zoomy_core.model.boundary_conditions

zoomy_core.model.boundary_conditions#

Boundary conditions of the Model layer: per-tag BC classes, the BoundaryConditions container and the kernels it lowers to. They are attached to a SystemModel, which turns them into the boundary / ghost-state kernels the solver templates call.

Module Contents#

Classes#

BoundaryValueKind

What a boundary condition’s value is: the ghost state, or the state on the face.

BoundaryCondition

Base class of a boundary condition: a tag (patch) and an on selector naming the state field(s) it owns. A flat list of BCs gives different fields different BCs at one tag; on is resolved against the model state by resolve_per_field.

Extrapolation

Ghost state equals the interior state (zero normal gradient).

ZeroNeumann

Named alias of Extrapolation (dQ/dn = 0).

Dirichlet

Prescribed value on the field(s) selected by on=, e.g. Dirichlet("left", on="h", value=1.5).

Flux

Prescribed normal gradient dQ/dn = gradient on the field(s) selected by on=; the ghost value extrapolates. gradient is a number, a string formula in field/parameter names (e.g. Navier slip "lambda_s*h*mom/nu"), a sympy expression or a numpy callable; names are bound by resolve.

Coupled

preCICE-coupled boundary patch; the kernel is an extrapolation fallback that the solver overwrites with the exchanged data at runtime.

InflowOutflow

Prescribe selected state fields, extrapolate the rest. prescribe_fields maps a state index to a value (scalar or expression) or to a dict with mode in replace (value), inlet_outlet (value only where inflowing) or blend (soft pull to target with weight).

Lambda

Face values from user functions: prescribe_fields maps a slot to f(time, X, dX, Q, Qaux, p, n) at the face centre.

FromModel

Boundary values derived in the model: references a boundary:<name> function group registered by the derivation. resolve (called by SystemModel.attach_boundary_conditions) binds it to sm.boundary_specs; slots the definition does not prescribe extrapolate.

Characteristic

Incoming-characteristic ghost: only the characteristic fields with lambda < 0 take the target state, Q + R 1_{lambda<0} L (Q_target - Q), so the Riemann problem reflects nothing. Built on the SystemModel’s opaque eigensystem kernel; the target is the inner state unless overridden by prescribe_fields or target_state.

CharacteristicFarField

Non-reflecting far-field boundary: incoming characteristics carry far_field, outgoing ones leave undisturbed.

CharacteristicWall

Wall from the characteristic tool: the target is the mirror state (normal momentum reflected) and only its incoming content is imposed. momentum_field_indices=None derives the groups at resolve time (see derive_momentum_field_indices).

FromData

Face values from a time series: prescribe_fields maps a slot to data interpolated over timeline.

CharacteristicReflective

Reflective boundary in characteristic variables: incoming ones (D <= 0) are mapped through M. R, L, D are the user-supplied eigen-decomposition and S the rotation into the normal frame.

Wall

Free-slip / partially permeable wall: per momentum vector, u_wall = slip * u_tangential - (1 - permeability) * u_normal; scalars extrapolate. momentum_field_indices lists index groups (one vector per group); None derives them from the model at resolve time, an explicit pin wins.

RoughWall

Wall with a distance-dependent slip from a log-law roughness (CsW, Ks).

Periodic

Periodic boundary; the runtime pairs it with periodic_to_physical_tag (mesh.resolve_periodic_bcs), the kernel is an extrapolation fallback.

WindStress

Mixed Dirichlet and Neumann boundary (POM-style wind-stress surface): prescribe_values fixes rows, prescribe_gradients fixes face-normal gradients, other rows extrapolate. Symbolic specs work on the codegen and Firedrake-DG paths, the numpy paths need numbers.

SystemExtrapolation

System-aware BC: Extrapolation on every equation.

SystemPeriodic

System-aware BC: Periodic on every equation.

SystemWall

System-aware wall: extrapolation (without gradient) for scalar equations, reflection (WallMomentumBC) for momentum equations.

WallMomentumBC

Wall BC for the momentum equations of a system; compile_system_bcs groups their variables into momentum vectors.

BoundaryConditions

