197 FloatArray dgamma, dgammared, tempGamma, dkappa;
204 std :: vector< FloatArray > yieldGradSigVec(this->
nsurf), loadGradSigVec(this->
nsurf), * loadGradSigVecPtr;
205 std :: vector< FloatArray > yieldGradKVec(this->
nsurf), loadGradKVec(this->
nsurf);
210 int elastic, restart, actSurf, indx;
211 bool yieldConsistency, init =
true;
220 loadGradSigVecPtr = & yieldGradSigVec;
222 loadGradSigVecPtr = & loadGradSigVec;
247 elasticStrainVectorR = totalStrain;
248 elasticStrainVectorR.
subtract(plasticStrainVectorR);
257 activeConditionMap.
zero();
260 initialConditionMap.
zero();
263 for (
int i = 1; i <= this->
nsurf; i++ ) {
264 yieldValue = this->
computeYieldValueAt(gp, i, fullStressVector, strainSpaceHardeningVariables);
268 initialConditionMap.
at(i) = 1;
273 activeConditionMap.
at(i) = actSurf;
288 printf(
"New activeConditionMap:");
298 for (
int i = 1; i <=
nsurf; i++ ) {
300 strainSpaceHardeningVariables);
303 strainSpaceHardeningVariables);
308 for (
int i = 1; i <=
nsurf; i++ ) {
310 strainSpaceHardeningVariables);
313 strainSpaceHardeningVariables);
321 strainSpaceHardeningVariables, * loadGradSigVecPtr);
324 printf(
"Convergence[actSet: ");
325 for (
int i = 1; i <=
nsurf; i++ ) {
326 printf(
"%d ", activeConditionMap.
at(i) );
329 printf(
"] yield_val (gamma) ");
335 yieldConsistency =
true;
336 for (
int i = 1; i <=
nsurf; i++ ) {
337 if ( activeConditionMap.
at(i) ) {
338 yieldValue = this->
computeYieldValueAt(gp, i, fullStressVector, strainSpaceHardeningVariables);
340 yieldConsistency =
false;
345 printf(
"%e(%e) ", yieldValue, gamma.
at(i) );
360 if ( yieldConsistency ) {
361 answer = fullStressVector;
369 printf(
"Consistency: ");
373 for (
int i = 1; i <= this->
nsurf; i++ ) {
374 yieldValue = this->
computeYieldValueAt(gp, i, fullStressVector, strainSpaceHardeningVariables);
378 printf(
"%e ", yieldValue);
383 if ( ( gamma.
at(i) < 0.0 ) || ( ( activeConditionMap.
at(i) == 0 ) && ( yieldValue >
YIELD_TOL_SECONDARY ) ) ) {
391 printf(
"\nStress: ");
392 for (
int i = 1; i <= fullStressVector.
giveSize(); i++ ) {
393 printf(
" %e", fullStressVector.
at(i) );
396 printf(
"\nKappa : ");
397 for (
int i = 1; i <= strainSpaceHardeningVariables.
giveSize(); i++ ) {
398 printf(
" %e", strainSpaceHardeningVariables.
at(i) );
401 printf(
"\n Restart %d\n", restart);
411 for (
int i = 1; i <= this->
nsurf; i++ ) {
412 yieldValue = this->
computeYieldValueAt(gp, i, fullStressVector, strainSpaceHardeningVariables);
413 if ( ( ( activeConditionMap.
at(i) ) && ( gamma.
at(i) >= 0.0 ) ) || ( yieldValue >
YIELD_TOL ) ) {
416 newmap.
at(i) = actSurf;
434 elasticStrainVectorR = totalStrain;
435 elasticStrainVectorR.
subtract(plasticStrainVectorR);
440 OOFEM_ERROR(
"Internal Consistency error: all combinations of yield functions tried, no consistent return");
444 OOFEM_ERROR(
"Internal Consistency error: all combinations of yield functions tried, no consistent return");
449 for (
int i = 1; i <=
nsurf; i++ ) {
450 if ( activeConditionMap.
at(i) ) {
479 elasticStrainVectorR = totalStrain;
480 elasticStrainVectorR.
subtract(plasticStrainVectorR);
499 gamma, activeConditionMap,
500 fullStressVector, strainSpaceHardeningVariables);
508 gmat.
resize(actSurf, actSurf);
510 lmat.
resize(actSurf, strSize);
512 rmat.
resize(strSize, actSurf);
516 strainSpaceHardeningVariables, gamma);
518 fullStressVector, strainSpaceHardeningVariables, gamma);
521 for (
int i = 1; i <=
nsurf; i++ ) {
522 if ( ( indx = activeConditionMap.
at(i) ) ) {
525 helpVector.
add(yieldGradSigVec [ i - 1 ]);
526 for (
int j = 1; j <= strSize; j++ ) {
527 lmat.
at(indx, j) = helpVector.
at(j);
530 for (
int j = 1; j <= strSize; j++ ) {
531 lmat.
at(indx, j) = yieldGradSigVec [ i - 1 ].at(j);
537 strainSpaceHardeningVariables);
543 for (
int j = 1; j <= strSize; j++ ) {
544 rmat.
at(j, indx) += ( * loadGradSigVecPtr ) [ i - 1 ].at(j);
549 for (
int j = 1; j <= actSurf; j++ ) {
550 gmat.
at(indx, j) = ( -1.0 ) * helpVector2.
at(j);
554 yieldValue = this->
computeYieldValueAt(gp, i, fullStressVector, strainSpaceHardeningVariables);
555 rhs.
at(indx) = yieldValue;
564 helpVector2.
beProductOf(consistentModuli, residualVectorR);
573 for (
int i = 1; i <= this->
nsurf; i++ ) {
574 if ( ( indx = activeConditionMap.
at(i) ) ) {
575 dgamma.
at(i) = dgammared.
at(indx);
582 tempGamma.
add(dgamma);
591 for (
int i = 1; i <= this->
nsurf; i++ ) {
592 if ( tempGamma.
at(i) < 0.0 ) {
600 activeConditionMap.
zero();
601 for (
int i = 1; i <= this->
nsurf; i++ ) {
602 if ( tempGamma.
at(i) > 0.0 ) {
604 activeConditionMap.
at(i) = actSurf;
610 elasticStrainVectorR = totalStrain;
611 elasticStrainVectorR.
subtract(plasticStrainVectorR);
628 helpVector2.
resize(strSize);
630 for (
int i = 1; i <=
nsurf; i++ ) {
631 if ( activeConditionMap.
at(i) ) {
632 ( * loadGradSigVecPtr ) [ i - 1 ].times( dgamma.
at(i) );
633 residualVectorR.
add( ( * loadGradSigVecPtr ) [ i - 1 ] );
637 strainSpaceHardeningVariables);
639 fullStressVector, strainSpaceHardeningVariables, gamma);
644 residualVectorR.
add(helpVector2);
649 helpVector.
beProductOf(consistentModuli, residualVectorR);
650 helpVector2.
beProductOf(elasticModuliInverse, helpVector);
653 for (
int i = 1; i <= strSize; i++ ) {
654 plasticStrainVectorR.
at(i) += helpVector2.
at(i);
657 elasticStrainVectorR = totalStrain;
658 elasticStrainVectorR.
subtract(plasticStrainVectorR);
665 strainSpaceHardeningVariables.
add(dkappa);
678 fprintf( stderr,
"\nclosestPointReturn (mat no. %d): reached max number of iterations\n", this->
giveNumber() );
679 fprintf(stderr,
"activeSet: ");
680 for (
int i = 1; i <=
nsurf; i++ ) {
681 fprintf( stderr,
"%d ", activeConditionMap.
at(i) );
684 fprintf(stderr,
"\n");
696 bool smartCandidate =
false;
702 for (
int i = 1; i <= this->
nsurf; i++ ) {
703 if ( activeConditionMap.
at(i) ) {
704 if ( gamma.
at(i) < 0.0 ) {
705 smartCandidate =
true;
712 if ( smartCandidate && candidate && initialConditionMap.
at(candidate) ) {
715 newMap.
at(candidate) = 1;
731 elasticStrainVectorR = totalStrain;
732 elasticStrainVectorR.
subtract(plasticStrainVectorR);
737 OOFEM_ERROR(
"Internal Consistency error: all combinations of yield functions tried, no consistent return");
741 OOFEM_ERROR(
"Internal Consistency error: all combinations of yield functions tried, no consistent return");
746 for (
int i = 1; i <=
nsurf; i++ ) {
747 if ( activeConditionMap.
at(i) ) {
756 for (
int i = 1; i <= this->
nsurf; i++ ) {
757 if ( initialConditionMap.
at(i) ) {
774 elasticStrainVectorR = totalStrain;
775 elasticStrainVectorR.
subtract(plasticStrainVectorR);
780 OOFEM_ERROR(
"Internal Consistency error: all combinations of yield functions tried, no consistent return");
784 OOFEM_ERROR(
"Internal Consistency error: all combinations of yield functions tried, no consistent return");
788 for ( actSurf = 0, i = 1; i <=
nsurf; i++ ) {
789 if ( activeConditionMap.
at(i) ) {
805 elasticStrainVectorR = totalStrain;
806 elasticStrainVectorR.
subtract(plasticStrainVectorR);
817 OOFEM_WARNING(
"local equlibrium not reached in %d iterations\nElement %d, gp %d, continuing",
819 answer = fullStressVector;
827 answer = fullStressVector;
843 FloatArray helpVector, helpVector2, rhs, dkappa;
844 FloatMatrix elasticModuli, helpMtrx, helpMtrx2, gmat;
847 std :: vector< FloatArray > yieldGradSigVec(this->
nsurf), loadGradSigVec(this->
nsurf), * loadGradSigVecPtr;
848 std :: vector< FloatArray > yieldGradKVec(this->
nsurf), loadGradKVec(this->
nsurf);
852 int strSize, i, j, elastic, restart, actSurf, indx;
853 bool yieldConsistency, init =
true;
859 loadGradSigVecPtr = & yieldGradSigVec;
861 loadGradSigVecPtr = & loadGradSigVec;
878 elasticStrainVectorR = totalStrain;
879 elasticStrainVectorR.
subtract(plasticStrainVectorR);
885 activeConditionMap.
zero();
888 initialConditionMap.
zero();
891 for ( i = 1; i <= this->
nsurf; i++ ) {
892 yieldValue = this->
computeYieldValueAt(gp, i, fullStressVector, strainSpaceHardeningVariables);
896 initialConditionMap.
at(i) = 1;
901 activeConditionMap.
at(i) = actSurf;
912 for ( i = 1; i <=
nsurf; i++ ) {
914 strainSpaceHardeningVariables);
918 strainSpaceHardeningVariables);
923 for ( i = 1; i <=
nsurf; i++ ) {
925 strainSpaceHardeningVariables);
928 strainSpaceHardeningVariables);
935 gmat.
resize(actSurf, actSurf);
937 lmat.
resize(actSurf, strSize);
939 rmat.
resize(strSize, actSurf);
944 strainSpaceHardeningVariables, gamma);
946 fullStressVector, strainSpaceHardeningVariables, gamma);
949 for ( i = 1; i <=
nsurf; i++ ) {
950 if ( ( indx = activeConditionMap.
at(i) ) ) {
955 helpVector.
add(yieldGradSigVec [ i - 1 ]);
956 for ( j = 1; j <= strSize; j++ ) {
957 lmat.
at(indx, j) = helpVector.
at(j);
960 for ( j = 1; j <= strSize; j++ ) {
961 lmat.
at(indx, j) = yieldGradSigVec [ i - 1 ].at(j);
965 for ( j = 1; j <= strSize; j++ ) {
966 rmat.
at(j, indx) += ( * loadGradSigVecPtr ) [ i - 1 ].at(j);
971 for ( j = 1; j <= actSurf; j++ ) {
972 gmat.
at(indx, j) = ( -1.0 ) * helpVector2.
at(j);
985 for ( i = 1; i <= this->
nsurf; i++ ) {
986 if ( ( indx = activeConditionMap.
at(i) ) ) {
987 dgamma.
at(i) = helpVector.
at(indx);
996 for ( i = 1; i <= this->
nsurf; i++ ) {
997 if ( ( gamma.
at(i) + dgamma.
at(i) ) < 0.0 ) {
1006 activeConditionMap.
zero();
1007 for ( i = 1; i <= this->
nsurf; i++ ) {
1008 if ( ( gamma.
at(i) + dgamma.
at(i) ) > 0.0 ) {
1010 activeConditionMap.
at(i) = actSurf;
1016 elasticStrainVectorR = totalStrain;
1017 elasticStrainVectorR.
subtract(plasticStrainVectorR);
1031 helpVector.
resize(strSize);
1033 for ( i = 1; i <= this->
nsurf; i++ ) {
1034 if ( activeConditionMap.
at(i) ) {
1035 ( * loadGradSigVecPtr ) [ i - 1 ].times( dgamma.
at(i) );
1036 for ( j = 1; j <= strSize; j++ ) {
1037 helpVector.
at(j) += ( * loadGradSigVecPtr ) [ i - 1 ].at(j);
1042 plasticStrainVectorR.
add(helpVector);
1047 elasticStrainVectorR = totalStrain;
1048 elasticStrainVectorR.
subtract(plasticStrainVectorR);
1055 strainSpaceHardeningVariables.
add(dkappa);
1059 yieldConsistency =
true;
1060 for ( i = 1; i <=
nsurf; i++ ) {
1061 if ( activeConditionMap.
at(i) ) {
1062 yieldValue = this->
computeYieldValueAt(gp, i, fullStressVector, strainSpaceHardeningVariables);
1064 yieldConsistency =
false;
1069 if ( yieldConsistency ) {
1072 for ( i = 1; i <= this->
nsurf; i++ ) {
1073 yieldValue = this->
computeYieldValueAt(gp, i, fullStressVector, strainSpaceHardeningVariables);
1074 if ( ( gamma.
at(i) < 0.0 ) || ( ( activeConditionMap.
at(i) == 0 ) && ( yieldValue >
YIELD_TOL ) ) ) {
1087 for ( i = 1; i <= this->
nsurf; i++ ) {
1088 yieldValue = this->
computeYieldValueAt(gp, i, fullStressVector, strainSpaceHardeningVariables);
1089 if ( ( ( activeConditionMap.
at(i) ) && ( gamma.
at(i) >= 0.0 ) ) || ( yieldValue >
YIELD_TOL ) ) {
1092 newmap.
at(i) = actSurf;
1099 activeConditionMap = newmap;
1102 activeConditionMap = newmap;
1106 for ( i = 1; i <= this->
nsurf; i++ ) {
1107 if ( initialConditionMap.
at(i) ) {
1109 activeConditionMap.
zero();
1110 activeConditionMap.
at(i) = 1;
1111 initialConditionMap.
at(i) = 0;
1123 elasticStrainVectorR = totalStrain;
1124 elasticStrainVectorR.
subtract(plasticStrainVectorR);
1145 bool smartCandidate =
false;
1151 for ( i = 1; i <= this->
nsurf; i++ ) {
1152 if ( activeConditionMap.
at(i) ) {
1153 if ( gamma.
at(i) < 0.0 ) {
1154 smartCandidate =
true;
1161 if ( smartCandidate && candidate && initialConditionMap.
at(candidate) ) {
1163 activeConditionMap.
zero();
1164 activeConditionMap.
at(candidate) = 1;
1165 initialConditionMap.
at(candidate) = 0;
1169 for ( i = 1; i <= this->
nsurf; i++ ) {
1170 if ( initialConditionMap.
at(i) ) {
1172 activeConditionMap.
zero();
1173 activeConditionMap.
at(i) = 1;
1174 initialConditionMap.
at(i) = 0;
1186 elasticStrainVectorR = totalStrain;
1187 elasticStrainVectorR.
subtract(plasticStrainVectorR);
1198 OOFEM_WARNING(
"local equlibrium not reached in %d iterations\nElement %d, gp %d, continuing",
1200 answer = fullStressVector;
1210 answer = fullStressVector;
1339MPlasticMaterial2 :: giveConsistentStiffnessMatrix(MatResponseMode mode,
1348 FloatMatrix consistentModuli, elasticModuli, umat, vmat;
1350 FloatMatrix gradientMatrix, gmat, gmatInv, gradMat, helpMtrx, helpMtrx2, answerR;
1351 FloatArray gradientVector, stressVector, fullStressVector;
1352 FloatArray strainSpaceHardeningVariables, helpVector;
1353 std :: vector< FloatArray > yieldGradSigVec(this->
nsurf), loadGradSigVec(this->
nsurf), * loadGradSigVecPtr;
1354 std :: vector< FloatArray > yieldGradKVec(this->
nsurf), loadGradKVec(this->
nsurf);
1359 int strSize, indx, actSurf = 0;
1365 loadGradSigVecPtr = & yieldGradSigVec;
1367 loadGradSigVecPtr = & loadGradSigVec;
1376 if ( ( status->
giveTempStateFlag() == MPlasticMaterial2Status :: PM_Elastic ) ||
1387 for (
int i = 1; i <=
nsurf; i++ ) {
1388 if ( activeConditionMap.
at(i) ) {
1399 StructuralMaterial :: giveFullSymVectorForm( fullStressVector, stressVector, gp->
giveMaterialMode() );
1406 activeConditionMap, fullStressVector, strainSpaceHardeningVariables);
1409 for (
int i = 1; i <=
nsurf; i++ ) {
1411 strainSpaceHardeningVariables);
1414 strainSpaceHardeningVariables);
1419 for (
int i = 1; i <=
nsurf; i++ ) {
1421 strainSpaceHardeningVariables);
1424 strainSpaceHardeningVariables);
1430 umat.
resize(strSize, actSurf);
1432 vmat.
resize(actSurf, strSize);
1434 gmat.
resize(actSurf, actSurf);
1439 strainSpaceHardeningVariables, gamma);
1441 fullStressVector, strainSpaceHardeningVariables, gamma);
1444 for (
int i = 1; i <=
nsurf; i++ ) {
1445 if ( ( indx = activeConditionMap.
at(i) ) ) {
1448 helpVector.
add(yieldGradSigVec [ i - 1 ]);
1449 for (
int j = 1; j <= strSize; j++ ) {
1450 vmat.
at(indx, j) = helpVector.
at(j);
1453 for (
int j = 1; j <= strSize; j++ ) {
1454 vmat.
at(indx, j) = yieldGradSigVec [ i - 1 ].at(j);
1460 strainSpaceHardeningVariables);
1462 helpMtrx.
times( gamma.
at(i) );
1466 for (
int j = 1; j <= strSize; j++ ) {
1467 umat.
at(j, indx) += ( ( * loadGradSigVecPtr ) [ i - 1 ] ).at(j);
1473 for (
int j = 1; j <= actSurf; j++ ) {
1474 gmat.
at(indx, j) = ( -1.0 ) * helpVector2.
at(j);
1482 gmat.
add(helpMtrx2);
1492 answer.
add(consistentModuli);
1497MPlasticMaterial2 :: giveElastoPlasticStiffnessMatrix(MatResponseMode mode,
1507 FloatMatrix gmat, gmatInv, helpMtrx, helpMtrx2, kl, ks;
1509 FloatArray strainSpaceHardeningVariables, helpVector, helpVector2;
1510 std :: vector< FloatArray > yieldGradSigVec(this->
nsurf), loadGradSigVec(this->
nsurf), * loadGradSigVecPtr;
1511 std :: vector< FloatArray > yieldGradKVec(this->
nsurf), loadGradKVec(this->
nsurf);
1516 int strSize, indx, actSurf = 0;
1522 loadGradSigVecPtr = & yieldGradSigVec;
1524 loadGradSigVecPtr = & loadGradSigVec;
1533 if ( ( status->
giveTempStateFlag() == MPlasticMaterial2Status :: PM_Elastic ) ||
1544 for (
int i = 1; i <=
nsurf; i++ ) {
1545 if ( activeConditionMap.
at(i) ) {
1555 StructuralMaterial :: giveFullSymVectorForm( fullStressVector, stressVector, gp->
giveMaterialMode() );
1560 for (
int i = 1; i <=
nsurf; i++ ) {
1562 strainSpaceHardeningVariables);
1565 strainSpaceHardeningVariables);
1570 for (
int i = 1; i <=
nsurf; i++ ) {
1572 strainSpaceHardeningVariables);
1575 strainSpaceHardeningVariables);
1580 umat.
resize(strSize, actSurf);
1581 vmat.
resize(actSurf, strSize);
1582 gmat.
resize(actSurf, actSurf);
1586 strainSpaceHardeningVariables, gamma);
1588 fullStressVector, strainSpaceHardeningVariables, gamma);
1591 for (
int i = 1; i <=
nsurf; i++ ) {
1592 if ( ( indx = activeConditionMap.
at(i) ) ) {
1595 helpVector.
add(yieldGradSigVec [ i - 1 ]);
1596 for (
int j = 1; j <= strSize; j++ ) {
1597 vmat.
at(indx, j) = helpVector.
at(j);
1600 for (
int j = 1; j <= strSize; j++ ) {
1601 vmat.
at(indx, j) = yieldGradSigVec [ i - 1 ].at(j);
1605 for (
int j = 1; j <= strSize; j++ ) {
1606 umat.
at(j, indx) += ( * loadGradSigVecPtr ) [ i - 1 ].at(j);
1612 for (
int j = 1; j <= actSurf; j++ ) {
1613 gmat.
at(indx, j) = ( -1.0 ) * helpVector2.
at(j);
1621 gmat.
add(helpMtrx2);
1630 answer.
add(elasticModuli);