engineFoam.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  Copyright (C) 2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Application
28  engineFoam
29 
30 Description
31  Transient solver for compressible, turbulent engine flow with a spray
32  particle cloud.
33 
34 \*---------------------------------------------------------------------------*/
35 
36 #include "fvCFD.H"
37 #include "engineTime.H"
38 #include "engineMesh.H"
40 #include "basicSprayCloud.H"
41 #include "psiReactionThermo.H"
42 #include "CombustionModel.H"
43 #include "radiationModel.H"
44 #include "SLGThermo.H"
45 #include "pimpleControl.H"
46 #include "fvOptions.H"
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 int main(int argc, char *argv[])
51 {
52  argList::addNote
53  (
54  "Transient solver for compressible, turbulent engine flow"
55  " with a spray particle cloud."
56  );
57 
58  #define CREATE_TIME createEngineTime.H
59  #define CREATE_MESH createEngineMesh.H
60  #include "postProcess.H"
61 
62  #include "setRootCaseLists.H"
63  #include "createEngineTime.H"
64  #include "createEngineMesh.H"
65  #include "createControl.H"
66  #include "readEngineTimeControls.H"
67  #include "createFields.H"
68  #include "createFieldRefs.H"
69  #include "createRhoUf.H"
70  #include "compressibleCourantNo.H"
71  #include "setInitialDeltaT.H"
72  #include "initContinuityErrs.H"
73  #include "startSummary.H"
74 
75  turbulence->validate();
76 
77  // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
78 
79  Info<< "\nStarting time loop\n" << endl;
80 
81  while (runTime.run())
82  {
83  #include "readEngineTimeControls.H"
84  #include "compressibleCourantNo.H"
85  #include "setDeltaT.H"
86 
87  ++runTime;
88 
89  Info<< "Engine time = " << runTime.theta() << runTime.unit() << endl;
90 
91  mesh.move();
92 
93  parcels.evolve();
94 
95  #include "rhoEqn.H"
96 
97  // --- Pressure-velocity PIMPLE corrector loop
98  while (pimple.loop())
99  {
100  #include "UEqn.H"
101  #include "YEqn.H"
102  #include "EEqn.H"
103 
104  // --- Pressure corrector loop
105  while (pimple.correct())
106  {
107  #include "pEqn.H"
108  }
109 
110  if (pimple.turbCorr())
111  {
112  turbulence->correct();
113  }
114  }
115 
116  #include "logSummary.H"
117 
118  rho = thermo.rho();
119 
120  if (runTime.write())
121  {
122  combustion->Qdot()().write();
123  }
124 
125  runTime.printExecutionTime(Info);
126  }
127 
128  Info<< "End\n" << endl;
129 
130  return 0;
131 }
132 
133 
134 // ************************************************************************* //
engineTime & runTime
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:531
psiReactionThermo & thermo
Definition: createFields.H:28
void write(vtk::formatter &fmt, const Type &val, const label n=1)
Component-wise write of a value (N times)
dynamicFvMesh & mesh
pimpleControl & pimple
Info<< "Reading field U\"<< 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\"<< endl;autoPtr< compressible::turbulenceModel > turbulence(compressible::turbulenceModel::New(rho, U, phi, thermo))
Definition: createFields.H:94
Info<< "Creating combustion model\"<< endl;autoPtr< CombustionModel< psiReactionThermo > > combustion(CombustionModel< psiReactionThermo >::New(thermo, turbulence()))
messageStream Info
Information stream (stdout output on master, null elsewhere)
Execute application functionObjects to post-process existing results.
Creates and initialises the velocity velocity field rhoUf.