Container of the per-tag BCs, sorted by tag; builds the indexed boundary, gradient and ghost-state kernels.

PerFieldBoundary

Composite BC for one tag: each state slot takes the value/gradient of the BC assigned to its field. Built by resolve_per_field; unclaimed slots fall back to Extrapolation.

Functions#

derive_momentum_field_indices

Derive the momentum index groups (one vector per group, across the horizontal directions) from the registry sm.interpolate_to_3d, or from declared roles.

compile_system_bcs

Translate system-aware BCs into a BoundaryConditions container with one BC per tag.

boundary_data_symbols

Per-face boundary-data group bdata_0 .. bdata_{n-1} (coupling data, one entry per state row) of the ghost-state kernel.

build_boundary_ghost_kernel

Build the ghost-state kernel of sm from its BoundaryConditions source, in the system’s current symbols.

boundary_face_branches

BC-kernel branch index of every boundary face of mesh, matched by tag name (the mesh’s own tag numbers are not branch indices). A face whose tag has no BC raises, except the reserved halo tag (branch -1); without bcs the mesh numbering is returned unchanged.

resolve_per_field

Build a BoundaryConditions from a flat list of per-field BCs: one PerFieldBoundary per tag, unclaimed slots extrapolate, two BCs on one (tag, field) raise. Whole-patch BCs (Periodic, Coupled) pass through unwrapped.

resolve_and_attach

Attach boundary conditions (a BoundaryConditions container or a flat per-field list) to the SystemModel sm; shared by every model’s system_model.

API#

class zoomy_core.model.boundary_conditions.BoundaryValueKind#

Bases: zoomy_core.misc.options.Option

What a boundary condition’s value is: the ghost state, or the state on the face.

Initialization

Initialize self. See help(type(self)) for accurate signature.

ghost#

‘ghost’

face#

‘face’

class zoomy_core.model.boundary_conditions.BoundaryCondition(tag=None, on=None, **params)#

Bases: param.Parameterized

Base class of a boundary condition: a tag (patch) and an on selector naming the state field(s) it owns. A flat list of BCs gives different fields different BCs at one tag; on is resolved against the model state by resolve_per_field.

A BC feeds three channels: face, the state on the boundary face (the Riemann problem); ghost, the value at the mirror image of the inner cell centre (gradients, limiters, derivative aux, diffusion), by default derived from the face value; normal_gradient, a prescribed dQ/dn on the face (Neumann data). face= / ghost= / normal_gradient= take another BC that supplies that channel on the slots of its on, e.g. Wall(tag="w", ghost=Dirichlet(on="momentum", value=0)).

Initialization

Set tag and on (both optional) and forward the remaining parameters.

tag#

‘String(…)’

on#

‘String(…)’

face#

‘Parameter(…)’

ghost#

‘Parameter(…)’

normal_gradient#

‘Parameter(…)’

boundary_value_kind#

None

channels()#

The channel BCs given, e.g. {"face": bc, "ghost": bc}.

bind_on(state_names, aliases=None)#

Resolve on to the owned state-slot indices (None: all, no masking); called by SystemModel.attach_boundary_conditions.

abstract compute_boundary_condition(time, X, dX, Q, Qaux, parameters, normal)#

Symbolic boundary value (the outer face state seen by the Riemann problem), assembled into the indexed boundary_conditions kernel.

compute_boundary_gradient(time, X, dX, Q, Qaux, parameters, normal)#

Symbolic face-normal gradient dQ/dn (default: zero Neumann), assembled into the boundary_gradients kernel.

compute_ghost_state(time, X, dX, Q, Qaux, parameters, normal, bdata=None)#

Symbolic ghost state at the mirror image of the inner cell centre; a BoundaryValueKind.face value v gives 2v - Q.

Args

  • bdata: per-face boundary data (coupling), read only by subclasses that need it.

face_state(Q_face, Qaux_face, normal, parameters)#

Deprecated numpy boundary-side Riemann state from the reconstructed face value (default: copy); use face_value.

face_value(Q_inner, Qaux_inner, normal, d_face, time, parameters)#

