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
48 // cohesiveZone is an index field
49 // which allows the user to limit the crack to certain areas at runtime
50 // 1 for faces within cohesiveZone
51 // 0 for faces outside cohesiveZone
52 surfaceScalarField cohesiveZone
59 IOobject::READ_IF_PRESENT,
63 dimensionedScalar("zero", dimless, 0.0)
66 // limit crack to specified boxes
68 const dictionary& stressControl =
69 mesh.solutionDict().subDict("solidMechanics");
71 List<boundBox> userBoxes(stressControl.lookup("crackLimitingBoxes"));
72 const surfaceVectorField& Cf = mesh.Cf();
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;
88 forAll(cohesiveZone.boundaryField(), patchI)
90 // cracks may go along proc boundaries
91 if(mesh.boundaryMesh()[patchI].type() == processorPolyPatch::typeName)
93 forAll(cohesiveZone.boundaryField()[patchI], faceI)
95 bool faceInsideBox = false;
97 forAll(userBoxes, boxi)
99 if(userBoxes[boxi].contains(Cf.boundaryField()[patchI][faceI])) faceInsideBox = true;
104 cohesiveZone.boundaryField()[patchI][faceI] = 1.0;
110 Info << "\nThere are " << gSum(cohesiveZone.internalField()) << " potential internal crack faces" << nl << endl;
111 Info << "\nThere are " << gSum(cohesiveZone.boundaryField())/2 << " potential coupled boundary crack faces" << nl << endl;
113 // write field for visualisation
114 volScalarField cohesiveZoneVol
125 dimensionedScalar("zero", dimless, 0.0)
127 forAll(cohesiveZone.internalField(), facei)
129 if(cohesiveZone.internalField()[facei])
131 cohesiveZoneVol.internalField()[mesh.owner()[facei]] = 1.0;
132 cohesiveZoneVol.internalField()[mesh.neighbour()[facei]] = 1.0;
135 forAll(cohesiveZone.boundaryField(), patchi)
137 forAll(cohesiveZone.boundaryField()[patchi], facei)
139 if(cohesiveZone.boundaryField()[patchi][facei] > 0.0)
141 cohesiveZoneVol.boundaryField()[patchi][facei] = 1.0;
145 Info << "Writing cohesiveZone field" << endl;
146 cohesiveZoneVol.write();
150 Switch initialiseSolution(false);
154 mesh.solutionDict().subDict("solidMechanics")
155 .found("initialiseSolution")
161 mesh.solutionDict().subDict("solidMechanics").lookup
169 Switch breakOnlyOneFacePerTopologyChange(true);
173 mesh.solutionDict().subDict("solidMechanics")
174 .found("breakOnlyOneFacePerTopologyChange")
177 breakOnlyOneFacePerTopologyChange =
180 mesh.solutionDict().subDict("solidMechanics").lookup
182 "breakOnlyOneFacePerTopologyChange"
188 Switch crackPropagationFromSpecifiedPatches
190 mesh.solutionDict().subDict("solidMechanics").lookup
192 "crackPropagationFromSpecifiedPatches"
196 wordList crackPropagationPatchNames
198 mesh.solutionDict().subDict("solidMechanics").lookup
200 "crackPropagationPatches"
204 labelList crackPropagationPatches(crackPropagationPatchNames.size(), -1);
206 forAll(crackPropagationPatchNames, patchI)
208 crackPropagationPatches[patchI] =
209 mesh.boundaryMesh().findPatchID
211 crackPropagationPatchNames[patchI]
214 if(crackPropagationPatches[patchI] == -1)
216 FatalErrorIn(args.executable())
217 << "Can't find " << crackPropagationPatchNames[patchI]
218 << " patch" << abort(FatalError);
222 // Internal faces next to selected crack propagation patches
223 labelList crackPropagationPatchesInternalFaces;
225 # include "updateCrackPropagationPatchesInternalFaces.H"