zoomy_core.model.models.equations#
Balance-equation blueprints (Mass, Momentum, MomentumNonHydrostatic,
Transport) that declare their state/closure variables and add their residual to a derivation
Model, plus the tracked scaling steps applied to them. They feed the SME/VAM derivations,
before the Model is lifted to a SystemModel.
Module Contents#
Classes#
Base balance blueprint: |
|
Incompressible mass balance |
|
General 3-D momentum balance with the full symmetric stress tensor |
|
How much of the bulk closure’s deviatoric stress a moment model keeps; the rule is
applied by |
|
Non-hydrostatic momentum with the hydrostatic pressure pre-absorbed: horizontal rows
|
|
Conservative transport of a scalar field |
Functions#
|
|
Gravity body-force vector per spatial direction, the single gravity path of every
momentum blueprint (flat plane is |
|
Stress scaling step of the moment models: |
|
Route a retained viscous residual into conservative diffusion by rewriting
|
|
Opaque geometric-slope symbol of a boundary interface ( |
|
Tracked step resolving the opaque boundary frame to its small-slope limit (every
|
|
Complement of |
API#
- zoomy_core.model.models.equations.evaluate_time_derivatives(expr, t)#
.doit()only theSubsatoms and the derivatives carryingtof a residual, keeping every purely spatial flux divergenced_x(F)folded so it stays in the flux slot.
- class zoomy_core.model.models.equations.Equation(model=None)#
Base balance blueprint:
add_to(model)declares variables and adds the residual, andmodel.add_equation(blueprint)dispatches to it.Initialization
Store the (optional) model the blueprint is attached to.
- abstract add_to(model)#
Declare variables and add the residual to
model; implemented by subclasses.
- class zoomy_core.model.models.equations.Mass(model=None, suffix='')#
Bases:
zoomy_core.model.models.equations.EquationIncompressible mass balance
sum_d d_d u_d + d_z w = 0; registers the horizontal velocities andwas state.Args
suffix: scopes the field names for a multilayer column ("_1"givesu_1, w_1).
Initialization
Store the model and the field-name
suffix.- add_to(model)#
Declare
u(v) andwas state and add themassequation; returns it.
- zoomy_core.model.models.equations.gravity_components(model, coords)#
Gravity body-force vector per spatial direction, the single gravity path of every momentum blueprint (flat plane is
e_d = 0).Returns
(g_h, g_z): in-plane component per horizontal coordinate (downslopeg e_xalong x, else 0) and the normal component-g.
- class zoomy_core.model.models.equations.Momentum(model=None)#
Bases:
zoomy_core.model.models.equations.EquationGeneral 3-D momentum balance with the full symmetric stress tensor
tau_ijdeclared as closure variables (in every row, the vertical one included) and the pressurepas state. The shallow simplification is not built in; it is applied explicitly bymoment_scaling.Initialization
Store the (optional) model the blueprint is attached to.
- add_to(model)#
Declare
pand the stress components, and add themomentumequation (horizontal rows plus the vertical row); returns it.
- class zoomy_core.model.models.equations.Stress#
Bases:
zoomy_core.misc.options.OptionHow much of the bulk closure’s deviatoric stress a moment model keeps; the rule is applied by
moment_scaling, per component, in physical coordinates before the sigma map.Initialization
Initialize self. See help(type(self)) for accurate signature.
- shallow#
‘shallow’
- full#
‘full’
- zoomy_core.model.models.equations.moment_scaling(model, momentum, stress=Stress.shallow)#
Stress scaling step of the moment models:
Stress.shallowdrops, from the full-tensor blueprintmomentum, the in-plane stressestau_de,tau_zzand the stress of the vertical row;Stress.fullkeeps everything. The choice is recorded asmodel.stress, which the bulk closure reads for thed_e wpart oftau_ez(apply_stress_closures).
- zoomy_core.model.models.equations.package_viscous(expr, nu, states, space)#
Route a retained viscous residual into conservative diffusion by rewriting
C d_d d_e Qasd_d(C d_e Q) - (d_d C) d_e Qwith the diffusive flux wrapped in aViscousDiffusionmarker; non-viscous terms pass through.Args
expr: projected residual.nu: viscosity symbol identifying the viscous terms.states: state functionsQthat may carry second derivatives.space: spatial coordinatesd, e.
Returns
The residual with the viscous part in divergence form.
- zoomy_core.model.models.equations.frame_slope(tag, direction)#
Opaque geometric-slope symbol of a boundary interface (
tagis"b"or"eta") in horizontaldirection"x"or"y", distinct from the physicald_d(interface).
- zoomy_core.model.models.equations.small_slope_scaling(model)#
Tracked step resolving the opaque boundary frame to its small-slope limit (every
frame_slopesymbol to 0,n -> z_hat); skip it to keep the slope-aware tractions. Geometric sibling ofmoment_scaling; together they give the shallow-moment form.
- zoomy_core.model.models.equations.slope_aware_scaling(model, interfaces)#
Complement of
small_slope_scaling: resolve eachframe_slopesymbol to the physical interface sloped_dir(interface), so the geometrically exact model has no opaque symbol left.Args
interfaces: map from frame tag to height expression, e.g.{"b": b, "eta": b + h}.
- class zoomy_core.model.models.equations.MomentumNonHydrostatic(model=None, suffix='', tau_name='tau_xz', free_surface=None)#
Bases:
zoomy_core.model.models.equations.EquationNon-hydrostatic momentum with the hydrostatic pressure pre-absorbed: horizontal rows
momentum_<d>carryg d_d(eta)andpis only the non-hydrostatic part of-sigma_zz, and the vertical rowmomentum_zkeepsd_z p; the full stress tensor is declared, the shallow form is applied bymoment_scaling.Args
suffix: scopes the field names (multilayer column).tau_name: stress field name for one horizontal direction (defaulttau_xz).free_surface: overrideseta(defaultb + h).
References
Escalante et al. 2024, https://doi.org/10.1016/j.jcp.2024.112882
Initialization
Store the field-name
suffix, the stress name and the optional free-surface override.- add_to(model)#
Declare
pand the stress tensor (one shear stress per horizontal direction, the in-planetau_deandtau_zz) and add themomentum_x(momentum_y) andmomentum_zequations.
- class zoomy_core.model.models.equations.Transport(model=None, name='c', source=None)#
Bases:
zoomy_core.model.models.equations.EquationConservative transport of a scalar field
name,d_t c + sum_d d_d(u_d c) + d_z(w c) = source, registered as a state field (TKE, dissipation, tracer, …).Args
source: optional source field or expression;Nonefor a passive scalar.
Initialization
Store the field
nameand the optionalsource.- add_to(model)#
Declare the scalar as state and add its transport equation; returns it.