zoomy_amrex.transformation.to_amrex

zoomy_amrex.transformation.to_amrex#

Printers of a frozen SystemModel for the AMReX C++ drivers: Model.H (source, Jacobians, aux update, eigenvalues, BC and Chorin kernels) and Numerics.H (core’s AmrexNumerics). Opaque calls (eigensystem, eigenvalues, solve, …) are routed to the hand-written UserFunctions.H, as foam does.

Module Contents#

Classes#

AmrexNumericsPrinter

Core’s AmrexNumerics with real-valued conditional / Heaviside and the opaque eigen- and solve calls routed to amrex_user.

AmrexSystemModelPrinter

Emit Model.H (operators, BC kernels, state-row map, Chorin metadata) from a frozen SystemModel. Called by generate_headers and write_chorin_headers.

Functions#

generate_headers

Generate Model.H, Numerics.H and the user-function headers into out_dir from a frozen SystemModel. Files are rewritten only when their text changes, so make does not recompile.

write_chorin_headers

Generate ModelPred.H / ModelPress.H / ModelCorr.H, NumericsPred.H and the user-function headers for the C++ Chorin driver (predictor, pressure solve, corrector). An unresolved boundary trace in the emitted C++ raises ValueError.

API#

class zoomy_amrex.transformation.to_amrex.AmrexNumericsPrinter(numerics, *args, **kwargs)#

Bases: zoomy_core.transformation.to_amrex.AmrexNumerics

Core’s AmrexNumerics with real-valued conditional / Heaviside and the opaque eigen- and solve calls routed to amrex_user.

Initialization

Initialize the instance.

c_functions#

None

class zoomy_amrex.transformation.to_amrex.AmrexSystemModelPrinter(sm, *, analytical_eigenvalues=True, wrapper_name='Model', time_position_ops=False)#

Bases: zoomy_core.transformation.to_amrex.AmrexCore, zoomy_core.transformation.generic_c.GenericCppBase

Emit Model.H (operators, BC kernels, state-row map, Chorin metadata) from a frozen SystemModel. Called by generate_headers and write_chorin_headers.

Initialization

Bind the SystemModel sm and register the Q, Qaux, n, p, X and time symbol maps; dt is appended to p when an operator uses it.

Args

  • analytical_eigenvalues: print the model’s eigenvalues; else zeros (the backend then uses a numerical spectral radius).

  • wrapper_name: name of the emitted struct.

  • time_position_ops: source / update_aux_variables take (time, X) (hyperbolic Model.H only).

gpu_enabled#

True

c_functions#

None

get_includes()#

AMReX includes of Model.H.

create_code()#

Print the whole Model.H struct: every operator kernel (zero stubs for the slots the driver does not read), the BC kernels and, on a Chorin sub-model, the pressure-operator kernels and metadata.

zoomy_amrex.transformation.to_amrex.generate_headers(sm, out_dir, *, riemann=None, analytical_eigenvalues=True)#

Generate Model.H, Numerics.H and the user-function headers into out_dir from a frozen SystemModel. Files are rewritten only when their text changes, so make does not recompile.

Args

  • sm: frozen SystemModel.

  • riemann: zoomy_core.fvm.riemann_solvers.Numerics subclass; default NonconservativeRusanov.

Returns

out_dir as a Path.

zoomy_amrex.transformation.to_amrex.write_chorin_headers(split, out_dir)#

Generate ModelPred.H / ModelPress.H / ModelCorr.H, NumericsPred.H and the user-function headers for the C++ Chorin driver (predictor, pressure solve, corrector). An unresolved boundary trace in the emitted C++ raises ValueError.

Args

  • split: the model’s own chorin_split(system_model=sm) result (SM_pred, SM_press, SM_corr).

Returns

out_dir as a Path.

References

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