OpenFOAM logo
The Open Source CFD Toolbox
  Source Guide OpenCFD Solutions Contact OpenFOAM

dieselEngineFoam.C

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------------*\
00002   =========                 |
00003   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
00004    \\    /   O peration     |
00005     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
00006      \\/     M anipulation  |
00007 -------------------------------------------------------------------------------
00008 License
00009     This file is part of OpenFOAM.
00010 
00011     OpenFOAM is free software; you can redistribute it and/or modify it
00012     under the terms of the GNU General Public License as published by the
00013     Free Software Foundation; either version 2 of the License, or (at your
00014     option) any later version.
00015 
00016     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
00017     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00018     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00019     for more details.
00020 
00021     You should have received a copy of the GNU General Public License
00022     along with OpenFOAM; if not, write to the Free Software Foundation,
00023     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
00024 
00025 Application
00026     dieselFoam
00027 
00028 Description
00029     Solver for diesel engine spray and combustion.
00030 
00031 \*---------------------------------------------------------------------------*/
00032 
00033 #include "fvCFD.H"
00034 #include "engineTime.H"
00035 #include "engineMesh.H"
00036 #include "hCombustionThermo.H"
00037 #include "turbulenceModel.H"
00038 #include "spray.H"
00039 #include "psiChemistryModel.H"
00040 #include "chemistrySolver.H"
00041 #include "multivariateScheme.H"
00042 #include "Switch.H"
00043 #include "OFstream.H"
00044 #include "volPointInterpolation.H"
00045 #include "thermoPhysicsTypes.H"
00046 
00047 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00048 
00049 int main(int argc, char *argv[])
00050 {
00051     #include "setRootCase.H"
00052     #include "createEngineTime.H"
00053     #include "createEngineMesh.H"
00054     #include "createFields.H"
00055     #include "readGravitationalAcceleration.H"
00056     #include "readCombustionProperties.H"
00057     #include "createSpray.H"
00058     #include "initContinuityErrs.H"
00059     #include "readEngineTimeControls.H"
00060     #include "compressibleCourantNo.H"
00061     #include "setInitialDeltaT.H"
00062     #include "startSummary.H"
00063 
00064     // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
00065 
00066     Info << "\nStarting time loop\n" << endl;
00067 
00068     while (runTime.run())
00069     {
00070         #include "readPISOControls.H"
00071         #include "readEngineTimeControls.H"
00072         #include "compressibleCourantNo.H"
00073         #include "setDeltaT.H"
00074 
00075         runTime++;
00076 
00077         Info<< "Crank angle = " << runTime.theta() << " CA-deg" << endl;
00078 
00079         mesh.move();
00080         const_cast<volPointInterpolation&>
00081         (
00082             volPointInterpolation::New(mesh)
00083         ).updateMesh();
00084 
00085         dieselSpray.evolve();
00086 
00087         Info << "Solving chemistry" << endl;
00088 
00089         chemistry.solve
00090         (
00091             runTime.value() - runTime.deltaT().value(),
00092             runTime.deltaT().value()
00093         );
00094 
00095         // turbulent time scale
00096         {
00097             volScalarField tk =
00098                 Cmix*sqrt(turbulence->muEff()/rho/turbulence->epsilon());
00099             volScalarField tc = chemistry.tc();
00100 
00101             //Chalmers PaSR model
00102             kappa = (runTime.deltaT() + tc)/(runTime.deltaT() + tc + tk);
00103         }
00104 
00105         #include "rhoEqn.H"
00106         #include "UEqn.H"
00107 
00108         for (label ocorr=1; ocorr <= nOuterCorr; ocorr++)
00109         {
00110             #include "YEqn.H"
00111             #include "hEqn.H"
00112 
00113             // --- PISO loop
00114             for (int corr=1; corr<=nCorr; corr++)
00115             {
00116                 #include "pEqn.H"
00117             }
00118         }
00119 
00120         turbulence->correct();
00121 
00122         #include "logSummary.H"
00123         #include "spraySummary.H"
00124 
00125         rho = thermo.rho();
00126 
00127         if (runTime.write())
00128         {
00129             chemistry.dQ()().write();
00130         }
00131 
00132         Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
00133             << "  ClockTime = " << runTime.elapsedClockTime() << " s"
00134             << nl << endl;
00135     }
00136 
00137     Info<< "End\n" << endl;
00138 
00139     return 0;
00140 }
00141 
00142 
00143 // ************************************************************************* //
Copyright © 2000-2009 OpenCFD Ltd