OneSimulation docs Website Free books Plans on Gumroad

Docs › Numerical API reference › onesim.numerics.fvm

B.7 onesim.numerics.fvm

BarthJespersenLimiter class

BarthJespersenLimiter(epsilon: float = 1e-14) -> None

Limit reconstructed values to the local neighbor range on a supported multidimensional stencil.

Methods and properties.

factor(center: float, neighbors: tuple[float, ...], increment: float) -> float

limit slope.

limit_slope(center: float, left: float, right: float, slope: float) -> float

Apply the limiter to the given one-sided slopes.

factor_jvp(center, neighbors, increment, center_direction, neighbors_direction, increment_direction)

Derivative of the executed extremum/ratio branch at a cell face.

cell_factor(center, neighbors, increment)

Compute the reconstruction limiter factor for the given cell data.

cell_factor_jvp(center, neighbors, increment, center_direction, neighbors_direction, increment_direction)

Evaluate the directional derivative of the cell limiter factor.

limit(left_slope: float, right_slope: float) -> float

Limit both cell faces against the actual signed neighbor changes.

limit_jvp(left_slope, right_slope, left_direction, right_direction)

Evaluate the directional derivative of the limited result.

BoundaryLeastSquaresGradient class

BoundaryLeastSquaresGradient(*, factory: object = None) -> None

Reconstruct cell gradients with boundary data through the supported least-squares port.

Methods and properties.

bind(*, geometry)

Bind this declaration to the supplied execution context and collaborators.

CellGradientReconstruction class

CellGradientReconstruction(*, factory: object | None = None) -> None

Declare a native cell-gradient reconstruction component for compatible volume carriers.

Methods and properties.

bind_volume(*, geometry, gradient, limiter=None)

Bind this declaration to a supported volume mesh.

CentralDifference class

CentralDifference(factory: object | None = None) -> None

Select the central FV diffusion contribution on supported carriers. This is a different declaration from fdm.CentralDifference.

Methods and properties.

bind(*, geometry, gradient)

Bind this declaration to the supplied execution context and collaborators.

bind_scalar(*, geometry, gradient)

Bind the declaration for a scalar field.

CentralElasticStress class

CentralElasticStress(*, factory: object = None) -> None

Choose the central FV stress contribution for a compatible elasticity formulation.

Methods and properties.

bind_elasticity(*, geometry, gradient)

Bind the finite-volume elasticity collaborator.

ConvexInvariantDomain class

ConvexInvariantDomain(*, factory: object | None = None) -> None

Retract face states toward their unchanged cell mean to satisfy the bound invariant domain.

Methods and properties.

bind(*, admissible)

Bind this declaration to the supplied execution context and collaborators.

DifferentiableSamples class

DifferentiableSamples(values: object, jacobian: object) -> None

Carry sampled values and their Jacobian together in a differentiable FV assembly.

Methods and properties.

variables(values)

Create differentiable samples representing independent variables.

constant(value)

Create differentiable samples with a zero derivative.

unary(values, derivative)

Apply a unary operation with its derivative to the samples.

apply(matrix)

Apply the bound operation with the supplied values and collaborators.

sum()

Reduce the differentiable samples while propagating the corresponding derivatives.

Eno2Reconstructor class

Eno2Reconstructor() -> None

Select a smooth second-order scalar ENO stencil at the face.

Methods and properties.

bind(*, cell_widths, limiter=None)

Bind this declaration to the supplied execution context and collaborators.

reconstruct_left_interfaces(values: tuple[float, ...]) -> tuple[float, ...]

Reconstruct the left state at each supported interface from cell samples.

Eno3Reconstructor class

Eno3Reconstructor() -> None

Select a smooth quadratic scalar ENO stencil at the face.

Methods and properties.

bind(*, cell_widths, limiter=None)

Bind this declaration to the supplied execution context and collaborators.

reconstruct_left_interfaces(values: tuple[float, ...]) -> tuple[float, ...]

Reconstruct the left state at each supported interface from cell samples.

FiniteIntegration class

FiniteIntegration(*, hodge: object, topology: object = <factory>) -> None

Select a discrete incidence complex and metric Hodge maps for a compatible curl operator.

Methods and properties.

bind_complex(*, mesh, cell_quadrature_order, face_quadrature_order)

Build the discrete incidence complex and metric operators on the supplied mesh.

FiniteVolume class

FiniteVolume(*, face_quadrature_order: int = 3, cell_quadrature_order: int = 3, convection: object | None = None, reconstruction: object | None = None, limiter: object | None = None, positivity: object | None = None, stability: object | None = None, diffusion: object | None = None, curl: object | None = None, stabilization: object | None = None, boundary_enforcement: object | None = None, gradient: object | None = None, velocity_pressure_interpolation: object | None = None, particle_flux: object | None = None, energy_flux: object | None = None, reaction_sources: object | None = None, initialization: object | None = None, provider: object | None = None) -> None

