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 elasticPlasticSolidFoam
28 Transient/steady-state segregated finite-volume solver for small strain
29 elastic plastic solid bodies.
31 Displacement increment field DU is solved for using a total Lagrangian
32 approach, also generating the strain tensor field epsilon, the plastic
33 strain field epsilonP and stress tensor field sigma.
38 Aitken relaxation by T. Tang DTU
40 \*---------------------------------------------------------------------------*/
43 #include "constitutiveModel.H"
44 #include "solidContactFvPatchVectorField.H"
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 int main(int argc, char *argv[])
50 # include "setRootCase.H"
51 # include "createTime.H"
52 # include "createMesh.H"
53 # include "createFields.H"
54 # include "createHistory.H"
55 # include "readDivDSigmaExpMethod.H"
57 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
59 Info<< "\nStarting time loop\n" << endl;
63 Info<< "Time = " << runTime.timeName() << nl << endl;
65 # include "readSolidMechanicsControls.H"
68 lduMatrix::solverPerformance solverPerf;
69 scalar initialResidual = 1.0;
70 scalar relativeResidual = 1.0;
71 scalar plasticResidual = 1.0;
78 # include "calculateDivDSigmaExp.H"
84 fvm::laplacian(2*muf + lambdaf, DU, "laplacian(DDU,DU)")
86 - fvc::div(2*muf*(mesh.Sf() & fvc::interpolate(DEpsilonP)))
89 solverPerf = DUEqn.solve();
93 initialResidual = solverPerf.initialResidual();
98 # include "aitkenRelaxation.H"
105 gradDU = fvc::grad(DU);
107 # include "calculateRelativeResidual.H"
108 # include "calculateDEpsilonDSigma.H"
110 // correct plastic strain increment
113 # include "calculatePlasticResidual.H"
115 if (iCorr % infoFrequency == 0)
117 Info<< "\tTime " << runTime.value()
118 << ", Corr " << iCorr
119 //<< ", Solving for " << DU.name()
120 // << " using " << solverPerf.solverName()
121 << ", res = " << solverPerf.initialResidual()
122 << ", rel res = " << relativeResidual
123 << ", plastic res = " << plasticResidual;
126 Info<< ", aitken = " << aitkenTheta;
128 Info<< ", inner iters = " << solverPerf.nIterations() << endl;
136 //solverPerf.initialResidual() > convergenceTolerance
137 relativeResidual > convergenceTolerance
142 Info<< nl << "Time " << runTime.value() << ", Solving for " << DU.name()
143 << ", Initial residual = " << initialResidual
144 << ", Final residual = " << solverPerf.initialResidual()
145 << ", Final rel residual = " << relativeResidual
146 << ", No outer iterations " << iCorr << endl;
148 // Update total quantities
151 epsilonP += rheology.DEpsilonP();
154 // Update yields stresses
155 rheology.updateYieldStress();
157 # include "writeFields.H"
158 # include "writeHistory.H"
160 Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
161 << " ClockTime = " << runTime.elapsedClockTime() << " s"
165 Info<< "End\n" << endl;
171 // ************************************************************************* //