Пример #1
0
    def __call__(self, t, x, profiles, HCoeffsTurb):
        #n = profiles['default']
        # Define the contributions to the H coefficients for the Shestakov Problem
        H1 = np.ones_like(x)
        H7 = shestakov_nonlinear_diffusion.H7contrib_Source(x)

        HCoeffs = tango.multifield.HCoefficients(H1=H1, H7=H7)
        HCoeffs = HCoeffs + HCoeffsTurb

        return HCoeffs


#==============================================================================
#  MAIN STARTS HERE
#==============================================================================
tlog.setup()

tlog.info("Initializing...")
L, N, dx, x, nL, n = initialize_shestakov_problem()
maxIterations, lmParams, tol = initialize_parameters()
fluxModel = shestakov_nonlinear_diffusion.AnalyticFluxModel(dx)

label = 'n'
turbHandler = tango.lodestro_method.TurbulenceHandler(dx, x, fluxModel)

compute_all_H_density = ComputeAllH()
lodestroMethod = tango.lodestro_method.lm(lmParams['EWMAParamTurbFlux'],
                                          lmParams['EWMAParamProfile'],
                                          lmParams['thetaParams'])
field0 = tango.multifield.Field(label=label,
                                rightBC=nL,
Пример #2
0
not the same, where the turbulent flux model has a buffer zone, and there is noise in the turbulent flux.

This example is similar to buffer_zone_and_extrapolation.py, but with noise added.  This example shows that
convergence can be achieved in the Shestakov problem when both complications of noise and a buffer zone are
present.
"""

from __future__ import division, absolute_import
import numpy as np
import matplotlib.pyplot as plt
import h5py

from tango.extras import shestakov_nonlinear_diffusion, bufferzone, noisyflux
import tango
import tango.tango_logging as tlog
tlog.setup(parallel=False, rank=0, level=tlog.INFO)

def initialize_shestakov_problem():
    # Problem Setup
    L = 1           # size of domain
    N = 300         # number of spatial grid points
    dx = L / (N-1)  # spatial grid size
    x = np.arange(N)*dx # location corresponding to grid points j=0, ..., N-1
    nL = 0.6           # right boundary condition
    n_initialcondition = 1 - 0.5*x
    return (L, N, dx, x, nL, n_initialcondition)

def initialize_parameters():
    maxIterations = 2000
    thetaparams = {'Dmin': 1e-5,
                   'Dmax': 1e13,
Пример #3
0
          solver            tango Solver (object)
        """
        iterationNumber = solver.l
        if iterationNumber == 50:
            self.turbhandler.set_ewma_params(0.1, 0.1)
            # run for 2.5/EWMA = 25 iterations
        if iterationNumber == 75:
            self.turbhandler.set_ewam_params(0.03, 0.03)
            # run for 2.5/EWMA = 83 iterations


# ************************************************** #
####              START OF MAIN PROGRAM           ####
# ************************************************** #
MPIrank = gene_tango.init_mpi()
tlog.setup(True, MPIrank, tlog.DEBUG)
(L, rTango, pressureRightBC, pressureICTango, maxIterations, tol,
 geneFluxModel, turbhandler, compute_all_H, t_array) = problem_setup()

# seed the EWMA for the turbulent heat flux
heatFluxSeed = read_seed_turb_flux()
turbhandler.seed_EWMA_turb_flux(heatFluxSeed)

# set up FileHandlers
#  GENE output to save periodically.  For list of available, see handlers.py
diagdir = DIAGDIR
f1HistoryHandler = tango.handlers.SaveGeneOutputHandler('checkpoint_000',
                                                        iterationInterval=2,
                                                        diagdir=diagdir)

geneFilesToSave = [
Пример #4
0
This example is similar to buffer_zone_and_extrapolation.py, but with noise added.  This example shows that
convergence can be achieved in the Shestakov problem when both complications of noise and a buffer zone are
present.
"""

from __future__ import division, absolute_import
import numpy as np

from tango.extras import shestakov_nonlinear_diffusion, bufferzone, noisyflux
import tango as tng
import matplotlib.pyplot as plt

from tango import analysis
import tango.tango_logging as tlog
tlog.setup(False, 0, tlog.INFO)  # when in a serial environment


def initialize_shestakov_problem():
    # Problem Setup
    L = 1  # size of domain
    N = 300  # number of spatial grid points
    dx = L / (N - 1)  # spatial grid size
    x = np.arange(
        N) * dx  # location corresponding to grid points j=0, ..., N-1
    nL = 0.6  # right boundary condition
    n_initialcondition = 1 - 0.5 * x
    return (L, N, dx, x, nL, n_initialcondition)


def initialize_parameters():