zoomy_foam._pipeline#
In-process run entry for the OpenFOAM (zoomyFoam) backend — REQ-93.
Foam is not drivable in-process: it is codegen -> apptainer wmake ->
OpenFOAM polyMesh + 0/ fields -> zoomyFoam -> VTK, with the DOF count
baked constexpr per model. This module wraps that whole pipeline behind one
call so the server’s FoamAdapter (and anyone) can drive the shared
folder-case format exactly like the numpy/jax/dmplex/amrex backends:
from zoomy_foam import run_case
h5 = run_case(model, settings, output_dir, on_progress=None) # -> HDF5 path
It mirrors, generically, the by-hand flow in
tools/macdonald_friction_verification.py:
(a) code-gen Model.H / NumericsKernels.H from the resolved model
(FoamSystemModelPrinter / FoamNumericsPrinter);
(b) wmake zoomyFoam in the OpenFOAM-13 apptainer — cached by a hash of
the emitted headers (the DOF + physics are baked in, so identical headers
reuse the binary);
(c) build the OpenFOAM case: structured blockMeshDict from the mesh, 0/Qi
from model.initial_conditions at the cell centres, controlDict from
settings (endTime / maxCo / reconstructionOrder / timeScheme / params);
(d) run zoomyFoam; parse Time = lines for on_progress;
(e) foamToVTK -> zoomy_prepost.vtk_to_hdf5 so the server serves the
shared HDF5 format.
Env: ZOOMY_OF_SIF overrides the apptainer image (default
~/of_build/zoomy_openfoam.sif); inside the OpenFOAM image (in_image) wmake and the solvers
run directly. ZOOMY_FOAM_BINCACHE names the binary cache (default <package>/../.bincache
when writable, else ~/.cache/zoomy/foam_bincache, else the temp directory).
Module Contents#
Functions#
True when this process already runs where OpenFOAM is: |
|
Run a shared folder-case on the zoomyFoam backend; return the HDF5 path. |
|
Same pipeline as |
|
Chorin (pressure-projection) analog of |
|
Chorin analog of |
Data#
API#
- zoomy_foam._pipeline.FOAM_ROOT#
None
- zoomy_foam._pipeline.SIF#
‘Path(…)’
- zoomy_foam._pipeline.OF_BASHRC#
‘Path(…)’
- zoomy_foam._pipeline.in_image()#
True when this process already runs where OpenFOAM is:
ZOOMY_FOAM_IN_IMAGE(1 / 0) when set, else OpenFOAM 13 here (/opt/openfoam13/etc/bashrcorfoamRunon PATH) and either an apptainer container around this process (APPTAINER_CONTAINER) or noapptainerto call. Then wmake, the meshers and the solvers run directly (no nested apptainer).
- zoomy_foam._pipeline.run_case(model, settings, output_dir, on_progress=None, with_aux=False)#
Run a shared folder-case on the zoomyFoam backend; return the HDF5 path.
Parameters
model(zoomy_core Model): Resolved case model (IC/BC baked); coerced withSystemModel.from_model.settings(dict): The casesettings.json(mesh,time_end,cfl,output_snapshots,reconstruction_order, optionaltime_scheme,min_dt).meshis resolved relative tosettings["_case_dir"]/ the current directory when not absolute.output_dir(str | Path): Where the OpenFOAM case +simulation.h5are written.on_progress(callable(iteration, time, dt) | None)with_aux(bool): Also export the model’s aux state as a per-frameQauxdataset. Off by default so the server’s state-only HDF5 contract is unchanged.
- zoomy_foam._pipeline.run_to_vtk(model, settings, output_dir, on_progress=None)#
Same pipeline as
run_casebut stops at the VTK series (no HDF5) — the shape the gui solver wrappers use (gui converts VTK→h5 withzoomy_prepost). Returns the.pvdcollection path.
- zoomy_foam._pipeline.run_chorin_to_vtk(model, settings, output_dir, on_progress=None)#
Chorin (pressure-projection) analog of
run_to_vtk— split codegen → wmake chorin_app → case (8-state VAM) → chorinFoam → VTK series. Returns the.pvdpath.modelmust exposechorin_split(e.g. VAM).
- zoomy_foam._pipeline.run_chorin_case(model, settings, output_dir, on_progress=None, with_aux=False)#
Chorin analog of
run_case: same pipeline, exported to HDF5.run_chorin_to_vtkstops at the VTK series because that is the shape the gui wants. The test suite needs the same(Q, Qaux)readback it gets for the hyperbolic path — otherwise the VAM/chorin pair would be the one pair compared on a weaker footing than every other test.