sparkl2d/dynamics/models/
constitutive_model.rs

1use crate::core::prelude::{ActiveTimestepBounds, CoreConstitutiveModel};
2use crate::dynamics::Particle;
3use crate::math::{Matrix, Real};
4
5pub trait ConstitutiveModel: Send + Sync {
6    fn is_fluid(&self) -> bool;
7
8    fn elastic_energy_density(&self, _particle: &Particle) -> Real {
9        0.0
10    }
11
12    fn pos_energy(&self, _particle: &Particle) -> Real {
13        0.0
14    }
15    fn update_particle_stress(&self, particle: &Particle) -> Matrix<Real>;
16    fn update_internal_energy_and_pressure(
17        &self,
18        _particle: &mut Particle,
19        _dt: Real,
20        _cell_width: Real,
21    ) {
22    }
23    fn active_timestep_bounds(&self) -> ActiveTimestepBounds;
24    fn timestep_bound(&self, particle: &Particle, cell_width: Real) -> Real;
25    fn to_core_model(&self) -> Option<CoreConstitutiveModel>;
26}