pub struct MOLSystem2D<S: SparseScalar> { /* private fields */ }Expand description
2D Method of Lines system.
Converts a 2D PDE of the form u_t = L[u] + R(t, x, y, u)
into an ODE system, where L is a linear spatial operator assembled
as a sparse matrix and R is an optional nonlinear reaction term.
Implementations§
Source§impl<S: SparseScalar> MOLSystem2D<S>
impl<S: SparseScalar> MOLSystem2D<S>
Sourcepub fn heat(grid: Grid2D<S>, alpha: S, bc: &BoundaryConditions2D<S>) -> Self
pub fn heat(grid: Grid2D<S>, alpha: S, bc: &BoundaryConditions2D<S>) -> Self
Create a 2D MOL system for the heat equation: u_t = alpha * laplacian(u).
Sourcepub fn laplacian(grid: Grid2D<S>, bc: &BoundaryConditions2D<S>) -> Self
pub fn laplacian(grid: Grid2D<S>, bc: &BoundaryConditions2D<S>) -> Self
Create a 2D MOL system for the Laplacian: u_t = laplacian(u).
Sourcepub fn with_operator(
grid: Grid2D<S>,
coeffs: &Operator2DCoefficients<S>,
bc: &BoundaryConditions2D<S>,
) -> Self
pub fn with_operator( grid: Grid2D<S>, coeffs: &Operator2DCoefficients<S>, bc: &BoundaryConditions2D<S>, ) -> Self
Create a 2D MOL system with a general linear operator.
Sourcepub fn with_reaction<F>(self, reaction: F) -> Self
pub fn with_reaction<F>(self, reaction: F) -> Self
Add a nonlinear reaction term R(t, x, y, u) to the system.
The full PDE becomes: u_t = L[u] + R(t, x, y, u).
Sourcepub fn n_interior(&self) -> usize
pub fn n_interior(&self) -> usize
Number of interior points (ODE dimension).
Sourcepub fn build_full_solution(&self, u_interior: &[S]) -> Vec<S>
pub fn build_full_solution(&self, u_interior: &[S]) -> Vec<S>
Build the full solution array including boundaries.
Interior values are stored in column-major order: u[jj * nx_int + ii]. The full array has nx*ny entries in the same column-major layout.
Trait Implementations§
Source§impl<S: SparseScalar> OdeSystem<S> for MOLSystem2D<S>
impl<S: SparseScalar> OdeSystem<S> for MOLSystem2D<S>
Source§fn jacobian(&self, t: S, y: &[S], jac: &mut [S])
fn jacobian(&self, t: S, y: &[S], jac: &mut [S])
Analytical Jacobian: copy the assembled sparse spatial operator
(which already equals ∂(L[u])/∂u by construction) into the row-major
dense buffer the solver expects, then add the reaction term’s
contribution to the diagonal.
The reaction Jacobian is diagonal because the reaction is
pointwise: R(t, x_i, y_j, u_i) depends only on the local state
u_i, so ∂R_i/∂u_k is identically zero for any k != i. Off-
diagonal entries cannot be populated by a pointwise reaction, no
matter what the closure contains. This is what makes the
FD-on-the-diagonal fallback affordable: one extra closure call per
interior point versus the O(N) rhs evaluations the trait-default
FD would need to populate the same entries through perturbation.
If a future reaction model couples grid points (nonlocal /
integro-PDE / multi-component), the trait default’s full FD path is
the correct fallback — but that’s out of scope for v1.
Source§fn is_autonomous(&self) -> bool
fn is_autonomous(&self) -> bool
Source§fn has_mass_matrix(&self) -> bool
fn has_mass_matrix(&self) -> bool
Source§fn mass_matrix(&self, mass: &mut [S])
fn mass_matrix(&self, mass: &mut [S])
Source§fn is_singular_mass(&self) -> bool
fn is_singular_mass(&self) -> bool
Auto Trait Implementations§
impl<S> Freeze for MOLSystem2D<S>
impl<S> !RefUnwindSafe for MOLSystem2D<S>
impl<S> Send for MOLSystem2D<S>
impl<S> Sync for MOLSystem2D<S>
impl<S> Unpin for MOLSystem2D<S>where
S: Unpin,
impl<S> UnsafeUnpin for MOLSystem2D<S>
impl<S> !UnwindSafe for MOLSystem2D<S>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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