NeoPZ
TPZMixedElasticityMaterial.cpp
Go to the documentation of this file.
1 
7 #include "pzelmat.h"
8 #include "pzbndcond.h"
9 #include "pzaxestools.h"
10 #include "TPZMatWithMem.h"
11 #include "pzmatrix.h"
12 #include "pzfmatrix.h"
13 #include "pzerror.h"
14 #include <math.h>
15 
16 #include "pzlog.h"
17 //#include "meshgen.h"
18 #include "TPZAnalyticSolution.h"
19 #ifdef LOG4CXX
20 static LoggerPtr logdata(Logger::getLogger("pz.mixedelasticity"));
21 #endif
22 
23 #include <fstream>
24 using namespace std;
25 
27  fE_const = -1.; // Young modulus
28  fnu_const = -1.; // Poisson coefficient
29  fForce[0] = 0.; // X component of the body force
30  fForce[1] = 0.; // Y component of the body force
31  fForce[2] = 0.; // Z component of the body force - not used for this class
32  flambda_const = 0.;
33  fmu_const = 0.;
34 
35  fPlaneStress = 0;
36  fPostProcIndex = 0;
37  fMatrixA = 0.;
38 }
39 
41  fE_const = -1.; // Young modulus
42  fnu_const = -1.; // Poisson coefficient
43  fForce[0] = 0.; // X component of the body force
44  fForce[1] = 0.; // Y component of the body force
45  fForce[2] = 0.; // Z component of the body force - not used for this class
46  flambda_const = 0.;
47  fmu_const = 0.;
48 
49  fPlaneStress = 0;
50  fPostProcIndex = 0;
51  fMatrixA = 0.;
52 }
53 
54 TPZMixedElasticityMaterial::TPZMixedElasticityMaterial(int num, REAL E, REAL nu, REAL fx, REAL fy, int planestress, int fdimension) : TPZDiscontinuousGalerkin(num), fDimension(fdimension) {
55  this->SetElasticity(E, nu);
56  fForce[0] = fx; // X component of the body force
57  fForce[1] = fy; // Y component of the body force
58  fPlaneStress = planestress;
59  fPostProcIndex = 0;
60 }
61 
63 }
64 
66  int nref = datavec.size();
67  for (int i = 0; i < nref; i++) {
68  datavec[i].SetAllRequirements(false);
69  datavec[i].fNeedsNeighborSol = false;
70  datavec[i].fNeedsNeighborCenter = false;
71  datavec[i].fNeedsNormal = false;
72  }
73 }
74 
76  return 2;
77 }
78 
80 
81 // Divergence on deformed element
82 
84  //itapopo conferir esse método. Foi copiado do TPZDarcyFlow3D
85  int sigmaBlock = 0;
86 
87  // Getting test and basis functions
88  //TPZFMatrix<REAL> phiSigmaH1 = datavec[sigmaBlock].phi; // For H1 test functions Q
89  //TPZFMatrix<REAL> dphiSigmaH1 = datavec[sigmaBlock].dphi; // Derivative For H1 test functions
90  TPZFMatrix<REAL> dphiSigmaH1axes = datavec[sigmaBlock].dphix; // Derivative For H1 test functions
91 
92  TPZFNMatrix<660> GradphiuH1;
93  TPZAxesTools<REAL>::Axes2XYZ(dphiSigmaH1axes, GradphiuH1, datavec[sigmaBlock].axes);
94 
95  int nphiuHdiv = datavec[sigmaBlock].fVecShapeIndex.NElements();
96 
97  DivergenceofPhi.Resize(nphiuHdiv, 1);
98 
99  REAL JacobianDet = datavec[sigmaBlock].detjac;
100 
101  TPZFMatrix<REAL> Qaxes = datavec[sigmaBlock].axes;
102  TPZFMatrix<REAL> QaxesT;
103  TPZFMatrix<REAL> Jacobian = datavec[sigmaBlock].jacobian;
104  TPZFMatrix<REAL> JacobianInverse = datavec[sigmaBlock].jacinv;
105 
106  TPZFMatrix<REAL> GradOfX;
107  TPZFMatrix<REAL> GradOfXInverse;
108  TPZFMatrix<REAL> VectorOnMaster;
109  TPZFMatrix<REAL> VectorOnXYZ(3, 1, 0.0);
110  Qaxes.Transpose(&QaxesT);
111  QaxesT.Multiply(Jacobian, GradOfX);
112  JacobianInverse.Multiply(Qaxes, GradOfXInverse);
113 
114  int ivectorindex = 0;
115  int ishapeindex = 0;
116 
117  {
118  for (int iq = 0; iq < nphiuHdiv; iq++) {
119  ivectorindex = datavec[sigmaBlock].fVecShapeIndex[iq].first;
120  ishapeindex = datavec[sigmaBlock].fVecShapeIndex[iq].second;
121 
122  VectorOnXYZ(0, 0) = datavec[sigmaBlock].fNormalVec(0, ivectorindex);
123  VectorOnXYZ(1, 0) = datavec[sigmaBlock].fNormalVec(1, ivectorindex);
124  VectorOnXYZ(2, 0) = datavec[sigmaBlock].fNormalVec(2, ivectorindex);
125 
126  GradOfXInverse.Multiply(VectorOnXYZ, VectorOnMaster);
127  VectorOnMaster *= JacobianDet;
128 
129  /* Contravariant Piola mapping preserves the divergence */
130 // DivergenceofPhi(iq, 0) = (1.0 / JacobianDet) * (dphiuH1(0, ishapeindex) * VectorOnMaster(0, 0) +
131 // dphiuH1(1, ishapeindex) * VectorOnMaster(1, 0) +
132 // dphiuH1(2, ishapeindex) * VectorOnMaster(2, 0));
133  }
134  }
135  return;
136 
137 }
138 
140  //Matrix modulus Voigt notation:
141  MatrixElast.Redim(4, 4);
142  REAL mu = elast.fmu;
143  REAL lambda = elast.flambda;
144  if (!fPlaneStress) {
145  // plane strain
146  MatrixElast(Exx, Exx) = 1. / (2. * mu) - lambda / (2. * mu * (2. * lambda + 2. * mu));
147  MatrixElast(Exx, Eyy) = -lambda / (2. * mu * (2. * lambda + 2. * mu));
148  MatrixElast(Eyy, Exx) = MatrixElast(Exx, Eyy);
149  MatrixElast(Eyy, Eyy) = MatrixElast(Exx, Exx);
150  MatrixElast(Exy, Exy) = 1. / (2. * mu);
151  MatrixElast(Eyx, Eyx) = MatrixElast(Exy, Exy);
152  } else {
153  // plane stress
154  MatrixElast(Exx, Exx) = (1 - elast.fnu*elast.fnu) / elast.fE;
155  MatrixElast(Exx, Eyy) = -elast.fnu * (1 + elast.fnu) / elast.fE;
156  MatrixElast(Eyy, Exx) = MatrixElast(Exx, Eyy);
157  MatrixElast(Eyy, Eyy) = MatrixElast(Exx, Exx);
158  MatrixElast(Exy, Exy) = 1. / (2. * mu);
159  MatrixElast(Eyx, Eyx) = MatrixElast(Exy, Exy);
160  }
161 }
162 
164  TPZFNMatrix<16, STATE> MatrixElast(4, 4, 0.);
165  ElasticityModulusTensor(MatrixElast, elast);
166 
167  for (int iq = 0; iq < 4; iq++) {
168  APhiStress[iq] = 0.;
169  for (int jq = 0; jq < 4; jq++) {
170  APhiStress[iq] += MatrixElast(iq, jq) * PhiStress[jq];
171  }
172  }
173 }
174 
176  if (fPlaneStress) {
177  Stress[Exx] = elast.fE / (1 - elast.fnu * elast.fnu)*(Deformation[Exx] + elast.fnu * Deformation[Eyy]);
178  Stress[Eyy] = elast.fE / (1. - elast.fnu * elast.fnu)*(elast.fnu * Deformation[Exx] + Deformation[Eyy]);
179  Stress[Exy] = elast.fE / (1. + elast.fnu) * Deformation[Exy];
180  Stress[Eyx] = elast.fE / (1. + elast.fnu) * Deformation[Eyx];
181  } else {
182  Stress[Exx] = elast.fE / ((1 + elast.fnu)*(1 - 2. * elast.fnu))*((1 - elast.fnu) * Deformation[Exx] + elast.fnu * Deformation[Eyy]);
183  Stress[Eyy] = elast.fE / ((1 + elast.fnu)*(1 - 2. * elast.fnu))*((1 - elast.fnu) * Deformation[Eyy] + elast.fnu * Deformation[Exx]);
184  Stress[Exy] = elast.fE / (1. + elast.fnu) * Deformation[Exy];
185  Stress[Eyx] = elast.fE / (1. + elast.fnu) * Deformation[Eyx];
186  }
187 }
188 
189 void TPZMixedElasticityMaterial::Print(std::ostream &out) {
190  out << "name of material : " << Name() << "\n";
191  out << "properties : \n";
192  out << "\tE_const = " << fE_const << endl;
193  out << "\tnu_const = " << fnu_const << endl;
194  out << "\tF = " << fForce[0] << ' ' << fForce[1] << endl;
195 }
196 
199  Svoigt[Exx] = S(0, 0);
200  Svoigt[Exy] = S(0, 1);
201  Svoigt[Eyx] = S(1, 0);
202  Svoigt[Eyy] = S(1, 1);
203 }
204 
207  S(0, 0) = Svoigt[Exx];
208  S(0, 1) = Svoigt[Exy];
209  S(1, 0) = Svoigt[Eyx];
210  S(1, 1) = Svoigt[Eyy];
211 }
212 
214  if (datavec[0].fVecShapeIndex.size() == 0) {
215  FillVecShapeIndex(datavec[0]);
216  }
217 
218  REAL R = datavec[0].x[0];
219  // Setting the phi's
220  // E
221  TPZFMatrix<REAL> &phiS = datavec[0].phi;
222  TPZFMatrix<REAL> &dphiS = datavec[0].dphix;
223  // U
224  TPZFMatrix<REAL> &phiU = datavec[1].phi;
225  TPZFMatrix<REAL> &dphiU = datavec[1].dphix;
226  // P
227  TPZFMatrix<REAL> &phiP = datavec[2].phi;
228 
229 
231  if(fElasticity)
232  {
233  //TPZManVector<REAL,3> result(2);
234  TPZManVector<STATE, 3> result(2);
235  TPZFNMatrix<4,STATE> Dres(0,0);
236  fElasticity->Execute(datavec[0].x, result, Dres);
237  REAL E = result[0];
238  REAL nu = result[1];
239  TElasticityAtPoint modify(E,nu);
240  elast = modify;
241  }
242  //
243 // TPZFNMatrix<220, REAL> dphiSx(fDimension, dphiS.Cols());
244 // TPZAxesTools<REAL>::Axes2XYZ(dphiS, dphiSx, datavec[0].axes);
245 
246 // TPZFNMatrix<220, REAL> dphiUx(fDimension, phiU.Cols());
247 // TPZAxesTools<REAL>::Axes2XYZ(dphiU, dphiUx, datavec[1].axes);
248 
249 // TPZFNMatrix<220, REAL> dphiPx(fDimension, phiP.Cols());
250 // TPZAxesTools<REAL>::Axes2XYZ(dphiU, dphiPx, datavec[2].axes);
251 
252  int nshapeS, nshapeU, nshapeP;
253  nshapeS = datavec[0].fVecShapeIndex.NElements();
254  nshapeU = datavec[1].phi.Rows();
255  nshapeP = datavec[2].phi.Rows();
256 
257  TPZManVector<STATE, 2> force(2, 0.);
258  TPZFMatrix<STATE> phiSi(3, 1, 0.), phiSj(fDimension, 1, 0.);
259  TPZManVector<STATE, 2> divSi1x(2, 0.), divSi1y(2, 0.);
260  TPZManVector<STATE, 4> phiSi1x(4, 0.0), phiSj1x(4, 0.0), phiSi1y(4, 0.0), phiSj1y(4, 0.0), phiPj1x(4, 0.0), phiPj1y(4, 0.0);
261  TPZManVector<STATE, 2> phiUi(fDimension, 0.0), phiUj(fDimension, 0.0), phiUj1x(2, 0.0), phiUj1y(2, 0.0);
262  TPZFMatrix<STATE> phiPi(fDimension, 1, 0.0), phiPj(fDimension, 1, 0.0);
263  TPZFNMatrix<3, REAL> ivecS(3, 1, 0.);
264 
265  force[0] = this->fForce[0];
266  force[1] = this->fForce[1];
267  if (this->HasForcingFunction()) {
268  this->ForcingFunction()->Execute(datavec[0].x, force);
269 #ifdef LOG4CXX
270  if (logdata->isDebugEnabled()) {
271  std::stringstream sout;
272  sout << " x = " << datavec[0].x << " force = " << force << std::endl;
273  LOGPZ_DEBUG(logdata, sout.str())
274  }
275 #endif
276  }
277  for (int i = 0; i < nshapeS; i++) {
278  int iphi = datavec[0].fVecShapeIndex[i].second;
279  int ivec = datavec[0].fVecShapeIndex[i].first;
281 
282  REAL divSi = 0.;
283 
284  for (int e = 0; e < 3; e++) {
285 
286  ivecS(e, 0) = datavec[0].fNormalVec(e, ivec);
287  phiSi(e, 0) = phiS(iphi, 0) * ivecS(e, 0);
288 
289  }
290  TPZFNMatrix<3, REAL> axesvec(fDimension, 1, 0.);
291  datavec[0].axes.Multiply(ivecS, axesvec);
292 
293  //calculando div(Si)
294  for (int f = 0; f < fDimension; f++) {
295  divSi += axesvec(f, 0) * dphiS(f, iphi);
296  }
297 
298  TPZFNMatrix<4, STATE> phiTensx(2, 2, 0.), phiTensy(2, 2, 0.);
299 
300  phiTensx(0, 0) = phiSi(0, 0);
301  phiTensx(0, 1) = phiSi(1, 0);
302 
303  phiTensy(1, 0) = phiSi(0, 0);
304  phiTensy(1, 1) = phiSi(1, 0);
305  ToVoigt(phiTensx, phiSi1x);
306  ToVoigt(phiTensy, phiSi1y);
307 
308  divSi1x[0] = divSi;
309  divSi1y[1] = divSi;
310 
311  // matrix K11 - (Matrix A * stress tensor) x test-function stress tensor
312  for (int j = 0; j < nshapeS; j++) {
313  int jphi = datavec[0].fVecShapeIndex[j].second;
314  int jvec = datavec[0].fVecShapeIndex[j].first;
315 
316  for (int e = 0; e < fDimension; e++) {
317  phiSj(e, 0) = phiS(jphi, 0) * datavec[0].fNormalVec(e, jvec);
318  }
319 
320  TPZFNMatrix<4, STATE> phjTensx(2, 2, 0.), phjTensy(2, 2, 0.);
321 
322  phjTensx(0, 0) = phiSj(0, 0);
323  phjTensx(0, 1) = phiSj(1, 0);
324 
325  phjTensy(1, 0) = phiSj(0, 0);
326  phjTensy(1, 1) = phiSj(1, 0);
327  ToVoigt(phjTensx, phiSj1x);
328  ToVoigt(phjTensy, phiSj1y);
329 
330  //Multiply by Lamé parameters
331  TPZManVector<STATE, 4> AphiSi1x(4, 0.0), AphiSi1y(4, 0.0);
332 
333  ComputeDeformationVector(phiSi1x, AphiSi1x,elast);
334  ComputeDeformationVector(phiSi1y, AphiSi1y,elast);
335 
336  STATE valxx = InnerVec(AphiSi1x, phiSj1x);
337  STATE valxy = InnerVec(AphiSi1x, phiSj1y);
338  STATE valyx = InnerVec(AphiSi1y, phiSj1x);
339  STATE valyy = InnerVec(AphiSi1y, phiSj1y);
340 
341  //Matrix K11
342  if (fAxisSymmetric) {
343  valxx /= R;
344  valxy /= R;
345  valyx /= R;
346  valyy /= R;
347  }
348  ek(2 * i, 2 * j) += weight * valxx;
349  ek(2 * i, 2 * j + 1) += weight * valxy;
350  ek(2 * i + 1, 2 * j) += weight * valyx;
351  ek(2 * i + 1, 2 * j + 1) += weight * valyy;
352  }
353 
354  // matrix K21 and K12 - divergent of test-function stress tensor * displacement vector
355  for (int j = 0; j < nshapeU; j++) {
356  phiUj1x[0] = phiU(j, 0);
357  phiUj1y[1] = phiU(j, 0);
358 
359  STATE valx = weight * InnerVec(divSi1x, phiUj1x);
360  STATE valy = weight * InnerVec(divSi1y, phiUj1y);
361 
362  //position K21
363  ek(2 * j + nshapeS * 2, 2 * i) += valx;
364  ek(2 * j + 1 + nshapeS * 2, 2 * i + 1) += valy;
365 
366  //position K12
367  ek(2 * i, 2 * j + nshapeS * 2) += valx;
368  ek(2 * i + 1, 2 * j + 1 + nshapeS * 2) += valy;
369  }
370 
371  // matrix K31 and K13 - test-function stress tensor x rotation tensor p
372  for (int j = 0; j < nshapeP; j++) {
373  TPZFNMatrix<4, STATE> phiPTensor(2, 2, 0.);
374  phiPTensor(0, 1) = phiP(j, 0);
375  phiPTensor(1, 0) = -phiP(j, 0);
376  ToVoigt(phiPTensor, phiPj1x);
377 
378  STATE valxx = InnerVec(phiSi1x, phiPj1x);
379  STATE valxy = InnerVec(phiSi1y, phiPj1x);
380  //Matrix K31
381  ek(j + nshapeS * 2 + nshapeU * 2, 2 * i) += weight * valxx;
382  ek(j + nshapeS * 2 + nshapeU * 2, 2 * i + 1) += weight * valxy;
383 
384  //Matrix K13
385  ek(2 * i, j + nshapeS * 2 + nshapeU * 2) += weight * valxx;
386  ek(2 * i + 1, j + nshapeS * 2 + nshapeU * 2) += weight * valxy;
387  }
388  }
389 
390  for (int i = 0; i < nshapeU; i++) {
391  phiUj1x[0] = phiU(i, 0);
392  phiUj1y[1] = phiU(i, 0);
393 
394  // Load vector f:
395  STATE factfx = -weight * phiUj1x[0] * force[0];
396  STATE factfy = -weight * phiUj1y[1] * force[1];
397  if (fAxisSymmetric) {
398  factfx *= R;
399  factfy *= R;
400  }
401  //if(factfx != 0) DebugStop();
402  ef(nshapeS * 2 + 2 * i, 0) += factfx;
403  ef(nshapeS * 2 + 2 * i + 1, 0) += factfy;
404 
405  //if(ef(nshapeS*2+2*j) != 0.) DebugStop();
406  if (fAxisSymmetric)
407  {
408  for (int j = 0; j < nshapeU; j++) {
409  ek(nshapeS * 2 + 2 * i, nshapeS * 2 + 2 * j) -= weight * phiU(i, 0) * phiU(j, 0) / (elast.fE * R);
410  }
411  }
412  }
414  // ek.Print("K1 = ",filestiff,EMathematicaInput);
415 }
416 
419  if (shapetype == data.EVecShape) {
420  DebugStop();
421  return;
422  }
423 
424  TPZFMatrix<REAL> &dphiU = data.dphix;
425  TPZFMatrix<REAL> &phi = data.phi;
426  TPZFMatrix<REAL> &axes = data.axes;
427 
428  int phc, phrU, dphc, dphr, efr, efc, ekr, ekc;
429  phc = phi.Cols();
430  phrU = phi.Rows();
431  int FirstU = 0;
432 
433  dphc = dphiU.Cols();
434  dphr = dphiU.Rows();
435  efr = ef.Rows();
436  efc = ef.Cols();
437  ekr = ek.Rows();
438  ekc = ek.Cols();
439  if (phc != 1 || dphr != 2 || phrU != dphc) {
440  PZError << "\nTPZMixedElasticityMaterial.contr, inconsistent input data : \n" <<
441  "phi.Cols() = " << phi.Cols() << " dphi.Cols() = " << dphiU.Cols() <<
442  " phi.Rows = " << phi.Rows() << " dphi.Rows = " <<
443  dphiU.Rows() << "\nek.Rows() = " << ek.Rows() << " ek.Cols() = "
444  << ek.Cols() <<
445  "\nef.Rows() = " << ef.Rows() << " ef.Cols() = "
446  << ef.Cols() << "\n";
447  return;
448  // PZError.show();
449  }
450  //TPZManVector<REAL, 2> force(2, 0.);
451  TPZManVector<STATE, 2> force(2, 0.);
452  force[0] = fForce[0];
453  force[1] = fForce[1];
454  if (fForcingFunction) { // phi(in, 0) : node in associated forcing function
456  fForcingFunction->Execute(data.x, force);
457  }
458 
460  if(fElasticity)
461  {
462  //TPZManVector<REAL,3> result(2);
463  TPZManVector<STATE, 3> result(2);
464  TPZFNMatrix<4,STATE> Dres(0,0);
465  fElasticity->Execute(data.x, result, Dres);
466  REAL E = result[0];
467  REAL nu = result[1];
468  TElasticityAtPoint modify(E,nu);
469  elast = modify;
470  }
471 
472  REAL MuL = elast.fmu;
473  REAL LambdaL = elast.flambda;
474  // ////////////////////////// Jacobian Matrix ///////////////////////////////////
475  // Contribution of domain integrals for Jacobian matrix
476  // Elasticity Block (Equation for elasticity )
477  // Elastic equation
478  // Linear strain operator
479  // Ke Matrix
480  for (int iu = 0; iu < phrU; iu++) {
481  for (int col = 0; col < efc; col++) {
482  ef(2 * iu, col) += weight * (force[0] * phi(iu, 0)); // direcao x
483  ef(2 * iu + 1, col) += weight * (force[1] * phi(iu, 0)); // direcao y <<<----
484  }
485 
486  TPZManVector<REAL, 2> dv(2);
487  // Derivative for Vx
488  dv[0] = dphiU(0, iu) * axes(0, 0) + dphiU(1, iu) * axes(1, 0);
489  // Derivative for Vy
490  dv[1] = dphiU(0, iu) * axes(0, 1) + dphiU(1, iu) * axes(1, 1);
491 
492  for (int ju = 0; ju < phrU; ju++) {
493  TPZManVector<REAL, 2> du(2);
494  // Derivative for Ux
495  du[0] = dphiU(0, ju) * axes(0, 0) + dphiU(1, ju) * axes(1, 0);
496  // Derivative for Uy
497  du[1] = dphiU(0, ju) * axes(0, 1) + dphiU(1, ju) * axes(1, 1);
498 
499  if (this->fPlaneStress == 1) {
500  /* Plain stress state */
501  ek(2 * iu + FirstU, 2 * ju + FirstU) += weight * ((4 * (MuL)*(LambdaL + MuL) / (LambdaL + 2 * MuL)) * dv[0] * du[0] + (MuL) * dv[1] * du[1]);
502  ek(2 * iu + FirstU, 2 * ju + 1 + FirstU) += weight * ((2 * (MuL)*(LambdaL) / (LambdaL + 2 * MuL)) * dv[0] * du[1] + (MuL) * dv[1] * du[0]);
503  ek(2 * iu + 1 + FirstU, 2 * ju + FirstU) += weight * ((2 * (MuL)*(LambdaL) / (LambdaL + 2 * MuL)) * dv[1] * du[0] + (MuL) * dv[0] * du[1]);
504  ek(2 * iu + 1 + FirstU, 2 * ju + 1 + FirstU) += weight * ((4 * (MuL)*(LambdaL + MuL) / (LambdaL + 2 * MuL)) * dv[1] * du[1] + (MuL) * dv[0] * du[0]);
505  } else {
506  /* Plain Strain State */
507  ek(2 * iu + FirstU, 2 * ju + FirstU) += weight * ((LambdaL + 2 * MuL) * dv[0] * du[0] + (MuL) * dv[1] * du[1]);
508  ek(2 * iu + FirstU, 2 * ju + 1 + FirstU) += weight * (LambdaL * dv[0] * du[1] + (MuL) * dv[1] * du[0]);
509  ek(2 * iu + 1 + FirstU, 2 * ju + FirstU) += weight * (LambdaL * dv[1] * du[0] + (MuL) * dv[0] * du[1]);
510  ek(2 * iu + 1 + FirstU, 2 * ju + 1 + FirstU) += weight * ((LambdaL + 2 * MuL) * dv[1] * du[1] + (MuL) * dv[0] * du[0]);
511  }
512  }
513  }
514 }
515 
517  data.fNeedsSol = true;
518  data.fNeedsNormal = false;
519 }
520 
522  data.fNeedsSol = false;
523  data.fNeedsNormal = false;
524  if (type == 4 || type == 5 || type == 6) {
525  data.fNeedsNormal = true;
526  }
527 }
528 
530  if (datavec[0].phi.Rows() != 0 && datavec[0].fShapeType != TPZMaterialData::EScalarShape) {
531  DebugStop();
532  }
533  int ndisp = datavec[1].phi.Rows();
534 
535  TPZFNMatrix<2, STATE> v_2 = bc.Val2();
536  TPZFNMatrix<4, STATE> v_1 = bc.Val1();
537 
538  // Setting forcing function
539  if (bc.HasForcingFunction()) {
541  TPZFNMatrix<4, STATE> tens(2, 2);
542  bc.ForcingFunction()->Execute(datavec[0].x, res, tens);
543  v_2(0, 0) = res[0];
544  v_2(1, 0) = res[1];
545  }
546 
547  // Setting the phis
548  // E
549  TPZFMatrix<REAL> &phiS = datavec[0].phi;
550 
551  int nshapeS;
552  nshapeS = datavec[0].phi.Rows();
553 
554 
555  // TPZMaterialData::MShapeFunctionType shapetype = data.fShapeType;
556  // if(shapetype==data.EVecShape){
557  // ContributeVecShapeBC(data,weight,ek, ef,bc);
558  // return;
559  // }
560 
561  REAL R = datavec[0].x[0];
562  if (R < 1.e-6) R = 1.e-6;
563 
564  switch (bc.Type()) {
565  case 0: // Dirichlet condition
566  {
567  for (int iq = 0; iq < nshapeS; iq++) {
568  ef(2 * iq, 0) += v_2(0, 0) * phiS(iq, 0) * weight; // forced v2 displacement
569  ef(2 * iq + 1, 0) += v_2(1, 0) * phiS(iq, 0) * weight; // forced v2 displacement
570  }
571  }
572  break;
573 
574  case 1: // Neumann condition
575  {
576  for (int iq = 0; iq < nshapeS; iq++) {
577  for (int jq = 0; jq < nshapeS; jq++) {
578  if (fAxisSymmetric) {
579  ek(2 * iq, 2 * jq) += gBigNumber * phiS(iq, 0) * phiS(jq, 0) * weight / R;
580  ek(2 * iq + 1, 2 * jq + 1) += gBigNumber * phiS(iq, 0) * phiS(jq, 0) * weight / R;
581  } else {
582  ek(2 * iq, 2 * jq) += gBigNumber * phiS(iq, 0) * phiS(jq, 0) * weight;
583  ek(2 * iq + 1, 2 * jq + 1) += gBigNumber * phiS(iq, 0) * phiS(jq, 0) * weight;
584  }
585  }
586  ef(2 * iq, 0) += gBigNumber * v_2(0, 0) * phiS(iq, 0) * weight; // normal stress in x direction
587  ef(2 * iq + 1, 0) += gBigNumber * v_2(1, 0) * phiS(iq, 0) * weight; // normal stress in y direction
588  }
589  }
590  break;
591 
592  case 2: // Mixed condition
593  {
594  for (int iq = 0; iq < nshapeS; iq++) {
595  for (int jq = 0; jq < nshapeS; jq++) {
596  if (fAxisSymmetric) {
597  ek(2 * iq, 2 * jq) += v_1(0, 0) * phiS(iq, 0) * phiS(jq, 0) * weight / R;
598  ek(2 * iq + 1, 2 * jq + 1) += v_1(1, 1) * phiS(iq, 0) * phiS(jq, 0) * weight / R;
599  ek(2 * iq + 1, 2 * jq) += v_1(1, 0) * phiS(iq, 0) * phiS(jq, 0) * weight / R;
600  ek(2 * iq, 2 * jq + 1) += v_1(0, 1) * phiS(iq, 0) * phiS(jq, 0) * weight / R;
601  } else {
602  ek(2 * iq, 2 * jq) += v_1(0, 0) * phiS(iq, 0) * phiS(jq, 0) * weight;
603  ek(2 * iq + 1, 2 * jq + 1) += v_1(1, 1) * phiS(iq, 0) * phiS(jq, 0) * weight;
604  ek(2 * iq + 1, 2 * jq) += v_1(1, 0) * phiS(iq, 0) * phiS(jq, 0) * weight;
605  ek(2 * iq, 2 * jq + 1) += v_1(0, 1) * phiS(iq, 0) * phiS(jq, 0) * weight;
606  }
607  }
608  ef(2 * iq, 0) += v_2(0, 0) * phiS(iq, 0) * weight; // normal stress in x direction
609  ef(2 * iq + 1, 0) += v_2(1, 0) * phiS(iq, 0) * weight; // normal stress in y direction
610  }
611  }
612  break;
613  case 5:
614  if (ndisp != 1) {
615  DebugStop();
616  }
617  if (v_1(0, 0) > 1.e-1) {
618  ek(2 * nshapeS, 2 * nshapeS) = 1.;
619  }
620  if (v_1(1, 1) > 1.e-1) {
621  ek(2 * nshapeS + 1, 2 * nshapeS + 1) = 1.;
622  }
623  break;
624  default:
625  DebugStop();
626  // nulo introduzindo o BIGNUMBER pelos valores da condição
627  } // 1 Val1 : a leitura é 00 01 10 11
628 }
629 
632 
633 
635  if (shapetype == data.EVecShape) {
636  DebugStop();
637  return;
638  }
639 
640  TPZFMatrix<REAL> &phi = data.phi;
641  int dim = Dimension();
642 
643  const REAL BIGNUMBER = TPZMaterial::gBigNumber;
644 
645  int phr = phi.Rows();
646  short in, jn;
647 
648  if (ef.Cols() != bc.NumLoadCases()) {
649  DebugStop();
650  }
651 
652  // In general when the problem is needed to stablish any convention for ContributeBC implementations
653 
654  // REAL v2[2];
655  // v2[0] = bc.Val2()(0,0);
656  // v2[1] = bc.Val2()(1,0);
657  int nstate = NStateVariables();
658 
659  TPZFMatrix<STATE> &v1 = bc.Val1();
660 
661  switch (bc.Type()) {
662  case 0: // Dirichlet condition
663  {
664  for (in = 0; in < phr; in++) {
665  for (int il = 0; il < NumLoadCases(); il++) {
666  REAL v2[2];
667  v2[0] = bc.Val2(il)(0, 0);
668  v2[1] = bc.Val2(il)(1, 0);
669  ef(2 * in, il) += BIGNUMBER * v2[0] * phi(in, 0) * weight; // forced v2 displacement
670  ef(2 * in + 1, il) += BIGNUMBER * v2[1] * phi(in, 0) * weight; // forced v2 displacement
671  }
672  for (jn = 0; jn < phi.Rows(); jn++) {
673  ek(2 * in, 2 * jn) += BIGNUMBER * phi(in, 0) * phi(jn, 0) * weight;
674  ek(2 * in + 1, 2 * jn + 1) += BIGNUMBER * phi(in, 0) * phi(jn, 0) * weight;
675  }
676  }
677  }
678  break;
679 
680  case 1: // Neumann condition
681  {
682  for (in = 0; in < phr; in++) {
683  for (int il = 0; il < fNumLoadCases; il++) {
684  TPZFNMatrix<2, STATE> v2 = bc.Val2(il);
685  ef(2 * in, il) += v2(0, 0) * phi(in, 0) * weight; // force in x direction
686  ef(2 * in + 1, il) += v2(1, 0) * phi(in, 0) * weight; // force in y direction
687  }
688  }
689  }
690  break;
691 
692  case 2: // Mixed Condition
693  {
694  for (in = 0; in < phi.Rows(); in++) {
695  for (int il = 0; il < fNumLoadCases; il++) {
696  TPZFNMatrix<2, STATE> v2 = bc.Val2(il);
697  ef(2 * in, il) += v2(0, 0) * phi(in, 0) * weight; // force in x direction
698  ef(2 * in + 1, il) += v2(1, 0) * phi(in, 0) * weight; // forced in y direction
699  }
700 
701  for (jn = 0; jn < phi.Rows(); jn++) {
702  ek(2 * in, 2 * jn) += bc.Val1()(0, 0) * phi(in, 0) *
703  phi(jn, 0) * weight; // peso de contorno => integral de contorno
704  ek(2 * in + 1, 2 * jn) += bc.Val1()(1, 0) * phi(in, 0) *
705  phi(jn, 0) * weight;
706  ek(2 * in + 1, 2 * jn + 1) += bc.Val1()(1, 1) * phi(in, 0) *
707  phi(jn, 0) * weight;
708  ek(2 * in, 2 * jn + 1) += bc.Val1()(0, 1) * phi(in, 0) *
709  phi(jn, 0) * weight;
710  }
711  } // este caso pode reproduzir o caso 0 quando o deslocamento
712 
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  for (jn = 0; jn < phr; jn++) {
719  ek(nstate * in + 0, nstate * jn + 0) += BIGNUMBER * phi(in, 0) * phi(jn, 0) * weight * bc.Val2()(0, 0);
720  ek(nstate * in + 1, nstate * jn + 1) += BIGNUMBER * phi(in, 0) * phi(jn, 0) * weight * bc.Val2()(1, 0);
721  }//jn
722  }//in
723  break;
724 
725 
726  case 4: // stressField Neumann condition
727  {
728  REAL v2[2];
729  for (in = 0; in < dim; in++) {
730  v2[in] = (v1(in, 0) * data.normal[0] +
731  v1(in, 1) * data.normal[1]);
732  }
733  // The normal vector points towards the neighbour. The negative sign is there to
734  // reflect the outward normal vector.
735  for (in = 0; in < phi.Rows(); in++) {
736  ef(nstate * in + 0, 0) += v2[0] * phi(in, 0) * weight;
737  ef(nstate * in + 1, 0) += v2[1] * 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  }
742  break;
743 
744  case 5://PRESSAO DEVE SER POSTA NA POSICAO 0 DO VETOR v2
745  {
746  TPZFNMatrix<2, STATE> res(2, 1, 0.);
747  for (in = 0; in < phi.Rows(); in++) {
748  for (int il = 0; il < NumLoadCases(); il++) {
749  ef(nstate * in + 0, 0) += (bc.Val2(il)(0, 0) * data.normal[0]) * phi(in, 0) * weight;
750  ef(nstate * in + 1, 0) += (bc.Val2(il)(0, 0) * data.normal[1]) * phi(in, 0) * weight;
751  }
752  for (jn = 0; jn < phi.Rows(); jn++) {
753  for (int idf = 0; idf < 2; idf++) for (int jdf = 0; jdf < 2; jdf++) {
754  ek(nstate * in + idf, nstate * jn + jdf) += bc.Val1()(idf, jdf) * data.normal[idf] * data.normal[jdf] * phi(in, 0) * phi(jn, 0) * weight;
755  //BUG FALTA COLOCAR VAL2
756  // DebugStop();
757  }
758  }
759 
760  }
761  }
762  break;
763 
764  case 6://PRESSAO DEVE SER POSTA NA POSICAO 0 DO VETOR v2
765  {
766  TPZFNMatrix<2, STATE> res(2, 1, 0.);
767  for (in = 0; in < phi.Rows(); in++) {
768  for (int il = 0; il < NumLoadCases(); il++) {
769  ef(nstate * in + 0, 0) += (bc.Val2(il)(0, 0) * data.normal[0]) * phi(in, 0) * weight;
770  ef(nstate * in + 1, 0) += (bc.Val2(il)(0, 0) * data.normal[1]) * phi(in, 0) * weight;
771  }
772  for (jn = 0; jn < phi.Rows(); jn++) {
773  for (int idf = 0; idf < 2; idf++) for (int jdf = 0; jdf < 2; jdf++) {
774  ek(nstate * in + idf, nstate * jn + jdf) += bc.Val1()(idf, jdf) * phi(in, 0) * phi(jn, 0) * weight;
775  //BUG FALTA COLOCAR VAL2
776  // DebugStop();
777  }
778  }
779 
780  }
781 
782  }
783  break;
784 
785  } // nulo introduzindo o BIGNUMBER pelos valores da condição
786  } // 1 Val1 : a leitura 00 01 10 11
787 }
788 
790 int TPZMixedElasticityMaterial::VariableIndex(const std::string &name) {
791  if (!strcmp("displacement", name.c_str())) return 9;
792  if (!strcmp("Displacement", name.c_str())) return 9; //function U ***
793  if (!strcmp("DisplacementMem", name.c_str())) return 9;
794  if (!strcmp("Pressure", name.c_str())) return 1;
795  if (!strcmp("MaxStress", name.c_str())) return 2;
796  if (!strcmp("PrincipalStress1", name.c_str())) return 3;
797  if (!strcmp("PrincipalStress2", name.c_str())) return 4;
798  if (!strcmp("SigmaX", name.c_str())) return 5;
799  if (!strcmp("SigmaY", name.c_str())) return 6;
800  if (!strcmp("TauXY", name.c_str())) return 8; //Cedric
801  if (!strcmp("Strain", name.c_str())) return 11; //Philippe
802  if (!strcmp("SigmaZ", name.c_str())) return 12; //Philippe
803  if (!strcmp("sig_x", name.c_str())) return 5;
804  if (!strcmp("sig_y", name.c_str())) return 6;
805  if (!strcmp("tau_xy", name.c_str())) return 8; //Cedric
806  if (!strcmp("Displacement6", name.c_str())) return 7;
807  if (!strcmp("Stress", name.c_str())) return 10; //function S ***
808  if (!strcmp("Flux", name.c_str())) return 10;
809  if (!strcmp("J2", name.c_str())) return 20;
810  if (!strcmp("I1", name.c_str())) return 21;
811  if (!strcmp("J2Stress", name.c_str())) return 20;
812  if (!strcmp("I1Stress", name.c_str())) return 21;
813  if (!strcmp("Alpha", name.c_str())) return 22;
814  if (!strcmp("PlasticSqJ2", name.c_str())) return 22;
815  if (!strcmp("PlasticSqJ2El", name.c_str())) return 22;
816  if (!strcmp("YieldSurface", name.c_str())) return 27;
817  if (!strcmp("NormalStress", name.c_str())) return 23;
818  if (!strcmp("ShearStress", name.c_str())) return 24;
819  if (!strcmp("NormalStrain", name.c_str())) return 25;
820  if (!strcmp("ShearStrain", name.c_str())) return 26;
821  if (!strcmp("Rotation", name.c_str())) return 27; //function P ***
822  if(!strcmp("Young_Modulus",name.c_str())) return 28;
823  if(!strcmp("Poisson",name.c_str())) return 29;
824 
825  return TPZMaterial::VariableIndex(name);
826 }
827 
830  switch (var) {
831  case 0:
832  return 2;
833  case 1:
834  case 2:
835  return 1;
836  case 3:
837  case 4:
838  return 2;
839  case 5:
840  case 6:
841  case 8:
842  return 1;
843  case 7:
844  return 6;
845  case 9:
846  return 3;
847  case 10: //Stress Tensor
848  return 4;
849  case 11: //Strain Tensor
850  return 3;
851  // SigZ
852  case 12:
853  return 1;
854  case 20:
855  return 1;
856  case 21:
857  return 1;
858  case 22:
859  return 1;
860  case 23:
861  case 24:
862  case 25:
863  case 26:
864  case 27:
865  return 3;
866  case 28:
867  case 29:
868  return 1;
869  default:
871  }
872 }
873 
875  int numbersol = data.dsol.size();
876  int ipos = 0;
877  if (fPostProcIndex < numbersol) {
878  ipos = fPostProcIndex;
879  }
880 
881  TPZVec<STATE> &Sol = data.sol[ipos];
882  TPZFMatrix<STATE> &DSol = data.dsol[ipos];
883  TPZFMatrix<REAL> &axes = data.axes;
884  TPZFNMatrix<4, STATE> DSolxy(2, 2);
885 
887 
888  REAL E(fE_const), nu(fnu_const);
889 
890  if(fElasticity)
891  {
892  TPZManVector<REAL,3> x = data.x;
893  TPZManVector<STATE, 3> result(2);
894  TPZFNMatrix<4,STATE> Dres(0,0);
895  fElasticity->Execute(x, result, Dres);
896  E = result[0];
897  nu = result[1];
898  TElasticityAtPoint modify(E,nu);
899  elast = modify;
900  }
901 
902  if(var == 28)
903  {
904  Solout[0] = E;
905  return ;
906  }
907  if(var == 29)
908  {
909  Solout[0] = nu;
910  return;
911  }
912 
913  REAL epsx;
914  REAL epsy;
915  REAL epsxy;
916  REAL epsz = 0.;
917  REAL SigX;
918  REAL SigY;
919  REAL SigZ;
920  REAL TauXY, aux, Sig1, Sig2, angle;
921 
922  // dudx - dudy
923  DSolxy(0, 0) = DSol(0, 0) * axes(0, 0) + DSol(1, 0) * axes(1, 0);
924  DSolxy(1, 0) = DSol(0, 0) * axes(0, 1) + DSol(1, 0) * axes(1, 1);
925  // dvdx - dvdy
926  DSolxy(0, 1) = DSol(0, 1) * axes(0, 0) + DSol(1, 1) * axes(1, 0);
927  DSolxy(1, 1) = DSol(0, 1) * axes(0, 1) + DSol(1, 1) * axes(1, 1);
928 
929  epsx = DSolxy(0, 0); // du/dx
930  epsy = DSolxy(1, 1); // dv/dy
931  epsxy = 0.5 * (DSolxy(1, 0) + DSolxy(0, 1));
932 
933  REAL lambda = elast.flambda;
934  REAL mu = elast.fmu;
935  if (this->fPlaneStress == 1) {
936  epsz = -lambda * (epsx + epsy) / (lambda + 2. * mu);
937  } else {
938  epsz = 0.;
939  }
940  TauXY = 2 * mu*epsxy;
941 #ifdef PZDEBUG
942  REAL TauXY2 = elast.fE * epsxy / (1. + elast.fnu);
943 #ifdef REALfloat
944  if (fabs(TauXY - TauXY2) > 1.e-10) {
945  DebugStop();
946  }
947 #else
948  if (fabs(TauXY - TauXY2) > 1.e-6) {
949  DebugStop();
950  }
951 #endif
952 #endif
953  if (this->fPlaneStress == 1) {
954  SigX = elast.fE / (1 - elast.fnu * elast.fnu)*(epsx + elast.fnu * epsy);
955  SigY = elast.fE / (1 - elast.fnu * elast.fnu)*(elast.fnu * epsx + epsy);
956  SigZ = 0.;
957  } else {
958  SigX = elast.fE / ((1. - 2. * elast.fnu)*(1. + elast.fnu))*((1. - elast.fnu) * epsx + elast.fnu * epsy);
959  SigY = elast.fE / ((1. - 2. * elast.fnu)*(1. + elast.fnu))*(elast.fnu * epsx + (1. - elast.fnu) * epsy);
960  SigZ = lambda * (epsx + epsy);
961  }
962 
963  switch (var) {
964  case 0:
965  //numvar = 2;
966  Solout[0] = Sol[0];
967  Solout[1] = Sol[1];
968  break;
969  case 7:
970  //numvar = 6;
971  Solout[0] = Sol[0];
972  Solout[1] = Sol[1];
973  Solout[2] = 0.;
974  Solout[3] = 0.;
975  Solout[4] = 0.;
976  Solout[5] = 0.;
977  break;
978  case 1:
979  case 2:
980  case 3:
981  case 4:
982  case 5:
983  case 6:
984  case 8:
985  case 10:
986  // Pressure variable
987  if (var == 1) {
988  //numvar = 1;
989  Solout[0] = SigX + SigY + SigZ;
990  return;
991  }
992  // TauXY variable
993  if (var == 8) {
994  Solout[0] = TauXY;
995  return;
996  }
997  if (var == 5) {
998  Solout[0] = SigX;
999  return;
1000  }
1001  if (var == 6) {
1002  Solout[0] = SigY;
1003  return;
1004  }
1005  aux = sqrt(0.25 * (SigX - SigY)*(SigX - SigY)
1006  +(TauXY)*(TauXY));
1007  // Philippe 13/5/99
1008  // if(abs(Tau) < 1.e-10 && abs(SigY-SigX) < 1.e-10) angle = 0.;
1009  if (fabs(TauXY) < 1.e-10 && fabs(SigY - SigX) < 1.e-10) angle = 0.;
1010  else angle = atan2(2 * TauXY, SigY - SigX) / 2.;
1011  Sig1 = 0.5 * (SigX + SigY) + aux;
1012  Sig2 = 0.5 * (SigX + SigY) - aux;
1013  if (var == 3) {
1014  //numvar = 2;
1015  Solout[0] = Sig1 * cos(angle);
1016  Solout[1] = Sig1 * sin(angle);
1017  return;
1018  }
1019  if (var == 4) {
1020  //numvar = 2;
1021  Solout[0] = -Sig2 * sin(angle);
1022  Solout[1] = Sig2 * cos(angle);
1023  return;
1024  }
1025  if (var == 2) {
1026  REAL sigmax;
1027  sigmax = (fabs(Sig1) < fabs(Sig2)) ? fabs(Sig2) : fabs(Sig1);
1028  Solout[0] = sigmax;
1029  return;
1030  }
1031  if (var == 10) {
1032  Solout[Exx] = SigX;
1033  Solout[Eyy] = SigY;
1034  Solout[Exy] = TauXY;
1035  Solout[Eyx] = TauXY;
1036  return;
1037  }
1038  cout << "Very critical error TPZMixedElasticityMaterial::Solution\n";
1039  exit(-1);
1040  // Solout[0] /= 0.;
1041  break;
1042  case 9:
1043  Solout[0] = Sol[0];
1044  Solout[1] = Sol[1];
1045  Solout[2] = 0.;
1046  break;
1047  case 11:
1048  Solout[0] = epsx;
1049  Solout[1] = epsy;
1050  Solout[2] = epsxy;
1051  break;
1052  case 12:
1053  Solout[0] = SigZ;
1054  break;
1055 
1056  case 20:
1057  {
1058  REAL J2 = (pow(SigX + SigY, 2) - (3 * (-pow(SigX, 2) - pow(SigY, 2) + pow(SigX + SigY, 2) - 2 * pow(TauXY, 2))) / 2.) / 2.;
1059  Solout[0] = J2;
1060  break;
1061  }
1062  case 21:
1063  {
1064  REAL I1 = SigX + SigY;
1065  Solout[0] = I1;
1066  break;
1067  }
1068  case 22:
1069  Solout[0] = 0.;
1070  break;
1071  case 23:
1072  // normal stress
1073  Solout[0] = SigX;
1074  Solout[1] = SigY;
1075  Solout[2] = SigZ;
1076  break;
1077  case 24:
1078  // shear stress
1079  Solout[0] = TauXY;
1080  Solout[1] = 0.;
1081  Solout[2] = 0.;
1082  break;
1083  case 25:
1084  Solout[0] = epsx;
1085  Solout[1] = epsy;
1086  Solout[2] = epsz;
1087  break;
1088  case 26:
1089  Solout[0] = epsxy;
1090  Solout[1] = 0.;
1091  Solout[2] = 0.;
1092  break;
1093  case 27:
1094  Solout[0] = 0.;
1095  Solout[1] = 0.;
1096  Solout[2] = 0.;
1097  break;
1098  default:
1099  TPZMaterial::Solution(Sol, DSol, axes, var, Solout);
1100  break;
1101  }
1102 }
1103 
1106 #ifdef PZDEBUG
1107  if (data.size() != 3) {
1108  DebugStop();
1109  }
1110 #endif
1111  TPZManVector<REAL, 3> x = data[0].x;
1112  REAL R = x[0];
1113  if (R < 1.e-6) {
1114  R = 1.e-6;
1115  }
1116  TPZFNMatrix<9, STATE> sigma(3, 3, 0.), sigmah(3, 3, 0.), eps(3, 3, 0.);
1117  int dim = Dimension();
1118  for (int i = 0; i < dim; i++) {
1119  for (int j = 0; j < 3; j++) {
1120  if (fAxisSymmetric) {
1121  sigma(i, j) = data[0].sol[0][j + i * 3] / R;
1122  } else {
1123  sigma(i, j) = data[0].sol[0][j + i * 3];
1124  }
1125  }
1126  }
1127  TPZManVector<STATE, 2> disp(2);
1128  for (int i = 0; i < dim; i++) {
1129  disp[i] = data[1].sol[0][i];
1130  }
1131  TPZFNMatrix<4, STATE> antisym(2, 2, 0.);
1132  antisym(0, 1) = data[2].sol[0][0];
1133  antisym(1, 0) = -antisym(0, 1);
1134 
1136  if(fElasticity)
1137  {
1138  //TPZManVector<REAL,3> result(2);
1139  TPZManVector<STATE, 3> result(2);
1140  TPZFNMatrix<4,STATE> Dres(0,0);
1141  fElasticity->Execute(x, result, Dres);
1142  REAL E = result[0];
1143  REAL nu = result[1];
1144  TElasticityAtPoint modify(E,nu);
1145  elast = modify;
1146  }
1147 
1148  REAL mu = elast.fmu;
1149  REAL E = elast.fE;
1150  REAL nu = elast.fnu;
1151 
1152  if(var == 28)
1153  {
1154  Solout[0] = E;
1155  return ;
1156  }
1157  if(var == 29)
1158  {
1159  Solout[0] = elast.fnu;
1160  return;
1161  }
1162 
1163 
1164  REAL Pressure;
1165 
1166  //TPZManVector<REAL, 4> SIGMA(4, 0.), EPSZ(4, 0.);
1167  TPZManVector<STATE, 4> SIGMA(4, 0.), EPSZ(4, 0.);
1168 
1169  ToVoigt(sigma, SIGMA);
1170 
1171  ComputeDeformationVector(SIGMA, EPSZ, elast);
1172 
1173  FromVoigt(EPSZ, eps);
1174 
1175  if (this->fPlaneStress == 1) {
1176  eps(2, 2) = -1. / E * nu * (sigma(0, 0) + sigma(1, 1));
1177  } else {
1178  sigma(2, 2) = nu * (sigma(0, 0) + sigma(1, 1));
1179  eps(2, 2) = 0;
1180  }
1181 
1182  Pressure = -1/3. * (sigma(0, 0) + sigma(1, 1) + sigma(2,2));
1183  sigmah(0, 1) = sigma(0, 1);
1184  sigmah(1, 0) = sigma(1, 0);
1185  sigmah(0, 0) = sigma(0, 0) + Pressure;
1186  sigmah(1, 1) = sigma(1, 1) + Pressure;
1187  sigmah(2, 2) = sigma(2, 2) + Pressure;
1188  // Displacement
1189  if (var == 9) {
1190  Solout[0] = disp[0];
1191  Solout[1] = disp[1]; //displacement is discontinuous. Can we write as it?
1192  return;
1193  }
1194  // Pressure
1195  if (var == 1) {
1196  Solout[0] = -1 / 3 * (sigma(0, 0) + sigma(1, 1) + sigma(2, 2));
1197  return;
1198  }
1199  // Sigmaz
1200  if (var == 12) {
1201  Solout[0] = sigma(2, 2);
1202 
1203  return;
1204  }
1205  // SigmaY
1206  if (var == 6) {
1207  Solout[0] = sigma(1, 1);
1208  return;
1209  }
1210 
1211  // SigmaX
1212  if (var == 5) {
1213  Solout[0] = sigma(0, 0);
1214  return;
1215  }
1216  // TauXY
1217  if (var == 8) {
1218  Solout[0] = 0.5 * (sigma(0, 1) + sigma(1, 0));
1219  return;
1220  }
1221  //Strain
1222  if (var == 11) {
1223  Solout[0] = eps(0, 0);
1224  Solout[1] = eps(1, 0);
1225  Solout[2] = eps(0, 1);
1226  Solout[3] = eps(2, 2);
1227  return;
1228  }
1229 
1230  //Stress
1231  if (var == 10) {
1232  Solout[Exx] = sigma(0, 0);
1233  Solout[Eyx] = sigma(1, 0);
1234  Solout[Exy] = sigma(0, 1);
1235  Solout[Eyy] = sigma(1, 1);
1236  return;
1237  }
1238 
1239  //I1
1240  if (var == 21) {
1241  Solout[0] = sigma(0, 0) + sigma(1, 1) + sigma(2, 2);
1242  return;
1243  }
1244  //J2
1245  if (var == 20) {
1246  Solout[0] = sigmah(1, 1) * sigmah(0, 0) + sigmah(1, 1) * sigma(2, 2)
1247  + sigmah(0,0) * sigmah(2,2) - sigmah(1, 0) * sigmah(1, 0) - sigmah(0, 1) * sigmah(0, 1);
1248  return;
1249  }
1250  //NormalStrain?
1251 
1252  //PrincipalStrain1
1253  if (var == 3) {
1254  Solout[0] = Pressure + sqrt(0.25 * (sigma(0, 0) - sigma(1, 1))*(sigma(0, 0) - sigma(1, 1)) + sigma(1, 2));
1255  return;
1256  }
1257  //Rotation
1258  if (var == 27) {
1259  Solout[0] = antisym(0, 1);
1260  return;
1261  }
1262 }
1263 
1264 
1266 
1268  //inner product of two tensors
1269 #ifdef DEBUG
1270  if (S.Rows() != S.Cols() || T.Cols() != T.Rows() || S.Rows() != T.Rows()) {
1271  DebugStop();
1272  }
1273 #endif
1274 
1275  STATE Val = 0;
1276  for (int i = 0; i < S.Cols(); i++) {
1277  for (int j = 0; j < S.Cols(); j++) {
1278  Val += S(i, j) * T(i, j);
1279  }
1280  }
1281  return Val;
1282 }
1283 
1285 
1286 template <typename TVar>
1288  //inner product of two vectors
1289 #ifdef DEBUG
1290  if (S.size() != T.size()) {
1291  DebugStop();
1292  }
1293 #endif
1294  TVar Val = 0;
1295  for (int i = 0; i < S.size(); i++) {
1296  Val += S[i] * T[i];
1297  }
1298  return Val;
1299 }
1300 
1303 
1304 #ifdef DEBUG
1305  if (GradU.Rows() != GradU.Cols()) {
1306  DebugStop();
1307  }
1308 #endif
1309 
1310  STATE Val = 0.;
1311 
1312  for (int i = 0; i < GradU.Rows(); i++) {
1313  Val += GradU(i, i);
1314  }
1315 
1316  return Val;
1317 }
1318 
1319 
1321 
1324  data.fNormalVec.Identity();
1325  data.fVecShapeIndex.Resize(fDimension * data.phi.Rows());
1326  for (int d = 0; d < fDimension; d++) {
1327  for (int i = 0; i < data.phi.Rows(); i++) {
1328  data.fVecShapeIndex[i * fDimension + d].first = d;
1329  data.fVecShapeIndex[i * fDimension + d].second = i;
1330  }
1331  }
1332 }
1333 
1335  if (fabs(axes(2, 0)) >= 1.e-6 || fabs(axes(2, 1)) >= 1.e-6) {
1336  cout << "TPZMixedElasticityMaterial::Flux only serves for xy configuration\n";
1337  axes.Print("axes");
1338  }
1339 }
1340 
1342  return 8;
1343 }
1344 
1346  //values[0] = 0.;
1347  //TPZManVector<REAL, 4> SigmaV(4, 0.), sigma_exactV(4, 0.), eps_exactV(4, 0.), EPSZV(4, 0.);
1348  TPZManVector<STATE, 4> SigmaV(4, 0.), sigma_exactV(4, 0.), eps_exactV(4, 0.), EPSZV(4, 0.);
1349  TPZFNMatrix<9, STATE> sigma(2, 2, 0.), eps(2, 2, 0.), grad(2, 2, 0.);
1350  TPZFNMatrix<4, STATE> eps_exact(2, 2, 0.);
1351  TPZManVector<REAL, 3> x = data[0].x;
1352  int dim = Dimension();
1353  for (int i = 0; i < dim; i++) {
1354  for (int j = 0; j < dim; j++) {
1355  sigma(i, j) = data[0].sol[0][j + i * 3];
1356  if (fAxisSymmetric) {
1357  sigma(i, j) /= x[0];
1358  }
1359  }
1360  }
1361  ToVoigt(sigma, SigmaV);
1362  TPZManVector<STATE, 2> divSigma(2,0.);
1363  for (int i = 0; i < dim; i++) {
1364  for (int j = 0; j < dim; j++) {
1365  divSigma[i] += data[0].dsol[0](i * 3 + j, j);
1366  }
1367  }
1368 
1369  TPZManVector<STATE, 2> disp(2);
1370  for (int i = 0; i < dim; i++) {
1371  disp[i] = data[1].sol[0][i];
1372  }
1373 
1374 #ifdef LOG4CXX
1375  if (logdata->isDebugEnabled())
1376  {
1377  std::stringstream sout;
1378  sout << "DISP*************************** = " << disp << std::endl;
1379  sigma.Print("sigma************************************ = ", sout, EMathematicaInput);
1380  LOGPZ_DEBUG(logdata, sout.str())
1381  }
1382 #endif
1383 
1384 
1385  eps_exact(0, 0) = du_exact(0, 0);
1386  eps_exact(1, 0) = eps_exact(0, 1) = 0.5 * (du_exact(0, 1) + du_exact(1, 0));
1387  eps_exact(1, 1) = du_exact(1, 1);
1388  ToVoigt(eps_exact, eps_exactV);
1389 
1391  if(fElasticity)
1392  {
1393  //TPZManVector<REAL,3> result(2);
1394  TPZManVector<STATE, 3> result(2);
1395  TPZFNMatrix<4,STATE> Dres(0,0);
1396  fElasticity->Execute(x, result, Dres);
1397  REAL E = result[0];
1398  REAL nu = result[1];
1399  TElasticityAtPoint modify(E,nu);
1400  elast = modify;
1401  }
1402 
1403  ComputeStressVector(eps_exactV, sigma_exactV, elast);
1404 
1405  STATE rotation = data[2].sol[0][0];
1406  STATE rotationExact = 0.5*(du_exact(1, 0)-du_exact(0, 1));
1407 #ifdef PZDEBUG
1408  {
1409  TPZManVector<STATE, 4> eps_again(4);
1410  ComputeDeformationVector(sigma_exactV, eps_again, elast);
1411  for (int i = 0; i < 4; i++) {
1412  if (abs(eps_again[i] - eps_exactV[i]) > 1.e-8) {
1413  DebugStop();
1414  }
1415  }
1416  }
1417 #endif
1418  //TPZFMatrix<STATE> du(dudx.Rows(),dudx.Cols());
1419  //du(0,0) = dudx(0,0)*axes(0,0)+dudx(1,0)*axes(1,0);
1420  //du(1,0) = dudx(0,0)*axes(0,1)+dudx(1,0)*axes(1,1);
1421  //du(0,1) = dudx(0,1)*axes(0,0)+dudx(1,1)*axes(1,0);
1422  //du(1,1) = dudx(0,1)*axes(0,1)+dudx(1,1)*axes(1,1);
1423 
1424  //tensões aproximadas : uma forma
1425  //gamma = du(1,0)+du(0,1);
1426  //sigma[0] = fPreStressXX+fEover1MinNu2*(du(0,0)+fnu*du(1,1));
1427  //sigma[1] = fPreStressYY+fEover1MinNu2*(fnu*du(0,0)+du(1,1));
1428  //sigma[2] = fPreStressXY+fE*0.5/(1.+fnu)*gamma;
1429 
1430  //exata
1431  //gamma = du_exact(1,0)+du_exact(0,1);
1432  //sigma_exactV[0] = fEover1MinNu2*(du_exact(0,0)+fnu*du_exact(1,1));
1433  //sigma_exactV[1] = fEover1MinNu2*(fnu*du_exact(0,0)+du_exact(1,1));
1434  //sigma_exactV[2] = fE*0.5/(1.+fnu)*gamma;
1435  //sigx = (SigmaV[0] - sigma_exactV[0]);
1436  //sigy = (SigmaV[1] - sigma_exactV[1]);
1437  //sigxy = (SigmaV[2] - sigma_exactV[2]);
1438 
1439  //L2_Error: for the displacement (u)
1440  errors[3] = (disp[0] - u_exact[0])*(disp[0] - u_exact[0])+(disp[1] - u_exact[1])*(disp[1] - u_exact[1]);
1441  //Energe norm
1442  //TPZManVector<REAL,4> SIGMA(4,0.) , EPSZ(4,0.);
1443 
1444 
1445  ToVoigt(sigma, SigmaV);
1446 
1447  ComputeDeformationVector(SigmaV, EPSZV, elast);
1448 
1449  //FromVoigt(EPSZV, eps);
1450 
1451  //SIGMA[0] = sigx;
1452  //SIGMA[1] = sigxy;
1453  //SIGMA[2] = sigxy;
1454  //SIGMA[3] = sigy;
1455  errors[0] = 0.;
1456  errors[1] = 0.;
1457  for (int i = 0; i < 4; i++) {
1458  //L2_Error: for the stress tensor (sigma)
1459  errors[0] += (SigmaV[i] - sigma_exactV[i])*(SigmaV[i] - sigma_exactV[i]);
1460 
1461  //Energy_Error: for the stress tensor (sigma)
1462  errors[1] += (SigmaV[i] - sigma_exactV[i])*(EPSZV[i] - eps_exactV[i]);
1463  }
1464  if (errors[1] < 0.) {
1465  std::cout << "I should stop \n";
1466  }
1467  //L2_Error: for the sigma_xx
1468  errors[7] = (SigmaV[0] - sigma_exactV[0])*(SigmaV[0] - sigma_exactV[0]);
1469 
1470  TPZManVector<STATE,3> divSigmaExact(fDimension,0.);
1471  if(HasForcingFunction())
1472  {
1473  fForcingFunction->Execute(data[0].x, divSigmaExact);
1474  for(int i=0; i<fDimension; i++) divSigmaExact[i] *= -1.;
1475  }
1476  //L2_Error: divergent of the stress tensor (div(sigma))
1477  errors[2] = pow(divSigma[0]-divSigmaExact[0],2) + pow(divSigma[1]-divSigmaExact[1],2);
1478  //L2_Error: for the rotation (q)
1479  errors[4] = pow(rotation-rotationExact,2);
1480  //L2_Error: for the symmetry measure (asym)
1481  errors[5] = pow(SigmaV[Exy]-SigmaV[Eyx],2);
1482 
1483  //Energy_Norm: for the exact displacement solution
1484  errors[6] = 0.;
1485  for(int i=0; i<4; i++)
1486  {
1487  errors[6] += eps_exactV[i]*sigma_exactV[i];
1488  }
1489  // std::cout << "x " << data[0].x << std::endl;
1490  // std::cout << "disp " << u_exact << std::endl;
1491  // du_exact.Print("du ",std::cout);
1492  // std::cout << "sigma_exact " << sigma_exactV << std::endl;
1493  // std::cout << errors << std::endl;
1494  //or we can compute as this methods
1495  //TPZFMatrix<STATE> MatrixElast(4,4,0.);
1496  //ElasticityModulusTensor(MatrixElast);
1497  //errors[1] = 0;
1498  //for(int i==0; i<4; i++)
1499  //{
1500  //for(int j=0; j<4; j++)
1501  //{
1502  //errors[1]+=SIGMA[j]*MatrixElast(j,i);
1503  //}
1504  //}
1505 
1506  // SemiH1 norm
1507  //TPZFNMatrix<4,REAL> antisym(2,2,0.);
1508  //antisym(0,1) = data[2].sol[0][0];
1509  //antisym(1,0) = -antisym(0,1);
1510  //TPZManVector<REAL,4> P(4,0.),DU(4,0.);
1511  //ToVoigt(antisym,P);
1512  //ToVoigt(du_exact,DU);
1513  //errors[2]=0;
1514  //for(int i=0;i<4;i++)
1515  //{
1516  // errors[2]+=(P[i]+EPSZ[i]-DU[i])*(P[i]+EPSZ[i]-DU[i]);
1517  //}
1518  //values[0] = calculo do erro estimado em norma Energia
1519  //values[0] = fE*(sigx*sigx + sigy*sigy + 2*fnu*sigx*sigy)/(1-fnu*fnu);
1520  //values[0] = (values[0] + .5*fE*sigxy*sigxy/(1+fnu));
1521 
1522  //values[1] : erro em norma L2 em tens�s
1523  //values[1] = sigx*sigx + sigy*sigy + sigxy*sigxy;
1524 
1525  //values[1] : erro em norma L2 em deslocamentos
1526  //values[1] = pow((REAL)fabs(u[0] - u_exact[0]),(REAL)2.0)+pow((REAL)fabs(u[1] - u_exact[1]),(REAL)2.0);
1527 
1528  //values[2] : erro estimado na norma H1
1529  //REAL SemiH1 =0.;
1530  //for(int i = 0; i < 2; i++) for(int j = 0; j < 2; j++) SemiH1 += (du(i,j) - du_exact(i,j)) * (du(i,j) - du_exact(i,j));
1531  //values[2] = values[1] + SemiH1;
1532 }
1533 
1535  TPZFMatrix<STATE> &dudx, TPZFMatrix<REAL> &axes, TPZVec<STATE> &flux,
1536  TPZVec<STATE> &u_exact, TPZFMatrix<STATE> &du_exact, TPZVec<REAL> &values) {
1537  values[0] = 0.;
1538  TPZVec<REAL> sigma(3, 0.), sigma_exact(3, 0.);
1539  REAL sigx, sigy, sigxy, gamma;
1540  TPZFMatrix<STATE> du(dudx.Rows(), dudx.Cols());
1541  du(0, 0) = dudx(0, 0) * axes(0, 0) + dudx(1, 0) * axes(1, 0);
1542  du(1, 0) = dudx(0, 0) * axes(0, 1) + dudx(1, 0) * axes(1, 1);
1543  du(0, 1) = dudx(0, 1) * axes(0, 0) + dudx(1, 1) * axes(1, 0);
1544  du(1, 1) = dudx(0, 1) * axes(0, 1) + dudx(1, 1) * axes(1, 1);
1545  TPZManVector<STATE, 4> deform(4), deformexact(4), stress(4), stressexact(4), deformerror(4), stresserror(4);
1546 
1548  if(fElasticity)
1549  {
1550  //TPZManVector<REAL,3> result(2);
1551  TPZManVector<STATE, 3> result(2);
1552  TPZFNMatrix<4,STATE> Dres(0,0);
1553  fElasticity->Execute(x, result, Dres);
1554  REAL E = result[0];
1555  REAL nu = result[1];
1556  TElasticityAtPoint modify(E,nu);
1557  elast = modify;
1558  }
1559 
1560  ToVoigt(du, deform);
1561  ComputeStressVector(deform, stress, elast);
1562 
1563  ToVoigt(du_exact, deformexact);
1564  ComputeStressVector(deformexact, stressexact, elast);
1565  //exata
1566  for (int i = 0; i < 4; i++) {
1567  deformerror[i] = deform[i] - deformexact[i];
1568  stresserror[i] = stress[i] - stressexact[i];
1569  }
1570  //values[0] = calculo do erro estimado em norma Energia
1571  values[0] = 0.;
1572  for (int i = 0; i < 4; i++) {
1573  values[0] += stresserror[i] * deformerror[i];
1574  }
1575 
1576  //values[1] : erro em norma L2 em tens�s
1577  //values[1] = sigx*sigx + sigy*sigy + sigxy*sigxy;
1578 
1579  //values[1] : erro em norma L2 em deslocamentos
1580  values[1] = 0;
1581  for (int i = 0; i < 2; i++) {
1582  values[i] += (u[i] - u_exact[i])*(u[i] - u_exact[i]);
1583  }
1584 
1585  //values[2] : erro estimado na norma H1
1586  values[2] = 0.;
1587  for (int i = 0; i < 4; i++) {
1588  values[2] += deformerror[i] * deformerror[i];
1589  }
1590 }
1591 
1594 fE_const(copy.fE_const),
1595 fnu_const(copy.fnu_const),
1597 fmu_const(copy.fmu_const),
1598 fForce(copy.fForce),
1600 fDimension(copy.fDimension),
1601 fMatrixA(copy.fMatrixA),
1602 fElasticity(copy.fElasticity),
1604 }
1605 
1607  return Hash("TPZMixedElasticityMaterial") ^ TPZDiscontinuousGalerkin::ClassId() << 1;
1608 }
1609 
1610 void TPZMixedElasticityMaterial::Read(TPZStream &buf, void *context) {
1611  TPZMaterial::Read(buf, context);
1612  buf.Read(&fE_const, 1);
1613  buf.Read(&fnu_const, 1);
1614  fForce.Resize(2, 0.);
1615  buf.Read(&fForce[0], 2);
1616  buf.Read(&fPlaneStress, 1);
1617  buf.Read(&fPostProcIndex);
1618 }
1619 
1620 void TPZMixedElasticityMaterial::Write(TPZStream &buf, int withclassid) const {
1621  TPZMaterial::Write(buf, withclassid);
1622  buf.Write(&fE_const, 1);
1623  buf.Write(&fnu_const, 1);
1624 
1625  buf.Write(&fForce[0], 2);
1626  buf.Write(&fPlaneStress, 1);
1627  buf.Write(&fPostProcIndex);
1628 }
1629 
Defines the interface which material objects need to implement for discontinuous Galerkin formulation...
Definition: pzdiscgal.h:20
virtual void FillDataRequirements(TPZMaterialData &data) override
Fill material data parameter with necessary requirements for the.
virtual void Solution(TPZMaterialData &data, int var, TPZVec< STATE > &Solout)
Returns the solution associated with the var index based on the finite element approximation.
virtual void Execute(const TPZVec< REAL > &x, TPZVec< TVar > &f, TPZFMatrix< TVar > &df)
Performs function computation.
Definition: pzfunction.h:38
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
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
int ClassId() const override
Unique identifier for serialization purposes.
Definition: pzdiscgal.cpp:110
TPZManVector< REAL, 3 > normal
normal to the element at the integration point
STATE Inner(TPZFMatrix< STATE > &S, TPZFMatrix< STATE > &T)
int fNumLoadCases
Defines the number of load cases generated by this material.
Definition: TPZMaterial.h:76
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
void FillVecShapeIndex(TPZMaterialData &data)
transform a H1 data structure to a vector data structure
clarg::argBool bc("-bc", "binary checkpoints", false)
bool fAxisSymmetric
flag indicates axix-AxisSymmetric
static void Axes2XYZ(const TPZFMatrix< TVar > &dudaxes, TPZFMatrix< TVar > &dudx, const TPZFMatrix< REAL > &axesv, bool colMajor=true)
Makes the basis transformation from axes basis to euclidian basis.
Definition: pzaxestools.h:61
int Type()
Definition: pzbndcond.h:249
TPZMixedElasticityMaterial()
Default constructor.
virtual void Identity()
Converts the matrix in an identity matrix.
Definition: pzmatrix.cpp:199
virtual int VariableIndex(const std::string &name)
Returns the variable index associated with the name.
Defines PZError.
void Write(TPZStream &buf, int withclassid) const override
Saves the element data to a stream.
TPZGradSolVec dsol
vector of the derivatives of the solution at the integration point
MShapeFunctionType fShapeType
TinyFad< 8, T > abs(const TinyFad< 8, T > &in)
Definition: tinyfadeight.h:846
TPZAutoPointer< TPZFunction< STATE > > fElasticity
This class implements a simple vector storage scheme for a templated class T. Utility.
Definition: pzgeopoint.h:19
virtual void FillBoundaryConditionDataRequirement(int type, TPZMaterialData &data) override
This method defines which parameters need to be initialized in order to compute the contribution of t...
void ElasticityModulusTensor(TPZFMatrix< STATE > &MatrixElast, TElasticityAtPoint &elast)
virtual void Resize(const int64_t newsize, const T &object)
Resizes the vector object.
Definition: pzmanvector.h:426
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 void Flux(TPZVec< REAL > &x, TPZVec< STATE > &Sol, TPZFMatrix< STATE > &DSol, TPZFMatrix< REAL > &axes, TPZVec< STATE > &flux) override
Computes the value of the flux function to be used by ZZ error estimator.
This class implements a two dimensional elastic material in plane stress or strain.
void SetElasticity(REAL E, REAL nu)
Set elasticity parameters.
TPZFNMatrix< 660, REAL > dphix
values of the derivative of the shape functions
void Errors(TPZVec< REAL > &x, TPZVec< STATE > &u, TPZFMatrix< STATE > &dudx, TPZFMatrix< REAL > &axes, TPZVec< STATE > &flux, TPZVec< STATE > &u_exact, TPZFMatrix< STATE > &du_exact, TPZVec< REAL > &values) override
Computes the error due to the difference between the interpolated flux and the flux computed based o...
int fPostProcIndex
indicates which solution should be used for post processing
Definition: TPZMaterial.h:79
Contains declaration of TPZElementMatrix struct which associates an element matrix with the coeficien...
static void FromVoigt(TPZVec< STATE > &Svoigt, TPZFMatrix< STATE > &S)
Transform a Voigt notation to a tensor.
Contains the TPZBndCond class which implements a boundary condition for TPZMaterial objects...
TPZAutoPointer< TPZFunction< STATE > > & ForcingFunction()
Returns a procedure as source function for the material.
Definition: TPZMaterial.h:397
STATE Tr(TPZFMatrix< REAL > &GradU)
int64_t size() const
Returns the number of elements of the vector.
Definition: pzvec.h:196
virtual int NSolutionVariables(int var) override
sin
Definition: fadfunc.h:63
int Dimension() const override
Returns the model dimension.
REAL flambda_const
first Lame Parameter
virtual void Read(TPZStream &buf, void *context) override
Reads the element data from a stream.
virtual void Write(TPZStream &buf, int withclassid) const override
Saves the element data to a stream.
void Read(TPZStream &buf, void *context) override
Reads the element data from a stream.
f
Definition: test.py:287
virtual int ClassId() const override
Unique identifier for serialization purposes.
void ComputeDivergenceOnDeformed(TPZVec< TPZMaterialData > &datavec, TPZFMatrix< STATE > &DivergenceofPhi)
virtual void Write(const bool val)
Definition: TPZStream.cpp:8
Contains TPZMatrixclass which implements full matrix (using column major representation).
#define DebugStop()
Returns a message to user put a breakpoint in.
Definition: pzerror.h:20
TPZFNMatrix< 180 > fNormalVec
list of normal vectors
#define LOGPZ_DEBUG(A, B)
Define log for debug info.
Definition: pzlog.h:87
This class defines the boundary condition for TPZMaterial objects.
Definition: pzbndcond.h:29
virtual void Contribute(TPZMaterialData &data, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef) override
Calculates the element stiffness matrix.
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
TPZFNMatrix< 9, REAL > axes
axes indicating the directions of the derivatives of the shapefunctions
string res
Definition: test.py:151
TPZFMatrix< STATE > & Val1()
Definition: pzbndcond.h:253
int fDimension
dimension of the material
void ComputeDeformationVector(TPZVec< STATE > &PhiStress, TPZVec< STATE > &APhiStress, TElasticityAtPoint &elastb)
virtual ~TPZMixedElasticityMaterial()
Default destructor.
virtual int HasForcingFunction()
Directive that gives true if the material has a forcing function.
Definition: TPZMaterial.h:472
int Redim(const int64_t newRows, const int64_t newCols) override
Redimension a matrix and ZERO your elements.
Definition: pzfmatrix.h:616
static REAL gBigNumber
Big number to penalization method, used for Dirichlet conditions.
Definition: TPZMaterial.h:83
int32_t Hash(std::string str)
Definition: TPZHash.cpp:10
long double gamma(unsigned int n)
Evaluate the factorial of a integer.
Contains TPZMatrix<TVar>class, root matrix class.
static REAL angle
Angle in radians to test.
Definition: pzsubcmesh.cpp:53
Contains the TPZMatWithMem class which implements the memory features.
virtual void ContributeBC(TPZVec< TPZMaterialData > &datavec, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef, TPZBndCond &bc) override
Applies the element boundary conditions Mixed.
TPZFlopCounter pow(const TPZFlopCounter &orig, const TPZFlopCounter &xp)
Returns the power and increments the counter of the power.
Definition: pzreal.h:487
static int idf[6]
virtual int NSolutionVariables(int var)
Returns the number of variables associated with the variable indexed by var.
virtual std::string Name() override
Returns the material name.
virtual int NEvalErrors() override
Returns the number of norm errors. Default is 3: energy, L2 and H1.
Contains the TPZMixedElasticityMaterial class which implements a two dimensional elastic material in ...
virtual void Solution(TPZMaterialData &data, int var, TPZVec< STATE > &Solout) override
Returns the solution associated with the var index based on the finite element approximation.
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
static void ToVoigt(TPZFMatrix< STATE > &S, TPZVec< STATE > &Svoigt)
Transform a tensor to a Voigt notation.
REAL fmu_const
Second Lame Parameter.
int NumLoadCases()
returns the number of load cases for this material object
Definition: TPZMaterial.h:186
virtual int NStateVariables() const override
Returns the number of state variables associated with the material.
Contains declaration of the TPZAxesTools class which implements verifications over axes...
void ComputeStressVector(TPZVec< STATE > &Deformation, TPZVec< STATE > &Stress, TElasticityAtPoint &elast)
int64_t Cols() const
Returns number of cols.
Definition: pzmatrix.h:809
virtual void Print(std::ostream &out) const
Definition: pzmatrix.h:253
int Resize(const int64_t newRows, const int64_t wCols) override
Redimension a matrix, but maintain your elements.
Definition: pzfmatrix.cpp:1016
TVar InnerVec(const TPZVec< TVar > &S, const TPZVec< TVar > &T)
Defines the interface for saving and reading data. Persistency.
Definition: TPZStream.h:50
int64_t NElements() const
Returns the number of elements of the vector.
Definition: pzvec.h:190
def values
Definition: rdt.py:119
REAL fnu_const
Poison coefficient.
virtual void Print(std::ostream &out=std::cout) override
Print the material data.
TPZManVector< std::pair< int, int64_t > > fVecShapeIndex
correspondence between normal vector index and index of the shape functions
TPZFlopCounter cos(const TPZFlopCounter &orig)
Returns the cosine in radians and increments the counter of the Cosine.
Definition: pzreal.h:514
TPZSolVec sol
vector of the solutions at the integration point
void Transpose(TPZMatrix< TVar > *const T) const override
It makes *T the transpose of current matrix.
Definition: pzfmatrix.cpp:1073
virtual int VariableIndex(const std::string &name) override
TPZManVector< REAL, 3 > fForce
Forcing vector.
Non abstract class which implements full matrices with preallocated storage with (N+1) entries...
Definition: pzfmatrix.h:716
#define PZError
Defines the output device to error messages and the DebugStop() function.
Definition: pzerror.h:15
virtual void Read(bool &val)
Definition: TPZStream.cpp:91