NumFlux

Trait NumFlux 

Source
pub trait NumFlux<const E: usize, const S: usize> {
    // Required methods
    fn new(numflux_config: &NumFluxConfig, mesh: &Mesh<S>) -> Result<Self>
       where Self: Sized;
    fn calc_dflux_dxi<P: Physics<E, S>>(
        &mut self,
        dflux_dxi: &mut Array2<f64>,
        u: &mut State<P, E, S>,
        mesh: &Mesh<S>,
    ) -> Result<()>;
}
Expand description

Trait for structs that can calculate numerical flux

Required Methods§

Source

fn new(numflux_config: &NumFluxConfig, mesh: &Mesh<S>) -> Result<Self>
where Self: Sized,

Construct a new NumFlux trait object wrapped in a color_eyre::Result

§Arguments
  • numflux_config - configures the NumFlux object
  • mesh - the Mesh this simulation runs on
§Examples
use corries::prelude::*;

const S: usize = 100;
set_Physics_and_E!(Euler1DIsot);
let mesh: Mesh<S> = Mesh::<S>::new(&MeshConfig::default_riemann_test()).unwrap();

// construct an Hll numerical flux solver
let hll = Hll::<E, S>::new(&NumFluxConfig::Hll, &mesh);

// construct a Kt numerical flux solver
let kt = Kt::<E, S>::new(&NumFluxConfig::Kt { limiter_mode: LimiterMode::VanLeer }, &mesh);
Source

fn calc_dflux_dxi<P: Physics<E, S>>( &mut self, dflux_dxi: &mut Array2<f64>, u: &mut State<P, E, S>, mesh: &Mesh<S>, ) -> Result<()>

Calculates the numerical derivative along the xi direction.

§Arguments
  • dflux_dxi - derivative of the numerical flux over xi
  • u - current State of the simulation
  • mesh - the Mesh this simulation runs on
§Examples
use corries::prelude::*;
use ndarray::Array2;

const S: usize = 100;
set_Physics_and_E!(Euler1DIsot);
type N = Hll<E,S>;

// build a configuratoin for riemann tests
let t_end = 0.5;
let folder_name = "results";
let file_name = "noh";
let config = CorriesConfig::default_riemann_test::<N, E, S>(t_end, folder_name, file_name);

let mesh: Mesh<S> = Mesh::<S>::new(&config.mesh_config).unwrap();
let mut u: State<P, E, S> = State::new(&config.physics_config);

// construct an Hll numerical flux solver
let mut hll = N::new(&NumFluxConfig::Hll, &mesh).unwrap();

/* assume that we apply some initial conditions to u */

// this will store the numerical flux derivative
let mut dflux_dxi = Array2::<f64>::zeros((E, S));

hll.calc_dflux_dxi(&mut dflux_dxi, &mut u, &mesh).unwrap();

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<const E: usize, const S: usize> NumFlux<E, S> for Hll<E, S>

Source§

impl<const E: usize, const S: usize> NumFlux<E, S> for Kt<E, S>