zoomy_jax.symsolver.solver#
Driver of the JAX backend: prints the solver template (hyperbolic, Chorin) of a
NumericalSystemModel and runs it against zoomy_jax.symsolver.runtime. ad_mode=AdMode.reverse
checkpoints the time loop for jax.grad, couple= makes the march a preCICE participant,
comm= (mpi4py) runs it distributed, one rank per device.
References
Bradbury et al. 2018, https://github.com/jax-ml/jax
Module Contents#
Classes#
Finite-volume solver on JAX: prints |
|
The Chorin projection solver on JAX ( |
API#
- class zoomy_jax.symsolver.solver.SymbolicHyperbolicSolverJax(**kwargs)#
Bases:
zoomy_core.symsolver.settings.HyperbolicSettingsFinite-volume solver on JAX: prints
HyperbolicTemplatefor a NumericalSystemModel, builds the runtime and marches the jitted program. Usesetup(mesh, model), thenrun(Q, Qaux).Initialization
- fold_geometry#
‘Boolean(…)’
- on_write#
‘Callable(…)’
- output#
‘String(…)’
- ad_mode#
‘OptionParam(…)’
- ad_checkpoints#
‘Integer(…)’
- couple#
‘Dict(…)’
- comm#
‘Parameter(…)’
- subcycling#
‘Boolean(…)’
- setup(mesh, model)#
Lift
modelto an NSM if needed, then build the solver onmesh.Args
mesh: a mesh, or the path of a mesh filemodel: SystemModel or NumericalSystemModel
Returns
initial
(Q, Qaux)(distributed: the local piece)
- initial_aux(Q, Qaux, parameters=None, X=None)#
The aux of the initial state: the pointwise formula plus the derivative aux with the BC ghosts and the boundary closure.
- property parameters#
The runtime’s parameter vector.
- run(Q, Qaux, parameters=None, time0=None, X=None)#
March from
time0(defaulttime_start; a restart: the saved state) totime_end; returns(time, Q, Qaux).parametersand the vertex coordinatesX(dim, n_vertices)may be traced for AD.
- class zoomy_jax.symsolver.solver.SymbolicChorinSolverJax(**kwargs)#
Bases:
zoomy_jax.symsolver.solver.SymbolicHyperbolicSolverJax,zoomy_core.symsolver.settings.ChorinSettingsThe Chorin projection solver on JAX (
ChorinTemplate):setup(mesh, pred, press, corr)takes the predictor NSM on the full state and the pressure and corrector systems. The split must use zoomy’s time-step symboldt(positive).References
Chorin 1968, https://doi.org/10.1090/S0025-5718-1968-0242392-2
Initialization
- pressure_linear_solver#
‘OptionParam(…)’
- pressure_amg_rebuild#
‘Integer(…)’
- pressure_amg_growth#
‘Number(…)’
- pressure_amgx#
‘Dict(…)’
- pressure_coarse#
‘Boolean(…)’
- setup(mesh, pred, press, corr)#
Check the split, build the pressure and corrector runtimes and the linear-solver settings, then
_setup; returns the initial(Q, Qaux).