Skip to main content

ParametricMOLSystem2D

Struct ParametricMOLSystem2D 

Source
pub struct ParametricMOLSystem2D<S: SparseScalar> { /* private fields */ }
Expand description

Parametric 2D Method of Lines system.

See the module-level docs for the parameter layout, the linearity argument that makes the scaled-operator path correct, and the boundary-condition handling.

Implementations§

Source§

impl<S: SparseScalar> ParametricMOLSystem2D<S>

Source

pub fn heat( grid: Grid2D<S>, alpha_nominal: S, bc: &BoundaryConditions2D<S>, ) -> Self

Build a parametric heat equation u_t = α∇²u with the diffusion coefficient α as the single parameter.

Source

pub fn heat_with_reaction<R>( grid: Grid2D<S>, alpha_nominal: S, bc: &BoundaryConditions2D<S>, nominal_reaction_params: Vec<S>, reaction: R, ) -> Self
where R: Fn(S, S, S, S, &[S]) -> S + Send + Sync + 'static,

Build a parametric heat equation with a parametric reaction term.

The full parameter vector is [α, reaction_params...]nominal_reaction_params supplies nominal values for the reaction parameters only; α goes in slot 0 separately.

The reaction closure receives (t, x, y, u, &p_full) where p_full is the full parameter slice (p_full[0] is α; p_full[1..] are the reaction parameters supplied here).

Source

pub fn grid(&self) -> &Grid2D<S>

Get the spatial grid.

Source

pub fn n_interior(&self) -> usize

Number of interior points (the ODE state dimension).

Trait Implementations§

Source§

impl<S: SparseScalar> ParametricOdeSystem<S> for ParametricMOLSystem2D<S>

Source§

fn jacobian_y(&self, t: S, y: &[S], jac: &mut [S])

Analytical state Jacobian: α · L0 plus the diagonal reaction contribution. Same structure as MOLSystem2D::jacobian, but the linear part is scaled by α from the parameter vector — and the reaction sees the full parameter slice.

Source§

fn jacobian_p(&self, t: S, y: &[S], jp: &mut [S])

Analytical parameter Jacobian. Column 0 (the α slot) is L0·y + bc_rhs_0 analytically, plus any ∂R/∂α contribution from the reaction closure (FD-detected). Columns 1..N_s are pure reaction contributions (FD on the closure with the relevant slot perturbed). The reaction is pointwise so each column has only diagonal entries (one nonzero per grid point).

Source§

fn n_states(&self) -> usize

Number of state variables N (the dimension of y).
Source§

fn n_params(&self) -> usize

Number of parameters N_s (the dimension of p).
Source§

fn params(&self) -> &[S]

Nominal parameter vector. Length must equal Self::n_params.
Source§

fn rhs_with_params(&self, t: S, y: &[S], p: &[S], dydt: &mut [S])

Evaluate f(t, y, p) -> dy/dt for an arbitrary parameter vector p. Read more
Source§

fn has_analytical_jacobian_y(&self) -> bool

Returns true iff Self::jacobian_y has been overridden with an analytical implementation. Default: false. Read more
Source§

fn has_analytical_jacobian_p(&self) -> bool

Returns true iff Self::jacobian_p has been overridden with an analytical implementation. Default: false. See Self::has_analytical_jacobian_y for the rationale, contract, and debug-build consistency check.
Source§

fn rhs(&self, t: S, y: &[S], dydt: &mut [S])

Convenience: evaluate the RHS at the system’s nominal parameters.
Source§

fn initial_sensitivity(&self, _y0: &[S], s0: &mut [S])

Initial sensitivity ∂y_0/∂p, column-major (s0[k*N + i], length N · N_s). Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V