Skip to main content

CoupledSolver

Struct CoupledSolver 

Source
pub struct CoupledSolver {
    pub tolerance: f64,
    pub max_iter: usize,
    pub relaxation: f64,
}
Expand description

Multiphysics coupled solver strategies.

Provides operator splitting, staggered scheme, and monolithic Newton iteration.

Fields§

§tolerance: f64

Convergence tolerance.

§max_iter: usize

Maximum iterations.

§relaxation: f64

Relaxation parameter ω for successive substitution (0 < ω ≤ 1).

Implementations§

Source§

impl CoupledSolver

Source

pub fn new(tolerance: f64, max_iter: usize, relaxation: f64) -> Self

Creates a new coupled solver.

Source

pub fn operator_split<FA, FB>( &self, a0: f64, b0: f64, solve_a: FA, solve_b: FB, ) -> (f64, f64, usize)
where FA: Fn(f64) -> f64, FB: Fn(f64) -> f64,

Operator splitting: alternately solve field A then field B.

solve_a(b) -> a and solve_b(a) -> b are the individual field solvers. Returns the converged (a, b) pair and number of iterations.

Source

pub fn staggered<F>(&self, state0: &[f64], step_fn: F) -> (Vec<f64>, usize)
where F: Fn(&[f64]) -> Vec<f64>,

Staggered scheme: sequential solve with fixed-point iteration.

Returns converged state vector and iteration count.

Source

pub fn monolithic_newton<F>(&self, x0: &[f64], residual: F) -> (Vec<f64>, usize)
where F: Fn(&[f64]) -> Vec<f64>,

Monolithic Newton iteration for a coupled residual R(x) = 0.

Uses finite-difference Jacobian and direct solve via Gaussian elimination.

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, 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.