NeoPZ
TPZYCCamClayPV.cpp
Go to the documentation of this file.
1 /*
2  * File: TPZYCCamClayPV.cpp
3  * Author: quinelato
4  *
5  * Created on August 14, 2017, 5:18 PM
6  */
7 
8 #include "pzlog.h"
9 #include "pzerror.h"
10 #include "TPZYCCamClayPV.h"
11 #include "TPZHWTools.h"
12 
13 
14 #ifdef LOG4CXX
15 static LoggerPtr loggerConvTest(Logger::getLogger("ConvTest"));
16 #endif
17 
18 using namespace std;
19 
20 TPZYCCamClayPV::TPZYCCamClayPV() : fGamma(0.), fM(0.), fPt(0.), fLogHardening(0.), fLogBulkModulus(0.), fA0(0.), fE0(0.) {
21 }
22 
23 TPZYCCamClayPV::TPZYCCamClayPV(const TPZYCCamClayPV& other) : fER(other.fER), fGamma(other.fGamma), fM(other.fM), fPt(other.fPt), fLogHardening(other.fLogHardening), fLogBulkModulus(other.fLogBulkModulus), fA0(other.fA0), fE0(other.fE0) {
24 }
25 
26 void TPZYCCamClayPV::SetUp(const TPZElasticResponse &ER, REAL gamma, REAL m, REAL pt, REAL logHardening, REAL logBulkModulus, REAL a0, REAL e0) {
28  fGamma = gamma;
29  fM = m;
30  fPt = pt;
31  fLogHardening = logHardening;
32  fLogBulkModulus = logBulkModulus;
33  fA0 = a0;
34  fE0 = e0;
35 }
36 
38  fER = ER;
39 }
40 
42  return Hash("TPZYCCamClayPV");
43 }
44 
45 void TPZYCCamClayPV::Read(TPZStream& buf, void* context) {
46  buf.Read(&fGamma);
47  buf.Read(&fM);
48  buf.Read(&fPt);
49  buf.Read(&fLogHardening);
50  buf.Read(&fLogBulkModulus);
51  buf.Read(&fA0);
52  buf.Read(&fE0);
53  fER.Read(buf, context);
54 }
55 
56 void TPZYCCamClayPV::Write(TPZStream& buf, int withclassid) const {
57  buf.Write(&fGamma);
58  buf.Write(&fM);
59  buf.Write(&fPt);
60  buf.Write(&fLogHardening);
61  buf.Write(&fLogBulkModulus);
62  buf.Write(&fA0);
63  buf.Write(&fE0);
64  fER.Write(buf, withclassid);
65 }
66 
67 REAL TPZYCCamClayPV::InitialDamage(const TPZVec<REAL> &stress_p) const{
68  std::cout << "Method not implemented." << std::endl;
69  DebugStop();
70  return -1.0;
71 }
72 
73 REAL TPZYCCamClayPV::bFromP(const REAL p, const REAL a) const {
74  return (p >= fPt - a) ? 1. : fGamma;
75 }
76 
77 REAL TPZYCCamClayPV::bFromTheta(REAL theta) const {
78  return (theta >= M_PI_2) ? 1. : fGamma;
79 }
80 
82  STATE log_a_a0 = log(a / fA0);
83  return log((1 + fE0 - fLogHardening * log_a_a0) / (1 + fE0 - fLogBulkModulus * log_a_a0));
84 }
85 
86 void TPZYCCamClayPV::Phi(TPZVec<REAL> sigmaPV, REAL a, TPZVec<REAL> &phi)const {
87  phi.resize(NYield);
88 
89  TPZTensor<REAL> sigma;
90  sigma.XX() = sigmaPV[0];
91  sigma.YY() = sigmaPV[1];
92  sigma.ZZ() = sigmaPV[2];
93 
94  const REAL p = sigma.I1() / 3.;
95  const REAL q = sqrt(3. * sigma.J2());
96 
97  phi[0] = 1 / (pow(bFromP(p, a), 2.)) * pow(p - fPt + a, 2.) + pow(q / fM, 2.) - pow(a, 2);
98 }
99 
100 void TPZYCCamClayPV::SurfaceInCyl(const REAL theta, const REAL beta, const REAL a, TPZVec<REAL> &returnValue) const {
101  const REAL SQRT1_3 = sqrt(1 / 3.);
102  const REAL I1 = 3. * (fPt - a * (1 + bFromTheta(theta) * cos(theta)));
103  REAL sqrtj2 = fM * SQRT1_3 * a * sin(theta);
104  REAL xi = SQRT1_3*I1;
105  REAL rho = M_SQRT2*sqrtj2;
106  returnValue[0] = xi; // hydrostatic component
107  returnValue[1] = rho; // deviatoric component
108  returnValue[2] = beta; // Lode angle
109 }
110 
111 REAL TPZYCCamClayPV::ResLFunc(const TPZVec<STATE> &sigma_trial_pv, STATE theta, STATE beta, REAL a, REAL aPrev) const {
112  const STATE ctheta = cos(theta);
113  const STATE b = bFromTheta(theta);
114  const STATE I1Trial = (sigma_trial_pv[0])+(sigma_trial_pv[1])+(sigma_trial_pv[2]);
115  const STATE I1Proj = 3. * (fPt - a * (1 + b * ctheta));
116  return (I1Trial - I1Proj) - 3 * fER.K()*(PlasticVolumetricStrain(a) - PlasticVolumetricStrain(aPrev));
117 }
118 
119 //REAL TPZYCCamClayPV::DResLFunc(const TPZVec<STATE> &sigma_trial_pv, STATE theta, STATE beta, REAL a, REAL aPrev) const {
120 // const STATE ctheta = cos(theta);
121 // const STATE b = bFromTheta(theta);
122 // const STATE I1Trial = (sigma_trial_pv[0])+(sigma_trial_pv[1])+(sigma_trial_pv[2]);
123 // const STATE I1Proj = 3. * (fPt - a * (1 + b * ctheta));
124 // return (I1Trial - I1Proj) - 3 * fER.K()*(PlasticVolumetricStrain(a) - PlasticVolumetricStrain(aPrev));
125 //}
126 
127 REAL TPZYCCamClayPV::DistanceToSurface(const TPZVec<REAL> &sigma_trial_pv, const REAL theta, const REAL beta, const REAL a) const {
128  TPZManVector<REAL, 3> projection_cyl(3);
129  SurfaceInCyl(theta, beta, a, projection_cyl);
130  TPZManVector<REAL, 3> projection_cart(3);
131  TPZHWTools::FromHWCylToHWCart(projection_cyl, projection_cart);
132  TPZManVector<REAL, 3> trial_cart(3);
133  TPZHWTools::FromPrincipalToHWCart(sigma_trial_pv, trial_cart);
134  REAL k = fER.K();
135  REAL g = fER.G();
136  return ((1. / (3. * k))*(trial_cart[0] - projection_cart[0])*(trial_cart[0] - projection_cart[0]))
137  +(1. / (2. * g))*((trial_cart[1] - projection_cart[1])*(trial_cart[1] - projection_cart[1])+(trial_cart[2] - projection_cart[2])*(trial_cart[2] - projection_cart[2]));
138 }
139 
140 void TPZYCCamClayPV::DDistanceToSurface(const TPZVec<STATE> &sigma_trial_pv, const STATE theta, const STATE beta, const REAL a, const REAL aPrev, TPZVec<STATE> &fxn) const {
141  const STATE stheta = sin(theta);
142  const STATE ctheta = cos(theta);
143  const STATE sbeta = sin(beta);
144  const STATE cbeta = cos(beta);
145  const REAL sqrt2_sqrt3 = sqrt(2. / 3.);
146  const REAL sqrt3_3 = sqrt(3.) / 3;
147  const STATE b = bFromTheta(theta);
148  TPZVec<STATE> ptcart(3);
149  TPZHWTools::FromPrincipalToHWCart(sigma_trial_pv, ptcart);
150  const STATE sig1 = ptcart[0];
151  const STATE sig2 = ptcart[1];
152  const STATE sig3 = ptcart[2];
153  fxn.Resize(3);
154  fxn[0] = 2. * a * b * stheta / fER.K()*(-sqrt3_3 * sig1 + fPt - a * (1 + b * ctheta)) + a * fM * sqrt2_sqrt3 * ctheta * (-sig2 * cbeta - sig3 * sbeta + a * fM * sqrt2_sqrt3 * stheta) / fER.G();
155  fxn[1] = a * fM * sqrt2_sqrt3 * stheta * (sbeta * sig2 - cbeta * sig3) / fER.G();
156  fxn[2] = ResLFunc(sigma_trial_pv, theta, beta, a, aPrev);
157 }
158 
159 void TPZYCCamClayPV::D2DistanceToSurface(const TPZVec<STATE> &sigma_trial_pv, const STATE theta, const STATE beta, const REAL a, TPZFNMatrix<9, STATE> &jac) const {
160  const STATE b = bFromTheta(theta);
161  const STATE a2 = pow(a, 2.);
162  const STATE b2 = pow(b, 2.);
163  const STATE M2 = pow(fM, 2.);
164  const STATE stheta = sin(theta);
165  const STATE stheta2 = pow(stheta, 2.);
166  const STATE ctheta = cos(theta);
167  const STATE ctheta2 = pow(ctheta, 2);
168  const STATE sbeta = sin(beta);
169  const STATE cbeta = cos(beta);
170  const REAL sqrt2_sqrt3 = sqrt(2. / 3.);
171  const REAL sqrt3_3 = sqrt(3.) / 3;
172  TPZVec<STATE> ptcart(3);
173  TPZHWTools::FromPrincipalToHWCart(sigma_trial_pv, ptcart);
174  const STATE sig1 = ptcart[0];
175  const STATE sig2 = ptcart[1];
176  const STATE sig3 = ptcart[2];
177  const STATE loga_a0 = log(a / fA0);
178 
179  jac.Resize(3, 3);
180  jac(0, 0) = 2. * a * b * ctheta * (-sqrt3_3 * sig1 + fPt - a * (1 + b * ctheta)) / fER.K() + 2 * a2 * b2 * stheta2 / fER.K() - a * fM * sqrt2_sqrt3 * stheta * (-sig2 * cbeta - sig3 * sbeta + a * fM * sqrt2_sqrt3 * stheta) / fER.G() + 2. * a2 * M2 * ctheta2 / (3. * fER.G());
181  jac(0, 1) = a * fM * sqrt2_sqrt3 * ctheta * (sbeta * sig2 - cbeta * sig3) / fER.G();
182  jac(0, 2) = 2. * b * stheta * (-sqrt3_3 * sig1 + fPt - 2. * a * (1. + b * ctheta)) / fER.K() + fM * sqrt2_sqrt3 * ctheta * (-sig2 * cbeta - sig3 * sbeta) / fER.G() + 4. * a * M2 * stheta * ctheta / (3. * fER.G());
183  jac(1, 0) = jac(0, 1);
184  jac(1, 1) = a * fM * sqrt2_sqrt3 * stheta * (sbeta * sig2 + cbeta * sig3) / fER.G();
185  jac(1, 2) = fM * sqrt2_sqrt3 * stheta * (sbeta * sig2 - cbeta * sig3) / fER.G();
186  jac(2, 0) = -3. * a * b*stheta;
187  jac(2, 1) = 0.;
188  jac(2, 2) = 3. * (1 + b * ctheta + fER.K() * fLogHardening / (a * (1. + fE0 - fLogHardening * loga_a0)) - fER.K() * fLogBulkModulus / (a * (1. + fE0 - fLogBulkModulus * loga_a0)));
189 }
190 
191 void TPZYCCamClayPV::ProjectToSurfaceConstantBeta(const TPZVec<REAL> &sigma_trial_pv, const REAL aPrev, TPZVec<REAL> &sigma_pv, REAL &aProj, const REAL tol) const {
192  REAL theta = 0.;
193  REAL theta_distance = std::numeric_limits<REAL>::max();
194  REAL beta = 0;
195  {
196  const REAL initial_theta_guess = 0; // initial_xi_guess = fPt*sqrt3; // multiplying by sqrt converts from p to xi coordinates
197  const REAL final_theta_guess = M_PI; // final_xi_guess (fPt - (1 + fGamma * fA)) * sqrt3;
198  const unsigned int n_steps_theta = 40;
199  const REAL theta_interval = (final_theta_guess - initial_theta_guess) / n_steps_theta;
200  for (unsigned int i = 0; i < n_steps_theta; ++i) {
201  REAL theta_guess = initial_theta_guess + i*theta_interval;
202  REAL distance = DistanceToSurface(sigma_trial_pv, theta_guess, beta, aPrev);
203  if (fabs(distance) < fabs(theta_distance)) {
204  theta = theta_guess;
205  theta_distance = distance;
206  }
207  }
208  }
209 
210  REAL residual_norm = std::numeric_limits<REAL>::max();
211  TPZFNMatrix<3, STATE> xn(3, 1, 0.), sol(3, 1, 0.);
212  TPZManVector<STATE> fxn(3);
213  xn(0, 0) = theta;
214  xn(1, 0) = beta;
215  xn(2, 0) = aPrev;
216  for (unsigned int i = 0; i < 30; ++i) {
217  TPZFNMatrix<9, STATE> jac(3, 3);
218  D2DistanceToSurface(sigma_trial_pv, xn(0), xn(1), xn(2), jac);
219  DDistanceToSurface(sigma_trial_pv, xn(0), xn(1), xn(2), aPrev, fxn);
220  for (unsigned int k = 0; k < 3; ++k) {
221  sol(k, 0) = fxn[k];
222  }
223  residual_norm = Norm(sol);
224 
225  for (unsigned int k = 0; k < 3; k++) {
226  jac(k, 1) = 0.;
227  jac(1, k) = 0.;
228  }
229  jac(1, 1) = 1.;
230 
231 #ifdef LOG4CXX
232  if (loggerConvTest->isDebugEnabled()) {
233  std::stringstream outfile; //("convergencF1.txt");
234  outfile << i << " " << log(residual_norm) << endl;
235  //jac.Print(outfile);
236  //outfile<< "\n xn " << " "<<fxnvec <<endl;
237  //outfile<< "\n res " << " "<<fxnvec <<endl;
238  LOGPZ_DEBUG(loggerConvTest, outfile.str());
239  }
240 #endif
241 
242  jac.Solve_LU(&sol);
243  xn(0) = xn(0) - sol(0);
244  xn(1) = beta;
245  xn(2) = xn(2) - sol(2);
246  if (residual_norm < tol) break;
247  }
248 
249  STATE thetasol, betasol, asol;
250 
251  thetasol = xn(0);
252  betasol = xn(1);
253  asol = xn(2);
254  aProj = asol;
255 
256  TPZManVector<STATE, 3> surfaceCyl(3);
257  SurfaceInCyl(thetasol, betasol, asol, surfaceCyl);
258  TPZHWTools::FromHWCylToPrincipal(surfaceCyl, sigma_pv);
259 }
260 
261 void TPZYCCamClayPV::ProjectToSurface(const TPZVec<REAL> &sigma_trial_pv, const REAL aPrev, TPZVec<REAL> &sigma_pv, REAL &aProj, const REAL tol) const {
262  REAL theta = 0.;
263  REAL theta_distance = std::numeric_limits<REAL>::max();
264  TPZManVector<REAL> sigma_cyl;
265  TPZHWTools::FromPrincipalToHWCyl(sigma_trial_pv, sigma_cyl);
266  REAL beta = sigma_cyl[2];
267  {
268  const REAL initial_theta_guess = 0; // initial_xi_guess = fPt*sqrt3; // multiplying by sqrt converts from p to xi coordinates
269  const REAL final_theta_guess = M_PI; // final_xi_guess (fPt - (1 + fGamma * fA)) * sqrt3;
270  const unsigned int n_steps_theta = 40;
271  const REAL theta_interval = (final_theta_guess - initial_theta_guess) / n_steps_theta;
272  for (unsigned int i = 0; i < n_steps_theta; ++i) {
273  REAL theta_guess = initial_theta_guess + i*theta_interval;
274  REAL distance = DistanceToSurface(sigma_trial_pv, theta_guess, beta, aPrev);
275  if (fabs(distance) < fabs(theta_distance)) {
276  theta = theta_guess;
277  theta_distance = distance;
278  }
279  }
280  }
281 
282  REAL residual_norm = std::numeric_limits<REAL>::max();
283  TPZFNMatrix<3, STATE> xn(3, 1, 0.), sol(3, 1, 0.);
284  TPZManVector<STATE> fxn(3);
285  xn(0, 0) = theta;
286  xn(1, 0) = beta;
287  xn(2, 0) = aPrev;
288  for (unsigned int i = 0; i < 30; ++i) {
289  TPZFNMatrix<9, STATE> jac(3, 3);
290  D2DistanceToSurface(sigma_trial_pv, xn(0), xn(1), xn(2), jac);
291  DDistanceToSurface(sigma_trial_pv, xn(0), xn(1), xn(2), aPrev, fxn);
292  for (unsigned int k = 0; k < 3; ++k) {
293  sol(k, 0) = fxn[k];
294  }
295  residual_norm = Norm(sol);
296 
297 #ifdef LOG4CXX
298  if (loggerConvTest->isDebugEnabled()) {
299  std::stringstream outfile; //("convergencF1.txt");
300  outfile << i << " " << log(residual_norm) << endl;
301  //jac.Print(outfile);
302  //outfile<< "\n xn " << " "<<fxnvec <<endl;
303  //outfile<< "\n res " << " "<<fxnvec <<endl;
304  LOGPZ_DEBUG(loggerConvTest, outfile.str());
305  }
306 #endif
307 
308  jac.Solve_LU(&sol);
309  xn = xn - sol;
310  if (residual_norm < tol) break;
311  }
312 
313  STATE thetasol, betasol, asol;
314 
315  thetasol = xn(0);
316  betasol = xn(1);
317  asol = xn(2);
318  aProj = asol;
319 
320  TPZManVector<STATE, 3> surfaceCyl(3);
321  SurfaceInCyl(thetasol, betasol, asol, surfaceCyl);
322  TPZHWTools::FromHWCylToPrincipal(surfaceCyl, sigma_pv);
323 }
324 
325 void TPZYCCamClayPV::ProjectSigma(const TPZVec<REAL> &sigma_trial_pv, const REAL aPrev, TPZVec<REAL> &sigma_pv, REAL &aProj, int &m_type, TPZFMatrix<REAL> * gradient) const {
326 
327  bool require_gradient_Q = true;
328  if (!gradient) {
329  require_gradient_Q = false;
330  }
331 
332 #ifdef PZDEBUG
333  // Check for required dimensions of tangent
334  if (!(gradient->Rows() == 3 && gradient->Cols() == 3)) {
335  std::cerr << "Unable to compute the gradient operator. Required gradient array dimensions are 3x3." << std::endl;
336  DebugStop();
337  }
338 
339  if (require_gradient_Q) {
340  DebugStop(); // implemented this functionality.
341  }
342 
343 #endif
344 
345  TPZVec<REAL> yield(NYield);
346  this->Phi(sigma_trial_pv, aPrev, yield);
347 
348  if (yield[0] <= 0.) {
349  sigma_pv = sigma_trial_pv;
350  aProj = aPrev;
351  } else {
352  ProjectToSurface(sigma_trial_pv, aPrev, sigma_pv, aProj, 1.e-5);
353  }
354 }
355 
356 void TPZYCCamClayPV::SurfaceParam(const TPZVec<STATE> &sigma_pv, const STATE a, STATE &theta, STATE &beta) const {
357  TPZManVector<STATE> sigmaHWCyl(3);
358  TPZHWTools::FromPrincipalToHWCyl(sigma_pv, sigmaHWCyl);
359  STATE I1 = sigmaHWCyl[0] * sqrt(3.);
360  const REAL p = I1 / 3.;
361  const STATE b = bFromP(p, a);
362  STATE costheta = (-I1 / 3. + fPt - a) / (a * b);
363  STATE sqrtj2 = M_SQRT1_2 * sigmaHWCyl[1];
364  STATE sintheta = sqrt(3.) * sqrtj2 / (a * fM);
365  theta = atan2(sintheta, costheta);
366  beta = sigmaHWCyl[2];
367 }
368 
369 void TPZYCCamClayPV::GradSigmaTrial(const TPZVec<REAL> &sigma_trial_pv, const REAL theta, const REAL beta, const REAL a, TPZFNMatrix<9, STATE> &ddist_dsigmatrial) const {
370  const STATE stheta = sin(theta);
371  const STATE ctheta = cos(theta);
372  const STATE sbeta = sin(beta);
373  const STATE cbeta = cos(beta);
374  const REAL b = bFromTheta(theta);
375  const REAL sqrt3 = sqrt(3.);
376  const REAL sqrt27 = pow(3, 1.5);
377 
378  ddist_dsigmatrial(0, 0) = -(2 * a * b * stheta * fER.G() + 2 * a * cbeta * ctheta * fER.K() * fM) / (3 * fER.G() * fER.K());
379  ddist_dsigmatrial(0, 1) = -(2 * sqrt3 * a * b * stheta * fER.G()+(3 * a * sbeta - sqrt3 * a * cbeta) * ctheta * fER.K() * fM) / (sqrt27 * fER.G() * fER.K());
380  ddist_dsigmatrial(0, 2) = ((3 * a * sbeta + sqrt3 * a * cbeta) * ctheta * fER.K() * fM - 2 * sqrt3 * a * b * stheta * fER.G()) / (sqrt27 * fER.G() * fER.K());
381 
382  ddist_dsigmatrial(1, 0) = (2 * a * sbeta * stheta * fM) / (3 * fER.G());
383  ddist_dsigmatrial(1, 1) = -((3 * a * cbeta + sqrt3 * a * sbeta) * stheta * fM) / (sqrt27 * fER.G());
384  ddist_dsigmatrial(1, 2) = -((sqrt3 * a * sbeta - 3 * a * cbeta) * stheta * fM) / (sqrt27 * fER.G());
385 
386  ddist_dsigmatrial(2, 0) = 1.;
387  ddist_dsigmatrial(2, 1) = 1.;
388  ddist_dsigmatrial(2, 2) = 1.;
389 }
390 
391 void TPZYCCamClayPV::DFuncCart(STATE theta, STATE beta, STATE a, TPZFNMatrix<9, STATE> &DFunccart) const {
392  const STATE stheta = sin(theta);
393  const STATE ctheta = cos(theta);
394  const STATE sbeta = sin(beta);
395  const STATE cbeta = cos(beta);
396  const REAL b = bFromTheta(theta);
397  const REAL sqrt3 = sqrt(3.);
398 
399  DFunccart(0, 0) = a * b * stheta + 2. * a * cbeta * ctheta * fM / 3.;
400  DFunccart(0, 1) = -2 * a * sbeta * stheta * fM / 3.;
401  DFunccart(0, 2) = -1 - b * ctheta + 2. * cbeta * stheta * fM / 3.;
402 
403  DFunccart(1, 0) = a * b * stheta + (sqrt3 * a * sbeta - a * cbeta) * ctheta * fM / 3.;
404  DFunccart(1, 1) = ((sqrt3 * a * cbeta + a * sbeta) * stheta * fM) / 3.;
405  DFunccart(1, 2) = -1 - b * ctheta + (sqrt3 * sbeta - cbeta) * stheta * fM / 3.;
406 
407  DFunccart(2, 0) = -(sqrt3 * a * sbeta + a * cbeta) * ctheta * fM / 3. - a * b*stheta;
408  DFunccart(2, 1) = ((a * sbeta - sqrt3 * a * cbeta) * stheta * fM) / 3.;
409  DFunccart(2, 2) = -1 + b * ctheta + (sqrt3 * sbeta + cbeta) * stheta * fM / 3.;
410 }
411 
412 void TPZYCCamClayPV::ProjectSigmaDep(const TPZVec<REAL> &sigma_trial_pv, const REAL aPrev, TPZVec<REAL> &sigma, REAL &aProj, TPZFMatrix<REAL> &GradSigma) const {
413  TPZVec<REAL> yield(NYield);
414  this->Phi(sigma_trial_pv, aPrev, yield);
415 
416  if (yield[0] <= 0.) {
417  sigma = sigma_trial_pv;
418  aProj = aPrev;
419  GradSigma.Identity();
420  } else {
421  const REAL tol=1.e-5;
422  bool threeEigEqual = (fabs(sigma_trial_pv[0] - sigma_trial_pv[1]) < tol && fabs(sigma_trial_pv[1] - sigma_trial_pv[2]) < tol);
423 // if (threeEigEqual){
424 // ProjectToSurfaceConstantBeta(sigma_trial_pv, aPrev, sigma, aProj, 1.e-5);
425 // // we can compute the tangent matrix
426 // STATE theta, beta;
427 // SurfaceParam(sigma, aProj, theta, beta);
428 // TPZFNMatrix<9, STATE> ddist_dsigmatrial(3, 3), jac(3, 3), DFunccart(3, 3);
429 // GradSigmaTrial(sigma_trial_pv, theta, beta, aProj, ddist_dsigmatrial);
430 // D2DistanceToSurface(sigma_trial_pv, theta, beta, aProj, jac);
431 // jac.Solve_LU(&ddist_dsigmatrial);
432 // DFuncCart(theta, beta, aProj, DFunccart);
433 // DFunccart.Multiply(ddist_dsigmatrial, GradSigma);
434 // GradSigma *= -1.;
435 // } else {
436  ProjectToSurface(sigma_trial_pv, aPrev, sigma, aProj, 1.e-5);
437  // we can compute the tangent matrix
438  STATE theta, beta;
439  SurfaceParam(sigma, aProj, theta, beta);
440  TPZFNMatrix<9, STATE> ddist_dsigmatrial(3, 3), jac(3, 3), DFunccart(3, 3);
441  GradSigmaTrial(sigma_trial_pv, theta, beta, aProj, ddist_dsigmatrial);
442  D2DistanceToSurface(sigma_trial_pv, theta, beta, aProj, jac);
443  jac.Solve_LU(&ddist_dsigmatrial);
444  DFuncCart(theta, beta, aProj, DFunccart);
445  DFunccart.Multiply(ddist_dsigmatrial, GradSigma);
446  GradSigma *= -1.;
447 // }
448  }
449 }
450 
452 }
453 
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
void ProjectSigma(const TPZVec< REAL > &sigma_trial, const REAL aPrev, TPZVec< REAL > &sigma, REAL &aProj, int &m_type, TPZFMatrix< REAL > *gradient=NULL) const
REAL DistanceToSurface(const TPZVec< REAL > &sigma_trial_pv, const REAL theta, const REAL beta, const REAL a) const
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
STATE PlasticVolumetricStrain(STATE a) const
int Solve_LU(TPZFMatrix< TVar > *B, std::list< int64_t > &singular)
Solves the linear system using LU method .
Definition: pzmatrix.h:900
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.
static void FromPrincipalToHWCyl(const TPZVec< REAL > &PrincipalCoords, TPZVec< REAL > &HWCyl)
Definition: TPZHWTools.h:39
void SurfaceInCyl(const REAL theta, const REAL beta, const REAL a, TPZVec< REAL > &returnValue) const
REAL bFromTheta(REAL theta) const
T I1() const
Definition: TPZTensor.h:903
virtual void resize(const int64_t newsize)
Definition: pzvec.h:213
void SetElasticResponse(const TPZElasticResponse &ER)
void Read(TPZStream &buf, void *context) override
virtual int ClassId() const override
Define the class id associated with the class.
virtual void Identity()
Converts the matrix in an identity matrix.
Definition: pzmatrix.cpp:199
Defines PZError.
T & YY() const
Definition: TPZTensor.h:578
void SurfaceParam(const TPZVec< STATE > &sigma_pv, const STATE a, STATE &theta, STATE &beta) const
void DDistanceToSurface(const TPZVec< STATE > &sigma_trial_pv, const STATE theta, const STATE beta, const REAL a, const REAL aPrev, TPZVec< STATE > &fxn) const
virtual ~TPZYCCamClayPV()
REAL bFromP(const REAL p, const REAL a) const
void Phi(TPZVec< REAL > sigmaPV, REAL a, TPZVec< REAL > &phi) const
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
static void FromHWCylToHWCart(const TPZVec< REAL > &HWCylCoords, TPZVec< REAL > &HWCart)
Definition: TPZHWTools.h:28
sin
Definition: fadfunc.h:63
static const double tol
Definition: pzgeoprism.cpp:23
REAL InitialDamage(const TPZVec< REAL > &stress_p) const
virtual void Write(const bool val)
Definition: TPZStream.cpp:8
REAL ResLFunc(const TPZVec< STATE > &sigma_trial_pv, STATE theta, STATE beta, REAL a, REAL aPrev) const
void Write(TPZStream &buf, int withclassid) const override
Writes this object to the TPZStream buffer. Include the classid if withclassid = true.
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
#define LOGPZ_DEBUG(A, B)
Define log for debug info.
Definition: pzlog.h:87
int64_t Rows() const
Returns number of rows.
Definition: pzmatrix.h:803
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
void SetUp(const TPZElasticResponse &ER, REAL gamma, REAL m, REAL pt, REAL logHardening, REAL logBulkModulus, REAL a0, REAL e0)
T J2() const
Definition: TPZTensor.h:927
void ProjectSigmaDep(const TPZVec< REAL > &sigma_trial, const REAL aPrev, TPZVec< REAL > &sigma, REAL &aProj, TPZFMatrix< REAL > &GradSigma) const
static void FromHWCylToPrincipal(const TPZVec< REAL > &HWCylCoords, TPZVec< REAL > &PrincipalCoords)
Definition: TPZHWTools.h:67
int32_t Hash(std::string str)
Definition: TPZHash.cpp:10
long double gamma(unsigned int n)
Evaluate the factorial of a integer.
void ProjectToSurface(const TPZVec< REAL > &sigma_trial, const REAL aPrev, TPZVec< REAL > &sigma, REAL &aProj, const REAL tol) const
TPZFlopCounter pow(const TPZFlopCounter &orig, const TPZFlopCounter &xp)
Returns the power and increments the counter of the power.
Definition: pzreal.h:487
static void FromPrincipalToHWCart(const TPZVec< REAL > &PrincipalCoords, TPZVec< REAL > &HWCart)
Definition: TPZHWTools.h:52
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_ log
Definition: tfadfunc.h:130
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
void DFuncCart(STATE theta, STATE beta, STATE a, TPZFNMatrix< 9, STATE > &DFunccart) const
int64_t Cols() const
Returns number of cols.
Definition: pzmatrix.h:809
T & ZZ() const
Definition: TPZTensor.h:586
void ProjectToSurfaceConstantBeta(const TPZVec< REAL > &sigma_trial_pv, const REAL aPrev, TPZVec< REAL > &sigma_pv, REAL &aProj, const REAL tol) const
int Resize(const int64_t newRows, const int64_t wCols) override
Redimension a matrix, but maintain your elements.
Definition: pzfmatrix.cpp:1016
void GradSigmaTrial(const TPZVec< REAL > &sigma_trial_pv, const REAL theta, const REAL beta, const REAL aProj, TPZFNMatrix< 9, STATE > &ddist_dsigmatrial) const
Defines the interface for saving and reading data. Persistency.
Definition: TPZStream.h:50
clarg::argString m("-m", "input matrix file name (text format)", "matrix.txt")
void D2DistanceToSurface(const TPZVec< STATE > &sigma_trial_pv, const STATE theta, const STATE beta, const REAL a, TPZFNMatrix< 9, STATE > &jac) const
TPZFlopCounter cos(const TPZFlopCounter &orig)
Returns the cosine in radians and increments the counter of the Cosine.
Definition: pzreal.h:514
void Read(TPZStream &buf, void *context) override
read objects from the stream
void Write(TPZStream &buf, int withclassid) const override
TPZElasticResponse fER
virtual void Read(bool &val)
Definition: TPZStream.cpp:91