1 label cohesivePatchID = -1;
3 solidCohesiveFvPatchVectorField* cohesivePatchUPtr = NULL;
4 solidCohesiveFixedModeMixFvPatchVectorField* cohesivePatchUFixedModePtr = NULL;
6 forAll (U.boundaryField(), patchI)
8 if (isA<solidCohesiveFvPatchVectorField>(U.boundaryField()[patchI]))
10 cohesivePatchID = patchI;
12 &refCast<solidCohesiveFvPatchVectorField>
14 U.boundaryField()[cohesivePatchID]
18 else if (isA<solidCohesiveFixedModeMixFvPatchVectorField>(U.boundaryField()[patchI]))
20 cohesivePatchID = patchI;
21 cohesivePatchUFixedModePtr =
22 &refCast<solidCohesiveFixedModeMixFvPatchVectorField>
24 U.boundaryField()[cohesivePatchID]
30 if(cohesivePatchID == -1)
32 FatalErrorIn(args.executable())
33 << "Can't find cohesiveLawFvPatch" << nl
34 << "One of the boundary patches in " << U.name() << ".boundaryField() "
35 << "should be of type " << solidCohesiveFvPatchVectorField::typeName
36 << "or " << solidCohesiveFixedModeMixFvPatchVectorField::typeName
40 // solidCohesiveFvPatchVectorField& cohesivePatchU =
41 // refCast<solidCohesiveFvPatchVectorField>
43 // U.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 forAll(cohesiveZone.internalField(), faceI)
74 bool faceInsideBox = false;
76 forAll(userBoxes, boxi)
78 if(userBoxes[boxi].contains(Cf.internalField()[faceI])) faceInsideBox = true;
83 cohesiveZone.internalField()[faceI] = 1.0;
87 forAll(cohesiveZone.boundaryField(), patchI)
89 // cracks may go along proc boundaries
90 if(mesh.boundaryMesh()[patchI].type() == processorPolyPatch::typeName)
92 forAll(cohesiveZone.boundaryField()[patchI], faceI)
94 bool faceInsideBox = false;
96 forAll(userBoxes, boxi)
98 if(userBoxes[boxi].contains(Cf.boundaryField()[patchI][faceI])) faceInsideBox = true;
103 cohesiveZone.boundaryField()[patchI][faceI] = 1.0;
109 Info << "\nThere are " << gSum(cohesiveZone.internalField()) << " potential internal crack faces" << nl << endl;
110 Info << "\nThere are " << gSum(cohesiveZone.boundaryField())/2 << " potential coupled boundary crack faces" << nl << endl;
112 // write field for visualisation
113 volScalarField cohesiveZoneVol
124 dimensionedScalar("zero", dimless, 0.0)
126 forAll(cohesiveZone.internalField(), facei)
128 if(cohesiveZone.internalField()[facei])
130 cohesiveZoneVol.internalField()[mesh.owner()[facei]] = 1.0;
131 cohesiveZoneVol.internalField()[mesh.neighbour()[facei]] = 1.0;
134 forAll(cohesiveZone.boundaryField(), patchi)
136 forAll(cohesiveZone.boundaryField()[patchi], facei)
138 if(cohesiveZone.boundaryField()[patchi][facei] > 0.0)
140 cohesiveZoneVol.boundaryField()[patchi][facei] = 1.0;
144 Info << "Writing cohesiveZone field" << endl;
145 cohesiveZoneVol.write();
149 Switch initialiseSolution(false);
153 mesh.solutionDict().subDict("solidMechanics")
154 .found("initialiseSolution")
160 mesh.solutionDict().subDict("solidMechanics").lookup
168 Switch breakOnlyOneFacePerTopologyChange(true);
172 mesh.solutionDict().subDict("solidMechanics")
173 .found("breakOnlyOneFacePerTopologyChange")
176 breakOnlyOneFacePerTopologyChange =
179 mesh.solutionDict().subDict("solidMechanics").lookup
181 "breakOnlyOneFacePerTopologyChange"
187 Switch crackPropagationFromSpecifiedPatches
189 mesh.solutionDict().subDict("solidMechanics").lookup
191 "crackPropagationFromSpecifiedPatches"
195 wordList crackPropagationPatchNames
197 mesh.solutionDict().subDict("solidMechanics").lookup
199 "crackPropagationPatches"
203 labelList crackPropagationPatches(crackPropagationPatchNames.size(), -1);
205 forAll(crackPropagationPatchNames, patchI)
207 crackPropagationPatches[patchI] =
208 mesh.boundaryMesh().findPatchID
210 crackPropagationPatchNames[patchI]
213 if(crackPropagationPatches[patchI] == -1)
215 FatalErrorIn(args.executable())
216 << "Can't find " << crackPropagationPatchNames[patchI]
217 << " patch" << abort(FatalError);
221 // Internal faces next to selected crack propagation patches
222 labelList crackPropagationPatchesInternalFaces;
224 # include "updateCrackPropagationPatchesInternalFaces.H"