Exemplo n.º 1
0
my_runs = basic_runner(\
            nproc = 1,\
            # Set the directory

            directory = 'MMS',\
            # Set the time domain

            nout     = 1,\
            timestep = 1,\
            # Set mms to true

            mms = True,\
            # Set the spatial domain

            nx = [4, 8, 16],\
            ny = [4, 8, 16],\
            nz = [4, 8, 16],\
            # Additional (put here to illustrate the sorting)

            series_add = [('cst','D_par',[1,2]), ('cst','D_perp',[0.5,1])],\
            # Since we would like to do a MMS test, we would like to run
            # the runs in a particular order. In this example, we would
            # like to run all the possible spatial variables before
            # doing the test. Hence we would like the spatial domain
            # option to be the fastest varying.
            # Since we have put post_process_after_every_run = False in
            # the run function below, the processing function being
            # called when all possibilities of the fastest variable has
            # been run.









            sort_by = 'spatial_domain'\
            # Some additional sorting examples:
            #
            # This returns an error, stating the sorting possibilities
            # (which will depend on the member data of this object)
            # sort_by = 'uncomment_me'\
            #
            # In this example cst:D_par will be the fastest varying
            # variable, followed by the spatial_domain. The post
            # processing function will be called when all possibilities
            # of these variables has been run
            # sort_by = ['cst:D_par', 'spatial_domain']\
            )
Exemplo n.º 2
0
# With a few exceptions: All variables in the constructor can be given
# as an iterable When execute_runs is called, all combinations of the
# member data is going to be runned
my_runs = basic_runner(\
            # nx, ny and nz must be of the same size as they constitute
            # one "part" of the combination (i.e. there will be no
            # internal combination between the elements in nx, ny and
            # nz)




            nx         = (9, 18),\
            ny         = (6, 12),\
            nz         = (8, 16),\
            # nout and timestep must be of the same dimension for the
            # same reason as mention above


            nout       = (10,   11,    12),\
            timestep   = (0.01, 0.01, 0.01),\
            # The differencing option

            ddz_second = ('FFT','C2'),\
            # Additional options

            additional = [('cst','D_perp',[1, 2])]\
            )

# Execute all the runs
# 2 runs for each combination of nx, ny, nz
Exemplo n.º 3
0
#!/usr/bin/env python

"""Driver which runs 3d_diffusion with the options given in BOUT.inp"""

from bout_runners.bout_runners import basic_runner

# Create the instance
my_runs = basic_runner()

# Do the run
my_runs.execute_runs()
Exemplo n.º 4
0
from bout_runners.bout_runners import basic_runner

my_instance = basic_runner(\
                    nproc      = 1,\
                    directory  = 'data',\
                    solver     = ['cvode', 'ida'],\
                    grid_file  = ['conduct_grid.nc', 'lol.nc'],\
                    ddx_first  = ['C2', 'C4'],\
                    ddx_second = 'W3',\
                    ddx_upwind = ['U1', 'W3'],\
                    ddx_flux   = ['SPLIT', 'NND'],\
                    ddy_first  = 'C2',\
                    ddy_second = ['C4', 'W3'],\
                    ddy_upwind = 'W3',\
                    ddy_flux   = 'NND',\
                    ddz_first  = 'FFT',\
                    ddz_second = ['FFT', 'C2'],\
                    #ddz_upwind = 'U4',\
                    ddz_flux   = 'SPLIT',\
                    nout       = [0, 1],\
                    timestep   = [1, 2],\
                    MXG        = 1,\
                    MYG        = 1,\
                    # additional = ('test1','ok1',1),\
                    additional = [('test1','ok1',[1, 2]), ('test2','ok2',1)],\
                    restart    = 'overwrite',\
                    cpy_source = True)

my_instance.run()
my_runs = basic_runner(\
            nproc = 1,\
            # Set the directory
            directory = 'MMS',\
            # Set the time domain
            nout     = 1,\
            timestep = 1,\
            # Set mms to true
            mms = True,\
            # Set the spatial domain
            nx = [4, 8, 16],\
            ny = [4, 8, 16],\
            nz = [4, 8, 16],\
            # Additional (put here to illustrate the sorting)
            series_add = [('cst','D_par',[1,2]), ('cst','D_perp',[0.5,1])],\
            # Since we would like to do a MMS test, we would like to run
            # the runs in a particular order. In this example, we would
            # like to run all the possible spatial variables before
            # doing the test. Hence we would like the spatial domain
            # option to be the fastest varying.
            # Since we have put post_process_after_every_run = False in
            # the run function below, the processing function being
            # called when all possibilities of the fastest variable has
            # been run.
            sort_by = 'spatial_domain'\
            # Some additional sorting examples:
            #
            # This returns an error, stating the sorting possibilities
            # (which will depend on the member data of this object)
            # sort_by = 'uncomment_me'\
            #
            # In this example cst:D_par will be the fastest varying
            # variable, followed by the spatial_domain. The post
            # processing function will be called when all possibilities
            # of these variables has been run
            # sort_by = ['cst:D_par', 'spatial_domain']\
            )
