int StructuralInterfaceMaterial :: giveIPValue(FloatArray &answer, GaussPoint *gp, InternalStateType type, TimeStep *tStep) { StructuralInterfaceMaterialStatus *status = static_cast< StructuralInterfaceMaterialStatus * >( this->giveStatus(gp) ); if ( type == IST_InterfaceJump ) { answer = status->giveJump(); answer.resizeWithValues(3); // In case some model is not storing all components. return 1; } else if ( type == IST_InterfaceTraction ) { answer = status->giveTraction(); answer.resizeWithValues(3); return 1; } else if ( type == IST_InterfaceFirstPKTraction ) { answer = status->giveFirstPKTraction(); answer = status->giveTempFirstPKTraction(); answer.resizeWithValues(3); return 1; } else if ( type == IST_DeformationGradientTensor ) { answer.beVectorForm( status->giveF() ); return 1; } else if ( type == IST_InterfaceNormal ) { answer = status->giveNormal(); return 1; } else { return Material :: giveIPValue(answer, gp, type, tStep); } }
void GnuplotExportModule::outputXFEM(Crack &iCrack, TimeStep *tStep) { const std::vector<GaussPoint*> &czGaussPoints = iCrack.giveCohesiveZoneGaussPoints(); std::vector<double> arcLengthPositions, normalJumps, tangJumps, normalTractions; const BasicGeometry *bg = iCrack.giveGeometry(); for( GaussPoint *gp: czGaussPoints ) { StructuralInterfaceMaterialStatus *matStat = dynamic_cast<StructuralInterfaceMaterialStatus*> ( gp->giveMaterialStatus() ); if(matStat != NULL) { // Compute arc length position of the Gauss point const FloatArray &coord = (gp->giveGlobalCoordinates()); double tangDist = 0.0, arcPos = 0.0; bg->computeTangentialSignDist(tangDist, coord, arcPos); arcLengthPositions.push_back(arcPos); // Compute displacement jump in normal and tangential direction // Local numbering: (tang_z, tang, normal) const FloatArray &jumpLoc = matStat->giveJump(); double normalJump = jumpLoc.at(3); normalJumps.push_back(normalJump); tangJumps.push_back( jumpLoc.at(2) ); const FloatArray &trac = matStat->giveFirstPKTraction(); normalTractions.push_back(trac.at(3)); } } Domain *domain = emodel->giveDomain(1); XfemManager *xMan = domain->giveXfemManager(); if ( xMan != NULL ) { double time = 0.0; TimeStep *ts = emodel->giveCurrentStep(); if ( ts != NULL ) { time = ts->giveTargetTime(); } int eiIndex = iCrack.giveNumber(); std :: stringstream strNormalJump; strNormalJump << "NormalJumpGnuplotEI" << eiIndex << "Time" << time << ".dat"; std :: string nameNormalJump = strNormalJump.str(); XFEMDebugTools::WriteArrayToGnuplot(nameNormalJump, arcLengthPositions, normalJumps); std :: stringstream strTangJump; strTangJump << "TangJumpGnuplotEI" << eiIndex << "Time" << time << ".dat"; std :: string nameTangJump = strTangJump.str(); XFEMDebugTools::WriteArrayToGnuplot(nameTangJump, arcLengthPositions, tangJumps); std :: stringstream strNormalTrac; strNormalTrac << "NormalTracGnuplotEI" << eiIndex << "Time" << time << ".dat"; std :: string nameNormalTrac = strNormalTrac.str(); XFEMDebugTools::WriteArrayToGnuplot(nameNormalTrac, arcLengthPositions, normalTractions); std::vector<FloatArray> matForcesStart, matForcesEnd; std::vector<double> radii; // Material forces for(double matForceRadius : mMatForceRadii) { radii.push_back(matForceRadius); EnrichmentFront *efStart = iCrack.giveEnrichmentFrontStart(); const TipInfo &tipInfoStart = efStart->giveTipInfo(); FloatArray matForceStart; mpMatForceEvaluator->computeMaterialForce(matForceStart, *domain, tipInfoStart, tStep, matForceRadius); if(matForceStart.giveSize() > 0) { matForcesStart.push_back(matForceStart); } else { matForcesStart.push_back({0.0,0.0}); } EnrichmentFront *efEnd = iCrack.giveEnrichmentFrontEnd(); const TipInfo &tipInfoEnd = efEnd->giveTipInfo(); FloatArray matForceEnd; mpMatForceEvaluator->computeMaterialForce(matForceEnd, *domain, tipInfoEnd, tStep, matForceRadius); if(matForceEnd.giveSize() > 0) { matForcesEnd.push_back(matForceEnd); } else { matForcesEnd.push_back({0.0,0.0}); } } std::vector< std::vector<FloatArray> > matForcesStartArray, matForcesEndArray; matForcesStartArray.push_back(matForcesStart); matForcesEndArray.push_back(matForcesEnd); std :: stringstream strRadii; strRadii << "MatForceRadiiGnuplotTime" << time << "Crack" << iCrack.giveNumber() << ".dat"; XFEMDebugTools::WriteArrayToGnuplot(strRadii.str(), radii, radii); std :: stringstream strMatForcesStart; strMatForcesStart << "MatForcesStartGnuplotTime" << time << "Crack" << iCrack.giveNumber() << ".dat"; WritePointsToGnuplot(strMatForcesStart.str(), matForcesStartArray); std :: stringstream strMatForcesEnd; strMatForcesEnd << "MatForcesEndGnuplotTime" << time << "Crack" << iCrack.giveNumber() << ".dat"; WritePointsToGnuplot(strMatForcesEnd.str(), matForcesEndArray); double crackLength = iCrack.computeLength(); // printf("crackLength: %e\n", crackLength ); mCrackLengthHist[eiIndex].push_back(crackLength); std :: stringstream strCrackLength; strCrackLength << "CrackLengthGnuplotEI" << eiIndex << "Time" << time << ".dat"; XFEMDebugTools::WriteArrayToGnuplot(strCrackLength.str(), mTimeHist, mCrackLengthHist[eiIndex]); } }