sparkl3d/dynamics/models/
elasticity_corotated_linear.rs

1use crate::dynamics::models::{
2    ActiveTimestepBounds, CoreConstitutiveModel, CorotatedLinearElasticity,
3};
4use crate::dynamics::{models::ConstitutiveModel, Particle};
5use crate::math::{Matrix, Real};
6
7impl ConstitutiveModel for CorotatedLinearElasticity {
8    fn is_fluid(&self) -> bool {
9        false
10    }
11
12    fn update_particle_stress(&self, particle: &Particle) -> Matrix<Real> {
13        self.kirchhoff_stress(
14            particle.phase,
15            particle.elastic_hardening,
16            &particle.deformation_gradient,
17        )
18    }
19
20    fn elastic_energy_density(&self, particle: &Particle) -> Real {
21        self.elastic_energy_density(particle.deformation_gradient, particle.elastic_hardening)
22    }
23
24    fn pos_energy(&self, particle: &Particle) -> Real {
25        self.pos_energy(particle.deformation_gradient, particle.elastic_hardening)
26    }
27
28    fn active_timestep_bounds(&self) -> ActiveTimestepBounds {
29        self.active_timestep_bounds()
30    }
31
32    fn timestep_bound(&self, particle: &Particle, cell_width: Real) -> Real {
33        self.timestep_bound(
34            particle.density0(),
35            &particle.velocity,
36            particle.elastic_hardening,
37            cell_width,
38        )
39    }
40
41    fn to_core_model(&self) -> Option<CoreConstitutiveModel> {
42        Some(CoreConstitutiveModel::CorotatedLinearElasticity(*self))
43    }
44}