Numpy boundary-side Riemann state of the adjacent interior cell (default: copy of Q_inner).

Args

  • d_face: distance from the interior cell centre to the face centre.

Returns

State of shape (n_vars,) seen by the Riemann solver on the boundary side.

face_gradient(Q_inner, Q_face, Qaux_inner, normal, d_face, time, parameters)#

Numpy face-normal gradient dQ/dn for the diffusive flux (default: (Q_face - Q_inner) / d_face).

Args

  • Q_face: the already computed face_value result.

Returns

Gradient of shape (n_vars,).

class zoomy_core.model.boundary_conditions.Extrapolation(tag=None, on=None, **params)#

Bases: zoomy_core.model.boundary_conditions.BoundaryCondition

Ghost state equals the interior state (zero normal gradient).

Initialization

Set tag and on (both optional) and forward the remaining parameters.

use_gradient#

‘Boolean(…)’

compute_boundary_condition(time, X, dX, Q, Qaux, parameters, normal)#

Symbolic boundary value: the inner state.

face_state(Q_face, Qaux_face, normal, parameters)#

Boundary state equals the interior face state.

face_value(Q_inner, Qaux_inner, normal, d_face, time, parameters)#

Boundary state equals the interior cell state.

face_gradient(Q_inner, Q_face, Qaux_inner, normal, d_face, time, parameters)#

Zero normal gradient.

class zoomy_core.model.boundary_conditions.ZeroNeumann(tag=None, on=None, **params)#

Bases: zoomy_core.model.boundary_conditions.Extrapolation

Named alias of Extrapolation (dQ/dn = 0).

Initialization

Set tag and on (both optional) and forward the remaining parameters.

class zoomy_core.model.boundary_conditions.Dirichlet(tag=None, on=None, value=None, **params)#

Bases: zoomy_core.model.boundary_conditions.BoundaryCondition

Prescribed value on the field(s) selected by on=, e.g. Dirichlet("left", on="h", value=1.5).

Initialization

Set the prescribed value besides tag and on.

value#

‘Number(…)’

boundary_value_kind#

None

compute_boundary_condition(time, X, dX, Q, Qaux, parameters, normal)#

Symbolic boundary value: value in every slot.

face_value(Q_inner, Qaux_inner, normal, d_face, time, parameters)#

Numpy boundary state: value in every slot.

class zoomy_core.model.boundary_conditions.Flux(tag=None, on=None, gradient=None, **params)#

Bases: zoomy_core.model.boundary_conditions.BoundaryCondition

Prescribed normal gradient dQ/dn = gradient on the field(s) selected by on=; the ghost value extrapolates. gradient is a number, a string formula in field/parameter names (e.g. Navier slip "lambda_s*h*mom/nu"), a sympy expression or a numpy callable; names are bound by resolve.

Initialization

Set the gradient specification besides tag and on.

gradient#

‘Parameter(…)’

resolve(sm)#

Bind a string / sympy gradient to the symbols of sm by name and lambdify it for the numpy path.

compute_boundary_condition(time, X, dX, Q, Qaux, parameters, normal)#

Symbolic boundary value: the inner state.

compute_ghost_state(time, X, dX, Q, Qaux, parameters, normal, bdata=None)#

Ghost of the prescribed gradient g: Q + 2*dX*g.

compute_boundary_gradient(time, X, dX, Q, Qaux, parameters, normal)#

Symbolic prescribed gradient in every slot.

face_value(Q_inner, Qaux_inner, normal, d_face, time, parameters)#

Numpy boundary state: the interior cell state.

face_gradient(Q_inner, Q_face, Qaux_inner, normal, d_face, time, parameters)#

Numpy prescribed gradient, evaluated at the interior cell.

class zoomy_core.model.boundary_conditions.Coupled(tag=None, on=None, **params)#

Bases: zoomy_core.model.boundary_conditions.BoundaryCondition

preCICE-coupled boundary patch; the kernel is an extrapolation fallback that the solver overwrites with the exchanged data at runtime.

Args

  • mesh_name: preCICE mesh name of the patch (as in precice-config.xml).

Initialization

Set tag and on (both optional) and forward the remaining parameters.

