NeoPZ
pzelast3d.h
Go to the documentation of this file.
1 
6 #ifndef PZELAST3D
7 #define PZELAST3D
8 
9 #include <iostream>
10 #include "TPZMaterial.h"
11 #include "pzfmatrix.h"
12 #include "pzvec.h"
13 #include <vector>
14 
15 
21 class TPZElasticity3D : public TPZMaterial {
22 
23  private:
24 
26 
27  STATE VonMisesPlasticFunction( TPZFMatrix<STATE> & StressTensor) const;
28 
29  STATE MohrCoulombPlasticFunction( TPZFMatrix<STATE> & StressTensor) const;
30 
31  void Invariants( TPZFMatrix<STATE> & A, STATE & I1, STATE & I2, STATE & I3) const;
32 
33  void StressDecomposition( TPZFMatrix<STATE> & StressTensor, TPZFMatrix<STATE> & Deviator, STATE & p) const;
34 
35  public :
36 
41 
42 
43 
51  TPZElasticity3D(int nummat, STATE E, STATE poisson, TPZVec<STATE> &force,
52  STATE preStressXX = 0., STATE preStressYY = 0., STATE preStressZZ = 0.);
53 
58  TPZElasticity3D(int nummat);
59 
62 
65 
67  virtual ~TPZElasticity3D();
68 
70  int Dimension() const override { return 3;}
71 
73  int NStateVariables() const override { return 3;}
74 
79  virtual int IntegrationRuleOrder(int elPMaxOrder) const override
80  {
81  return 2*(elPMaxOrder);
82  }
83 
85  virtual void Print(std::ostream & out) override;
86 
92  if (Direction.NElements() != 3){
93  PZError << __PRETTY_FUNCTION__ << " - ERROR!\n";
94  }
96  for(int i = 0; i < 3; i++) this->fPostProcessDirection[i] = Direction[i];
97  }
98 
99  void SetVonMises(REAL fy){
100  this->fFy = fy;
101  this->fFrictionAngle = 0.;
102  this->fCohesion = 0.;
103  this->fPlasticPostProc = EVonMises;
104  }
105 
106  void SetMohrCoulomb(REAL fc, REAL ft){
107  this->fFy = 0.;
108  this->fFrictionAngle = asin( (fc-ft)/(fc+ft) );
109  this->fCohesion = fc*ft/(fc-ft) * tan(fFrictionAngle);
111  }
112 
114  virtual std::string Name() override { return "TPZElasticity3D"; }
115 
116  virtual void Contribute(TPZMaterialData &data,
117  REAL weight,
118  TPZFMatrix<STATE> &ek,
119  TPZFMatrix<STATE> &ef) override;
120 
121  virtual void Contribute(TPZMaterialData &data,
122  REAL weight,
123  TPZFMatrix<STATE> &ef) override
124  {
125  TPZMaterial::Contribute(data,weight,ef);
126  }
127 
128  virtual void ContributeVecShape(TPZMaterialData &data,REAL weight,TPZFMatrix<STATE> &ek,TPZFMatrix<STATE> &ef);
129 
131  virtual void ContributeBC(TPZMaterialData &data,
132  REAL weight,
133  TPZFMatrix<STATE> &ek,
134  TPZFMatrix<STATE> &ef,
135  TPZBndCond &bc) override;
136 
137  virtual void ContributeVecShapeBC(TPZMaterialData & data, REAL weight,
139 
141  virtual void ContributeBC(TPZMaterialData &data,
142  REAL weight,
143  TPZFMatrix<STATE> &ef,
144  TPZBndCond &bc) override
145  {
146  TPZMaterial::ContributeBC(data,weight,ef,bc);
147  }
148 
150  virtual int VariableIndex(const std::string &name) override;
151 
153  virtual int NSolutionVariables(int var) override;
154 protected:
156  virtual void Solution(TPZVec<STATE> &Sol,TPZFMatrix<STATE> &DSol,TPZFMatrix<REAL> &axes,int var,TPZVec<STATE> &Solout) override;
157 public:
159  virtual void Solution(TPZMaterialData &data, int var, TPZVec<STATE> &Solout) override
160  {
161  TPZMaterial::Solution(data,var,Solout);
162  }
163 
168  virtual int NFluxes() override {
169  PZError << "\nTPZElasticity3D::NFluxes() - Method not implemented\n";
170  return 0;
171  }
172 
177  virtual void Flux(TPZVec<REAL> &x, TPZVec<STATE> &Sol, TPZFMatrix<STATE> &DSol, TPZFMatrix<REAL> &axes, TPZVec<STATE> &flux) override {
178  PZError << "\nTPZElasticity3D::Flux - Method not implemented\n";
179  }
180 
182  virtual void Errors(TPZVec<REAL> &x,TPZVec<STATE> &u, TPZFMatrix<STATE> &dudx,
183  TPZFMatrix<REAL> &axes, TPZVec<STATE> &flux,
184  TPZVec<STATE> &u_exact,TPZFMatrix<STATE> &du_exact,TPZVec<REAL> &values) override;
186  virtual int NEvalErrors() override {return 3;}
187 
189  void FillDataRequirements(TPZMaterialData &data) override;
190 
192  virtual void FillBoundaryConditionDataRequirement(int type,TPZMaterialData &data) override
193  {
194  // default is no specific data requirements
195  if(type == 50)
196  {
197  data.fNeedsSol = true;
198  }
199  data.fNeedsNormal = true;
200  }
201 
202  void SetMaterialDataHook(REAL Ela, REAL poisson)
203  {
204  fE = Ela;
205  fPoisson = poisson;
206  SetC();
207  }
208 
209  void SetMaterialDataLame(REAL lambda, REAL mu)
210  {
211  fE = mu*((REAL(3))*lambda+((REAL(2))*mu))/(lambda + mu);
212  fPoisson = lambda/((REAL(2))*(lambda + mu));
213  SetC();
214  }
215 
216  void SetC()
217  {
218  C1 = fE / (2.+ 2.*fPoisson);
219  C2 = fE * fPoisson / (-1. + fPoisson + 2.*fPoisson*fPoisson);
220  C3 = fE * (fPoisson - 1.) / (-1. + fPoisson +2. * fPoisson * fPoisson);
221  }
222 
224  {
225  for(int i = 0; i < 3; i++) this->fForce[i] = force[i];
226  }
227 
228  STATE GetE()
229  {
230  return fE;
231  }
232 
233  STATE GetPoisson()
234  {
235  return fPoisson;
236  }
237 
238  STATE GetLambda()
239  {
240  STATE lambda = (fPoisson*fE)/((1.+fPoisson)*(1.-2.*fPoisson));
241  return lambda;
242  }
243 
244  STATE GetMU()
245  {
246  STATE mu = fE/(2.*(1.+fPoisson));
247  return mu;
248  }
249 
250  STATE GetPrestress(int index)
251  {
252  return this->fPreStress[index];
253  }
254 
255  protected :
256 
258  STATE fE;
259 
261  STATE fPoisson;
262 
263  REAL C1;
264  REAL C2;
265  REAL C3;
268 
271 
273  REAL fFy;
274 
277 
280 
281  TPZManVector<REAL> fPreStress;//just prestress XX, YY and ZZ
282 
283 public:
284  virtual void ComputeStressVector(TPZFMatrix<STATE> &Stress, TPZFMatrix<STATE> &DSol) const;
285  void ComputeStrainVector(TPZFMatrix<STATE> &Strain, TPZFMatrix<STATE> &DSol) const;
286  virtual void ComputeStressTensor(TPZFMatrix<STATE> &Stress, TPZMaterialData &data) const;
287  void ComputeStressTensor(TPZFMatrix<STATE> &Stress, TPZFMatrix<STATE> &DSol) const;
288  void ComputeStrainTensor(TPZFMatrix<STATE> &Strain, TPZFMatrix<STATE> &DSol) const;
289  void ApplyDirection(TPZFMatrix<STATE> &StrVec, TPZVec<STATE> &Out) const;
290  void PrincipalDirection(TPZFMatrix<STATE> &DSol, TPZVec< STATE > &Solout, int direction) const;
291 
292 public:
294  virtual void Write(TPZStream &buf, int withclassid) const override;
295 
297  virtual void Read(TPZStream &buf, void *context) override;
298  public:
299 virtual int ClassId() const override;
300 
302  virtual TPZMaterial * NewMaterial() override { return new TPZElasticity3D(*this);}
303 
304  static STATE gTolerance;
305 
306 };
307 
308 #endif
virtual void Write(TPZStream &buf, int withclassid) const override
Saves the element data to a stream.
Definition: pzelast3d.cpp:1245
virtual void Solution(TPZMaterialData &data, int var, TPZVec< STATE > &Solout)
Returns the solution associated with the var index based on the finite element approximation.
void ComputeStrainVector(TPZFMatrix< STATE > &Strain, TPZFMatrix< STATE > &DSol) const
Definition: pzelast3d.cpp:1148
REAL fFy
Yeilding stress for von mises post processing.
Definition: pzelast3d.h:273
STATE GetPoisson()
Definition: pzelast3d.h:233
void SetVonMises(REAL fy)
Definition: pzelast3d.h:99
void PrincipalDirection(TPZFMatrix< STATE > &DSol, TPZVec< STATE > &Solout, int direction) const
Definition: pzelast3d.cpp:1182
virtual void Contribute(TPZMaterialData &data, REAL weight, TPZFMatrix< STATE > &ef) override
It computes a contribution to the residual vector at one integration point.
Definition: pzelast3d.h:121
virtual void ContributeVecShapeBC(TPZMaterialData &data, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef, TPZBndCond &bc)
Definition: pzelast3d.cpp:509
void SetMaterialDataLame(REAL lambda, REAL mu)
Definition: pzelast3d.h:209
clarg::argBool bc("-bc", "binary checkpoints", false)
virtual void Solution(TPZVec< STATE > &Sol, TPZFMatrix< STATE > &DSol, TPZFMatrix< REAL > &axes, int var, TPZVec< STATE > &Solout) override
Post-processing method. Based on solution Sol and its derivatives DSol, it computes the post-processe...
Definition: pzelast3d.cpp:831
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.
Definition: pzelast3d.h:159
virtual void Flux(TPZVec< REAL > &x, TPZVec< STATE > &Sol, TPZFMatrix< STATE > &DSol, TPZFMatrix< REAL > &axes, TPZVec< STATE > &flux) override
Compute the value of the flux function to be used by ZZ error estimator.
Definition: pzelast3d.h:177
int Dimension() const override
Returns model dimension.
Definition: pzelast3d.h:70
Templated vector implementation.
This class implements a 3D isotropic elasticity material.
Definition: pzelast3d.h:21
PLASTICPOSTPROC fPlasticPostProc
Plastic model for post-processing.
Definition: pzelast3d.h:279
virtual void Contribute(TPZMaterialData &data, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef) override
It computes a contribution to the stiffness matrix and load vector at one integration point...
Definition: pzelast3d.cpp:88
virtual void ContributeVecShape(TPZMaterialData &data, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef)
Definition: pzelast3d.cpp:417
static STATE gTolerance
Definition: pzelast3d.h:304
void ApplyDirection(TPZFMatrix< STATE > &StrVec, TPZVec< STATE > &Out) const
Definition: pzelast3d.cpp:1174
void Invariants(TPZFMatrix< STATE > &A, STATE &I1, STATE &I2, STATE &I3) const
Definition: pzelast3d.cpp:1202
virtual void Contribute(TPZMaterialData &data, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef)=0
It computes a contribution to the stiffness matrix and load vector at one integration point...
virtual TPZMaterial * NewMaterial() override
Creates a new material from the current object ??
Definition: pzelast3d.h:302
virtual void ComputeStressTensor(TPZFMatrix< STATE > &Stress, TPZMaterialData &data) const
Definition: pzelast3d.cpp:1128
void StressDecomposition(TPZFMatrix< STATE > &StressTensor, TPZFMatrix< STATE > &Deviator, STATE &p) const
Definition: pzelast3d.cpp:1209
virtual void Resize(const int64_t newsize, const T &object)
Resizes the vector object.
Definition: pzmanvector.h:426
REAL fFrictionAngle
Mohr-Coulomb parameters.
Definition: pzelast3d.h:276
virtual int ClassId() const override
Define the class id associated with the class.
Definition: pzelast3d.cpp:1272
This abstract class defines the behaviour which each derived class needs to implement.
Definition: TPZMaterial.h:39
virtual void ContributeBC(TPZMaterialData &data, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef, TPZBndCond &bc) override
Implements Dirichlet and Neumann boundary conditions.
Definition: pzelast3d.cpp:612
void SetForce(TPZVec< STATE > force)
Definition: pzelast3d.h:223
virtual void Print(std::ostream &out) override
Print material report.
Definition: pzelast3d.cpp:77
virtual int NFluxes() override
Return the number of components which form the flux function.
Definition: pzelast3d.h:168
TPZManVector< REAL, 3 > fPostProcessDirection
Direction to compute stress and strain.
Definition: pzelast3d.h:270
TPZManVector< REAL > fPreStress
Definition: pzelast3d.h:281
virtual ~TPZElasticity3D()
Default destructor.
Definition: pzelast3d.cpp:64
void FillDataRequirements(TPZMaterialData &data) override
Fill material data parameter with necessary requirements for the Contribute method.
Definition: pzelast3d.cpp:1276
Contains TPZMatrixclass which implements full matrix (using column major representation).
virtual std::string Name() override
Material name.
Definition: pzelast3d.h:114
expr_ expr_ tan
Definition: tfadfunc.h:70
This class defines the boundary condition for TPZMaterial objects.
Definition: pzbndcond.h:29
virtual int IntegrationRuleOrder(int elPMaxOrder) const override
Gets the order of the integration rule necessary to integrate an element with polinomial order p...
Definition: pzelast3d.h:79
void SetMohrCoulomb(REAL fc, REAL ft)
Definition: pzelast3d.h:106
STATE MohrCoulombPlasticFunction(TPZFMatrix< STATE > &StressTensor) const
Definition: pzelast3d.cpp:1227
virtual int NEvalErrors() override
Returns the number of norm errors: 3 (Semi H1, L2 and H1)
Definition: pzelast3d.h:186
int NStateVariables() const override
Number of state variables.
Definition: pzelast3d.h:73
virtual void ContributeBC(TPZMaterialData &data, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef, TPZBndCond &bc)=0
It computes a contribution to the stiffness matrix and load vector at one BC integration point...
STATE GetE()
Definition: pzelast3d.h:228
void SetPostProcessingDirection(TPZVec< REAL > &Direction)
Direction to post process stress and strain. Result of post processing is (Stress.Direction) or (Strain.Direction)
Definition: pzelast3d.h:91
virtual void Read(TPZStream &buf, void *context) override
Reads the element data from a stream.
Definition: pzelast3d.cpp:1258
void ComputeStrainTensor(TPZFMatrix< STATE > &Strain, TPZFMatrix< STATE > &DSol) const
Definition: pzelast3d.cpp:1115
virtual void ComputeStressVector(TPZFMatrix< STATE > &Stress, TPZFMatrix< STATE > &DSol) const
Definition: pzelast3d.cpp:1158
STATE GetMU()
Definition: pzelast3d.h:244
void SetMaterialDataHook(REAL Ela, REAL poisson)
Definition: pzelast3d.h:202
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...
Definition: pzelast3d.h:192
STATE fPoisson
Poisson&#39;s ratio.
Definition: pzelast3d.h:261
virtual void ContributeBC(TPZMaterialData &data, REAL weight, TPZFMatrix< STATE > &ef, TPZBndCond &bc) override
Implements Dirichlet and Neumann boundary conditions.
Definition: pzelast3d.h:141
expr_ expr_ expr_ expr_ expr_ expr_ asin
Definition: tfadfunc.h:80
TPZManVector< STATE, 3 > fForce
External forces.
Definition: pzelast3d.h:267
Defines the interface for saving and reading data. Persistency.
Definition: TPZStream.h:50
STATE fE
Young&#39;s modulus.
Definition: pzelast3d.h:258
int64_t NElements() const
Returns the number of elements of the vector.
Definition: pzvec.h:190
virtual 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
Evaluate error between approximate (FEM) and exact solutions.
Definition: pzelast3d.cpp:1074
def values
Definition: rdt.py:119
STATE VonMisesPlasticFunction(TPZFMatrix< STATE > &StressTensor) const
Definition: pzelast3d.cpp:1216
virtual int VariableIndex(const std::string &name) override
Returns index of post-processing variable.
Definition: pzelast3d.cpp:771
STATE GetPrestress(int index)
Definition: pzelast3d.h:250
TPZElasticity3D()
Default constructor.
Definition: pzelast3d.cpp:57
virtual int NSolutionVariables(int var) override
Number of data of variable var.
Definition: pzelast3d.cpp:798
#define PZError
Defines the output device to error messages and the DebugStop() function.
Definition: pzerror.h:15
STATE GetLambda()
Definition: pzelast3d.h:238