zoomy_foam.symkernels

zoomy_foam.symkernels#

C++ kernels of the symbolic solvers on foam: one struct <system>_t per system with one static constexpr functor per kernel the printed solver references. The kernels are the NumericalSystemModel’s call table (the Functions the JAX runtime lambdifies) printed in Foam syntax: state arguments are zs::Col views (rt.H), results fixed-size std::arrays, row-major.

Module Contents#

Classes#

FoamKernelPrinter

Foam syntax of FoamNumericsPrinter with stack results (std::array, row-major); the symbol maps come from each kernel’s own argument groups.

Functions#

family

Kernel family (face, bc, recon, normal, cell) of a Function, which fixes its full C++ argument list.

referenced

Kernel names <system>.<name> used by the printed solver source.

write_kernels

Write Kernels.H: struct <name>_t and constexpr <name>_t <name> for each (name, nsm) in systems, with the kernels source uses.

API#

zoomy_foam.symkernels.family(f)#

Kernel family (face, bc, recon, normal, cell) of a Function, which fixes its full C++ argument list.

class zoomy_foam.symkernels.FoamKernelPrinter#

Bases: zoomy_core.transformation.to_openfoam.FoamNumericsPrinter

Foam syntax of FoamNumericsPrinter with stack results (std::array, row-major); the symbol maps come from each kernel’s own argument groups.

Initialization

Initialise the generic C++ printer only.

get_array_declaration(target, shape, init_zero=False)#

Zero-initialised stack array target of the flattened shape.

format_assignment(target, indices, value, shape)#

Row-major flat entry of indices.

kernel(f, n_state)#

Print one Function as struct <name>_k and its static constexpr instance; the call operator takes the full argument list of its family (unused arguments are ignored).

zoomy_foam.symkernels.referenced(source, system)#

Kernel names <system>.<name> used by the printed solver source.

zoomy_foam.symkernels.write_kernels(systems, source, path, topo=None)#

Write Kernels.H: struct <name>_t and constexpr <name>_t <name> for each (name, nsm) in systems, with the kernels source uses.

Args

  • topo: mesh topology; derivative aux entries carry the boundary-closure class of their state row (-1 without it)

Returns

path.