zoomy_core.model.basemodel module

zoomy_core.model.basemodel module#

Symbolic PDE model base: variables, parameters, registered flux/source callbacks, and BC wiring.

zoomy_core.model.basemodel.register_sympy_attribute(definition, prefix='q')#

Turn int or list field specs into a Zstruct of real sympy Symbols.

zoomy_core.model.basemodel.eigenvalue_dict_to_matrix(eigenvals_dict)#

Flatten a sympy eigenvals() dict {eigenvalue: multiplicity} into a ZArray.

zoomy_core.model.basemodel.default_simplify(expr)#
zoomy_core.model.basemodel.parse_definition_to_zstruct(definition, prefix='q_')#

Turn int/list/dict/Zstruct specs into symbolic Zstruct fields.

zoomy_core.model.basemodel.extract_parameter_defaults(definition)#

Numeric defaults for parameters (feeds parameter_values arrays in solvers).

class zoomy_core.model.basemodel.Model(init_functions=True, **params)#

Bases: Parameterized, SymbolicRegistrar

Model. (class).

name = 'Model'#
dimension = 1#
disable_differentiation = False#
eigenvalue_mode = 'symbolic'#
variables = 1#
aux_variables = 0#
parameters = {}#
boundary_conditions = None#
aux_boundary_conditions = None#
initial_conditions = None#
aux_initial_conditions = None#
print_boundary_conditions()#

Print boundary conditions.

flux()#

Flux.

diffusive_flux()#

Diffusive flux F_diff(Q, ∇Q). Shape (n_variables, dimension).

Evaluated at faces using reconstructed gradients. Default: zero (no diffusion).

dflux()#

Dflux (legacy).

hydrostatic_pressure()#

Hydrostatic pressure.

nonconservative_matrix()#

Nonconservative matrix.

source()#

Source.

residual()#

Residual.

interpolate()#

Interpolate.

project_2d_to_3d()#

Project 2d to 3d.

project_3d_to_2d()#

Project 3d to 2d.

initial_condition()#

Initial condition.

initial_aux_condition()#

Initial aux condition.

update_variables()#

Update variables.

update_aux_variables()#

Update aux variables.

update_variables_jacobian_wrt_variables()#

Update variables jacobian wrt variables.

update_aux_variables_jacobian_wrt_variables()#

Update aux variables jacobian wrt variables.

quasilinear_matrix()#

Quasilinear matrix.

source_jacobian_wrt_variables()#

Source jacobian wrt variables.

source_jacobian_wrt_aux_variables()#

Source jacobian wrt aux variables.

eigenvalues()#

Eigenvalues of the normal-projected quasilinear matrix.

In ‘symbolic’ mode: solves the characteristic polynomial in SymPy. In ‘numerical’ mode: returns an empty ZArray (eigenvalues computed at runtime by the Numerics class via np.linalg.eigvals).

left_eigenvectors()#

Left eigenvectors.

right_eigenvectors()#

Right eigenvectors.

print_model_functions(function_names=None)#

Print model functions.

summarize_model(tex=False)#

Complete model description as a dict (for display) or LaTeX string.

Returns a dict with keys:
  • ‘pde_form’: the general PDE structure

  • ‘Q’: state vector

  • ‘Qaux’: auxiliary variables

  • ‘F’: flux matrix

  • ‘P’: hydrostatic pressure

  • ‘B’: nonconservative matrix (per dimension)

  • ‘S’: source vector

  • ‘eigenvalues’: list of eigenvalue expressions (or ‘numerical’)

  • ‘parameters’: {name: default_value}

  • ‘config’: model configuration summary

If tex=True, all SymPy objects are returned as LaTeX strings.