Initial commit for version 2.0.x patch release
[OpenFOAM-2.0.x.git] / applications / solvers / combustion / dieselFoam / dieselFoam.C
blob7fd74102476c6aab20528e167dfc4ec0b152d2db
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2004-2011 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
9     This file is part of OpenFOAM.
11     OpenFOAM is free software: you can redistribute it and/or modify it
12     under the terms of the GNU General Public License as published by
13     the Free Software Foundation, either version 3 of the License, or
14     (at your option) any later version.
16     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
19     for more details.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM.  If not, see <http://www.gnu.org/licenses/>.
24 Application
25     dieselFoam
27 Description
28     Solver for diesel spray and combustion.
30 \*---------------------------------------------------------------------------*/
32 #include "fvCFD.H"
33 #include "hCombustionThermo.H"
34 #include "turbulenceModel.H"
35 #include "spray.H"
36 #include "psiChemistryModel.H"
37 #include "chemistrySolver.H"
39 #include "multivariateScheme.H"
40 #include "IFstream.H"
41 #include "OFstream.H"
42 #include "Switch.H"
43 #include "mathematicalConstants.H"
44 #include "pimpleControl.H"
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 int main(int argc, char *argv[])
50     #include "setRootCase.H"
51     #include "createTime.H"
52     #include "createMesh.H"
53     #include "createFields.H"
54     #include "readGravitationalAcceleration.H"
55     #include "readCombustionProperties.H"
56     #include "createSpray.H"
57     #include "initContinuityErrs.H"
58     #include "readTimeControls.H"
59     #include "compressibleCourantNo.H"
60     #include "setInitialDeltaT.H"
62     pimpleControl pimple(mesh);
64     // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
66     Info<< "\nStarting time loop\n" << endl;
68     while (runTime.run())
69     {
70         #include "compressibleCourantNo.H"
71         #include "setDeltaT.H"
73         runTime++;
74         Info<< "Time = " << runTime.timeName() << nl << endl;
76         Info<< "Evolving Spray" << endl;
78         dieselSpray.evolve();
80         Info<< "Solving chemistry" << endl;
82         chemistry.solve
83         (
84             runTime.value() - runTime.deltaTValue(),
85             runTime.deltaTValue()
86         );
88         // turbulent time scale
89         {
90             volScalarField tk
91             (
92                 Cmix*sqrt(turbulence->muEff()/rho/turbulence->epsilon())
93             );
94             volScalarField tc(chemistry.tc());
96             // Chalmers PaSR model
97             kappa = (runTime.deltaT() + tc)/(runTime.deltaT()+tc+tk);
98         }
100         chemistrySh = kappa*chemistry.Sh()();
102         #include "rhoEqn.H"
104         // --- Pressure-velocity PIMPLE corrector loop
105         for (pimple.start(); pimple.loop(); pimple++)
106         {
107             #include "UEqn.H"
108             #include "YEqn.H"
109             #include "hsEqn.H"
111             // --- PISO loop
112             for (int corr=0; corr<pimple.nCorr(); corr++)
113             {
114                 #include "pEqn.H"
115             }
117             if (pimple.turbCorr())
118             {
119                 turbulence->correct();
120             }
121         }
123         #include "spraySummary.H"
125         rho = thermo.rho();
127         if (runTime.write())
128         {
129             chemistry.dQ()().write();
130         }
132         Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
133             << "  ClockTime = " << runTime.elapsedClockTime() << " s"
134             << nl << endl;
135     }
137     Info<< "End\n" << endl;
139     return 0;
143 // ************************************************************************* //