1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2004-2007 Hrvoje Jasak
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM 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 2 of the License, or (at your
14 option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM; if not, write to the Free Software Foundation,
23 Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 elasticPlasticNonLinTLSolidFoam
29 Finite volume structural solver employing an incremental strain total
30 Lagrangian approach, with Mises plasticity.
32 Valid for finite strains, finite displacements and finite rotations.
36 Aitken relaxation by T. Tang DTU
38 \*---------------------------------------------------------------------------*/
41 #include "constitutiveModel.H"
42 #include "solidContactFvPatchVectorField.H"
44 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 int main(int argc, char *argv[])
48 # include "setRootCase.H"
49 # include "createTime.H"
50 # include "createMesh.H"
51 # include "createFields.H"
52 # include "createHistory.H"
53 # include "readDivDSigmaExpMethod.H"
54 # include "readDivDSigmaNonLinExpMethod.H"
56 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
58 Info<< "\nStarting time loop\n" << endl;
62 Info<< "Time: " << runTime.timeName() << nl << endl;
64 # include "readSolidMechanicsControls.H"
67 scalar initialResidual = 0;
68 lduMatrix::solverPerformance solverPerf;
69 scalar relativeResidual = GREAT;
76 # include "calculateDivDSigmaExp.H"
77 # include "calculateDivDSigmaNonLinExp.H"
79 // Incremental form of the
80 // linear momentum conservation
81 // ensuring conservation of total momentum
86 fvm::laplacian(2*muf + lambdaf, DU, "laplacian(DDU,DU)")
89 //- fvc::div(2*mu*DEpsilonP, "div(sigma)")
92 2*muf*( mesh.Sf() & fvc::interpolate(DEpsilonP))
96 if (largeStrainOverRelax)
98 // the terms (gradDU & gradU.T()) and (gradU & gradDU.T())
99 // are linearly dependent of DU and represent initial
100 // displacement effect
101 // which can cause convergence difficulties when treated
103 // so we implicitly over-relax with gradU & gradDU here
104 // which tends to help convergence
105 // this should improve convergence when gradU is large
106 // but maybe not execution time
110 (2*mu + lambda)*gradU, DU, "laplacian(DDU,DU)"
112 - fvc::div( (2*mu + lambda)*(gradU&gradDU), "div(sigma)");
115 if (nonLinearSemiImplicit)
118 // we can treat the nonlinear term (gradDU & gradDU.T()) in a
119 // semi-implicit over-relaxed manner
120 // this should improve convergence when gradDU is large
121 // but maybe not execution time
125 (2*mu + lambda)*gradDU, DU, "laplacian(DDU,DU)"
127 - fvc::div( (2*mu + lambda)*(gradDU&gradDU), "div(sigma)");
130 solverPerf = DUEqn.solve();
134 initialResidual = solverPerf.initialResidual();
139 # include "aitkenRelaxation.H"
146 gradDU = fvc::grad(DU);
148 // correct plasticty term
151 # include "calculateDEpsilonDSigma.H"
152 # include "calculateRelativeResidual.H"
154 if (iCorr % infoFrequency == 0)
156 Info << "\tTime " << runTime.value()
157 << ", Corrector " << iCorr
158 << ", Solving for " << DU.name()
159 << " using " << solverPerf.solverName()
160 << ", res = " << solverPerf.initialResidual()
161 << ", rel res = " << relativeResidual;
164 Info << ", aitken = " << aitkenTheta;
166 Info << ", iters = " << solverPerf.nIterations() << endl;
173 (//solverPerf.initialResidual() > convergenceTolerance
174 relativeResidual > convergenceTolerance
179 Info<< nl << "Time " << runTime.value() << ", Solving for " << DU.name()
180 << ", Initial residual = " << initialResidual
181 << ", Final residual = " << solverPerf.initialResidual()
182 << ", Relative residual = " << relativeResidual
183 << ", No outer iterations " << iCorr
184 << nl << "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
185 << " ClockTime = " << runTime.elapsedClockTime() << " s"
188 // Update total quantities
192 epsilonP += rheology.DEpsilonP();
194 rheology.updateYieldStress();
195 rho = rho/det(I+gradU);
197 # include "writeFields.H"
198 # include "writeHistory.H"
200 Info<< "ExecutionTime = "
201 << runTime.elapsedCpuTime()
205 Info<< "End\n" << endl;
211 // ************************************************************************* //