1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation, either version 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
25 elasticIncrAcpSolidFoam
28 Incremental form of elasticAcpSolidFoam
29 arbitrary crack propagation solver
32 Zeljko Tukovic, FSB Zagreb
36 \*---------------------------------------------------------------------------*/
39 #include "constitutiveModel.H"
40 //#include "componentReferenceList.H"
41 #include "crackerFvMesh.H"
42 #include "processorPolyPatch.H"
43 #include "SortableList.H"
44 #include "solidInterface.H"
45 #include "solidCohesiveFvPatchVectorField.H"
46 #include "solidCohesiveFixedModeMixFvPatchVectorField.H"
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 int main(int argc, char *argv[])
52 # include "setRootCase.H"
53 # include "createTime.H"
54 # include "createCrackerMesh.H"
55 # include "createFields.H"
56 # include "createCrack.H"
57 //# include "createReference.H"
58 # include "createHistory.H"
59 # include "readDivDSigmaExpMethod.H"
60 # include "createSolidInterfaceIncrNoModify.H"
62 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
64 Info<< "\nStarting time loop\n" << endl;
68 scalar maxEffTractionFraction = 0;
72 # include "readSolidMechanicsControls.H"
73 # include "setDeltaT.H"
77 Info<< "\nTime = " << runTime.timeName() << " s\n" << endl;
79 volScalarField rho = rheology.rho();
80 volScalarField mu = rheology.mu();
81 volScalarField lambda = rheology.lambda();
82 surfaceScalarField muf = fvc::interpolate(mu);
83 surfaceScalarField lambdaf = fvc::interpolate(lambda);
85 solidInterfacePtr->modifyProperties(muf, lambdaf);
86 //# include "waveCourantNo.H"
89 lduMatrix::solverPerformance solverPerf;
90 scalar initialResidual = 0;
91 scalar relativeResidual = 1;
92 //scalar forceResidual = 1;
93 label nFacesToBreak = 0;
94 label nCoupledFacesToBreak = 0;
95 bool topoChange = false;
97 // DU from the previous timestep is usually a good guess
98 // for the next timestep, but it can cause faces to prematurely
100 // so I will reduce DU here to stop this happening
108 surfaceVectorField n = mesh.Sf()/mesh.magSf();
113 # include "calculateDivDSigmaExp.H"
119 fvm::laplacian(2*muf + lambdaf, DU, "laplacian(DDU,DU)")
123 //# include "setReference.H"
125 if(solidInterfacePtr)
127 solidInterfacePtr->correct(DUEqn);
132 solverPerf = DUEqn.solve();
136 # include "aitkenRelaxation.H"
145 initialResidual = solverPerf.initialResidual();
146 aitkenInitialRes = gMax(mag(DU.internalField()));
149 //gradDU = solidInterfacePtr->grad(DU);
150 // use leastSquaresSolidInterface grad scheme
151 gradDU = fvc::grad(DU);
153 # include "calculateRelativeResidual.H"
155 if (iCorr % infoFrequency == 0)
157 Info<< "\tTime " << runTime.value()
158 << ", Corr " << iCorr
159 << ", Solving for " << DU.name()
160 << " using " << solverPerf.solverName()
161 << ", res = " << solverPerf.initialResidual()
162 << ", rel res = " << relativeResidual;
165 Info << ", aitken = " << aitkenTheta;
167 Info << ", inner iters " << solverPerf.nIterations() << endl;
176 //solverPerf.initialResidual() > convergenceTolerance
177 relativeResidual > convergenceTolerance
183 Info<< "Solving for " << DU.name() << " using "
184 << solverPerf.solverName()
185 << ", Initial residual = " << initialResidual
186 << ", Final residual = " << solverPerf.initialResidual()
187 << ", No outer iterations " << iCorr
188 << ", Relative residual " << relativeResidual << endl;
190 # include "calculateTraction.H"
191 # include "updateCrack.H"
193 Info<< "Max effective traction fraction: "
194 << maxEffTractionFraction << endl;
196 // reset counter if faces want to crack
197 if ((nFacesToBreak > 0) || (nCoupledFacesToBreak > 0)) iCorr = 0;
199 while( (nFacesToBreak > 0) || (nCoupledFacesToBreak > 0));
201 if (cohesivePatchDUPtr)
203 if (returnReduce(cohesivePatchDUPtr->size(), sumOp<label>()))
205 cohesivePatchDUPtr->cracking();
214 cohesivePatchDUFixedModePtr->size(),
219 Pout << "Number of faces in crack: "
220 << cohesivePatchDUFixedModePtr->size() << endl;
221 cohesivePatchDUFixedModePtr->relativeSeparationDistance();
225 # include "calculateDEpsilonDSigma.H"
227 // update total quantities
232 # include "writeFields.H"
233 # include "writeHistory.H"
235 Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
236 << " ClockTime = " << runTime.elapsedClockTime() << " s\n\n"
240 Info<< "End\n" << endl;
246 // ************************************************************************* //