1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
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
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/>.
28 Solver for diesel engine spray and combustion.
30 \*---------------------------------------------------------------------------*/
33 #include "engineTime.H"
34 #include "engineMesh.H"
35 #include "hCombustionThermo.H"
36 #include "turbulenceModel.H"
38 #include "psiChemistryModel.H"
39 #include "chemistrySolver.H"
40 #include "multivariateScheme.H"
43 #include "volPointInterpolation.H"
44 #include "thermoPhysicsTypes.H"
45 #include "mathematicalConstants.H"
46 #include "pimpleControl.H"
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 int main(int argc, char *argv[])
52 #include "setRootCase.H"
53 #include "createEngineTime.H"
54 #include "createEngineMesh.H"
55 #include "createFields.H"
56 #include "readGravitationalAcceleration.H"
57 #include "readCombustionProperties.H"
58 #include "createSpray.H"
59 #include "initContinuityErrs.H"
60 #include "readEngineTimeControls.H"
61 #include "compressibleCourantNo.H"
62 #include "setInitialDeltaT.H"
63 #include "startSummary.H"
65 pimpleControl pimple(mesh);
67 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
69 Info<< "\nStarting time loop\n" << endl;
73 #include "readEngineTimeControls.H"
74 #include "compressibleCourantNo.H"
75 #include "setDeltaT.H"
79 Info<< "Crank angle = " << runTime.theta() << " CA-deg" << endl;
85 Info<< "Solving chemistry" << endl;
89 runTime.value() - runTime.deltaTValue(),
93 // turbulent time scale
97 Cmix*sqrt(turbulence->muEff()/rho/turbulence->epsilon())
99 volScalarField tc(chemistry.tc());
101 // Chalmers PaSR model
102 kappa = (runTime.deltaT() + tc)/(runTime.deltaT() + tc + tk);
105 chemistrySh = kappa*chemistry.Sh()();
110 for (pimple.start(); pimple.loop(); pimple++)
117 for (int corr=1; corr<=pimple.nCorr(); corr++)
122 if (pimple.turbCorr())
124 turbulence->correct();
128 #include "logSummary.H"
129 #include "spraySummary.H"
135 chemistry.dQ()().write();
138 Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
139 << " ClockTime = " << runTime.elapsedClockTime() << " s"
143 Info<< "End\n" << endl;
149 // ************************************************************************* //