mesh_name#

‘String(…)’

compute_boundary_condition(time, X, dX, Q, Qaux, parameters, normal)#

Fallback boundary value (extrapolation), overwritten by preCICE at runtime.

compute_ghost_state(time, X, dX, Q, Qaux, parameters, normal, bdata=None)#

Ghost equals the per-face coupling data bdata (the inner state if absent).

face_value(Q_inner, Qaux_inner, normal, d_face, time, parameters)#

Fallback face value: the interior cell state.

class zoomy_core.model.boundary_conditions.InflowOutflow(tag=None, on=None, **params)#

Bases: zoomy_core.model.boundary_conditions.BoundaryCondition

Prescribe selected state fields, extrapolate the rest. prescribe_fields maps a state index to a value (scalar or expression) or to a dict with mode in replace (value), inlet_outlet (value only where inflowing) or blend (soft pull to target with weight).

Initialization

Set tag and on (both optional) and forward the remaining parameters.

prescribe_fields#

‘Dict(…)’

boundary_value_kind#

None

compute_boundary_condition(time, X, dX, Q, Qaux, parameters, normal)#

Symbolic boundary value with the prescribed fields replaced.

face_value(Q_inner, Qaux_inner, normal, d_face, time, parameters)#

Numpy path: constant replace specs only; other modes go through the codegen path.

class zoomy_core.model.boundary_conditions.Lambda(tag=None, on=None, **params)#

Bases: zoomy_core.model.boundary_conditions.BoundaryCondition

Face values from user functions: prescribe_fields maps a slot to f(time, X, dX, Q, Qaux, p, n) at the face centre.

Initialization

Set tag and on (both optional) and forward the remaining parameters.

prescribe_fields#

‘Dict(…)’

boundary_value_kind#

None

compute_boundary_condition(time, X, dX, Q, Qaux, parameters, normal)#

Symbolic boundary value with the prescribed slots from the user functions.

class zoomy_core.model.boundary_conditions.FromModel(tag=None, on=None, **params)#

Bases: zoomy_core.model.boundary_conditions.BoundaryCondition

Boundary values derived in the model: references a boundary:<name> function group registered by the derivation. resolve (called by SystemModel.attach_boundary_conditions) binds it to sm.boundary_specs; slots the definition does not prescribe extrapolate.

Initialization

Set tag and on (both optional) and forward the remaining parameters.

definition#

‘String(…)’

prescribe_fields#

‘Dict(…)’

resolve(sm)#

Take the named definition from sm.boundary_specs and capture the state and face-normal symbols.

compute_boundary_condition(time, X, dX, Q, Qaux, parameters, normal)#

Symbolic boundary value: the model definition with state and normal symbols substituted.

class zoomy_core.model.boundary_conditions.Characteristic(tag=None, on=None, **params)#

Bases: zoomy_core.model.boundary_conditions.BoundaryCondition

Incoming-characteristic ghost: only the characteristic fields with lambda < 0 take the target state, Q + R 1_{lambda<0} L (Q_target - Q), so the Riemann problem reflects nothing. Built on the SystemModel’s opaque eigensystem kernel; the target is the inner state unless overridden by prescribe_fields or target_state.

Initialization

Set tag and on (both optional) and forward the remaining parameters.

prescribe_fields#

‘Dict(…)’

resolve(sm)#

Bind the state symbols, normal symbols and eigensystem of sm.

target_state(time, X, dX, Q, Qaux, parameters, normal)#

State whose incoming content is imposed (default: inner state overridden by prescribe_fields).

compute_boundary_condition(time, X, dX, Q, Qaux, parameters, normal)#

Symbolic boundary value from the eigendecomposition of the normal-projected system.

class zoomy_core.model.boundary_conditions.CharacteristicFarField(tag=None, on=None, **params)#

Bases: zoomy_core.model.boundary_conditions.Characteristic

Non-reflecting far-field boundary: incoming characteristics carry far_field, outgoing ones leave undisturbed.

Initialization

Set tag and on (both optional) and forward the remaining parameters.

far_field#

‘Parameter(…)’

target_state(time, X, dX, Q, Qaux, parameters, normal)#

