NeoPZ
pzelasmat.h
Go to the documentation of this file.
1 
6 #ifndef ELASMATHPP
7 #define ELASMATHPP
8 
9 #include <iostream>
10 
11 #include "TPZMaterial.h"
12 #include "pzdiscgal.h"
13 
14 
20 
21  public :
22 
34  TPZElasticityMaterial(int id, REAL E, REAL nu, REAL fx, REAL fy, int planestress = 1);
35 
36  TPZElasticityMaterial(int id);
37 
40 
42  virtual TPZMaterial * NewMaterial() override { return new TPZElasticityMaterial(*this);}
43 
45  virtual ~TPZElasticityMaterial();
46 
48  void SetElasticity(REAL E, REAL nu)
49  {
50  fE_def = E; // Young modulus
51  fnu_def = nu; // poisson coefficient
52 
53  }
54 
57  {
58  fElasticity = func;
59  }
60 
63  {
64  fPlaneStress = 0;
65  }
66 
69  {
70  fPlaneStress = 1;
71  }
72 
74  void SetBodyForce(REAL fx, REAL fy)
75  {
76  ff[0] = fx;
77  ff[1] = fy;
78  ff[2] = 0.;
79  }
81  int Dimension() const override { return 2;}
82 
84  virtual int NStateVariables() const override;
85 
87  virtual void Print(std::ostream & out = std::cout) override;
88 
90  std::string Name() override { return "TPZElasticityMaterial"; }
91 
93  virtual short NumberOfFluxes(){return 3;}
94 
96  virtual int NFluxes() override { return 3;}
97 
102  virtual void Contribute(TPZMaterialData &data, REAL weight,TPZFMatrix<STATE> &ek,TPZFMatrix<STATE> &ef) override;
103 
105  virtual void Contribute(TPZVec<TPZMaterialData> &data, REAL weight,TPZFMatrix<STATE> &ek,TPZFMatrix<STATE> &ef) override;
106 
108 // virtual void Contribute(TPZVec<TPZMaterialData> &data, REAL weight, TPZFMatrix<STATE> &ef)
109 // {
110 // DebugStop();
111 // }
112 
114 
116  virtual void Contribute(TPZMaterialData &data, REAL weight,TPZFMatrix<STATE> &ef) override
117  {
118  TPZDiscontinuousGalerkin::Contribute(data,weight,ef);
119  }
120 
121 
132  virtual void ContributeBC(TPZVec<TPZMaterialData> &datavec, REAL weight, TPZFMatrix<STATE> &ek, TPZFMatrix<STATE> &ef, TPZBndCond &bc) override;
133 
135  virtual void ContributeBC(TPZMaterialData &data,REAL weight,
136  TPZFMatrix<STATE> &ek,TPZFMatrix<STATE> &ef,TPZBndCond &bc) override;
137 
138  void ContributeVecShapeBC(TPZMaterialData &data,REAL weight,
140 
142  virtual void ContributeBC(TPZMaterialData &data,REAL weight,
143  TPZFMatrix<STATE> &ef,TPZBndCond &bc) override
144  {
145  TPZDiscontinuousGalerkin::ContributeBC(data,weight,ef,bc);
146  }
147 
148  //virtual void FillDataRequirements(TPZMaterialData &data);
149  virtual void FillDataRequirements(TPZMaterialData &data) override;
150  virtual void FillBoundaryConditionDataRequirement(int type, TPZMaterialData &data) override;
151 
152 
153 
154  virtual void ContributeInterface(TPZMaterialData &data, TPZMaterialData &dataleft, TPZMaterialData &dataright, REAL weight, TPZFMatrix<STATE> &ek, TPZFMatrix<STATE> &ef) override {
155  PZError << "\nFATAL ERROR - Method not implemented: " << __PRETTY_FUNCTION__ << "\n";
156  }
157 
158  virtual void ContributeBCInterface(TPZMaterialData &data, TPZMaterialData &dataleft, REAL weight, TPZFMatrix<STATE> &ek,TPZFMatrix<STATE> &ef,TPZBndCond &bc) override {
159  PZError << "\nFATAL ERROR - Method not implemented: " << __PRETTY_FUNCTION__ << "\n";
160  }
161 
162  virtual void ContributeInterface(TPZMaterialData &data, TPZMaterialData &dataleft, TPZMaterialData &dataright, REAL weight, TPZFMatrix<STATE> &ef) override {
163  PZError << "\nFATAL ERROR - Method not implemented: " << __PRETTY_FUNCTION__ << "\n";
164  }
165 
166  virtual void ContributeBCInterface(TPZMaterialData &data, TPZMaterialData &left, REAL weight, TPZFMatrix<STATE> &ef,TPZBndCond &bc) override {
167  PZError << "\nFATAL ERROR - Method not implemented: " << __PRETTY_FUNCTION__ << "\n";
168  }
169 
173  virtual int VariableIndex(const std::string &name) override;
174 
178  virtual int NSolutionVariables(int var) override;
179 
180  STATE GetLambda(REAL E, REAL nu) const
181  {
182  STATE lambda = (nu*E)/((1.+nu)*(1.-2.*nu));
183  return lambda;
184  }
185 
186  STATE GetMU(REAL E, REAL nu) const
187  {
188  STATE mu = E/(2.*(1.+nu));
189  return mu;
190  }
191 
192 public:
193 
195  virtual void Solution(TPZMaterialData &data, int var, TPZVec<STATE> &Solout) override;
196 
198  virtual void SolutionDisc(TPZMaterialData &data, TPZMaterialData &dataleft, TPZMaterialData &dataright, int var, TPZVec<STATE> &Solout)
199  {
200  TPZDiscontinuousGalerkin::SolutionDisc(data,dataleft,dataright,var,Solout);
201  }
202 
204  virtual void Flux(TPZVec<REAL> &x, TPZVec<STATE> &Sol, TPZFMatrix<STATE> &DSol, TPZFMatrix<REAL> &axes, TPZVec<STATE> &flux) override;
205 
207  virtual int NEvalErrors() override {return 6;}
208 
209 
210 
215  virtual void Errors(TPZVec<REAL> &x,TPZVec<STATE> &u,
217  TPZVec<STATE> &u_exact,TPZFMatrix<STATE> &du_exact,TPZVec<REAL> &values) override;//Cedric
218 
220  REAL E() {return fE_def;}
221 
223  REAL Nu() {return fnu_def;}
224 
226  void SetPreStress(REAL Sigxx, REAL Sigyy, REAL Sigxy, REAL Sigzz);
227 
228  public:
229 virtual int ClassId() const override;
230 
231 
232  virtual void Read(TPZStream &buf, void *context) override;
233 
234  virtual void Write(TPZStream &buf, int withclassid) const override;
235 
236 
237 
238 protected:
240  REAL fE_def;
241 
243  REAL fnu_def;
244 
247 
250 
253 
256 
259 
262 
265 
268 
271 
272 };
273 
274 #endif
virtual void Print(std::ostream &out=std::cout) override
Print the material data.
Definition: pzelasmat.cpp:92
Defines the interface which material objects need to implement for discontinuous Galerkin formulation...
Definition: pzdiscgal.h:20
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...
Definition: pzelasmat.h:158
void SolutionDisc(TPZMaterialData &data, TPZMaterialData &dataleft, TPZMaterialData &dataright, int var, TPZVec< STATE > &Solout)
Returns the solution associated with the var index based on the finite element approximation.
Definition: pzdiscgal.h:176
int fPlaneStress
Uses plain stress.
Definition: pzelasmat.h:270
STATE GetMU(REAL E, REAL nu) const
Definition: pzelasmat.h:186
REAL Nu()
Returns the poison coefficient modulus E.
Definition: pzelasmat.h:223
REAL fPreStressYY
Pre Stress Tensor - Sigma YY.
Definition: pzelasmat.h:261
clarg::argBool bc("-bc", "binary checkpoints", false)
virtual void ContributeBC(TPZMaterialData &data, REAL weight, TPZFMatrix< STATE > &ef, TPZBndCond &bc) override
Applies the element boundary conditions.
Definition: pzelasmat.h:142
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.
Definition: pzelasmat.cpp:1128
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: pzelasmat.cpp:886
REAL fPreStressZZ
Pre Stress Tensor - Sigma ZZ.
Definition: pzelasmat.h:267
TPZElasticityMaterial()
Default constructor.
Definition: pzelasmat.cpp:24
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
Computes the error due to the difference between the interpolated flux and the flux computed based o...
Definition: pzelasmat.cpp:1135
void SetPlaneStrain()
Set the material configuration to plane strain.
Definition: pzelasmat.h:62
REAL fPreStressXY
Pre Stress Tensor - Sigma XY.
Definition: pzelasmat.h:264
virtual void FillDataRequirements(TPZMaterialData &data) override
Fill material data parameter with necessary requirements for the.
Definition: pzelasmat.cpp:417
void SetElasticity(REAL E, REAL nu)
Set elasticity parameters.
Definition: pzelasmat.h:48
This class implements a simple vector storage scheme for a templated class T. Utility.
Definition: pzgeopoint.h:19
virtual void Contribute(TPZMaterialData &data, REAL weight, TPZFMatrix< STATE > &ef) override
Calculates the element stiffness matrix.
Definition: pzelasmat.h:116
void SetElasticityFunction(TPZAutoPointer< TPZFunction< STATE > > func)
Set a variable elasticity and poisson coefficient.
Definition: pzelasmat.h:56
void SetPreStress(REAL Sigxx, REAL Sigyy, REAL Sigxy, REAL Sigzz)
Set PresStress Tensor.
Definition: pzelasmat.cpp:112
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...
Definition: pzelasmat.h:154
virtual int NSolutionVariables(int var) override
Returns the number of variables associated with the variable indexed by var.
Definition: pzelasmat.cpp:840
This abstract class defines the behaviour which each derived class needs to implement.
Definition: TPZMaterial.h:39
void ContributeVecShapeBC(TPZMaterialData &data, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef, TPZBndCond &bc)
Definition: pzelasmat.cpp:700
virtual int ClassId() const override
Unique identifier for serialization purposes.
Definition: pzelasmat.cpp:1253
virtual void Read(TPZStream &buf, void *context) override
Reads the element data from a stream.
Definition: pzelasmat.cpp:1261
virtual void ContributeBC(TPZMaterialData &data, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef, TPZBndCond &bc) override=0
It computes a contribution to the stiffness matrix and load vector at one BC integration point...
This class defines the boundary condition for TPZMaterial objects.
Definition: pzbndcond.h:29
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
virtual int NEvalErrors() override
Returns the number of norm errors. Default is 3: energy, L2 and H1.
Definition: pzelasmat.h:207
virtual void ContributeInterface(TPZMaterialData &data, TPZMaterialData &dataleft, TPZMaterialData &dataright, REAL weight, TPZFMatrix< STATE > &ef) override
It computes a contribution to residual vector at one integration point.
Definition: pzelasmat.h:162
virtual void SolutionDisc(TPZMaterialData &data, TPZMaterialData &dataleft, TPZMaterialData &dataright, int var, TPZVec< STATE > &Solout)
Returns the solution associated with the var index based on the finite element approximation.
Definition: pzelasmat.h:198
TPZAutoPointer< TPZFunction< STATE > > fElasticity
Definition: pzelasmat.h:246
REAL E()
Returns the elasticity modulus E.
Definition: pzelasmat.h:220
TPZManVector< STATE, 3 > ff
Forcing vector.
Definition: pzelasmat.h:249
virtual void Write(TPZStream &buf, int withclassid) const override
Saves the element data to a stream.
Definition: pzelasmat.cpp:1277
void SetPlaneStress()
Set the material configuration to plane stress.
Definition: pzelasmat.h:68
std::string Name() override
Returns the material name.
Definition: pzelasmat.h:90
virtual short NumberOfFluxes()
Returns the number of components which form the flux function.
Definition: pzelasmat.h:93
STATE GetLambda(REAL E, REAL nu) const
Definition: pzelasmat.h:180
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: pzelasmat.cpp:424
virtual void ContributeBCInterface(TPZMaterialData &data, TPZMaterialData &left, REAL weight, TPZFMatrix< STATE > &ef, TPZBndCond &bc) override
It computes a contribution to residual vector at one BC integration point.
Definition: pzelasmat.h:166
virtual ~TPZElasticityMaterial()
Default destructor.
Definition: pzelasmat.cpp:85
void SetBodyForce(REAL fx, REAL fy)
Set forcing function.
Definition: pzelasmat.h:74
virtual void Contribute(TPZMaterialData &data, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef) override
Calculates the element stiffness matrix.
Definition: pzelasmat.cpp:120
This class implements a two dimensional elastic material in plane stress or strain.
Definition: pzelasmat.h:19
virtual TPZMaterial * NewMaterial() override
Creates a new material from the current object ??
Definition: pzelasmat.h:42
int Dimension() const override
Returns the model dimension.
Definition: pzelasmat.h:81
Defines the interface for saving and reading data. Persistency.
Definition: TPZStream.h:50
virtual int NFluxes() override
Returns the number of components which form the flux function.
Definition: pzelasmat.h:96
REAL fPreStressXX
Pre Stress Tensor - Sigma XX.
Definition: pzelasmat.h:258
def values
Definition: rdt.py:119
REAL fnu_def
Poison coeficient.
Definition: pzelasmat.h:243
Contains the TPZDiscontinuousGalerkin class which implements the interface for discontinuous Galerkin...
virtual void Contribute(TPZMaterialData &data, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef) override=0
It computes a contribution to the stiffness matrix and load vector at one integration point...
REAL fE_def
Elasticity modulus.
Definition: pzelasmat.h:240
virtual void ContributeBC(TPZVec< TPZMaterialData > &datavec, 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 to mul...
Definition: pzelasmat.cpp:524
virtual int NStateVariables() const override
Returns the number of state variables associated with the material.
Definition: pzelasmat.cpp:88
#define PZError
Defines the output device to error messages and the DebugStop() function.
Definition: pzerror.h:15
virtual int VariableIndex(const std::string &name) override
Returns the variable index associated with the name.
Definition: pzelasmat.cpp:762
This class implements a reference counter mechanism to administer a dynamically allocated object...