Struct dzahui::solvers::fem::stokes_solver::dim1::StokesSolver1D
source · pub struct StokesSolver1D {
pub(crate) stiffness_matrix: Array2<f64>,
pub(crate) b_vector: Array1<f64>,
pub gauss_step: usize,
pub hydrostatic_pressure: f64,
pub rho: f64,
}
Expand description
General Information
A Stokes solver 1d abstracts the equation: “(1/ρ)p_x = f” with constant velocity and hydrostatic pressure “ρ”
Fields
boundary_condition_pressure
- Original boundary conditions (Only Dirichlet is supported for now).stiffness_matrix
- Left-side matrix of resulting discrete equation.b_vector
- Right-side vector of the resulting discrete equation.gauss_step
- Precision of quadrature.speed
- Constant speed.rho
- Constant density.
Fields§
§stiffness_matrix: Array2<f64>
§b_vector: Array1<f64>
§gauss_step: usize
§hydrostatic_pressure: f64
§rho: f64
Implementations§
source§impl StokesSolver1D
impl StokesSolver1D
sourcepub fn new(
params: &StokesParams1D,
mesh: Vec<f64>,
gauss_step: usize
) -> Result<Self, Error>
pub fn new(
params: &StokesParams1D,
mesh: Vec<f64>,
gauss_step: usize
) -> Result<Self, Error>
Creates a new instance of solver from params
sourcepub fn gauss_legendre_integration(
rho: f64,
hydrostatic_pressure: f64,
mesh: &Vec<f64>,
gauss_step: usize,
function: &Box<dyn Fn(f64) -> f64>
) -> Result<(Array2<f64>, Array1<f64>), Error>
pub fn gauss_legendre_integration(
rho: f64,
hydrostatic_pressure: f64,
mesh: &Vec<f64>,
gauss_step: usize,
function: &Box<dyn Fn(f64) -> f64>
) -> Result<(Array2<f64>, Array1<f64>), Error>
General Information
First, it generates the basis for a solver from the linear basis constructor. Then the stiffnes matrix and vector b are generated based on linear basis integration via Gauss-Legendre and returned. Note that vector and matrix will have one on their diagonals’ boundaries and zero on other boundary elements to make boundary conditions permanent.
Parameters
rho
- densityhydrostatic_pressure
mesh
- Vector of f64 representing a linegauss_step
- How many nodes will be calculated for a given integrationfunction
- Force acting on the fluid
Returns
A tuple with both the stiffness matrix and the vector b.