Compose control-volume term operators, reconstruction, limiter, initialization, and cell and face quadrature.

Methods and properties.

option_applicability(*, context)

Dimension-dependent semantics, not a claim of provider execution.

HydrostaticReconstruction class

HydrostaticReconstruction(*, dry_linearization: object = None) -> None

Reconstruct depth and discharge consistently with the bed for a supported well-balanced method.

Methods and properties.

validate(*, numerics, **unused)

Validate the supplied numerical context or input.

bind_operator(*, model, mesh, numerics, boundary_conditions, initial_conditions, inputs=None, **unused)

Construct the selected operator on the supplied geometry and context.

ImplicitLocalSources class

ImplicitLocalSources(factory: object | None = None) -> None

Select the implicit local source treatment for models exposing a compatible reaction or source operator.

Methods and properties.

to_mapping()

Return the mapping representation used for configuration and diagnostics.

bind(*, model, geometry)

Bind this declaration to the supplied execution context and collaborators.

LeastSquaresGradient class

LeastSquaresGradient(factory: object | None = None) -> None

Choose least-squares reconstruction of cell gradients for supported face fluxes and field diagnostics.

Methods and properties.

bind(*, geometry)

Bind this declaration to the supplied execution context and collaborators.

LinearUpwind class

LinearUpwind(factory: object | None = None) -> None

Select a linear upwind reconstruction for the compatible FV convective operator.

Methods and properties.

bind(*, geometry, gradient, reconstruction=None)

Bind this declaration to the supplied execution context and collaborators.

bind_scalar_advection(*, geometry, gradient, reconstruction=None)

Construct the scalar advection flux collaborator for the selected carrier.

MimeticCurl class

MimeticCurl(*, factory: object = None) -> None

Choose the mimetic discrete curl route for supported electromagnetic models.

Methods and properties.

bind(*, shape, extents, wave_number_squared, relative_permittivity, source, field_id)

Bind this declaration to the supplied execution context and collaborators.

MinmodLimiter class

MinmodLimiter() -> None

Limit two scalar one-sided slopes with minmod to obtain a TVD slope on the supported stencil.

Methods and properties.

limit_jvp(left_slope, right_slope, left_direction, right_direction)

Selected generalized derivative; ties use the executed right branch.

limit(left_slope: float, right_slope: float) -> float

Return the limited state or slope for the supplied carrier and admissibility policy.

MonotoneUpwind class

MonotoneUpwind(*, factory: object | None = None) -> None

Select scalar upwinding with a physical flux monotone in the declared direction.

Methods and properties.

bind(*, physical_flux, direction, wave_speed=None, physical_flux_jacobian=None)

Bind this declaration to the supplied execution context and collaborators.

bind_conservation(*, law)

Bind the conservative operator using the physical flux and geometry supplied by the model.

to_mapping()

Return the mapping representation used for configuration and diagnostics.

MonotonizedCentralLimiter class

MonotonizedCentralLimiter() -> None

Use a monotonized central TVD slope with less flattening than minmod in smooth regions.

Methods and properties.

limit_jvp(left_slope, right_slope, left_direction, right_direction)

Selected generalized derivative, preserving the minimum's tie order.

limit(left_slope: float, right_slope: float) -> float

Return the limited state or slope for the supplied carrier and admissibility policy.

MUSCL class

MUSCL(*, factory: object | None = None) -> None

Reconstruct conservative piecewise-linear face states. Select the limiter separately.

Methods and properties.

bind(*, cell_widths, limiter=None)

Bind this declaration to the supplied execution context and collaborators.

OrientedCellComplex class

OrientedCellComplex() -> None

Represent oriented incidence between discrete geometric entities, independently of the metric.

Methods and properties.

bind(*, edge_space, face_space)

Bind this declaration to the supplied execution context and collaborators.

OrthogonalHodge class

OrthogonalHodge() -> None

Select orthogonal metric Hodge maps on a supported orthogonal carrier.

Methods and properties.

bind(*, mesh, cell_quadrature_order, face_quadrature_order)

Bind this declaration to the supplied execution context and collaborators.

RhieChow class

RhieChow(factory: object | None = None) -> None

Select collocated face-velocity interpolation with pressure correction in a supported flow model.

Methods and properties.

bind(*, geometry, gradient)

Bind this declaration to the supplied execution context and collaborators.

Rusanov class

Rusanov(*, factory: object | None = None) -> None

Select the local Lax–Friedrichs flux using the physical model's wave-speed estimate.

Methods and properties.

bind_conservation(*, law)

Bind the conservative operator using the physical flux and geometry supplied by the model.

to_mapping()

Return the mapping representation used for configuration and diagnostics.

bind(*, equation_of_state=None, physical_flux=None, wave_speed=None, direction=None)

Bind this declaration to the supplied execution context and collaborators.

ScharfetterGummel class

ScharfetterGummel(factory: object | None = None, gradient: object | None = None) -> None

Choose an exponential-fitting flux for drift–diffusion. Supply a gradient collaborator if the binding requires one.

