Fixed URL for libccmio-2.6.1 (bug report #5 by Thomas Oliveira)
[foam-extend-3.2.git] / applications / solvers / solidMechanics / elasticNonLinULSolidFoam / elasticNonLinULSolidFoam.C
blob4852c9a3ec58d011ef158964a372a3cb4e1b78d9
1 /*---------------------------------------------------------------------------*\
2   =========                 |
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 -------------------------------------------------------------------------------
8 License
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/>.
24 Application
25     elasticNonLinULSolidFoam
27 Description
28     Finite volume structural solver employing a incremental strain updated
29     Lagrangian approach.
31     Valid for small strains, finite displacements and finite rotations.
33 Author
34     Philip Cardiff UCD
36 \*---------------------------------------------------------------------------*/
38 #include "fvCFD.H"
39 #include "constitutiveModel.H"
40 #include "solidInterface.H"
41 #include "volPointInterpolation.H"
42 #include "pointPatchInterpolation.H"
43 #include "primitivePatchInterpolation.H"
44 #include "pointFields.H"
45 #include "twoDPointCorrector.H"
46 #include "leastSquaresVolPointInterpolation.H"
47 #include "processorFvPatchFields.H"
48 #include "transformGeometricField.H"
49 #include "symmetryPolyPatch.H"
51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
53 int main(int argc, char *argv[])
55 #   include "setRootCase.H"
56 #   include "createTime.H"
57 #   include "createMesh.H"
58 #   include "createFields.H"
59 #   include "readDivDSigmaExpMethod.H"
60 #   include "readDivDSigmaLargeStrainExpMethod.H"
61 #   include "readMoveMeshMethod.H"
62 #   include "createSolidInterfaceNonLin.H"
63 #   include "findGlobalFaceZones.H"
65 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
67     Info<< "\nStarting time loop\n" << endl;
69     while(runTime.loop())
70     {
71         Info<< "Time = " << runTime.timeName() << nl << endl;
73 #       include "readSolidMechanicsControls.H"
75         int iCorr = 0;
76         lduMatrix::solverPerformance solverPerf;
77         scalar initialResidual = 1.0;
78         scalar relativeResidual = 1.0;
79         lduMatrix::debug = 0;
81         do
82         {
83             DU.storePrevIter();
85 #           include "calculateDivDSigmaExp.H"
86 #           include "calculateDivDSigmaLargeStrainExp.H"
88             //- Updated lagrangian momentum equation
89             fvVectorMatrix DUEqn
90             (
91                 fvm::d2dt2(rho,DU)
92              ==
93                 fvm::laplacian(2*muf + lambdaf, DU, "laplacian(DDU,DU)")
94               + divDSigmaExp
95               + divDSigmaLargeStrainExp
96             );
98             if (solidInterfaceCorr)
99             {
100                 solidInterfacePtr->correct(DUEqn);
101             }
103             solverPerf = DUEqn.solve();
105             if (iCorr == 0)
106             {
107                 initialResidual = solverPerf.initialResidual();
108             }
110             DU.relax();
112             gradDU = fvc::grad(DU);
114 #           include "calculateDEpsilonDSigma.H"
115 #           include "calculateRelativeResidual.H"
117             Info<< "\tTime " << runTime.value()
118                 << ", Corrector " << iCorr
119                 << ", Solving for " << DU.name()
120                 << " using " << solverPerf.solverName()
121                 << ", res = " << solverPerf.initialResidual()
122                 << ", rel res = " << relativeResidual
123                 << ", inner iters " << solverPerf.nIterations() << endl;
124         }
125         while
126         (
127             //solverPerf.initialResidual() > convergenceTolerance
128             relativeResidual > convergenceTolerance
129          && ++iCorr < nCorr
130         );
132       Info << nl << "Time " << runTime.value() << ", Solving for " << DU.name()
133            << ", Initial residual = " << initialResidual
134            << ", Final residual = " << solverPerf.initialResidual()
135            << ", No outer iterations " << iCorr << endl;
137 #       include "moveMesh.H"
138 #       include "rotateFields.H"
139 #       include "writeFields.H"
141         Info<< nl << "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
142             << "  ClockTime = " << runTime.elapsedClockTime() << " s"
143             << endl;
144     }
146     Info<< "End\n" << endl;
148     return(0);
152 // ************************************************************************* //