NeoPZ
tpzycvonmisescombtresca.h
Go to the documentation of this file.
1 
5 #ifndef TPZYCVONMISESCOMBTRESCA_H
6 #define TPZYCVONMISESCOMBTRESCA_H
7 
8 #include "pzlog.h"
9 
10 #include "TPZYCVonMises.h"
11 #include "tpzyctrescaregularized.h"
12 
17 
18 public:
19 
20  public:
21 virtual int ClassId() const override;
22 
23 
24  const char * Name() const
25  {
26  return "TPZYCVonMisesCombTresca";
27  }
28 
29  void Print(std::ostream & out) const override
30  {
31  out << "\n" << this->Name();
32  out << "\n fVonMises :\n";
33  fVonMises.Print(out);
34  out << "\n fTresca :\n";
35  fTresca.Print(out);
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 
60  void Write(TPZStream& buf, int withclassid) const override{
61  fVonMises.Write(buf, withclassid);
62  fTresca.Write(buf, withclassid);
63  }
64 
65  void Read(TPZStream& buf, void* context) override{
66  fVonMises.Read(buf, context);
67  fTresca.Read(buf, context);
68  }
69 
70 protected:
73 
76 
77 public:
78 
80 
83 
91  template < class T>
92  void Compute(const TPZTensor<T> & sigma, const T & A, TPZVec<T> &res, int checkForcedYield = 0) const;
93 
101  template <class T>
102  void N(const TPZTensor<T> & sigma,const T & A, TPZVec<TPZTensor<T> > & NDir, int checkForcedYield = 0) const;
103 
111  template <class T>
112  void H(const TPZTensor<T> & sigma,const T & A, TPZVec<T> & h, int checkForcedYield = 0) const;
113 
117  template <class T>
118  void AlphaMultiplier(const T &A, T &multiplier) const
119  {
120  multiplier = T(1.);
121  }
122 
123  void YieldFunction(const TPZVec<STATE>& sigma, STATE kprev, TPZVec<STATE>& yield) const override{
124  TPZTensor<STATE> sigmaTensor;
125  sigmaTensor.XX() = sigma[0];
126  sigmaTensor.YY() = sigma[1];
127  sigmaTensor.ZZ() = sigma[2];
128  Compute(sigmaTensor, kprev, yield, 0);
129  }
130 
131  virtual int GetNYield() const override{
132  return as_integer(NYield);
133  }
134 
135 };
136 
137 
138 
140 {
141 }
142 
143 
144 template < class T>
145 void TPZYCVonMisesCombTresca::Compute(const TPZTensor<T> & sigma, const T & A, TPZVec<T> &res, int checkForcedYield) const
146 {
147 #ifdef LOG4CXX_PLASTICITY
148  LoggerPtr logger(Logger::getLogger("plasticity.ycvonmisescombtresca"));
149 #endif
150  if (res.NElements()!=2)
151  {
152 #ifdef LOG4CXX_PLASTICITY
153  std::stringstream sout;
154  sout << __PRETTY_FUNCTION__ << " wrong vector size: res has dimension = " << res.NElements()
155  << " waiting for size = 2";
156  LOGPZ_ERROR(logger,sout.str().c_str());
157 #endif
158  return;
159  }
160  TPZVec<T> aux (1);
161  const T aux1 = A*T(cos(3.141592/6.)/cos(3.141592/12.));
162 // const T aux1 = A;
163  fVonMises.Compute(sigma,aux1,aux,checkForcedYield);
164  res[0] = aux[0];
165  fTresca.Compute(sigma,A,aux,checkForcedYield);
166  res[1] = aux[0];
167 #ifdef LOG4CXX_PLASTICITY
168  {
169  std::stringstream sout;
170  sout << __PRETTY_FUNCTION__ << " valores dos phi " << res;
171  sout << "\nvalor aux1 " << aux1;
172  sout << "\nvalor A " << A;
173  LOGPZ_DEBUG(logger,sout.str().c_str());
174  }
175 #endif
176 }
177 
178 
179 template <class T>
180 void TPZYCVonMisesCombTresca::N(const TPZTensor<T> & sigma,const T & A, TPZVec<TPZTensor<T> > & NDir, int checkForcedYield) const
181 {
182 #ifdef LOG4CXX_PLASTICITY
183  LoggerPtr logger(Logger::getLogger("plasticity.ycvonmisescombtresca"));
184 #endif
185  if (NDir.NElements()!=2)
186  {
187 #ifdef LOG4CXX_PLASTICITY
188  std::stringstream sout;
189  sout << __PRETTY_FUNCTION__ << " wrong vector size: Ndir has dimension = " << NDir.NElements()
190  << " waiting for size = 2";
191  LOGPZ_ERROR(logger,sout.str().c_str());
192 #endif
193  return;
194  }
195  TPZVec< TPZTensor<T> > aux (1);
196  fVonMises.N(sigma,A,aux,checkForcedYield);
197  NDir[0] = aux[0];
198  fTresca.N(sigma,A,aux,checkForcedYield);
199  NDir[1] = aux[0];
200 }
201 
202 
203 template <class T>
204 void TPZYCVonMisesCombTresca::H(const TPZTensor<T> & sigma,const T & A, TPZVec<T> & h, int checkForcedYield) const
205 {
206 #ifdef LOG4CXX_PLASTICITY
207  LoggerPtr logger(Logger::getLogger("plasticity.ycvonmisescombtresca"));
208 #endif
209  if (h.NElements()!=2)
210  {
211 #ifdef LOG4CXX_PLASTICITY
212  std::stringstream sout;
213  sout << __PRETTY_FUNCTION__ << " wrong vector size: h has dimension = " << h.NElements()
214  << " waiting for size = 2";
215  LOGPZ_ERROR(logger,sout.str().c_str());
216 #endif
217  return;
218  }
219  TPZVec<T> aux (1);
220  fVonMises.H(sigma,A,aux,checkForcedYield);
221  h[0] = aux[0];
222  fTresca.H(sigma,A,aux,checkForcedYield);
223  h[1] = aux [0];
224 }
225 
226 #endif
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.
void SetYieldStatusMode(const TPZTensor< REAL > &sigma, const REAL &A)
void AlphaMultiplier(const T &A, T &multiplier) const
virtual int GetNYield() const override
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 Write(TPZStream &buf, int withclassid) const override
Writes this object to the TPZStream buffer. Include the classid if withclassid = true.
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
void Read(TPZStream &buf, void *context) override
read objects from the stream
void H(const TPZTensor< T > &sigma, const T &A, TPZVec< T > &h, int checkForcedYield=0) const
void Write(TPZStream &buf, int withclassid) const override
Writes this object to the TPZStream buffer. Include the classid if withclassid = true.
void Read(TPZStream &buf, void *context) override
read objects from the stream
TPZYCTrescaRegularized fTresca
Pointer to Tresca&#39;s yield criteria object.
void Print(std::ostream &out) const override
void Compute(const TPZTensor< T > &sigma, const T &A, TPZVec< T > &res, int checkForcedYield=0) const
void Compute(const TPZTensor< T > &sigma, const T &A, TPZVec< T > &result, int checkForcedYield=0) const
Calculo do criterio de plastificacao.
#define LOGPZ_DEBUG(A, B)
Define log for debug info.
Definition: pzlog.h:87
void YieldFunction(const TPZVec< STATE > &sigma, STATE kprev, TPZVec< STATE > &yield) const override
void H(const TPZTensor< T > &sigma, const T &A, TPZVec< T > &h, int checkForcedYield=0) const
string res
Definition: test.py:151
#define LOGPZ_ERROR(A, B)
Define log for errors (cout)
Definition: pzlog.h:93
This class implements a tresca yield criteria whrere the gradient of the inverse angle is regularized...
void N(const TPZTensor< T > &sigma, const T &A, TPZVec< TPZTensor< T > > &NDir, int checkForcedYield=0) const
void Write(TPZStream &buf, int withclassid) const override
Writes this object to the TPZStream buffer. Include the classid if withclassid = true.
void N(const TPZTensor< T > &sigma, const T &A, TPZVec< TPZTensor< T > > &Ndir, int checkForcedYield=0) const
Derivada da funcao de plastificacao.
T & XX() const
Definition: TPZTensor.h:566
TPZYCVonMises fVonMises
Pointer to Von Mises&#39;s yield criteria object.
virtual int ClassId() const override
Define the class id associated with the class.
void SetForceYield(const int forceYield)
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
void H(const TPZTensor< T > &sigma, const T &A, TPZVec< T > &h, int checkForcedYield=0) const
Definition: TPZYCTresca.h:84
Defines the interface for saving and reading data. Persistency.
Definition: TPZStream.h:50
int64_t NElements() const
Returns the number of elements of the vector.
Definition: pzvec.h:190
TPZFlopCounter cos(const TPZFlopCounter &orig)
Returns the cosine in radians and increments the counter of the Cosine.
Definition: pzreal.h:514
void Compute(const TPZTensor< T > &sigma, const T &A, TPZVec< T > &res, int checkForcedYield=0) const
void Print(std::ostream &out) const override