Methods and properties.

bind(*, geometry, gradient=None, reconstruction=None, limiter=None)

Bind this declaration to the supplied execution context and collaborators.

SuperbeeLimiter class

SuperbeeLimiter() -> None

Choose a compressive TVD limiter for a compatible scalar slope reconstruction.

Methods and properties.

limit_jvp(left_slope, right_slope, left_direction, right_direction)

Selected min/max branch, including the executed tie ordering.

limit(left_slope: float, right_slope: float) -> float

Return the limited state or slope for the supplied carrier and admissibility policy.

TvbLimiter class

TvbLimiter(base_limiter: Callable[[float, float], float], tvb_constant: float = 0.0, mesh_width: float = 1.0, base_tangent: object = None) -> None

Wrap a base limiter with a mesh-width and curvature threshold for suppressing limiting near smooth extrema.

Methods and properties.

limit(left_slope: float, right_slope: float) -> float

Return the limited state or slope for the supplied carrier and admissibility policy. supports_jvp. Check availability of a Jacobian-vector product for the selected path.

limit_jvp(left_slope, right_slope, left_direction, right_direction)

Evaluate the directional derivative of the limited result.

TwoPointDiffusion class

TwoPointDiffusion(*, factory: object | None = None) -> None

Select a two-point diffusion flux based on adjacent cell values.

Methods and properties.

bind(*, geometry, coefficients, periodic)

Bind this declaration to the supplied execution context and collaborators.

VanLeerLimiter class

VanLeerLimiter() -> None

Use a harmonic TVD slope where the one-sided slopes agree in sign.

Methods and properties.

limit_jvp(left_slope, right_slope, left_direction, right_direction)

Exact smooth-branch derivative, zero on the selected inactive branch.

limit(left_slope: float, right_slope: float) -> float

Return the limited state or slope for the supplied carrier and admissibility policy.

VenkatakrishnanLimiter class

VenkatakrishnanLimiter(epsilon: float = 1e-08) -> None

Use smooth slope limiting with a regularizing epsilon.

Methods and properties.

factor(delta: float, variation: float) -> float

Evaluate the limiter or trace scaling factor.

limit_slope(left_slope: float, right_slope: float) -> float

Apply the limiter to the given one-sided slopes.

factor_jvp(delta, variation, delta_direction, variation_direction)

Differentiate the selected regularized rational factor.

cell_factor(center, neighbors, increment)

Compute the reconstruction limiter factor for the given cell data.

cell_factor_jvp(center, neighbors, increment, center_direction, neighbors_direction, increment_direction)

Evaluate the directional derivative of the cell limiter factor.

limit(left_slope: float, right_slope: float) -> float

Return the limited state or slope for the supplied carrier and admissibility policy.

limit_jvp(left_slope, right_slope, left_direction, right_direction)

Differentiate the signed available variation and selected factor.

Weno3Reconstructor class

Weno3Reconstructor(epsilon: float = 1e-12) -> None

Reconstruct a scalar left trace with WENO3 weights on the supported uniform line stencil.

Methods and properties.

bind(*, cell_widths, limiter=None)

Bind this declaration to the supplied execution context and collaborators.

reconstruct_left_interfaces(values: tuple[float, ...]) -> tuple[float, ...]

Reconstruct the left state at each supported interface from cell samples.

Weno5Reconstructor class

Weno5Reconstructor(epsilon: float = 1e-12) -> None

Reconstruct a scalar left trace with WENO5 weights on the supported uniform line stencil.

Methods and properties.

bind(*, cell_widths, limiter=None)

Bind this declaration to the supplied execution context and collaborators.

reconstruct_left_interfaces(values: tuple[float, ...]) -> tuple[float, ...]

Reconstruct the left state at each supported interface from cell samples.

WetDryActiveSet class

WetDryActiveSet() -> None

Select the wet/dry active-set treatment for a compatible shallow-water linearization.

Methods and properties.

inactive_dry_nodes(values, rate)

Identify nodes treated as inactive by the dry-state rule.

bind_flux(flux, law)

Bind the face flux with the supplied physical and geometric collaborators.

linearize(*, residual, state, context)

Evaluate the local derivative or directional linearization of the operation.

linearization_law(law)

Return the selected linearization policy.

reconstructed_direction(state, star, direction, *, bed, high)

Reconstruct the supplied direction for the tangent calculation.

WetDryTraceScaling class

WetDryTraceScaling() -> None

Retract depth and discharge traces by one factor toward admissible means.

Methods and properties.

bind(*, admissible)

Bind this declaration to the supplied execution context and collaborators.

WhitneyHodge class

WhitneyHodge(edge_reconstruction: object | None = None, face_reconstruction: object | None = None) -> None

Use Whitney reconstruction for metric edge and face maps, with optional reconstruction collaborators.

Methods and properties.

bind(*, mesh, cell_quadrature_order, face_quadrature_order)

Bind this declaration to the supplied execution context and collaborators.