NeoPZ
TPZYCVonMises.h
Go to the documentation of this file.
1 
5 #ifndef TPZYCVONMISES_H
6 #define TPZYCVONMISES_H
7 
8 #include "TPZTensor.h"
9 #include "pzfmatrix.h"
10 
11 #include "pzlog.h"
12 #include "TPZPlasticCriterion.h"
13 
18 
19 
20 public:
21 
22  enum {NYield = 1};
23 
24  const char * Name() const
25  {
26  return "TPZYCVonMises";
27  }
28 
29  public:
30 virtual int ClassId() const override;
31 
32 
33  void Print(std::ostream & out) const override
34  {
35  out << Name();
36  }
37 
39  {
40  return 0; // nothing to be done in this yield criterium
41  }
42 
43  void SetForceYield(const int forceYield)
44  {
45  // nothing to be done in this yield criterium
46  }
47 
55  void SetYieldStatusMode(const TPZTensor<REAL> & sigma, const REAL & A)
56  {
57  // nothing to be done in this yield criterium
58  }
59 
67  template < class T>
68  void Compute(const TPZTensor<T> & sigma, const T & A, TPZVec<T> &res, int checkForcedYield = 0) const;
69 
77  template <class T>
78  void N(const TPZTensor<T> & sigma,const T & A, TPZVec<TPZTensor<T> > & Ndir, int checkForcedYield = 0) const;
79 
87  template <class T>
88  void H(const TPZTensor<T> & sigma,const T & A, TPZVec<T> & h, int checkForcedYield = 0) const;
89 
93  template <class T>
94  void AlphaMultiplier(const T &A, T &multiplier) const
95  {
96  multiplier = T(1.);
97  }
98 
99  void Write(TPZStream& buf, int withclassid) const override;
100 
101  void Read(TPZStream& buf, void* context) override;
102 
103  void YieldFunction(const TPZVec<STATE>& sigma, STATE kprev, TPZVec<STATE>& yield) const override {
104  TPZTensor<STATE> sigmaTensor;
105  sigmaTensor.XX() = sigma[0];
106  sigmaTensor.YY() = sigma[1];
107  sigmaTensor.ZZ() = sigma[2];
108  Compute(sigmaTensor, kprev, yield, 0);
109  }
110 
111  virtual int GetNYield() const override {
112  return as_integer(NYield);
113  }
114 
115 
116 public:
118 
122  int NumCases()
123  {
124  return 3;
125  }
126 
132  {
133  #ifdef LOG4CXX_PLASTICITY
134  LoggerPtr logger(Logger::getLogger("plasticity.ycvonmises"));
135  #endif
136  int i;
137  for(i=0; i<6; i++) gRefTension[i] = state(i,0);
138  #ifdef LOG4CXX_PLASTICITY
139  std::stringstream sout;
140  sout << "Tensao " << state;
141  LOGPZ_DEBUG(logger,sout.str().c_str());
142  #endif
143  }
144 
145  void ComputeTangent(TPZFMatrix<REAL> &tangent, TPZVec<REAL> &, int icase)
146  {
147  #ifdef LOG4CXX_PLASTICITY
148  LoggerPtr logger(Logger::getLogger("plasticity.ycvonmises"));
149  #endif
150  TPZTensor<REAL> dj2;
151  REAL A(1.e7);
152  TPZVec<REAL> phivec(1,0.);
153  TPZVec<TPZTensor<REAL> > ndir(1);
154  int i;
155  REAL j2, mult;
156  switch(icase)
157  {
158  case 0:
159  gRefTension.dJ2(dj2);
160  tangent.Redim(1,6);
161  for(i=0; i<6; i++) tangent(0,i) = dj2[i];
162  break;
163  case 1:
164  j2 = gRefTension.J2();
165  gRefTension.dJ2(dj2);
166  tangent.Redim(1,6);
167  mult = 0.5/sqrt(j2);
168  dj2.Multiply(mult,1.);
169  for(i=0; i<6; i++) tangent(0,i) = dj2[i];
170  break;
171  case 2:
172  N(gRefTension,A,ndir,0);
173  tangent.Redim(1,6);
174  for(i=0; i<6; i++) tangent(0,i) = ndir[0][i];
175  }
176  #ifdef LOG4CXX_PLASTICITY
177  std::stringstream sout;
178  sout << "Matriz tangent " << tangent;
179  LOGPZ_DEBUG(logger,sout.str().c_str());
180  #endif
181  }
182 
183  void Residual(TPZFMatrix<REAL> &res,int icase)
184  {
185  #ifdef LOG4CXX_PLASTICITY
186  LoggerPtr logger(Logger::getLogger("plasticity.ycvonmises"));
187  #endif
188  TPZTensor<REAL> gradtheta;
189  REAL A(1.e7),j2;
190  TPZVec<REAL> phivec(1,0.);
191  switch(icase)
192  {
193  case 0:
194  j2 = gRefTension.J2();
195  res.Redim(1,1);
196  res(0,0) = j2;
197  break;
198  case 1:
199  j2 = gRefTension.J2();
200  res.Redim(1,1);
201  res(0,0) = sqrt(j2);
202  break;
203  case 2:
204  Compute(gRefTension,A,phivec,0);
205  res.Redim(1,1);
206  res(0,0) = phivec[0];
207  break;
208  }
209  #ifdef LOG4CXX_PLASTICITY
210  std::stringstream sout;
211  sout << "valor phi " << res(0,0);
212  LOGPZ_DEBUG(logger,sout.str().c_str());
213  #endif
214  }
215 
217 public:
218 
219 };
220 
221 
222 
223 template <class T>
224 void TPZYCVonMises::Compute(const TPZTensor<T> & sigma,const T & A, TPZVec<T> &phi, int checkForcedYield) const{
225 
226  T J2 = sigma.J2();
227  T temp = sqrt(T(3.)*J2);
228  T result = temp-A;
229  phi[0] = result;
230 }
231 
232 template <class T>
233 void TPZYCVonMises::N(const TPZTensor<T> & sigma,const T & A, TPZVec<TPZTensor<T> > & Ndir, int checkForcedYield) const
234 {
235 // T temp1= sqrt(T(3.)/T(2.));
236  TPZTensor<T> s;
237  sigma.S(s);
238  //T NORM = sqrt(s.XX()*s.XX()+s.YY()*s.YY()+s.ZZ()*s.ZZ()+T(2.)*(s.XY()*s.XY())+T(2.)*(s.XZ()*s.XZ())+T(2.)*(s.YZ()*s.YZ()));
239  // T NORM = s.Norm();
240  //s.Multiply(T(1.)/NORM,T(1.));
241  //s.Multiply(temp1, T(1.));
242  //Ndir[0]=s;
243  sigma.dJ2(Ndir[0]);
244  Ndir[0].Multiply(T(0.5)/sqrt(sigma.J2()),sqrt(3.));
245 
246 }
247 
248 template <class T>
249 void TPZYCVonMises::H(const TPZTensor<T> & sigma,const T & A, TPZVec<T> & h, int checkForcedYield) const
250 {
251  h[0] = 1.;
252 // Conflicting definitions:
253 // Eduardo Souza Neto, pg 242 -> H = -1.0 for von Mises
254 // H = dKsi/dA
255 // pg 146 -> H = -dKsi/dA
256 
257 }
258 
259 #endif //TPZYCVONMISES_H
const char * Name() const
Definition: TPZYCVonMises.h:24
void Multiply(const T1 &multipl, const T2 &constant)
Definition: TPZTensor.h:766
Implementa a plastificacao do criterio de Von Mises.
Definition: TPZYCVonMises.h:17
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.
std::underlying_type< Enumeration >::type as_integer(const Enumeration value)
Definition: pzreal.h:37
void N(const TPZTensor< T > &sigma, const T &A, TPZVec< TPZTensor< T > > &Ndir, int checkForcedYield=0) const
T & YY() const
Definition: TPZTensor.h:578
void YieldFunction(const TPZVec< STATE > &sigma, STATE kprev, TPZVec< STATE > &yield) const override
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
virtual int ClassId() const override
Define the class id associated with the class.
void Write(TPZStream &buf, int withclassid) const override
Writes this object to the TPZStream buffer. Include the classid if withclassid = true.
void SetYieldStatusMode(const TPZTensor< REAL > &sigma, const REAL &A)
Definition: TPZYCVonMises.h:55
void AlphaMultiplier(const T &A, T &multiplier) const
Definition: TPZYCVonMises.h:94
Contains TPZMatrixclass which implements full matrix (using column major representation).
#define LOGPZ_DEBUG(A, B)
Define log for debug info.
Definition: pzlog.h:87
void dJ2(TPZTensor< T > &Tangent) const
Definition: TPZTensor.h:935
void LoadState(TPZFMatrix< REAL > &state)
void H(const TPZTensor< T > &sigma, const T &A, TPZVec< T > &h, int checkForcedYield=0) const
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
string res
Definition: test.py:151
T J2() const
Definition: TPZTensor.h:927
int Redim(const int64_t newRows, const int64_t newCols) override
Redimension a matrix and ZERO your elements.
Definition: pzfmatrix.h:616
virtual int GetNYield() const override
T & XX() const
Definition: TPZTensor.h:566
void Read(TPZStream &buf, void *context) override
read objects from the stream
T & ZZ() const
Definition: TPZTensor.h:586
void Print(std::ostream &out) const override
Definition: TPZYCVonMises.h:33
Defines the interface for saving and reading data. Persistency.
Definition: TPZStream.h:50
static TPZTensor< REAL > gRefTension
void ComputeTangent(TPZFMatrix< REAL > &tangent, TPZVec< REAL > &, int icase)
int GetForceYield()
Definition: TPZYCVonMises.h:38
void Residual(TPZFMatrix< REAL > &res, int icase)
void Compute(const TPZTensor< T > &sigma, const T &A, TPZVec< T > &res, int checkForcedYield=0) const
void SetForceYield(const int forceYield)
Definition: TPZYCVonMises.h:43
void S(TPZTensor< T > &s) const
Definition: TPZTensor.h:894