36 static LoggerPtr pointloadconfig(Logger::getLogger(
"plasticity.loadconfig"));
37 static LoggerPtr plasticIntegrLogger(Logger::getLogger(
"plasticity.plasticIntegr"));
41 static LoggerPtr logger(Logger::getLogger(
"pz.PLASTIC_STEP.main"));
42 static LoggerPtr loggerx(Logger::getLogger(
"pz.PLASTIC_STEP.main"));
43 static LoggerPtr loggerPlasticResidual(Logger::getLogger(
"PLASTIC_RESIDUAL"));
44 static LoggerPtr loggerDEP1(Logger::getLogger(
"pz.PLASTIC_STEP.DEP1"));
45 static LoggerPtr loggerDEP2(Logger::getLogger(
"pz.PLASTIC_STEP.DEP2"));
48 template <
class YC_t,
class TF_t,
class ER_t>
50 return fPlasticMem.NElements() - 2;
53 template <
class YC_t,
class TF_t,
class ER_t>
57 #ifdef LOG4CXX_PLASTICITY 59 std::stringstream sout1, sout2;
60 sout1 <<
">>> SetState_Internal ***";
61 sout2 <<
"\nfN.m_eps_p << " << fN.
m_eps_p <<
"\nfN.m_hardening << " << fN.m_hardening;
68 template <
class YC_t,
class TF_t,
class ER_t>
73 template <
class YC_t,
class TF_t,
class ER_t>
76 int multipl = SignCorrection();
79 fN.m_eps_t *= multipl;
81 #ifdef LOG4CXX_PLASTICITY 83 std::stringstream sout1, sout2;
84 sout1 <<
">>> SetUp ***";
85 sout2 <<
"\nfN.m_eps_p << " << fN.m_eps_p <<
"\nfN.m_hardening << " << fN.m_hardening;
92 template <
class YC_t,
class TF_t,
class ER_t>
94 int multipl = SignCorrection();
102 template <
class YC_t,
class TF_t,
class ER_t>
105 fN.m_eps_t = epsTotal;
107 #ifdef LOG4CXX_PLASTICITY 109 std::stringstream sout1, sout2;
110 sout1 <<
">>> SetUp ***";
116 template <
class YC_t,
class TF_t,
class ER_t>
119 epsTotal_Internal *= SignCorrection();
120 ApplyStrain_Internal(epsTotal_Internal);
123 template <
class YC_t,
class TF_t,
class ER_t>
126 bool require_tangent_Q =
true;
128 require_tangent_Q =
false;
133 if (!(tangent->
Rows() == 6 && tangent->
Cols() == 6)) {
134 std::cerr <<
"Unable to compute the tangent operator. Required tangent array dimensions are 6x6." << std::endl;
139 if (require_tangent_Q) {
143 int multipl = SignCorrection();
145 epsTotal_Internal *= multipl;
146 ApplyStrainComputeSigma_Internal(epsTotal_Internal, sigma);
150 template <
class YC_t,
class TF_t,
class ER_t>
152 int multipl = SignCorrection();
154 epsTotal_Internal *= multipl;
155 ApplyStrainComputeDep_Internal(epsTotal_Internal, sigma, Dep);
159 template <
class YC_t,
class TF_t,
class ER_t>
162 sigma_Internal *= SignCorrection();
163 ApplyLoad_Internal(sigma_Internal, epsTotal);
164 epsTotal *= SignCorrection();
167 template <
class YC_t,
class TF_t,
class ER_t>
170 epsTotal_Internal *= SignCorrection();
172 Phi_Internal(epsTotal_Internal, phi);
177 template <
class YC_t,
class TF_t,
class ER_t>
179 fInterfaceTensionSign = (s >= 0) ? 1 : -1;
182 template <
class YC_t,
class TF_t,
class ER_t>
184 return fMaterialTensionSign * fInterfaceTensionSign;
187 template <
class YC_t,
class TF_t,
class ER_t>
195 epsE_T.
Add(state_T.
EpsP(), T(-1.));
197 fER.ComputeStress(epsE_T, sigma_T);
202 template <
class YC_t,
class TF_t,
class ER_t>
204 #ifdef LOG4CXX_PLASTICITY 206 std::stringstream sout1, sout2;
207 sout1 <<
">>> IsStrainElastic ***";
208 sout2 <<
"\nstate.EpsT() << " << state.
EpsT();
217 ComputePlasticVars<REAL>(state, sigma, A);
222 fYC.Compute(sigma, A, phi, 0);
225 for (i = 0; i < YC_t::NYield; i++) {
226 if (phi[i] > 0.)
break;
231 if (i == YC_t::NYield) {
232 #ifdef LOG4CXX_PLASTICITY 234 std::stringstream sout;
235 sout <<
"*** IsStrainElastic *** Strain yet in the elastic range - no damage variable needs update.\nExiting method ApplyStrain." 237 for (
int j = 0; j < YC_t::NYield; j++)sout << phi[j] <<
" ";
243 #ifdef LOG4CXX_PLASTICITY 245 std::stringstream sout;
246 sout <<
"*** IsStrainElastic *** Strain exceeds the elastic range - damage variables need update" 248 for (
int j = 0; j < YC_t::NYield; j++)sout << phi[j] <<
" ";
256 template <
class YC_t,
class TF_t,
class ER_t>
261 std::stringstream sout;
262 sout <<
">>> ApplyStrain_Internal *** Imposed epsTotal << " << epsTotal;
266 #ifdef LOG4CXX_PLASTICITY 268 std::stringstream sout;
269 sout <<
">>> ApplyStrain_Internal *** Imposed epsTotal << " << epsTotal;
275 ProcessStrain(epsTotal);
277 int n = fPlasticMem.NElements();
282 #ifdef LOG4CXX_PLASTICITY 284 std::stringstream sout;
285 sout <<
"*** ProcessStrain *** Exiting Method.";
292 template <
class YC_t,
class TF_t,
class ER_t>
295 #ifdef LOG4CXX_PLASTICITY 297 std::stringstream sout1;
298 sout1 <<
">>> ProcessStrainNoSubIncrement ***";
303 REAL yieldMultipl = 0;
305 fPlasticMem.Resize(0);
319 #ifdef LOG4CXX_PLASTICITY 321 std::stringstream sout1;
322 sout1 <<
">>> ProcessStrainNoSubIncrement *** behaviour imposed to be Elastic";
330 #ifdef LOG4CXX_PLASTICITY 332 std::stringstream sout1;
333 sout1 <<
">>> ProcessStrainNoSubIncrement *** behaviour imposed to be Plastic";
340 if (ep ==
EAuto) elastic = IsStrainElastic(Np1);
354 yieldMultipl = FindPointAtYield(Np1.
EpsT(), stateAtYield);
356 PushPlasticMem(stateAtYield,
365 DeltaEpsP_guess.
Add(stateAtYield.m_eps_t, -1.);
375 REAL normEpsPErr = 0.;
379 succeeded = PlasticLoop(stateAtYield, Np1, delGamma, normEpsPErr, lambda, validEqs);
381 if (normEpsPErr < fIntegrTol && succeeded) {
382 PushPlasticMem(Np1, 1., lambda, delGamma, validEqs, fYC.GetForceYield());
387 deltaEpsTotal.
Add(stateAtYield.EpsT(), -1.);
396 succeeded = PlasticLoop(stateAtYield, Np1, delGamma, normEpsPErr, lambda, validEqs);
400 for (k = 0; k < 6; k++)residual_mat(k, 0) =
res.fData[k] - epstyield.
fData[k];
401 for (k = 0; k < 6; k++)resnorm +=
pow(residual_mat(k, 0), 2.);
402 resnorm =
sqrt(resnorm);
405 }
while (resnorm > 1.e-3 && succeeded);
408 PushPlasticMem(Np1, 1., lambda, delGamma, validEqs, fYC.GetForceYield());
410 cout <<
"\n ProcessStrainNoSubIncrement ";
411 cout <<
"\n fIntegrTol = " << fIntegrTol;
412 cout <<
"\n lambda = " << lambda;
413 cout <<
"\n delGamma = " << delGamma;
414 cout <<
"\n fIntegrTol = " << fIntegrTol;
418 template <
class YC_t,
class TF_t,
class ER_t>
421 #ifdef LOG4CXX_PLASTICITY 423 std::stringstream sout1;
424 sout1 <<
">>> ProcessStrain ***";
429 REAL yieldMultipl = 0;
431 fPlasticMem.Resize(0);
446 #ifdef LOG4CXX_PLASTICITY 448 std::stringstream sout1;
449 sout1 <<
">>> ProcessStrain *** behaviour imposed to be Elastic";
457 #ifdef LOG4CXX_PLASTICITY 459 std::stringstream sout1;
460 sout1 <<
">>> ProcessStrain *** behaviour imposed to be Plastic";
468 bool result = IsStrainElastic(Np1);
469 elastic = (result == 1);
484 yieldMultipl = FindPointAtYield(Np1.
EpsT(), stateAtYield);
486 PushPlasticMem(stateAtYield,
495 DeltaEpsP_guess.
Add(stateAtYield.m_eps_t, -1.);
498 PlasticIntegrate(stateAtYield, Np1, fIntegrTol);
504 template <
class YC_t,
class TF_t,
class ER_t>
511 std::stringstream sout;
512 sout <<
">>> ApplyStrainComputeDep_Internal *** Imposed epsTotal << " << epsTotal;
516 #ifdef LOG4CXX_PLASTICITY 518 std::stringstream sout;
519 sout <<
">>> ApplyStrainComputeDep_Internal *** Imposed epsTotal << " << epsTotal;
524 ApplyStrain_Internal(epsTotal);
526 #ifdef LOG4CXX_PLASTICITY 528 std::stringstream sout;
529 sout <<
"*** ApplyStrainComputeDep *** \n Calling ComputeDep";
534 ComputeDep(sigma, Dep);
871 template <
class YC_t,
class TF_t,
class ER_t>
874 const int nyield = YC_t::NYield;
875 const int nVarsResidual = 7 + nyield;
876 const int nVarsTensor = 6;
883 REAL normResidual, normResidual2, resnorm;
899 TPZDiffMatrix< REAL > tangent(nVarsResidual, nVarsResidual), residual_RES(nVarsResidual, 1), Sol_RES(nVarsResidual, 1);
908 int n = fPlasticMem.NElements();
912 if (logger->isDebugEnabled()) {
913 std::stringstream sout;
914 sout <<
">>> ComputeDep2 *** Insufficient Plastic Mem Entries: " << n <<
".";
915 LOGPZ_ERROR(plasticIntegrLogger, sout.str().c_str());
920 std::stringstream sout;
921 sout <<
">>> ComputeDep2 *** Insufficient Plastic Mem Entries: " << n <<
".";
929 std::stringstream sout;
930 sout <<
">>> ComputeDep2 *** Plastic Mem Entries: " << n <<
".";
931 if (n == 2) sout <<
"\nTwo entries indicate pure elastic step";
937 fPlasticMem[1].m_elastoplastic_state.CopyTo(Nkp1_FAD);
938 for (
int i = 0; i < nVarsTensor; i++)Nkp1_FAD.
m_eps_t.fData[i].fastAccessDx(i) = 1.;
945 fPlasticMem[1].m_elastoplastic_state.CopyTo(Nk_FADRES);
946 fPlasticMem[1].m_elastoplastic_state.CopyTo(Nkp1_FAD);
954 for (
int plasticstep = 2; plasticstep < n; plasticstep++) {
955 InitializePlasticFAD(fPlasticMem[plasticstep].m_elastoplastic_state,
956 fPlasticMem[plasticstep].fDelGamma,
960 fYC.SetForceYield(fPlasticMem[plasticstep].fForceYield);
962 fPlasticMem[plasticstep].m_elastoplastic_state.
CopyTo(Nkp1_FAD);
963 for (
int j = 0; j < 6; j++) {
964 Nkp1_FAD.
m_eps_t[j].fastAccessDx(j) = fPlasticMem[plasticstep].fK;
966 for (
int i = 0; i < YC_t::NYield; i++) {
967 delGamma_FAD[i] = fPlasticMem[plasticstep].fDelGamma[i];
974 std::stringstream sout;
975 sout <<
"*** ComputeDep2 *** Before Matrix Invertion: Plastic step number " << plasticstep - 1 <<
" of " << n - 1
976 <<
"\n*Nk_FADFAD = " << setw(10) << Nk_FADRES
977 <<
"\n*Nkp1_FADFAD = " << setw(10) << Nkp1_FADRES
978 <<
"\n*delGamma_FADFAD = " << setw(10) << delGamma_FADRES
979 <<
"\nNk_FAD= " << Nk_FAD
980 <<
"\nNkp1_FAD = " << Nkp1_FAD
981 <<
"\ndelGamma_FAD = " << delGamma_FAD;
987 PlasticResidual<TFAD_RES, TFAD_RES>(Nk_FADRES, Nkp1_FADRES,
988 delGamma_FADRES, Residual_FADRES,
990 PlasticResidual<TFAD, TFAD>(Nk_FAD, Nkp1_FAD, delGamma_FAD, Residual_FAD, normResidual2);
996 int precondtangent = 1;
997 int resetInvalidEqs = 1;
998 ExtractTangent(Residual_FADRES, residual_RES,
1000 fPlasticMem[plasticstep].fValidEqs, pivots,
1001 precondtangent, resetInvalidEqs);
1003 ExtractTangent(Residual_FAD, residualFAD_STATE, resnorm, tangentFAD, fPlasticMem[plasticstep].fValidEqs, pivots, precond, resetInvalidEqs);
1005 for (
int i = 0; i < tangentFAD.Rows(); i++) {
1006 for (
int j = 0; j < tangentFAD.Cols(); j++) {
1007 tangentFAD(i, j) /= pivots[i];
1013 status = tangent.Decompose_LU();
1015 std::stringstream sout;
1016 sout <<
"*** ComputeDep2 *** ### Decompose_LU error! - ZeroPivot ### No inversion will be performed";
1018 sout <<
"\nMatrix before decomposition\n";
1019 sout << tangentcopy;
1020 LOGPZ_ERROR(plasticIntegrLogger, sout.str().c_str());
1022 #ifdef LOG4CXX_PLASTICITY 1025 cout << endl << sout.str().c_str();
1028 Sol_RES = tangentFAD;
1030 if (status !=
EOk) {
1031 std::stringstream sout;
1032 if (status ==
EIncompDim)sout <<
"*** ComputeDep2 *** ### LU Substitution error! - IncompatibleDimensions ### No inversion will be performed";
1033 if (status ==
EZeroPivot)sout <<
"*** ComputeDep2 *** ### LU Substitution error! - ZeroPivot ### No inversion will be performed";
1035 LOGPZ_ERROR(plasticIntegrLogger, sout.str().c_str());
1040 cout << endl << sout.str().c_str();
1047 std::stringstream sout;
1048 sout <<
"*** ComputeDep2 *** Plastic step number " << plasticstep - 1 <<
" of " << n - 1
1049 <<
"\nSol_FAD = " << setw(10) << Sol_RES
1050 <<
"\nResidual_FADRES = " << setw(10) << Residual_FADRES
1051 <<
"\ntangentFAD = " << tangentFAD;
1057 for (j = 0; j < nVarsTensor; j++)
for (
int k = 0; k < 6; k++) Nkp1_FAD.m_eps_p.fData[j].fastAccessDx(k) = -Sol_RES(j, k);
1058 for (
int k = 0; k < 6; k++) Nkp1_FAD.m_hardening.fastAccessDx(k) = -Sol_RES(j, k);
1060 for (
int k = 0; k < 6; k++)
for (j = 0; j < YC_t::NYield; j++) delGamma_FAD[j].
fastAccessDx(k) = -Sol_RES(j + 7, k);
1065 std::stringstream sout;
1066 sout <<
"*** ComputeDep2 *** substep " << plasticstep - 1 <<
" of " << n - 2
1067 <<
" solved with residual = " << resnorm;
1076 ComputePlasticVars(Nkp1_FAD, sigma_FAD, A_FAD);
1078 for (
int i = 0; i < nVarsTensor; i++)
for (j = 0; j < nVarsTensor; j++)Dep(i, j) = sigma_FAD.
fData[i].dx(j);
1082 std::stringstream sout;
1083 sout <<
"*** ComputeDep2 *** \nsigma_FAD= \n" << sigma_FAD
1084 <<
"\nDep =\n" << Dep;
1280 template <
class YC_t,
class TF_t,
class ER_t>
1285 #ifdef LOG4CXX_PLASTICITY 1287 int plasticIntegrOutput;
1290 std::stringstream sout;
1291 sout <<
">>> FindPointAtYield ***";
1296 const int nVars = 1;
1299 TFAD_One A_FAD, multipl_FAD;
1304 REAL multiplN, minMultipl = 1.;
1308 stateAtYield.
CopyTo(stateAtYield_FAD);
1315 ComputePlasticVars(stateAtYield, sigma, A);
1317 fYC.Compute(sigma, A, phi, 0);
1321 epsTotalNp1.
CopyTo(deltaEps);
1322 deltaEps.
Add(fN.EpsT(), -1.);
1324 int i, nyield = YC_t::NYield;
1327 for (i = 0; i < nyield; i++) {
1335 deltaEps.
CopyTo(deltaEps_FAD);
1338 TFAD_One mult(multiplN, 0);
1339 deltaEps_FAD *= mult;
1340 stateAtYield.
CopyTo(stateAtYield_FAD);
1341 stateAtYield_FAD.
m_eps_t += deltaEps_FAD;
1346 ComputePlasticVars(stateAtYield_FAD, sigma_FAD, A_FAD);
1348 fYC.Compute(sigma_FAD, A_FAD, phi_FAD, 0);
1351 if (logger->isDebugEnabled()) {
1352 std::stringstream sout;
1353 sout <<
"State at yield " << stateAtYield_FAD << std::endl;
1354 sout <<
"Sigma " << sigma_FAD << std::endl;
1355 sout <<
"phi " << phi_FAD << std::endl;
1362 if (phi_FAD[i].
val() < fResTol) {
1367 if (phi[i] > -fResTol) {
1374 while (
fabs(phi_FAD[i].
val()) > fResTol) {
1376 REAL phi_prev = phi_FAD[i].val();
1377 deltaEps.
CopyTo(deltaEps_FAD);
1380 TFAD_One mult(multiplN, 0);
1381 deltaEps_FAD *= mult;
1382 stateAtYield.
CopyTo(stateAtYield_FAD);
1383 stateAtYield_FAD.
m_eps_t += deltaEps_FAD;
1386 ComputePlasticVars(stateAtYield_FAD, sigma_FAD, A_FAD);
1388 fYC.Compute(sigma_FAD, A_FAD, phi_FAD, 0);
1391 if (logger->isDebugEnabled()) {
1392 std::stringstream sout;
1393 sout <<
"State at yield " << stateAtYield_FAD << std::endl;
1394 sout <<
"Sigma " << sigma_FAD << std::endl;
1395 sout <<
"phi " << phi_FAD << std::endl;
1403 REAL derX = phi_FAD[i].dx(0);
1404 if (
fabs(derX) < 1.e-8) derX += 1.e-8;
1405 REAL delmult = -phi_FAD[i].val() / derX;
1406 if (multiplN == 1.0 && delmult > 0.) {
1410 multiplN += delmult;
1411 if (multiplN > 1.) multiplN = 1.;
1414 #ifdef LOG4CXX_PLASTICITY 1416 std::stringstream sout;
1417 sout <<
"*** FindPointAtYield *** multiplication factor= ";
1418 sout << multiplN <<
" such that yield of function ";
1419 sout << i <<
" = " << phi_FAD[i].val();
1420 if (count >= fMaxNewton) {
1421 sout <<
"\n#### Truncated Newton after " 1422 << fMaxNewton <<
" steps with phi[" << i <<
"] = " 1424 <<
"####. It appears in such load path the plastic yield solution was found in the opposite direction." 1425 <<
"\nPlease check the other(s) yield function(s) to guarantee at least one of them is plastifying within the proposed load path.";
1427 LOGPZ_WARN(plasticIntegrLogger, sout.str().c_str());
1435 if (multiplN < minMultipl)minMultipl = multiplN;
1438 if (minMultipl < fResTol) {
1442 std::stringstream sout;
1443 sout <<
"*** FindPointAtYield *** Ignoring deltaStrainMultiplier = " << minMultipl
1444 <<
" and setting it to zero.\n\t###### WARN: EpsTotalN isn't elastic!! ######";
1445 LOGPZ_WARN(plasticIntegrLogger, sout.str().c_str());
1448 #ifdef LOG4CXX_PLASTICITY 1450 std::stringstream sout;
1451 sout <<
"*** FindPointAtYield *** Ignoring deltaStrainMultiplier = " << minMultipl
1452 <<
" and setting it to zero.\n\t###### WARN: EpsTotalN isn't elastic!! ######";
1460 stateAtYield.
m_eps_t.
Add(deltaEps, minMultipl);
1462 #ifdef LOG4CXX_PLASTICITY 1464 std::stringstream sout;
1465 sout <<
"<<< FindPointAtYield *** Exiting Method with deltaStrainMultiplier = " << minMultipl;
1467 if (plasticIntegrOutput)
LOGPZ_DEBUG(plasticIntegrLogger, sout.str().c_str());
1483 template <
class YC_t,
class TF_t,
class ER_t>
1493 template <
class YC_t,
class TF_t,
class ER_t>
1503 const int nVars = 7 + YC_t::NYield;
1505 const REAL Tol = fResTol;
1508 if (pointloadconfig->isDebugEnabled()) {
1509 std::stringstream sout;
1510 sout <<
"alpha = " << NN.
m_hardening << std::endl;
1517 fER.ComputeStress(deformElast, sigmaT);
1523 InitialGuess(NN, Np1, delGamma, validEqs);
1526 std::stringstream sout;
1527 sout <<
" >>> PlasticLoop ***\n";
1528 sout <<
"Np1 = " << Np1
1529 <<
"\ndelGamma = " << delGamma
1530 <<
"\nlambda = " << lambda
1531 <<
"\nValid eqs = " << validEqs;
1553 for (
int i = 0; i < validEqs.
size(); i++) {
1554 if (validEqs[i] != 0) {
1558 int countNewton = 0;
1559 int switchvalid = 0;
1566 ComputePlasticVars<REAL>(Np1, sigmaGuess, AGuess);
1567 fYC.SetYieldStatusMode(sigmaGuess, AGuess);
1569 InitializePlasticFAD(Np1, delGamma, Np1_FAD, delGamma_FAD);
1572 std::stringstream sout;
1573 sout <<
"Before plastic residual\n";
1574 sout <<
"Np1_FAD\n" << Np1_FAD << std::endl;
1575 sout <<
"delGamma_FAD " << delGamma_FAD << std::endl;
1580 PlasticResidual<REAL, TFAD>(NN, Np1_FAD, delGamma_FAD, epsRes_FAD, normEpsPErr);
1584 std::stringstream sout;
1585 sout <<
"After Plastic residual\nepsRes_FAD = \n" << epsRes_FAD << std::endl;
1586 sout <<
"delGamma_FAD " << delGamma_FAD << std::endl;
1591 if (countReset == 0)InitializeValidEqs(epsRes_FAD, validEqs);
1593 #ifdef LOG4CXX_PLASTICITY 1595 std::stringstream sout;
1596 sout <<
"*** PlasticLoop *** PlasticLoop main loop with " 1597 << countReset <<
"-th valid equation set: {" 1598 << validEqs <<
"}.";
1606 ExtractTangent(epsRes_FAD, ResVal, resnorm, tangent, validEqs, pivots, 1, 1);
1609 std::stringstream sout;
1638 st.
Solve(ResVal, Sol, 0);
1641 lambda = UpdatePlasticVars(NN, Np1_FAD, delGamma_FAD, epsRes_FAD, Sol, validEqs);
1644 if (countNewton > 8) {
1645 std::cout <<
"countNewton = " << countNewton <<
" resnorm " << resnorm <<
" tolerance " << fResTol <<
"\n";
1648 PlasticResidual<REAL, TFAD>(NN, Np1_FAD, delGamma_FAD, epsRes_FAD, normEpsPErr);
1652 std::stringstream sout;
1653 sout <<
"Plastic residual " << epsRes_FAD << std::endl;
1654 sout <<
"delGamma_FAD " << delGamma_FAD << std::endl;
1659 ExtractTangent(epsRes_FAD, ResVal, resnorm, tangent, validEqs, pivots, 1, 1);
1661 #ifdef LOG4CXX_PLASTICITY 1663 std::stringstream sout1, sout2;
1664 sout1 <<
"*** PlasticLoop *** Newton's " << countNewton
1665 <<
"-th iteration with residual norm = " << resnorm;
1672 }
while (resnorm > Tol && countNewton < fMaxNewton);
1677 std::stringstream sout;
1678 sout <<
"*** PlasticLoop *** Exiting Newton's scheme after " << countNewton
1679 <<
" steps and with residual norm = " << resnorm;
1680 if (resnorm > Tol) {
1681 sout <<
"\n###### Max Newton steps achieved - Truncating Newton ######";
1682 LOGPZ_WARN(plasticIntegrLogger, sout.str().c_str());
1684 LOGPZ_DEBUG(plasticIntegrLogger, sout.str().c_str());
1688 #ifdef LOG4CXX_PLASTICITY 1690 std::stringstream sout1, sout2;
1691 sout1 <<
"*** PlasticLoop *** Exiting Newton's scheme after " << countNewton
1692 <<
" steps and with residual norm = " << resnorm;
1694 if (resnorm > Tol) {
1695 sout2 <<
"\n###### Max Newton steps achieved - Truncating Newton ######";
1703 }
while (switchvalid < 3 && RemoveInvalidEqs(delGamma_FAD, epsRes_FAD, validEqs));
1711 if (switchvalid == 3) {
1712 std::cout << __FUNCTION__ <<
" should stop switchvalid\n";
1717 for (i = 0; i < YC_t::NYield; i++)
1718 delGamma[i] = delGamma_FAD[i].
val();
1735 std::stringstream sout1, sout2;
1736 sout1 <<
"<<< PlasticLoop *** Exiting Method";
1737 sout2 <<
"\nNp1 << " << Np1
1738 <<
"\ndelGamma = " << delGamma
1739 <<
"\nValidEqs = {" << validEqs <<
"}";
1746 if (pointloadconfig->isDebugEnabled()) {
1747 std::stringstream sout;
1748 sout <<
"alphanp1 = " << Np1.
m_hardening << std::endl;
1751 sout <<
"delGamma = {" << delGamma <<
"};\n";
1756 return resnorm <= Tol;
1759 template <
class YC_t,
class TF_t,
class ER_t>
1763 const REAL &TolEpsPErr) {
1769 REAL normEpsPErr = 0.;
1773 succeeded = PlasticLoop(N, Np1, delGamma, normEpsPErr, lambda, validEqs);
1775 if (normEpsPErr < TolEpsPErr && succeeded) {
1777 PushPlasticMem(Np1, 1., lambda, delGamma, validEqs, fYC.GetForceYield());
1789 deltaEpsTotal.
Add(N.
EpsT(), -1.);
1791 REAL k = 0., q = 1., kp1 = 0., multipl;
1793 ofstream outfile(
"integrate.txt");
1794 ofstream outfile2(
"integrate2.txt");
1799 multipl = 0.95 *
pow(TolEpsPErr / normEpsPErr, 0.5);
1801 if (multipl < 0.1) multipl = 0.1;
1802 if (multipl > 10.) multipl = 10.;
1804 if (!succeeded)multipl = 0.5;
1808 if (q < fMinStepSize)q = fMinStepSize;
1810 kp1 = min((REAL) 1.0, k + q);
1816 for (
int i = 0; i < YC_t::NYield; i++)delGamma[i] = 0.;
1820 std::stringstream sout;
1821 sout <<
"Nkp1 = " << Nkp1 << endl;
1822 sout <<
"Nk = " << Nk << endl;
1823 sout <<
"k = " << k << endl;
1824 sout <<
"normEpsPErr = " << normEpsPErr << endl;
1825 sout <<
"delGamma = " << delGamma << endl;
1826 sout <<
"lambda = " << lambda << endl;
1832 succeeded = PlasticLoop(Nk, Nkp1, delGamma, normEpsPErr, lambda, validEqs);
1835 if ((normEpsPErr < TolEpsPErr && succeeded) || kp1 - k < fMinStepSize * 1.001)
1838 PushPlasticMem(Nkp1, kp1, lambda, delGamma, validEqs, fYC.GetForceYield());
1846 outfile <<
"\n" << counter <<
" " << k;
1852 REAL razaoerros = normEpsPErr / TolEpsPErr;
1853 outfile2 <<
"\n" << counter <<
" " << razaoerros;
1860 template <
class YC_t,
class TF_t,
class ER_t>
1863 #ifdef LOG4CXX_PLASTICITY 1866 std::stringstream sout;
1867 sout <<
">>> InitializeValidEqs *** Res = ";
1872 const int nyield = YC_t::NYield;
1875 for (i = 0; i < nyield; i++) {
1892 template <
class YC_t,
class TF_t,
class ER_t>
1895 const int nyield = YC_t::NYield;
1898 if (nyield == 1)
return 0;
1902 #ifdef LOG4CXX_PLASTICITY 1905 std::stringstream sout;
1906 sout <<
">>> RemoveInvalidEqs *** delGamma = ";
1918 for (i = 0; i < nyield; i++) {
1920 BoolValidEq = validEqs[i];
1940 if (BoolValidEq && !BoolDelGamma) {
1954 template <
class YC_t,
class TF_t,
class ER_t>
1955 template<
class T1,
class T_VECTOR,
class T_MATRIX>
1964 const int resetInvalidEqs) {
1966 const int nyield = YC_t::NYield;
1967 const int nVars = 7 + nyield;
1969 int ncols = epsRes_FAD[0].
size();
1972 for (i = 0; i < nVars; i++) {
1973 for (j = 0; j < ncols; j++) {
1974 tangent(i, j) = epsRes_FAD[i].dx(j);
1976 ResVal(i, 0) = epsRes_FAD[i].val();
1989 if (resetInvalidEqs) {
1990 for (i = 0; i < nyield; i++) {
1991 if (validEqs[i] == 0) {
1992 for (j = 0; j < ncols; j++) {
1993 tangent(i + 7, j) = 0.;
1995 if (i + 7 < ncols) {
1996 tangent(i + 7, i + 7) = 1.;
1999 ResVal(i + 7, 0) = 0.;
2009 for (i = 0; i < nVars; i++) {
2012 resnorm =
sqrt(resnorm);
2014 if (precond && nVars != ncols) {
2021 for (i = 0; i < 7; i++) {
2022 REAL pivot = 0., elem;
2025 if (
fabs(pivot) <
fabs(elem))pivot = elem;
2029 for (j = 0; j < nVars; j++)
2030 tangent(i, j) = tangent(i, j) / pivot;
2031 ResVal(i, 0) = ResVal(i, 0) / pivot;
2034 for (; i < nVars; i++) {
2035 REAL pivot = 0., elem;
2036 for (j = 0; j < nVars; j++) {
2038 if (
fabs(pivot) <
fabs(elem))pivot = elem;
2042 for (j = 0; j < nVars; j++) {
2043 tangent(i, j) = tangent(i, j) / pivot;
2045 ResVal(i, 0) = ResVal(i, 0) / pivot;
2048 #ifdef LOG4CXX_PLASTICITY 2050 std::stringstream sout;
2051 sout <<
">>> ExtractTangent *** Residual norm = " << resnorm
2052 <<
"; precond = " << precond
2053 <<
"; resetInvalidEqs = " << resetInvalidEqs
2054 <<
"; validEqs = {" << validEqs <<
"}";
2060 template <
class YC_t,
class TF_t,
class ER_t>
2061 template <
class T1,
class T2>
2076 const int nyield = YC_t::NYield;
2094 T2 alphaRes_T2, ANp1_T2;
2097 ComputePlasticVars<T1>(N_T1, sigmaN_T1, AN_T1);
2098 ComputePlasticVars<T2>(Np1_T2, sigmaNp1_T2, ANp1_T2);
2101 fYC.N(sigmaN_T1, AN_T1, NdirN_T1, 0);
2102 fYC.N(sigmaNp1_T2, ANp1_T2, NdirNp1_T2, 1);
2105 for (i = 0; i < nyield; i++){
2106 for (j = 0; j < 6; j++){
2107 NdirMidPt_T2[i].fData[j] = ((NdirNp1_T2[i].fData[j]) * T2(1. - a)
2108 + (NdirN_T1[i].fData[j]) * T1(a));
2113 fYC.H(sigmaN_T1, AN_T1, HN_T1, 0);
2114 fYC.H(sigmaNp1_T2, ANp1_T2, HNp1_T2, 1);
2116 for (i = 0; i < nyield; i++) {
2117 HMidPt_T2[i] = (HNp1_T2[i] * T2(1. - a) + T2(HN_T1[i] * T1(a)));
2122 for (i = 0; i < nyield; i++) {
2123 NdirMidPt_T2[i].Multiply(delGamma_T2[i], T2(1.));
2124 epsResMidPt_T2.
Add(NdirMidPt_T2[i], T2(-1.));
2127 for (j = 0; j < 6; j++) {
2132 epsResMidPt_T2.
Add(N_T1.EpsP(), T1(-1.));
2133 epsResMidPt_T2.
Add(Np1_T2.EpsP(), T1(1.));
2139 std::stringstream sout;
2148 normEpsPErr = epsPErr.
Norm();
2154 alphaRes_T2 = Np1_T2.VolHardening() - N_T1.VolHardening();
2158 fYC.AlphaMultiplier(Np1_T2.VolHardening(), multiplier);
2159 alphaRes_T2 *= multiplier;
2160 for (i = 0; i < nyield; i++) {
2161 alphaRes_T2 -= delGamma_T2[i] * HMidPt_T2[i];
2168 fYC.Compute(sigmaNp1_T2, ANp1_T2, phiRes_T2, 1);
2172 for (i = 0; i < 6; i++) {
2173 res_T2[i] = epsResMidPt_T2.
fData[i];
2175 res_T2[i++] = alphaRes_T2;
2176 for (j = 0; j < nyield; j++) {
2177 res_T2[i++] = phiRes_T2[j];
2182 template <
class YC_t,
class TF_t,
class ER_t>
2183 template <
class T1,
class T2>
2194 const int nyield = YC_t::NYield;
2204 TPZManVector<TPZTensor<T2>, nyield> NdirNp1_T2(nyield), NdirMidPt_T2(nyield), K1N_T2(nyield), K2N_T2(nyield), K3N_T2(nyield), K4N_T2(nyield), KTOTALN_T2(nyield);
2208 TPZManVector<T2, nyield> phiRes_T2(nyield), HNp1_T2(nyield), HMidPt_T2(nyield), K1H_T2(nyield), K2H_T2(nyield), K3H_T2(nyield), K4H_T2(nyield), KTOTALH_T2(nyield);
2212 T2 alphaRes_T2, ANp1_T2;
2215 ComputePlasticVars<T1>(N_T1, sigmaN_T1, AN_T1);
2216 ComputePlasticVars<T2>(Np1_T2, sigmaNp1_T2, ANp1_T2);
2219 fYC.N(sigmaN_T1, AN_T1, NdirN_T1, 0);
2220 fYC.N(sigmaNp1_T2, ANp1_T2, NdirNp1_T2, 1);
2224 for (i = 0; i < nyield; i++) {
2225 for (j = 0; j < 6; j++) {
2226 K1N_T2[i].fData[j] = N_T1.m_eps_p.fData[j];
2227 K2N_T2[i].fData[j] = N_T1.m_eps_p.fData[j] + (NdirN_T1[i].fData[j]) * T2(0.5) * K1N_T2[i].fData[j];
2228 K3N_T2[i].fData[j] = N_T1.m_eps_p.fData[j] + (NdirN_T1[i].fData[j]) * T2(0.5) * K2N_T2[i].fData[j];
2229 K4N_T2[i].fData[j] = N_T1.m_eps_p.fData[j] + (NdirN_T1[i].fData[j]) * K3N_T2[i].fData[j];
2230 KTOTALN_T2[i].fData[j] = K1N_T2[i].fData[j] + T2(2.) * K2N_T2[i].fData[j] + T2(2.) * K3N_T2[i].fData[j] + K4N_T2[i].fData[j];
2232 NdirN_T1COPY[i].fData[j] = NdirN_T1[i].fData[j];
2241 fYC.H(sigmaN_T1, AN_T1, HN_T1, 0);
2242 fYC.H(sigmaNp1_T2, ANp1_T2, HNp1_T2, 1);
2244 for (i = 0; i < nyield; i++) {
2245 K1H_T2[i] = N_T1.m_hardening;
2246 K2H_T2[i] = N_T1.m_hardening + HN_T1[i] * T2(0.5) * K1H_T2[i];
2247 K3H_T2[i] = N_T1.m_hardening + HN_T1[i] * T2(0.5) * K2H_T2[i];
2248 K4H_T2[i] = N_T1.m_hardening + HN_T1[i] * K3H_T2[i];
2249 KTOTALH_T2[i] = K1H_T2[i]+(T2(2.) * K2H_T2[i])+(T2(2.) * K3H_T2[i]) + K2H_T2[i];
2256 for (i = 0; i < nyield; i++) {
2258 NdirN_T1COPY[i].Multiply(delGamma_T2[i], T2(1. / 6.));
2259 NdirN_T1COPY[i].Multiply(K1H_T2[i], T2(1.));
2260 epsResMidPt_T2.
Add(NdirN_T1COPY[i], T2(-1.));
2267 epsResMidPt_T2.
Add(N_T1.EpsP(), T1(-1.));
2268 epsResMidPt_T2.
Add(Np1_T2.EpsP(), T1(1.));
2272 normEpsPErr = epsPErr.
Norm();
2278 alphaRes_T2 = Np1_T2.VolHardening() - N_T1.VolHardening();
2279 for (i = 0; i < nyield; i++) {
2280 alphaRes_T2 -= delGamma_T2[i] * HN_T1[i] * T2(1. / 6.) * KTOTALH_T2[i];
2284 fYC.Compute(sigmaNp1_T2, ANp1_T2, phiRes_T2, 1);
2288 for (i = 0; i < 6; i++) {
2289 res_T2[i] = epsResMidPt_T2.
fData[i];
2291 res_T2[i++] = alphaRes_T2;
2292 for (j = 0; j < nyield; j++) {
2293 res_T2[i++] = phiRes_T2[j];
2298 if (plasticIntegrLogger->isDebugEnabled()) {
2299 std::stringstream sout;
2310 sout <<
"\n epsResMidPt_T2 = " << epsResMidPt_T2 << endl;
2311 sout <<
"\n alphaRes_T2 = " << alphaRes_T2 << endl;
2312 sout <<
"\n NdirN_T1 = " << NdirN_T1 << endl;
2313 LOGPZ_DEBUG(plasticIntegrLogger, sout.str().c_str());
2320 template <
class YC_t,
class TF_t,
class ER_t>
2321 template<
class T1,
class T2,
class TVECTOR>
2327 TVECTOR & Sol_TVECTOR,
2329 int updateVars)
const {
2330 const int nyield = YC_t::NYield;
2331 const int nVars = 7 + nyield;
2333 REAL sqrNormResN = 0, sqrNormResNp1, normEpsPErr;
2345 PlasticResidual<REAL, REAL>(N, Np1, delGamma,
res, normEpsPErr, 1 );
2348 sqrNormResNp1 =
pow(
sdot(res, res), 0.5);
2354 sqrNormResN = sqrNormResNp1;
2359 for (i = 0; i < 6; i++) Np1.m_eps_p.fData[i] -= lambda *
TPZExtractVal::val(Sol_TVECTOR(i));
2361 for (j = 0; j < nyield; j++)delGamma[j] = TPZExtractVal::val(delGamma_T2[j]) - lambda *
TPZExtractVal::val(Sol_TVECTOR(i++));
2363 PlasticResidual<REAL, REAL>(N, Np1, delGamma,
res, normEpsPErr, 1 );
2367 for (i = 0; i < nyield; i++)
2368 if (validEqs[i] == 0)
2371 sqrNormResNp1 =
pow(
sdot(res, res), 0.5);
2373 }
while (sqrNormResNp1 < sqrNormResN && lambda >= fMinLambda);
2379 #ifdef LOG4CXX_PLASTICITY 2381 std::stringstream sout;
2382 sout <<
"*** UpdatePlasticVars *** Line Search indicates lambda = " << lambda <<
" to ensure residual drop.";
2388 if (!updateVars)
return lambda;
2390 for (i = 0; i < 6; i++) Np1_T2.
m_eps_p.fData[i] -= T2(lambda * Sol_TVECTOR(i));
2391 Np1_T2.
m_hardening -= T2(lambda * Sol_TVECTOR(i++));
2392 for (j = 0; j < YC_t::NYield; j++) delGamma_T2[j] -= T2(lambda * Sol_TVECTOR(i++));
2398 template <
class YC_t,
class TF_t,
class ER_t>
2405 const int nVars)
const {
2407 int nVarsPlastic = 7 + YC_t::NYield;
2411 for (i = 0; i < YC_t::NYield; i++)delGamma_T[i] = delGamma[i];
2415 for (i = 0; i < 6; i++) state_T.
m_eps_p.fData[i].diff(i, nVars);
2420 for (i = 7; i < nVarsPlastic; i++) delGamma_T[i - 7].diff(i, nVars);
2424 template <
class YC_t,
class TF_t,
class ER_t>
2426 const int nVars = 6;
2436 if (plasticIntegrLogger->isDebugEnabled()) {
2437 std::stringstream sout;
2438 sout <<
">>> ProcessLoad *** Evaluating Sigma to compute the resultant stress for the guess strain - Preparing starting tangent matrix for Newton's scheme";
2439 sout <<
"\n sigma << " << sigma;
2440 LOGPZ_DEBUG(plasticIntegrLogger, sout.str().c_str());
2443 #ifdef LOG4CXX_PLASTICITY 2445 std::stringstream sout1, sout2;
2446 sout1 <<
">>> ProcessLoad *** Evaluating Sigma to compute the resultant stress for the guess strain - Preparing starting tangent matrix for Newton's scheme";
2447 sout2 <<
"\n sigma << " << sigma;
2514 ProcessStrain(epsTotal,
EAuto);
2515 ComputeDep(EEpsilon, Dep_mat);
2521 for (i = 0; i < nVars; i++)residual_mat(i, 0) = EEpsilon.
fData[i] - sigma.
fData[i];
2522 for (i = 0; i < nVars; i++)resnorm +=
pow(residual_mat(i, 0), 2.);
2523 resnorm =
sqrt(resnorm);
2525 while (resnorm > fResTol && k < fMaxNewton) {
2533 if (logger->isDebugEnabled()) {
2534 std::stringstream sout;
2535 Dep_mat.
Print(
"Derivative", sout);
2536 sout <<
"EEpsilon " << EEpsilon << std::endl;
2549 st.Solve(residual_mat, sol_mat, 0);
2555 REAL scalefactor = 1.;
2556 REAL resnormprev = resnorm;
2559 for (i = 0; i < nVars; i++)epsTotal.fData[i] = epsTotalPrev.
fData[i] - scalefactor * sol_mat(i, 0);
2563 if (logger->isDebugEnabled()) {
2564 std::stringstream sout;
2565 sout <<
"Next epsTotal " << epsTotal << std::endl;
2574 ProcessStrain(epsTotal, ep);
2575 ComputeDep(EEpsilon, Dep_mat);
2581 for (i = 0; i < nVars; i++)residual_mat(i, 0) = EEpsilon.
fData[i] - sigma.
fData[i];
2582 for (i = 0; i < nVars; i++)resnorm +=
pow(residual_mat(i, 0), 2.);
2583 resnorm =
sqrt(resnorm);
2586 }
while (resnorm > resnormprev);
2590 if (plasticIntegrLogger->isDebugEnabled()) {
2591 std::stringstream sout;
2592 sout <<
"*** ProcessLoad *** " << k <<
"-th iteration of Newton's scheme with residual = " << resnorm;
2593 LOGPZ_DEBUG(plasticIntegrLogger, sout.str().c_str());
2596 #ifdef LOG4CXX_PLASTICITY 2598 std::stringstream sout;
2599 sout <<
"*** ProcessLoad *** " << k <<
"-th iteration of Newton's scheme with residual = " << resnorm;
2604 if (k > fMaxNewton)cout <<
"\n*** ProcessLoad step " << k <<
" with res= " << resnorm;
2607 #ifdef LOG4CXX_PLASTICITY 2609 std::stringstream sout;
2611 if (k > fMaxNewton) {
2612 sout <<
"<<< ProcessLoad *** Exiting Method with residual = " << resnorm
2613 <<
" after " << k <<
" steps.";
2614 sout <<
"\n#### Truncated Newton ####. Results are unpredictable";
2616 LOGPZ_WARN(plasticIntegrLogger, sout.str().c_str());
2618 sout <<
"<<< ProcessLoad *** Exiting Method with residual = " << resnorm;
2620 LOGPZ_DEBUG(plasticIntegrLogger, sout.str().c_str());
2630 template <
class YC_t,
class TF_t,
class ER_t>
2638 ComputePlasticVars<REAL>(state, sigma, A);
2640 fYC.Compute(sigma, A, phi, 0);
2645 template <
class YC_t,
class TF_t,
class ER_t>
2650 const REAL & lambda,
2653 const int forceYield) {
2655 fPlasticMem.Push(Mem);
2659 template <
class YC_t,
class TF_t,
class ER_t>
2663 if (plasticIntegrLogger->isDebugEnabled()) {
2664 std::stringstream sout;
2665 sout <<
">>> ApplyLoad_Internal ***" 2666 <<
" Imposed sigma << " << sigma;
2667 LOGPZ_DEBUG(plasticIntegrLogger, sout.str().c_str());
2672 if (pointloadconfig->isDebugEnabled()) {
2673 std::stringstream sout;
2674 sout <<
">>> ApplyLoad_Internal ***" 2675 <<
" Imposed sigma << " << sigma;
2680 #ifdef LOG4CXX_PLASTICITY 2682 std::stringstream sout;
2683 sout <<
">>> ApplyLoad_Internal ***" 2684 <<
" Imposed sigma << " << sigma;
2694 #ifdef LOG4CXX_PLASTICITY 2696 std::stringstream sout;
2697 sout <<
">>> ApplyLoad_Internal ***" 2698 <<
" Forcing Elastic behaviour";
2704 int n = fPlasticMem.NElements();
2706 if (!IsStrainElastic(fPlasticMem[n - 1].m_elastoplastic_state)) {
2707 #ifdef LOG4CXX_PLASTICITY 2709 std::stringstream sout;
2710 sout <<
">>> ApplyLoad_Internal ***" 2711 <<
" Forcing Plastic behaviour - Elastic attempt led to a final plastic state";
2716 n = fPlasticMem.NElements();
2721 epsTotal = fN.m_eps_t;
2723 #ifdef LOG4CXX_PLASTICITY 2725 std::stringstream sout1, sout2;
2726 sout1 <<
"<<< ApplyLoad_Internal ***";
2727 sout2 <<
"\nOutput epsTotal << " << epsTotal;
2735 template <
class YC_t,
class TF_t,
class ER_t>
2737 int i, j, n = fPlasticMem.NElements();
2739 if (n <= 2)
return 0;
2741 plastifLen.
Fill(0.);
2742 REAL plasticLen = 0., deltaK;
2744 for (i = 2; i < n; i++) {
2745 deltaK = fPlasticMem[i].fK - fPlasticMem[i - 1].fK;
2746 for (j = 0; j < YC_t::NYield; j++)
if (fPlasticMem[i].fValidEqs[j])plastifLen[j] += deltaK;
2747 plasticLen += deltaK;
2753 template<
class YC_t,
class TF_t,
class ER_t>
2755 fYC.Write(buf, withclassid);
2756 fTFA.Write(buf, withclassid);
2757 fER.Write(buf, withclassid);
2758 buf.
Write(&fResTol);
2759 buf.
Write(&fIntegrTol);
2760 buf.
Write(&fMaxNewton);
2761 buf.
Write(&fMinLambda);
2762 buf.
Write(&fMinStepSize);
2763 fN.Write(buf, withclassid);
2764 if (fPlasticMem.NElements() > 0) {
2767 buf.
Write(&fMaterialTensionSign);
2768 buf.
Write(&fInterfaceTensionSign);
2771 template<
class YC_t,
class TF_t,
class ER_t>
2773 fYC.Read(buf, context);
2774 fTFA.Read(buf, context);
2775 fER.Read(buf, context);
2777 buf.
Read(&fIntegrTol);
2778 buf.
Read(&fMaxNewton);
2779 buf.
Read(&fMinLambda);
2780 buf.
Read(&fMinStepSize);
2781 fN.Read(buf, context);
2782 if (fPlasticMem.NElements() > 0) {
2785 buf.
Read(&fMaterialTensionSign);
2786 buf.
Read(&fInterfaceTensionSign);
2791 template <
class YC_t,
class TF_t,
class ER_t>
2801 template <
class YC_t,
class TF_t,
class ER_t>
2816 template <
class YC_t,
class TF_t,
class ER_t>
2842 TPZPlasticState<REAL> &,
2848 PlasticResidual<REAL, TFad<14, REAL> >(TPZPlasticState<REAL>
const &,
2851 TPZVec<TFad<14, REAL> > &,
2880 const TPZPlasticState<REAL> &N,
2881 TPZPlasticState<REAL> &Np1,
2882 TPZVec<REAL> &delGamma,
2889 ETrial.
Add(EpN, -1.);
2890 fER.ComputeStress(ETrial, sigmaTrial);
2894 sigPlast.
Add(sigproj, -1.);
2895 fER.ComputeStrain(sigPlast, Np1.
m_eps_p);
2898 for (
int i = 0; i < 2; i++) {
2899 if (delGamma[i] > 0.) {
2905 std::stringstream sout;
2906 sout <<
"epsp next " << Np1.
m_hardening << std::endl;
2907 sout <<
"delGamma " << delGamma << std::endl;
2908 sout <<
"validEqs " << validEqs << std::endl;
2910 fYC.Compute(sigmaTrial, N.
m_hardening, Residual, 1);
2911 sout <<
"residual before projection" << Residual << std::endl;
2912 fYC.Compute(sigproj, Np1.
m_hardening, Residual, 1);
2913 sout <<
"residual after projection" << Residual << std::endl;
2921 const TPZPlasticState<REAL> &N,
2922 TPZPlasticState<REAL> &Np1,
2923 TPZVec<REAL> &delGamma,
2930 ETrial.
Add(EpN, -1.);
2931 fER.ComputeStress(ETrial, sigmaTrial);
2935 sigPlast.
Add(sigproj, -1.);
2936 fER.ComputeStrain(sigPlast, Np1.
m_eps_p);
2939 for (
int i = 0; i < 2; i++) {
2940 if (delGamma[i] > 0.) {
2946 std::stringstream sout;
2947 sout <<
"epsp next " << Np1.
m_hardening << std::endl;
2948 sout <<
"delGamma " << delGamma << std::endl;
2949 sout <<
"validEqs " << validEqs << std::endl;
2951 fYC.Compute(sigmaTrial, N.
m_hardening, Residual, 1);
2952 sout <<
"residual before projection" << Residual << std::endl;
2953 fYC.Compute(sigproj, Np1.
m_hardening, Residual, 1);
2954 sout <<
"residual after projection" << Residual << std::endl;
2962 const TPZPlasticState<REAL> &N,
2963 TPZPlasticState<REAL> &Np1,
2964 TPZVec<REAL> &delGamma,
2971 ETrial.
Add(EpN, -1.);
2972 fER.ComputeStress(ETrial, sigmaTrial);
2976 sigPlast.
Add(sigproj, -1.);
2977 fER.ComputeStrain(sigPlast, Np1.
m_eps_p);
2980 for (
int i = 0; i < 2; i++) {
2981 if (delGamma[i] > 0.) {
2987 std::stringstream sout;
2988 sout <<
"epsp next " << Np1.
m_hardening << std::endl;
2989 sout <<
"delGamma " << delGamma << std::endl;
2990 sout <<
"validEqs " << validEqs << std::endl;
2992 fYC.Compute(sigmaTrial, N.
m_hardening, Residual, 1);
2993 sout <<
"residual before projection" << Residual << std::endl;
2994 fYC.Compute(sigproj, Np1.
m_hardening, Residual, 1);
2995 sout <<
"residual after projection" << Residual << std::endl;
Classe que efetua avanco de um passo de plastificacao utilizando o metodo de Newton.
virtual void Phi_Internal(const TPZTensor< REAL > &epsTotal, TPZVec< REAL > &phi) const
Return the value of the yield functions for the given strain Internal Method.
virtual void SetUp(const TPZTensor< REAL > &epsTotal)
Overwrite the current total strain only.
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
void CopyTo(TPZTensor< T1 > &target) const
void Add(const TPZTensor< T1 > &tensor, const T2 &constant)
void ApplyLoad_Internal(const TPZTensor< REAL > &sigma, TPZTensor< REAL > &epsTotal)
Attempts to compute an epsTotal value in order to reach an imposed stress state sigma. This methid should be used only for test purposes because it isn't fully robust. Some materials, specially those perfectly plastic and with softening, may fail when applying the Newton Method on ProcessLoad. Internal 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.
TPZTensor< T > m_eps_t
Tensors representing the total and plastic strain states.
virtual void ProcessStrainNoSubIncrement(const TPZTensor< REAL > &epsTotal, const EElastoPlastic ep=EAuto)
Imposes the specified strain tensor and performs plastic integration when necessary. This function DO NOT calls PlasticIntegrate.
TPZManVector< T, 6 > fData
T m_hardening
Plastic volumetric hardeing variable.
Defines step solvers class. Solver.
void InitializePlasticFAD(const TPZPlasticState< REAL > &state, const TPZVec< REAL > &delGamma, TPZPlasticState< T > &state_T, TPZVec< T > &delGamma_T, const int nVars=7+YC_t::NYield) const
This method copies the REAL variables into FAD variables and intializes the derivatives The nVars var...
void ApplyStrain_Internal(const TPZTensor< REAL > &epsTotal)
Imposes the specified strain tensor, evaluating the plastic integration if necessary. Internal Method.
double sdot(TPZVec< T1 > &x, TPZVec< T1 > &y)
Performs a sdot operation: dot <- Transpose[x] * y.
REAL val(STATE &number)
Returns value of the variable.
#define LOGPZ_WARN(A, B)
Define log for warnings.
int RemoveInvalidEqs(TPZVec< T > &delGamma_T, TPZVec< T > &res_T, TPZVec< int > &validEqs)
After a complete plasticLoop, plsatic surface equations related to negative plastic multipliers are d...
void ExtractTangent(const TPZVec< T1 > &epsRes_FAD, T_VECTOR &ResVal, REAL &resnorm, T_MATRIX &tangent, TPZVec< int > &validEqs, TPZVec< REAL > &pivots, const int precond=1, const int resetInvalidEqs=1)
Extracts the tangent matrix and residual vector from the FAD variables and according to the precondit...
virtual REAL IntegrationOverview(TPZVec< REAL > &plastifLen)
Similar to IntegrationSteps, it returns the plastic parcel of the last loading. 1.0 means that the whole step was plastic, 0.0 means the whole step was elastic.
bool IsStrainElastic(const TPZPlasticState< REAL > &state) const
Verifies if the proposed epsTotalNp1 is still in the elastic range.
EStatus Substitution(TPZDiffMatrix< T > *B) const
void CopyTo(TPZPlasticState< T1 > &target) const
int InitializeValidEqs(TPZVec< T > &res_T, TPZVec< int > &validEqs)
Initializes the fValidEqs booleans indication whether to consider the plastic surfaces.
int SignCorrection() const
Indicates whether or not to correct Stress/Strain sign.
void Read(TPZStream &buf, void *context) override
read objects from the stream
void ApplyStrainComputeDep_Internal(const TPZTensor< REAL > &epsTotal, TPZTensor< REAL > &sigma, TPZFMatrix< REAL > &Dep)
Imposes the specified strain tensor and returns the corresp. stress state and tangent stiffness matri...
int64_t size() const
Returns the number of elements of the vector.
virtual void Resize(const int64_t newsize, const T &object)
Resizes the vector object reallocating the necessary storage, copying the existing objects to the new...
virtual void Write(const bool val)
virtual void ApplyStrain(const TPZTensor< REAL > &epsTotal) override
Contains TPZMatrixclass which implements full matrix (using column major representation).
#define DebugStop()
Returns a message to user put a breakpoint in.
void InitialGuess(const TPZPlasticState< REAL > &N, TPZPlasticState< REAL > &Np1, TPZVec< REAL > &delGamma, TPZVec< int > &validEqs)
Proposes an update to the plastic variables and estimates the relative error comitted in this update...
#define LOGPZ_DEBUG(A, B)
Define log for debug info.
void Write(TPZStream &buf, int withclassid) const override
Writes this object to the TPZStream buffer. Include the classid if withclassid = true.
TPZPlasticIntegrMem< REAL, 4 > teste
int PlasticLoop(const TPZPlasticState< REAL > &N, TPZPlasticState< REAL > &Np1, TPZVec< REAL > &delGamma, REAL &normEpsPErr, REAL &lambda, TPZVec< int > &validEqs)
Proposes an update to the plastic variables and estimates the relative error comitted in this update...
virtual void Phi(const TPZTensor< REAL > &epsTotal, TPZVec< REAL > &phi) const override
Return the value of the yield functions for the given strain.
REAL FindPointAtYield(const TPZTensor< REAL > &epsTotalNp1, TPZPlasticState< REAL > &stateAtYield) const
Finds the strain point in the linear path from epsTotalN and towards epsTotalNp1 that matches the yie...
int64_t Rows() const
Returns number of rows.
void PlasticResidualRK(const TPZPlasticState< T1 > &N_T1, TPZPlasticState< T2 > &Np1_T2, const TPZVec< T2 > &delGamma_T2, TPZVec< T2 > &res_T2, REAL &normEpsPErr, int silent=0) const
Evaluates the residual vector for the plasticity problem RK.
REAL UpdatePlasticVars(const TPZPlasticState< T1 > &N_T1, TPZPlasticState< T2 > &Np1_T2, TPZVec< T2 > &delGamma_T2, TPZVec< T2 > &res_T2, TVECTOR &Sol_TVECTOR, TPZVec< int > &validEqs, int updateVars=1) const
Updates the N+1 plastic state variables based on the solution of a Newton's scheme. A very simple line search is performed in order to attempt to guarantee residual drop.
expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ sqrt
void SetTensionSign(int s)
virtual TPZPlasticState< REAL > GetState() const override
Retrieve the plastic state variables.
virtual void ProcessStrain(const TPZTensor< REAL > &epsTotal, const EElastoPlastic ep=EAuto)
Imposes the specified strain tensor and performs plastic integration when necessary. This function creates a new plastic integration history epserimenting the proposed epsTotal. It does not update the current plastic state.
void PushPlasticMem(const TPZPlasticState< REAL > &state, const REAL &k, const REAL &lambda, const TPZManVector< REAL, N > &delGamma, const TPZVec< int > &validEqs, const int forceYield)
Stores the whole content of a plastic integration step in order to allow its further reevaluation...
expr_ expr_ fastAccessDx(i) *cos(expr_.val())) FAD_FUNC_MACRO(TFadFuncTan
#define LOGPZ_ERROR(A, B)
Define log for errors (cout)
void PlasticResidual(const TPZPlasticState< T1 > &N_T1, TPZPlasticState< T2 > &Np1_T2, const TPZVec< T2 > &delGamma_T2, TPZVec< T2 > &res_T2, REAL &normEpsPErr, int silent=0) const
void Solve(const TPZFMatrix< TVar > &F, TPZFMatrix< TVar > &result, TPZFMatrix< TVar > *residual=0) override
Solves the system of linear equations.
void Print(std::ostream &out) const
virtual void ApplyLoad(const TPZTensor< REAL > &sigma, TPZTensor< REAL > &epsTotal) override
virtual void SetElasticResponse(TPZElasticResponse &ER) override
modify the elastic response. Needs to be reimplemented for each instantiation
virtual TPZElasticResponse GetElasticResponse() const override
TPZFlopCounter pow(const TPZFlopCounter &orig, const TPZFlopCounter &xp)
Returns the power and increments the counter of the power.
virtual void ApplyStrainComputeDep(const TPZTensor< REAL > &epsTotal, TPZTensor< REAL > &sigma, TPZFMatrix< REAL > &Dep) override
const T & VolHardening() const
const TPZTensor< T > & EpsT() const
Matrix class to hold the flux derivatives A B C and diffusive matrix coefficients. Matrix.
void ComputePlasticVars(const TPZPlasticState< T > &state_T, TPZTensor< T > &sigma_T, T &A_T) const
Evaluates the sigma stress tensor and the thermoForceA for use in several pieces of this code...
const TPZTensor< T > & EpsP() const
void Fill(const T ©, const int64_t from=0, const int64_t numelem=-1)
Will fill the elements of the vector with a copy object.
Contains TPZStepSolver class which defines step solvers class.
int64_t Cols() const
Returns number of cols.
virtual void Print(std::ostream &out) const
virtual void ApplyStrainComputeSigma(const TPZTensor< REAL > &epsTotal, TPZTensor< REAL > &sigma, TPZFMatrix< REAL > *tangent=NULL) override
Defines the interface for saving and reading data. Persistency.
int64_t NElements() const
Returns the number of elements of the vector.
void SetDirect(const DecomposeType decomp)
virtual TPZPlasticState< REAL > GetState_Internal() const
Retrieves the plastic state variables - makes no interface sign checks.
virtual void ComputeDep(TPZTensor< REAL > &sigma, TPZFMatrix< REAL > &Dep)
Evaluates the constitutive matrix (DSigma/DEpsT) based on the data from the plastic integration histo...
virtual void SetState(const TPZPlasticState< REAL > &state) override
Update the damage values.
int PlasticIntegrate(const TPZPlasticState< REAL > &N, TPZPlasticState< REAL > &Np1, const REAL &TolEpsPErr)
Proposes an update to the plastic variables respecting an integration with error control. Neither internal variable are used nor changed. In the Np1 variables, EpsT is imposed [input] and the Alpha and EpsP are evaluated.
virtual void SetState_Internal(const TPZPlasticState< REAL > &state)
Updates the damage values - makes no interface sign checks.
Non abstract class which implements full matrices with preallocated storage with (N+1) entries...
virtual void ProcessLoad(const TPZTensor< REAL > &sigma, const EElastoPlastic ep=EAuto)
Imposes the specified stress tensor and performs plastic integration when necessary. This function evaluates a newton's method on ProcessStrain until the stress state matches. It does not update the current plastic state.
virtual void Read(bool &val)
virtual int IntegrationSteps() const override
Return the number of plastic steps in the last load step. Zero indicates elastic loading.