Exemplo n.º 6
0
#!/usr/bin/env python
"""Driver which runs 3D_diffusion using grid files."""

from bout_runners.bout_runners import basic_runner
from grid_generator import generate_grid

# Generate a grid
generate_grid(file_name = "3D_diffusion_grid",\
              inp_path  = "data")

my_runs = basic_runner(\
            grid_file = "3D_diffusion_grid.nc",\
            # Copy the grid file

            cpy_grid = True,\
            # Set the flag in 3D_diffusion that a grid file will be
            # used


            additional = ('flags', 'use_grid', 'true')\
            )

my_runs.execute_runs()
Exemplo n.º 7
0
#!/usr/bin/env python

"""Driver which runs 3d_diffusion, and calls the function show_the_data when done"""

from post_processing_show_the_data import show_the_data
from bout_runners.bout_runners import basic_runner


my_runs = basic_runner()

# Put this in the post-processing function
my_runs.execute_runs(\
                     post_processing_function = show_the_data,\
                     # This function will be called every time after
                     # performing a run
                     post_process_after_every_run = True,\
                     # Below are the kwargs arguments being passed to
                     # show_the_data
                     t = slice(0,None),\
                     x = 1,\
                     y = slice(0,None),\
                     z = slice(0,None)\
                    )
my_runs = basic_runner(
    # Number of processors
    nproc=2,
    # Directory of the inp file
    directory="data",
    # Set the solver option
    solver="rk4",
    mms=False,
    atol=1.0e-8,
    rtol=1.0e-8,
    mxstep=10000000,
    # Spatial domain option
    nx=19,
    ny=17,
    nz=16,
    # These can be set if needed
    zperiod=None,
    zmin=None,
    zmax=None,
    # These are not set here, but the code handles them
    # internally
    dx=None,
    dy=None,
    dz=None,
    # The same as in BOUT.inp
    # (Setting them to a different value doesn't make much sense)
    MXG=1,
    MYG=1,
    # These can also be set
    ixseps1=None,
    ixseps2=None,
    jyseps1_1=None,
    jyseps1_2=None,
    jyseps2_1=None,
    jyseps2_2=None,
    symGlobX=None,
    symGlobY=None,
    # The differencing option
    ddx_first="C2",
    ddx_second="C2",
    ddx_upwind="U1",
    ddx_flux="SPLIT",
    ddy_first="C2",
    ddy_second="C2",
    ddy_upwind="U1",
    ddy_flux="SPLIT",
    ddz_first="FFT",
    ddz_second="FFT",
    ddz_upwind="U4",
    ddz_flux="SPLIT",
    # Temporal domain option
    nout=11,
    timestep=0.02,
    # Additional options
    # (An example ofadditional options run in series is found in
    #  6a-run_with_MMS_post_processing_specify_numbers.py)
    # tuple[0] - section name
    # tuple[1] - variable name for the section
    # tuple[2] - value of the variable name in the section
    additional=[("cst", "D_perp", 5), ("cst", "D_par", 0.5)],
    # Can set this to overwrite or append
    restart=None,
    # Will copy the source file
    cpy_source=True,
    # Will remake the file
    make=True,
    # Code will return an error if False, due to the mismatch
    # between nx, ny and nproc
    allow_size_modification=True,
)
Exemplo n.º 9
0
my_runs = basic_runner(\
            # Number of processors

            nproc      = 2,\
            # Directory of the inp file

            directory  = 'data',\
            # Set the solver option

            solver     = 'rk4',\
            mms        = False,\
            atol       = 1.0e-8,\
            rtol       = 1.0e-8,\
            mxstep     = 10000000,\
            # Spatial domain option

            nx         = 19,\
            ny         = 17,\
            nz         = 16,\
            # These can be set if needed

            zperiod    = None,\
            zmin       = None,\
            zmax       = None,\
            # These are not set here, but the code handles them
            # internally


            dx         = None,\
            dy         = None,\
            dz         = None,\
            # The same as in BOUT.inp
            # (Setting them to a different value doesn't make much sense)


            MXG        = 1,\
            MYG        = 1,\
            # These can also be set

            ixseps1    = None,\
            ixseps2    = None,\
            jyseps1_1  = None,\
            jyseps1_2  = None,\
            jyseps2_1  = None,\
            jyseps2_2  = None,\
            symGlobX   = None,\
            symGlobY   = None,\
            # The differencing option

            ddx_first  = 'C2',\
            ddx_second = 'C2',\
            ddx_upwind = 'U1',\
            ddx_flux   = 'SPLIT',\
            ddy_first  = 'C2',\
            ddy_second = 'C2',\
            ddy_upwind = 'U1',\
            ddy_flux   = 'SPLIT',\
            ddz_first  = 'FFT',\
            ddz_second = 'FFT',\
            ddz_upwind = 'U4',\
            ddz_flux   = 'SPLIT',\
            # Temporal domain option

            nout       = 11,\
            timestep   = 0.02,\
            # Additional options
            # (An example ofadditional options run in series is found in
            #  6a-run_with_MMS_post_processing_specify_numbers.py)
            # tuple[0] - section name
            # tuple[1] - variable name for the section
            # tuple[2] - value of the variable name in the section






            additional = [('cst','D_perp',5), ('cst', 'D_par', 0.5)],\
            # Can set this to overwrite or append

            restart    = None,\
            # Will copy the source file

            cpy_source = True,\
            # Will remake the file

            make       = True,\
            # Code will return an error if False, due to the mismatch
            # between nx, ny and nproc


            allow_size_modification = True)
