NeoPZ
TPZYCSandlerDimaggioL.h
Go to the documentation of this file.
1 // $Id: TPZYCSandlerDimaggio.h,v 1.11 2009-06-29 22:54:01 erick Exp $
2 
3 #ifndef TPZYCSANDLERDIMAGGIOL_H
4 #define TPZYCSANDLERDIMAGGIOL_H
5 
6 #include "TPZYCSandlerDimaggio.h"
7 #include "pzlog.h"
8 
9 #ifndef CHECKCONV
10 #define CHECKCONV
11 #include "checkconv.h"
12 #endif
13 
14 #include "fadType.h"
15 
16 #ifdef LOG4CXX
17 #include "pzlog.h"
18 
19 static LoggerPtr loggerSML(Logger::getLogger("material.plasticity.SML"));
20 
21 #endif
22 
29 
30 
31 public:
32 
33  enum {NYield = 2};
34 
35 int ClassId() const override;
36 
37 
39 
41  {
42  }
43 
45  {
47  return *this;
48  }
49 
51  {
52 
53  }
54 
55 
56  const char * Name() const
57  {
58  return "TPZYCSandlerDimaggioL";
59  }
60 
61  void Print(std::ostream & out) const override
62  {
63  out << "\n" << this->Name();
65  }
66 
67 
75  template < class T>
76  void Compute(const TPZTensor<T> & sigma, const T & A, TPZVec<T> &res, int checkForcedYield) const;
77 
85  template <class T>
86  void N(const TPZTensor<T> & sigma,const T & A, TPZVec<TPZTensor<T> > & Ndir, int checkForcedYield) const;
87 
95  template <class T>
96  void H(const TPZTensor<T> & sigma,const T & A, TPZVec<T> & h, int checkForcedYield) const;
97 
101  template <class T>
102  void AlphaMultiplier(const T &A, T &multiplier) const;
103 
114  void InitialGuess(const TPZElasticResponse &ER, REAL L, TPZTensor<REAL> &sigtrial, REAL &epspproj,
115  TPZVec<REAL> &delgamma, TPZTensor<REAL> &sigproj);
116 
117  inline REAL InitialDamage()
118  {
119  // for this particular case!!! toto
120  REAL X,L,alpha(0.);
121  ComputeX(alpha, X);
122  SolveL(X, L);
123 // L -= 0.01;
124  return L;
125 
126  }
127  // 3 K Depsp/DL (L-Lextern) = (I1(sigtrial)-L)
128  void ComputeLatIntersectionLeft(const TPZElasticResponse &ER, REAL &L, TPZVec<REAL> &sigtrialIJ) const;
129 
130  // 3 K Depsp/DL (LIntersect-Lextern) = (I1(sigtrial)-I1(Lintersect) )
131  void ComputeLatIntersectionRight(const TPZElasticResponse &ER, REAL &L, TPZVec<REAL> &sigtrialIJ) const;
132 private:
133 
134  void NewtonF2(const TPZElasticResponse &ER, REAL &L, TPZVec<REAL> &sigtrialIJ)
135  {
136  DebugStop();
137  }
138 public:
139 
140  virtual int GetNYield() const override {
141  return as_integer(NYield);
142  }
143 
145 
149  inline int NumCases();
150 
155  inline void LoadState(TPZFMatrix<REAL> &state);
156 
157  inline void ComputeTangent(TPZFMatrix<REAL> &tangent, TPZVec<REAL> &, int icase);
158 
159  inline void Residual(TPZFMatrix<REAL> &res,int icase);
160 
161  static void CheckConv();
162 
164 
166 
167  static void TestSolveL();
169 
170  static void McCormicRanchSand(TPZYCSandlerDimaggio & material);
171 public:
172 
173 };
174 
175 
176 
177 template <class T>
178 inline void TPZYCSandlerDimaggioL::Compute(const TPZTensor<T> & sigma,const T & A, TPZVec<T> &res, int checkForcedYield) const
179 {
180  // the termoforce A in this case is assumed to be the
181  // plastic volumetric strain itself. In fact it is not,
182  // but the resultant derivatives are correct for practical purposes.
183 
184  // The following line evaluates L, the value of the first
185  // invariant of stresses at the intersection of the
186  // shear and hardening cap yield criteria / plastic potential.
187  // It is first evaluated as REAL type to avoid unnecessary
188  // derivatives evaluation.
189 #ifdef LOG4CXX_PLASTICITY
190  {
191  LoggerPtr logger(Logger::getLogger("plasticity.SandlerDimaggioL"));
192  std::stringstream sout;
193  sout << ">>> TPZYCSandlerDimaggio::Compute *** - Plastic Potential / Yield - associative";
194  LOGPZ_INFO(logger,sout.str().c_str());
195  }
196 #endif
197 
198 // REAL L_REAL = TPZExtractVal::val(A);
199 // REAL X_REAL;
200 // ComputeX((REAL)TPZExtractVal::val(A), X_REAL);
201 // LInitialGuess(X_REAL, L_REAL);
202 // SolveL(X_REAL, L_REAL);
203 
204  T I1 = sigma.I1();
205  T J2 = sigma.J2();
206 
207  if (fIsonCap == false)
208  {
209  // f1 - Modified Drucker-Prager as shear Yield Criterium
210  T FI1;
211  ComputeF(I1, FI1);
212  if(fabs((REAL)TPZExtractVal::val(J2)) < 1.e-6)
213  {
214  res[0] = - FI1; // avoiding nan derivatives
215  }else{
216  res[0] = sqrt(J2) - FI1;
217  }
218 
219  // f2 - ellipsoidal hardening/softening cap
220  T L = A;
221  T FL;
222  // T L(L_REAL), X;
223  // ComputeX(A, X);
224  // SolveL(X, L); // evaluating the derivatives of L
225  ComputeF(L, FL);
226 
227  if(fabs( (REAL)TPZExtractVal::val(FL) ) < 0.00001)
228  {
229  #ifdef LOG4CXX_PLASTICITY
230  {
231  LoggerPtr logger(Logger::getLogger("plasticity.SandlerDimaggio"));
232  std::stringstream sout;
233  sout << "*** TPZYCSandlerDimaggio::ComputePlasticPotential ***";
234  sout << "\nDivision by F=" << TPZExtractVal::val(L) << " at f2 - ellipsoidal hardening/softening cap";
235  LOGPZ_WARN(logger,sout.str().c_str());
236  }
237  #endif
238  }
239 
240  T Temp1( (L - I1)/(FL * T(fR) ) );
241  Temp1 *= Temp1;
242  T Temp2 = J2 / FL / FL;
243 
244  res[1] = Temp1 + Temp2 - T(1.);
245  }
246  else {
247  REAL lmax = LMax();
248  REAL FI1;
249  ComputeF(lmax , FI1);
250  if(fabs((REAL)TPZExtractVal::val(J2)) < 1.e-6)
251  {
252  res[1] = - FI1; // avoiding nan derivatives
253  }else{
254  res[1] = sqrt(J2) - FI1;
255  }
256  res[0] = I1-T(lmax);
257 #ifdef PZDEBUG
258  {
259  std::stringstream sout;
260  T sqj2 = J2;
261  if(fabs(TPZExtractVal::val(J2)) > 1.e-6)
262  {
263  sqj2 = sqrt(J2);
264  }
265 
266  sout << "Computing the distance from cap entry I1 " << I1 << " sqJ2 " << sqj2 << " lmax " << lmax << " F(lmax) " << FI1;
267  LOGPZ_DEBUG(loggerSML, sout.str())
268  }
269 #endif
270  }
271  return;
272 }
273 
274 template <class T>
275 inline void TPZYCSandlerDimaggioL::N(const TPZTensor<T> & sigma, const T & A, TPZVec<TPZTensor<T> > & Ndir, int checkForcedYield) const
276 {
277 
278  // the termoforce A in this case is assumed to be the
279  // plastic volumetric strain itself. In fact it is not,
280  // but the resultant derivatives are correct for practical purposes.
281 
282  //The following line evaluates L, the value of the first
283  // invariant of stresses at the intersection of the
284  // shear and hardening cap yield criteria / plastic potential.
285  // It is first evaluated as REAL type to avoid unnecessary
286  // derivatives evaluation.
287 
288 
289  #ifdef LOG4CXX_PLASTICITY
290  {
291  LoggerPtr logger(Logger::getLogger("plasticity.SandlerDimaggioL"));
292  std::stringstream sout;
293  sout << ">>> TPZYCSandlerDimaggio::N *** - Plastification direction - associative";
294  LOGPZ_INFO(logger,sout.str().c_str());
295  }
296  #endif
297 
298 // REAL ResTol = 1.e-6;
299 
300  REAL L_REAL;
301 // REAL X_REAL;
302 // ComputeX((REAL)TPZExtractVal::val(A), X_REAL);
303 // LInitialGuess(X_REAL, L_REAL);
304 // SolveL(X_REAL, L_REAL, ResTol);
305 
306  L_REAL = TPZExtractVal::val(A);
307  T I1 = sigma.I1();
308  T J2 = sigma.J2();
309  T SQRTJ2;
310  if (TPZExtractVal::val(J2) > 1.e-12) {
311  SQRTJ2 = sqrt(J2);
312  }
313  else {
314  SQRTJ2 = sqrt(T(1.e-6)+J2);
315  }
316 
317  if(fIsonCap == false)
318  {
319  //f1 - Modified Drucker-Prager as shear Yield Criterium / Plastic Potential
320  REAL fz = FZero();
321  T Temp1(0.);
322  if (TPZExtractVal::val(I1) < fz )
323  {
324  Temp1 = I1 * T(fB);
325  Temp1 = exp( Temp1 ) * T (fB * fC);
326 
327  if((REAL)TPZExtractVal::val(SQRTJ2) < 1.e-6) // just for robustness. f1 shouldn't be reached when J2 = 0.
328  {
329  #ifdef LOG4CXX_PLASTICITY
330  {
331  LoggerPtr logger(Logger::getLogger("plasticity.SandlerDimaggio"));
332  std::stringstream sout;
333  sout << "*** TPZYCSandlerDimaggio::N *** - SQRT(J2) = " << TPZExtractVal::val(SQRTJ2) << " < 1.e-6 causes error in 0-th yield function. Imposing J2 = 1.e-6 instead";
334  LOGPZ_WARN(logger,sout.str().c_str());
335  }
336  #endif
337  SQRTJ2 = T(1.e-6)+SQRTJ2;
338  }
339  }
340  Temp1 = Temp1 - I1 / SQRTJ2 / T(6.);
341  T Temp2 = T(1.) / SQRTJ2;
342  T Temp3 = Temp2 / T(2.);
343 
344  Ndir[0].XX() = Temp1 + sigma.XX() * Temp3;
345  Ndir[0].YY() = Temp1 + sigma.YY() * Temp3;
346  Ndir[0].ZZ() = Temp1 + sigma.ZZ() * Temp3;
347 // Ndir[0].YZ() = sigma.YZ() * Temp2;
348 // Ndir[0].XZ() = sigma.XZ() * Temp2;
349 // Ndir[0].XY() = sigma.XY() * Temp2;
350  Ndir[0].YZ() = sigma.YZ() * Temp3;
351  Ndir[0].XZ() = sigma.XZ() * Temp3;
352  Ndir[0].XY() = sigma.XY() * Temp3;
353 #ifdef LOG4CXX
354  {
355  std::stringstream sout;
356  Ndir[0].Print(sout);
357  LOGPZ_DEBUG(loggerSML, sout.str())
358  }
359 #endif
360  }
361  else {
362  Ndir[0].XX() = 1.;
363  Ndir[0].YY() = 1.;
364  Ndir[0].ZZ() = 1.;
365  // Ndir[0].YZ() = sigma.YZ() * Temp2;
366  // Ndir[0].XZ() = sigma.XZ() * Temp2;
367  // Ndir[0].XY() = sigma.XY() * Temp2;
368  Ndir[0].YZ() = 0.;
369  Ndir[0].XZ() = 0.;
370  Ndir[0].XY() = 0.;
371 
372  }
373 
374  if (fIsonCap == false)
375  {//f2 - ellipsoidal hardening/softening cap
376 
377  T FL;
378  T L = A;
379 // T X;
380 // T L(L_REAL * 1.- ResTol); // guaranteeing that the function will be evaluated
381 // ComputeX(A, X);
382 // SolveL(X, L, ResTol); // evaluating the derivatives of L
383 
384  ComputeF(L, FL);
385  // the radius of the ellips needs to be positive
386  // this should be taken care of by the computation of L which is limited by LMax()
387  if (TPZExtractVal::val(FL) <= 0.) {
388  DebugStop();
389  }
390  T FL2 = FL * FL;
391  T FL3 = FL2;// / T(2.);
392 
393  T Temp = (I1-L)/ T(fR * fR) - I1 / T(6.);
394  Temp = Temp / FL2 * T(2.);
395 
396  #ifdef LOG4CXX_PLASTICITY
397  {
398  LoggerPtr logger(Logger::getLogger("plasticity.SandlerDimaggio"));
399  std::stringstream sout;
400  sout << "*** TPZYCSandlerDimaggio::N *** X = " << X
401  << "\n L = " << L << " L_REAL = " << L_REAL
402  << "\n FL = " << FL
403  << "\n Temp = " << Temp
404  << "\n 3 Temp + I1/FL2 " << T(3.)*Temp+I1/FL2;
405 
406  LOGPZ_DEBUG(logger,sout.str().c_str());
407  }
408  #endif
409 
410  Ndir[1].XX() = Temp + sigma.XX() / FL2;
411  Ndir[1].YY() = Temp + sigma.YY() / FL2;
412  Ndir[1].ZZ() = Temp + sigma.ZZ() / FL2;
413  Ndir[1].YZ() = sigma.YZ() / FL3;
414  Ndir[1].XZ() = sigma.XZ() / FL3;
415  Ndir[1].XY() = sigma.XY() / FL3;
416  }
417  else {
418  TPZTensor<T> Deviatoric;
419  sigma.S(Deviatoric);
420  Ndir[1] = Deviatoric;
421  }
422 
423  #ifdef LOG4CXX
424  {
425  LoggerPtr logger(Logger::getLogger("pz.plasticity.SandlerDimaggio.main"));
426  std::stringstream sout;
427  sout << "<< TPZYCSandlerDimaggio::N *** \n sigma = \n" << sigma
428  << "\nI1 = " << I1
429  << "\nJ2 = " << J2
430  << "\nSQRTJ2 = " << SQRTJ2
431  << "\nNdir = \n" << Ndir;
432  //LOGPZ_DEBUG(logger,sout.str().c_str());
433  }
434  #endif
435 
436  return;
437 }
438 
442 template <class T>
443 inline void TPZYCSandlerDimaggioL::AlphaMultiplier(const T &A, T &multiplier) const
444 {
445  this->DEpspDL(A, multiplier);
446 }
447 
448 template <class T>
449 inline void TPZYCSandlerDimaggioL::H(const TPZTensor<T> & sigma,const T & A, TPZVec<T> & h, int checkForcedYield) const
450 {
451 
452  // the termoforce A in this case is assumed to be the
453  // plastic volumetric strain itself. In fact it is not,
454  // but the resultant derivatives are correct for practical purposes.
455 
456  //The following line evaluates L, the value of the first
457  // invariant of stresses at the intersection of the
458  // shear and hardening cap yield criteria / plastic potential.
459  // It is first evaluated as REAL type to avoid unnecessary
460  // derivatives evaluation.
461 
462  #ifdef LOG4CXX_PLASTICITY
463  {
464  LoggerPtr logger(Logger::getLogger("plasticity.SandlerDimaggio"));
465  std::stringstream sout;
466  sout << ">>> TPZYCSandlerDimaggio::H *** - Hardening modulus";
467  LOGPZ_INFO(logger,sout.str().c_str());
468  }
469  #endif
470 
471 // REAL L_REAL = TPZExtractVal::val(A);
472 // REAL X_REAL;
473 // ComputeX((REAL)TPZExtractVal::val(A), X_REAL);
474 // LInitialGuess(X_REAL, L_REAL);
475 // SolveL(X_REAL, L_REAL);
476 
477  if (fIsonCap == false)
478  {
479  T I1 = sigma.I1();
480 
481  {//f1 - Modified Drucker-Prager as shear Yield Criterium / Plastic Potential
482 
483  h[0] = exp (I1 * T(fB) ) * T(3. * fB * fC) ;
484  // h > 0 because plastic deformation is dilatant
485  }
486 
487  {//f2 - ellipsoidal hardening/softening cap
488  T FL;
489  T L = A;
490  // T X, L(L_REAL);
491  // ComputeX(A, X);
492  // SolveL(X, L); // evaluating the derivatives of L
493  ComputeF(L, FL);
494  T FL2 = FL * FL;
495  // DebugStop();
496  h[1] = (I1 - L) / FL2 * T ( 6. / fR / fR);
497  // h <=0 because plastic deformation is compactant
498  }
499  }
500  else
501  {
502  h[0] = 0.;
503  h[1] = 0.;
504  }
505  return;
506 
507 }
508 
509 
510 
512 
514 
525 inline void TPZYCSandlerDimaggioL::InitialGuess(const TPZElasticResponse &ER, REAL Lextern, TPZTensor<REAL> &sigtrial, REAL &Lproj,
526  TPZVec<REAL> &delgamma, TPZTensor<REAL> &sigproj)
527 {
528  TPZManVector<REAL,2> yield(2,0.);
529  REAL L = Lextern;
530  TPZTensor<REAL> S;
531  sigtrial.S(S);
532  REAL J2 = S.J2();
533  REAL sqJ2 = sqrt(fabs(J2));
534  REAL I1 = sigtrial.I1();
535  TPZManVector<REAL,2> sigtrialIJ(2),sigtrialIJF1(2),sigtrialIJF2(2),sigtrialIJkeep;
536  sigtrialIJ[0] = I1;
537  sigtrialIJ[1] = sqJ2;
538  sigtrialIJkeep = sigtrialIJ;
539  Compute(sigtrial, L, yield, 0);
540  int surfaceprojected = -1;
541 #ifdef LOG4CXX
542  {
543  std::stringstream sout;
544  sout << "Value of fIsonCap " << fIsonCap;
545  if (fIsonCap == true) {
546  sout << "\nI should stop";
547  }
548  LOGPZ_DEBUG(loggerSML, sout.str())
549  }
550 #endif
551  fIsonCap = false;
552 
553  if (yield[1] <= 0.) {
554  sigtrialIJF1 = sigtrialIJ;
555  if (yield[0] > 0.)
556  {
557  NewtonF1(ER, L, sigtrialIJF1);
558  sigtrial.Adjust(sigtrialIJF1, sigproj);
559  surfaceprojected = 0;
560 
561  }
562  else {
563  // fully elastic
564  Lproj = Lextern;
565  sigproj = sigtrial;
566  delgamma.Fill(0.);
567 #ifdef LOG4CXX
568  if(loggerSML->isDebugEnabled())
569  {
570  std::stringstream sout;
571  if(yield[0] <= 0.)
572  {
573  sout << "ELASTIC YIELD\n";
574  }
575  sout << "Deformation elastic yield = " << yield;
576  sout << "delgamma condition " << (delgamma[0] > 0.) << " " << (delgamma[1] > 0.) << std::endl;
577  LOGPZ_DEBUG(loggerSML, sout.str())
578  }
579 #endif
580  return;
581 
582  }
583  if (sigtrialIJF1[0] <= LMax())
584  {
585  // after the projection the point is left from the cap surface
586  sigtrialIJ = sigtrialIJF1;
587  Lproj = L;
588  }
589  else {
590  fIsonCap = true;
591  sigtrialIJ[0] = LMax();
592  REAL F;
593  ComputeF(sigtrialIJ[0],F);
594  if (sqJ2 > F) {
595  sigtrialIJ[1] = F;
596  }
597  else
598  {
599  sigtrialIJ[1] = sqJ2;
600  }
601  sigtrial.Adjust(sigtrialIJ, sigproj);
602  L = LMax();
603  Lproj = Lextern;
604 #ifdef LOG4CXX
605  {
606  std::stringstream sout;
607  sout << "Projecting on the cap after projection on F1 : sigtrialIJ " << sigtrialIJ << " L " << L << " Lproj " << Lproj;
608  LOGPZ_DEBUG(loggerSML, sout.str())
609  }
610 #endif
611  }
612  }
613  else {
614  surfaceprojected = 1;
615  NewtonF2L(ER, L, sigtrialIJ);
616 
617  sigtrial.Adjust(sigtrialIJ, sigproj);
618  if(sigtrialIJ[0] > LMax())
619  {
620  fIsonCap = true;
621  sigtrialIJ[0] = LMax();
622  REAL F;
623  ComputeF(sigtrialIJ[0],F);
624  if (sqJ2 > F) {
625  sigtrialIJ[1] = F;
626  }
627  else
628  {
629  sigtrialIJ[1] = sqJ2;
630  }
631  sigtrial.Adjust(sigtrialIJ, sigproj);
632  L = LMax();
633  Lproj = Lextern;
634 #ifdef LOG4CXX
635  {
636  std::stringstream sout;
637  sout << "Projecting on the cap after projection on F2 : sigtrialIJ " << sigtrialIJ << " L " << L << " Lproj " << Lproj;
638  LOGPZ_DEBUG(loggerSML, sout.str())
639  }
640 #endif
641  }
642  else
643  {
644  Lproj = L;
645  }
646  }
647 // REAL LF1 = L;
648 // REAL LF2 = L;
649 // if(I1 < Lextern)
650 // {
651 // fIsonCap = false;
652 // // we can only project on the surface F2
653 // if (yield[1] > 0.) {
654 // // project the point on surface F2
655 // sigtrialIJF2 = sigtrialIJ;
656 // TPZTensor<REAL> sigtrialF2;
657 // NewtonF2L(ER, LF2, sigtrialIJF2);
658 // }
659 // sigtrial.Adjust(sigtrialIJF2, sigproj);
661 // sigtrialIJ = sigtrialIJF2;
662 // L = LF2;
663 // }
664 // else {
665 // // the point can project on F1 or F2 or can be projected on the cap
666 // if (yield[0] > 0.) {
667 // sigtrialIJF1 = sigtrialIJ;
668 // NewtonF1(ER, LF1, sigtrialIJF1);
669 //
670 // // verify if the projected point plastifies F2
671 // if (sigtrialIJF1[0] < LF1) {
672 // // the projected point is left of L
673 // // this means F2 must be active
674 // // the increase in L must be at the intersection of both surfaces this intersection point is L itself!
675 // // 3 K Depsp/DL (L-Lextern) = (I1(sigtrial)-L)
676 // TPZManVector<REAL> sigtrialIntersectIJ(sigtrialIJ);
677 // REAL LFIntersect = Lextern;
678 // ComputeLatIntersectionLeft(ER, LFIntersect, sigtrialIJ);
679 //
680 // }
681 // else {
682 // // verify if the projected point is within F2
683 // TPZManVector<REAL,2> yieldProj(2);
684 // TPZTensor<REAL> sigtrialF1;
685 // sigtrial.Adjust(sigtrialIJF1,sigtrialF1);
686 // Compute(sigtrialF1,LF1,yieldProj,0);
687 // if (yieldProj[1] > 0.) {
688 // // the projection on F1 is within F2
689 // // the increase in L is such that the projection point is at the intersection of F1 and F2 to the right
690 // // unlikely case!
691 // // 3 K Depsp/DL (L-Lextern) = (I1(sigtrial) - I1intersect(L) )
692 // TPZManVector<REAL> sigtrialIntersectIJ(sigtrialIJ);
693 // REAL LFIntersect = Lextern;
694 // ComputeLatIntersectionRight(ER, LFIntersect, sigtrialIJ);
695 // sigtrial.Adjust(sigtrialIJ, sigproj);
696 // L = LFIntersect;
697 // }
698 // else {
699 // L = LF1;
700 // sigtrialIJ = sigtrialIJF1;
701 // sigtrial.Adjust(sigtrialIJF1, sigproj);
702 // }
703 // }
704 // }
705 // else if(yield[1] > 0.)
706 // {
707 // sigtrialIJF2 = sigtrialIJ;
708 // LF2 = Lextern;
709 // NewtonF2(ER, LF2, sigtrialIJF2);
710 // TPZTensor<REAL> sigtrialF2;
711 // sigtrial.Adjust(sigtrialIJF2, sigtrialF2);
712 // TPZManVector<REAL,2> yieldproj(2,0.);
713 // Compute(sigtrialF2,LF2,yieldproj,0);
714 // if (yieldproj[0] > 0.) {
715 // // Don't know what to do??
716 // DebugStop();
717 // }
718 // else {
719 // L = LF2;
720 // sigtrialIJ = sigtrialIJF2;
721 // }
722 // }
723 // if (LF1 > LMax()) {
724 // fIsonCap = true;
725 // }
726 //
727 // }
728 
729  TPZManVector<TPZTensor<REAL>,2> Ndir(2);
730  this->N(sigproj, Lproj, Ndir, 1);
731  TPZTensor<REAL> sigPlast(sigtrial),epsPlast;
732  sigPlast.Add(sigproj, -1.);
733  TPZManVector<REAL,2> sigPlastIJ(2);
734  sigPlastIJ[0] = sigPlast.I1();
735  sigPlastIJ[1] = sqrt(sigPlast.J2());
736  ER.ComputeStrain(sigPlast, epsPlast);
737  TPZManVector<REAL,2> epsplastIJ(2);
738  epsplastIJ[0] = epsPlast.I1();
739  epsplastIJ[1] = sqrt(epsPlast.J2());
740  REAL I1err = sigPlastIJ[0]-epsplastIJ[0]*3.*ER.K();
741  REAL J2err = sigPlastIJ[1]-epsplastIJ[1]*2.*ER.G();
742  if (fabs(I1err) > 1.e-10 || fabs(J2err) > 1.e-10) {
743  DebugStop();
744  }
745  if (fIsonCap == false)
746  {
747  if (surfaceprojected != 0 && surfaceprojected != 1) {
748  DebugStop();
749  }
750  REAL i1Ndir = Ndir[surfaceprojected].I1();
751  REAL sqj2Ndir = sqrt(Ndir[surfaceprojected].J2());
752  REAL theta1 = atan2(sqj2Ndir,i1Ndir);
753  REAL theta2 = atan2(epsplastIJ[1],epsplastIJ[0]);
754  REAL difftheta = theta1-theta2;
755  REAL sigplnorm = sigPlast.Norm();
756  if (fabs(difftheta) > 1.e-4 && sigplnorm > 1.e-9) {
757  std::cout << "difftheta " << difftheta << " theta1 " << theta1 << " theta2 " << theta2 << std::endl;
758  }
759  REAL theta = 0.;
760  if (surfaceprojected == 1) {
761  REAL FL;
762  ComputeF(Lproj, FL);
763  REAL cst = i1Ndir*(FL*fR)/6.;
764  REAL sst = sqj2Ndir*FL;
765  REAL check = 1.-cst*cst-sst*sst;
766  if (fabs(check) > 1.e-6) {
767  std::cout << "check = " << check << " cst " << cst << " sst " << sst << std::endl;
768  }
769  theta = atan2(sst,cst);
770 
771  REAL xdist = sigtrialIJ[0]-Lproj;
772  REAL ydist = sigtrialIJ[1];
773  REAL theta3 = atan2(ydist, xdist/fR);
774 
775  REAL thetadiff = theta-theta3;
776  if (fabs(thetadiff) > 1.e-6) {
777  std::cout << " thetadiff " << thetadiff << " theta " << theta << " theta3 " << theta3 << std::endl;
778  }
779  // verificar pelo angulo
780  REAL verify = FuncTheta2L(ER, theta, Lproj, sigtrialIJkeep);
781  if (fabs(verify) > 1.e-9) {
782  std::cout << "Validity of functheta " << verify << std::endl;
783  }
784  }
785  Lproj = L;
786  REAL scale = epsPlast.Norm()/Ndir[surfaceprojected].Norm();
787  for (int i=0; i<6; i++) {
788  REAL diff = fabs(scale*Ndir[surfaceprojected][i]-epsPlast[i]);
789  if (diff > 1.e-6) {
790  DebugStop();
791  }
792  }
793  delgamma[0] = 0.;
794  delgamma[1] = 0.;
795  delgamma[surfaceprojected] = scale;
796  }
797  else
798  {
799  REAL lmax = LMax();
800  REAL F;
801  ComputeF(lmax , F);
802  REAL i1Ndir = Ndir[0].I1();
803  REAL sqj2Ndir = sqrt(Ndir[1].J2());
804  REAL i1epsplast = epsPlast.I1();
805  REAL sqj2epsplast = sqrt(epsPlast.J2());
806  if (I1 > lmax ) {
807  delgamma[0] = i1epsplast/i1Ndir;
808  }
809  else
810  {
811  // there would be no reason to fall on the cap
812  DebugStop();
813  }
814  if (sqJ2 > F) {
815  delgamma[1] = sqj2epsplast/sqj2Ndir;
816  }
817  else
818  {
819  delgamma[1] = 0.;
820  }
821  }
822  Compute(sigproj, Lproj, yield, 0);
823 #ifdef LOG4CXX
824  if(loggerSM->isDebugEnabled())
825  {
826  std::stringstream sout;
827  sout << "After projecting the point yield = " << yield;
828  sout << "\ndelgamma = " << delgamma;
829  LOGPZ_DEBUG(loggerSM, sout.str())
830  }
831 #endif
832  if (yield[0] > 1.e-8 && fIsonCap == true) {
833  DebugStop();
834  }
835  if (yield[1] > 1.e-6) {
836  DebugStop();
837  }
838 }
839 
840 // 3 K Depsp/DL (L-Lextern) = (I1(sigtrial)-L)
841 inline void TPZYCSandlerDimaggioL::ComputeLatIntersectionLeft(const TPZElasticResponse &ER, REAL &Lextern, TPZVec<REAL> &sigtrialIJ) const
842 {
843  REAL depspdl;
844  REAL L = Lextern;
845  DEpspDL(L, depspdl);
846  REAL I1 = sigtrialIJ[0];
847  REAL res = 3.*ER.K()*depspdl*(L-Lextern)-(I1-L);
848  while (fabs(res) > 1.e-10) {
849  REAL dres;
850  REAL d2epspdl2;
851  D2EpspDL2(L, d2epspdl2 );
852  dres = 3.*ER.K()*depspdl + 1 + 3.*ER.K()*(L-Lextern)*d2epspdl2;
853  L -= res/dres;
854  DEpspDL(L, depspdl);
855  res = 3.*ER.K()*depspdl*(L-Lextern)-(I1-L);
856  }
857 }
858 
859 // 3 K Depsp/DL (LIntersect-Lextern) = (I1(sigtrial)-I1(Lintersect) )
861 {
862  DebugStop();
863 }
864 
865 
866 #endif //TPZYCSANDLERDIMAGGIO_H
void N(const TPZTensor< T > &sigma, const T &A, TPZVec< TPZTensor< T > > &Ndir, int checkForcedYield) const
TPZYCSandlerDimaggioL & operator=(const TPZYCSandlerDimaggioL &source)
TPZFlopCounter atan2(const TPZFlopCounter &val1, const TPZFlopCounter &val2)
Returns the arc tangent in radians and increments the counter of the Arc Tangent. ATAN2 returns the ...
Definition: pzreal.h:544
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 Add(const TPZTensor< T1 > &tensor, const T2 &constant)
Definition: TPZTensor.h:757
T Norm() const
Definition: TPZTensor.h:854
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.
Implements a vector class which allows to use external storage provided by the user. Utility.
Definition: pzquad.h:16
void ComputeX(const T &A, T &X) const
static void TestSolveL()
T I1() const
Definition: TPZTensor.h:903
void DEpspDL(const T &L, T &depspdL) const
int ClassId() const override
Define the class id associated with the class.
std::underlying_type< Enumeration >::type as_integer(const Enumeration value)
Definition: pzreal.h:37
T & YY() const
Definition: TPZTensor.h:578
clarg::argBool h("-h", "help message", false)
static void CheckConv()
This class implements a simple vector storage scheme for a templated class T. Utility.
Definition: pzgeopoint.h:19
#define LOGPZ_WARN(A, B)
Define log for warnings.
Definition: pzlog.h:91
void H(const TPZTensor< T > &sigma, const T &A, TPZVec< T > &h, int checkForcedYield) const
void ComputeLatIntersectionRight(const TPZElasticResponse &ER, REAL &L, TPZVec< REAL > &sigtrialIJ) const
void AlphaMultiplier(const T &A, T &multiplier) const
virtual int GetNYield() const override
void ComputeF(const T &L, T &F) const
void D2EpspDL2(const T &L, T &d2epspdL2) const
void LoadState(TPZFMatrix< REAL > &state)
T & YZ() const
Definition: TPZTensor.h:582
#define LOGPZ_INFO(A, B)
Define log for informations.
Definition: pzlog.h:89
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 LOGPZ_DEBUG(A, B)
Define log for debug info.
Definition: pzlog.h:87
TPZYCSandlerDimaggio & operator=(const TPZYCSandlerDimaggio &source)
expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ sqrt
Definition: tfadfunc.h:120
TPZYCSandlerDimaggioL(const TPZYCSandlerDimaggioL &source)
string res
Definition: test.py:151
T J2() const
Definition: TPZTensor.h:927
void Adjust(TPZVec< T > &sigIJ, TPZTensor< T > &result) const
adjust the tensor to the given values of I1 and sqj2
Definition: TPZTensor.h:490
void Print(std::ostream &out) const override
static REAL val(const int number)
Definition: pzextractval.h:21
void Residual(TPZFMatrix< REAL > &res, int icase)
static TPZTensor< REAL > gRefTension
void ComputeTangent(TPZFMatrix< REAL > &tangent, TPZVec< REAL > &, int icase)
void InitialGuess(const TPZElasticResponse &ER, REAL L, TPZTensor< REAL > &sigtrial, REAL &epspproj, TPZVec< REAL > &delgamma, TPZTensor< REAL > &sigproj)
void NewtonF2L(const TPZElasticResponse &ER, REAL &L, TPZVec< REAL > &sigtrialIJ)
void Print(std::ostream &out) const override
#define FL(A)
Function for dynamic cast of the material based on map A (second data)
T & XX() const
Definition: TPZTensor.h:566
void ComputeLatIntersectionLeft(const TPZElasticResponse &ER, REAL &L, TPZVec< REAL > &sigtrialIJ) const
void NewtonF2(const TPZElasticResponse &ER, REAL &L, TPZVec< REAL > &sigtrialIJ)
T & XY() const
Definition: TPZTensor.h:570
void Fill(const T &copy, const int64_t from=0, const int64_t numelem=-1)
Will fill the elements of the vector with a copy object.
Definition: pzvec.h:460
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
void NewtonF1(const TPZElasticResponse &ER, REAL &L, TPZVec< REAL > &sigtrialIJ)
Projeto o ponto sobre a superficie F1, atualiza o L.
void Compute(const TPZTensor< T > &sigma, const T &A, TPZVec< T > &res, int checkForcedYield) const
Calculo do criterio de plastificacao.
T & XZ() const
Definition: TPZTensor.h:574
Contains the implementation of the CheckConvergence function.
const char * Name() const
static void McCormicRanchSand(TPZYCSandlerDimaggio &material)
void SolveL(const T &X, T &L, REAL relTol=1.e-10) const
REAL FuncTheta2L(const TPZElasticResponse &ER, REAL theta, REAL L, TPZVec< REAL > &sigtrialIJ) const
void S(TPZTensor< T > &s) const
Definition: TPZTensor.h:894