NeoPZ
pzelasthybrid.cpp
Go to the documentation of this file.
1 //
2 // pzelasthybrid.cpp
3 // PZ
4 //
5 // Created by Joao on 18/09/12.
6 //
7 //
13 #include "pzelasthybrid.h"
14 
15 #include "pzelasmat.h"
16 #include "pzelmat.h"
17 #include "pzbndcond.h"
18 #include "pzmatrix.h"
19 #include "pzfmatrix.h"
20 #include "pzerror.h"
21 #include <math.h>
22 
23 #include "pzlog.h"
24 #ifdef LOG4CXX
25 static LoggerPtr logdata(Logger::getLogger("pz.material.elasticity.data"));
26 #endif
27 
28 #include <fstream>
29 using namespace std;
30 
33 }
34 
35 TPZElasticityHybridMaterial::TPZElasticityHybridMaterial(int num, REAL E, REAL nu, REAL fx, REAL fy, int plainstress) :
37 TPZElasticityMaterial(num, E, nu, fx, fy, plainstress) {
38 
39 }
40 
42 }
43 
45  return 2;
46 }
47 
49 
50  std::cout<<" Passou pelo Contribute"<<std::endl;
52  if(shapetype==data.EVecShape){
53  ContributeVecShape(data,weight,ek, ef);
54  return;
55  }
56 
57  TPZFMatrix<REAL> &dphi = data.dphix;
58  TPZFMatrix<REAL> &phi = data.phi;
59  TPZFMatrix<REAL> &axes=data.axes;
60 
61  int phc,phr,dphc,dphr,efr,efc,ekr,ekc;
62  phc = phi.Cols();
63  phr = phi.Rows();
64  dphc = dphi.Cols();
65  dphr = dphi.Rows();
66  efr = ef.Rows();
67  efc = ef.Cols();
68  ekr = ek.Rows();
69  ekc = ek.Cols();
70  if(phc != 1 || dphr != 2 || phr != dphc ||
71  ekr != phr*2 || ekc != phr*2 ||
72  efr != phr*2 ){
73  PZError << "\nTPZElasticityMaterial.contr, inconsistent input data : \n" <<
74  "phi.Cols() = " << phi.Cols() << " dphi.Cols() = " << dphi.Cols() <<
75  " phi.Rows = " << phi.Rows() << " dphi.Rows = " <<
76  dphi.Rows() << "\nek.Rows() = " << ek.Rows() << " ek.Cols() = "
77  << ek.Cols() <<
78  "\nef.Rows() = " << ef.Rows() << " ef.Cols() = "
79  << ef.Cols() << "\n";
80  return;
81  // PZError.show();
82  }
83  if(fForcingFunction) { // phi(in, 0) : node in associated forcing function
85  fForcingFunction->Execute(data.x,res);
86  ff[0] = res[0];
87  ff[1] = res[1];
88  ff[2] = res[2];
89  }
90 
91  TPZFMatrix<STATE> du(2,2);
92  /*
93  * Plain strain materials values
94  */
95  REAL nu1 = 1 - fnu;//(1-nu)
96  REAL nu2 = (1-2*fnu)/2;
97  REAL F = fE/((1+fnu)*(1-2*fnu));
98 
99  for( int in = 0; in < phr; in++ ) {
100  du(0,0) = dphi(0,in)*axes(0,0)+dphi(1,in)*axes(1,0);
101  du(1,0) = dphi(0,in)*axes(0,1)+dphi(1,in)*axes(1,1);
102 
103  for (int col = 0; col < efc; col++)
104  {
105  ef(2*in, col) += weight * (ff[0] * phi(in, 0)- du(0,0)*fPreStressXX - du(1,0)*fPreStressXY); // dire�o x
106  ef(2*in+1, col) += weight * (ff[1] * phi(in, 0)- du(0,0)*fPreStressYY - du(1,0)*fPreStressXY);// dire�o y <<<----
107  }
108  for( int jn = 0; jn < phr; jn++ ) {
109  du(0,1) = dphi(0,jn)*axes(0,0)+dphi(1,jn)*axes(1,0);
110  du(1,1) = dphi(0,jn)*axes(0,1)+dphi(1,jn)*axes(1,1);
111 
112 
113  if (fPlaneStress != 1){
114  /* Plain Strain State */
115  ek(2*in,2*jn) += weight * (
116  nu1 * du(0,0)*du(0,1)+ nu2 * du(1,0)*du(1,1)
117  ) * F;
118 
119  ek(2*in,2*jn+1) += weight * (
120  fnu*du(0,0)*du(1,1)+ nu2*du(1,0)*du(0,1)
121  ) * F;
122 
123  ek(2*in+1,2*jn) += weight * (
124  fnu*du(1,0)*du(0,1)+ nu2*du(0,0)*du(1,1)
125  ) * F;
126 
127  ek(2*in+1,2*jn+1) += weight * (
128  nu1*du(1,0)*du(1,1)+ nu2*du(0,0)*du(0,1)
129  ) * F;
130  }
131  else{
132  /* Plain stress state */
133  ek(2*in,2*jn) += weight * (
134  fEover1MinNu2 * du(0,0)*du(0,1)+ fEover21PlusNu * du(1,0)*du(1,1)
135  );
136 
137  ek(2*in,2*jn+1) += weight * (
138  fEover1MinNu2*fnu*du(0,0)*du(1,1)+ fEover21PlusNu*du(1,0)*du(0,1)
139  );
140 
141  ek(2*in+1,2*jn) += weight * (
142  fEover1MinNu2*fnu*du(1,0)*du(0,1)+ fEover21PlusNu*du(0,0)*du(1,1)
143  );
144 
145  ek(2*in+1,2*jn+1) += weight * (
146  fEover1MinNu2*du(1,0)*du(1,1)+ fEover21PlusNu*du(0,0)*du(0,1)
147  );
148  }
149  }
150  }
151 
152  //#ifdef LOG4CXX
153  // if(logdata->isDebugEnabled())
154  // {
155  // std::stringstream sout;
156  // ek.Print("ek_elastmat = ",sout,EMathematicaInput);
157  // ef.Print("ef_elastmat = ",sout,EMathematicaInput);
158  // LOGPZ_DEBUG(logdata,sout.str())
159  // }
160  //#endif
161 
162 }
163 
165  std::cout<< "Passou ContributeInterface"<< std::endl;
166 }
167 
169  std::cout<< "Passou ContributeBCInterface"<< std::endl;
170 }
171 
172 
176 {
177 }
178 
179 
181  return Hash("TPZElasticityHybridMaterial") ^ TPZElasticityMaterial::ClassId() << 1;
182 }
183 
184 
185 
virtual void Execute(const TPZVec< REAL > &x, TPZVec< TVar > &f, TPZFMatrix< TVar > &df)
Performs function computation.
Definition: pzfunction.h:38
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
REAL fPreStressXX
Pre Stress Tensor - Sigma XX.
Definition: pzelasthybrid.h:97
Implements a vector class which allows to use external storage provided by the user. Utility.
Definition: pzquad.h:16
virtual void Contribute(TPZMaterialData &data, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef) override
Calculates the element stiffness matrix.
clarg::argBool bc("-bc", "binary checkpoints", false)
REAL ff[3]
Forcing vector.
Definition: pzelasthybrid.h:88
This class implements a two dimensional elastic material to hybrid method. It is derived from the cla...
Definition: pzelasthybrid.h:28
Defines PZError.
MShapeFunctionType fShapeType
REAL fnu
Poison coeficient.
Definition: pzelasthybrid.h:85
REAL fPreStressXY
Pre Stress Tensor - Sigma XY.
virtual ~TPZElasticityHybridMaterial()
Default destructor.
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
Contains declaration of TPZElementMatrix struct which associates an element matrix with the coeficien...
int fPlaneStress
Uses plain stress.
Contains the TPZBndCond class which implements a boundary condition for TPZMaterial objects...
virtual int ClassId() const override
Unique identifier for serialization purposes.
Definition: pzelasmat.cpp:1253
REAL fE
Elasticity modulus.
Definition: pzelasthybrid.h:82
Contains TPZMatrixclass which implements full matrix (using column major representation).
This class defines the boundary condition for TPZMaterial objects.
Definition: pzbndcond.h:29
Contains the TPZElasticityMaterial class which implements a two dimensional elastic material in plane...
REAL fPreStressYY
Pre Stress Tensor - Sigma YY.
void ContributeVecShape(TPZMaterialData &data, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef)
Calculates the element stiffness matrix - simulate compaction as aditional variable.
Definition: pzelasmat.cpp:433
int64_t Rows() const
Returns number of rows.
Definition: pzmatrix.h:803
TPZFNMatrix< 9, REAL > axes
axes indicating the directions of the derivatives of the shapefunctions
string res
Definition: test.py:151
REAL E()
Returns the elasticity modulus E.
Definition: pzelasmat.h:220
int32_t Hash(std::string str)
Definition: TPZHash.cpp:10
Contains TPZMatrix<TVar>class, root matrix class.
TPZAutoPointer< TPZFunction< STATE > > fForcingFunction
Pointer to forcing function, it is the right member at differential equation.
Definition: TPZMaterial.h:47
virtual int NStateVariables() const override
Returns the number of state variables associated with the material.
This class implements a two dimensional elastic material in plane stress or strain.
Definition: pzelasmat.h:19
int64_t Cols() const
Returns number of cols.
Definition: pzmatrix.h:809
TPZElasticityHybridMaterial()
Default constructor.
virtual void ContributeBCInterface(TPZMaterialData &data, TPZMaterialData &dataleft, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef, TPZBndCond &bc) override
It computes a contribution to stiffness matrix and load vector at one BC integration point...
Contains the TPZElasticityHybridMaterial class which implements a two dimensional elastic material to...
virtual void ContributeInterface(TPZMaterialData &data, TPZMaterialData &dataleft, TPZMaterialData &dataright, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef) override
It computes a contribution to stiffness matrix and load vector at one integration point...
virtual int ClassId() const override
Unique identifier for serialization purposes.
#define PZError
Defines the output device to error messages and the DebugStop() function.
Definition: pzerror.h:15