XiEngineFoam.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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2017 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Application
27  XiEngineFoam
28 
29 Description
30  Solver for internal combustion engines.
31 
32  Combusting RANS code using the b-Xi two-equation model.
33  Xi may be obtained by either the solution of the Xi transport
34  equation or from an algebraic expression. Both approaches are
35  based on Gulder's flame speed correlation which has been shown
36  to be appropriate by comparison with the results from the
37  spectral model.
38 
39  Strain effects are encorporated directly into the Xi equation
40  but not in the algebraic approximation. Further work need to be
41  done on this issue, particularly regarding the enhanced removal rate
42  caused by flame compression. Analysis using results of the spectral
43  model will be required.
44 
45  For cases involving very lean Propane flames or other flames which are
46  very strain-sensitive, a transport equation for the laminar flame
47  speed is present. This equation is derived using heuristic arguments
48  involving the strain time scale and the strain-rate at extinction.
49  the transport velocity is the same as that for the Xi equation.
50 
51 \*---------------------------------------------------------------------------*/
52 
53 #include "fvCFD.H"
54 #include "engineTime.H"
55 #include "engineMesh.H"
56 #include "psiuReactionThermo.H"
58 #include "laminarFlameSpeed.H"
59 #include "ignition.H"
60 #include "Switch.H"
61 #include "OFstream.H"
62 #include "mathematicalConstants.H"
63 #include "pimpleControl.H"
64 #include "fvOptions.H"
65 
66 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
67 
68 int main(int argc, char *argv[])
69 {
70  argList::addNote
71  (
72  "Solver for compressible premixed/partially-premixed combustion with"
73  " turbulence modelling in internal combustion engines."
74  );
75 
76  #define CREATE_TIME createEngineTime.H
77  #define CREATE_MESH createEngineMesh.H
78  #include "postProcess.H"
79 
80  #include "setRootCaseLists.H"
81  #include "createEngineTime.H"
82  #include "createEngineMesh.H"
83  #include "createControl.H"
84  #include "readCombustionProperties.H"
85  #include "createFields.H"
86  #include "createFieldRefs.H"
87  #include "createRhoUf.H"
88  #include "initContinuityErrs.H"
89  #include "readEngineTimeControls.H"
90  #include "compressibleCourantNo.H"
91  #include "setInitialDeltaT.H"
92  #include "startSummary.H"
93 
94  turbulence->validate();
95 
96  // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
97 
98  Info<< "\nStarting time loop\n" << endl;
99 
100  while (runTime.run())
101  {
102  #include "readEngineTimeControls.H"
103  #include "compressibleCourantNo.H"
104  #include "setDeltaT.H"
105 
106  ++runTime;
107 
108  Info<< "Crank angle = " << runTime.theta() << " CA-deg" << endl;
109 
110  mesh.move();
111 
112  #include "rhoEqn.H"
113 
114  // --- Pressure-velocity PIMPLE corrector loop
115  while (pimple.loop())
116  {
117  #include "UEqn.H"
118 
119  #include "ftEqn.H"
120  #include "bEqn.H"
121  #include "EauEqn.H"
122  #include "EaEqn.H"
123 
124  if (!ign.ignited())
125  {
126  thermo.heu() == thermo.he();
127  }
128 
129  // --- Pressure corrector loop
130  while (pimple.correct())
131  {
132  #include "pEqn.H"
133  }
134 
135  if (pimple.turbCorr())
136  {
137  turbulence->correct();
138  }
139  }
140 
141  #include "logSummary.H"
142 
143  rho = thermo.rho();
144 
145  runTime.write();
146 
147  Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
148  << " ClockTime = " << runTime.elapsedClockTime() << " s"
149  << nl << endl;
150  }
151 
152  Info<< "End\n" << endl;
153 
154  return 0;
155 }
156 
157 
158 // ************************************************************************* //
createEngineTime.H
runTime
engineTime & runTime
Definition: createEngineTime.H:13
psiuReactionThermo.H
mathematicalConstants.H
fvOptions.H
turbulence
Info<< "Reading field U\n"<< endl;volVectorField U(IOobject("U", runTime.timeName(), mesh, IOobject::MUST_READ, IOobject::AUTO_WRITE), mesh);volScalarField rho(IOobject("rho", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::AUTO_WRITE), thermo.rho());volVectorField rhoU(IOobject("rhoU", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE), rho *U);volScalarField rhoE(IOobject("rhoE", runTime.timeName(), mesh, IOobject::NO_READ, IOobject::NO_WRITE), rho *(e+0.5 *magSqr(U)));surfaceScalarField pos(IOobject("pos", runTime.timeName(), mesh), mesh, dimensionedScalar("pos", dimless, 1.0));surfaceScalarField neg(IOobject("neg", runTime.timeName(), mesh), mesh, dimensionedScalar("neg", dimless, -1.0));surfaceScalarField phi("phi", fvc::flux(rhoU));Info<< "Creating turbulence model\n"<< endl;autoPtr< compressible::turbulenceModel > turbulence(compressible::turbulenceModel::New(rho, U, phi, thermo))
Definition: createFields.H:94
thermo
Basic thermodynamics type based on the use of fitting functions for cp, h, s obtained from the templa...
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:350
laminarFlameSpeed.H
rho
rho
Definition: readInitialConditions.H:88
pimpleControl.H
OFstream.H
pimple
pimpleControl & pimple
Definition: setRegionFluidFields.H:56
readEngineTimeControls.H
setRootCaseLists.H
Foam::Info
messageStream Info
Information stream (uses stdout - output is on the master only)
createEngineMesh.H
ignition.H
Switch.H
engineMesh.H
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
postProcess.H
Execute application functionObjects to post-process existing results.
Foam::nl
constexpr char nl
Definition: Ostream.H:385
engineTime.H
createRhoUf.H
Creates and initialises the velocity velocity field rhoUf.
fvCFD.H
turbulentFluidThermoModel.H