80XfemStructuralElementInterface :: XfemStructuralElementInterface(
Element *e) :
87bool XfemStructuralElementInterface :: XfemElementInterface_updateIntegrationRule()
89 const double tol2 = 1.0e-18;
91 bool partitionSucceeded =
false;
109 MaterialMode matMode =
element->giveMaterialMode();
111 bool firstIntersection =
true;
113 std :: vector< std :: vector< FloatArray > >pointPartitions;
116 std :: vector< int >enrichingEIs;
121 for (
size_t p = 0; p < enrichingEIs.size(); p++ ) {
123 int eiIndex = enrichingEIs [ p ];
126 std :: vector< int >touchingEiIndices;
129 if ( firstIntersection ) {
132 double startXi, endXi;
133 bool intersection =
false;
136 if ( intersection ) {
137 firstIntersection =
false;
140 for (
auto &partition : pointPartitions ) {
148 if ( crack ==
nullptr ) {
149 OOFEM_ERROR(
"Cohesive zones are only available for cracks.")
153 std :: vector< FloatArray >crackPolygon;
158 size_t numSeg = crackPolygon.size() - 1;
160 for (
size_t segIndex = 0; segIndex < numSeg; segIndex++ ) {
179 crackTang.
beDifferenceOf(crackPolygon [ segIndex + 1 ], crackPolygon [ segIndex ]);
187 crackTang =
Vec2(0.0, 1.0);
191 -crackTang.
at(2), crackTang.
at(1), 0.
195 crackPolygon [ segIndex ], crackPolygon [ segIndex + 1 ]);
199 crackPolygon [ segIndex ], crackPolygon [ segIndex + 1 ]);
203 double gw = gp->giveWeight();
204 double segLength =
distance(crackPolygon [ segIndex ], crackPolygon [ segIndex + 1 ]);
205 gw *= 0.5 * segLength;
225 if ( periodicityNormal(0) < 0.0 && periodicityNormal(1) < 0.0 ) {
227 periodicityNormal =
Vec2(periodicityNormal(1), -periodicityNormal(0));
246 double gw = gp->giveWeight();
247 double segLength =
distance(crackPolygon [ segIndex ], crackPolygon [ segIndex + 1 ]);
248 gw *= 0.5 * segLength;
267 if ( periodicityNormal(0) < 0.0 && periodicityNormal(1) < 0.0 ) {
269 periodicityNormal =
Vec2(periodicityNormal(1), -periodicityNormal(0));
285 partitionSucceeded =
true;
289 std :: vector< Triangle >allTriCopy;
290 for (
size_t triIndex = 0; triIndex <
mSubTri.size(); triIndex++ ) {
292 std :: vector< std :: vector< FloatArray > >pointPartitionsTri;
293 double startXi, endXi;
294 bool intersection =
false;
297 if ( intersection ) {
299 for (
int i = 0; i < int ( pointPartitionsTri.size() ); i++ ) {
308 if ( crack ==
nullptr ) {
309 OOFEM_ERROR(
"Cohesive zones are only available for cracks.")
313 std :: vector< FloatArray >crackPolygon;
316 int numSeg = crackPolygon.size() - 1;
318 for (
int segIndex = 0; segIndex < numSeg; segIndex++ ) {
333 crackTang.
beDifferenceOf(crackPolygon [ segIndex + 1 ], crackPolygon [ segIndex ]);
341 crackTang =
Vec2(0.0, 1.0);
347 crackPolygon [ segIndex ], crackPolygon [ segIndex + 1 ]);
351 crackPolygon [ segIndex ], crackPolygon [ segIndex + 1 ]);
355 double gw = gp->giveWeight();
356 double segLength =
distance(crackPolygon [ segIndex ], crackPolygon [ segIndex + 1 ]);
357 gw *= 0.5 * segLength;
377 if ( periodicityNormal(0) < 0.0 && periodicityNormal(1) < 0.0 ) {
379 periodicityNormal =
Vec2(periodicityNormal(1), -periodicityNormal(0));
398 double gw = gp->giveWeight();
399 double segLength =
distance(crackPolygon [ segIndex ], crackPolygon [ segIndex + 1 ]);
400 gw *= 0.5 * segLength;
421 if ( periodicityNormal(0) < 0.0 && periodicityNormal(1) < 0.0 ) {
423 periodicityNormal =
Vec2(periodicityNormal(1), -periodicityNormal(0));
442 allTriCopy.push_back(
mSubTri [ triIndex ]);
453 for (
int i = 0; i < numRefs; i++ ) {
454 std :: vector< Triangle > triRef;
455 for (
const auto &tri :
mSubTri ) {
471 std :: stringstream str3;
472 int elIndex = this->
element->giveGlobalNumber();
473 str3 <<
"TriEl" << elIndex <<
".vtk";
474 std :: string name3 = str3.str();
477 XFEMDebugTools :: WriteTrianglesToVTK(name3,
mSubTri);
484 if ( partitionSucceeded ) {
485 std :: vector< std :: unique_ptr< IntegrationRule > >intRule;
495 std :: vector< FloatArray >czGPCoord;
499 czGPCoord.push_back( gp->giveGlobalCoordinates() );
506 if ( dom !=
nullptr ) {
508 if ( em !=
nullptr ) {
510 if ( ts !=
nullptr ) {
516 std :: stringstream str;
517 int elIndex = this->
element->giveGlobalNumber();
518 str <<
"CZGaussPointsTime" << time <<
"El" << elIndex <<
".vtk";
519 std :: string name = str.str();
521 XFEMDebugTools :: WritePointsToVTK(name, czGPCoord);
526 bool map_state_variables =
true;
527 if ( map_state_variables ) {
532 for (
int i = 0; i < num_ir_new; i++ ) {
538 if (gp_new->hasMaterialStatus() ==
false) {
546 double closest_dist = 0.0;
553 if ( mapper_interface ) {
557 OOFEM_ERROR(
"Failed casting to MaterialStatusMapperInterface.")
570 for (
int i = 0; i < num_ir_new; i++ ) {
578 double closest_dist_cz = 0.0;
584 bool non_std_cz =
false;
590 double closest_dist_bulk = 0.0;
592 if ( closest_dist_bulk < closest_dist_cz ) {
593 printf(
"Bulk is closest. Dist: %e\n", closest_dist_bulk);
594 ms_old = ms_old_bulk;
603 if ( mapper_interface ) {
606 OOFEM_ERROR(
"Failed casting to MaterialStatusMapperInterface.")
619 for (
int i = 0; i < num_ir_new; i++ ) {
627 double closest_dist_cz = 0.0;
633 bool non_std_cz =
false;
639 double closest_dist_bulk = 0.0;
641 if ( closest_dist_bulk < closest_dist_cz ) {
642 printf(
"Bulk is closest. Dist: %e\n", closest_dist_bulk);
643 ms_old = ms_old_bulk;
652 if ( mapper_interface ) {
655 OOFEM_ERROR(
"Failed casting to MaterialStatusMapperInterface.")
667 if ( partitionSucceeded ) {
677 return partitionSucceeded;
680MaterialStatus* XfemStructuralElementInterface :: giveClosestGP_MatStat(
double &oClosestDist, std :: vector< std :: unique_ptr< IntegrationRule > > &iRules,
const FloatArray &iCoord)
682 double min_dist2 = std::numeric_limits<double>::max();
685 for (
size_t i = 0; i < iRules.size(); i++ ) {
686 for (
auto &gp : *(iRules[i]) ) {
688 const FloatArray &x = gp->giveGlobalCoordinates();
690 if ( d2 < min_dist2 ) {
692 closest_ms =
dynamic_cast<MaterialStatus*
>( gp->giveMaterialStatus() );
698 oClosestDist = sqrt(min_dist2);
716 double angle = atan2( t(1), t(0) );
718 if ( angle < 0.25*
M_PI ) {
721 double l_s = l_box*(cos(angle));
726 double l_s = l_box*(sin(angle));
732void XfemStructuralElementInterface :: XfemElementInterface_computeConstitutiveMatrixAt(
FloatMatrix &answer, MatResponseMode rMode,
GaussPoint *gp,
TimeStep *tStep)
734 if (
element->giveDomain()->hasXfemManager() ) {
739 for (
size_t i = 0; i < materialModifyingEnrItemIndices.size(); i++ ) {
745 if ( structCS !=
nullptr ) {
763 answer = cs->giveStiffnessMatrix_PlaneStrain(rMode, gp, tStep);
765 answer = cs->giveStiffnessMatrix_PlaneStress(rMode, gp, tStep);
772 if ( cs ==
nullptr ) {
776 if (
element->giveDomain()->hasXfemManager() ) {
782 for (
size_t i = 0; i < materialModifyingEnrItemIndices.size(); i++ ) {
788 if ( structCSInclusion !=
nullptr ) {
790 answer = structCSInclusion->giveRealStress_PlaneStrain(strain, gp, tStep);
792 answer = structCSInclusion->giveRealStress_PlaneStress(strain, gp, tStep);
797 OOFEM_ERROR(
"failed to fetch StructuralCrossSection");
805 answer = cs->giveRealStress_PlaneStrain(strain, gp, tStep);
807 answer = cs->giveRealStress_PlaneStress(strain, gp, tStep);
817 element->computeVectorOf(VM_Total, tStep, solVec);
820 for (
size_t segIndex = 0; segIndex < numSeg; segIndex++ ) {
836 if ( ms ==
nullptr ) {
857 double dA = thickness * gp->giveWeight();
858 answer.
add(dA, NTimesT);
868 element->computeVectorOf(VM_Total, tStep, solVec);
872 OOFEM_ERROR(
"Failed to cast StructuralFE2Material*.")
876 for (
size_t segIndex = 0; segIndex < numSeg; segIndex++ ) {
877 for (
int gpInd = 0; gpInd <
mpCZIntegrationRules[ segIndex ]->giveNumberOfIntegrationPoints(); gpInd++ ) {
893 if ( fe2ms ==
nullptr ) {
894 OOFEM_ERROR(
"The material status is not of an allowed type.")
919 FloatArray smearedJumpStrain =
Vec6(jump2D(0)*crackNormal(0)/l_s, jump2D(1)*crackNormal(1)/l_s, 0.0, 0.0, 0.0, (1.0/l_s)*( jump2D(0)*crackNormal(1) + jump2D(1)*crackNormal(0) ));
922 smearedBulkStrain.
zero();
936 xPert.
add(eps, crackNormal);
938 element->computeLocalCoordinates(locCoordPert, xPert);
944 xPert.
add(-eps, crackNormal);
945 element->computeLocalCoordinates(locCoordPert, xPert);
951 BAvg.
add(1.0, BMinus);
956 if ( smearedBulkStrain.
giveSize() == 4 ) {
957 smearedBulkStrain =
Vec6(smearedBulkStrain(0), smearedBulkStrain(1), smearedBulkStrain(2), 0.0, 0.0, smearedBulkStrain(3));
960 FloatArray smearedJumpStrainTemp = smearedJumpStrain;
962 smearedJumpStrain.
add(smearedBulkStrain);
976 FloatArray trac =
Vec2(stressVec[0]*crackNormal[0]+stressVec[5]*crackNormal[1], stressVec[5]*crackNormal[0]+stressVec[1]*crackNormal[1]);
988 answer.
add(dA, NTimesT);
995 FloatArray stressV4 =
Vec4(stressVec[0]-stressVecBulk[0], stressVec[1]-stressVecBulk[1], stressVec[2]-stressVecBulk[2], stressVec[5]-stressVecBulk[5]);
998 answer.
add(1.0*dA*l_s, BTimesT);
1015 auto crackTangent3D =
cross(crackNormal3D, ez);
1027 if ( intMat ==
nullptr ) {
1028 OOFEM_ERROR(
"Failed to cast StructuralInterfaceMaterial*.")
1032 FloatArrayF<3> TLoc = {TLocRenumbered.at(2), TLocRenumbered.at(3), TLocRenumbered.at(1)};
1034 auto T =
dot(locToGlob, TLoc);
1036 oT =
Vec2(T.at(1), T.at(2));
1045 element->computeVectorOf(VM_Total, tStep, solVec);
1051 OOFEM_ERROR(
"Failed to cast StructuralInterfaceMaterial*.")
1054 for (
size_t segIndex = 0; segIndex < numSeg; segIndex++ ) {
1068 0.0, jump2D.
at(1), jump2D.
at(2)
1089 K3D.
at(1, 1) = K3DRenumbered.at(2, 2);
1090 K3D.
at(1, 2) = K3DRenumbered.at(2, 3);
1091 K3D.
at(1, 3) = K3DRenumbered.at(2, 1);
1093 K3D.
at(2, 1) = K3DRenumbered.at(3, 2);
1094 K3D.
at(2, 2) = K3DRenumbered.at(3, 3);
1095 K3D.
at(2, 3) = K3DRenumbered.at(3, 1);
1097 K3D.
at(3, 1) = K3DRenumbered.at(1, 2);
1098 K3D.
at(3, 2) = K3DRenumbered.at(1, 3);
1099 K3D.
at(3, 3) = K3DRenumbered.at(1, 1);
1104 if ( ms ==
nullptr ) {
1111 crackNormal.
at(1), crackNormal.
at(2), 0.0
1130 K2D.
at(1, 1) = K3DGlob.
at(1, 1);
1131 K2D.
at(1, 2) = K3DGlob.
at(1, 2);
1132 K2D.
at(2, 1) = K3DGlob.
at(2, 1);
1133 K2D.
at(2, 2) = K3DGlob.
at(2, 2);
1137 double eps = 1.0e-9;
1143 if ( ms ==
nullptr ) {
1155 jump2DPert = jump2D;
1156 jump2DPert.
at(1) += eps;
1159 K2D.
at(1, 1) = ( TPert.
at(1) - T.
at(1) ) / eps;
1160 K2D.
at(2, 1) = ( TPert.
at(2) - T.
at(2) ) / eps;
1162 jump2DPert = jump2D;
1163 jump2DPert.
at(2) += eps;
1166 K2D.
at(1, 2) = ( TPert.
at(1) - T.
at(1) ) / eps;
1167 K2D.
at(2, 2) = ( TPert.
at(2) - T.
at(2) ) / eps;
1178 double dA = thickness * gp->giveWeight();
1179 answer.
add(dA, tmp2);
1188 element->computeVectorOf(VM_Total, tStep, solVec);
1194 OOFEM_ERROR(
"Failed to cast StructuralFE2Material*.")
1197 for (
size_t segIndex = 0; segIndex < numSeg; segIndex++ ) {
1199 for (
int gpInd = 0; gpInd <
mpCZIntegrationRules[ segIndex ]->giveNumberOfIntegrationPoints(); gpInd++ ) {
1218 if ( fe2ms ==
nullptr ) {
1219 OOFEM_ERROR(
"The material status is not of an allowed type.")
1244 Ka(0,0) = (0.5/l_s)*( C(0,0)*n(0)*n(0) + a2*C(0,5)*n(0)*n(1) + a1*C(5,0)*n(1)*n(0) + a3*C(5,5)*n(1)*n(1) ) +
1245 (0.5/l_s)*( C(0,0)*n(0)*n(0) + a2*C(0,5)*n(0)*n(1) + a1*C(5,0)*n(1)*n(0) + a3*C(5,5)*n(1)*n(1) );
1247 Ka(0,1) = (0.5/l_s)*( a2*C(0,5)*n(0)*n(0) + C(0,1)*n(0)*n(1) + a3*C(5,5)*n(1)*n(0) + a1*C(5,1)*n(1)*n(1) ) +
1248 (0.5/l_s)*( a2*C(0,5)*n(0)*n(0) + C(0,1)*n(0)*n(1) + a3*C(5,5)*n(1)*n(0) + a1*C(5,1)*n(1)*n(1) );
1251 Ka(1,0) = (0.5/l_s)*( a1*C(5,0)*n(0)*n(0) + a3*C(5,5)*n(0)*n(1) + C(1,0)*n(1)*n(0) + a2*C(1,5)*n(1)*n(1) ) +
1252 (0.5/l_s)*( a1*C(5,0)*n(0)*n(0) + a3*C(5,5)*n(0)*n(1) + C(1,0)*n(1)*n(0) + a2*C(1,5)*n(1)*n(1) );
1255 Ka(1,1) = (0.5/l_s)*( a3*C(5,5)*n(0)*n(0) + a1*C(5,1)*n(0)*n(1) + a2*C(1,5)*n(1)*n(0) + C(1,1)*n(1)*n(1) ) +
1256 (0.5/l_s)*( a3*C(5,5)*n(0)*n(0) + a1*C(5,1)*n(0)*n(1) + a2*C(1,5)*n(1)*n(0) + C(1,1)*n(1)*n(1) );
1266 answer.
add(dA, tmp2);
1280 double eps = 1.0e-6;
1285 element->computeLocalCoordinates(locCoordPert, xPert);
1292 element->computeLocalCoordinates(locCoordPert, xPert);
1298 BAvg.
add(1.0, BMinus);
1304 Kb(0,0) = C(0,0)*n(0) + C(5,0)*n(1);
1305 Kb(0,1) = C(0,1)*n(0) + C(5,1)*n(1);
1306 Kb(0,3) = C(0,5)*n(0) + C(5,5)*n(1);
1308 Kb(1,0) = C(5,0)*n(0) + C(1,0)*n(1);
1309 Kb(1,1) = C(5,1)*n(0) + C(1,1)*n(1);
1310 Kb(1,3) = C(5,5)*n(0) + C(1,5)*n(1);
1314 answer.
add(dA, tmp2);
1325 answer.
add(1.0*dA, tmp);
1351 answer.
add(1.0*dA*l_s, tmp2);
1354 C4Bulk(0,0) = CBulk(0,0);
1355 C4Bulk(0,1) = CBulk(0,1);
1356 C4Bulk(0,2) = CBulk(0,2);
1357 C4Bulk(0,3) = CBulk(0,5);
1359 C4Bulk(1,0) = CBulk(1,0);
1360 C4Bulk(1,1) = CBulk(1,1);
1361 C4Bulk(1,2) = CBulk(1,2);
1362 C4Bulk(1,3) = CBulk(1,5);
1364 C4Bulk(2,0) = CBulk(2,0);
1365 C4Bulk(2,1) = CBulk(2,1);
1366 C4Bulk(2,2) = CBulk(2,2);
1367 C4Bulk(2,3) = CBulk(2,5);
1369 C4Bulk(3,0) = CBulk(5,0);
1370 C4Bulk(3,1) = CBulk(5,1);
1371 C4Bulk(3,2) = CBulk(5,2);
1372 C4Bulk(3,3) = CBulk(5,5);
1376 answer.
add(-1.0*dA*l_s, tmp2);
1388 printf(
"Entering XfemElementInterface :: computeCohesiveTangentAt().\n");
1392void XfemStructuralElementInterface :: XfemElementInterface_computeConsistentMassMatrix(
FloatMatrix &answer,
TimeStep *tStep,
double &mass,
const double *ipDensity)
1395 if ( structEl ==
nullptr ) {
1404 answer.
resize(ndofs, ndofs);
1414 for (
auto &gp: *
element->giveIntegrationRule(0) ) {
1418 if ( ipDensity !=
nullptr ) {
1420 density = * ipDensity;
1424 mass += density * dV;
1429 for (
int i = 1; i <= ndofs; i++ ) {
1430 for (
int j = i; j <= ndofs; j++ ) {
1433 if ( mask.
at(k) == 0 ) {
1437 summ += n.
at(k, i) * n.
at(k, j);
1440 answer.
at(i, j) += summ * density * dV;
1448 const double tol = 1.0e-9;
1449 const double regularizationCoeff = 1.0e-6;
1451 for (
int i = 0; i < numRows; i++ ) {
1452 if ( fabs( answer(i, i) ) < tol ) {
1453 answer(i, i) += regularizationCoeff;
1460XfemStructuralElementInterface :: initializeCZFrom(
InputRecord &ir,
int priority)
1481void XfemStructuralElementInterface :: initializeCZMaterial()
1488 OOFEM_ERROR(
"Failed to fetch pointer for mpCZMat.");
1493bool XfemStructuralElementInterface :: useNonStdCz()
1495 if (
element->giveDomain()->hasXfemManager() ) {
1535 if ( matMode == _3dMat || matMode == _PlaneStrain ) {
1536 answer.
at(1) += 1.0;
1537 answer.
at(2) += 1.0;
1538 answer.
at(3) += 1.0;
1539 }
else if ( matMode == _PlaneStress ) {
1540 answer.
at(1) += 1.0;
1541 answer.
at(2) += 1.0;
1542 }
else if ( matMode == _1dMat ) {
1543 answer.
at(1) += 1.0;
1545 OOFEM_ERROR(
"MaterialMode is not supported yet (%s)", __MaterialModeToString(matMode) );
1549void XfemStructuralElementInterface :: giveIntersectionsTouchingCrack(std :: vector< int > &oTouchingEnrItemIndices,
const std :: vector< int > &iCandidateIndices,
int iEnrItemIndex,
XfemManager &iXMan)
1554 for (
int candidateIndex : iCandidateIndices ) {
1555 if ( candidateIndex != iEnrItemIndex ) {
1565 if ( efStart !=
nullptr ) {
1570 oTouchingEnrItemIndices.push_back(candidateIndex);
1576 if ( efEnd !=
nullptr ) {
1581 oTouchingEnrItemIndices.push_back(candidateIndex);
1588void XfemStructuralElementInterface :: giveSubtriangulationCompositeExportData(std :: vector< ExportRegion > &vtkPieces,
IntArray &primaryVarsToExport,
IntArray &internalVarsToExport,
IntArray cellVarsToExport,
TimeStep *tStep)
1590 const int numCells =
mSubTri.size();
1591 vtkPieces [ 0 ].setNumberOfCells(numCells);
1593 int numTotalNodes = numCells * 3;
1594 vtkPieces [ 0 ].setNumberOfNodes(numTotalNodes);
1597 std :: vector< FloatArray >nodeCoords;
1598 int nodesPassed = 1;
1600 for (
int i = 1; i <= 3; i++ ) {
1602 nodeCoords.push_back(x);
1603 vtkPieces [ 0 ].setNodeCoords(nodesPassed, x);
1611 for (
size_t i = 1; i <=
mSubTri.size(); i++ ) {
1613 nodesPassed, nodesPassed + 1, nodesPassed + 2
1616 vtkPieces [ 0 ].setConnectivity(i, nodes);
1618 vtkPieces [ 0 ].setOffset(i, offset);
1621 vtkPieces [ 0 ].setCellType(i, 5);
1627 vtkPieces [ 0 ].setNumberOfPrimaryVarsToExport(primaryVarsToExport, numTotalNodes);
1629 for (
int fieldNum = 1; fieldNum <= primaryVarsToExport.
giveSize(); fieldNum++ ) {
1637 triCenter.
add( tri.giveVertex(2) );
1638 triCenter.
add( tri.giveVertex(3) );
1639 triCenter.
times(1.0 / 3.0);
1641 double meanEdgeLength = 0.0;
1642 meanEdgeLength += ( 1.0 / 3.0 ) *
distance(tri.giveVertex(1), tri.giveVertex(2) );
1643 meanEdgeLength += ( 1.0 / 3.0 ) *
distance(tri.giveVertex(2), tri.giveVertex(3) );
1644 meanEdgeLength += ( 1.0 / 3.0 ) *
distance(tri.giveVertex(3), tri.giveVertex(1) );
1646 const double relPertLength = XfemTolerances :: giveRelLengthTolTight();
1648 for (
int i = 1; i <= 3; i++ ) {
1649 if ( type == DisplacementVector ) {
1659 element->computeLocalCoordinates(locCoordNode, x);
1664 double pertLength = relPertLength;
1667 for (
int j = 0; j < numTries; j++ ) {
1671 pertVec.
times(pertLength);
1677 element->computeLocalCoordinates(locCoord, xPert);
1690 const int nDofMan =
element->giveNumberOfDofManagers();
1695 bool joinNodes =
false;
1697 for (
int eiIndex = 1; eiIndex <= numEI; eiIndex++ ) {
1700 double levelSetTang = 0.0, levelSetNormal = 0.0, levelSetInNode = 0.0;
1702 bool evaluationSucceeded =
true;
1703 for (
int elNodeInd = 1; elNodeInd <= nDofMan; elNodeInd++ ) {
1708 evaluationSucceeded =
false;
1710 levelSetTang +=
N.at(elNodeInd) * levelSetInNode;
1713 evaluationSucceeded =
false;
1715 levelSetNormal +=
N.at(elNodeInd) * levelSetInNode;
1718 double tangSignDist = levelSetTang, arcPos = 0.0;
1721 if ( geoEI !=
nullptr ) {
1727 if ( !evaluationSucceeded ) {
1736 if ( ( tangSignDist < ( 1.0e-3 ) * meanEdgeLength || fabs(levelSetNormal) > ( 1.0e-2 ) * meanEdgeLength ) &&
false ) {
1744 element->computeVectorOf(VM_Total, tStep, solVec);
1747 element->computeVectorOf(VM_Total, tStep, solVec);
1758 uTemp [ 0 ], uTemp [ 1 ], 0.0
1764 vtkPieces [ 0 ].setPrimaryVarInNode(type, nodesPassed, valuearray);
1767 printf(
"fieldNum: %d\n", fieldNum);
1777 vtkPieces [ 0 ].setNumberOfInternalVarsToExport(internalVarsToExport, numTotalNodes);
1780 vtkPieces [ 0 ].setNumberOfCellVarsToExport(cellVarsToExport, numCells);
1781 for (
int i = 1; i <= cellVarsToExport.
giveSize(); i++ ) {
1784 for (
size_t triInd = 1; triInd <=
mSubTri.size(); triInd++ ) {
1791 VTKXMLExportModule :: computeIPAverage(average, iRule,
element, type, tStep);
1801 averageVoigt.
at(1) = average.
at(1);
1802 averageVoigt.
at(5) = average.
at(2);
1803 averageVoigt.
at(9) = average.
at(3);
1804 averageVoigt.
at(6) = averageVoigt.
at(8) = average.
at(4);
1805 averageVoigt.
at(3) = averageVoigt.
at(7) = average.
at(5);
1806 averageVoigt.
at(2) = averageVoigt.
at(4) = average.
at(6);
1810 averageVoigt.
at(1) = average.
at(1);
1814 vtkPieces [ 0 ].setCellVar(type, triInd, averageVoigt);
1821 if (
element->giveDomain()->hasXfemManager() ) {
1827 const int nDofMan =
element->giveNumberOfDofManagers();
1833 for (
int enrItIndex = 1; enrItIndex <= nEnrIt; enrItIndex++ ) {
1835 for (
int nodeInd = 1; nodeInd <= numTotalNodes; nodeInd++ ) {
1836 const FloatArray &x = nodeCoords [ nodeInd - 1 ];
1838 element->computeLocalCoordinates(locCoord, x);
1845 if ( xfemstype == XFEMST_LevelSetPhi ) {
1846 double levelSet = 0.0, levelSetInNode = 0.0;
1848 for (
int elNodeInd = 1; elNodeInd <= nDofMan; elNodeInd++ ) {
1853 levelSet +=
N.at(elNodeInd) * levelSetInNode;
1860 vtkPieces [ 0 ].setInternalXFEMVarInNode(field, enrItIndex, nodeInd, valueArray);
1861 }
else if ( xfemstype == XFEMST_LevelSetGamma ) {
1862 double levelSet = 0.0, levelSetInNode = 0.0;
1864 for (
int elNodeInd = 1; elNodeInd <= nDofMan; elNodeInd++ ) {
1869 levelSet +=
N.at(elNodeInd) * levelSetInNode;
1876 vtkPieces [ 0 ].setInternalXFEMVarInNode(field, enrItIndex, nodeInd, valueArray);
1877 }
else if ( xfemstype == XFEMST_NodeEnrMarker ) {
1878 double nodeEnrMarker = 0.0, nodeEnrMarkerInNode = 0.0;
1880 for (
int elNodeInd = 1; elNodeInd <= nDofMan; elNodeInd++ ) {
1884 nodeEnrMarker +=
N.at(elNodeInd) * nodeEnrMarkerInNode;
1892 vtkPieces [ 0 ].setInternalXFEMVarInNode(field, enrItIndex, nodeInd, valueArray);
1909 FloatArray globCoord = ip->giveGlobalCoordinates();
1914 gptot += ip->giveWeight();
1915 answer.
add(ip->giveWeight(), temp);
1919 answer.
times(1. / gptot);
virtual void computeTangentialSignDist(double &oDist, const FloatArray &iPoint, double &oMinDistArcPos) const =0
void AppendCohesiveZoneGaussPoint(GaussPoint *ipGP)
virtual double give(CrossSectionProperty a, GaussPoint *gp) const
int giveGlobalNumber() const
const FloatArray & giveCoordinates() const
int giveElementPlaceInArray(int iGlobalElNum) const
EngngModel * giveEngngModel()
virtual bool isActivated(TimeStep *tStep)
virtual int computeNumberOfDofs()
void computeVectorOf(ValueModeType u, TimeStep *tStep, FloatArray &answer)
virtual int giveIPValue(FloatArray &answer, GaussPoint *gp, InternalStateType type, TimeStep *tStep)
virtual double computeVolumeAround(GaussPoint *gp)
virtual TimeStep * giveCurrentStep(bool force=false)
const TipInfo & giveTipInfo() const
bool evalNodeEnrMarkerInNode(double &oNodeEnrMarker, int iNodeInd) const
EnrichmentFront * giveEnrichmentFrontStart()
bool evalLevelSetTangInNode(double &oLevelSet, int iNodeInd, const FloatArray &iGlobalCoord) const
bool tipIsTouchingEI(const TipInfo &iTipInfo)
EnrichmentFront * giveEnrichmentFrontEnd()
bool evalLevelSetNormalInNode(double &oLevelSet, int iNodeInd, const FloatArray &iGlobalCoord) const
virtual bool isMaterialModified(GaussPoint &iGP, Element &iEl, CrossSection *&opCS) const
virtual void evalN(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const =0
double & at(std::size_t i)
double computeSquaredNorm() const
Index giveSize() const
Returns the size of receiver.
void beDifferenceOf(const FloatArray &a, const FloatArray &b)
void zero()
Zeroes all coefficients of receiver.
void beProductOf(const FloatMatrix &aMatrix, const FloatArray &anArray)
void beVectorProductOf(const FloatArray &v1, const FloatArray &v2)
void beTProductOf(const FloatMatrix &aMatrix, const FloatArray &anArray)
void add(const FloatArray &src)
void subtract(const FloatArray &src)
void setColumn(const FloatArrayF< N > &src, std::size_t c)
void plusProductSymmUpper(const FloatMatrix &a, const FloatMatrix &b, double dV)
void add(const FloatMatrix &a)
void resize(Index rows, Index cols)
void beProductTOf(const FloatMatrix &a, const FloatMatrix &b)
void beProductOf(const FloatMatrix &a, const FloatMatrix &b)
void setColumn(const FloatArray &src, int c)
void beTranspositionOf(const FloatMatrix &src)
void zero()
Zeroes all coefficient of receiver.
int giveNumberOfRows() const
Returns number of rows of receiver.
double at(std::size_t i, std::size_t j) const
void beTProductOf(const FloatMatrix &a, const FloatMatrix &b)
void beUnitMatrix()
Sets receiver to unity matrix.
const FloatArray & giveGlobalCoordinates()
MaterialMode giveMaterialMode()
Returns corresponding material mode of receiver.
IntegrationPointStatus * giveMaterialStatus(IntegrationPointStatusIDType key=IPSID_Default)
double giveWeight()
Returns integration weight of receiver.
void giveSubPolygon(std ::vector< FloatArray > &oPoints, const double &iXiStart, const double &iXiEnd) const
BasicGeometry * giveGeometry()
virtual void copyStateVariables(const MaterialStatus &iStatus)=0
virtual void computeBHmatrixAt(GaussPoint *gp, FloatMatrix &answer)
void recomputeTractionMesh()
void setPeriodicityNormal(const FloatArray &iPeriodicityNormal)
virtual double domainSize(Domain *d, int set)
virtual void createMaterialStatus(GaussPoint &iGP)=0
virtual FloatMatrixF< 4, 4 > giveStiffnessMatrix_PlaneStrain(MatResponseMode mode, GaussPoint *gp, TimeStep *tStep) const =0
virtual FloatMatrixF< 3, 3 > giveStiffnessMatrix_PlaneStress(MatResponseMode mode, GaussPoint *gp, TimeStep *tStep) const =0
StructuralCrossSection * giveStructuralCrossSection()
Helper function which returns the structural cross-section for the element.
virtual void giveMassMtrxIntegrationgMask(IntArray &answer)
virtual void computeNmatrixAt(const FloatArray &iLocCoord, FloatMatrix &answer)
std::unique_ptr< FloatArray > initialDisplacements
Initial displacement vector, describes the initial nodal displacements when element has been casted.
PrescribedGradientHomogenization * giveBC()
const FloatArray & giveNormal() const
void letNormalBe(FloatArray iN)
FloatArrayF< 6 > giveRealStressVector_3d(const FloatArrayF< 6 > &strain, GaussPoint *gp, TimeStep *tStep) const override
Default implementation relies on giveRealStressVector for second Piola-Kirchoff stress.
FloatMatrixF< 6, 6 > give3dMaterialStiffnessMatrix(MatResponseMode mode, GaussPoint *gp, TimeStep *tStep) const override
void setNewlyInserted(bool iNewlyInserted)
void letNormalBe(const FloatArrayF< 3 > &iN)
Assigns normal vector.
const FloatArrayF< 3 > & giveNormal() const
Returns const reference to normal vector.
virtual FloatArrayF< 3 > giveFirstPKTraction_3d(const FloatArrayF< 3 > &jump, const FloatMatrixF< 3, 3 > &F, GaussPoint *gp, TimeStep *tStep) const
virtual bool hasAnalyticalTangentStiffness() const =0
virtual FloatMatrixF< 3, 3 > give3dStiffnessMatrix_dTdj(MatResponseMode rMode, GaussPoint *gp, TimeStep *tStep) const
virtual FloatMatrixF< 6, 6 > give3dMaterialStiffnessMatrix(MatResponseMode mode, GaussPoint *gp, TimeStep *tStep) const
virtual FloatArrayF< 6 > giveRealStressVector_3d(const FloatArrayF< 6 > &strain, GaussPoint *gp, TimeStep *tStep) const
Default implementation relies on giveRealStressVector for second Piola-Kirchoff stress.
double giveTargetTime()
Returns target time.
static void refineTriangle(std::vector< Triangle > &oRefinedTri, const Triangle &iTri)
bool pointIsInTriangle(const FloatArray &iP) const
std ::vector< std ::unique_ptr< IntegrationRule > > mIntRule_tmp
void computeDisplacementJump(GaussPoint &iGP, FloatArray &oJump, const FloatArray &iSolVec, const FloatMatrix &iNMatrix)
static ParamKey IPK_XfemElementInterface_CohesiveZoneMaterial
std ::vector< std ::unique_ptr< IntegrationRule > > mpCZExtraIntegrationRules
virtual void XfemElementInterface_partitionElement(std ::vector< Triangle > &oTriangles, const std ::vector< FloatArray > &iPoints)
Partitions the element into patches by a triangulation.
std ::vector< std ::unique_ptr< IntegrationRule > > mpCZExtraIntegrationRules_tmp
void ComputeBOrBHMatrix(FloatMatrix &oAnswer, GaussPoint &iGP, Element &iEl, bool iComputeBH, const FloatArray &iNaturalGpCoord)
std ::vector< std ::vector< int > > mCZTouchingEnrItemIndices
XfemElementInterface(Element *e)
Constructor.
virtual void XfemElementInterface_prepareNodesForDelaunay(std ::vector< std ::vector< FloatArray > > &oPointPartitions, double &oCrackStartXi, double &oCrackEndXi, int iEnrItemIndex, bool &oIntersection)
Returns an array of array of points. Each array of points defines the points of a subregion of the el...
static ParamKey IPK_XfemElementInterface_NumIntPointsCZ
std ::vector< std ::unique_ptr< IntegrationRule > > mpCZIntegrationRules
void computeNCohesive(FloatMatrix &oN, GaussPoint &iGP, int iEnrItemIndex, const std ::vector< int > &iTouchingEnrItemIndices)
void XfemElementInterface_createEnrNmatrixAt(FloatMatrix &oAnswer, const FloatArray &iLocCoord, Element &iEl, bool iSetDiscontContribToZero)
Creates enriched N-matrix.
std ::vector< int > mCZEnrItemIndices
Index of enrichment items associated with cohesive zones.
bool mUsePlaneStrain
Flag that tells if plane stress or plane strain is assumed.
std ::vector< std ::unique_ptr< IntegrationRule > > mpCZIntegrationRules_tmp
static ParamKey IPK_XfemElementInterface_PlaneStrain
bool isElementEnriched(const Element *elem)
bool giveVtkDebug() const
void giveElementEnrichmentItemIndices(std ::vector< int > &oElemEnrInd, int iElementIndex) const
int giveNumGpPerTri() const
const std ::vector< int > & giveMaterialModifyingEnrItemIndices() const
int giveNumTriRefs() const
Number of Gauss points per sub-triangle in cut elements.
EnrichmentItem * giveEnrichmentItem(int n)
int giveNumberOfEnrichmentItems() const
virtual void initializeCZMaterial()
void computeIPAverageInTriangle(FloatArray &answer, IntegrationRule *iRule, Element *elem, InternalStateType isType, TimeStep *tStep, const Triangle &iTri)
Help functions for VTK export.
void giveIntersectionsTouchingCrack(std ::vector< int > &oTouchingEnrItemIndices, const std ::vector< int > &iCandidateIndices, int iEnrItemIndex, XfemManager &iXMan)
virtual void computeGlobalCohesiveTractionVector(FloatArray &oT, const FloatArray &iJump, const FloatArray &iCrackNormal, const FloatMatrix &iNMatrix, GaussPoint &iGP, TimeStep *tStep)
virtual bool hasCohesiveZone() const
double computeEffectiveSveSize(StructuralFE2MaterialStatus *iFe2Ms)
std ::vector< Triangle > mSubTri
MaterialStatus * giveClosestGP_MatStat(double &oClosestDist, std ::vector< std ::unique_ptr< IntegrationRule > > &iRules, const FloatArray &iCoord)
bool giveUseNonStdCz() const
static FloatArray Vec2(const double &a, const double &b)
FloatMatrixF< N, P > Tdot(const FloatMatrixF< M, N > &a, const FloatMatrixF< M, P > &b)
Computes .
GaussPoint IntegrationPoint
static FloatArray Vec6(const double &a, const double &b, const double &c, const double &d, const double &e, const double &f)
FloatArrayF< 3 > cross(const FloatArrayF< 3 > &x, const FloatArrayF< 3 > &y)
Computes $ x \cross y $.
double dot(const FloatArray &x, const FloatArray &y)
static FloatArray Vec4(const double &a, const double &b, const double &c, const double &d)
double distance(const FloatArray &x, const FloatArray &y)
double distance_square(const FloatArray &x, const FloatArray &y)
static FloatArray Vec1(const double &a)
FloatMatrixF< N, N > eye()
Constructs an identity matrix.
static FloatArray Vec3(const double &a, const double &b, const double &c)
#define PM_UPDATE_PARAMETER(_val, _pm, _ir, _componentnum, _paramkey, _prio)
#define _IFT_XfemElementInterface_NumIntPointsCZ
#define _IFT_XfemElementInterface_PlaneStrain
#define _IFT_XfemElementInterface_CohesiveZoneMaterial