Far-field state vector (the inner state if far_field is None).

zoomy_core.model.boundary_conditions.derive_momentum_field_indices(sm)#

Derive the momentum index groups (one vector per group, across the horizontal directions) from the registry sm.interpolate_to_3d, or from declared roles.

Returns

Groups such as [[q_x_0, q_y_0], [q_x_1, q_y_1], ...]; raises if the registry is missing or ragged.

class zoomy_core.model.boundary_conditions.CharacteristicWall(tag=None, on=None, **params)#

Bases: zoomy_core.model.boundary_conditions._DerivedMomentumIndices, zoomy_core.model.boundary_conditions.Characteristic

Wall from the characteristic tool: the target is the mirror state (normal momentum reflected) and only its incoming content is imposed. momentum_field_indices=None derives the groups at resolve time (see derive_momentum_field_indices).

Initialization

Set tag and on (both optional) and forward the remaining parameters.

momentum_field_indices#

‘List(…)’

target_state(time, X, dX, Q, Qaux, parameters, normal)#

Inner state with the normal momentum of each group reflected.

class zoomy_core.model.boundary_conditions.FromData(tag=None, on=None, **params)#

Bases: zoomy_core.model.boundary_conditions.BoundaryCondition

Face values from a time series: prescribe_fields maps a slot to data interpolated over timeline.

Initialization

Set tag and on (both optional) and forward the remaining parameters.

prescribe_fields#

‘Dict(…)’

timeline#

‘Array(…)’

compute_boundary_condition(time, X, dX, Q, Qaux, parameters, normal)#

Symbolic ghost 2*interp - Q for the prescribed slots.

class zoomy_core.model.boundary_conditions.CharacteristicReflective(tag=None, on=None, **params)#

Bases: zoomy_core.model.boundary_conditions.BoundaryCondition

Reflective boundary in characteristic variables: incoming ones (D <= 0) are mapped through M. R, L, D are the user-supplied eigen-decomposition and S the rotation into the normal frame.

Initialization

Set tag and on (both optional) and forward the remaining parameters.

R#

‘Parameter(…)’

L#

‘Parameter(…)’

D#

‘Parameter(…)’

S#

‘Parameter(…)’

M#

‘Parameter(…)’

compute_boundary_condition(time, X, dX, Q, Qaux, parameters, normal)#

Symbolic boundary value: incoming characteristic variables reflected through M, guarded against dry cells.

class zoomy_core.model.boundary_conditions.Wall(tag=None, on=None, **params)#

Bases: zoomy_core.model.boundary_conditions._DerivedMomentumIndices, zoomy_core.model.boundary_conditions.BoundaryCondition

Free-slip / partially permeable wall: per momentum vector, u_wall = slip * u_tangential - (1 - permeability) * u_normal; scalars extrapolate. momentum_field_indices lists index groups (one vector per group); None derives them from the model at resolve time, an explicit pin wins.

Initialization

Set tag and on (both optional) and forward the remaining parameters.

momentum_field_indices#

‘List(…)’

permeability#

‘Number(…)’

wall_slip#

‘Number(…)’

blending#

‘Number(…)’

use_gradient#

‘Boolean(…)’

compute_boundary_condition(time, X, dX, Q, Qaux, parameters, normal)#

Symbolic wall ghost: reflected normal momentum, slip on the tangential part, blended with the inner state by blending.

face_state(Q_face, Qaux_face, normal, parameters)#

Numpy wall state from the reconstructed face value.

face_value(Q_inner, Qaux_inner, normal, d_face, time, parameters)#

Numpy wall state: reflected normal momentum, scalars copied from the interior.

class zoomy_core.model.boundary_conditions.RoughWall(tag=None, on=None, **params)#

Bases: zoomy_core.model.boundary_conditions.Wall

Wall with a distance-dependent slip from a log-law roughness (CsW, Ks).

Initialization

Set tag and on (both optional) and forward the remaining parameters.

CsW#

‘Number(…)’

Ks#

‘Number(…)’

compute_boundary_condition(time, X, dX, Q, Qaux, parameters, normal)#

