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
//! Damage TC — **two** damage variables, one for tension and one for compression.
//!
//! Mazars blends its two branches into a single scalar `D`. That is economical,
//! but it means a material damaged in compression is equally damaged in tension:
//! the model cannot represent a crack that **closes** and carries load again.
//!
//! Damage TC (Faria-Oliver-Cervera) keeps the two apart:
//!
//! ```text
//! σ = (1 − d⁺)·σ̃⁺ + (1 − d⁻)·σ̃⁻
//! ```
//!
//! where `σ̃⁺` and `σ̃⁻` are the positive and negative parts of the **effective**
//! stress, split on its principal values. Each part is degraded by its own
//! variable, so unloading from tension into compression recovers the compressive
//! stiffness — the *unilateral* effect, which is what makes the law usable under
//! cyclic loading and what a single scalar cannot express.
//!
//! ## The two drivers
//!
//! Each damage has its own equivalent stress and its own history variable:
//!
//! ```text
//! τ⁺ = √(σ̃⁺ : ε) (tensile energy)
//! τ⁻ = √(√3·(K·σ̃⁻_oct + τ̃⁻_oct)) (compressive, octahedral)
//! r⁺ = max(r₀⁺, max_t τ⁺) r⁻ = max(r₀⁻, max_t τ⁻)
//! ```
//!
//! and each evolves by its own softening law — exponential in tension (a brittle
//! crack), and with a hardening-then-softening shape in compression.
//!
//! `r₀⁺ = f_t/√E` and `r₀⁻ = f_c/√E` are the thresholds; `A_t` and `A_c` set how
//! fast each branch softens.
use crateResult;
use crate;
use Matrix3;
/// The law's material contract.
///
/// ```
/// # 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(), "f_t".into(), "f_c".into(), "A_t".into(), "A_c".into()], &[30000.0, 0.2, 3.0, 30.0, 0.5, 0.5]).unwrap();
/// # let mat = MatRead { field: &materiau, cell: 0 };
/// // Deux résistances et deux fragilités : traction et compression sont
/// // suivies séparément.
/// assert!(damage::damage_tc::MATERIAL.contains(&"f_t"));
/// assert!(damage::damage_tc::MATERIAL.contains(&"f_c"));
/// # Ok::<(), pyrucast::PyrucastError>(())
/// ```
pub const MATERIAL: & = &;
/// One Damage-TC step.
///
/// `prev` carries `[r⁺, r⁻]`; the update returns them alongside the two damages
/// and the degraded stress.
///
/// ```
/// # 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(), "f_t".into(), "f_c".into(), "A_t".into(), "A_c".into()], &[30000.0, 0.2, 3.0, 30.0, 0.5, 0.5]).unwrap();
/// # let mat = MatRead { field: &materiau, cell: 0 };
/// // Deux endommagements distincts : la traction en active un, la
/// // compression l'autre — c'est ce qui **restitue la raideur** quand une
/// // fissure se referme.
/// let traction = damage::damage_tc::update(&[1e-3, 0.0, 0.0, 0.0, 0.0, 0.0], &[0.0; 4], &mat)?;
/// let compression =
/// damage::damage_tc::update(&[-1e-3, 0.0, 0.0, 0.0, 0.0, 0.0], &[0.0; 4], &mat)?;
/// assert_eq!(traction.vars.len(), 4); // r⁺, r⁻, d⁺, d⁻
/// assert!(traction.vars[2] > compression.vars[2]); // d⁺ : la traction seule
/// # Ok::<(), pyrucast::PyrucastError>(())
/// ```