Merge branch 'master' of ssh://git.code.sf.net/p/foam-extend/foam-extend-3.2
[foam-extend-3.2.git] / applications / solvers / compressible / dbnsTurbFoam / dbnsTurbFoam.C
blob28eec55798a9258fb331250d3e6985c9957f9050
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     dbnsTurbFoamHEqn
27 Description
28     Density-based compressible explicit time-marching flow solver
29     using enthalpy-based thermo packages
31 Author
32     Hrvoje Jasak
34 \*---------------------------------------------------------------------------*/
36 #include "fvCFD.H"
37 #include "basicPsiThermo.H"
38 #include "turbulenceModel.H"
39 #include "bound.H"
40 #include "hllcFlux.H"
41 #include "roeFlux.H"
42 #include "rusanovFlux.H"
43 #include "betaFlux.H"
44 #include "MDLimiter.H"
45 #include "firstOrderLimiter.H"
46 #include "BarthJespersenLimiter.H"
47 #include "VenkatakrishnanLimiter.H"
48 #include "numericFlux.H"
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52 int main(int argc, char *argv[])
54 #   include "setRootCase.H"
55 #   include "createTime.H"
56 #   include "createMesh.H"
57 #   include "createFields.H"
59 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
61     Info<< "\nStarting time loop\n" << endl;
63     // Runge-Kutta coefficient
64     scalarList beta(4);
65     beta[0] = 0.1100;
66     beta[1] = 0.2766;
67     beta[2] = 0.5000;
68     beta[3] = 1.0000;
70     while (runTime.run())
71     {
72 #       include "readTimeControls.H"
73 #       include "readFieldBounds.H"
74 #       include "compressibleCourantNo.H"
75 #       include "setDeltaT.H"
77         runTime++;
79         Info<< "\n Time = " << runTime.value() << endl;
81         // Switch off solver messages for diagonal solver RK
82         lduMatrix::debug = 0;
84         // Low storage Runge-Kutta time integration
85         forAll (beta, i)
86         {
87             // Solve the approximate Riemann problem for this time step
88             dbnsFlux.computeFlux();
90             // Time integration
91             solve
92             (
93                 1.0/beta[i]*fvm::ddt(rho)
94               + fvc::div(dbnsFlux.rhoFlux())
95             );
97             solve
98             (
99                 1.0/beta[i]*fvm::ddt(rhoU)
100               + fvc::div(dbnsFlux.rhoUFlux())
101               + fvc::div(turbulence->devRhoReff())
102             );
104             solve
105             (
106                 1.0/beta[i]*fvm::ddt(rhoE)
107               + fvc::div(dbnsFlux.rhoEFlux())
108               + fvc::div(turbulence->devRhoReff() & U)
109               - fvc::laplacian(turbulence->alphaEff(), h)
110             );
112 #           include "updateFields.H"
113         }
115         // Switch on solver messages for turbulence
116         lduMatrix::debug = 1;
118         turbulence->correct();
120         runTime.write();
122         Info<< "    ExecutionTime = "
123             << runTime.elapsedCpuTime()
124             << " s\n" << endl;
125     }
127     Info<< "\n end \n";
129     return(0);
133 // ************************************************************************* //