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 elasticThermalSolidFoam
28 Transient/steady-state segregated finite-volume solver for small strain
29 elastic thermal solid bodies. Temperature is solved and then coupled
30 displacement is solved.
32 Displacement field U is solved for using a total Lagrangian approach,
33 also generating the strain tensor field epsilon and stress tensor
34 field sigma and temperature field T.
39 \*---------------------------------------------------------------------------*/
42 #include "constitutiveModel.H"
43 #include "thermalModel.H"
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 int main(int argc, char *argv[])
49 # include "setRootCase.H"
50 # include "createTime.H"
51 # include "createMesh.H"
52 # include "createFields.H"
53 # include "readDivSigmaExpMethod.H"
55 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
57 Info<< "\nStarting time loop\n" << endl;
61 Info<< "Time = " << runTime.timeName() << nl << endl;
63 # include "readSolidMechanicsControls.H"
66 scalar initialResidual = 1.0;
69 lduMatrix::solverPerformance solverPerfU;
70 lduMatrix::solverPerformance solverPerfT;
73 // solve energy equation for temperature
74 // the loop is for non-orthogonal corrections
75 Info<< "Solving for " << T.name() << nl;
82 rhoC*fvm::ddt(T) == fvm::laplacian(k, T, "laplacian(k,T)")
85 solverPerfT = TEqn.solve();
89 # include "calculateRelResT.H"
91 if (iCorr % infoFrequency == 0)
93 Info<< "\tCorrector " << iCorr
94 << ", residual = " << solverPerfT.initialResidual()
95 << ", relative res = " << relResT
96 << ", inner iters = " << solverPerfT.nIterations() << endl;
101 relResT > convergenceToleranceT
105 Info<< "Solved for " << T.name()
106 << " using " << solverPerfT.solverName()
107 << " in " << iCorr << " iterations"
108 << ", residual = " << solverPerfT.initialResidual()
109 << ", relative res = " << relResT << nl
110 << "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
111 << ", ClockTime = " << runTime.elapsedClockTime() << " s"
114 // Solve momentum equation for displacement
116 volVectorField gradThreeKalphaDeltaT =
117 fvc::grad(threeKalpha*(T-T0), "grad(threeKalphaDeltaT)");
118 surfaceVectorField threeKalphaDeltaTf =
119 mesh.Sf()*threeKalphaf*fvc::interpolate(T-T0, "deltaT");
121 Info<< "Solving for " << U.name() << nl;
126 # include "calculateDivSigmaExp.H"
128 // Linear momentum equaiton
133 fvm::laplacian(2*muf + lambdaf, U, "laplacian(DU,U)")
137 solverPerfU = UEqn.solve();
141 # include "aitkenRelaxation.H"
148 gradU = fvc::grad(U);
150 # include "calculateRelResU.H"
154 initialResidual = solverPerfU.initialResidual();
157 if (iCorr % infoFrequency == 0)
159 Info<< "\tCorrector " << iCorr
160 << ", residual = " << solverPerfU.initialResidual()
161 << ", relative res = " << relResU;
165 Info << ", aitken = " << aitkenTheta;
167 Info<< ", inner iters = " << solverPerfU.nIterations() << endl;
174 relResU > convergenceToleranceU
179 Info<< "Solved for " << U.name()
180 << " using " << solverPerfU.solverName()
181 << " in " << iCorr << " iterations"
182 << ", initial res = " << initialResidual
183 << ", final res = " << solverPerfU.initialResidual()
184 << ", final rel res = " << relResU << nl
185 << "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
186 << ", ClockTime = " << runTime.elapsedClockTime() << " s"
189 # include "calculateEpsilonSigma.H"
190 # include "writeFields.H"
192 Info<< "ExecutionTime = "
193 << runTime.elapsedCpuTime()
197 Info<< "End\n" << endl;
203 // ************************************************************************* //