20 static LoggerPtr elastoplastic2dLogger(Logger::getLogger(
"material.pzElastoPlastic2D"));
24 template <
class T,
class TMEM>
30 template <
class T,
class TMEM>
36 template <
class T,
class TMEM>
40 if(elastoplastic2dLogger->isDebugEnabled())
42 std::stringstream sout;
43 sout <<
">>> TPZMatElastoPlastic2D<T,TMEM>() copy constructor called ***";
44 LOGPZ_INFO(elastoplastic2dLogger,sout.str().c_str());
49 template <
class T,
class TMEM>
55 template <
class T,
class TMEM>
61 if (DeltaStrain.
Rows() != 6) {
76 template <
class T,
class TMEM>
80 if (DeltaStrain.
Rows() != 6) {
91 template <
class T,
class TMEM>
99 axesT.Multiply(dphi, dphiXY);
101 const int phr = phi.
Rows();
113 int numsol = locsol.
size();
115 for (
int is = 0; is < numsol; is++) {
116 data.
sol[0] = locsol[is];
117 data.
dsol[0] = locdsol[is];
128 feclearexcept(FE_ALL_EXCEPT);
129 if (fetestexcept( FE_ALL_EXCEPT)) {
130 std::cout <<
"division by zero reported\n";
136 if (elastoplastic2dLogger->isDebugEnabled()) {
137 std::stringstream sout;
138 sout <<
">>> TPZMatElastoPlastic<T,TMEM>::Contribute ***";
139 sout <<
"\nIntegration Local Point index = " << data.
intGlobPtIndex;
140 sout <<
"\nIntegration Global Point index = " << data.
intGlobPtIndex;
141 sout <<
"\ndata.axes = " << data.
axes;
142 sout <<
"\nDep " << endl;
147 sout <<
"\nStress " << endl;
148 sout << Stress(
_XX_, 0) <<
"\t" << Stress(
_YY_, 0) <<
"\t" << Stress(
_XY_, 0) <<
"\n";
150 sout <<
"\nDELTA STRAIN " << endl;
151 sout << DeltaStrain(0, 0) <<
"\t" << DeltaStrain(1, 0) <<
"\t" << DeltaStrain(2, 0) <<
"\n";
152 sout <<
"data.phi" << data.
phi;
154 LOGPZ_DEBUG(elastoplastic2dLogger, sout.str().c_str());
167 for (in = 0; in < phr; in++) {
169 val = ForceLoc[0] * phi(in, 0);
170 val -= Stress(
_XX_, 0) * dphiXY(0, in);
171 val -= Stress(
_XY_, 0) * dphiXY(1, in);
172 ef(in * nstate + 0, 0) += weight *
val;
174 val = ForceLoc[1] * phi(in, 0);
175 val -= Stress(
_XY_, 0) * dphiXY(0, in);
176 val -= Stress(
_YY_, 0) * dphiXY(1, in);
177 ef(in * nstate + 1, 0) += weight *
val;
179 for (
int jn = 0; jn < phr; jn++) {
180 for (
int ud = 0; ud < 2; ud++) {
181 for (
int vd = 0; vd < 2; vd++) {
182 Deriv(vd, ud) = dphiXY(vd, in) * dphiXY(ud, jn);
186 val = 2. * Dep(
_XX_,
_XX_) * Deriv(0, 0);
187 val += Dep(
_XX_,
_XY_) * Deriv(0, 1);
188 val += 2. * Dep(
_XY_,
_XX_) * Deriv(1, 0);
189 val += Dep(
_XY_,
_XY_) * Deriv(1, 1);
191 ek(in * nstate + 0, jn * nstate + 0) += weight *
val;
193 val = Dep(
_XX_,
_XY_) * Deriv(0, 0);
194 val += 2. * Dep(
_XX_,
_YY_) * Deriv(0, 1);
195 val += Dep(
_XY_,
_XY_) * Deriv(1, 0);
196 val += 2. * Dep(
_XY_,
_YY_) * Deriv(1, 1);
198 ek(in * nstate + 0, jn * nstate + 1) += weight *
val;
200 val = 2. * Dep(
_XY_,
_XX_) * Deriv(0, 0);
201 val += Dep(
_XY_,
_XY_) * Deriv(0, 1);
202 val += 2. * Dep(
_YY_,
_XX_) * Deriv(1, 0);
203 val += Dep(
_YY_,
_XY_) * Deriv(1, 1);
205 ek(in * nstate + 1, jn * nstate + 0) += weight *
val;
207 val = Dep(
_XY_,
_XY_) * Deriv(0, 0);
208 val += 2. * Dep(
_XY_,
_YY_) * Deriv(0, 1);
209 val += Dep(
_YY_,
_XY_) * Deriv(1, 0);
210 val += 2. * Dep(
_YY_,
_YY_) * Deriv(1, 1);
212 ek(in * nstate + 1, jn * nstate + 1) += weight *
val;
217 if (elastoplastic2dLogger->isDebugEnabled()) {
218 std::stringstream sout;
219 sout <<
"<<< TPZMatElastoPlastic2D<T,TMEM>::Contribute ***";
220 sout <<
" Resultant rhs vector:\n" << ef;
221 sout <<
" Resultant stiff vector:\n" << ek;
222 LOGPZ_DEBUG(elastoplastic2dLogger, sout.str().c_str());
227 template <
class T,
class TMEM>
238 const int phr = phi.
Rows();
249 int numsol = locsol.
size();
251 for (
int is = 0; is < numsol; is++) {
252 data.
sol[0] = locsol[is];
253 data.
dsol[0] = locdsol[is];
263 feclearexcept(FE_ALL_EXCEPT);
264 if (fetestexcept( FE_ALL_EXCEPT)) {
265 std::cout <<
"division by zero reported\n";
271 if (elastoplastic2dLogger->isDebugEnabled()) {
272 std::stringstream sout;
273 sout <<
">>> TPZMatElastoPlastic<T,TMEM>::Contribute ***";
274 sout <<
"\nIntegration Local Point index = " << data.
intGlobPtIndex;
275 sout <<
"\nIntegration Global Point index = " << data.
intGlobPtIndex;
276 sout <<
"\ndata.axes = " << data.
axes;
277 sout <<
"\nStress " << endl;
278 sout << Stress(
_XX_, 0) <<
"\t" << Stress(
_YY_, 0) <<
"\t" << Stress(
_XY_, 0) <<
"\n";
279 sout <<
"\nDELTA STRAIN " << endl;
280 sout << DeltaStrain(0, 0) <<
"\t" << DeltaStrain(1, 0) <<
"\t" << DeltaStrain(2, 0) <<
"\n";
281 sout <<
"data.phi" << data.
phi<< std::endl;
284 LOGPZ_DEBUG(elastoplastic2dLogger, sout.str().c_str());
296 for (in = 0; in < phr; in++) {
297 val = ForceLoc[0] * phi(in, 0);
298 val -= Stress(
_XX_, 0) * dphiXY(0, in);
299 val -= Stress(
_XY_, 0) * dphiXY(1, in);
300 ef(in * nstate + 0, 0) += weight *
val;
302 val = ForceLoc[1] * phi(in, 0);
303 val -= Stress(
_XY_, 0) * dphiXY(0, in);
304 val -= Stress(
_YY_, 0) * dphiXY(1, in);
305 ef(in * nstate + 1, 0) += weight *
val;
310 if (elastoplastic2dLogger->isDebugEnabled()) {
311 std::stringstream sout;
312 sout <<
"<<< TPZMatElastoPlastic2D<T,TMEM>::Contribute ***";
313 sout <<
" Resultant rhs vector:\n" << ef;
314 LOGPZ_DEBUG(elastoplastic2dLogger, sout.str().c_str());
321 template <
class T,
class TMEM>
326 if (type == 4 || type ==5 || type == 6) {
334 template <
class T,
class TMEM>
347 for (
int i = 0; i < nstate; i++) {
348 u_n[i] = delta_u[i] + u[i];
353 bc_with_memory.
MemItem(gp_index).m_u = u_n;
356 const int phr = phi.
Rows();
357 int in, jn,
idf, jdf;
359 v2[0] = bc.
Val2()(0, 0);
360 v2[1] = bc.
Val2()(1, 0);
365 for (in = 0; in < phr; in++) {
366 ef(nstate * in + 0, 0) += BIGNUMBER * (v2[0] - u_n[0]) * phi(in, 0) * weight;
367 ef(nstate * in + 1, 0) += BIGNUMBER * (v2[1] - u_n[1]) * phi(in, 0) * weight;
369 for (jn = 0; jn < phr; jn++) {
370 ek(nstate * in + 0, nstate * jn + 0) += BIGNUMBER * phi(in, 0) * phi(jn, 0) * weight;
371 ek(nstate * in + 1, nstate * jn + 1) += BIGNUMBER * phi(in, 0) * phi(jn, 0) * weight;
378 for (in = 0; in < phi.
Rows(); in++) {
379 ef(nstate * in + 0, 0) += v2[0] * phi(in, 0) * weight;
380 ef(nstate * in + 1, 0) += v2[1] * phi(in, 0) * weight;
387 for (
int i = 0; i < 2; i++) {
388 for (
int j = 0; j < 2; j++) {
389 res(i, 0) += bc.
Val1()(i, j) * u_n[j];
393 for (in = 0; in < phi.
Rows(); in++) {
394 ef(nstate * in + 0, 0) += (v2[0] -
res(0, 0)) * phi(in, 0) * weight;
395 ef(nstate * in + 1, 0) += (v2[1] -
res(1, 0)) * phi(in, 0) * weight;
396 for (jn = 0; jn < phi.
Rows(); jn++) {
397 for (idf = 0; idf < 2; idf++) {
398 for (jdf = 0; jdf < 2; jdf++) {
399 ek(nstate * in + idf, nstate * jn + jdf) += bc.
Val1()(
idf, jdf) * phi(in, 0) * phi(jn, 0) * weight;
410 for (in = 0; in < phr; in++) {
411 ef(nstate * in + 0, 0) += BIGNUMBER * (0. - u_n[0]) * v2[0] * phi(in, 0) * weight;
412 ef(nstate * in + 1, 0) += BIGNUMBER * (0. - u_n[1]) * v2[1] * phi(in, 0) * weight;
413 for (jn = 0; jn < phr; jn++) {
414 ek(nstate * in + 0, nstate * jn + 0) += BIGNUMBER * phi(in, 0) * phi(jn, 0) * weight * v2[0];
415 ek(nstate * in + 1, nstate * jn + 1) += BIGNUMBER * phi(in, 0) * phi(jn, 0) * weight * v2[1];
421 v2[0] = v1(0, 0) * data.
normal[0] + v1(0, 1) * data.
normal[1];
422 v2[1] = v1(1, 0) * data.
normal[0] + v1(1, 1) * data.
normal[1];
425 for (in = 0; in < phi.
Rows(); in++) {
426 ef(nstate * in + 0, 0) += v2[0] * phi(in, 0) * weight;
427 ef(nstate * in + 1, 0) += v2[1] * phi(in, 0) * weight;
433 for (
int i = 0; i < 2; i++) {
434 for (
int j = 0; j < 2; j++) {
438 for (in = 0; in < phi.
Rows(); in++) {
439 ef(nstate * in + 0, 0) += (v2[0] * data.
normal[0] -
res(0, 0)) * phi(in, 0) * weight;
440 ef(nstate * in + 1, 0) += (v2[0] * data.
normal[1] -
res(1, 0)) * phi(in, 0) * weight;
441 for (jn = 0; jn < phi.
Rows(); jn++) {
442 for (idf = 0; idf < 2; idf++) {
443 for (jdf = 0; jdf < 2; jdf++) {
444 ek(nstate * in + idf, nstate * jn + jdf) += bc.
Val1()(
idf, jdf) * data.
normal[idf] * data.
normal[jdf] * phi(in, 0) * phi(jn, 0) * weight;
459 v[0] = bc.
Val2()(0,0);
465 for(in = 0 ; in < phi.
Rows(); in++)
468 ef(nstate*in+0,0) += weight * tn * n[0] * phi(in,0);
469 ef(nstate*in+1,0) += weight * tn * n[1] * phi(in,0);
478 v_null[0] = bc.
Val1()(0, 0);
479 v_null[1] = bc.
Val1()(1, 1);
481 for (in = 0; in < phr; in++) {
482 ef(nstate * in + 0, 0) += BIGNUMBER * (v2[0] - u_n[0]) * v_null[0] * phi(in, 0) * weight;
483 ef(nstate * in + 1, 0) += BIGNUMBER * (v2[1] - u_n[1]) * v_null[1] * phi(in, 0) * weight;
484 for (jn = 0; jn < phr; jn++) {
485 ek(nstate * in + 0, nstate * jn + 0) += BIGNUMBER * phi(in, 0) * phi(jn, 0) * weight * v_null[0];
486 ek(nstate * in + 1, nstate * jn + 1) += BIGNUMBER * phi(in, 0) * phi(jn, 0) * weight * v_null[1];
495 if (elastoplastic2dLogger->isDebugEnabled()) {
496 std::stringstream sout;
497 sout <<
"<<< TPZMatElastoPlastic2D<T,TMEM>::ContributeBC *** WRONG BOUNDARY CONDITION TYPE = " << bc.
Type();
498 LOGPZ_ERROR(elastoplastic2dLogger, sout.str().c_str());
501 PZError <<
"TPZMatElastoPlastic2D::ContributeBC error - Wrong boundary condition type" << std::endl;
505 template <
class T,
class TMEM>
513 PZError <<
"TPZMatElastoPlastic2D::ContributeBC error - Wrong boundary objected: expected TPZBndCondWithMem<TMEM>" << std::endl;
523 for (
int i = 0; i < nstate; i++) {
524 u_n[i] = delta_u[i] + u[i];
529 bc_with_memory->
MemItem(gp_index).m_u = u_n;
532 const int phr = phi.
Rows();
533 int in, jn,
idf, jdf;
535 v2[0] = bc.
Val2()(0, 0);
536 v2[1] = bc.
Val2()(1, 0);
541 for (in = 0; in < phr; in++) {
542 ef(nstate * in + 0, 0) += BIGNUMBER * (v2[0] - u_n[0]) * phi(in, 0) * weight;
543 ef(nstate * in + 1, 0) += BIGNUMBER * (v2[1] - u_n[1]) * phi(in, 0) * weight;
549 for (in = 0; in < phi.
Rows(); in++) {
550 ef(nstate * in + 0, 0) += v2[0] * phi(in, 0) * weight;
551 ef(nstate * in + 1, 0) += v2[1] * phi(in, 0) * weight;
558 for (
int i = 0; i < 2; i++) {
559 for (
int j = 0; j < 2; j++) {
560 res(i, 0) += bc.
Val1()(i, j) * u_n[j];
564 for (in = 0; in < phi.
Rows(); in++) {
565 ef(nstate * in + 0, 0) += (v2[0] -
res(0, 0)) * phi(in, 0) * weight;
566 ef(nstate * in + 1, 0) += (v2[1] -
res(1, 0)) * phi(in, 0) * weight;
572 for (in = 0; in < phr; in++) {
573 ef(nstate * in + 0, 0) += BIGNUMBER * (0. - u_n[0]) * v2[0] * phi(in, 0) * weight;
574 ef(nstate * in + 1, 0) += BIGNUMBER * (0. - u_n[1]) * v2[1] * phi(in, 0) * weight;
579 v2[0] = v1(0, 0) * data.
normal[0] + v1(0, 1) * data.
normal[1];
580 v2[1] = v1(1, 0) * data.
normal[0] + v1(1, 1) * data.
normal[1];
583 for (in = 0; in < phi.
Rows(); in++) {
584 ef(nstate * in + 0, 0) += v2[0] * phi(in, 0) * weight;
585 ef(nstate * in + 1, 0) += v2[1] * phi(in, 0) * weight;
591 for (
int i = 0; i < 2; i++) {
592 for (
int j = 0; j < 2; j++) {
596 for (in = 0; in < phi.
Rows(); in++) {
597 ef(nstate * in + 0, 0) += (v2[0] * data.
normal[0] -
res(0, 0)) * phi(in, 0) * weight;
598 ef(nstate * in + 1, 0) += (v2[0] * data.
normal[1] -
res(1, 0)) * phi(in, 0) * weight;
607 v[0] = bc.
Val2()(0,0);
613 for(in = 0 ; in < phi.
Rows(); in++)
616 ef(nstate*in+0,0) += weight * tn * n[0] * phi(in,0);
617 ef(nstate*in+1,0) += weight * tn * n[1] * phi(in,0);
626 v_null[0] = bc.
Val1()(0, 0);
627 v_null[1] = bc.
Val1()(1, 1);
629 for (in = 0; in < phr; in++) {
630 ef(nstate * in + 0, 0) += BIGNUMBER * (v2[0] - u_n[0]) * v_null[0] * phi(in, 0) * weight;
631 ef(nstate * in + 1, 0) += BIGNUMBER * (v2[1] - u_n[1]) * v_null[1] * phi(in, 0) * weight;
639 if (elastoplastic2dLogger->isDebugEnabled()) {
640 std::stringstream sout;
641 sout <<
"<<< TPZMatElastoPlastic2D<T,TMEM>::ContributeBC *** WRONG BOUNDARY CONDITION TYPE = " << bc.
Type();
642 LOGPZ_ERROR(elastoplastic2dLogger, sout.str().c_str());
645 PZError <<
"TPZMatElastoPlastic2D::ContributeBC error - Wrong boundary condition type" << std::endl;
651 template <
class T,
class TMEM>
658 datalocal.
dsol[0](2,0) = 0.;
659 datalocal.
dsol[0](2,1) = 0.;
660 datalocal.
dsol[0](2,2) = 0.;
661 datalocal.
dsol[0](0,2) = 0.;
662 datalocal.
dsol[0](1,2) = 0.;
667 template <
class T,
class TMEM>
671 if (DeltaStrain.
Rows() != 6) {
675 DeltaStrain(
_XX_, 0) = DSolXYZ(0, 0);
676 DeltaStrain(
_YY_, 0) = DSolXYZ(1, 1);
677 DeltaStrain(
_XY_, 0) = 0.5 * (DSolXYZ(1, 0) + DSolXYZ(0, 1));
678 DeltaStrain(
_XZ_, 0) = 0.;
679 DeltaStrain(
_YZ_, 0) = 0.;
680 DeltaStrain(
_ZZ_, 0) = 0.;
685 template <
class T,
class TMEM>
695 template <
class T,
class TMEM>
698 return "TPZMatElastoPlastic<T,TMEM>";
701 template <
class T,
class TMEM>
708 template <
class T,
class TMEM>
720 template <
class T,
class TMEM>
723 out << __PRETTY_FUNCTION__ << std::endl;
727 template <
class T,
class TMEM>
730 out << __PRETTY_FUNCTION__ << std::endl;
virtual void Execute(const TPZVec< REAL > &x, TPZVec< TVar > &f, TPZFMatrix< TVar > &df)
Performs function computation.
TPZManVector< REAL, 3 > normal
normal to the element at the integration point
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< REAL, 3 > x
value of the coordinate at the integration point
clarg::argBool bc("-bc", "binary checkpoints", false)
virtual void ContributeBC(TPZMaterialData &data, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef, TPZBndCond &bc) override
virtual void Write(TPZStream &buf, int withclassid) const override
virtual void ComputeDeltaStrainVector(TPZMaterialData &data, TPZFMatrix< REAL > &DeltaStrain)
TPZGradSolVec dsol
vector of the derivatives of the solution at the integration point
virtual ~TPZMatElastoPlastic2D()
virtual void FillBoundaryConditionDataRequirement(int type, TPZMaterialData &data) override
void ApplyDeltaStrain(TPZMaterialData &data, TPZFMatrix< REAL > &DeltaStrain, TPZFMatrix< REAL > &Stress)
REAL val(STATE &number)
Returns value of the variable.
virtual void Solution(TPZMaterialData &data, int var, TPZVec< REAL > &Solout) override
virtual void Read(TPZStream &buf, void *context) override
virtual void Resize(const int64_t newsize, const T &object)
Resizes the vector object.
Implements an abstract class implementing the memory features.
TPZFMatrix< STATE > & Val2(int loadcase=0)
TPZFNMatrix< 220, REAL > phi
vector of shapefunctions (format is dependent on the value of shapetype)
virtual void Read(TPZStream &buf, void *context) override
TPZFNMatrix< 660, REAL > dphix
values of the derivative of the shape functions
This abstract class defines the behaviour which each derived class needs to implement.
Contains the TPZBndCond class which implements a boundary condition for TPZMaterial objects...
virtual void Write(TPZStream &buf, int withclassid) const override
int64_t size() const
Returns the number of elements of the vector.
virtual void Print(std::ostream &out, const int memory)
#define LOGPZ_INFO(A, B)
Define log for informations.
virtual void Write(const bool val)
#define DebugStop()
Returns a message to user put a breakpoint in.
#define LOGPZ_DEBUG(A, B)
Define log for debug info.
This class defines the boundary condition for TPZMaterial objects.
int64_t Rows() const
Returns number of rows.
virtual int ClassId() const override
virtual void ApplyDeltaStrainComputeDep(TPZMaterialData &data, TPZFMatrix< REAL > &DeltaStrain, TPZFMatrix< REAL > &Stress, TPZFMatrix< REAL > &Dep)
TPZFNMatrix< 9, REAL > axes
axes indicating the directions of the derivatives of the shapefunctions
virtual void Solution(TPZMaterialData &data, int var, TPZVec< REAL > &Solout) override
TPZFMatrix< STATE > & Val1()
int intGlobPtIndex
global point index
#define LOGPZ_ERROR(A, B)
Define log for errors (cout)
static REAL gBigNumber
Big number to penalization method, used for Dirichlet conditions.
virtual void Contribute(TPZMaterialData &data, REAL weight, TPZFMatrix< REAL > &ef) override
virtual void ApplyDeltaStrain(TPZMaterialData &data, TPZFMatrix< REAL > &DeltaStrain, TPZFMatrix< REAL > &Stress)
virtual std::string Name() override
virtual void Print(std::ostream &out) override
Prints out the data associated with the material.
virtual int NStateVariables() const override
virtual void Multiply(const TPZFMatrix< TVar > &A, TPZFMatrix< TVar > &res, int opt=0) const
It mutiplies itself by TPZMatrix<TVar>A putting the result in res.
TPZAutoPointer< TPZFunction< STATE > > fForcingFunction
Pointer to forcing function, it is the right member at differential equation.
Defines the interface for saving and reading data. Persistency.
virtual TMEM & MemItem(const int i) const
void ApplyDeltaStrainComputeDep(TPZMaterialData &data, TPZFMatrix< REAL > &DeltaStrain, TPZFMatrix< REAL > &Stress, TPZFMatrix< REAL > &Dep)
TPZSolVec sol
vector of the solutions at the integration point
void Transpose(TPZMatrix< TVar > *const T) const override
It makes *T the transpose of current matrix.
virtual TMEM & MemItem(const int i) const
Non abstract class which implements full matrices with preallocated storage with (N+1) entries...
#define PZError
Defines the output device to error messages and the DebugStop() function.
virtual void Read(bool &val)
virtual TPZMaterial * NewMaterial() override