NeoPZ
TPZMatElasticity2D.h
Go to the documentation of this file.
1 //
2 // TPZMatElasticity2D.h
3 // PZ
4 //
5 // Created by Omar on 10/27/14.
6 //
7 //
8 
9 #ifndef __PZ__TPZMatElasticity2D__
10 #define __PZ__TPZMatElasticity2D__
11 
12 #include <stdio.h>
13 #include "TPZMaterial.h"
14 #include "pzvec.h"
15 #include <iostream>
16 
17 
33 
34 protected:
35 
38 
40  REAL m_E;
41 
43  REAL m_nu;
44 
46  REAL m_lambda;
47 
49  REAL m_mu;
50 
52  REAL m_s0_xx;
53  REAL m_s0_xy;
54  REAL m_s0_yy;
55  REAL m_s0_zz;
56 
60 
61 
62 public:
63 
64 virtual int ClassId() const override;
65 
67 
77  TPZMatElasticity2D(int matid, REAL E, REAL nu, REAL fx, REAL fy, int plainstress = 1);
78 
79  TPZMatElasticity2D(int matid);
80 
82 
83  virtual ~TPZMatElasticity2D();
84 
87 
88  virtual TPZMaterial *NewMaterial() override
89  {
90  return new TPZMatElasticity2D(*this);
91  }
92 
93  virtual void Print(std::ostream & out) override;
94 
95  virtual std::string Name() override { return "TPZMatElasticity2D"; }
96 
97  int Dimension() const override {return 2;}
98 
99  virtual int NStateVariables() const override;
100 
109  void SetParameters(REAL Lambda, REAL mu, REAL fx, REAL fy)
110  {
111  m_E = (mu*(3.0*Lambda+2.0*mu))/(Lambda+mu);
112  m_nu = (Lambda)/(2*(Lambda+mu));
113 
114  m_lambda = Lambda;
115  m_mu = mu;
116  m_f[0] = fx;
117  m_f[1] = fy;
118  }
119 
125  void SetElasticParameters(REAL Eyoung, REAL nu)
126  {
127  this->SetElasticity(Eyoung,nu);
128  }
129 
135  void SetElasticity(REAL Ey, REAL nu)
136  {
137  m_E = Ey;
138  m_nu = nu;
139  m_lambda = (Ey*nu)/((1+nu)*(1-2*nu));
140  m_mu = Ey/(2*(1+nu));
141 
142  }
143 
147  {
148  m_plane_stress = 1;
149  }
150 
154  {
155  m_plane_stress = 0;
156  }
157 
159  void SetPreStress(REAL SigmaXX, REAL SigmaXY, REAL SigmaYY, REAL SigmaZZ)
160  {
161  m_s0_xx = SigmaXX;
162  m_s0_xy = SigmaXY;
163  m_s0_yy = SigmaYY;
164  m_s0_zz = SigmaZZ;
165  }
166 
168  void ComputeSigma(const TPZFMatrix<STATE> &dudx, TPZFMatrix<STATE> &sigma);
169 
170  // Get Elastic Materials Parameters
171  void GetElasticParameters(REAL &Ey, REAL &nu, REAL &Lambda, REAL &G)
172  {
173  Ey = m_E;
174  nu = m_nu;
175  Lambda = m_lambda;
176  G = m_mu;
177  }
178 
183  STATE GetEyoung() {return m_E;}
184 
185  STATE GetNu() {return m_nu;}
186 
191  STATE GetLambda() {return m_lambda;}
192 
193  STATE GetMu() {return m_mu;}
194 
195 
196  virtual void FillDataRequirements(TPZMaterialData &data) override;
197 
198  virtual void FillBoundaryConditionDataRequirement(int type, TPZMaterialData &data) override;
199 
207  virtual void Contribute(TPZMaterialData &data, REAL weight, TPZFMatrix<STATE> &ek, TPZFMatrix<STATE> &ef) override;
208  virtual void Contribute(TPZMaterialData &data, REAL weight, TPZFMatrix<STATE> &ef) override;
209  void ContributeVec(TPZMaterialData &data, REAL weight, TPZFMatrix<STATE> &ek, TPZFMatrix<STATE> &ef);
210  void ContributeVec(TPZMaterialData &data, REAL weight, TPZFMatrix<STATE> &ef);
211 
212  virtual void ContributeBC(TPZMaterialData &data, REAL weight, TPZFMatrix<STATE> &ek,TPZFMatrix<STATE> &ef,TPZBndCond &bc) override;
213  virtual void ContributeBC(TPZMaterialData &data, REAL weight, TPZFMatrix<STATE> &ef,TPZBndCond &bc) override;
214 
215  virtual int VariableIndex(const std::string &name) override;
216 
217  virtual int NSolutionVariables(int var) override;
218 
219  //public:
220  virtual void Solution(TPZMaterialData &data, int var, TPZVec<STATE> &Solout) override;
221  virtual void Solution(TPZMaterialData &data, TPZVec<TPZMaterialData> &dataleftvec, TPZVec<TPZMaterialData> &datarightvec, int var, TPZVec<STATE> &Solout, TPZCompEl * Left, TPZCompEl * Right) override {
222  DebugStop();
223  }
224 
229  virtual void Errors(TPZVec<REAL> &x, TPZVec<STATE> &sol, TPZFMatrix<STATE> &dsol,
230  TPZFMatrix<REAL> &axes, TPZVec<STATE> &flux,
231  TPZVec<STATE> &uexact, TPZFMatrix<STATE> &duexact,
232  TPZVec<REAL> &val) override;
233 
234 
238  virtual void Write(TPZStream &buf, int withclassid) const override;
239 
243  void Read(TPZStream &buf, void *context) override;
244 
245 };
246 
247 #endif /* defined(__PZ__TPZMatElasticity2D__) */
void SetPreStress(REAL SigmaXX, REAL SigmaXY, REAL SigmaYY, REAL SigmaZZ)
Set Initial Stress.
virtual void Write(TPZStream &buf, int withclassid) const override
virtual void ContributeBC(TPZMaterialData &data, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef, TPZBndCond &bc) override
It computes a contribution to the stiffness matrix and load vector at one BC integration point...
virtual int NStateVariables() const override
Returns the number of state variables associated with the material.
REAL m_E
Elasticity modulus.
clarg::argBool bc("-bc", "binary checkpoints", false)
TPZMatElasticity2D & operator=(const TPZMatElasticity2D &copy)
virtual void Print(std::ostream &out) override
Prints out the data associated with the material.
virtual std::string Name() override
Returns the name of the material.
int m_plane_stress
plain stress directive
void SetParameters(REAL Lambda, REAL mu, REAL fx, REAL fy)
Set parameters of elastic material:
Templated vector implementation.
REAL m_s0_xx
Initial Stress.
virtual int ClassId() const override
Define the class id associated with the class.
virtual void Solution(TPZMaterialData &data, TPZVec< TPZMaterialData > &dataleftvec, TPZVec< TPZMaterialData > &datarightvec, int var, TPZVec< STATE > &Solout, TPZCompEl *Left, TPZCompEl *Right) override
Returns the solution associated with the var index based on the finite element approximation around o...
REAL val(STATE &number)
Returns value of the variable.
Definition: pzartdiff.h:23
int Dimension() const override
Returns the integrable dimension of the material.
virtual void FillDataRequirements(TPZMaterialData &data) override
Fill material data parameter with necessary requirements for the.
void SetElasticity(REAL Ey, REAL nu)
Set parameters of elastic material:
virtual int NSolutionVariables(int var) override
Returns the number of variables associated with the variable indexed by var.
This abstract class defines the behaviour which each derived class needs to implement.
Definition: TPZMaterial.h:39
virtual void Errors(TPZVec< REAL > &x, TPZVec< STATE > &sol, TPZFMatrix< STATE > &dsol, TPZFMatrix< REAL > &axes, TPZVec< STATE > &flux, TPZVec< STATE > &uexact, TPZFMatrix< STATE > &duexact, TPZVec< REAL > &val) override
Computes the error due to the difference between the interpolated flux and the flux computed based o...
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.
void Read(TPZStream &buf, void *context) override
#define DebugStop()
Returns a message to user put a breakpoint in.
Definition: pzerror.h:20
This class defines the boundary condition for TPZMaterial objects.
Definition: pzbndcond.h:29
void ComputeSigma(const TPZFMatrix< STATE > &dudx, TPZFMatrix< STATE > &sigma)
compute the stress tensor as a function of the solution gradient
REAL m_nu
Poison coeficient.
void ContributeVec(TPZMaterialData &data, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef)
REAL m_lambda
first Lame Parameter
STATE GetLambda()
Get lame parameters Lambda first lame Mu Second lame.
virtual TPZMaterial * NewMaterial() override
To create another material of the same type.
void GetElasticParameters(REAL &Ey, REAL &nu, REAL &Lambda, REAL &G)
void SetPlaneStrain()
Set plane strain problem.
REAL m_mu
Second Lame Parameter.
TPZManVector< STATE, 2 > m_f
Forcing vector.
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...
virtual int VariableIndex(const std::string &name) override
Defines the interface for saving and reading data. Persistency.
Definition: TPZStream.h:50
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 to multip...
STATE GetEyoung()
Get Eyoung and Poisson m_E young modulus m_nu Poisson ratio.
void SetPlaneStress()
Set plane stress problem.
Defines the interface of a computational element. Computational Element.
Definition: pzcompel.h:59
Description Linear elastic equations.
void SetElasticParameters(REAL Eyoung, REAL nu)
Set parameters of elastic material: