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 = (5, 8, 16),\
            ny = (5, 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')\
            )
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 = (5, 8, 16),\
            ny = (5, 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')\
            )
#!/usr/bin/env python
"""Driver which runs 3d_diffusion, and calls the function show_the_data when done"""

from pre_and_post_processing.post_processing_show_the_data import show_the_data
from 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)\
                    )
#!/usr/bin/env python

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

from pre_and_post_processing.post_processing_show_the_data import show_the_data
from 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)\
                    )
Beispiel #5
0
"""Driver which restarts a scan, given a restart function"""

from pre_and_post_processing.post_processing_show_the_data import show_the_data
from pre_and_post_processing.restart_from_func import restart_from_func
from bout_runners import basic_runner

scan = (("cst", "D_perp", (1.0,5.5)),\
        ("cst", "D_par",  (1.5,2.5))
       )

# Given that the runs has already been performed
only_post_process = False

# 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,\
Beispiel #6
0
# as an iterable.
# When execute_runs is called, bout_runners will run all combinations of
# the member data
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
Beispiel #7
0
#!/usr/bin/env python
"""Driver which resizes the grid after restart"""

from pre_and_post_processing.post_processing_show_the_data import show_the_data
from 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
# ===========================================================================
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)
#!/usr/bin/env python

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

from bout_runners import basic_runner
from pre_and_post_processing.grid_generator import generate_grid
import os

# Generate a grid
file_name = os.path.join("grid_files","3D_diffusion_grid.nc")
generate_grid(file_name = file_name,\
              inp_path  = "data")

my_runs = basic_runner(\
            grid_file = file_name,\
            # 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()
Beispiel #10
0
#!/usr/bin/env python

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

from pre_and_post_processing.post_processing_show_the_data import show_the_data
from bout_runners import basic_runner

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

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],\
Beispiel #11
0
from postProcess.checkModes import checkModes as postProcess

# The options for the run
# =============================================================================
# Additional options
remove_old = True
make = True
nproc = 4
# =============================================================================

# Create the runner
# =============================================================================
my_runs = basic_runner(\
            nproc      = nproc ,\
            # Copy the source file

            cpy_source = True  ,\
            make       = make  ,\
            )
# =============================================================================

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

                     post_processing_function = postProcess,\
                    )
# =============================================================================
from 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, bout_runners will run all combinations of
# the member data
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
    grid_files.append(file_name)

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 = 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)
Beispiel #15
0
#!/usr/bin/env python
"""Driver which runs 3D_diffusion using grid files."""

from bout_runners import basic_runner
from pre_and_post_processing.grid_generator import generate_grid
import os

# Generate a grid
file_name = os.path.join("grid_files", "3D_diffusion_grid.nc")
generate_grid(file_name = file_name,\
              inp_path  = "data")

my_runs = basic_runner(\
            grid_file = file_name,\
            # 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()