1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
//! Mazars isotropic damage — the classical concrete law.
//!
//! Damage is driven by an **equivalent strain** built from the positive
//! principal strains, `ε̃ = √(Σ⟨ε_I⟩₊²)`, so it responds to extension and is
//! blind to hydrostatic compression. The stress is the effective one, degraded:
//! `σ = (1 − D)·C:ε`.
//!
//! Two branches, tension and compression, are blended by the weights `α_t`,
//! `α_c` derived from the split of the effective stress — which is what lets one
//! law describe a material an order of magnitude stronger in compression.
//!
//! The single history variable is `κ = max_t ε̃`: damage never heals.
use crateResult;
use crate;
use Matrix3;
/// Material parameters of the Mazars model at one Gauss point.
///
/// ```
/// # use pyrucast::aggregate::Aggregate;
/// # use pyrucast::atoms::{ElementType, Node};
/// # use pyrucast::containers::element_field::SubElementField;
/// # use pyrucast::containers::finite_element_space::FiniteElementSpace;
/// # use pyrucast::containers::mesh::{Mesh, SubMesh};
/// # use pyrucast::coords::Coords;
/// # use pyrucast::handle::Handle;
/// # use pyrucast::models::damage::{self, MatRead};
/// # let coords = Handle::new(Coords::new(2).unwrap());
/// # let n: Vec<Node> = [[0.0, 0.0], [1.0, 0.0], [0.0, 1.0]]
/// # .iter().map(|p| Node::create_in(coords.clone(), p).unwrap()).collect();
/// # let mut sm = SubMesh::new(coords.clone(), ElementType::TRI3);
/// # sm.add_cell(&[n[0].id(), n[1].id(), n[2].id()])?;
/// # let fes = FiniteElementSpace::lagrange1(&Mesh::from_submesh(sm))?;
/// # let materiau = SubElementField::from_uniform_per_component(
/// # fes.get(0)?, vec!["E".into(), "nu".into(), "eps_d0".into(), "A_t".into(),
/// # "B_t".into(), "A_c".into(), "B_c".into()],
/// # &[30_000.0, 0.2, 1e-4, 0.8, 20_000.0, 1.4, 1_850.0])?;
/// # let mat = MatRead { field: &materiau, cell: 0 };
/// // Les paramètres de Mazars, lus une fois par maille : le seuil `eps_d0`
/// // et les deux branches, traction et compression. Ils ne sont pas
/// // exposés champ par champ — c'est `update` qui les emploie.
/// let u = damage::mazars::update(&[1e-3, 0.0, 0.0, 0.0, 0.0, 0.0], &[0.0], &mat)?;
/// assert!(u.damage > 0.0);
/// # Ok::<(), pyrucast::PyrucastError>(())
/// ```
/// One damage branch `D = 1 − eps_d0(1−A)/κ − A / exp(B (κ − eps_d0))`,
/// clamped to `[0, 1)`.
/// Mazars point update. Returns `(stress, damage, kappa)` (stress full 3-D Voigt).
/// The law's material contract and its history variable.
///
/// ```
/// # use pyrucast::aggregate::Aggregate;
/// # use pyrucast::atoms::{ElementType, Node};
/// # use pyrucast::containers::element_field::SubElementField;
/// # use pyrucast::containers::finite_element_space::FiniteElementSpace;
/// # use pyrucast::containers::mesh::{Mesh, SubMesh};
/// # use pyrucast::coords::Coords;
/// # use pyrucast::handle::Handle;
/// # use pyrucast::models::damage::{self, DamageLaw, MatRead};
/// # let coords = Handle::new(Coords::new(2).unwrap());
/// # let n: Vec<Node> = [[0.0, 0.0], [1.0, 0.0], [0.0, 1.0]]
/// # .iter().map(|p| Node::create_in(coords.clone(), p).unwrap()).collect();
/// # let mut sm = SubMesh::new(coords.clone(), ElementType::TRI3);
/// # sm.add_cell(&[n[0].id(), n[1].id(), n[2].id()]).unwrap();
/// # let fes = FiniteElementSpace::lagrange1(&Mesh::from_submesh(sm)).unwrap();
/// # let materiau = SubElementField::from_uniform_per_component(
/// # fes.get(0).unwrap(), vec!["E".into(), "nu".into(), "eps_d0".into(), "A_t".into(), "B_t".into(), "A_c".into(), "B_c".into()], &[30000.0, 0.2, 0.0001, 0.8, 20000.0, 1.4, 1850.0]).unwrap();
/// # let mat = MatRead { field: &materiau, cell: 0 };
/// // Un seuil `eps_d0`, puis deux branches : traction (A_t, B_t) et
/// // compression (A_c, B_c), mélangées par la part de traction.
/// assert!(damage::mazars::MATERIAL.contains(&"eps_d0"));
/// # Ok::<(), pyrucast::PyrucastError>(())
/// ```
pub const MATERIAL: & = &;
/// One Mazars step: `(σ, D, κ)` from the strain and the previous history.
///
/// ```
/// # use pyrucast::aggregate::Aggregate;
/// # use pyrucast::atoms::{ElementType, Node};
/// # use pyrucast::containers::element_field::SubElementField;
/// # use pyrucast::containers::finite_element_space::FiniteElementSpace;
/// # use pyrucast::containers::mesh::{Mesh, SubMesh};
/// # use pyrucast::coords::Coords;
/// # use pyrucast::handle::Handle;
/// # use pyrucast::models::damage::{self, DamageLaw, MatRead};
/// # let coords = Handle::new(Coords::new(2).unwrap());
/// # let n: Vec<Node> = [[0.0, 0.0], [1.0, 0.0], [0.0, 1.0]]
/// # .iter().map(|p| Node::create_in(coords.clone(), p).unwrap()).collect();
/// # let mut sm = SubMesh::new(coords.clone(), ElementType::TRI3);
/// # sm.add_cell(&[n[0].id(), n[1].id(), n[2].id()]).unwrap();
/// # let fes = FiniteElementSpace::lagrange1(&Mesh::from_submesh(sm)).unwrap();
/// # let materiau = SubElementField::from_uniform_per_component(
/// # fes.get(0).unwrap(), vec!["E".into(), "nu".into(), "eps_d0".into(), "A_t".into(), "B_t".into(), "A_c".into(), "B_c".into()], &[30000.0, 0.2, 0.0001, 0.8, 20000.0, 1.4, 1850.0]).unwrap();
/// # let mat = MatRead { field: &materiau, cell: 0 };
/// // `kappa` est la mémoire de la loi : il **ne décroît pas**. Décharger
/// // après avoir endommagé ne répare rien.
/// let grand = [1e-3, 0.0, 0.0, 0.0, 0.0, 0.0];
/// let charge = damage::mazars::update(&grand, &[0.0], &mat)?;
/// let petit = [1e-5, 0.0, 0.0, 0.0, 0.0, 0.0];
/// let decharge = damage::mazars::update(&petit, &charge.vars, &mat)?;
/// assert_eq!(decharge.vars[0], charge.vars[0]);
/// // `damage` est recalculé depuis κ, d'où l'égalité à l'arrondi près.
/// assert!((decharge.damage - charge.damage).abs() < 1e-12);
/// // La contrainte, elle, retombe : la raideur est celle du matériau
/// // endommagé, pas celle du matériau sain.
/// assert!(decharge.sigma[0] < charge.sigma[0]);
/// # Ok::<(), pyrucast::PyrucastError>(())
/// ```