NeoPZ
TPZPorousElasticResponse.cpp
Go to the documentation of this file.
1 //
2 // TPZPorousElasticResponse.cpp
3 // pz
4 //
5 // Created by Omar Durán on 1/16/19.
6 //
7 
9 
10 
12  return Hash("TPZPorousElasticResponse");
13 }
14 
16 
17  m_kappa = 0.0;
18  m_pt_el = 0.0;
19  m_e_0 = 0.0;
20  m_p_0 = 0.0;
21  m_nu = 0.0;
22  m_mu = 0.0;
23  m_is_G_constant_Q = false;
24  m_plane_stress_Q = false;
25 }
26 
28 
29  m_kappa = other.m_kappa;
30  m_pt_el = other.m_pt_el;
31  m_e_0 = other.m_e_0;
32  m_p_0 = other.m_p_0;
33  m_nu = other.m_nu;
34  m_mu = other.m_mu;
37 }
38 
40 
41  // check for self-assignment
42  if(&other == this){
43  return *this;
44  }
45 
46  m_kappa = other.m_kappa;
47  m_pt_el = other.m_pt_el;
48  m_e_0 = other.m_e_0;
49  m_p_0 = other.m_p_0;
50  m_nu = other.m_nu;
51  m_mu = other.m_mu;
54  return *this;
55 }
56 
57 void TPZPorousElasticResponse::Write(TPZStream& buf, int withclassid) const { //ok
58  buf.Write(&m_kappa);
59  buf.Write(&m_pt_el);
60  buf.Write(&m_e_0);
61  buf.Write(&m_p_0);
62  buf.Write(&m_nu);
63  buf.Write(&m_mu);
66 }
67 
68 void TPZPorousElasticResponse::Read(TPZStream& buf, void* context) { //ok
69  buf.Read(&m_kappa);
70  buf.Read(&m_pt_el);
71  buf.Read(&m_e_0);
72  buf.Read(&m_p_0);
73  buf.Read(&m_nu);
74  buf.Read(&m_mu);
77 }
78 
79 void TPZPorousElasticResponse::SetPorousElasticity(STATE kappa, STATE pt_el, STATE e_0, STATE p_0)
80 {
81  m_kappa = kappa;
82  m_pt_el = pt_el;
83  m_e_0 = e_0;
84  m_p_0 = p_0;
85 }
86 
88  m_p_0 = p_0;
89 }
90 
92  m_e_0 = e_0;
93 }
94 
96  m_is_G_constant_Q = true;
97  m_mu = G;
98 }
99 
101  m_is_G_constant_Q = false;
102  m_nu = nu;
103 }
104 
106  m_plane_stress_Q = false;
107 }
108 
110  m_plane_stress_Q = true;
111 }
112 
113 const char * TPZPorousElasticResponse::Name() const {
114  return "TPZPorousElasticResponse";
115 }
116 
117 void TPZPorousElasticResponse::Print(std::ostream & out) const {
118  out << this->Name();
119  out << "\n Logarithmic bulk modulus = " << m_kappa;
120  out << "\n Elastic tensile strength = " << m_pt_el;
121  out << "\n Initial void ratio = " << m_e_0;
122  out << "\n Initial hydrostatic stress = " << m_p_0;
123  out << "\n Constant Shear modulus directive = " << m_is_G_constant_Q;
124  if (m_is_G_constant_Q) {
125  out << "\n Second Lamé parameter (Shear modulus) = " << m_mu;
126  }else{
127  out << "\n Poisson ratio = " << m_nu;
128  }
129  out << "\n Plane stress state directive = " << m_plane_stress_Q;
130 }
131 
132 void TPZPorousElasticResponse::G(const TPZTensor<STATE> &epsilon, STATE & G, STATE & dG_desp_vol) const{
133 
134  STATE epsv = epsilon.I1();
135  G = (3*(1 + m_e_0)*(1 + epsv)*(1 - 2*m_nu)*(m_p_0 + m_pt_el))/
136  (2.*exp(((1 + m_e_0)*epsv)/m_kappa)*m_kappa*(1 + m_nu));
137 
138  dG_desp_vol = (-3*pow(1 + m_e_0,2)*(1 + epsv)*
139  (1 - 2*m_nu)*(m_p_0 + m_pt_el))/
140  (2.*exp(((1 + m_e_0)*epsv)/m_kappa)*
141  pow(m_kappa,2)*(1 + m_nu)) +
142  (3*(1 + m_e_0)*(1 - 2*m_nu)*(m_p_0 + m_pt_el))/
143  (2.*exp(((1 + m_e_0)*epsv)/m_kappa)*
144  m_kappa*(1 + m_nu));
145 }
146 
147 void TPZPorousElasticResponse::Poisson(const TPZTensor<STATE> &epsilon, STATE & nu, STATE & dnu_desp_vol) const{
148 
149  if (m_is_G_constant_Q) {
150  STATE lambda, K, dK_desp_vol, dnu_dK;
151  this->K(epsilon, K, dK_desp_vol);
152  nu = -1 + (9*K)/(2.*(3*K + m_mu));
153  dnu_dK = (9*m_mu)/(2.*pow(3*K + m_mu,2));
154  dnu_desp_vol = dnu_dK * dK_desp_vol;
155  }else{
156  nu = m_nu;
157  dnu_desp_vol = 0.0;
158  }
159 
160 }
161 
162 void TPZPorousElasticResponse::Poisson_linearized(const TPZTensor<STATE> &epsilon_ref,const TPZTensor<STATE> &epsilon, STATE & nu) const{
163 
164  STATE epsv = epsilon.I1();
165  STATE epsv_ref = epsilon_ref.I1();
166  nu = -1 + (9*(1 + m_e_0)*(m_p_0 + m_pt_el)*
167  (m_mu*exp((epsv_ref*(1 + m_e_0))/m_kappa)*
168  (-((epsv - epsv_ref)*(1 + epsv_ref)*
169  (1 + m_e_0)) + (1 + epsv)*m_kappa) +
170  3*pow(1 + epsv_ref,2)*(1 + m_e_0)*(m_p_0 + m_pt_el)))/
171  (2.*pow(m_mu*exp((epsv_ref*(1 + m_e_0))/m_kappa)*m_kappa +
172  3*(1 + epsv_ref)*(1 + m_e_0)*(m_p_0 + m_pt_el),2));
173 }
174 
175 void TPZPorousElasticResponse::K(const TPZTensor<STATE> &epsilon, STATE & K, STATE & dK_desp_vol) const{
176 
177  STATE epsv = epsilon.I1();
178  K = ((1 + epsv)*(1 + m_e_0)*(m_p_0 + m_pt_el))/(exp((epsv*(1 + m_e_0))/m_kappa)*m_kappa);
179 
180  dK_desp_vol = -(((1 + m_e_0)*(1 + epsv + m_e_0 + epsv*m_e_0 - m_kappa)*
181  (m_p_0 + m_pt_el))/(exp((epsv*(1 + m_e_0))/m_kappa)*pow(m_kappa,2)));
182 }
183 
184 
186 
187  STATE lambda, K, dK_desp_vol;
188  this->K(epsilon, K, dK_desp_vol);
189  lambda = K - (2.0/3.0)*m_mu;
190 
191  // Line 0
192  De.PutVal(_XX_,_XX_, lambda + 2. * m_mu);
193  De.PutVal(_XX_,_YY_, lambda);
194  De.PutVal(_XX_,_ZZ_, lambda);
195 
196  // Line 1
197  De.PutVal(_XY_,_XY_, 2. * m_mu);
198 
199  // Line 2
200  De.PutVal(_XZ_,_XZ_, 2. * m_mu);
201 
202  // Line 3
203  De.PutVal(_YY_,_XX_, lambda);
204  De.PutVal(_YY_,_YY_, lambda + 2. * m_mu);
205  De.PutVal(_YY_,_ZZ_, lambda);
206 
207  // Line 4
208  De.PutVal(_YZ_,_YZ_, 2. * m_mu);
209 
210  // Line 5
211  De.PutVal(_ZZ_,_XX_, lambda);
212  De.PutVal(_ZZ_,_YY_, lambda);
213  De.PutVal(_ZZ_,_ZZ_, lambda + 2. * m_mu);
214 
216  TPZFMatrix<STATE> De_nl(6,6,0.0);
217  REAL constant = ( epsilon.XX() + epsilon.YY() + epsilon.ZZ() ) * dK_desp_vol;
218 
219  // Line 0
220  De_nl.PutVal(_XX_, _XX_, 1.0);
221  De_nl.PutVal(_XX_, _YY_, 1.0);
222  De_nl.PutVal(_XX_, _ZZ_, 1.0);
223 
224  // Line 3
225  De_nl.PutVal(_YY_, _XX_, 1.0);
226  De_nl.PutVal(_YY_, _YY_, 1.0);
227  De_nl.PutVal(_YY_, _ZZ_, 1.0);
228 
229  // Line 5
230  De_nl.PutVal(_ZZ_, _XX_, 1.0);
231  De_nl.PutVal(_ZZ_, _YY_, 1.0);
232  De_nl.PutVal(_ZZ_, _ZZ_, 1.0);
233 
234  De+=constant*De_nl;
235 }
236 
238 
239  STATE lambda, G, dG_desp_vol;
240  this->G(epsilon, G, dG_desp_vol);
241  lambda = (2.0*G*m_nu)/(1.0-2.0*m_nu);
242 
243  // Line 0
244  De.PutVal(_XX_,_XX_, lambda + 2. * G);
245  De.PutVal(_XX_,_YY_, lambda);
246  De.PutVal(_XX_,_ZZ_, lambda);
247 
248  // Line 1
249  De.PutVal(_XY_,_XY_, 2. * G);
250 
251  // Line 2
252  De.PutVal(_XZ_,_XZ_, 2. * G);
253 
254  // Line 3
255  De.PutVal(_YY_,_XX_, lambda);
256  De.PutVal(_YY_,_YY_, lambda + 2. * G);
257  De.PutVal(_YY_,_ZZ_, lambda);
258 
259  // Line 4
260  De.PutVal(_YZ_,_YZ_, 2. * G);
261 
262  // Line 5
263  De.PutVal(_ZZ_,_XX_, lambda);
264  De.PutVal(_ZZ_,_YY_, lambda);
265  De.PutVal(_ZZ_,_ZZ_, lambda + 2. * G);
266 
268  TPZFMatrix<STATE> De_nl(6,6,0.0);
269  REAL constant = (2.0/(-1.0+2.0*m_nu));
270 
271  // Line 0
272  REAL l0_val = constant * ( epsilon.XX() * (m_nu - 1.0) - m_nu * (epsilon.YY() + epsilon.ZZ())) * dG_desp_vol;
273  De_nl.PutVal(_XX_, _XX_, l0_val);
274  De_nl.PutVal(_XX_, _YY_, l0_val);
275  De_nl.PutVal(_XX_, _ZZ_, l0_val);
276 
277  // Line 1
278  REAL l1_val = 2.0 * dG_desp_vol * epsilon.XY();
279  De_nl.PutVal(_XY_, _XX_, l1_val);
280  De_nl.PutVal(_XY_, _YY_, l1_val);
281  De_nl.PutVal(_XY_, _ZZ_, l1_val);
282 
283  // Line 2
284  REAL l2_val = 2.0 * dG_desp_vol * epsilon.XZ();
285  De_nl.PutVal(_XZ_, _XX_, l2_val);
286  De_nl.PutVal(_XZ_, _YY_, l2_val);
287  De_nl.PutVal(_XZ_, _ZZ_, l2_val);
288 
289  // Line 3
290  REAL l3_val = constant * ( epsilon.YY() * (m_nu - 1.0) - m_nu * (epsilon.XX() + epsilon.ZZ())) * dG_desp_vol;
291  De_nl.PutVal(_YY_, _XX_, l3_val);
292  De_nl.PutVal(_YY_, _YY_, l3_val);
293  De_nl.PutVal(_YY_, _ZZ_, l3_val);
294 
295  // Line 4
296  REAL l4_val = 2.0 * dG_desp_vol * epsilon.YZ();
297  De_nl.PutVal(_YZ_, _XX_, l4_val);
298  De_nl.PutVal(_YZ_, _YY_, l4_val);
299  De_nl.PutVal(_YZ_, _ZZ_, l4_val);
300 
301  // Line 5
302  REAL l5_val = constant * ( epsilon.ZZ() * (m_nu - 1.0) - m_nu * (epsilon.XX() + epsilon.YY())) * dG_desp_vol;
303  De_nl.PutVal(_ZZ_, _XX_, l5_val);
304  De_nl.PutVal(_ZZ_, _YY_, l5_val);
305  De_nl.PutVal(_ZZ_, _ZZ_, l5_val);
306 
307  De+=De_nl;
308  return;
309 }
310 
312  if (m_is_G_constant_Q) {
313  De_G_constant(epsilon, De);
314  }else{
315  De_Poisson_constant(epsilon, De);
316  }
317 }
318 
320 
321  TPZElasticResponse LinearER;
322  REAL Eyoung;
324  STATE G;
325  if (m_is_G_constant_Q) {
326  STATE K,dK_desp_vol,nu;
327  this->K(epsilon, K, dK_desp_vol);
328  Eyoung = 9*K*m_mu/(3.0*K+m_mu);
329  nu = (3.0*K-2.0*m_mu)/(2.0*(3.0*K+m_mu));
330  LinearER.SetEngineeringData(Eyoung, nu);
331  }else{
332  STATE dG_desp_vol;
333  this->G(epsilon, G, dG_desp_vol);
334  Eyoung = 2*G*(1.0+m_nu);
335  LinearER.SetEngineeringData(Eyoung, m_nu);
336  }
337 
339  {
340  TPZTensor<REAL> linear_epsilon,sigma, eps_res;
341  this->ComputeStress(epsilon, sigma);
342  LinearER.ComputeStrain(sigma, linear_epsilon);
343  eps_res = epsilon - linear_epsilon;
344  LinearER.SetResidualStrainData(eps_res);
345  }
346 
347  return LinearER;
348 }
349 
351 
352  TPZElasticResponse LinearER;
353  REAL Eyoung;
355  STATE G;
356  if (m_is_G_constant_Q) {
357  STATE nu;
358  this->Poisson_linearized(epsilon_ref,epsilon, nu);
359  Eyoung = 2*m_mu*(1.0+nu);
360  LinearER.SetEngineeringData(Eyoung, nu);
361  }else{
362  STATE dG_desp_vol;
363  this->G(epsilon, G, dG_desp_vol);
364  Eyoung = 2*G*(1.0+m_nu);
365  LinearER.SetEngineeringData(Eyoung, m_nu);
366  DebugStop(); // Implement linearization for G expression.
367  }
368 
370  {
371  TPZTensor<REAL> linear_epsilon,sigma, eps_res;
372  this->ComputeStress(epsilon, sigma);
373  LinearER.ComputeStrain(sigma, linear_epsilon);
374  eps_res = epsilon - linear_epsilon;
375  LinearER.SetResidualStrainData(eps_res);
376  }
377 
378  return LinearER;
379 }
#define _XZ_
Definition: TPZTensor.h:29
bool m_is_G_constant_Q
Directive for define constant shear modulus calculations (false means constant Poisson ratio) ...
void ComputeStress(const TPZTensor< T > &epsilon, TPZTensor< T > &sigma) const
bool m_plane_stress_Q
Directive for define Plain stress state or plane strain state.
T I1() const
Definition: TPZTensor.h:903
TPZElasticResponse LinearizedElasticResponse(const TPZTensor< STATE > &epsilon_ref, const TPZTensor< STATE > &epsilon) const
Computes a linear elastic response from the linearization around a reference state eps_ref...
void Print(std::ostream &out) const
STATE m_mu
Second lamé parameter.
T & YY() const
Definition: TPZTensor.h:578
STATE m_p_0
Initial equivalent pressure stress.
STATE m_kappa
Logarithmic bulk modulus.
void Poisson_linearized(const TPZTensor< STATE > &epsilon_ref, const TPZTensor< STATE > &epsilon, STATE &nu) const
T & YZ() const
Definition: TPZTensor.h:582
TPZPorousElasticResponse & operator=(const TPZPorousElasticResponse &other)
void SetPorousElasticity(STATE kappa, STATE pt_el, STATE e_0, STATE p_0)
virtual void Write(const bool val)
Definition: TPZStream.cpp:8
void ComputeStrain(const TPZTensor< T > &sigma, TPZTensor< T > &epsilon) const
#define DebugStop()
Returns a message to user put a breakpoint in.
Definition: pzerror.h:20
#define _XX_
Definition: TPZTensor.h:27
#define _YZ_
Definition: TPZTensor.h:31
STATE m_pt_el
Elastic tensile strengh.
#define _XY_
Definition: TPZTensor.h:28
void De(const TPZTensor< STATE > &epsilon, TPZFMatrix< STATE > &De) const
#define _YY_
Definition: TPZTensor.h:30
int32_t Hash(std::string str)
Definition: TPZHash.cpp:10
void De_G_constant(const TPZTensor< STATE > &epsilon, TPZFMatrix< STATE > &De) const
#define _ZZ_
Definition: TPZTensor.h:32
TPZFlopCounter pow(const TPZFlopCounter &orig, const TPZFlopCounter &xp)
Returns the power and increments the counter of the power.
Definition: pzreal.h:487
void Read(TPZStream &buf, void *context) override
void De_Poisson_constant(const TPZTensor< STATE > &epsilon, TPZFMatrix< STATE > &De) const
void SetEngineeringData(REAL Eyoung, REAL Poisson)
T & XX() const
Definition: TPZTensor.h:566
STATE m_e_0
Initial void ratio.
T & XY() const
Definition: TPZTensor.h:570
T & ZZ() const
Definition: TPZTensor.h:586
expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ exp
Definition: tfadfunc.h:125
Defines the interface for saving and reading data. Persistency.
Definition: TPZStream.h:50
T & XZ() const
Definition: TPZTensor.h:574
void Write(TPZStream &buf, int withclassid) const override
int PutVal(const int64_t row, const int64_t col, const TVar &value) override
Put values without bounds checking This method is faster than "Put" if DEBUG is defined.
Definition: pzfmatrix.h:548
TPZElasticResponse EvaluateElasticResponse(const TPZTensor< STATE > &epsilon) const
Computes a linear elastic response from function evaluation of non linear expressions.
void SetResidualStrainData(TPZTensor< REAL > &eps_res)
virtual void Read(bool &val)
Definition: TPZStream.cpp:91