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
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
//! Gurson-Tvergaard-Needleman — plasticity of a **porous** metal.
//!
//! A ductile metal does not fail by reaching a stress: it fails because voids
//! nucleate, grow and coalesce until the ligaments between them cannot carry the
//! load. Gurson's surface makes the porosity `f` an explicit internal variable
//! and lets it shrink the yield surface:
//!
//! ```text
//! Φ = (q/σ_y)² + 2q₁ f* cosh(3q₂ σ_m / 2σ_y) − (1 + q₃ f*²)
//! ```
//!
//! At `f = 0` this collapses to `q = σ_y` — von Mises exactly. As `f` grows the
//! surface contracts, and the `cosh` makes that contraction depend on the
//! **hydrostatic** stress: voids grow under triaxial tension and close under
//! compression. That pressure sensitivity is the whole point, and it is why a
//! J2 law can never predict ductile rupture.
//!
//! ## Coalescence: `f*` rather than `f`
//!
//! Voids do not weaken a material gradually all the way to failure — beyond a
//! critical porosity they **coalesce**, and the collapse accelerates sharply.
//! Tvergaard and Needleman model that by feeding the surface an *effective*
//! porosity:
//!
//! ```text
//! f* = f if f ≤ f_c
//! f* = f_c + (1/q₁ − f_c)·(f − f_c)/(f_f − f_c) otherwise
//! ```
//!
//! which reaches `1/q₁` — where the surface has shrunk to nothing — at the
//! failure porosity `f_f`. Without this the model predicts a far too ductile
//! material.
//!
//! ## Growth
//!
//! ```text
//! ḟ = (1 − f)·tr(ε̇_p)
//! ```
//!
//! Mass conservation, no more: the voids grow with the **volumetric** plastic
//! strain. Plastic flow on this surface is *not* isochoric — that is precisely
//! what distinguishes it from von Mises — so `tr(ε̇_p)` is non-zero, and the
//! `cosh` makes it grow with triaxiality. Nucleation (a strain- or
//! stress-driven source term) is **not** modelled: only growth from an initial
//! porosity `f_0`.
//!
//! ## Integration
//!
//! The surface is scalar and closed-form, but its return has no closed form, so
//! it goes through the same **cutting plane with a numerically differentiated
//! normal** as [`ottosen`](crate::models::plastic::ottosen). The normal here has
//! both a deviatoric and a volumetric part, which is exactly what makes the
//! plastic flow dilatant.
use crate;
use crate;
/// The **effective** porosity of Tvergaard and Needleman — `f` below the
/// coalescence threshold, accelerating to `1/q₁` at failure above it.
/// Gurson's yield function. Negative inside the elastic domain, and exactly
/// `(q/σ_y)² − 1` when the porosity vanishes.
///
/// ```
/// # 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::plastic::{self, MatParams, PlasticLaw, PrevState};
/// # 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(), "sigma_y".into(), "q_1".into(), "q_2".into(), "q_3".into(), "f_0".into(), "f_c".into(), "f_f".into()], &[210000.0, 0.3, 250.0, 1.5, 1.0, 2.25, 0.001, 0.15, 0.25]).unwrap();
/// # let mat = MatParams::new(&materiau, 0).unwrap();
/// # let repos = PrevState { eps: [0.0; 6], sigma: [0.0; 6], eps_p: [0.0; 6], p: 0.0,
/// # vars: vec![0.001] };
/// // La porosité **rétrécit** la surface de charge : à contrainte égale, un
/// // métal plus poreux est plus près de céder.
/// let s = [200.0, 0.0, 0.0, 0.0, 0.0, 0.0];
/// let sain = plastic::gurson::yield_function(&s, 0.001, &mat)?;
/// let poreux = plastic::gurson::yield_function(&s, 0.05, &mat)?;
/// assert!(poreux > sain);
/// # Ok::<(), pyrucast::PyrucastError>(())
/// ```
/// `∂Φ/∂σ` by central differences, in the **tensor** sense.
/// Cutting-plane return onto Gurson's surface, with the porosity updated from
/// the volumetric plastic flow it produces.
///
/// ```
/// # 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::plastic::{self, MatParams, PlasticLaw, PrevState};
/// # 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(), "sigma_y".into(), "q_1".into(), "q_2".into(), "q_3".into(), "f_0".into(), "f_c".into(), "f_f".into()], &[210000.0, 0.3, 250.0, 1.5, 1.0, 2.25, 0.001, 0.15, 0.25]).unwrap();
/// # let mat = MatParams::new(&materiau, 0).unwrap();
/// # let repos = PrevState { eps: [0.0; 6], sigma: [0.0; 6], eps_p: [0.0; 6], p: 0.0,
/// # vars: vec![0.001] };
/// // La porosité **est** l'état : elle croît avec l'écoulement, et c'est
/// // elle qui mène à la rupture ductile.
/// let trial = [800.0, 400.0, 400.0, 0.0, 0.0, 0.0];
/// let pas = plastic::gurson::return_map(&trial, &repos, &mat)?;
/// assert!(pas.p > 0.0);
/// assert_eq!(pas.vars.len(), 1);
/// assert!(pas.vars[0] >= repos.vars[0]); // la porosité ne décroît pas
/// # Ok::<(), pyrucast::PyrucastError>(())
/// ```