Symbolic wall ghost with the roughness slip (1 - f) / (1 + f).

face_value(Q_inner, Qaux_inner, normal, d_face, time, parameters)#

Numpy wall state with the roughness slip.

class zoomy_core.model.boundary_conditions.Periodic(tag=None, on=None, **params)#

Bases: zoomy_core.model.boundary_conditions.BoundaryCondition

Periodic boundary; the runtime pairs it with periodic_to_physical_tag (mesh.resolve_periodic_bcs), the kernel is an extrapolation fallback.

Initialization

Set tag and on (both optional) and forward the remaining parameters.

periodic_to_physical_tag#

‘String(…)’

compute_boundary_condition(time, X, dX, Q, Qaux, parameters, normal)#

Fallback boundary value: the inner state.

class zoomy_core.model.boundary_conditions.WindStress(tag=None, on=None, **params)#

Bases: zoomy_core.model.boundary_conditions.BoundaryCondition

Mixed Dirichlet and Neumann boundary (POM-style wind-stress surface): prescribe_values fixes rows, prescribe_gradients fixes face-normal gradients, other rows extrapolate. Symbolic specs work on the codegen and Firedrake-DG paths, the numpy paths need numbers.

Initialization

Set tag and on (both optional) and forward the remaining parameters.

prescribe_values#

‘Dict(…)’

prescribe_gradients#

‘Dict(…)’

compute_boundary_condition(time, X, dX, Q, Qaux, parameters, normal)#

Dirichlet rows take the prescribed value; others extrapolate.

compute_boundary_gradient(time, X, dX, Q, Qaux, parameters, normal)#

Neumann rows take the prescribed gradient; others zero.

compute_ghost_state(time, X, dX, Q, Qaux, parameters, normal, bdata=None)#

Dirichlet rows 2v - Q, Neumann rows Q + 2*dX*g, the rest extrapolate.

face_value(Q_inner, Qaux_inner, normal, d_face, time, parameters)#

Numpy: Dirichlet rows take the prescribed (numeric) value; others extrapolate.

face_gradient(Q_inner, Q_face, Qaux_inner, normal, d_face, time, parameters)#

Numpy: Neumann rows take the prescribed (numeric) gradient; others zero.

class zoomy_core.model.boundary_conditions.SystemExtrapolation(tag=None)#

System-aware BC: Extrapolation on every equation.

Initialization

Store the boundary tag.

apply_to_system_bcs(system_bcs, tag=None)#

Set Extrapolation for every equation of system_bcs at the tag.

class zoomy_core.model.boundary_conditions.SystemPeriodic(tag=None, periodic_to_physical_tag='')#

System-aware BC: Periodic on every equation.

Initialization

Store the tag and periodic_to_physical_tag.

apply_to_system_bcs(system_bcs, tag=None)#

Set Periodic for every equation of system_bcs at the tag.

class zoomy_core.model.boundary_conditions.SystemWall(tag=None, permeability=0.0, wall_slip=1.0)#

System-aware wall: extrapolation (without gradient) for scalar equations, reflection (WallMomentumBC) for momentum equations.

Args

  • permeability: 0 impermeable (default), 1 fully permeable.

  • wall_slip: 1 free-slip (default), 0 no-slip.

Initialization

Store tag, permeability and wall slip.

apply_to_system_bcs(system_bcs, tag=None, system=None)#

Set extrapolation on scalar equations and WallMomentumBC on momentum equations at the tag.

class zoomy_core.model.boundary_conditions.WallMomentumBC(tag, system_bcs, permeability=0.0, wall_slip=1.0, use_gradient=True)#

Wall BC for the momentum equations of a system; compile_system_bcs groups their variables into momentum vectors.

Initialization

Store the tag, the system BC container and the wall parameters.

property momentum_equations#

Momentum equations of the current system.

zoomy_core.model.boundary_conditions.compile_system_bcs(system_bcs, equation_variable_map, dimension)#

Translate system-aware BCs into a BoundaryConditions container with one BC per tag.

Args

  • system_bcs: per-equation, per-tag BCs.

  • equation_variable_map: {equation_name: [var_index, ...]}, used to group momentum indices.

  • dimension: horizontal model dimension (1 or 2).