Exemplo n.º 10
0
#!/usr/bin/env python
"""Driver which resizes the grid after restart"""

from post_processing_show_the_data import show_the_data
from bout_runners.bout_runners import basic_runner

# Initial run
# ===========================================================================
init_run = basic_runner(nz=8)

dmp_folder, _ =\
        init_run.execute_runs(\
                              post_processing_function = show_the_data,\
                              # This function will be called every time after
                              # performing a run


                              post_process_after_every_run = True,\
                              # Below are the kwargs arguments being passed to
                              # show_the_data


                              t = slice(0,None),\
                              x = 1,\
                              y = slice(0,None),\
                              z = slice(0,None)\
                             )
# ===========================================================================

# Restart the run after resizing the grid
# ===========================================================================
#!/usr/bin/env python

"""Driver which runs 3D_diffusion using grid files."""

from bout_runners.bout_runners import basic_runner
from grid_generator import generate_grid

# Generate a grid
generate_grid(file_name = "3D_diffusion_grid",\
              inp_path  = "data")

my_runs = basic_runner(\
            grid_file = "3D_diffusion_grid.nc",\
            # Copy the grid file
            cpy_grid = True,\
            # Set the flag in 3D_diffusion that a grid file will be
            # used
            additional = ('flags', 'use_grid', 'true')\
            )

