bool PLCrackPrescribedDir :: propagateInterface(Domain &iDomain, EnrichmentFront &iEnrFront, TipPropagation &oTipProp) { if ( !iEnrFront.propagationIsAllowed() ) { return false; } const TipInfo &tipInfo = iEnrFront.giveTipInfo(); SpatialLocalizer *localizer = iDomain.giveSpatialLocalizer(); // It is meaningless to propagate a tip that is not inside any element if ( tipInfo.mGlobalCoord.giveSize() == 0 ) { return false; } Element *el = localizer->giveElementContainingPoint(tipInfo.mGlobalCoord); if ( el == NULL ) { return false; } double angleRad = mAngle * M_PI / 180.0; FloatArray dir = { cos(angleRad), sin(angleRad) }; oTipProp.mTipIndex = tipInfo.mTipIndex; oTipProp.mPropagationDir = dir; oTipProp.mPropagationLength = mIncrementLength; return true; }
bool PLnodeRadius :: propagateInterface(Domain &iDomain, EnrichmentFront &iEnrFront, TipPropagation &oTipProp) { if ( !iEnrFront.propagationIsAllowed() ) { printf("EnrichmentFront.propagationIsAllowed is false \n"); return false; } const TipInfo &tipInfo = iEnrFront.giveTipInfo(); // includes the dofman numbers which represent the boundary of the EI. //tipInfo.mTipDofManNumbers.printYourself(); // No listbased tip (or EI) present, so nothing to propagate. if ( tipInfo.mTipDofManNumbers.giveSize() == 0 ) { printf("No dofmans in tip; nothing to propagate. \n"); return false; } // Localise nodes within certain radius from tip nodes oTipProp.mPropagationDofManNumbers.clear(); SpatialLocalizer *localizer = iDomain.giveSpatialLocalizer(); for ( int i = 1 ; i <= tipInfo.mTipDofManNumbers.giveSize() ; i++ ) { //DofManager *dofMan = iDomain.giveDofManager(tipInfo.mTipDofManNumbers.at(i)); //const FloatArray gCoords = dofMan->giveCoordinates(); Node *iNode = iDomain.giveNode(tipInfo.mTipDofManNumbers.at(i)); const FloatArray gCoords = iNode->giveNodeCoordinates(); std :: list< int > nodeList; localizer->giveAllNodesWithinBox(nodeList,gCoords,mRadius); for ( int jNode : nodeList ) { //printf("nodeList node %d \n",jNode); oTipProp.mPropagationDofManNumbers.insertSortedOnce(jNode); } } //oTipProp.mPropagationDofManNumbers.printYourself(" The following noded will be propagated to:"); return true; }
bool PLMaterialForce :: propagateInterface(Domain &iDomain, EnrichmentFront &iEnrFront, TipPropagation &oTipProp) { // printf("Entering PLMaterialForce :: propagateInterface().\n"); if ( !iEnrFront.propagationIsAllowed() ) { return false; } // Fetch crack tip data const TipInfo &tipInfo = iEnrFront.giveTipInfo(); // Check if the tip is located in the domain SpatialLocalizer *localizer = iDomain.giveSpatialLocalizer(); FloatArray lCoords, closest; // printf("tipInfo.mGlobalCoord: \n"); tipInfo.mGlobalCoord.printYourself(); if( tipInfo.mGlobalCoord.giveSize() == 0 ) { return false; } localizer->giveElementClosestToPoint(lCoords, closest, tipInfo.mGlobalCoord); if(closest.distance(tipInfo.mGlobalCoord) > 1.0e-9) { // printf("Tip is outside all elements.\n"); return false; } FloatArray matForce; TimeStep *tStep = iDomain.giveEngngModel()->giveCurrentStep(); mpMaterialForceEvaluator->computeMaterialForce(matForce, iDomain, tipInfo, tStep, mRadius); // printf("matForce: "); matForce.printYourself(); if(matForce.giveSize() == 0) { return false; } double forceNorm = matForce.computeNorm(); // printf("forceNorm: %e mCrackPropThreshold: %e\n", forceNorm, mCrackPropThreshold); if(forceNorm < mCrackPropThreshold || forceNorm < 1.0e-20) { return false; } printf("forceNorm: %e mCrackPropThreshold: %e\n", forceNorm, mCrackPropThreshold); printf("Propagating crack in PLMaterialForce :: propagateInterface.\n"); // printf("Tip coord: "); tipInfo.mGlobalCoord.printYourself(); FloatArray dir(matForce); dir.times(1.0/forceNorm); // printf("dir: "); dir.printYourself(); const double cosAngTol = 1.0/sqrt(2.0); if(tipInfo.mTangDir.dotProduct(dir) < cosAngTol) { // Do not allow sharper turns than 45 degrees if( tipInfo.mNormalDir.dotProduct(dir) > 0.0 ) { dir = tipInfo.mTangDir; dir.add(tipInfo.mNormalDir); dir.normalize(); } else { // dir = tipInfo.mNormalDir; // dir.times(-1.0); dir = tipInfo.mTangDir; dir.add(-1.0,tipInfo.mNormalDir); dir.normalize(); } printf("//////////////////////////////////////////// Resticting crack propagation direction.\n"); // printf("tipInfo.mTangDir: "); tipInfo.mTangDir.printYourself(); // printf("dir: "); dir.printYourself(); } // Fill up struct oTipProp.mTipIndex = tipInfo.mTipIndex; oTipProp.mPropagationDir = dir; oTipProp.mPropagationLength = mIncrementLength; return true; }