NEOPAX._boundary_conditions

Modular boundary condition (BC) abstraction for NEOPAX, inspired by torax.

Attributes

BC_REGISTRY

Classes

BoundaryCondition

DirichletBC

NeumannBC

RobinBC

BoundaryConditionModel

Left/right radial BC for 1D arrays with optional species-wise values.

Functions

register_bc(name, bc_class)

get_bc(name, *args, **kwargs)

build_boundary_condition_model(bc_cfg, dr[, ...])

_as_like_template(value, template)

Broadcast or resize scalar/species-wise values to match template shape.

_boundary_cell_spacing(face_centers, *, side)

right_constraints_from_bc_model(bc_model, default_value)

Translate right BC model to CellVariable right-face constraints.

left_constraints_from_bc_model(bc_model, default_value)

Translate left BC model to CellVariable left-face constraints.

apply_cell_centered_boundary_state(profile, bc_model, ...)

Project cell-centered profiles so boundary cells satisfy the configured BCs.

Module Contents

class NEOPAX._boundary_conditions.BoundaryCondition
abstractmethod apply(flux, state=None, axis=True, edge=True, **kwargs)
class NEOPAX._boundary_conditions.DirichletBC(axis_value, edge_value)

Bases: BoundaryCondition

axis_value
edge_value
apply(flux, state=None, axis=True, edge=True, **kwargs)
class NEOPAX._boundary_conditions.NeumannBC(grad_axis, grad_edge, dr)

Bases: BoundaryCondition

grad_axis
grad_edge
dr
apply(flux, state=None, axis=True, edge=True, **kwargs)
class NEOPAX._boundary_conditions.RobinBC(alpha_axis, beta_axis, gamma_axis, alpha_edge, beta_edge, gamma_edge, dr)

Bases: BoundaryCondition

alpha_axis
beta_axis
gamma_axis
alpha_edge
beta_edge
gamma_edge
dr
apply(flux, state, axis=True, edge=True, **kwargs)
NEOPAX._boundary_conditions.BC_REGISTRY
NEOPAX._boundary_conditions.register_bc(name, bc_class)
NEOPAX._boundary_conditions.get_bc(name, *args, **kwargs)
class NEOPAX._boundary_conditions.BoundaryConditionModel

Left/right radial BC for 1D arrays with optional species-wise values.

dr: float
left_type: str = 'dirichlet'
right_type: str = 'dirichlet'
left_value: jax.numpy.ndarray | None = None
right_value: jax.numpy.ndarray | None = None
left_gradient: jax.numpy.ndarray | None = None
right_gradient: jax.numpy.ndarray | None = None
left_decay_length: jax.numpy.ndarray | None = None
right_decay_length: jax.numpy.ndarray | None = None
reference_profile: jax.numpy.ndarray | None = None
reference_profiles: jax.numpy.ndarray | None = None
static _as_jnp_or_none(value, species_names=None)
static _pick_for_row(value, row_index: int)
_infer_gradient(arr: jax.numpy.ndarray) tuple[jax.numpy.ndarray, jax.numpy.ndarray]
_infer_log_gradient_coeff(boundary_value: jax.numpy.ndarray, boundary_grad: jax.numpy.ndarray) jax.numpy.ndarray
_infer_decay_length(boundary_value: jax.numpy.ndarray, boundary_grad: jax.numpy.ndarray) jax.numpy.ndarray
_apply_ghost_row(arr: jax.numpy.ndarray, row_index: int, reference_row: jax.numpy.ndarray | None) jax.numpy.ndarray
apply_ghost(arr: jax.numpy.ndarray) jax.numpy.ndarray
apply_ghost_all(arr2d: jax.numpy.ndarray) jax.numpy.ndarray
NEOPAX._boundary_conditions.build_boundary_condition_model(bc_cfg: dict, dr: float, reference_profile=None, reference_profiles=None, species_names=None)
NEOPAX._boundary_conditions._as_like_template(value, template)

Broadcast or resize scalar/species-wise values to match template shape.

NEOPAX._boundary_conditions._boundary_cell_spacing(face_centers, *, side: str)
NEOPAX._boundary_conditions.right_constraints_from_bc_model(bc_model, default_value, profile=None, face_centers=None)

Translate right BC model to CellVariable right-face constraints.

Returns:

(right_face_constraint, right_face_grad_constraint) where one of the entries is typically None and the other is a JAX array.

Return type:

tuple

NEOPAX._boundary_conditions.left_constraints_from_bc_model(bc_model, default_value, profile=None, face_centers=None)

Translate left BC model to CellVariable left-face constraints.

NEOPAX._boundary_conditions.apply_cell_centered_boundary_state(profile, bc_model, face_centers)

Project cell-centered profiles so boundary cells satisfy the configured BCs.