create block


The page defines the application programing interface specification for the block operation.



The command line interface for the block catagory of operations is:

usage: flashkit create block [<opt>...] [<flg>...]
Create an initial simulation flow field (block) hdf5 file.

options:
-D, --ndim     INT   Number of simulation dimensions (i.e., 2 or 3); defaults to 2.
-X, --nxb      INT   Number of grid points per block in the i direction; defaults to 64.
-Y, --nyb      INT   Number of grid points per block in the j direction; defaults to 64.
-Z, --nzb      INT   Number of grid points per block in the k direction; defaults to 64.
-i, --iprocs   INT   Number of blocks in the i direction; defaults to 1.
-j, --jprocs   INT   Number of blocks in the j direction; defaults to 1.
-k, --kprocs   INT   Number of blocks in the k direction; defaults to 1.
-l, --fields   DICT  Key/value pairs for fields (e.g., <temp=center,...>); defaults to 
                         {'velx': 'facex', 'vely': 'facey', 'velz': 'facez', 'temp': 'center'}.
-m, --fmethod  DICT  Key/value pairs for flow initialization (e.g., <temp=constant,...>) used for each flow field.
-o, --fparam   DICT  Key/value pairs for paramaters (e.g., <temp={const=0.5,...},...>) used for each field method.
-p, --path     PATH  Path to source files used in some initialization methods (e.g., python); defaults to cwd.
-d, --dest     PATH  Path to intial block hdf5 file; defaults to cwd.

flags:
-F, --nofile         Do not write the calculated coordinates to file. 
-R, --result         Return the calculated fields by block on root. 
-I, --ignore         Ignore configuration file provided arguments, options, and flags.
-O, --options        Show the available options (i.e., defaults and config file format) and exit.
-h, --help           Show this message and exit.

note:  This function reads grid data from an hdf5 file (i.e., must run <flashkit create grid> first); if you receive a cryptic
       error message (e.g., ValueError about inhomogenious shape) make sure you have rerun the create grid command with the 
       correct and compatible options to what you are intending for the create block command.

Please consult the discussion on command line syntax for help in formating the above options (e.g., LIST or DICT).



The python interface for the block operation is accessed with the following code:

from flashkit import flash
...
flash.create.block(options=value, flags=True, ...)

The python interface specification for block is as follows:

block(**arguments: Any) None

Python application interface for creating an initial block file from command line or python code.

This method creates an HDF5 file associated with the desired intial flow specification (for each needed computational field), suitable for input by the FLASH application at runtime.

Keyword Arguments
  • ndim (int) – Number of simulation dimensions (i.e., 2 or 3).

  • nxb (int) – Number of grid points per block in the i direction.

  • nyb (int) – Number of grid points per block in the j direction.

  • nzb (int) – Number of grid points per block in the k direction.

  • iprocs (int) – Number of blocks in the i direction.

  • jprocs (int) – Number of blocks in the j direction.

  • kprocs (int) – Number of blocks in the k direction.

  • fields (dict) – Key/value pairs for fields (e.g., {‘temp’: ‘center’, …})

  • fmethod (dict) – Key/value pairs for flow initialization (e.g., {‘temp’: ‘constant’, …}).

  • fparam (dict) – Key/value pairs for paramaters (e.g., {‘temp’: {‘const’: 0.5, …}, …}) used for each field method.

  • path (str) – Path to source files used in some initialization methods (e.g., python).

  • dest (str) – Path to initial block hdf5 file.

  • ignore (bool) – Ignore configuration file provided arguments, options, and flags.

  • result (bool) – Return the calculated fields by block on root.

  • nofile (bool) – Do not write the calculated fields by block to file.

Note

By default this function reads the grid data from the hdf5 file (i.e., must run create.grid() first); optionally you can provide the result from grid creation directly by using an optional keyword – coords: (ndarray, …).



The complete specification of library defaults values (as shown above) and mappings is as follows:

The following library defaults are provided for flashkit create block:

Options          Default Values
-------          --------------
fields           {'velx': 'facex', 'vely': 'facey', 'velz': 'facez', 'temp': 'center'}
iprocs           1
jprocs           1
kprocs           1
dest             --
path             --
nofile           False
result           False
ndim             2
nxb              64
nyb              64
nzb              64


The following outlines the general section options, which can be mapped
in the configuration file, that are provided for flashkit create block:

Options          flash.toml Sections and Options
-------          -------------------------------
iprocs           [general.mesh]
                 iprocs = ...

jprocs           [general.mesh]
                 jprocs = ...

kprocs           [general.mesh]
                 kprocs = ...

dest             [general.paths]
                 working = ...

path             [general.paths]
                 working = ...

nofile           [general.pipes]
                 nofile = ...

result           [general.pipes]
                 result = ...

ndim             [general.space]
                 ndim = ...

nxb              [general.space]
                 nxb = ...

nyb              [general.space]
                 nyb = ...

nzb              [general.space]
                 nzb = ...

Please consult the tutorial discussion on configuration file formating for help in specifying the above options in a flash.toml file and what mapping general options are, as well as the full specification on FlashKit library options.