pencil.sim.remesh

Remesh mature simulation snapshot with [nx,ny,nz] dimensions onto new simulation with new grid dimensions and optionally alternate cpu layout copying the base simulation files, existing start output files.

uses: local_remesh to apply the interpolation onto a variable array get_dstgrid to derive the new grid layout src2dst_remesh to create the new simulation object and files

Attributes

lnml

Functions

local_remesh(var, xsrc, ysrc, zsrc, xdst, ydst, zdst)

local_remesh(var, xsrc, ysrc, zsrc, xdst, ydst, zdst, quiet=True, kind="linear")

get_dstgrid(srch5, srcsim, dsth5, dstsim[, ncpus, ...])

get_dstgrid(srch5, srcsim, dsth5, dstsim, ncpus=[1,1,1], multxyz=[2,2,2],

src2dst_remesh([src, dst, h5in, h5out, nxyz, multxyz, ...])

src2dst_remesh(src=None, dst=None, h5in='var.h5', h5out='var.h5', nxyz=None,

Module Contents

pencil.sim.remesh.lnml = True
pencil.sim.remesh.local_remesh(var, xsrc, ysrc, zsrc, xdst, ydst, zdst, quiet=True, kind='linear')

local_remesh(var, xsrc, ysrc, zsrc, xdst, ydst, zdst, quiet=True, kind=”linear”)

Parameters:
  • var (np.array) – Snapshot scalar numpy array of shape [mz, my, mx].

  • xsrc (ndarrays) – Grid x, y, z arrays from source simulation.

  • ysrc (ndarrays) – Grid x, y, z arrays from source simulation.

  • zsrc (ndarrays) – Grid x, y, z arrays from source simulation.

  • xdst (ndarrays) – Grid x, y, z arrays for destination simulation.

  • ydst (ndarrays) – Grid x, y, z arrays for destination simulation.

  • zdst (ndarrays) – Grid x, y, z arrays for destination simulation.

  • kind (string) – interpolation method

  • quiet (bool) – Flag for switching of output.

  • Useage (interpolate a 3D data array of arbitrary shape onto an equivalent) – grid of alternate shape

pencil.sim.remesh.get_dstgrid(srch5, srcsim, dsth5, dstsim, ncpus=[1, 1, 1], nxyz=None, multxyz=[2, 2, 2], fracxyz=[1, 1, 1], srcghost=3, dstghost=3, dtype=np.float64, lsymmetric=True, quiet=True, dstprecision=[b'D'], srcchunks=None)
get_dstgrid(srch5, srcsim, dsth5, dstsim, ncpus=[1,1,1], multxyz=[2,2,2],

nxyz=None, fracxyz=[1,1,1], srcghost=3, dstghost=3, dtype=np.float64, lsymmetric=True, quiet=True, dstprecision=[b”D”], srchunks=srchunks)

Parameters:
  • srch5 (obj) – hdf5 object from source simulation.

  • srcsim (simulation object) – src simulation object

  • dsth5 (obj) – hdf5 object for destination simulation data.

  • dstsim (simulation object) – dst simulation object

  • ncpus (int) – Array of nprocx, nprocy, and nprocz to apply for new simulation.

  • nxyz (bool) – integer list of lenght 3 with new size of grid excluding ghosts.

  • multxyz (list) – Factors by which to multiply old sim dimensions yxz order.

  • fracxyz (list) – Factors by which to divide old sim dimensions yxz order.

  • srcghost (int) – Number of ghost zones from the source order of accuracy (mx-nx)/2

  • dstghost (int) – Number of ghost zones for the destination order of accuracy (mx-nx)/2

  • dtype ('string') – Precision used in destination simulation. Default double.

  • lsymmetric (bool) – Option to make non-periodic grid symmetric about old sim centre. Otherwise the lower boundary is retained from old sim grid.

  • quiet (bool) – Flag for switching of output.

  • dstprecision – floating point precision of new simulation grid.

  • srcchunks (bool) – list of index limits [l[0]:l[1],m[0]:m[1],n[0]:n[1]] for subdomain remesh

pencil.sim.remesh.src2dst_remesh(src=None, dst=None, h5in='var.h5', h5out='var.h5', nxyz=None, multxyz=[2, 2, 2], fracxyz=[1, 1, 1], srcchunks=None, srcghost=3, dstghost=3, srcdatadir='data/allprocs', dstdatadir='data/allprocs', dstprecision=[b'D'], lsymmetric=True, quiet=True, kind='linear', check_grid=True, optionals=True, nmin=32, rename_submit_script=False, MBmin=64.0, ncpus=[1, 1, 1], start_optionals=False, hostfile=None, submit_new=False, chunksize=5000.0, lfs=False, MB=32, count=1, size=1, rank=0, comm=None, farray=None, index_farray=None, datasets='all', remesh=True, newtime=None)
src2dst_remesh(src=None, dst=None, h5in=’var.h5’, h5out=’var.h5’, nxyz=None,

multxyz=[2, 2, 2], fracxyz=[1, 1, 1], srcchunks=None, srcghost=3, dstghost=3, srcdatadir=’data/allprocs’, dstdatadir=’data/allprocs’, dstprecision=[b’D’], lsymmetric=True, quiet=True, kind=”linear”, check_grid=True, OVERWRITE=False, optionals=True, nmin=32, rename_submit_script=False, MBmin=5.0, ncpus=[1, 1, 1], start_optionals=False, hostfile=None, submit_new=False, chunksize=1000.0, lfs=False, MB=1, count=1, size=1, rank=0, comm=None, farray=None, index_farray=None, datasets=’all’, remesh=True)

Parameters:
  • src (string) – Source relative or absolute path to source simulation.

  • dst (string) – Destination relative or absolute path to destination simulation.

  • h5in (string) – Source simulation data file to be copied and remeshed.

  • h5out (string) – Destination simulation file to be written.

  • nxyz (list) – If not None a list of 3 integers [nx, ny, nz] defining the size of the destination domain

  • multxyz (list) – Factors by which to multiply old sim dimensions xyz order.

  • fracxyz (list) – Factors by which to divide old sim dimensions xyz order.

  • srcghost (int) – Number of ghost zones from the source order of accuracy (mx-nx)/2.

  • dstghost (int) – Number of ghost zones for the destination order of accuracy (mx-nx)/2.

  • srcdatadir (string) – Path from source simulation directory to data.

  • dstdatadir – Path from destination simulation directory to data.

  • dstprecision (string) – Floating point precision settings [b’S’] or [b’D’].

  • lsymmetric (bool) – Option to make non-periodic grid symmetric about old sim centre. Otherwise the lower boundary is retained from old sim grid.

  • quiet (bool) – Flag for switching of output.

  • check_grid (bool) – Flag to run check on grid and cpu layout before executing remesh.

  • OVERWRITE (bool) – Flag to overwrite existing simulation directory and filesin dst.

  • optionals (bool) – Copy simulation files with True or specify list of names (string) for additional files from src sim directory.

  • nmin (int) – Minimum length along coordinate after splitting by proc.

  • rename_submit_script (bool) – Edit lines in submission files vcopied from src to dst. Not yet operational.

  • MBmin (float) – Minimum size in MB of data on a sinlge proc pf ncpus total processes.

  • ncpus (ndarray) – Array of nprocx, nprocy, and nprocz to apply for new simulation.

  • start_optionals (bool) – Copy simulation files output by start.x with True or specify list of names (string) for additional files from src sim data directory.

  • hostfile (string) – Specify name of host config file argument in pc_build. Not yet operational.

  • submit_new (bool) – Execute changes to submission files, compile and run simulation. Not yet operational.

  • chunksize (float) – Size in megabytes of snapshot variable before chunked remesh is used.

  • lfs (bool) – Flag to set the striping for large file sizes to improve IO efficiency.

  • MB (float) – Size of data to write contiguously before moving to new OST on lustre.

  • count (int) – Number of OSTs across which the data will be shared for IO operations.

  • size (int) – Number of MPI processes

  • rank (int) – ID of processor

  • comm – MPI library calls

  • farray (string list) – Select subset of the farray from src.

  • index_farray (integer list) – set of index at which interpolation shall start

  • datasets (string) – “all” default to interpolate full farray, or specify selection

  • remesh (bool) – remesh or just copy