NeoPZ
TPZMatElastoPlastic_impl.h
Go to the documentation of this file.
1 //
2 // TPZMatElastoPlastic_impl.h
3 // pz
4 //
5 // Created by Omar DurĂ¡n on 9/8/18.
6 //
7 
8 #include "TPZMatElastoPlastic.h"
9 #include "pzbndcond.h"
10 #include "pzlog.h"
11 
12 #ifdef LOG4CXX
13 static LoggerPtr elastoplasticLogger(Logger::getLogger("pz.material.pzElastoPlastic"));
14 static LoggerPtr updatelogger(Logger::getLogger("pz.material.pzElastoPlastic.update"));
15 static LoggerPtr ceckconvlogger(Logger::getLogger("checkconvmaterial"));
16 #endif
17 
18 
19 template <class T, class TMEM>
20 TPZMatElastoPlastic<T,TMEM>::TPZMatElastoPlastic() : TPZMatWithMem<TMEM>(), m_force(), m_rho_bulk(0), m_PostProcessDirection(), m_tol(1.e-6)
21 {
22  m_force.Resize(3,0);
23  m_force[1] = -9.8; // proper gravity acceleration in m/s^2
25  m_PostProcessDirection[0] = 1.;
27 
28 #ifdef LOG4CXX
29  if(elastoplasticLogger->isDebugEnabled())
30  {
31  std::stringstream sout;
32  sout << ">>> TPZMatElastoPlastic<T,TMEM>() constructor called ***";
33  LOGPZ_DEBUG(elastoplasticLogger,sout.str().c_str());
34  }
35 #endif
36 
37 }
38 
39 template <class T, class TMEM>
41 {
42  m_force.Resize(3,0);
43  m_force[1] = -9.8; // proper gravity acceleration in m/s^2 -> 1=y 0=x 2=z
45  m_PostProcessDirection[0] = 1.;
48 
49 
50 #ifdef LOG4CXX
51  if (elastoplasticLogger->isDebugEnabled())
52  {
53  std::stringstream sout;
54  sout << ">>> TPZMatElastoPlastic<T,TMEM>(int id) constructor called with id = " << id << " ***";
55  LOGPZ_DEBUG(elastoplasticLogger,sout.str().c_str());
56  }
57 #endif
58 
59 }
60 
61 template <class T, class TMEM>
65 {
66 #ifdef LOG4CXX
67  if(elastoplasticLogger->isDebugEnabled())
68  {
69  std::stringstream sout;
70  sout << ">>> TPZMatElastoPlastic<T,TMEM>() copy constructor called ***";
71  LOGPZ_DEBUG(elastoplasticLogger,sout.str().c_str());
72  }
73 #endif
75 }
76 
77 
78 template <class T, class TMEM>
80 {
81 #ifdef LOG4CXX
82  if(elastoplasticLogger->isDebugEnabled())
83  {
84  std::stringstream sout;
85  sout << ">>> TPZMatElastoPlastic<T,TMEM>::SetPlasticityModel " << std::endl;
86  sout << "\n with plasticity argument: " << std::endl;
87  plasticity.Print(sout);
88  LOGPZ_DEBUG(elastoplasticLogger,sout.str().c_str());
89  }
90 #endif
91 
92  TMEM memory;
93  m_plasticity_model = plasticity;
94  T plastloc(m_plasticity_model);
95  memory.m_elastoplastic_state = plastloc.GetState();
96  plastloc.ApplyStrainComputeSigma(memory.m_elastoplastic_state.m_eps_t, memory.m_sigma);
97  this->SetDefaultMem(memory);
98 #ifdef LOG4CXX
99  if(elastoplasticLogger->isDebugEnabled())
100  {
101  std::stringstream sout;
102  sout << "<< TPZMatElastoPlastic<T,TMEM>::SetPlasticityModel " << std::endl;
103  sout << "\n Computed Sigma: " << std::endl;
104  sout << memory.m_sigma;
105  LOGPZ_DEBUG(elastoplasticLogger,sout.str().c_str());
106  }
107 #endif
108 }
109 
110 
111 template <class T, class TMEM>
113 {
114  m_rho_bulk = RhoB;
115 }
116 
117 template <class T, class TMEM>
119  m_PER = PER;
121 }
122 
123 template <class T, class TMEM>
125  return PER;
126 }
127 
128 template <class T, class TMEM>
130  m_plasticity_model = plasticity_model;
131 }
132 
133 template <class T, class TMEM>
135  return m_plasticity_model;
136 }
137 
138 template <class T, class TMEM>
140 {
141 
142 }
143 
144 template <class T, class TMEM>
145 void TPZMatElastoPlastic<T,TMEM>::Print(std::ostream &out, const int memory)
146 {
147  out << this->Name();
148  out << "\n with template argurment T = " << m_plasticity_model.Name();
149  out << "\n Base material Data:\n";
150  TPZMatWithMem<TMEM>::PrintMem(out, memory);
151  out << "\n Localy defined members:";
152  out << "\n Body Forces: " << m_force;
153  out << "\n Bulk density = " << m_rho_bulk;
154  out << "\n Post process direction: " << m_PostProcessDirection;
155  out << "\n Tolerance for internal post processing iterations: " << m_tol;
156  out << "\n Directive for the use of nonlinear elasticity: " << m_use_non_linear_elasticity_Q;
157  out << "\n Internal plasticity <T> member:\n";
158  m_plasticity_model.Print(out);
159 }
160 
161 template <class T, class TMEM>
162 void TPZMatElastoPlastic<T,TMEM>::Print(std::ostream &out)
163 {
164  out << __PRETTY_FUNCTION__ << std::endl;
165  out << this->Name();
167  out << "\n Body Forces: " << m_force;
168  out << "\n Bulk density = " << m_rho_bulk;
169  out << "\n Post process direction: " << m_PostProcessDirection;
170  out << "\n Tolerance for internal post processing iterations: " << m_tol;
171  out << "\n Directive for the use of nonlinear elasticity: " << m_use_non_linear_elasticity_Q;
172  out << "\n Internal plasticity <T> member:\n";
173  m_plasticity_model.Print(out);
174 }
175 
176 template <class T, class TMEM>
177 int TPZMatElastoPlastic<T,TMEM>::VariableIndex(const std::string &name)
178 {
179  if(!strcmp("DisplacementDoF",name.c_str())) return TPZMatElastoPlastic<T,TMEM>::EDisplacementDoF;
180  if(!strcmp("Displacement",name.c_str())) return TPZMatElastoPlastic<T,TMEM>::EDisplacement;
181  if(!strcmp("Strain",name.c_str())) return TPZMatElastoPlastic<T,TMEM>::EStrain;
182  if(!strcmp("Stress",name.c_str())) return TPZMatElastoPlastic<T,TMEM>::EStress;
183  if(!strcmp("StrainElastic",name.c_str())) return TPZMatElastoPlastic<T,TMEM>::EStrainElastic;
184  if(!strcmp("StrainPlastic",name.c_str())) return TPZMatElastoPlastic<T,TMEM>::EStrainPlastic;
185  if(!strcmp("Yield",name.c_str())) return TPZMatElastoPlastic<T,TMEM>::EYield;
186  if(!strcmp("VolHardening",name.c_str())) return TPZMatElastoPlastic<T,TMEM>::EVolHardening;
187  if(!strcmp("StrainPValues",name.c_str())) return TPZMatElastoPlastic<T,TMEM>::EStrainPValues;
188  if(!strcmp("StressPValues",name.c_str())) return TPZMatElastoPlastic<T,TMEM>::EStressPValues;
189  if(!strcmp("StrainElasticPValues",name.c_str())) return TPZMatElastoPlastic<T,TMEM>::EStrainElasticPValues;
190  if(!strcmp("StrainPlasticPValues",name.c_str())) return TPZMatElastoPlastic<T,TMEM>::EStrainPlasticPValues;
191  if(!strcmp("StrainI1",name.c_str())) return TPZMatElastoPlastic<T,TMEM>::EStrainI1;
192  if(!strcmp("StressI1",name.c_str())) return TPZMatElastoPlastic<T,TMEM>::EStressI1;
193  if(!strcmp("StrainElasticI1",name.c_str())) return TPZMatElastoPlastic<T,TMEM>::EStrainElasticI1;
194  if(!strcmp("StrainPlasticI1",name.c_str())) return TPZMatElastoPlastic<T,TMEM>::EStrainPlasticI1;
195  if(!strcmp("StrainJ2",name.c_str())) return TPZMatElastoPlastic<T,TMEM>::EStrainJ2;
196  if(!strcmp("StressJ2",name.c_str())) return TPZMatElastoPlastic<T,TMEM>::EStressJ2;
197  if(!strcmp("StrainElasticJ2",name.c_str())) return TPZMatElastoPlastic<T,TMEM>::EStrainElasticJ2;
198  if(!strcmp("StrainPlasticJ2",name.c_str())) return TPZMatElastoPlastic<T,TMEM>::EStrainPlasticJ2;
199  if(!strcmp("FailureType",name.c_str())) return TPZMatElastoPlastic<T,TMEM>::EFailureType;
200  PZError << "TPZMatElastoPlastic<T,TMEM>:: VariableIndex Error\n";
202 }
203 
204 template <class T, class TMEM>
206 {
208  if(var == TPZMatElastoPlastic<T,TMEM>::EDisplacement) return 3;
209  if(var == TPZMatElastoPlastic<T,TMEM>::EStrain) return 9;
210  if(var == TPZMatElastoPlastic<T,TMEM>::EStress) return 9;
213  if(var == TPZMatElastoPlastic<T,TMEM>::EYield) return 1;
214  if(var == TPZMatElastoPlastic<T,TMEM>::EVolHardening) return 1;
219  if(var == TPZMatElastoPlastic<T,TMEM>::EStrainI1) return 1;
222  if(var == TPZMatElastoPlastic<T,TMEM>::EStrainJ2) return 1;
223  if(var == TPZMatElastoPlastic<T,TMEM>::EStressJ2) return 1;
226  if(var == TPZMatElastoPlastic<T,TMEM>::EFailureType) return 1;
227 
228  if(var == 100) return 1;
230 }
231 
232 template <class T, class TMEM>
234 {
235  Out.Resize(3);
237  Out[0] = Dir[0] * vectorTensor(_XX_,0) + Dir[1] * vectorTensor(_XY_,0) + Dir[2] * vectorTensor(_XZ_,0);
238  Out[1] = Dir[0] * vectorTensor(_XY_,0) + Dir[1] * vectorTensor(_YY_,0) + Dir[2] * vectorTensor(_YZ_,0);
239  Out[2] = Dir[0] * vectorTensor(_XZ_,0) + Dir[1] * vectorTensor(_YZ_,0) + Dir[2] * vectorTensor(_ZZ_,0);
240 }
241 
242 template <class T, class TMEM>
244 
245  Solout.Resize(this->NSolutionVariables(var));
246 
249  {
250  for (int i = 0; i < 3; ++i) {
251  Solout[i] = data.sol[0][i];
252  }//for
253  }//EDisplacement from DoF
254 
255  int intPt = data.intGlobPtIndex;
256  if (intPt == -1 || TPZMatElastoPlastic<T, TMEM>::GetMemory()->NElements() == 0) {
257  return;
258  }
259 
260  TMEM &Memory = this->MemItem(intPt);
261  T plasticloc(m_plasticity_model);
262  plasticloc.SetState(Memory.m_elastoplastic_state);
263  switch (var) {
264  case EDisplacement:
265  {
266  for (int i = 0; i < 3; i++) {
267  Solout[i] = Memory.m_u[i];
268  }
269  }
270  break;
272  {
273  TPZTensor<REAL> & eps_t = Memory.m_elastoplastic_state.m_eps_t;
274  Solout[0] = eps_t.XX();
275  Solout[1] = eps_t.XY();
276  Solout[2] = eps_t.XZ();
277  Solout[3] = eps_t.XY();
278  Solout[4] = eps_t.YY();
279  Solout[5] = eps_t.YZ();
280  Solout[6] = eps_t.XZ();
281  Solout[7] = eps_t.YZ();
282  Solout[8] = eps_t.ZZ();
283  }
284  break;
286  {
287  TPZTensor<REAL> & sigma = Memory.m_sigma;
288  Solout[0] = sigma.XX();
289  Solout[1] = sigma.XY();
290  Solout[2] = sigma.XZ();
291  Solout[3] = sigma.XY();
292  Solout[4] = sigma.YY();
293  Solout[5] = sigma.YZ();
294  Solout[6] = sigma.XZ();
295  Solout[7] = sigma.YZ();
296  Solout[8] = sigma.ZZ();
297  }
298  break;
300  {
301  TPZTensor<REAL> eps_e(Memory.m_elastoplastic_state.m_eps_t);
302  eps_e -= Memory.m_elastoplastic_state.m_eps_p;
303  Solout[0] = eps_e.XX();
304  Solout[1] = eps_e.XY();
305  Solout[2] = eps_e.XZ();
306  Solout[3] = eps_e.XY();
307  Solout[4] = eps_e.YY();
308  Solout[5] = eps_e.YZ();
309  Solout[6] = eps_e.XZ();
310  Solout[7] = eps_e.YZ();
311  Solout[8] = eps_e.ZZ();
312  }
313  break;
315  {
316  TPZTensor<REAL> & eps_p = Memory.m_elastoplastic_state.m_eps_p;
317  Solout[0] = eps_p.XX();
318  Solout[1] = eps_p.XY();
319  Solout[2] = eps_p.XZ();
320  Solout[3] = eps_p.XY();
321  Solout[4] = eps_p.YY();
322  Solout[5] = eps_p.YZ();
323  Solout[6] = eps_p.XZ();
324  Solout[7] = eps_p.YZ();
325  Solout[8] = eps_p.ZZ();
326  }
327  break;
329  {
330  TPZTensor<REAL> & eps = Memory.m_elastoplastic_state.m_eps_t;
331  TPZTensor<REAL>::TPZDecomposed eigensystem;
332  eps.EigenSystem(eigensystem);
333  for (int i = 0; i < 3; i++)Solout[i] = eigensystem.fEigenvalues[i];
334  }
335  break;
337  {
338  TPZTensor<REAL> & Sigma = Memory.m_sigma;
339  TPZTensor<REAL>::TPZDecomposed eigensystem;
340  Sigma.EigenSystem(eigensystem);
341  for (int i = 0; i < 3; i++)Solout[i] = eigensystem.fEigenvalues[i];
342  }
343  break;
345  {
346  TPZTensor<REAL> eps_e(Memory.m_elastoplastic_state.m_eps_t);
347  eps_e -= Memory.m_elastoplastic_state.m_eps_p;
348  TPZTensor<REAL>::TPZDecomposed eigensystem;
349  eps_e.EigenSystem(eigensystem);
350  for (int i = 0; i < 3; i++) Solout[i] = eigensystem.fEigenvalues[i];
351  }
352  break;
354  {
355  TPZTensor<REAL> & eps_p = Memory.m_elastoplastic_state.m_eps_p;
356  TPZTensor<REAL>::TPZDecomposed eigensystem;
357  eps_p.EigenSystem(eigensystem);
358  for (int i = 0; i < 3; i++) Solout[i] = eigensystem.fEigenvalues[i];
359  }
360  break;
362  {
363  TPZTensor<REAL> eps_t = Memory.m_elastoplastic_state.m_eps_t;
364  Solout[0] = eps_t.I1();
365  }
366  break;
368  {
369  TPZTensor<REAL> sigma = Memory.m_sigma;
370  Solout[0] = sigma.I1();
371  }
372  break;
374  {
375  TPZTensor<REAL> eps_e(Memory.m_elastoplastic_state.m_eps_t);
376  eps_e -= Memory.m_elastoplastic_state.m_eps_p;
377  Solout[0] = eps_e.I1();
378  }
379  break;
381  {
382  TPZTensor<REAL> eps_p = Memory.m_elastoplastic_state.m_eps_p;
383  Solout[0] = eps_p.I1();
384  }
385  break;
387  {
388  TPZTensor<REAL> eps_t = Memory.m_elastoplastic_state.m_eps_t;
389  Solout[0] = eps_t.J2();
390  }
391  break;
393  {
394  TPZTensor<REAL> sigma = Memory.m_sigma;
395  Solout[0] = sigma.J2();
396  }
397  break;
399  {
400  TPZTensor<REAL> eps_e(Memory.m_elastoplastic_state.m_eps_t);
401  eps_e -= Memory.m_elastoplastic_state.m_eps_p;
402  Solout[0] = eps_e.J2();
403  }
404  break;
406  {
407  TPZTensor<REAL> eps_p = Memory.m_elastoplastic_state.m_eps_p;
408  Solout[0] = eps_p.J2();
409  }
410  break;
412  {
413  TPZTensor<REAL> & EpsT = Memory.m_elastoplastic_state.m_eps_t;
414  TPZTensor<STATE> epsElastic(EpsT);
415  epsElastic -= Memory.m_elastoplastic_state.m_eps_p;
416  plasticloc.Phi(epsElastic, Solout);
417  }//EVolPlasticSteps - makes sense only if the evaluated point refers to an identified integration point
418  break;
420  {
421  int m_type = Memory.m_elastoplastic_state.m_m_type;
422  Solout[0] = m_type;
423  }
424  break;
425  default:
426  {
427  TPZMatWithMem<TMEM>::Solution(data, var, Solout);
428  }
429  }
430 }
431 
432 template <class T, class TMEM>
434 {
435 
436 #ifdef LOG4CXX
437  if(elastoplasticLogger->isDebugEnabled())
438  {
439  std::stringstream sout;
440  sout << ">>> TPZMatElastoPlastic<T,TMEM>::Contribute ***";
441  sout << "\nIntegration Point index = " << data.intGlobPtIndex;
442  LOGPZ_DEBUG(elastoplasticLogger,sout.str().c_str());
443  }
444 #endif
445 
446  TPZFMatrix<REAL> &dphi = data.dphix, dphiXYZ;
447  TPZFMatrix<REAL> &phi = data.phi;
448  TPZFMatrix<REAL> &axes = data.axes, axesT;
449  TPZManVector<REAL,3> &x = data.x;
450 
451  // rotating the shape functions to the XYZ coordinates
452  axes.Transpose(&axesT);
453  axesT.Multiply(dphi,dphiXYZ);
454 
455  const int phr = phi.Rows();
456 
457  TPZFNMatrix<9> Deriv(3,3);
458  TPZFNMatrix<36> Dep(6,6);
459  TPZFNMatrix<6> DeltaStrain(6,1);
460  TPZFNMatrix<6> Stress(6,1);
461 
462  this->ComputeDeltaStrainVector(data, DeltaStrain);
463  this->ApplyDeltaStrainComputeDep(data, DeltaStrain, Stress, Dep);
464 
465  int nstate = NStateVariables();
466  REAL val,val2,val3,val4,val5,val6,val7,val8,val9,val10;
467 
468  TPZManVector<STATE, 3> ForceLoc(nstate,0.0);
469  if(this->fForcingFunction)
470  {
471  this->fForcingFunction->Execute(data.x,ForceLoc);
472  }
473 
474  int in;
475  for(in = 0; in < phr; in++) { //in: test function index
476 
477  // m_force represents the gravity acceleration
478  //First equation: fb and fk
479  val = m_rho_bulk * ForceLoc[0] * phi(in,0); // fb
480  val -= Stress(_XX_,0) * dphiXYZ(0,in); // |
481  val -= Stress(_XY_,0) * dphiXYZ(1,in); // fk
482  val -= Stress(_XZ_,0) * dphiXYZ(2,in); // |
483  ef(in*nstate+0,0) += weight * val;
484 
485  //Second equation: fb and fk
486  val = m_rho_bulk * ForceLoc[1] * phi(in,0); // fb
487  val -= Stress(_XY_,0) * dphiXYZ(0,in); // |
488  val -= Stress(_YY_,0) * dphiXYZ(1,in); // fk
489  val -= Stress(_YZ_,0) * dphiXYZ(2,in); // |
490  ef(in*nstate+1,0) += weight * val;
491 
492  //third equation: fb and fk
493  val = m_rho_bulk * ForceLoc[2] * phi(in,0); // fb
494  val -= Stress(_XZ_,0) * dphiXYZ(0,in); // |
495  val -= Stress(_YZ_,0) * dphiXYZ(1,in); // fk
496  val -= Stress(_ZZ_,0) * dphiXYZ(2,in); // |
497  ef(in*nstate+2,0) += weight * val;
498 
499  for( int jn = 0; jn < phr; jn++ ) {
500  //jn: trial function index
501  //this matrix will store
502  //{{dvdx*dudx, dvdx*dudy, dvdx*dudz},
503  //{dvdy*dudx, dvdy*dudy, dvdy*dudz},
504  //{dvdz*dudx, dvdz*dudy, dvdz*dudz}}
505  //Compute Deriv matrix
506  for(int ud = 0; ud < 3; ud++){
507  for(int vd = 0; vd < 3; vd++){
508  Deriv(vd,ud) = dphiXYZ(vd,in)*dphiXYZ(ud,jn);
509  }//ud
510  }//vd
511 
512 
513  //#define _XX_ 0
514  //#define _XY_ 1
515  //#define _XZ_ 2
516  //#define _YY_ 3
517  //#define _YZ_ 4
518  //#define _ZZ_ 5
519  //First equation Dot[Sigma1, gradV1]
520  val2 = 2. * Dep(_XX_,_XX_) * Deriv(0,0);//dvdx*dudx
521  val2 += Dep(_XX_,_XY_) * Deriv(0,1);//dvdx*dudy
522  val2 += Dep(_XX_,_XZ_) * Deriv(0,2);//dvdx*dudz
523  val2 += 2. * Dep(_XY_,_XX_) * Deriv(1,0);//dvdy*dudx
524  val2 += Dep(_XY_,_XY_) * Deriv(1,1);//dvdy*dudy
525  val2 += Dep(_XY_,_XZ_) * Deriv(1,2);//dvdy*dudz
526  val2 += 2. * Dep(_XZ_,_XX_) * Deriv(2,0);//dvdz*dudx
527  val2 += Dep(_XZ_,_XY_) * Deriv(2,1);//dvdz*dudy
528  val2 += Dep(_XZ_,_XZ_) * Deriv(2,2);//dvdz*dudz
529  val2 *= 0.5;
530  ek(in*nstate+0,jn*nstate+0) += weight * val2;
531 
532  val3 = Dep(_XX_,_XY_) * Deriv(0,0);
533  val3 += 2. * Dep(_XX_,_YY_) * Deriv(0,1);
534  val3 += Dep(_XX_,_YZ_) * Deriv(0,2);
535  val3 += Dep(_XY_,_XY_) * Deriv(1,0);
536  val3 += 2. * Dep(_XY_,_YY_) * Deriv(1,1);
537  val3 += Dep(_XY_,_YZ_) * Deriv(1,2);
538  val3 += Dep(_XZ_,_XY_) * Deriv(2,0);
539  val3 += 2. * Dep(_XZ_,_YY_) * Deriv(2,1);
540  val3 += Dep(_XZ_,_YZ_) * Deriv(2,2);
541  val3 *= 0.5;
542  ek(in*nstate+0,jn*nstate+1) += weight * val3;
543 
544  val4 = Dep(_XX_,_XZ_) * Deriv(0,0);
545  val4 += Dep(_XX_,_YZ_) * Deriv(0,1);
546  val4 += 2. * Dep(_XX_,_ZZ_) * Deriv(0,2);//
547  val4 += Dep(_XY_,_XZ_) * Deriv(1,0);
548  val4 += Dep(_XY_,_YZ_) * Deriv(1,1);
549  val4 += 2. * Dep(_XY_,_ZZ_) * Deriv(1,2);//
550  val4 += Dep(_XZ_,_XZ_) * Deriv(2,0);
551  val4 += Dep(_XZ_,_YZ_) * Deriv(2,1);
552  val4 += 2. * Dep(_XZ_,_ZZ_) * Deriv(2,2);
553  val4 *= 0.5;
554  ek(in*nstate+0,jn*nstate+2) += weight * val4;
555 
556  //Second equation Dot[Sigma2, gradV2]
557  val5 = 2. * Dep(_XY_,_XX_) * Deriv(0,0);
558  val5 += Dep(_XY_,_XY_) * Deriv(0,1);
559  val5 += Dep(_XY_,_XZ_) * Deriv(0,2);
560  val5 += 2. * Dep(_YY_,_XX_) * Deriv(1,0);
561  val5 += Dep(_YY_,_XY_) * Deriv(1,1);
562  val5 += Dep(_YY_,_XZ_) * Deriv(1,2);
563  val5 += 2. * Dep(_YZ_,_XX_) * Deriv(2,0);
564  val5 += Dep(_YZ_,_XY_) * Deriv(2,1);
565  val5 += Dep(_YZ_,_XZ_) * Deriv(2,2);
566  val5 *= 0.5;
567  ek(in*nstate+1,jn*nstate+0) += weight * val5;
568 
569  val6 = Dep(_XY_,_XY_) * Deriv(0,0);
570  val6 += 2. * Dep(_XY_,_YY_) * Deriv(0,1);
571  val6 += Dep(_XY_,_YZ_) * Deriv(0,2);
572  val6 += Dep(_YY_,_XY_) * Deriv(1,0);
573  val6 += 2. * Dep(_YY_,_YY_) * Deriv(1,1);
574  val6 += Dep(_YY_,_YZ_) * Deriv(1,2);
575  val6 += Dep(_YZ_,_XY_) * Deriv(2,0);
576  val6 += 2. * Dep(_YZ_,_YY_) * Deriv(2,1);
577  val6 += Dep(_YZ_,_YZ_) * Deriv(2,2);
578  val6 *= 0.5;
579  ek(in*nstate+1,jn*nstate+1) += weight * val6;
580 
581  val7 = Dep(_XY_,_XZ_) * Deriv(0,0);
582  val7 += Dep(_XY_,_YZ_) * Deriv(0,1);
583  val7 += 2. * Dep(_XY_,_ZZ_) * Deriv(0,2);//
584  val7 += Dep(_YY_,_XZ_) * Deriv(1,0);
585  val7 += Dep(_YY_,_YZ_) * Deriv(1,1);
586  val7 += 2. * Dep(_YY_,_ZZ_) * Deriv(1,2);//
587  val7 += Dep(_YZ_,_XZ_) * Deriv(2,0);
588  val7 += Dep(_YZ_,_YZ_) * Deriv(2,1);
589  val7 += 2. * Dep(_YZ_,_ZZ_) * Deriv(2,2);
590  val7 *= 0.5;
591  ek(in*nstate+1,jn*nstate+2) += weight * val7;
592 
593  //Third equation Dot[Sigma3, gradV3]
594  val8 = 2. * Dep(_XZ_,_XX_) * Deriv(0,0);
595  val8 += Dep(_XZ_,_XY_) * Deriv(0,1);
596  val8 += Dep(_XZ_,_XZ_) * Deriv(0,2);
597  val8 += 2. * Dep(_YZ_,_XX_) * Deriv(1,0);
598  val8 += Dep(_YZ_,_XY_) * Deriv(1,1);
599  val8 += Dep(_YZ_,_XZ_) * Deriv(1,2);
600  val8 += 2. * Dep(_ZZ_,_XX_) * Deriv(2,0);//
601  val8 += Dep(_ZZ_,_XY_) * Deriv(2,1);//
602  val8 += Dep(_ZZ_,_XZ_) * Deriv(2,2);
603  val8 *= 0.5;
604  ek(in*nstate+2,jn*nstate+0) += weight * val8;
605 
606  val9 = Dep(_XZ_,_XY_) * Deriv(0,0);
607  val9 += 2. * Dep(_XZ_,_YY_) * Deriv(0,1);
608  val9 += Dep(_XZ_,_YZ_) * Deriv(0,2);
609  val9 += Dep(_YZ_,_XY_) * Deriv(1,0);
610  val9 += 2. * Dep(_YZ_,_YY_) * Deriv(1,1);
611  val9 += Dep(_YZ_,_YZ_) * Deriv(1,2);
612  val9 += Dep(_ZZ_,_XY_) * Deriv(2,0);//
613  val9 += 2. * Dep(_ZZ_,_YY_) * Deriv(2,1);//
614  val9 += Dep(_ZZ_,_YZ_) * Deriv(2,2);
615  val9 *= 0.5;
616  ek(in*nstate+2,jn*nstate+1) += weight * val9;
617 
618  val10 = Dep(_XZ_,_XZ_) * Deriv(0,0);
619  val10 += Dep(_XZ_,_YZ_) * Deriv(0,1);
620  val10 += 2. * Dep(_XZ_,_ZZ_) * Deriv(0,2);
621  val10 += Dep(_YZ_,_XZ_) * Deriv(1,0);
622  val10 += Dep(_YZ_,_YZ_) * Deriv(1,1);
623  val10 += 2. * Dep(_YZ_,_ZZ_) * Deriv(1,2);
624  val10 += Dep(_ZZ_,_XZ_) * Deriv(2,0);
625  val10 += Dep(_ZZ_,_YZ_) * Deriv(2,1);
626  val10 += 2. * Dep(_ZZ_,_ZZ_) * Deriv(2,2);//
627  val10 *= 0.5;
628  ek(in*nstate+2,jn*nstate+2) += weight * val10;
629 
630  }//jn
631  }//in
632 
633 #ifdef LOG4CXX
634  if(elastoplasticLogger->isDebugEnabled())
635  {
636  std::stringstream sout;
637  sout << "<<< TPZMatElastoPlastic<T,TMEM>::Contribute ***";
638  //sout << " Resultant rhs vector:\n" << ef;
639  LOGPZ_DEBUG(elastoplasticLogger,sout.str().c_str());
640  }
641 #endif
642 }
643 
644 template <class T, class TMEM>
646  REAL weight,
647  TPZFMatrix<REAL> &ek,
648  TPZFMatrix<REAL> &ef,
649  TPZBndCond &bc)
650 {
651 #ifdef LOG4CXX
652  if(elastoplasticLogger->isDebugEnabled())
653  {
654  std::stringstream sout;
655  sout << ">>> TPZMatElastoPlastic<T,TMEM>::ContributeBC *** with bc.Type()=" << bc.Type();
656  LOGPZ_DEBUG(elastoplasticLogger,sout.str().c_str());
657  }
658 #endif
659  TPZFMatrix<REAL> &phi = data.phi;
660 
661  const REAL BIGNUMBER = 1.e16;
662 
663  int dim = Dimension();
664  int nstate = NStateVariables();
665 
666  const int phr = phi.Rows();
667  int in,jn,idf,jdf;
668  REAL v2[3];
669  v2[0] = bc.Val2()(0,0);
670  v2[1] = bc.Val2()(1,0);
671  v2[2] = bc.Val2()(2,0);
672 
673 
674  TPZFMatrix<REAL> &v1 = bc.Val1();
675  //bc.Print(cout);
676  //cout << "val2: " << v2[0] << ' ' << v2[1] << ' ' << v2[2] << endl;
677  switch (bc.Type()) {
678  case 0: // Dirichlet condition
679  for(in = 0 ; in < phr; in++) {
680  ef(nstate*in+0,0) += BIGNUMBER * (v2[0] - data.sol[0][0]) * phi(in,0) * weight;
681  ef(nstate*in+1,0) += BIGNUMBER * (v2[1] - data.sol[0][1]) * phi(in,0) * weight;
682  ef(nstate*in+2,0) += BIGNUMBER * (v2[2] - data.sol[0][2]) * phi(in,0) * weight;
683  for (jn = 0 ; jn < phr; jn++) {
684  ek(nstate*in+0,nstate*jn+0) += BIGNUMBER * phi(in,0) * phi(jn,0) * weight;
685  ek(nstate*in+1,nstate*jn+1) += BIGNUMBER * phi(in,0) * phi(jn,0) * weight;
686  ek(nstate*in+2,nstate*jn+2) += BIGNUMBER * phi(in,0) * phi(jn,0) * weight;
687  }//jn
688  }//in
689  break;
690 
691  case 1: // Neumann condition
692  for(in = 0 ; in < phi.Rows(); in++) {
693  ef(nstate*in+0,0) += v2[0] * phi(in,0) * weight;
694  ef(nstate*in+1,0) += v2[1] * phi(in,0) * weight;
695  ef(nstate*in+2,0) += v2[2] * phi(in,0) * weight;
696  }
697  break;
698 
699  case 2: // Mixed condition
700  for(in = 0 ; in < phi.Rows(); in++) {
701  ef(nstate*in+0,0) += v2[0] * phi(in,0) * weight;
702  ef(nstate*in+1,0) += v2[1] * phi(in,0) * weight;
703  ef(nstate*in+2,0) += v2[2] * phi(in,0) * weight;
704  for(jn=0; jn<phi.Rows(); jn++)
705  {
706  for(idf=0; idf<3; idf++) for(jdf=0; jdf<3; jdf++)
707  {
708  ek(nstate*in+idf,nstate*jn+jdf) += bc.Val1()(idf,jdf);
709  }
710  }
711  }//in
712  break;
713 
714  case 3: // Directional Null Dirichlet - displacement is set to null in the non-null vector component direction
715  for(in = 0 ; in < phr; in++) {
716  ef(nstate*in+0,0) += BIGNUMBER * (0. - data.sol[0][0]) * v2[0] * phi(in,0) * weight;
717  ef(nstate*in+1,0) += BIGNUMBER * (0. - data.sol[0][1]) * v2[1] * phi(in,0) * weight;
718  ef(nstate*in+2,0) += BIGNUMBER * (0. - data.sol[0][2]) * v2[2] * phi(in,0) * weight;
719  for (jn = 0 ; jn < phr; jn++) {
720  ek(nstate*in+0,nstate*jn+0) += BIGNUMBER * phi(in,0) * phi(jn,0) * weight * v2[0];
721  ek(nstate*in+1,nstate*jn+1) += BIGNUMBER * phi(in,0) * phi(jn,0) * weight * v2[1];
722  ek(nstate*in+2,nstate*jn+2) += BIGNUMBER * phi(in,0) * phi(jn,0) * weight * v2[2];
723  }//jn
724  }//in
725  break;
726 
727  case 4: // stressField Neumann condition
728  for(in = 0; in < dim; in ++)
729  v2[in] = - ( v1(in,0) * data.normal[0] +
730  v1(in,1) * data.normal[1] +
731  v1(in,2) * data.normal[2] );
732  // The normal vector points towards the neighbour. The negative sign is there to
733  // reflect the outward normal vector.
734  for(in = 0 ; in < phi.Rows(); in++) {
735  ef(nstate*in+0,0) += v2[0] * phi(in,0) * weight;
736  ef(nstate*in+1,0) += v2[1] * phi(in,0) * weight;
737  ef(nstate*in+2,0) += v2[2] * phi(in,0) * weight;
738  // cout << "normal:" << data.normal[0] << ' ' << data.normal[1] << ' ' << data.normal[2] << endl;
739  // cout << "val2: " << v2[0] << endl;
740  }
741  break;
742 
743  case 5://PRESSAO
744  for(in = 0 ; in < phi.Rows(); in++)
745  {
746  ef(nstate*in+0,0) += v2[0] * phi(in,0) * weight * (data.normal[0]);
747  ef(nstate*in+1,0) += v2[0] * phi(in,0) * weight * (data.normal[1]);
748  ef(nstate*in+2,0) += v2[0] * phi(in,0) * weight * (data.normal[2]);
749  }
750  break;
751 
752  case 6: // Directional Dirichlet - displacement is set to u_D in the non-null vector component direction
753 
754  REAL v_null[3];
755  v_null[0] = bc.Val1()(0,0);
756  v_null[1] = bc.Val1()(1,1);
757  v_null[2] = bc.Val1()(2,2);
758 
759  for(in = 0 ; in < phr; in++) {
760  ef(nstate*in+0,0) += BIGNUMBER * (v2[0] - data.sol[0][0]) * v_null[0] * phi(in,0) * weight;
761  ef(nstate*in+1,0) += BIGNUMBER * (v2[1] - data.sol[0][1]) * v_null[1] * phi(in,0) * weight;
762  ef(nstate*in+2,0) += BIGNUMBER * (v2[2] - data.sol[0][2]) * v_null[2] * phi(in,0) * weight;
763  for (jn = 0 ; jn < phr; jn++) {
764  ek(nstate*in+0,nstate*jn+0) += BIGNUMBER * phi(in,0) * phi(jn,0) * weight * v_null[0];
765  ek(nstate*in+1,nstate*jn+1) += BIGNUMBER * phi(in,0) * phi(jn,0) * weight * v_null[1];
766  ek(nstate*in+2,nstate*jn+2) += BIGNUMBER * phi(in,0) * phi(jn,0) * weight * v_null[2];
767  }//jn
768  }//in
769  break;
770 
771  default:
772 #ifdef LOG4CXX
773  {
774  std::stringstream sout;
775  sout << "<<< TPZMatElastoPlastic<T,TMEM>::ContributeBC *** WRONG BOUNDARY CONDITION TYPE = " << bc.Type();
776  LOGPZ_ERROR(elastoplasticLogger,sout.str().c_str());
777  }
778 #endif
779  PZError << "TPZMatElastoPlastic::ContributeBC error - Wrong boundary condition type" << std::endl;
780  }//switch
781 
782 }
783 
784 template <class T, class TMEM>
786 {
787 #ifdef LOG4CXX
788  if(elastoplasticLogger->isDebugEnabled())
789  {
790  std::stringstream sout;
791  sout << ">>> TPZMatElastoPlastic<T,TMEM>::Contribute ***";
792  sout << "\nIntegration Point index = " << data.intGlobPtIndex;
793  LOGPZ_DEBUG(elastoplasticLogger,sout.str().c_str());
794  }
795 #endif
796 
797  TPZFMatrix<REAL> &dphi = data.dphix, dphiXYZ;
798  TPZFMatrix<REAL> &phi = data.phi;
799  TPZFMatrix<REAL> &axes = data.axes, axesT;
800  TPZManVector<REAL,3> &x = data.x;
801 
802  // rotating the shape functions to the XYZ coordinates
803  axes.Transpose(&axesT);
804  axesT.Multiply(dphi,dphiXYZ);
805  const int phr = phi.Rows();
806 
807  TPZFNMatrix<9> Deriv(3,3);
808  // TPZFNMatrix<36> Dep(6,6);
809  TPZFNMatrix<6> DeltaStrain(6,1);
810  TPZFNMatrix<6> Stress(6,1);
811 
812  this->ComputeDeltaStrainVector(data, DeltaStrain);
813  this->ApplyDeltaStrain(data,DeltaStrain,Stress);
814 
815  int nstate = NStateVariables();
816  REAL val;
817 
818  TPZManVector<STATE, 3> ForceLoc(nstate,0.0);
819  if(this->fForcingFunction)
820  {
821  this->fForcingFunction->Execute(data.x,ForceLoc);
822  }
823 
824  int in;
825  for(in = 0; in < phr; in++) { //in: test function index
826 
827  // m_force represents the gravity acceleration
828  //First equation: fb and fk
829  val = m_rho_bulk * ForceLoc[0] * phi(in,0); // fb
830  val -= Stress(_XX_,0) * dphiXYZ(0,in); // |
831  val -= Stress(_XY_,0) * dphiXYZ(1,in); // fk
832  val -= Stress(_XZ_,0) * dphiXYZ(2,in); // |
833  ef(in*nstate+0,0) += weight * val;
834 
835  //Second equation: fb and fk
836  val = m_rho_bulk * ForceLoc[1] * phi(in,0); // fb
837  val -= Stress(_XY_,0) * dphiXYZ(0,in); // |
838  val -= Stress(_YY_,0) * dphiXYZ(1,in); // fk
839  val -= Stress(_YZ_,0) * dphiXYZ(2,in); // |
840  ef(in*nstate+1,0) += weight * val;
841 
842  //third equation: fb and fk
843  val = m_rho_bulk * ForceLoc[2] * phi(in,0); // fb
844  val -= Stress(_XZ_,0) * dphiXYZ(0,in); // |
845  val -= Stress(_YZ_,0) * dphiXYZ(1,in); // fk
846  val -= Stress(_ZZ_,0) * dphiXYZ(2,in); // |
847  ef(in*nstate+2,0) += weight * val;
848 
849  }//in
850 
851 #ifdef LOG4CXX
852  if(elastoplasticLogger->isDebugEnabled())
853  {
854  std::stringstream sout;
855  sout << "<<< TPZMatElastoPlastic<T,TMEM>::Contribute ***";
856  //sout << " Resultant rhs vector:\n" << ef;
857  LOGPZ_DEBUG(elastoplasticLogger,sout.str().c_str());
858  }
859 #endif
860 }
861 
862 template <class T, class TMEM>
864  REAL weight,
865  TPZFMatrix<REAL> &ef,
866  TPZBndCond &bc)
867 {
868  TPZMaterial::ContributeBC(data, weight, ef, bc);//not efficient but here to remember reimplementing it when ContributeBC becomes robust
869 }
870 
871 template <class T, class TMEM>
873  TPZFMatrix<REAL> &axes, TPZVec<REAL> &flux,
874  TPZVec<REAL> &u_exact,TPZFMatrix<REAL> &du_exact,TPZVec<REAL> &values)
875 {
876  int i, j;
877 
879  REAL L2 = 0.;
880  for(i = 0; i < 3; i++) L2 += (u[i] - u_exact[i]) * (u[i] - u_exact[i]);
881 
883  REAL SemiH1 = 0.;
884  for(i = 0; i < 3; i++) for(j = 0; j < 3; j++) SemiH1 += (dudx(i,j) - du_exact(i,j)) * (dudx(i,j) - du_exact(i,j));
885 
887  REAL H1 = L2 + SemiH1;
888 
889  //values[1] : eror em norma L2
890  values[1] = L2;
891 
892  //values[2] : erro em semi norma H1
893  values[2] = SemiH1;
894 
895  //values[0] : erro em norma H1 <=> norma Energia
896  values[0] = H1;
897 
898 }
899 
900 template <class T, class TMEM>
902 {
903  ComputeDeltaStrainVector(data, Strain);
904 
905  TPZTensor<REAL> & EpsT = this->MemItem(data.intGlobPtIndex).m_elastoplastic_state.m_eps_t;
906 
907  int i;
908  for( i = 0; i < 6; i++ )Strain(i,0) = Strain(i,0) + EpsT.fData[i];
909 }
910 
911 template <class T, class TMEM>
913 {
914  TPZFNMatrix<9> DSolXYZ(3,3,0.);
915  data.axes.Multiply(data.dsol[0],DSolXYZ,1/*transpose*/);
916  cout << "\n data dsol \n";
917  data.dsol[0].Print("data.sol");
918  DeltaStrain.Redim(6,1);
919  DeltaStrain(_XX_,0) = DSolXYZ(0,0);
920  DeltaStrain(_YY_,0) = DSolXYZ(1,1);
921  DeltaStrain(_ZZ_,0) = DSolXYZ(2,2);
922  DeltaStrain(_XY_,0) = 0.5 * ( DSolXYZ(1,0) + DSolXYZ(0,1) );
923  DeltaStrain(_XZ_,0) = 0.5 * ( DSolXYZ(2,0) + DSolXYZ(0,2) );
924  DeltaStrain(_YZ_,0) = 0.5 * ( DSolXYZ(2,1) + DSolXYZ(1,2) );
925 }
926 
927 template <class T, class TMEM>
929 {
930 
931  TPZFNMatrix<6> DeltaStrain;
932  ComputeDeltaStrainVector(data, DeltaStrain);
933  Stress.Redim(6,1);
934  ApplyDeltaStrain(data, DeltaStrain, Stress);
935 
936 }
937 
938 template <class T, class TMEM>
940 {
941  int intPt = data.intGlobPtIndex;//, plasticSteps;
942  T plasticloc(m_plasticity_model);
943  plasticloc.SetState(this->MemItem(intPt).m_elastoplastic_state);
944  TPZTensor<REAL> deps;
945  deps.CopyFrom(DeltaStrain);
946 
947  REAL alfa =1.e-6;
948  REAL alfa2 = 2.e-6;
949  TPZTensor<REAL> part1,part2,part3,temp;
950  TPZTensor<REAL> Alfa1DeltaEps, Alfa2DeltaEps,Eps(plasticloc.GetState().m_eps_t);
951  Alfa1DeltaEps.CopyFrom(DeltaStrain);
952  Alfa2DeltaEps.CopyFrom(DeltaStrain);
953  TPZFNMatrix<36,REAL> DEP(6,6);
954 
955  Alfa1DeltaEps*=alfa;
956  Alfa2DeltaEps*=alfa2;
957  temp=Eps;
958  temp+=Alfa1DeltaEps;
959  plasticloc.ApplyStrainComputeSigma(temp,part1);
960  plasticloc.ApplyStrainComputeDep(Eps,part2,DEP);
961  TPZFNMatrix<6,REAL> part3temp(6,1),tempAlfa1DeltaEps(6,1);
962  for(int i=0;i<6;i++)
963  {
964  tempAlfa1DeltaEps(i,0)=Alfa1DeltaEps.fData[i];
965  }
966  DEP.Multiply(tempAlfa1DeltaEps, part3temp);
967  part3.CopyFrom(part3temp);
968  TPZTensor<REAL> e1(part1);
969  e1-=part2;
970  e1-=part3;
971 
972  part1*=0.;
973  part3*=0.;
974  part3temp*=0.;
975  temp*=0.;
976 
977  temp=Eps;
978  temp+=Alfa2DeltaEps;
979  plasticloc.ApplyStrainComputeSigma(temp,part1);
980  for(int i=0;i<6;i++)
981  {
982  tempAlfa1DeltaEps(i,0)=Alfa2DeltaEps.fData[i];
983  }
984  DEP.Multiply(tempAlfa1DeltaEps, part3temp);
985  part3.CopyFrom(part3temp);
986  TPZTensor<REAL> e2(part1);
987  e2-=part2;
988  e2-=part3;
989  REAL n = (log10(Norm(e1))-log10(Norm(e2)))/(log10(alfa)-log10(alfa2));
990 
991 #ifdef LOG4CXX
992  if(ceckconvlogger->isDebugEnabled())
993  {
994  std::stringstream sout;
995  TPZManVector<REAL,3> phi(3,1);
996  plasticloc.Phi(Eps,phi);
997  sout << "DEP "<< DEP << std::endl;
998  sout << "tempAlfa1DeltaEps "<< tempAlfa1DeltaEps << std::endl;
999  sout << "Phi "<< phi << std::endl;
1000  sout << "Integration Point "<< intPt << std::endl;
1001  sout << "n = " << n << std::endl;
1002  LOGPZ_DEBUG(ceckconvlogger, sout.str())
1003  }
1004 #endif
1005 
1006 
1007 
1008 }
1009 
1010 template <class T, class TMEM>
1012  TPZFMatrix<REAL> & Stress, TPZFMatrix<REAL> & Dep)
1013 {
1014 
1015  int intPt = data.intGlobPtIndex;
1016  T plasticloc(m_plasticity_model);
1017 
1019  plasticloc.SetState(this->MemItem(intPt).m_elastoplastic_state);
1020  TPZTensor<REAL> eps_t, sigma(this->MemItem(intPt).m_sigma);
1021  eps_t.CopyFrom(DeltaStrain);
1022  eps_t.Add(plasticloc.GetState().m_eps_t, 1.);
1023 
1025  TPZTensor<REAL> last_eps_p = plasticloc.GetState().m_eps_p;
1026  TPZTensor<REAL> eps_e = eps_t - last_eps_p;
1027  this->MemItem(intPt).m_ER = m_PER.EvaluateElasticResponse(eps_e);
1028  }
1029  plasticloc.SetElasticResponse(this->MemItem(intPt).m_ER);
1030 
1031  UpdateMaterialCoeficients(data.x,plasticloc);
1032  plasticloc.ApplyStrainComputeSigma(eps_t, sigma, &Dep);
1033 
1034  sigma.CopyTo(Stress);
1035 
1037  {
1038  this->MemItem(intPt).m_sigma = sigma;
1039  this->MemItem(intPt).m_elastoplastic_state = plasticloc.GetState();
1040  this->MemItem(intPt).m_plastic_steps = plasticloc.IntegrationSteps();
1041  this->MemItem(intPt).m_ER = plasticloc.GetElasticResponse();
1042  int solsize = data.sol[0].size();
1043  for(int i=0; i<solsize; i++)
1044  {
1045  this->MemItem(intPt).m_u[i] += data.sol[0][i];
1046  }
1047  }
1048 
1049 }
1050 
1051 template <class T, class TMEM>
1053 {
1055  return;
1056 }
1057 
1058 template <class T, class TMEM>
1060  TPZFMatrix<REAL> & Stress)
1061 {
1062 
1063  int intPt = data.intGlobPtIndex;
1064  T plasticloc(m_plasticity_model);
1065 
1067  plasticloc.SetState(this->MemItem(intPt).m_elastoplastic_state);
1068  TPZTensor<REAL> eps_t, sigma(this->MemItem(intPt).m_sigma);
1069  eps_t.CopyFrom(Strain);
1070  eps_t.Add(plasticloc.GetState().m_eps_t, 1.);
1071 
1073  TPZTensor<REAL> & last_eps_p = this->MemItem(data.intGlobPtIndex).m_elastoplastic_state.m_eps_p;
1074  TPZTensor<REAL> eps_e = eps_t - last_eps_p;
1075  this->MemItem(intPt).m_ER = m_PER.EvaluateElasticResponse(eps_e);
1076  }
1077  plasticloc.SetElasticResponse(this->MemItem(intPt).m_ER);
1078 
1079  UpdateMaterialCoeficients(data.x,plasticloc);
1080  plasticloc.ApplyStrainComputeSigma(eps_t, sigma);
1081  sigma.CopyTo(Stress);
1082 
1084  {
1085  this->MemItem(intPt).m_sigma = sigma;
1086  this->MemItem(intPt).m_elastoplastic_state = plasticloc.GetState();
1087  this->MemItem(intPt).m_plastic_steps = plasticloc.IntegrationSteps();
1088  this->MemItem(intPt).m_ER = plasticloc.GetElasticResponse();
1089  int solsize = data.sol[0].size();
1090  for(int i=0; i<solsize; i++)
1091  {
1092  this->MemItem(intPt).m_u[i] += data.sol[0][i];
1093  }
1094  }
1095 }
1096 
1097 template <class T, class TMEM>
1099 {
1100  TPZFNMatrix<9> Tensor(3,3);
1101  ev.Resize(3);
1102  this->vectorToTensor(vectorTensor, Tensor);
1103  int64_t numiterations = 1000;
1104 
1105 #ifdef PZDEBUG
1106  bool result = Tensor.SolveEigenvaluesJacobi(numiterations, m_tol, &ev);
1107  if (result == false){
1108  PZError << __PRETTY_FUNCTION__ << " - ERROR! - result = false - numiterations = " << numiterations << " - tol = " << m_tol << std::endl;
1109 #ifdef LOG4CXX
1110  {
1111  std::stringstream sout;
1112  sout << "<<< TPZMatElastoPlastic<T,TMEM>::EigenValues *** not solved within " << numiterations << " iterations";
1113  sout << "\n vectorTensor = " << vectorTensor;
1114  LOGPZ_ERROR(elastoplasticLogger,sout.str().c_str());
1115  }
1116 #endif
1117  }
1118 #else
1119  Tensor.SolveEigenvaluesJacobi(numiterations, m_tol, &ev);
1120 #endif
1121 }
1122 
1123 template <class T, class TMEM>
1125 {
1126  TPZFNMatrix<9> Tensor(3,3);
1127  this->vectorToTensor(vectorTensor, Tensor);
1128 
1129  TPZManVector<REAL,3> Eigenvalues(3);
1130  TPZFNMatrix<9> Eigenvectors(3,3);
1131 
1132  int64_t numiterations = 1000;
1133 #ifdef PZDEBUG
1134  bool result = Tensor.SolveEigensystemJacobi(numiterations, m_tol, Eigenvalues, Eigenvectors);
1135  if (result == false){
1136  PZError << __PRETTY_FUNCTION__ << " - ERROR! - result = false - numiterations = " << numiterations << " - tol = " << m_tol << std::endl;
1137 #ifdef LOG4CXX
1138  {
1139  std::stringstream sout;
1140  sout << "<<< TPZMatElastoPlastic<T,TMEM>::EigenVectors *** not solved within " << numiterations << " iterations";
1141  sout << "\n vectorTensor = " << vectorTensor;
1142  LOGPZ_ERROR(elastoplasticLogger,sout.str().c_str());
1143  }
1144 #endif
1145  }
1146 #else
1147  Tensor.SolveEigensystemJacobi(numiterations, m_tol, Eigenvalues, Eigenvectors);
1148 #endif
1149  Solout.Resize(3);
1150  for(int i = 0; i < 3; i++) Solout[i] = Eigenvectors(direction,i);
1151 }
1152 
1153 template <class T, class TMEM>
1155 {
1156  return new TPZMatElastoPlastic<T,TMEM>(*this);
1157 }
1158 /*
1159  void TPZMatElastoPlastic::SetData(std::istream &data)
1160  {
1161  TPZMaterial::SetData(data);
1162  data >> fDeltaT; // to be removed in the elastoplastic material and readded to the poroelastoplastic material
1163  }*/
1164 
1165 #include "TPZSandlerExtended.h"
1166 #include "TPZPlasticStepPV.h"
1167 #include "TPZYCMohrCoulombPV.h"
1168 
1169 template <class T, class TMEM>
1171  return "TPZMatElastoPlastic<T,TMEM>";
1172 }
1173 
1174 template <class T, class TMEM>
1175 void TPZMatElastoPlastic<T, TMEM>::Write(TPZStream &buf, int withclassid) const {
1176  TPZMatWithMem<TMEM>::Write(buf, withclassid);
1177 
1178  buf.Write(&m_force[0], 3);
1179  buf.Write(&m_PostProcessDirection[0], 3);
1180  m_plasticity_model.Write(buf, withclassid);
1181  buf.Write(&m_tol, 1);
1182 }
1183 
1184 template <class T, class TMEM>
1186  // TPZSavable::Read(buf, context);
1187 
1188  TPZMatWithMem<TMEM>::Read(buf, context);
1189 
1190  buf.Read(&m_force[0], 3);
1191  buf.Read(&m_PostProcessDirection[0], 3);
1192  m_plasticity_model.Read(buf, context);
1193  buf.Read(&m_tol, 1);
1194 }
1195 
1196 template <class T, class TMEM>
1198 {
1199  m_tol = tol;
1200 }
1201 
1202 template <class T, class TMEM>
1204 {
1205  m_rho_bulk = bulk;
1206 }
1207 
1208 template <class T, class TMEM>
1210 {
1211  TPZTensor<REAL> vecT;
1212  vecT.CopyFrom(vectorTensor);
1213  vecT.CopyToTensor(Tensor);
1214 }
1215 
1216 template <class T, class TMEM>
1218 
1220  data.fNeedsSol = true;
1221  data.fNeedsNormal = false;
1222  data.fNeedsHSize = false;
1223  data.fNeedsNeighborCenter = false;
1224 }
1225 
1226 template <class T, class TMEM>
1228 {
1229  data.fNeedsSol = true;
1230  data.fNeedsNormal = true;
1231 }
1232 
1233 
1234 
1235 
1236 
virtual void Print(std::ostream &out) override
Prints out the data associated with the material.
virtual void Execute(const TPZVec< REAL > &x, TPZVec< TVar > &f, TPZFMatrix< TVar > &df)
Performs function computation.
Definition: pzfunction.h:38
#define _XZ_
Definition: TPZTensor.h:29
void Print(std::ostream &out=std::cout)
Prints the structural information of the vector object to the output stream. This method will not p...
Definition: pzvec.h:482
virtual bool SolveEigenvaluesJacobi(int64_t &numiterations, REAL &tol, TPZVec< TVar > *Sort=0)
Transforms this matrix in a diagonal matrix, where the diagonal values are its eigenvalues. This method is efficient only for small matrices.
Definition: pzmatrix.cpp:1727
void CopyTo(TPZTensor< T1 > &target) const
Definition: TPZTensor.h:819
TPZManVector< REAL, 3 > normal
normal to the element at the integration point
void Add(const TPZTensor< T1 > &tensor, const T2 &constant)
Definition: TPZTensor.h:757
void CopyFrom(const TPZFMatrix< T > &source)
Definition: TPZTensor.h:833
TPZManVector< REAL, 3 > m_PostProcessDirection
Contains definitions to LOGPZ_DEBUG, LOGPZ_INFO, LOGPZ_WARN, LOGPZ_ERROR and LOGPZ_FATAL, and the implementation of the inline InitializePZLOG(string) function using log4cxx library or not. It must to be called out of "#ifdef LOG4CXX" scope.
TPZManVector< REAL, 3 > x
value of the coordinate at the integration point
TPZManVector< REAL, 3 > m_force
clarg::argBool bc("-bc", "binary checkpoints", false)
TPZManVector< T, 6 > fData
Definition: TPZTensor.h:652
virtual void SetBulkDensity(REAL &RhoB)
T I1() const
Definition: TPZTensor.h:903
virtual std::string Name() override
virtual void Write(TPZStream &buf, int withclassid) const override
int Type()
Definition: pzbndcond.h:249
virtual bool SolveEigensystemJacobi(int64_t &numiterations, REAL &tol, TPZVec< TVar > &Eigenvalues, TPZFMatrix< TVar > &Eigenvectors) const
Compute Eigenvalues and Eigenvectors of this matrix. This method is efficient only for small matrice...
Definition: pzmatrix.cpp:1583
virtual void SetPlasticityModel(T &plasticity)
T & YY() const
Definition: TPZTensor.h:578
void SetPlasticModel(T &plasticity_model)
TPZGradSolVec dsol
vector of the derivatives of the solution at the integration point
void ApplyDeltaStrain(TPZMaterialData &data, TPZFMatrix< REAL > &DeltaStrain, TPZFMatrix< REAL > &Stress)
void Write(TPZStream &buf, int withclassid) const override
virtual void SetDefaultMem(TMEM &defaultMem)
Sets the default memory settings for initialization.
REAL val(STATE &number)
Returns value of the variable.
Definition: pzartdiff.h:23
virtual void Solution(TPZMaterialData &data, int var, TPZVec< REAL > &Solout) override
virtual void ContributeBC(TPZMaterialData &data, REAL weight, TPZFMatrix< REAL > &ek, TPZFMatrix< REAL > &ef, TPZBndCond &bc) override
void ComputeDeltaStrainVector(TPZMaterialData &data, TPZFMatrix< REAL > &DeltaStrain)
virtual void Resize(const int64_t newsize, const T &object)
Resizes the vector object.
Definition: pzmanvector.h:426
Implements an abstract class implementing the memory features.
Definition: TPZMatWithMem.h:23
TPZFMatrix< STATE > & Val2(int loadcase=0)
Definition: pzbndcond.h:255
TPZFNMatrix< 220, REAL > phi
vector of shapefunctions (format is dependent on the value of shapetype)
virtual int NSolutionVariables(int var) override
virtual TPZMaterial * NewMaterial() override
virtual void Read(TPZStream &buf, void *context) override
void ComputeStrainVector(TPZMaterialData &data, TPZFMatrix< REAL > &Strain)
virtual int Dimension() const override
TPZFNMatrix< 660, REAL > dphix
values of the derivative of the shape functions
virtual TPZPorousElasticResponse & GetPorousElasticity(TPZPorousElasticResponse &PER)
This abstract class defines the behaviour which each derived class needs to implement.
Definition: TPZMaterial.h:39
virtual void UpdateMaterialCoeficients(TPZVec< REAL > &x, T &plasticity)
Contains the TPZBndCond class which implements a boundary condition for TPZMaterial objects...
virtual void SetTol(const REAL &tol)
int64_t size() const
Returns the number of elements of the vector.
Definition: pzvec.h:196
virtual void Resize(const int64_t newsize, const T &object)
Resizes the vector object reallocating the necessary storage, copying the existing objects to the new...
Definition: pzvec.h:373
virtual void Contribute(TPZMaterialData &data, REAL weight, TPZFMatrix< REAL > &ek, TPZFMatrix< REAL > &ef) override
T & YZ() const
Definition: TPZTensor.h:582
virtual void Print(std::ostream &out, const int memory)
static const double tol
Definition: pzgeoprism.cpp:23
void EigenValues(TPZFMatrix< REAL > &vectorTensor, TPZVec< REAL > &ev)
void CopyToTensor(TPZFMatrix< T > &Tensor) const
Definition: TPZTensor.h:988
virtual void Write(const bool val)
Definition: TPZStream.cpp:8
void EigenVectors(TPZFMatrix< REAL > &vectorTensor, TPZVec< REAL > &Solout, int direction)
TVar Norm(const TPZFMatrix< TVar > &A)
Returns the norm of the matrix A.
virtual int NStateVariables() const override
#define _XX_
Definition: TPZTensor.h:27
#define LOGPZ_DEBUG(A, B)
Define log for debug info.
Definition: pzlog.h:87
void EigenSystem(TPZDecomposed &eigensystem) const
Definition: TPZTensor.h:1265
This class defines the boundary condition for TPZMaterial objects.
Definition: pzbndcond.h:29
virtual void Errors(TPZVec< REAL > &x, TPZVec< REAL > &u, TPZFMatrix< REAL > &dudx, TPZFMatrix< REAL > &axes, TPZVec< REAL > &flux, TPZVec< REAL > &u_exact, TPZFMatrix< REAL > &du_exact, TPZVec< REAL > &values) override
#define _YZ_
Definition: TPZTensor.h:31
#define _XY_
Definition: TPZTensor.h:28
void ComputeStressVector(TPZMaterialData &data, TPZFMatrix< REAL > &Stress)
int64_t Rows() const
Returns number of rows.
Definition: pzmatrix.h:803
void Read(TPZStream &buf, void *context) override
TPZFNMatrix< 9, REAL > axes
axes indicating the directions of the derivatives of the shapefunctions
T J2() const
Definition: TPZTensor.h:927
TPZFMatrix< STATE > & Val1()
Definition: pzbndcond.h:253
int intGlobPtIndex
global point index
virtual void ContributeBC(TPZMaterialData &data, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef, TPZBndCond &bc)=0
It computes a contribution to the stiffness matrix and load vector at one BC integration point...
#define LOGPZ_ERROR(A, B)
Define log for errors (cout)
Definition: pzlog.h:93
virtual void SetPorousElasticity(TPZPorousElasticResponse &PER)
#define _YY_
Definition: TPZTensor.h:30
int Redim(const int64_t newRows, const int64_t newCols) override
Redimension a matrix and ZERO your elements.
Definition: pzfmatrix.h:616
virtual void FillBoundaryConditionDataRequirement(int type, TPZMaterialData &data) override
#define _ZZ_
Definition: TPZTensor.h:32
static int idf[6]
void ApplyDirection(TPZFMatrix< REAL > &vectorTensor, TPZVec< REAL > &Out)
void CheckConvergence(TPZMaterialData &data, TPZFMatrix< REAL > &DeltaStrain)
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
TPZAutoPointer< TPZFunction< STATE > > fForcingFunction
Pointer to forcing function, it is the right member at differential equation.
Definition: TPZMaterial.h:47
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_ expr_ expr_ expr_ expr_ log10
Definition: tfadfunc.h:135
virtual int VariableIndex(const std::string &name) override
Defines the interface for saving and reading data. Persistency.
Definition: TPZStream.h:50
def values
Definition: rdt.py:119
void vectorToTensor(const TPZFMatrix< REAL > &vectorTensor, TPZFMatrix< REAL > &Tensor)
virtual void PrintMem(std::ostream &out=std::cout, const int memory=0)
Prints out the data associated with the material.
T & XZ() const
Definition: TPZTensor.h:574
virtual TMEM & MemItem(const int i) const
void ApplyDeltaStrainComputeDep(TPZMaterialData &data, TPZFMatrix< REAL > &DeltaStrain, TPZFMatrix< REAL > &Stress, TPZFMatrix< REAL > &Dep)
TPZSolVec sol
vector of the solutions at the integration point
TPZElasticResponse EvaluateElasticResponse(const TPZTensor< STATE > &epsilon) const
Computes a linear elastic response from function evaluation of non linear expressions.
void Transpose(TPZMatrix< TVar > *const T) const override
It makes *T the transpose of current matrix.
Definition: pzfmatrix.cpp:1073
TPZPorousElasticResponse m_PER
#define PZError
Defines the output device to error messages and the DebugStop() function.
Definition: pzerror.h:15
virtual void FillDataRequirements(TPZMaterialData &data) override
virtual void Read(bool &val)
Definition: TPZStream.cpp:91