zoomy_foam.symsolver

zoomy_foam.symsolver#

Foam driver of the symbolic solvers: prints the C++ solver, builds it with wmake in the OpenFOAM apptainer (inside the image: directly, zoomy_foam._pipeline.in_image), runs the case. Sits at the end of Model -> SystemModel -> NumericalSystemModel -> C++ template -> foam runtime (symsolver/rt.H).

Module Contents#

Classes#

Decomposition

decomposePar’s method for an MPI run.

FoamDriver

Foam runtime of a C++ solver backend (zoomy_core.symsolver.backend_cxx): build tree, case, launch, read-back.

SymbolicHyperbolicSolverFoam

The explicit hyperbolic template on foam: time, Q = solver.run(mesh, nsm, Q0, workdir).

SymbolicChorinSolverFoam

The Chorin projection template on foam, run with (pred, press, corr) in place of nsm.

Functions#

hypre_prefix

The CPU hypre install symFoam links (~/.cache/zoomy/hypre-cpu-3.2.0, or ZOOMY_HYPRE_DIR), built first by containers/zoomy_amrex/build_hypre_cuda.sh cpu when missing.

restart_state

The restart state (base, name, time) at path: a time directory of io.save_state (<base>/[processor<k>/]<name>), or a case / checkpoint directory (its latest).

Data#

API#

zoomy_foam.symsolver.APP#

None

zoomy_foam.symsolver.SCHEMES = <Multiline-String>#
zoomy_foam.symsolver.PRECICE#

‘Path(…)’

zoomy_foam.symsolver.HYPRE_VERSION#

‘3.2.0’

zoomy_foam.symsolver.HYPRE_CACHE#

‘Path(…)’

zoomy_foam.symsolver.HYPRE_SCRIPT#

None

class zoomy_foam.symsolver.Decomposition#

Bases: zoomy_core.misc.options.Option

decomposePar’s method for an MPI run.

Initialization

Initialize self. See help(type(self)) for accurate signature.

scotch#

‘scotch’

simple#

‘simple’

class zoomy_foam.symsolver.FoamDriver(**params)#

Bases: param.Parameterized

Foam runtime of a C++ solver backend (zoomy_core.symsolver.backend_cxx): build tree, case, launch, read-back.

References

  • Weller et al. 1998, https://doi.org/10.1063/1.168744

Initialization

nprocs#

‘Integer(…)’

decomposition#

‘OptionParam(…)’

build(nsm, dimension, topo=None)#

Print the solver, write the build tree and wmake it (cached by a hash of the sources).

Args

  • nsm: the NumericalSystemModel (or the tuple of systems of a split template)

  • dimension: spatial dimension of the case

  • topo: mesh topology whose boundary-closure classes the kernels carry; None (precompile): none

Returns

Path of the symFoam binary.

run(mesh, model, Q0, workdir)#

Write the case (mesh, fields, stencils), launch symFoam (mpirun -parallel for nprocs > 1) and read the result back.

Args

  • mesh: zoomy_core mesh

  • Q0: initial state (n_state, n_cells) in the mesh order

  • workdir: case directory (recreated)

Returns

(time, Q) with Q in the mesh order; the written snapshots are kept in self.snapshots.

class zoomy_foam.symsolver.SymbolicHyperbolicSolverFoam(**params)#

Bases: zoomy_foam.symsolver.FoamDriver, zoomy_core.symsolver.backend_cxx.CxxBackend

The explicit hyperbolic template on foam: time, Q = solver.run(mesh, nsm, Q0, workdir).

Initialization

class zoomy_foam.symsolver.SymbolicChorinSolverFoam(**params)#

Bases: zoomy_foam.symsolver.FoamDriver, zoomy_core.symsolver.backend_cxx.CxxChorinBackend

The Chorin projection template on foam, run with (pred, press, corr) in place of nsm.

pred is the predictor NSM on the full state, press / corr the pressure and corrector systems of the model’s split.

References

  • Chorin 1968, https://doi.org/10.1090/S0025-5718-1968-0242392-2

Initialization

linear_solver#

‘OptionParam(…)’

zoomy_foam.symsolver.hypre_prefix()#

The CPU hypre install symFoam links (~/.cache/zoomy/hypre-cpu-3.2.0, or ZOOMY_HYPRE_DIR), built first by containers/zoomy_amrex/build_hypre_cuda.sh cpu when missing.

References

  • Falgout, Yang 2002, https://doi.org/10.1007/3-540-47789-6_66

zoomy_foam.symsolver.restart_state(path, nprocs=1)#

The restart state (base, name, time) at path: a time directory of io.save_state (<base>/[processor<k>/]<name>), or a case / checkpoint directory (its latest).