NeoPZ
TPZElasticCriterion.cpp
Go to the documentation of this file.
1 #include "TPZElasticCriterion.h"
2 
4 {
5 
6 }
7 
9 {
10 }
11 
13 {
15  if(&other == this){
16  return *this;
17  }
18 
19  fN = other.fN;
20  fER = other.fER;
21  return *this;
22 }
23 
24 void TPZElasticCriterion::Read(TPZStream& buf, void* context) {
25  fN.Read(buf, context);
26  fER.Read(buf, context);
27 }
28 
29 void TPZElasticCriterion::Write(TPZStream& buf, int withclassid) const {
30  fN.Write(buf, withclassid);
31  fER.Write(buf, withclassid);
32 }
33 
35 {
36 
37  bool require_tangent_Q = (tangent != NULL);
38 
39 #ifdef PZDEBUG
40  if (require_tangent_Q){
41  // Check for required dimensions of tangent
42  if (tangent->Rows() != 6 || tangent->Cols() != 6) {
43  std::cerr << "Unable to compute the tangent operator. Required tangent array dimensions are 6x6." << std::endl;
44  DebugStop();
45  }
46  }
47 #endif
48 
49  fER.ComputeStress(epsTotal, sigma);
50  fN.m_eps_t = epsTotal;
51 
52  if (require_tangent_Q) {
53  const REAL lambda = fER.Lambda();
54  const REAL mu = fER.G();
55 
56  // Linha 0
57  tangent->PutVal(_XX_,_XX_, lambda + 2. * mu);
58  tangent->PutVal(_XX_,_YY_, lambda);
59  tangent->PutVal(_XX_,_ZZ_, lambda);
60 
61  // Linha 1
62  tangent->PutVal(_XY_,_XY_, 2. * mu);
63 
64  // Linha 2
65  tangent->PutVal(_XZ_,_XZ_, 2. * mu);
66 
67  // Linha 3
68  tangent->PutVal(_YY_,_XX_, lambda);
69  tangent->PutVal(_YY_,_YY_, lambda + 2. * mu);
70  tangent->PutVal(_YY_,_ZZ_, lambda);
71 
72  // Linha 4
73  tangent->PutVal(_YZ_,_YZ_, 2. * mu);
74 
75  // Linha 5
76  tangent->PutVal(_ZZ_,_XX_, lambda);
77  tangent->PutVal(_ZZ_,_YY_, lambda);
78  tangent->PutVal(_ZZ_,_ZZ_, lambda + 2. * mu);
79  }
80 
81 }
82 
84 {
85 
86  std::cout<< " \n this method is not implemented in TPZElasticCriteria. ";
87  DebugStop();
88 
89 }
90 
92 {
93  TPZFNMatrix<36,REAL> Dep(6,6,0.0);
94  TPZTensor<REAL> eps(0.),sigma;
95  ApplyStrainComputeSigma(eps, sigma, &Dep);
96  TPZFNMatrix<6,REAL> stressmat(6,1);
97  stressmat(_XX_) = GivenStress[_XX_];
98  stressmat(_YY_) = GivenStress[_YY_];
99  stressmat(_XY_) = GivenStress[_XY_];
100  stressmat(_ZZ_) = GivenStress[_ZZ_];
101  stressmat(_XZ_) = GivenStress[_XZ_];
102  stressmat(_YZ_) = GivenStress[_YZ_];
103  Dep.Solve_LDLt(&stressmat);
104  epsTotal[_XX_] = stressmat(_XX_);
105  epsTotal[_YY_] = stressmat(_YY_);
106  epsTotal[_XY_] = stressmat(_XY_);
107  epsTotal[_XZ_] = stressmat(_XZ_);
108  epsTotal[_YZ_] = stressmat(_YZ_);
109  epsTotal[_ZZ_] = stressmat(_ZZ_);
110  fN.m_eps_t = epsTotal;
111 }
112 
113 
115 {
116  return fN;
117 }
118 
119 
121 {
122 
123  phi.resize(3);
124  for (int i = 0; i < 3; i++) {
125  phi[i] = 0.;
126  }
127 }
128 
130 {
131  fN = state;
132 }
133 
135 {
136  return 1;
137 }
138 
140  return Hash("TPZElasticCriterion") ^ TPZPlasticBase::ClassId() << 1;
141 }
#define _XZ_
Definition: TPZTensor.h:29
void Write(TPZStream &buf, int withclassid) const override
Writes this object to the TPZStream buffer. Include the classid if withclassid = true.
TPZElasticCriterion & operator=(const TPZElasticCriterion &cp)
virtual int IntegrationSteps() const override
Return.
virtual void Phi(const TPZTensor< REAL > &epsTotal, TPZVec< REAL > &phi) const override
virtual void ApplyLoad(const TPZTensor< REAL > &sigma, TPZTensor< REAL > &epsTotal) override
void Write(TPZStream &buf, int withclassid) const override
TPZTensor< T > m_eps_t
Tensors representing the total and plastic strain states.
virtual int ClassId() const override
virtual void resize(const int64_t newsize)
Definition: pzvec.h:213
TPZPlasticState< STATE > fN
Plastic state.
void Read(TPZStream &buf, void *context) override
TPZElasticResponse fER
Elastic response.
void ComputeStress(const TPZTensor< T > &epsilon, TPZTensor< T > &sigma) const
int Solve_LDLt(TPZFMatrix< TVar > *B, std::list< int64_t > &singular)
Solves the linear system using LDLt method .
Definition: pzmatrix.cpp:1993
#define DebugStop()
Returns a message to user put a breakpoint in.
Definition: pzerror.h:20
#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
virtual TPZPlasticState< REAL > GetState() const override
void Read(TPZStream &buf, void *context) override
read objects from the stream
#define _YY_
Definition: TPZTensor.h:30
int32_t Hash(std::string str)
Definition: TPZHash.cpp:10
virtual void ApplyStrain(const TPZTensor< REAL > &epsTotal) override
#define _ZZ_
Definition: TPZTensor.h:32
virtual void ApplyStrainComputeSigma(const TPZTensor< REAL > &epsTotal, TPZTensor< REAL > &sigma, TPZFMatrix< REAL > *De=NULL) override
void Read(TPZStream &buf, void *context) override
int64_t Cols() const
Returns number of cols.
Definition: pzmatrix.h:809
Defines the interface for saving and reading data. Persistency.
Definition: TPZStream.h:50
virtual void SetState(const TPZPlasticState< REAL > &state) override
int ClassId() const override
Define the class id associated with the class.
int PutVal(const int64_t row, const int64_t col, const TVar &value) override
Put values without bounds checking This method is faster than "Put" if DEBUG is defined.
Definition: pzfmatrix.h:548
Non abstract class which implements full matrices with preallocated storage with (N+1) entries...
Definition: pzfmatrix.h:716
void Write(TPZStream &buf, int withclassid) const override