conspire/constitutive/fluid/viscoplastic/
mod.rs

1//! Viscoplastic constitutive models.
2
3use crate::{
4    constitutive::{ConstitutiveError, fluid::plastic::Plastic},
5    math::{Scalar, Tensor, TensorArray},
6    mechanics::{MandelStressElastic, StretchingRatePlastic},
7};
8
9const TWO_THIRDS: Scalar = 2.0 / 3.0;
10
11/// Required methods for viscoplastic constitutive models.
12pub trait Viscoplastic
13where
14    Self: Plastic,
15{
16    /// Calculates and returns the rate of plastic stretching.
17    ///
18    /// ```math
19    /// \mathbf{D}_\mathrm{p} = d_0\left(\frac{|\mathbf{M}_\mathrm{e}'|}{Y(S)}\right)^{\footnotesize\tfrac{1}{m}}\frac{\mathbf{M}_\mathrm{e}'}{|\mathbf{M}_\mathrm{e}'|}
20    /// ```
21    fn plastic_stretching_rate(
22        &self,
23        deviatoric_mandel_stress_e: MandelStressElastic,
24        yield_stress: Scalar,
25    ) -> Result<StretchingRatePlastic, ConstitutiveError> {
26        let magnitude = deviatoric_mandel_stress_e.norm();
27        if magnitude == 0.0 {
28            Ok(StretchingRatePlastic::zero())
29        } else {
30            Ok(deviatoric_mandel_stress_e
31                * (self.reference_flow_rate() / magnitude
32                    * (magnitude / yield_stress).powf(1.0 / self.rate_sensitivity())))
33        }
34    }
35    /// Returns the rate_sensitivity parameter.
36    fn rate_sensitivity(&self) -> Scalar;
37    /// Returns the reference flow rate.
38    fn reference_flow_rate(&self) -> Scalar;
39    /// Calculates and returns the evolution of the yield stress.
40    ///
41    /// ```math
42    /// \dot{Y} = \sqrt{\frac{2}{3}}\,H\,|\mathbf{D}_\mathrm{p}|
43    /// ```
44    fn yield_stress_evolution(
45        &self,
46        plastic_stretching_rate: &StretchingRatePlastic,
47    ) -> Result<Scalar, ConstitutiveError> {
48        Ok(self.hardening_slope() * plastic_stretching_rate.norm() * TWO_THIRDS.sqrt())
49    }
50}
51
52/// The viscoplastic flow model.
53#[derive(Clone, Debug)]
54pub struct ViscoplasticFlow {
55    /// The initial yield stress $`Y_0`$.
56    pub initial_yield_stress: Scalar,
57    /// The isotropic hardening slope $`H`$.
58    pub hardening_slope: Scalar,
59    /// The rate sensitivity parameter $`m`$.
60    pub rate_sensitivity: Scalar,
61    /// The reference flow rate $`d_0`$.
62    pub reference_flow_rate: Scalar,
63}
64
65impl Plastic for ViscoplasticFlow {
66    fn initial_yield_stress(&self) -> Scalar {
67        self.initial_yield_stress
68    }
69    fn hardening_slope(&self) -> Scalar {
70        self.hardening_slope
71    }
72}
73
74impl Viscoplastic for ViscoplasticFlow {
75    fn rate_sensitivity(&self) -> Scalar {
76        self.rate_sensitivity
77    }
78    fn reference_flow_rate(&self) -> Scalar {
79        self.reference_flow_rate
80    }
81}