my_runs.execute_runs()
the input. """

from bout_runners.bout_runners import basic_runner

# With a few exceptions: All variables in the constructor can be given
# as an iterable When execute_runs is called, all combinations of the
# member data is going to be runned
my_runs = basic_runner(\
            # nx, ny and nz must be of the same size as they constitute
            # one "part" of the combination (i.e. there will be no
            # internal combination between the elements in nx, ny and
            # nz)
            nx         = (9, 18),\
            ny         = (6, 12),\
            nz         = (8, 16),\
            # nout and timestep must be of the same dimension for the
            # same reason as mention above
            nout       = (10,   11,    12),\
            timestep   = (0.01, 0.01, 0.01),\
            # The differencing option
            ddz_second = ('FFT','C2'),\
            # Additional options
            additional = [('cst','D_perp',[1, 2])]\
            )

# Execute all the runs
# 2 runs for each combination of nx, ny, nz
# 3 runs for each combination of nout and timestep
# 2 runs for each combination in ddz_second
# 2 runs for each combination of cst:const:value
# In total: 24 runs
Exemplo n.º 13
0
    grid_files.append(file_name + '.nc')

my_runs = basic_runner(\
            nproc     = 1,\
            # Set the directory

            directory  = 'MMS',\
            # Set the time domain

            nout       = 1,\
            timestep   = 1,\
            # Set mms to true

            mms        = True,\
            # Set the spatial domain

            grid_file  = grid_files,\
            # Set the flag in 3D_diffusion that a grid file will be
            # used


            additional = ('flags','use_grid','true'),\
            # Copy the grid file

            cpy_grid   = True,\
            # Sort the runs by the spatial domain

            sort_by    = 'grid_file'
            )

# Put this in the post-processing function
Exemplo n.º 14
0
        value_start = hits[0] + len(scan_parameter) + 1
        # Here we assume that the value is not separated by an
        # underscore
        values[scan_parameter] = dmp_folder[value_start:].split("_")[0]

    # Insert the values
    restart_from = restart_template.format(values)

    return restart_from


#}}}

# Initial runs
# ===========================================================================
init_run = basic_runner(additional=scan)

dmp_folder, _ =\
        init_run.execute_runs(\
                              post_processing_function = show_the_data,\
                              # This function will be called every time after
                              # performing a run


                              post_process_after_every_run = True,\
                              # Below are the kwargs arguments being passed to
                              # show_the_data


                              t = slice(0,None),\
                              x = 1,\
Exemplo n.º 15
0
        # Choose the first hit to get the value from (again we assume
        # that the value does not contain a _)
        value_start = hits[0] + len(scan_parameter) + 1
        # Here we assume that the value is not separated by an
        # underscore
        values[scan_parameter] = dmp_folder[value_start:].split("_")[0]

    # Insert the values
    restart_from = restart_template.format(values)

    return restart_from
#}}}

# Initial runs
# ===========================================================================
init_run = basic_runner(additional = scan)

dmp_folder, _ =\
        init_run.execute_runs(\
                              post_processing_function = show_the_data,\
                              # This function will be called every time after
                              # performing a run
                              post_process_after_every_run = True,\
                              # Below are the kwargs arguments being passed to
                              # show_the_data
                              t = slice(0,None),\
                              x = 1,\
                              y = slice(0,None),\
                              z = slice(0,None)\
                             )
Exemplo n.º 16
0
#!/usr/bin/env python

"""Driver which resizes the grid after restart"""

from post_processing_show_the_data import show_the_data
from bout_runners.bout_runners import basic_runner

# Initial run
# ===========================================================================
init_run = basic_runner(nz = 8)

dmp_folder, _ =\
        init_run.execute_runs(\
                              post_processing_function = show_the_data,\
                              # This function will be called every time after
                              # performing a run
                              post_process_after_every_run = True,\
                              # Below are the kwargs arguments being passed to
                              # show_the_data
                              t = slice(0,None),\
                              x = 1,\
                              y = slice(0,None),\
                              z = slice(0,None)\
                             )
# ===========================================================================


# Restart the run after resizing the grid
# ===========================================================================
restart_run = basic_runner(restart      = "overwrite"  ,\
                           restart_from = dmp_folder[0],\
Exemplo n.º 17
0
# Additional options
remove_old = False
directory = "gaussianWSinAndParabola"
make = False
nproc = 4
# =============================================================================

# Create the runner
# =============================================================================
my_runs = basic_runner(\
            directory  = directory ,\
            nproc      = nproc ,\
            # Spatial domain

            nx         = nx,\
            # Copy the source file

            cpy_source = True  ,\
            make       = make  ,\
            # Sort the runs by the spatial domain

            sort_by    = 'spatial_domain'
            )
# =============================================================================

# Perform the run
# =============================================================================
my_runs.execute_runs(\
                     remove_old = remove_old,\
                     # Set the proper directory

                     post_processing_function = perform_MES_test,\
                  nz        = grid_number,\
                  inp_path  = 'MMS'      ,\
                  file_name = file_name)
    # Append the grid_files list
    grid_files.append(file_name + '.nc')

my_runs = basic_runner(\
            nproc     = 1,\
            # Set the directory
            directory  = 'MMS',\
            # Set the time domain
            nout       = 1,\
            timestep   = 1,\
            # Set mms to true
            mms        = True,\
            # Set the spatial domain
            grid_file  = grid_files,\
            # Set the flag in 3D_diffusion that a grid file will be
            # used
            additional = ('flags','use_grid','true'),\
            # Copy the grid file
            cpy_grid   = True,\
            # Sort the runs by the spatial domain
            sort_by    = 'grid_file'
            )

# Put this in the post-processing function
my_runs.execute_runs(\
                     post_processing_function = perform_MMS_test,\
                     # As we need several runs in order to perform the
                     # MMS test, this needs to be false