NeoPZ
TPZYCDruckerPrager.h
Go to the documentation of this file.
1 
5 #ifndef TPZYCDRUCKERPRAGER_H
6 #define TPZYCDRUCKERPRAGER_H
7 
8 #include "TPZTensor.h"
9 #include "pzfmatrix.h"
10 
11 #include "pzlog.h"
12 #include "TPZSavable.h"
13 #include "TPZPlasticCriterion.h"
14 
15 #ifdef LOG4CXX // LOG4CXX may be defined alone or with LOG4CXX_PLASTICITY. The latter shall not be used alone.
16 #include <log4cxx/logger.h>
17 #include <log4cxx/basicconfigurator.h>
18 #include <log4cxx/propertyconfigurator.h>
19 #endif
20 
21 #ifdef LOG4CXX_PLASTICITY
22 static LoggerPtr loggerDP(Logger::getLogger("plasticity.DruckerPrager"));
23 #endif
24 
29 
30 public:
31 
33 
35  {
36  fKsi = source.fKsi;
37  fEta = source.fEta;
38  }
39 
40  enum {NYield = 1};
41 
42  const char * Name() const
43  {
44  return "TPZYCDruckerPrager";
45  }
46 
47  void Print(std::ostream & out) const override
48  {
49  out << Name();
50  }
51 
60  void SetUp(const REAL & phi, const int innerMCFit)
61  {
62  if(innerMCFit == 0)
63  {
64  fKsi = 6. * cos(phi)/(sqrt(3.) * (3.+sin(phi)));//INNER
65  fEta = 6. * sin(phi)/(sqrt(3.)*(3.+sin(phi)));
66  return;
67  }
68  fKsi = 6. * cos(phi)/(sqrt(3.) * (3.-sin(phi)));//OUTER
69  fEta = 6. * sin(phi)/(sqrt(3.)*(3.-sin(phi)));
70  }
71 
73  {
74  return 0; //nothing to be done in this yield criterium
75  }
76 
77  void SetForceYield(const int forceYield)
78  {
79  //nothing to be done in this yield criterium
80  }
81 
89  void SetYieldStatusMode(const TPZTensor<REAL> & sigma, const REAL & A)
90  {
91  // nothing to be done in this yield criterium
92  }
93 
101  template < class T>
102  void Compute(const TPZTensor<T> & sigma, const T & A, TPZVec<T> &res, int checkForcedYield = 0)const;
103 
111  template <class T>
112  void N(const TPZTensor<T> & sigma,const T & A, TPZVec<TPZTensor<T> > & Ndir, int checkForcedYield = 0) const;
113 
121  template <class T>
122  void H(const TPZTensor<T> & sigma,const T & A, TPZVec<T> & h, int checkForcedYield = 0) const;
123 
127  template <class T>
128  void AlphaMultiplier(const T &A, T &multiplier) const
129  {
130  multiplier = T(1.);
131  }
132 
133 
134  virtual void Write(TPZStream &buf, int withclassid) const override;
135  virtual void Read(TPZStream &buf, void *context) override;
136  public:
137 virtual int ClassId() const override;
138 
139  void YieldFunction(const TPZVec<STATE>& sigma, STATE kprev, TPZVec<STATE>& yield) const override {
140  TPZTensor<STATE> sigmaTensor;
141  sigmaTensor.XX() = sigma[0];
142  sigmaTensor.YY() = sigma[1];
143  sigmaTensor.ZZ() = sigma[2];
144  Compute(sigmaTensor, kprev, yield, 0);
145  }
146 
147  virtual int GetNYield() const override {
148  return as_integer(NYield);
149  }
150 
151 
152 public:
153  REAL fPhi;
154 
155  REAL fKsi, fEta;
156 
158 
159 
161  int NumCases()
162  {
163  return 2;
164  }
166 
169  {
170  int i;
171  for(i=0; i<6; i++) gRefTension.fData[i] = state(i,0);
172  }
173  void ComputeTangent(TPZFMatrix<REAL> &tangent, TPZVec<REAL> &coefs, int icase)
174  {
175  switch(icase)
176  {
177  case 0:
178  {
179  TPZVec<TPZTensor<REAL> > Ndir(1);
180  REAL yield = 1.e6;
181  this->N<REAL>(gRefTension,yield, Ndir, 0);
182  //this->SetUp(20.,0);
183  tangent.Redim(1,6);
184  for(int i=0; i<6; i++)
185  {
186  tangent(0,i) = Ndir[0].fData[i];
187  }
188  break;
189  }
190  case 1:
191  {
192  TPZTensor<REAL> dj2;
193  gRefTension.dJ2(dj2);
194  tangent.Redim(1,6);
195  for(int i=0; i<6; i++)
196  {
197  tangent(0,i) = dj2.fData[i];
198  }
199  break;
200 
201  }
202 
203  }
204  }
205 
206  void Residual(TPZFMatrix<REAL> &res,int icase)
207  {
208 
209  res.Redim(1,1);
210 
211  switch(icase)
212  {
213 
214  case 0:
215  {
216  TPZVec<REAL> phi(1);
217  REAL yield = 1.e6;
218  //this->SetUp(20.,0);
219  this->Compute(gRefTension,yield,phi,0);
220  res(0,0) = phi[0];
221  break;
222  }
223  case 1:
224  {
225 
226  REAL j2 = gRefTension.J2();
227  res(0,0)=j2;
228  }
229  }
230 
231  }
232 
233 
234 
235 
236 public:
237 
238 };
239 
240 
241 
242 template <class T>
243 void TPZYCDruckerPrager::Compute(const TPZTensor<T> & sigma,const T & A, TPZVec<T> &res, int checkForcedYield) const
244 {
245  T I1,J2,p;
246  I1 = sigma.I1();
247  J2 = sigma.J2();
248  p = I1 / T(3.);
249 
250  res[0] = sqrt( J2 ) + p * T(fEta) - A * T(fKsi);
251 
252 #ifdef LOG4CXX_PLASTICITY
253  {
254  std::stringstream sout;
255  sout << "\nJ2 = " << J2;
256  sout << "\nI1 = " << I1;
257  sout << "\nPHI = " << res[0];
258  sout << " \nA = " << A;
259  LOGPZ_INFO(loggerDP,sout.str());
260  }
261 #endif
262 
263 }
264 
265 template <class T>
266 void TPZYCDruckerPrager::N(const TPZTensor<T> & sigma,const T & A, TPZVec<TPZTensor<T> > & Ndir, int checkForcedYield) const
267 {
268  //Deviatoric part
269  T J2 = sigma.J2();
270  TPZTensor<T> s,dj2;
271 
272 
273 
274 //SOUZA NETO CHECK CONV NAO DA 2 com S, mas com dJ2 BATE!
275 // sigma.S(s);
276 // s *= T(0.5) / sqrt(J2);
277 //Hydrostatic part
278 // T EtaOver3 = T(fEta/3.);
279 // s.XX() += EtaOver3;
280 // s.YY() += EtaOver3;
281 // s.ZZ() += EtaOver3;
282 // Ndir[0] = s;
283 
284  sigma.dJ2(dj2);
285  dj2*=T(0.5)/sqrt(J2);
286  T EtaOver3 = T(fEta/3.);
287  dj2.XX() += EtaOver3;
288  dj2.YY() += EtaOver3;
289  dj2.ZZ() += EtaOver3;
290  Ndir[0]=dj2;
291 
292 }
293 
294 template <class T>
295 void TPZYCDruckerPrager::H(const TPZTensor<T> & sigma,const T & A, TPZVec<T> & h, int checkForcedYield) const
296 {
297  //H=-dphi/dA
298  h[0] = fKsi;
299 }
300 
301 
302 inline void TPZYCDruckerPrager::Write(TPZStream &buf, int withclassid = 0) const
303 {
304 }
305 inline void TPZYCDruckerPrager::Read(TPZStream &buf, void *context = 0)
306 {
307 }
308 
309 #endif//TPZYDruckerPrager
void SetYieldStatusMode(const TPZTensor< REAL > &sigma, const REAL &A)
Checks if the proposed yield state leads to post-peak material behaviour. If so, the material is forc...
Contains declaration of the TPZSavable class which defines the interface to save and restore objects ...
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< T, 6 > fData
Definition: TPZTensor.h:652
T I1() const
Definition: TPZTensor.h:903
TPZTensor< REAL > gRefTension
void N(const TPZTensor< T > &sigma, const T &A, TPZVec< TPZTensor< T > > &Ndir, int checkForcedYield=0) const
Derivada da funcao de plastificacao.
void ComputeTangent(TPZFMatrix< REAL > &tangent, TPZVec< REAL > &coefs, int icase)
std::underlying_type< Enumeration >::type as_integer(const Enumeration value)
Definition: pzreal.h:37
T & YY() const
Definition: TPZTensor.h:578
clarg::argBool h("-h", "help message", false)
This class implements a simple vector storage scheme for a templated class T. Utility.
Definition: pzgeopoint.h:19
const char * Name() const
int NumCases()
Number of types of residuals.
sin
Definition: fadfunc.h:63
virtual int ClassId() const override
Define the class id associated with the class.
void LoadState(TPZFMatrix< REAL > &state)
LoadState will keep a given state as static variable of the class.
void SetForceYield(const int forceYield)
#define LOGPZ_INFO(A, B)
Define log for informations.
Definition: pzlog.h:89
void SetUp(const REAL &phi, const int innerMCFit)
Setup of material parameters.
Contains TPZMatrixclass which implements full matrix (using column major representation).
void dJ2(TPZTensor< T > &Tangent) const
Definition: TPZTensor.h:935
expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ sqrt
Definition: tfadfunc.h:120
virtual void Read(TPZStream &buf, void *context) override
read objects from the stream
string res
Definition: test.py:151
T J2() const
Definition: TPZTensor.h:927
void Print(std::ostream &out) const override
int Redim(const int64_t newRows, const int64_t newCols) override
Redimension a matrix and ZERO your elements.
Definition: pzfmatrix.h:616
void Residual(TPZFMatrix< REAL > &res, int icase)
virtual void Write(TPZStream &buf, int withclassid) const override
Writes this object to the TPZStream buffer. Include the classid if withclassid = true.
T & XX() const
Definition: TPZTensor.h:566
void H(const TPZTensor< T > &sigma, const T &A, TPZVec< T > &h, int checkForcedYield=0) const
Derivada da funcao de plastificacao com respeito a forca termodinamica.
virtual int GetNYield() const override
TPZYCDruckerPrager(const TPZYCDruckerPrager &source)
T & ZZ() const
Definition: TPZTensor.h:586
Defines the interface for saving and reading data. Persistency.
Definition: TPZStream.h:50
void Compute(const TPZTensor< T > &sigma, const T &A, TPZVec< T > &res, int checkForcedYield=0) const
Calculo do criterio de plastificacao.
void AlphaMultiplier(const T &A, T &multiplier) const
void YieldFunction(const TPZVec< STATE > &sigma, STATE kprev, TPZVec< STATE > &yield) const override
Implementa a plastificacao do criterio de Von Mises.
TPZFlopCounter cos(const TPZFlopCounter &orig)
Returns the cosine in radians and increments the counter of the Cosine.
Definition: pzreal.h:514