Returns

The container, with _gradient_variable_indices per tag.

class zoomy_core.model.boundary_conditions.BoundaryConditions(boundary_conditions=None, **params)#

Bases: param.Parameterized

Container of the per-tag BCs, sorted by tag; builds the indexed boundary, gradient and ghost-state kernels.

Initialization

Take the list of BCs (boundary_conditions), sort by tag and collect their kernels.

boundary_conditions_list#

‘List(…)’

property list_sorted_function_names#

Tags in kernel-branch order.

property boundary_conditions_list_dict#

BCs keyed by tag.

get_boundary_condition_function(time, X, dX, Q, Qaux, parameters, normal, function_name='boundary_conditions')#

Indexed symbolic boundary_conditions kernel: a Piecewise over the BC index dispatching to each BC’s boundary value.

get_boundary_gradient_function(time, X, dX, Q, Qaux, parameters, normal, function_name='boundary_gradients')#

Indexed symbolic boundary_gradients kernel (face-normal gradient), same contract as get_boundary_condition_function.

ghost_state_branches(time, X, dX, Q, Qaux, parameters, normal, bdata)#

Per-BC symbolic ghost states (branch i serves tag i); an empty container gives one extrapolation branch.

get_boundary_ghost_function(time, X, dX, Q, Qaux, parameters, normal, bdata, function_name='boundary_ghost_state')#

Indexed symbolic ghost-state kernel; as get_boundary_condition_function plus the per-face boundary_data group.

zoomy_core.model.boundary_conditions.boundary_data_symbols(n_state)#

Per-face boundary-data group bdata_0 .. bdata_{n-1} (coupling data, one entry per state row) of the ghost-state kernel.

zoomy_core.model.boundary_conditions.build_boundary_ghost_kernel(sm)#

Build the ghost-state kernel of sm from its BoundaryConditions source, in the system’s current symbols.

Returns

(function, branches): the indexed boundary_ghost_state kernel and the ghost ZArray per BC branch.

zoomy_core.model.boundary_conditions.boundary_face_branches(mesh, bcs)#

BC-kernel branch index of every boundary face of mesh, matched by tag name (the mesh’s own tag numbers are not branch indices). A face whose tag has no BC raises, except the reserved halo tag (branch -1); without bcs the mesh numbering is returned unchanged.

class zoomy_core.model.boundary_conditions.PerFieldBoundary(tag=None, slot_bc=None, n_state=0, **params)#

Bases: zoomy_core.model.boundary_conditions.BoundaryCondition

Composite BC for one tag: each state slot takes the value/gradient of the BC assigned to its field. Built by resolve_per_field; unclaimed slots fall back to Extrapolation.

Initialization

Store the {slot: BC} map and the state size.

compute_boundary_condition(time, X, dX, Q, Qaux, parameters, normal)#

Symbolic boundary value, per slot from the owning BC.

compute_boundary_gradient(time, X, dX, Q, Qaux, parameters, normal)#

Symbolic boundary gradient, per slot from the owning BC.

compute_ghost_state(time, X, dX, Q, Qaux, parameters, normal, bdata=None)#

Symbolic ghost state, per slot from the owning BC.

face_value(Q_inner, Qaux_inner, normal, d_face, time, parameters)#

Numpy boundary state, per slot from the owning BC.

face_gradient(Q_inner, Q_face, Qaux_inner, normal, d_face, time, parameters)#

Numpy face gradient, per slot from the owning BC.

zoomy_core.model.boundary_conditions.resolve_per_field(bc_list, state_names, aliases=None)#

Build a BoundaryConditions from a flat list of per-field BCs: one PerFieldBoundary per tag, unclaimed slots extrapolate, two BCs on one (tag, field) raise. Whole-patch BCs (Periodic, Coupled) pass through unwrapped.

zoomy_core.model.boundary_conditions.resolve_and_attach(sm, boundary_conditions, aux_bcs=None, aliases=None)#

Attach boundary conditions (a BoundaryConditions container or a flat per-field list) to the SystemModel sm; shared by every model’s system_model.