NeoPZ
pzviscoelastic.cpp
Go to the documentation of this file.
1 /*
2  * pzviscoelastic.cpp
3  * pos_processamento
4  *
5  * Created by Pamela Diaz on 7/16/10.
6  * Copyright 2010 __MyCompanyName__. All rights reserved.
7  *
8  */
9 
10 
11 #include "pzviscoelastic.h"
12 
13 TPZViscoelastic::TPZViscoelastic(TPZMatWithMem<TPZFMatrix<REAL>, TPZElasticity3D> &matwithmem,int id,REAL lambdaE,REAL muE, REAL lambdaV, REAL muV, REAL alphaT):TPZMatWithMem<TPZFMatrix<REAL>, TPZElasticity3D>(matwithmem), flambdaE(lambdaE),fmuE(muE),flambdaV(lambdaV),fmuV(muV),falphaT(alphaT)
14 {
15 
16  REAL lambda = flambdaE-(falphaT*flambdaV)/(1+falphaT);
17  REAL mu = fmuE -(falphaT*fmuV)/(1+falphaT);
18 
19  std::cout<<"lambda"<<std::endl;
20  std::cout<<lambda<<std::endl;
21  std::cout<<"mu"<<std::endl;
22  std::cout<<mu<<std::endl;
23 
24  fE=mu*(3*lambda+2*mu)/(lambda+mu);
25  fPoisson= lambda/(2*(lambda+mu));
26 
27  std::cout<<"elasticity modulus"<<std::endl;
28  std::cout<<fE<<std::endl;
29  std::cout<<"poisson"<<std::endl;
30  std::cout<<fPoisson<<std::endl;
32 
33 
34 }
35 
37 {
38 
39  if(fUpdateMem== 0){
40 
42  TPZFMatrix<REAL> dphi = data.dphix;
43  TPZFMatrix<REAL> phi = data.phi;
44 
45  const int phr = phi.Rows();
46  //this matrix will store {{dvdx*dudx, dvdx*dudy, dvdx*dudz},
47  //{dvdy*dudx, dvdy*dudy, dvdy*dudz},
48  //{dvdz*dudx, dvdz*dudy, dvdz*dudz}}
49  TPZFNMatrix<9> Deriv(3,3);
50 
51  int index = data.intGlobPtIndex;
52  //int index = 0;
53  TPZFNMatrix<6> qsi;//
54  qsi = *MemItem(index);
55  int nstate = NStateVariables();
56  int in;
57  REAL val;
58  //qsi.Print("Valores de qsi ",std::cout);
59 
60 
61  for(in = 0; in < phr; in++)
62  {
63  //in: test function index
64  val = 0.;
65  val -= qsi(_XX_,0) * dphi(0,in); // |
66  val -= qsi(_XY_,0) * dphi(1,in); // fk
67  val -= qsi(_XZ_,0) * dphi(2,in); // |
68  val = val/(1+falphaT);
69  ef(in*nstate+0,0) += weight * val;
70 
71  //Second equation: fb and fk
72  val = 0.;
73  val -= qsi(_XY_,0) * dphi(0,in); // |
74  val -= qsi(_YY_,0) * dphi(1,in); // fk
75  val -= qsi(_YZ_,0) * dphi(2,in); // |
76  val = val/(1+falphaT);
77  ef(in*nstate+1,0) += weight * val;
78 
79  //third equation: fb and fk
80  val = 0.;
81  val -= qsi(_XZ_,0) * dphi(0,in); // |
82  val -= qsi(_YZ_,0) * dphi(1,in); // fk
83  val -= qsi(_ZZ_,0) * dphi(2,in); // |
84  val = val/(1+falphaT);
85  ef(in*nstate+2,0) += weight * val;
86  }
87  }
88  else{
89 
90  TPZFMatrix<REAL> dphi = data.dphix;
91  TPZFMatrix<REAL> phi = data.phi;
92 
93  //this matrix will store {{dvdx*dudx, dvdx*dudy, dvdx*dudz},
94  //{dvdy*dudx, dvdy*dudy, dvdy*dudz},
95  //{dvdz*dudx, dvdz*dudy, dvdz*dudz}}
96  TPZFNMatrix<9> Deriv(3,3);
97 
98  int index = data.intGlobPtIndex;
99  TPZFNMatrix<6> qsi;
100  TPZFNMatrix<6> Strain(6,1);
101  TPZFNMatrix<6> qsin1(6,1);
102 
103 
104  qsi = *MemItem(index);
105 
106  TPZFNMatrix<9> DSolXYZ(3,3,0.);
107  DSolXYZ = data.dsol[0];
108  //data.axes.Multiply(data.dsol,DSolXYZ,1/*transpose*/);
109 
110  Strain.Redim(6,1);
111  Strain(_XX_,0) = DSolXYZ(0,0);
112  Strain(_YY_,0) = DSolXYZ(1,1);
113  Strain(_ZZ_,0) = DSolXYZ(2,2);
114  Strain(_XY_,0) = 0.5 * ( DSolXYZ(1,0) + DSolXYZ(0,1) );
115  Strain(_XZ_,0) = 0.5 * ( DSolXYZ(2,0) + DSolXYZ(0,2) );
116  Strain(_YZ_,0) = 0.5 * ( DSolXYZ(2,1) + DSolXYZ(1,2) );
117 
118  qsi = *MemItem(index);
119 
120 
121  REAL tr;
122  tr = Strain(_XX_,0)+Strain(_YY_,0)+Strain(_ZZ_,0);
123 
124  //REAL lambdaE,REAL muE, REAL lambdaV, REAL muV, REAL alphaT
125 
126  qsin1(_XX_,0) = (falphaT*(-(tr)*flambdaV - 2*Strain(_XX_,0)*fmuV) + qsi(_XX_,0))/(1 + falphaT);
127  qsin1(_YY_,0) = (falphaT*(-(tr)*flambdaV - 2*Strain(_YY_,0)*fmuV) + qsi(_YY_,0))/(1 + falphaT);
128  qsin1(_ZZ_,0) = (falphaT*(-(tr)*flambdaV - 2*Strain(_ZZ_,0)*fmuV) + qsi(_ZZ_,0))/(1 + falphaT);
129  qsin1(_XY_,0) = (-2*falphaT*Strain(_XY_,0)*fmuV + qsi(_XY_,0))/(1 + falphaT);
130  qsin1(_XZ_,0) = (-2*falphaT*Strain(_XZ_,0)*fmuV + qsi(_XZ_,0))/(1 + falphaT);
131  qsin1(_YZ_,0) = (-2*falphaT*Strain(_YZ_,0)*fmuV + qsi(_YZ_,0))/(1 + falphaT);
132 
133  //qsin1.Print("qsin1",std::cout);
134  MemItem(index) = qsin1;
135 
136 
137  }
138 
139 }
140 
virtual void Print(std::ostream &out) override
Prints out the data associated with the material.
#define _XZ_
Definition: TPZTensor.h:29
This class implements a 3D isotropic elasticity material.
Definition: pzelast3d.h:21
TPZGradSolVec dsol
vector of the derivatives of the solution at the integration point
REAL val(STATE &number)
Returns value of the variable.
Definition: pzartdiff.h:23
Implements an abstract class implementing the memory features.
Definition: TPZMatWithMem.h:23
TPZFNMatrix< 220, REAL > phi
vector of shapefunctions (format is dependent on the value of shapetype)
TPZFNMatrix< 660, REAL > dphix
values of the derivative of the shape functions
bool fUpdateMem
Flag to indicate whether the memory data are to be updated in an assemble loop.
#define _XX_
Definition: TPZTensor.h:27
#define _YZ_
Definition: TPZTensor.h:31
#define _XY_
Definition: TPZTensor.h:28
int64_t Rows() const
Returns number of rows.
Definition: pzmatrix.h:803
int NStateVariables() const override
Number of state variables.
Definition: pzelast3d.h:73
int intGlobPtIndex
global point index
#define _YY_
Definition: TPZTensor.h:30
int Redim(const int64_t newRows, const int64_t newCols) override
Redimension a matrix and ZERO your elements.
Definition: pzfmatrix.h:616
#define _ZZ_
Definition: TPZTensor.h:32
TPZViscoelastic()
Empty constructor.
STATE fPoisson
Poisson&#39;s ratio.
Definition: pzelast3d.h:261
STATE fE
Young&#39;s modulus.
Definition: pzelast3d.h:258
virtual void Contribute(TPZMaterialData &data, REAL weight, TPZFMatrix< REAL > &ek, TPZFMatrix< REAL > &ef)
virtual TPZFMatrix< STATE > & MemItem(const int i) const