zoomy_amrex.symsolver#
Driver of the symbolic solvers on AMReX: prints the C++ solver, builds it in the AMReX apptainer,
runs it on the mesh’s uniform Cartesian grid and reads the result back. Sits behind the C++ solver
template (zoomy_core.symsolver.backend_cxx) and in front of Source/symsolver.
Inside the AMReX image (zoomy-server’s amrex backend) the driver builds and runs natively, see
in_image. Binaries are cached in ZOOMY_AMREX_SYMCACHE, default <package>/../.symcache when
writable, else ~/.cache/zoomy/amrex_symcache (else the temp directory).
Module Contents#
Classes#
Builds, launches and reads back the AMReX C++ solver of a |
|
The explicit hyperbolic solver template on AMReX; its linear solves (Newton-Krylov of the implicit diffusion, finite-difference Jacobians) default to amrex::GMRES. |
|
The Chorin projection solver template on AMReX; the model is the triple |
Functions#
True when this process already runs where AMReX builds: |
|
The mesh’s uniform Cartesian grid (1-3-D) as a dict: |
|
BC branch of the x-lo, x-hi, y-lo, … sides (by outward normal; -1 on a periodic side) and the periodic flag per direction. |
|
The side ( |
|
LSQ topology and geometry ( |
|
Text table of the LSQ stencils and weights per cell class (distance to each side, up to the
stencil reach), read by |
|
The checkpoint directory |
|
The hypre install of the CPU or GPU build ( |
Data#
API#
- zoomy_amrex.symsolver.ROOT#
None
- zoomy_amrex.symsolver.SRC#
None
- zoomy_amrex.symsolver.CACHE#
‘_cache(…)’
- zoomy_amrex.symsolver.CONTAINERS#
‘Path(…)’
- zoomy_amrex.symsolver.SIF#
None
- zoomy_amrex.symsolver.HYPRE_VERSION#
‘3.2.0’
- zoomy_amrex.symsolver.HYPRE_CACHE#
‘Path(…)’
- zoomy_amrex.symsolver.HYPRE_SCRIPT#
None
- zoomy_amrex.symsolver.BUILD_CPUS#
‘_cpus(…)’
- zoomy_amrex.symsolver.RUN_CPUS#
‘_cpus(…)’
- zoomy_amrex.symsolver.APP#
(‘symsolver/symAmrex.cpp’, ‘symsolver/rt_amrex.H’, ‘symsolver/amr_amrex.H’, ‘UserFunctions.H’, ‘Zoom…
- zoomy_amrex.symsolver.in_image()#
True when this process already runs where AMReX builds:
ZOOMY_AMREX_IN_IMAGE(1 / 0) when set, else AMReX sources at$AMREX_HOMEand either an apptainer container around this process (APPTAINER_CONTAINER) or noapptainerto call. Then the build and the run are plain subprocesses; otherwise they go throughapptainer execofSIF.
- class zoomy_amrex.symsolver.AmrexDriver(**params)#
Bases:
param.ParameterizedBuilds, launches and reads back the AMReX C++ solver of a
backend_cxxtemplate: build tree, Cartesian case with LSQ tables and inputs, optional AMR levels,mpirun.References
Zhang et al. 2019, https://doi.org/10.21105/joss.01370
Berger, Oliger 1984, https://doi.org/10.1016/0021-9991(84)90073-1
Berger, Colella 1989, https://doi.org/10.1016/0021-9991(89)90035-1
Initialization
- ranks#
‘Integer(…)’
- gpu#
‘Boolean(…)’
- max_grid_size#
‘Integer(…)’
- tiny_profile#
‘Boolean(…)’
- build_only#
‘Boolean(…)’
- linear_solver#
‘OptionParam(…)’
- amr#
‘Dict(…)’
- build(nsm, dimension, classes=None)#
Print the solver, write the build tree and make it, cached by a hash of the sources. Called by
run.Args
classes: boundary-closure classes of the case (lsq_fit); without, no closure in the derivative aux.
Returns
Path of the binary.
- run(mesh, model, Q0, workdir, Qaux0=None, fine=())#
March
Q0(mesh order) totime_endand return(time, Q); snapshots, wall time and (AMR) per-level states stay inself.snapshots,self.wall,self.initialandself.levels.Args
fine: AMR only,[(mesh_l, Q0_l)]the initial state of level l on its refined domain (else interpolated).
Returns
(time, Q)withQon level 0 (the composite averaged down); the binary ifbuild_only.
- class zoomy_amrex.symsolver.SymbolicHyperbolicSolverAmrex(**params)#
Bases:
zoomy_amrex.symsolver.AmrexDriver,zoomy_core.symsolver.backend_cxx.CxxBackendThe explicit hyperbolic solver template on AMReX; its linear solves (Newton-Krylov of the implicit diffusion, finite-difference Jacobians) default to amrex::GMRES.
Initialization
- linear_solver#
‘OptionParam(…)’
- class zoomy_amrex.symsolver.SymbolicChorinSolverAmrex(**params)#
Bases:
zoomy_amrex.symsolver.AmrexDriver,zoomy_core.symsolver.backend_cxx.CxxChorinBackendThe Chorin projection solver template on AMReX; the model is the triple
(pred, press, corr).References
Chorin 1968, https://doi.org/10.1090/S0025-5718-1968-0242392-2
Initialization
- zoomy_amrex.symsolver.cartesian(mesh)#
The mesh’s uniform Cartesian grid (1-3-D) as a dict:
lo, hi, n, d, the grid order of the cells (x fastest) and each cell’s grid index. Anything but a full uniform grid raisesNotImplementedError.
- zoomy_amrex.symsolver.sides(mesh, nsm, dim)#
BC branch of the x-lo, x-hi, y-lo, … sides (by outward normal; -1 on a periodic side) and the periodic flag per direction.
- zoomy_amrex.symsolver.side_of(mesh, tag, dim)#
The side (
2 * axis + upper) of the boundary faces taggedtag.
- zoomy_amrex.symsolver.lsq_fit(nsm, systems, degree, grid, branch)#
LSQ topology and geometry (
lsq_gradQ; for degree >= 2 also the boundary closurelsq_closure) of a proxy mesh withgrid’s spacing, its sides carrying the case’s BC branches. Closure classes are renumbered by the kinds of the six sides, so a class has the same id on every proxy (grid size, AMR level) and inKernels.H.Args
systems: further systems the template differentiates besidesnsm.branch: BC branch per side (sides; -1: periodic, no closure).
Returns
dict
proxy, np, topo, geom, order, classes;classesmaps(owner, kind)(kind"state"or"reconstruction") to the class per row.References
Mavriplis 2003, https://doi.org/10.2514/6.2003-3986
- zoomy_amrex.symsolver.lsq_table(fit, grid, periodic, owner)#
Text table of the LSQ stencils and weights per cell class (distance to each side, up to the stencil reach), read by
zs::Mesh::load. Each class has the base list and one list per boundary-closure class; a periodic axis uses the interior class, its seam samples being halo cells.Args
fit: result oflsq_fit.owner: system whose reconstruction classes (the O2 gradient) follow the monomials.
Returns
The table as text.
References
Mavriplis 2003, https://doi.org/10.2514/6.2003-3986
- zoomy_amrex.symsolver.restart_dir(path)#
The checkpoint directory
chk<t>(ofio.save_state) atpath: itself or its latest.
- zoomy_amrex.symsolver.hypre_prefix(gpu)#
The hypre install of the CPU or GPU build (
~/.cache/zoomy/hypre-{cpu,cuda}-3.2.0), built first bycontainers/zoomy_amrex/build_hypre_cuda.shwhen missing.References
Falgout, Yang 2002, https://doi.org/10.1007/3-540-47789-6_66