1 label cohesivePatchID = -1;
3 solidCohesiveFvPatchVectorField* cohesivePatchDUPtr = NULL;
4 solidCohesiveFixedModeMixFvPatchVectorField* cohesivePatchDUFixedModePtr = NULL;
6 forAll (DU.boundaryField(), patchI)
8 if (isA<solidCohesiveFvPatchVectorField>(DU.boundaryField()[patchI]))
10 cohesivePatchID = patchI;
12 &refCast<solidCohesiveFvPatchVectorField>
14 DU.boundaryField()[cohesivePatchID]
18 else if (isA<solidCohesiveFixedModeMixFvPatchVectorField>(DU.boundaryField()[patchI]))
20 cohesivePatchID = patchI;
21 cohesivePatchDUFixedModePtr =
22 &refCast<solidCohesiveFixedModeMixFvPatchVectorField>
24 DU.boundaryField()[cohesivePatchID]
30 if(cohesivePatchID == -1)
32 FatalErrorIn(args.executable())
33 << "Can't find cohesiveLawFvPatch" << nl
34 << "One of the boundary patches in " << DU.name() << ".boundaryField() "
35 << "should be of type " << solidCohesiveFvPatchVectorField::typeName
36 << "or " << solidCohesiveFixedModeMixFvPatchVectorField::typeName
40 // solidCohesiveFvPatchVectorField& cohesivePatchDU =
41 // refCast<solidCohesiveFvPatchVectorField>
43 // DU.boundaryField()[cohesivePatchID]
46 // philipc: I have moved cohesive stuff to constitutiveModel
47 // cohesiveZone is an index field
48 // which allows the user to limit the crack to certain areas at runtime
49 // 1 for faces within cohesiveZone
50 // 0 for faces outside cohesiveZone
51 surfaceScalarField cohesiveZone
58 IOobject::READ_IF_PRESENT,
62 dimensionedScalar("zero", dimless, 0.0)
65 // limit crack to specified boxes
67 const dictionary& stressControl =
68 mesh.solutionDict().subDict("solidMechanics");
70 List<boundBox> userBoxes(stressControl.lookup("crackLimitingBoxes"));
71 const surfaceVectorField& Cf = mesh.Cf();
72 //int numPossibleCrackFaces = 0;
73 forAll(cohesiveZone.internalField(), faceI)
75 bool faceInsideBox = false;
77 forAll(userBoxes, boxi)
79 if(userBoxes[boxi].contains(Cf.internalField()[faceI])) faceInsideBox = true;
84 cohesiveZone.internalField()[faceI] = 1.0;
85 //numPossibleCrackFaces++;
88 //reduce(numPossibleCrackFaces, sumOp<int>());
90 forAll(cohesiveZone.boundaryField(), patchI)
92 // cracks may go along proc boundaries
93 if(mesh.boundaryMesh()[patchI].type() == processorPolyPatch::typeName)
95 forAll(cohesiveZone.boundaryField()[patchI], faceI)
97 bool faceInsideBox = false;
99 forAll(userBoxes, boxi)
101 if(userBoxes[boxi].contains(Cf.boundaryField()[patchI][faceI])) faceInsideBox = true;
106 cohesiveZone.boundaryField()[patchI][faceI] = 1.0;
110 // numPossibleCrackFaces += int(sum(cohesiveZone.boundaryField()[patchI]));
111 // philipc multiMat cracks not working on proc boundaries yet... disable for now
112 // found the problem: solidInterface needs to know about mesh changes so
113 // I make a new one each time there is a crack
114 // int numProcFaces = int(sum(cohesiveZone.boundaryField()[patchI]));
115 // if(numProcFaces > 0)
117 // cohesiveZone.boundaryField()[patchI] = 0.0;
118 // Warning << "Processor boundary cracking is "
119 // << "disabled because it is not working yet for multi-materials." << nl
120 // << "There are " << numProcFaces << " possible cracks "
121 // << "faces on processor boundary " << mesh.boundary()[patchI].name()
122 // << ", which are not allowed to crack." << endl;
127 // Info << "\nNumber of possible cracking faces is " << numPossibleCrackFaces << endl;
128 Info << "\nThere are " << gSum(cohesiveZone.internalField()) << " potential internal crack faces" << nl << endl;
129 Info << "\nThere are " << gSum(cohesiveZone.boundaryField())/2 << " potential coupled boundary crack faces" << nl << endl;
131 // write field for visualisation
132 volScalarField cohesiveZoneVol
143 dimensionedScalar("zero", dimless, 0.0)
146 forAll(cohesiveZone.internalField(), facei)
148 if(cohesiveZone.internalField()[facei])
150 cohesiveZoneVol.internalField()[mesh.owner()[facei]] = 1.0;
151 cohesiveZoneVol.internalField()[mesh.neighbour()[facei]] = 1.0;
155 forAll(cohesiveZone.boundaryField(), patchi)
157 forAll(cohesiveZone.boundaryField()[patchi], facei)
159 if(cohesiveZone.boundaryField()[patchi][facei] > 0.0)
161 cohesiveZoneVol.boundaryField()[patchi][facei] = 1.0;
165 Info << "Writing cohesiveZone field" << endl;
166 cohesiveZoneVol.write();
170 Switch initialiseSolution(false);
174 mesh.solutionDict().subDict("solidMechanics")
175 .found("initialiseSolution")
181 mesh.solutionDict().subDict("solidMechanics").lookup
189 Switch breakOnlyOneFacePerTopologyChange(true);
193 mesh.solutionDict().subDict("solidMechanics")
194 .found("breakOnlyOneFacePerTopologyChange")
197 breakOnlyOneFacePerTopologyChange =
200 mesh.solutionDict().subDict("solidMechanics").lookup
202 "breakOnlyOneFacePerTopologyChange"
208 Switch crackPropagationFromSpecifiedPatches
210 mesh.solutionDict().subDict("solidMechanics").lookup
212 "crackPropagationFromSpecifiedPatches"
216 wordList crackPropagationPatchNames
218 mesh.solutionDict().subDict("solidMechanics").lookup
220 "crackPropagationPatches"
224 labelList crackPropagationPatches(crackPropagationPatchNames.size(), -1);
226 forAll(crackPropagationPatchNames, patchI)
228 crackPropagationPatches[patchI] =
229 mesh.boundaryMesh().findPatchID
231 crackPropagationPatchNames[patchI]
234 if(crackPropagationPatches[patchI] == -1)
236 FatalErrorIn(args.executable())
237 << "Can't find " << crackPropagationPatchNames[patchI]
238 << " patch" << abort(FatalError);
242 // Internal faces next to selected crack propagation patches
243 labelList crackPropagationPatchesInternalFaces;
245 # include "updateCrackPropagationPatchesInternalFaces.H"