21 static LoggerPtr logger(Logger::getLogger(
"plasticity.poroelastoplastic2"));
25 static LoggerPtr logger2(Logger::getLogger(
"plasticity.poroelastoplastic"));
30 template <
class YC_t,
class ER_t>
34 k = fYC.InitialDamage(sigma_p.fEigenvalues);
37 template <
class YC_t,
class ER_t>
39 bool require_tangent_Q = (tangent != NULL);
42 if (require_tangent_Q) {
44 if (tangent->
Rows() != 6 || tangent->
Cols() != 6) {
45 std::cerr <<
"Unable to compute the tangent operator. Required tangent array dimensions are 6x6." << std::endl;
57 fER.ComputeStress(eps_tr, sig_tr);
69 if (require_tangent_Q) {
74 fYC.ProjectSigma(sig_eigen_system.fEigenvalues, fN.m_hardening, sig_projected, nextalpha, m_type, &gradient);
75 TangentOperator(gradient, eps_eigen_system, sig_eigen_system, *tangent);
77 fYC.ProjectSigma(sig_eigen_system.fEigenvalues, fN.m_hardening, sig_projected, nextalpha, m_type);
80 fN.m_hardening = nextalpha;
84 if(logger->isDebugEnabled())
86 std::stringstream sout;
87 sout <<
"Sig Trial " << sigtrvec <<
"\nSig Project " << sigprvec << std::endl;
93 sig_eigen_system.fEigenvalues = sig_projected;
97 fER.ComputeStrain(sigma, eps_e_Np1);
98 fN.m_eps_t = epsTotal;
99 fN.m_eps_p = epsTotal - eps_e_Np1;
102 template <
class YC_t,
class ER_t>
106 bool require_tangent_Q = (tangent != NULL);
109 if (require_tangent_Q) {
111 if (tangent->
Rows() != 6 || tangent->
Cols() != 6) {
112 std::cerr <<
"Unable to compute the tangent operator. Required tangent array dimensions are 6x6." << std::endl;
123 eps_p_N = fN.m_eps_p;
126 fER.ComputeStress(eps_tr, sig_tr);
135 if (require_tangent_Q) {
142 fYC.ProjectSigma(sig_eigen_system.fEigenvalues, fN.m_hardening, sig_projected, nextalpha, m_type, &gradient);
143 TangentOperator(gradient, eps_eigen_system, sig_eigen_system, *tangent);
146 fYC.ProjectSigma(sig_eigen_system.fEigenvalues, fN.m_hardening, sig_projected, nextalpha, m_type);
150 fN.m_hardening = nextalpha;
151 fN.m_m_type = m_type;
154 if(logger->isDebugEnabled())
156 std::stringstream sout;
157 sout <<
"Sig Trial " << sigtrvec <<
"\nSig Project " << sigprvec << std::endl;
163 sig_eigen_system.fEigenvalues = sig_projected;
166 fER.ComputeStrain(sigma, eps_e_Np1);
167 fN.m_eps_t = epsTotal;
169 eps_p_N -= eps_e_Np1;
170 fN.m_eps_p = eps_p_N;
173 template <
class YC_t,
class ER_t>
177 sig_vec[0] = sigma_tr[0] - sigma[0];
178 sig_vec[1] = sigma_tr[1] - sigma[1];
179 sig_vec[2] = sigma_tr[2] - sigma[2];
182 fYC.Phi(sigma,kappa,phi);
193 bool plastic_state_Q;
194 for (
int i = 1; i <= n_steps; i++) {
195 alpha = REAL(i*d_alpha);
197 sig[0] = alpha*sig_vec[0] +sigma[0];
198 sig[1] = alpha*sig_vec[1] +sigma[1];
199 sig[2] = alpha*sig_vec[2] +sigma[2];
200 fYC.Phi(sig,kappa,phi_n);
202 plastic_state_Q =
IsZero(phi_n[0]) || phi_n[0] > 0.0;
203 if (plastic_state_Q) {
211 template <
class YC_t,
class ER_t>
223 fER.ComputeStress(epsTr, sigtr);
232 if (logger->isDebugEnabled()) {
233 std::stringstream sout;
234 sig_eigen_system.
Print(sout);
237 STATE printPlastic = fN.VolHardening();
243 fYC.ProjectSigmaDep(sigtrvec, fN.m_hardening, sigprvec, nextalpha, GradSigma);
244 fN.m_hardening = nextalpha;
247 if (logger->isDebugEnabled()) {
248 std::stringstream sout;
249 sout <<
"Sig Trial " << sigtrvec <<
"\nSig Project " << sigprvec << std::endl;
256 sig_eigen_system.fEigenvalues = sigprvec;
258 TangentOperator(GradSigma, eps_eigen_system, sig_eigen_system, Dep);
260 fER.ComputeStrain(sigma, epsElaNp1);
261 fN.m_eps_t = epsTotal;
268 if (logger2->isDebugEnabled()) {
269 if (
fabs(printPlastic - fN.m_hardening) > 1.e-4) {
270 std::stringstream sout;
273 epsElastic -= fN.m_eps_p;
274 Phi(epsElastic, phi);
275 sout <<
" \n phi = [";
276 for (
int i = 0; i < phi.
size(); i++) {
277 sout << phi[i] <<
" ";
280 sout <<
" ] " << endl;
282 sout <<
" \n eigenvalues Sigma = [";
283 for (
int i = 0; i < 3; i++) {
284 sout << sig_eigen_system.fEigenvalues[i] <<
" ";
287 sout <<
" ] " << endl;
297 template <class YC_t, class ER_t>
302 unsigned int kival[] = {0, 0, 0, 1, 1, 2};
303 unsigned int kjval[] = {0, 1, 2, 1, 2, 2};
305 REAL lambda = fER.Lambda();
308 for (
unsigned int k = 0; k < 6; ++k) {
309 const unsigned int ki = kival[k];
310 const unsigned int kj = kjval[k];
311 for (
unsigned int i = 0; i < 3; ++i) {
312 for (
unsigned int j = 0; j < 3; ++j) {
313 REAL temp = 2 * G * eps_eigen_system.fEigenvectors[j][kj] * eps_eigen_system.fEigenvectors[j][ki];
319 for (
int l = 0; l < 6; ++l) {
320 const unsigned int li = kival[l];
321 const unsigned int lj = kjval[l];
322 Tangent(l, k) += temp * gradient(i, j) * eps_eigen_system.fEigenvectors[i][li] * eps_eigen_system.fEigenvectors[i][lj];
328 REAL deigensig = 0., deigeneps = 0.;
335 for (
unsigned int i = 0; i < 2; ++i) {
336 for (
unsigned int j = i + 1; j < 3; ++j) {
337 deigeneps = eps_eigen_system.fEigenvalues[i] - eps_eigen_system.fEigenvalues[j];
338 deigensig = sig_eigen_system.fEigenvalues[i] - sig_eigen_system.fEigenvalues[j];
342 factor = deigensig / deigeneps;
344 factor = fER.G() * (gradient(i, i) - gradient(i, j) - gradient(j, i) + gradient(j, j));
347 ProdT(eps_eigen_system.fEigenvectors[i], eps_eigen_system.fEigenvectors[j],temp_mat);
348 for (
unsigned int it = 0; it < 3; ++it) {
349 for (
unsigned int jt = 0; jt < 3; ++jt) {
350 tempMat(it,jt) += temp_mat(it,jt);
354 ProdT(eps_eigen_system.fEigenvectors[j], eps_eigen_system.fEigenvectors[i],temp_mat);
355 for (
unsigned int it = 0; it < 3; ++it) {
356 for (
unsigned int jt = 0; jt < 3; ++jt) {
357 tempMat(it,jt) += temp_mat(it,jt);
362 for (
unsigned int k = 0; k < 6; ++k) {
363 const unsigned int ki = kival[k];
364 const unsigned int kj = kjval[k];
366 temp_mat = (eps_eigen_system.fEigenvectors[j][ki] * eps_eigen_system.fEigenvectors[i][kj]) * factor * tempMat;
368 temp_mat = (eps_eigen_system.fEigenvectors[j][ki] * eps_eigen_system.fEigenvectors[i][kj] + eps_eigen_system.fEigenvectors[j][kj] * eps_eigen_system.fEigenvectors[i][ki]) * factor * tempMat;
371 for (
int l = 0; l < 6; l++) {
372 Tangent(l, k) += ColCorrV(l, 0);
380 template <
class YC_t,
class ER_t>
386 fN.m_eps_p.Scale(0.);
387 fN.m_eps_t.Scale(0.);
388 fN.m_hardening = kprev;
389 this->ApplyStrainComputeDep(EpsIni, SigmaTemp, dSigDe);
392 std::stringstream sout;
393 sout <<
"EpsIni " << EpsIni <<
"\nSigmaTemp " << SigmaTemp <<
"\ndSidDe " << dSigDe << std::endl;
397 fN.m_eps_p.Scale(0.);
398 fN.m_eps_t.Scale(0.);
399 fN.m_hardening = kprev;
402 REAL alphatable[] = {0.1, 0.2, 0.3, 0.4, 0.5, 0.6};
403 for (
int i = 0; i < 6; i++) {
404 alphatable[i] *= scale;
406 for (
int ia = 0; ia < 5; ia++) {
407 REAL alpha1 = alphatable[0];
408 REAL alpha2 = alphatable[ia + 1];
413 eps1.
Add(deps, alpha1);
414 eps2.
Add(deps, alpha2);
417 this->ApplyStrainComputeSigma(eps1, Sigma1);
418 fN.m_eps_p.Scale(0.);
419 fN.m_eps_t.Scale(0.);
420 fN.m_hardening = kprev;
423 this->ApplyStrainComputeSigma(eps2, Sigma2);
424 fN.m_eps_p.Scale(0.);
425 fN.m_eps_t.Scale(0.);
426 fN.m_hardening = kprev;
438 for (
int i = 0; i < 6; i++) {
439 tanmult1(i, 0) *= alpha1;
440 tanmult2(i, 0) *= alpha2;
444 TPZFNMatrix <6> sigprMat(6, 1, 0.), sigpr1Mat(6, 1, 0.), sigpr2Mat(6, 1, 0.);
445 SigMatTemp33 = SigmaTemp;
447 SigMatTemp33 = Sigma1;
449 SigMatTemp33 = Sigma2;
454 if (logger->isDebugEnabled()) {
455 std::stringstream sout;
456 sigprMat.Print(
"sigprMat", sout);
457 sigpr1Mat.Print(
"sigpr1Mat", sout);
458 tanmult1.Print(
"tanmult1", sout);
459 sigpr2Mat.
Print(
"sigpr2Mat", sout);
460 tanmult2.
Print(
"tanmult2", sout);
464 for (
int i = 0; i < 6; i++) {
465 error1(i, 0) = sigpr1Mat(i, 0) - sigprMat(i, 0) - tanmult1(i, 0);
466 error2(i, 0) = sigpr2Mat(i, 0) - sigprMat(i, 0) - tanmult2(i, 0);
469 if (logger->isDebugEnabled()) {
470 std::stringstream sout;
471 error1.Print(
"error1:", sout);
472 error2.
Print(
"error2:", sout);
480 n = (
log(norm1) -
log(norm2)) / (
log(alpha1) -
log(alpha2));
484 std::cout <<
"coef = " << coef << std::endl;
487 template <
class YC_t,
class ER_t >
490 REAL norm1, norm2, n;
493 n =
log(norm1 / norm2) /
log(alpha1 / alpha2);
500 for (
int i = 0; i < mat.
Rows(); i++) {
501 norm += mat(i, 0) * mat(i, 0);
510 for (
int i = 0; i < m1.
Rows(); i++) {
511 dot += m1(i, 0) *
m2(i, 0);
518 for (
int i = 0; i < 3; i++) {
519 for (
int j = 0; j < 3; j++) {
520 mat(i, j) = v1[i] * v2[j];
527 for (
int i = 0; i < 3; i++) {
528 for (
int j = 0; j < 3; j++) {
529 mat(i, j) = v1[i] * v2[j];
538 for (
int i = 0; i < 3; i++) {
539 for (
int j = i; j < 3; j++) {
540 voi(k++, 0) = mat(i, j);
546 template <
class YC_t,
class ER_t>
550 std::cout <<
" \n this method is not implemented in PlasticStepPV. ";
555 template <
class YC_t,
class ER_t>
564 ApplyStrainComputeSigma(epsTotal, GuessStress, &Dep);
566 if (logger->isDebugEnabled()) {
567 std::stringstream sout;
572 Diff = GivenStress - GuessStress;
574 STATE norm =
Norm(Diff), normprev;
578 while (norm>tol && counter<30) {
579 CopyFromTensorToFMatrix(Diff, DiffFN);
581 CopyFromFMatrixToTensor(DiffFN, Diff);
588 epsTotal.
Add(Diff, scale);
590 ApplyStrainComputeSigma(epsTotal, GuessStress, &Dep);
592 if (logger->isDebugEnabled()) {
593 std::stringstream sout;
600 Diff2 = GivenStress-GuessStress;
601 CopyFromTensorToFMatrix(Diff2, DiffFN);
606 }
while (norm >= normprev && counter2 < 30);
610 ApplyStrainComputeSigma(epsTotal, GuessStress, &Dep);
613 template <
class YC_t,
class ER_t >
619 template <
class YC_t,
class ER_t>
623 fER.ComputeStress(eps, sigma);
627 sigvec[0] = DecSig.fEigenvalues[0];
628 sigvec[1] = DecSig.fEigenvalues[1];
629 sigvec[2] = DecSig.fEigenvalues[2];
630 fYC.Phi(sigvec, fN.VolHardening(), phi);
633 template <
class YC_t,
class ER_t>
639 template<
class YC_t,
class ER_t>
641 fYC.Write(buf, withclassid);
642 fER.Write(buf, withclassid);
644 buf.
Write(&fMaxNewton);
645 fN.Write(buf, withclassid);
648 template<
class YC_t,
class ER_t>
650 fYC.Read(buf, context);
651 fER.Read(buf, context);
653 buf.
Read(&fMaxNewton);
654 fN.Read(buf, context);
675 template <
class YC_t,
class ER_t>
679 copy.
XX() = FNM(0, 0);
680 copy.
XY() = FNM(1, 0);
681 copy.
XZ() = FNM(2, 0);
682 copy.
YY() = FNM(3, 0);
683 copy.
YZ() = FNM(4, 0);
684 copy.
ZZ() = FNM(5, 0);
687 template <
class YC_t,
class ER_t>
691 copy(0, 0) = tensor.
XX();
692 copy(1, 0) = tensor.
XY();
693 copy(2, 0) = tensor.
XZ();
694 copy(3, 0) = tensor.
YY();
695 copy(4, 0) = tensor.
YZ();
696 copy(5, 0) = tensor.
ZZ();
699 template <
class YC_t,
class ER_t>
703 fYC.SetElasticResponse(ER);
clarg::argString m2("-m2", "argument matrix file name (text format)", "matrix2.txt")
expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ fabs
virtual void ApplyStrainComputeDep(const TPZTensor< REAL > &epsTotal, TPZTensor< REAL > &sigma, TPZFMatrix< REAL > &Dep) override
void Add(const TPZTensor< T1 > &tensor, const T2 &constant)
virtual void ApplyStrain(const TPZTensor< REAL > &epsTotal) override
bool IsZero(long double a)
Returns if the value a is close Zero as the allowable tolerance.
int Solve_LU(TPZFMatrix< TVar > *B, std::list< int64_t > &singular)
Solves the linear system using LU method .
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 TaylorCheck(TPZTensor< REAL > &EpsIni, TPZTensor< REAL > &deps, REAL kprev, TPZVec< REAL > &conv)
void ComputeEigenvectors(TPZDecomposed &eigensystem) const
virtual void Phi(const TPZTensor< REAL > &epsTotal, TPZVec< REAL > &phi) const override
Return the value of the yield functions for the given strain.
TPZFNMatrix< 6 > FromMatToVoight(TPZFNMatrix< 9 > mat)
REAL ComputeNFromTaylorCheck(REAL alpha1, REAL alpha2, TPZFMatrix< REAL > &error1Mat, TPZFMatrix< REAL > &error2Mat)
virtual void SetElasticResponse(TPZElasticResponse &ER) override
int64_t size() const
Returns the number of elements of the vector.
void Read(TPZStream &buf, void *context) override
read objects from the stream
void Write(TPZStream &buf, int withclassid) const override
Writes this object to the TPZStream buffer. Include the classid if withclassid = true.
virtual void SetState(const TPZPlasticState< REAL > &state) override
Update the damage values.
virtual void Write(const bool val)
TVar Norm(const TPZFMatrix< TVar > &A)
Returns the norm of the matrix A.
#define DebugStop()
Returns a message to user put a breakpoint in.
virtual void InitialDamage(const TPZTensor< REAL > &sigma, REAL &k)
#define LOGPZ_DEBUG(A, B)
Define log for debug info.
void EigenSystem(TPZDecomposed &eigensystem) const
void CopyFromTensorToFMatrix(TPZTensor< STATE > tensor, TPZFMatrix< STATE > ©)
void Scale(const T2 &constant)
int64_t Rows() const
Returns number of rows.
expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ sqrt
REAL NormVecOfMat(TPZFNMatrix< 9 > mat)
virtual void ApplyStressComputeStrain(const TPZTensor< REAL > &sigma, TPZTensor< REAL > &epsTotal, TPZFMatrix< REAL > *tangent_inv=NULL)
void Print(std::ostream &out) const
expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ log
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.
TPZFMatrix< REAL > ProdT(TPZManVector< REAL, 3 > &v1, TPZManVector< REAL, 3 > &v2)
Classe que efetua avanco de um passo de plastificacao utilizando o metodo de Newton.
virtual void ApplyLoad(const TPZTensor< REAL > &sigma, TPZTensor< REAL > &epsTotal) override
int64_t Cols() const
Returns number of cols.
virtual void ApplyStrainComputeSigma(const TPZTensor< REAL > &epsTotal, TPZTensor< REAL > &sigma, TPZFMatrix< REAL > *tangent=NULL) override
virtual void Print(std::ostream &out) const
int Resize(const int64_t newRows, const int64_t wCols) override
Redimension a matrix, but maintain your elements.
REAL InnerVecOfMat(TPZFMatrix< REAL > &m1, TPZFMatrix< REAL > &m2)
Defines the interface for saving and reading data. Persistency.
virtual TPZPlasticState< REAL > GetState() const override
void push_back(const T object)
virtual void TrialStressCorrection(REAL kappa, TPZVec< STATE > &sigma, TPZVec< STATE > &sigma_tr)
Method that correct the Sigma trial based on the intersection with the yield surface.
void CopyFromFMatrixToTensor(TPZFMatrix< STATE > FNM, TPZTensor< STATE > ©)
Object which represents the yield criterium.
virtual void Read(bool &val)