Fixed URL for libccmio-2.6.1 (bug report #5 by Thomas Oliveira)
[foam-extend-3.2.git] / applications / solvers / solidMechanics / elasticOrthoSolidFoam / elasticOrthoSolidFoam.C
bloba1443ed357921d4d2b74d12681a9c1a06b35347c
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     elasticOrthoSolidFoam
27 Description
28     Transient/steady-state segregated finite-volume solver for small strain
29     elastic orthotropic solid bodies allowing for general principal material
30     directions.
32     Please cite:
33     Cardiff P, Karac A & Ivankovic A, A Large Strain Finite Volume Method for
34     Orthotropic Bodies with General Material Orientations, Computer Methods
35     in Applied Mechanics & Engineering, 2013,
36     http://dx.doi.org/10.1016/j.cma.2013.09.008
38 Author
39     Philip Cardiff UCD
41 \*---------------------------------------------------------------------------*/
43 #include "fvCFD.H"
44 #include "constitutiveModel.H"
45 #include "solidInterface.H"
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 int main(int argc, char *argv[])
51 #   include "setRootCase.H"
52 #   include "createTime.H"
53 #   include "createMesh.H"
54 #   include "createFields.H"
55 #   include "createHistory.H"
56 #   include "readDivSigmaExpMethod.H"
57 #   include "createSolidInterfaceOrthotropic.H"
59 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
61     Info<< "\nStarting time loop\n" << endl;
63     while(runTime.loop())
64     {
65         Info<< "Time = " << runTime.timeName() << nl << endl;
67 #       include "readSolidMechanicsControls.H"
69         int iCorr = 0;
70         lduMatrix::solverPerformance solverPerf;
71         scalar initialResidual = 1.0;
72         scalar relativeResidual = 1.0;
73         lduMatrix::debug = 0;
75         do
76         {
77             U.storePrevIter();
79 #           include "calculateDivSigmaExp.H"
81             //- Linear momentum equation
82             fvVectorMatrix UEqn
83             (
84                 rho*fvm::d2dt2(U)
85              ==
86                 fvm::laplacian(Kf, U, "laplacian(K,U)")
87               + divSigmaExp
88             );
90             if (solidInterfaceCorr)
91             {
92                 solidInterfacePtr->correct(UEqn);
93             }
95             solverPerf = UEqn.solve();
97             if (iCorr == 0)
98             {
99                 initialResidual = solverPerf.initialResidual();
100             }
102             U.relax();
104             gradU = fvc::grad(U); // use leastSquaresSolidInterface
106             //#         include "setPlaneStressGradU.H"
108 #           include "calculateRelativeResidual.H"
110             if (iCorr % infoFrequency == 0)
111             {
112                 Info<< "\tTime " << runTime.value()
113                     << ", Corr " << iCorr
114                     << ", Solving for " << U.name()
115                     << " using " << solverPerf.solverName()
116                     << ", res = " << solverPerf.initialResidual()
117                     << ", rel res = " << relativeResidual
118                     << ", inner iters " << solverPerf.nIterations() << endl;
119             }
120         }
121         while
122         (
123             solverPerf.initialResidual() > convergenceTolerance
124          && ++iCorr < nCorr
125         );
127         Info<< nl << "Time " << runTime.value() << ", Solving for " << U.name()
128             << ", Initial residual = " << initialResidual
129             << ", Final residual = " << solverPerf.initialResidual()
130             << ", No outer iterations " << iCorr
131             << nl << "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
132             << "  ClockTime = " << runTime.elapsedClockTime() << " s"
133             << endl;
135 #       include "calculateEpsilonSigma.H"
136 #       include "writeFields.H"
137 #       include "writeHistory.H"
139         Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
140             << "  ClockTime = " << runTime.elapsedClockTime() << " s\n\n"
141             << endl;
142     }
144     Info<< "End\n" << endl;
146     return(0);
150 // ************************************************************************* //