FreeFOAM The Cross-Platform CFD Toolkit
dieselEngineFoam.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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.
15 
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.
20 
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/>.
23 
24 Application
25  dieselEngineFoam
26 
27 Description
28  Solver for diesel engine spray and combustion.
29 
30 Usage
31  - dieselEngineFoam [OPTION]
32 
33  @param -case <dir> \n
34  Specify the case directory
35 
36  @param -parallel \n
37  Run the case in parallel
38 
39  @param -help \n
40  Display short usage message
41 
42  @param -doc \n
43  Display Doxygen documentation page
44 
45  @param -srcDoc \n
46  Display source code
47 
48 \*---------------------------------------------------------------------------*/
49 
50 #include <finiteVolume/fvCFD.H>
51 #include <engine/engineTime.H>
52 #include <engine/engineMesh.H>
55 #include <dieselSpray/spray.H>
59 #include <OpenFOAM/Switch.H>
60 #include <OpenFOAM/OFstream.H>
63 
64 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
65 
66 int main(int argc, char *argv[])
67 {
68  #include <OpenFOAM/setRootCase.H>
69  #include <engine/createEngineTime.H>
70  #include <engine/createEngineMesh.H>
71  #include "createFields.H"
74  #include "createSpray.H"
79  #include "startSummary.H"
80 
81  // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
82 
83  Info<< "\nStarting time loop\n" << endl;
84 
85  while (runTime.run())
86  {
90  #include <finiteVolume/setDeltaT.H>
91 
92  runTime++;
93 
94  Info<< "Crank angle = " << runTime.theta() << " CA-deg" << endl;
95 
96  mesh.move();
97  const_cast<volPointInterpolation&>
98  (
99  volPointInterpolation::New(mesh)
100  ).updateMesh();
101 
103 
104  Info<< "Solving chemistry" << endl;
105 
107  (
108  runTime.value() - runTime.deltaT().value(),
109  runTime.deltaT().value()
110  );
111 
112  // turbulent time scale
113  {
114  volScalarField tk =
115  Cmix*sqrt(turbulence->muEff()/rho/turbulence->epsilon());
116  volScalarField tc = chemistry.tc();
117 
118  //Chalmers PaSR model
119  kappa = (runTime.deltaT() + tc)/(runTime.deltaT() + tc + tk);
120  }
121 
123 
124  #include "rhoEqn.H"
125  #include "UEqn.H"
126 
127  for (label ocorr=1; ocorr <= nOuterCorr; ocorr++)
128  {
129  #include "YEqn.H"
130  #include "hsEqn.H"
131 
132  // --- PISO loop
133  for (int corr=1; corr<=nCorr; corr++)
134  {
135  #include "pEqn.H"
136  }
137  }
138 
139  turbulence->correct();
140 
141  #include "logSummary.H"
142  #include "spraySummary.H"
143 
144  rho = thermo.rho();
145 
146  if (runTime.write())
147  {
148  chemistry.dQ()().write();
149  }
150 
151  Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
152  << " ClockTime = " << runTime.elapsedClockTime() << " s"
153  << nl << endl;
154  }
155 
156  Info<< "End\n" << endl;
157 
158  return 0;
159 }
160 
161 
162 // ************************ vim: set sw=4 sts=4 et: ************************ //