NeoPZ
TPZPorousElasticResponse.h
Go to the documentation of this file.
1 //
2 // TPZPorousElasticResponse.h
3 // pz
4 //
5 // Created by Omar Durán on 1/16/19.
6 //
7 
8 #ifndef TPZPorousElasticResponse_h
9 #define TPZPorousElasticResponse_h
10 
11 #include <stdio.h>
12 #include <iostream>
13 #include "TPZTensor.h"
14 #include "pzreal.h"
15 #include "TPZElasticResponse.h"
16 
18 
19 private:
20 
22  STATE m_kappa;
23 
25  STATE m_pt_el;
26 
28  STATE m_e_0;
29 
31  STATE m_p_0;
32 
34  STATE m_nu;
35 
37  STATE m_mu;
38 
41 
44 
45 public:
46 
47  //@TODO:: Document the Class
48 
49  int ClassId() const override;
50 
52 
54 
56 
57  void Write(TPZStream &buf, int withclassid) const override;
58 
59  void Read(TPZStream &buf, void *context) override;
60 
61  void SetPorousElasticity(STATE kappa, STATE pt_el, STATE e_0, STATE p_0);
62 
63  void Setp_0(STATE p_0);
64 
65  void Sete_0(STATE e_0);
66 
67  void SetShearModulusConstant(STATE G);
68 
69  void SetPoissonRatioConstant(STATE nu);
70 
71  void SetPlaneStrain();
72 
73  void SetPlaneStress();
74 
75  const char * Name() const ;
76 
77  void Print(std::ostream & out) const ;
78 
79  void G(const TPZTensor<STATE> &epsilon, STATE & G, STATE & dG_desp_vol) const;
80 
81  void Poisson(const TPZTensor<STATE> &epsilon, STATE & nu, STATE & dnu_desp_vol) const;
82 
83  void Poisson_linearized(const TPZTensor<STATE> &epsilon_ref,const TPZTensor<STATE> &epsilon, STATE & nu) const;
84 
85  void K(const TPZTensor<STATE> &epsilon, STATE & K, STATE & dK_desp_vol) const;
86 
87  void De(const TPZTensor<STATE> & epsilon, TPZFMatrix<STATE> & De) const;
88 
89  void De_G_constant(const TPZTensor<STATE> & epsilon, TPZFMatrix<STATE> & De) const;
90 
91  void De_Poisson_constant(const TPZTensor<STATE> & epsilon, TPZFMatrix<STATE> & De) const;
92 
95 
97  TPZElasticResponse LinearizedElasticResponse(const TPZTensor<STATE> & epsilon_ref, const TPZTensor<STATE> & epsilon) const;
98 
99  template<class T>
100  void ComputeStress(const TPZTensor<T> & epsilon, TPZTensor<T> & sigma) const {
101 
102  if (m_is_G_constant_Q) {
103  T trace = T(epsilon.I1());
104  STATE lambda, K, dK_desp_vol;
105  this->K(epsilon, K, dK_desp_vol);
106  lambda = K - (2.0/3.0)*m_mu;
107  sigma.Identity();
108  sigma.Multiply(trace, lambda);
109  sigma.Add(epsilon, 2. * m_mu);
110  }else{
111  T trace = T(epsilon.I1());
112  REAL lambda, G, dG_desp_vol;
113  this->G(epsilon,G,dG_desp_vol);
114  lambda = T((2.0*G*m_nu)/(1.0-2.0*m_nu));
115  sigma.Identity();
116  sigma.Multiply(trace, lambda);
117  sigma.Add(epsilon, 2. * G);
118  }
119 
120  }
121 
122  template<class T>
123  void ComputeStrain(const TPZTensor<T> & sigma, TPZTensor<T> & epsilon) const {
124 
125  // Initial guess is for the deviatoric is obtained from the given epsilon
126  // Computing the initial guess for the volumetric part
127  REAL p, p_star, r, j;
128  p = -sigma.I1()/3;
129  int n_iterations = 20;
130  bool stop_criterion = false;
131  REAL res_tol = 1.0e-5;
132  REAL eps_v = 0.0;
133  for(int i = 0; i < n_iterations; i++){
134  p_star = - m_pt_el + exp(-eps_v*(1.0+m_e_0)/m_kappa)*(m_p_0 + m_pt_el);
135  r = p - p_star;
136  stop_criterion = fabs(r) < res_tol;
137  if(stop_criterion){
138  break;
139  }
140  j = -(exp(-eps_v*(1.0+m_e_0)/m_kappa)*(1.0+m_e_0)*(m_p_0 + m_pt_el))/(m_kappa);
141  REAL deps_v = r / j;
142  eps_v += deps_v;
143  }
144 
145  epsilon.XX() = eps_v/3.0;
146  epsilon.YY() = eps_v/3.0;
147  epsilon.ZZ() = eps_v/3.0;
148 
149 
150  n_iterations = 40;
151  stop_criterion = false;
152  res_tol = 1.0e-8;
153  REAL corr_tol = 1.0e-8;
154  TPZFNMatrix<6,STATE> res_sigma(6,1), delta_eps(6,1), eps_k(6,1);
155  TPZTensor<T> delta_sigma, sigma_i;
156  epsilon.CopyTo(eps_k);
157 
158  REAL res_norm = 1.0;
159  REAL corr_norm = 1.0;
160  int i;
161  for (i = 0; i < n_iterations; i++) {
162 
163  ComputeStress(epsilon, sigma_i);
164  delta_sigma = sigma - sigma_i;
165  delta_sigma.CopyTo(res_sigma);
166  res_norm = Norm(res_sigma);
167  stop_criterion = res_norm < res_tol && corr_norm < corr_tol;
168  if (stop_criterion) {
169  break;
170  }
171  TPZFNMatrix<36,STATE> De(6,6,0.0),De_inv;
172  STATE det;
173  this->De(epsilon, De);
174 
175  De.DeterminantInverse(det, De_inv);
176  if (IsZero(det)) {
177  std::cout << "TPZPorousElasticResponse:: De matrix does not have an inverse." << std::endl;
178  DebugStop();
179  }
180 
181  De_inv.Multiply(res_sigma, delta_eps);
182  corr_norm = Norm(delta_eps);
183  eps_k += delta_eps;
184  epsilon.CopyFrom(eps_k);
185  }
186  if ( i == n_iterations) {
187  std::cout << "TPZPorousElasticResponse:: Inversion process does not converge." << std::endl;
188  std::cout << "TPZPorousElasticResponse:: Residual norm = " << res_norm << std::endl;
189  std::cout << "TPZPorousElasticResponse:: Correction norm = " << corr_norm << std::endl;
190  DebugStop();
191  }
192 
193  }
194 
195 };
196 
197 #endif /* TPZPorousElasticResponse_h */
bool m_is_G_constant_Q
Directive for define constant shear modulus calculations (false means constant Poisson ratio) ...
expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ fabs
Definition: tfadfunc.h:140
void CopyTo(TPZTensor< T1 > &target) const
Definition: TPZTensor.h:819
void ComputeStress(const TPZTensor< T > &epsilon, TPZTensor< T > &sigma) const
void Add(const TPZTensor< T1 > &tensor, const T2 &constant)
Definition: TPZTensor.h:757
void CopyFrom(const TPZFMatrix< T > &source)
Definition: TPZTensor.h:833
void Multiply(const T1 &multipl, const T2 &constant)
Definition: TPZTensor.h:766
bool IsZero(long double a)
Returns if the value a is close Zero as the allowable tolerance.
Definition: pzreal.h:668
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
TPZPorousElasticResponse & operator=(const TPZPorousElasticResponse &other)
void SetPorousElasticity(STATE kappa, STATE pt_el, STATE e_0, STATE p_0)
TVar Norm(const TPZFMatrix< TVar > &A)
Returns the norm of the matrix A.
#define DebugStop()
Returns a message to user put a breakpoint in.
Definition: pzerror.h:20
STATE m_pt_el
Elastic tensile strengh.
void De(const TPZTensor< STATE > &epsilon, TPZFMatrix< STATE > &De) const
void Identity()
Definition: TPZTensor.h:705
void De_G_constant(const TPZTensor< STATE > &epsilon, TPZFMatrix< STATE > &De) const
void Read(TPZStream &buf, void *context) override
void De_Poisson_constant(const TPZTensor< STATE > &epsilon, TPZFMatrix< STATE > &De) const
T & XX() const
Definition: TPZTensor.h:566
virtual void Multiply(const TPZFMatrix< TVar > &A, TPZFMatrix< TVar > &res, int opt=0) const
It mutiplies itself by TPZMatrix<TVar>A putting the result in res.
Definition: pzmatrix.cpp:1916
STATE m_e_0
Initial void ratio.
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
Contains the declaration of TPZFlopCounter class and TPZCounter struct.
void ComputeStrain(const TPZTensor< T > &sigma, TPZTensor< T > &epsilon) const
void Write(TPZStream &buf, int withclassid) const override
TPZElasticResponse EvaluateElasticResponse(const TPZTensor< STATE > &epsilon) const
Computes a linear elastic response from function evaluation of non linear expressions.