1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
5 \\ / A nd | 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 elasticPlasticNonLinTLSolidFoam
28 Finite volume structural solver employing an incremental strain total
29 Lagrangian approach, with Mises plasticity.
31 Valid for finite strains, finite displacements and finite rotations.
35 Aitken relaxation by T. Tang DTU
37 \*---------------------------------------------------------------------------*/
40 #include "constitutiveModel.H"
41 #include "solidContactFvPatchVectorField.H"
43 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
45 int main(int argc, char *argv[])
47 # include "setRootCase.H"
48 # include "createTime.H"
49 # include "createMesh.H"
50 # include "createFields.H"
51 # include "createHistory.H"
52 # include "readDivDSigmaExpMethod.H"
53 # include "readDivDSigmaNonLinExpMethod.H"
55 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
57 Info<< "\nStarting time loop\n" << endl;
61 Info<< "Time: " << runTime.timeName() << nl << endl;
63 # include "readSolidMechanicsControls.H"
66 scalar initialResidual = 0;
67 lduMatrix::solverPerformance solverPerf;
68 scalar relativeResidual = GREAT;
75 # include "calculateDivDSigmaExp.H"
76 # include "calculateDivDSigmaNonLinExp.H"
78 // Incremental form of the
79 // linear momentum conservation
80 // ensuring conservation of total momentum
85 fvm::laplacian(2*muf + lambdaf, DU, "laplacian(DDU,DU)")
88 //- fvc::div(2*mu*DEpsilonP, "div(sigma)")
91 2*muf*(mesh.Sf() & fvc::interpolate(DEpsilonP))
95 if (largeStrainOverRelax)
97 // the terms (gradDU & gradU.T()) and (gradU & gradDU.T())
98 // are linearly dependent of DU and represent initial
99 // displacement effect
100 // which can cause convergence difficulties when treated
102 // so we implicitly over-relax with gradU & gradDU here
103 // which tends to help convergence
104 // this should improve convergence when gradU is large
105 // but maybe not execution time
109 (2*mu + lambda)*gradU, DU, "laplacian(DDU,DU)"
111 - fvc::div((2*mu + lambda)*(gradU & gradDU), "div(sigma)");
114 if (nonLinearSemiImplicit)
117 // we can treat the nonlinear term (gradDU & gradDU.T()) in a
118 // semi-implicit over-relaxed manner
119 // this should improve convergence when gradDU is large
120 // but maybe not execution time
124 (2*mu + lambda)*gradDU, DU, "laplacian(DDU,DU)"
126 - fvc::div((2*mu + lambda)*(gradDU & gradDU), "div(sigma)");
129 solverPerf = DUEqn.solve();
133 initialResidual = solverPerf.initialResidual();
138 # include "aitkenRelaxation.H"
145 gradDU = fvc::grad(DU);
147 // correct plasticty term
150 # include "calculateDEpsilonDSigma.H"
151 # include "calculateRelativeResidual.H"
153 if (iCorr % infoFrequency == 0)
155 Info<< "\tTime " << runTime.value()
156 << ", Corrector " << iCorr
157 << ", Solving for " << DU.name()
158 << " using " << solverPerf.solverName()
159 << ", res = " << solverPerf.initialResidual()
160 << ", rel res = " << relativeResidual;
164 Info << ", aitken = " << aitkenTheta;
166 Info << ", iters = " << solverPerf.nIterations() << endl;
174 //solverPerf.initialResidual() > convergenceTolerance
175 relativeResidual > convergenceTolerance
180 Info<< nl << "Time " << runTime.value() << ", Solving for " << DU.name()
181 << ", Initial residual = " << initialResidual
182 << ", Final residual = " << solverPerf.initialResidual()
183 << ", Relative residual = " << relativeResidual
184 << ", No outer iterations " << iCorr
185 << nl << "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
186 << " ClockTime = " << runTime.elapsedClockTime() << " s"
189 // Update total quantities
193 epsilonP += rheology.DEpsilonP();
195 rheology.updateYieldStress();
196 rho = rho/det(I+gradU);
198 # include "writeFields.H"
199 # include "writeHistory.H"
201 Info<< "ExecutionTime = "
202 << runTime.elapsedCpuTime()
206 Info<< "End\n" << endl;
212 // ************************************************************************* //