Removed unnecessary return statement
[foam-extend-3.2.git] / applications / solvers / compressible / sonicDyMFoam / sonicDyMFoam.C
blob4fb6e2572753cc97a9c8473d0029df7f4e12270c
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     sonicDyMFoam
27 Description
28     Transient solver for trans-sonic/supersonic for laminar or turbulent
29     flow of a compressible gas with support for mesh motion and
30     topological changes
32     Uses the flexible PIMPLE (PISO-SIMPLE) solution for time-resolved and
33     pseudo-transient simulations.
35     Turbulence modelling is generic, i.e. laminar, RAS or LES may be selected.
37     Updated from sonicFoamAutoMotion by Hrvoje Jasak
39 Author
40     Hrvoje Jasak, Wikki Ltd.  All rights reserved.
42 \*---------------------------------------------------------------------------*/
44 #include "fvCFD.H"
45 #include "dynamicFvMesh.H"
46 #include "specie.H"
47 #include "basicPsiThermo.H"
48 #include "turbulenceModel.H"
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52 int main(int argc, char *argv[])
54 #   include "setRootCase.H"
56 #   include "createTime.H"
57 #   include "createDynamicFvMesh.H"
58 #   include "createFields.H"
59 #   include "initContinuityErrs.H"
61 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
63     Info<< "\nStarting time loop\n" << endl;
65     while (runTime.run())
66     {
67 #       include "readControls.H"
68 #       include "readFieldBounds.H"
69 #       include "compressibleCourantNo.H"
70 #       include "setDeltaT.H"
72         runTime++;
74         Info<< "Time = " << runTime.timeName() << nl << endl;
76         bool meshChanged = mesh.update();
78 #       include "volContinuity.H"
80         if (checkMeshCourantNo)
81         {
82 #           include "meshCourantNo.H"
83         }
85         // Mesh motion update
86         if (meshChanged)
87         {
88             T = max(T, TMin);
89             p = max(p, pMin);
90             e = max(e, thermo.Cv()*TMin);
92             thermo.correct();
93             rho = thermo.rho();
95             if (correctPhi)
96             {
97 // #           include "correctPhi.H"
98             }
99         }
101         if (meshChanged)
102         {
103 #           include "compressibleCourantNo.H"
104         }
106         // --- PIMPLE loop
107         label oCorr = 0;
108         do
109         {
110             // Under-relax pDivU term
111             pDivU.storePrevIter();
113             pDivU =
114                 p*fvc::div
115                 (
116                     phi/fvc::interpolate(rho)
117                   + fvc::meshPhi(rho, U)
118                 );
120             pDivU.relax();
122 #           include "rhoEqn.H"
123 #           include "eEqn.H"
124 #           include "UEqn.H"
126             // --- PISO loop
127             for (int corr = 0; corr < nCorr; corr++)
128             {
129 #               include "pEqn.H"
130             }
132             // Recalculate density
133             rho = thermo.rho();
135             turbulence->correct();
136         } while (++oCorr < nOuterCorr);
138         runTime.write();
140         Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
141             << "  ClockTime = " << runTime.elapsedClockTime() << " s"
142             << nl << endl;
143     }
145     Info<< "End\n" << endl;
147     return(0);
151 // ************************************************************************* //