create grid


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



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

usage: flashkit create grid [<opt>...] [<flg>...]
Create an initial simulation domain (grid) 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.
-x, --xrange   LIST  Bounding points (e.g., <0.0,1.0>) for i direction; defaults to [0.0, 1.0].
-y, --yrange   LIST  Bounding points (e.g., <0.0,1.0>) for j direction; defaults to [0.0, 1.0].
-z, --zrange   LIST  Bounding points (e.g., <0.0,1.0>) for k direction; defaults to [0.0, 1.0].
-B, --bndbox   LIST  Bounding box pairs (e.g., <0.0,1.0,...>) for each of i,j,k directions.
-a, --xmethod  STR   Stretching method for grid points in the i directions; defaults to uniform.
-b, --ymethod  STR   Stretching method for grid points in the j directions; defaults to uniform.
-c, --zmethod  STR   Stretching method for grid points in the k directions; defaults to uniform.
-q, --xparam   DICT  Key/value pairs for paramaters (e.g., <alpha=0.5,...>) used for i direction method.
-r, --yparam   DICT  Key/value pairs for paramaters (e.g., <alpha=0.5,...>) used for j direction method.
-s, --zparam   DICT  Key/value pairs for paramaters (e.g., <alpha=0.5,...>) used for k direction method.
-p, --path     PATH  Path to source files used in some streching methods (e.g., ascii); defaults to cwd.
-d, --dest     PATH  Path to intial grid hdf5 file; defaults to cwd.

flags:
-F, --nofile         Do not write the calculated coordinates to file. 
-R, --result         Return the calculated coordinates. 
-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.

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 grid operation is accessed with the following code:

from flashkit import flash
...
flash.create.grid(options=value, flag=True, ...)

The python interface specification for grid is as follows:

grid(**arguments: Any) None

Python application interface for creating a initial grid file from command line or python code.

This method creates an HDF5 file associated with the desired spacial grid specification (on a global basis using the face locations), 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.

  • xrange (list) – Bounding points (e.g., [0.0, 1.0]) for i direction.

  • yrange (list) – Bounding points (e.g., [0.0, 1.0]) for j direction.

  • zrange (list) – Bounding points (e.g., [0.0, 1.0]) for k direction.

  • bndbox (list) – Bounding box pairs (e.g., [0.0, 1.0, …]) for each of i,j,k directions.

  • xmethod (str) – Stretching method for grid points in the i directions.

  • ymethod (str) – Stretching method for grid points in the j directions.

  • zmethod (str) – Stretching method for grid points in the k directions.

  • xparam (dict) – Key/value pairs for paramaters (e.g., {‘alpha’: 0.5 …}) used for i direction method.

  • yparam (dict) – Key/value pairs for paramaters (e.g., {‘alpha’: 0.5 …}) used for j direction method.

  • zparam (dict) – Key/value pairs for paramaters (e.g., {‘alpha’: 0.5 …}) used for k direction method.

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

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

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

  • result (bool) – Return the calculated coordinates.

  • nofile (bool) – Do not write the calculated coordinates to file.



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

The following library defaults are provided for flashkit create grid:

Options          Default Values
-------          --------------
xmethod          uniform
ymethod          uniform
zmethod          uniform
iprocs           1
jprocs           1
kprocs           1
dest             --
path             --
nofile           False
result           False
ndim             2
nxb              64
nyb              64
nzb              64
xrange           [0.0, 1.0]
yrange           [0.0, 1.0]
zrange           [0.0, 1.0]


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

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 = ...

xrange           [general.space]
                 xrange = ...

yrange           [general.space]
                 yrange = ...

zrange           [general.space]
                 zrange = ...

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.