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 -------------------------------------------------------------------------------
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  engineFoam
28 
29 Description
30  Transient solver for compressible, turbulent engine flow with a spray
31  particle cloud.
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #include "fvCFD.H"
36 #include "engineTime.H"
37 #include "engineMesh.H"
39 #include "basicSprayCloud.H"
40 #include "psiReactionThermo.H"
41 #include "CombustionModel.H"
42 #include "radiationModel.H"
43 #include "SLGThermo.H"
44 #include "pimpleControl.H"
45 #include "fvOptions.H"
46 
47 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 
49 int main(int argc, char *argv[])
50 {
51  argList::addNote
52  (
53  "Transient solver for compressible, turbulent engine flow"
54  " with a spray particle cloud."
55  );
56 
57  #define CREATE_TIME createEngineTime.H
58  #define CREATE_MESH createEngineMesh.H
59  #include "postProcess.H"
60 
61  #include "setRootCaseLists.H"
62  #include "createEngineTime.H"
63  #include "createEngineMesh.H"
64  #include "createControl.H"
65  #include "readEngineTimeControls.H"
66  #include "createFields.H"
67  #include "createFieldRefs.H"
68  #include "createRhoUf.H"
69  #include "compressibleCourantNo.H"
70  #include "setInitialDeltaT.H"
71  #include "initContinuityErrs.H"
72  #include "startSummary.H"
73 
74  turbulence->validate();
75 
76  // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
77 
78  Info<< "\nStarting time loop\n" << endl;
79 
80  while (runTime.run())
81  {
82  #include "readEngineTimeControls.H"
83  #include "compressibleCourantNo.H"
84  #include "setDeltaT.H"
85 
86  ++runTime;
87 
88  Info<< "Engine time = " << runTime.theta() << runTime.unit() << endl;
89 
90  mesh.move();
91 
92  parcels.evolve();
93 
94  #include "rhoEqn.H"
95 
96  // --- Pressure-velocity PIMPLE corrector loop
97  while (pimple.loop())
98  {
99  #include "UEqn.H"
100  #include "YEqn.H"
101  #include "EEqn.H"
102 
103  // --- Pressure corrector loop
104  while (pimple.correct())
105  {
106  #include "pEqn.H"
107  }
108 
109  if (pimple.turbCorr())
110  {
111  turbulence->correct();
112  }
113  }
114 
115  #include "logSummary.H"
116 
117  rho = thermo.rho();
118 
119  if (runTime.write())
120  {
121  combustion->Qdot()().write();
122  }
123 
124  Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"
125  << " ClockTime = " << runTime.elapsedClockTime() << " s"
126  << nl << endl;
127  }
128 
129  Info<< "End\n" << endl;
130 
131  return 0;
132 }
133 
134 
135 // ************************************************************************* //
createEngineTime.H
runTime
engineTime & runTime
Definition: createEngineTime.H:13
basicSprayCloud.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
SLGThermo.H
rho
rho
Definition: readInitialConditions.H:88
pimpleControl.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
CombustionModel.H
engineMesh.H
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
postProcess.H
Execute application functionObjects to post-process existing results.
psiReactionThermo.H
Foam::nl
constexpr char nl
Definition: Ostream.H:385
engineTime.H
createRhoUf.H
Creates and initialises the velocity velocity field rhoUf.
Foam::vtk::write
void write(vtk::formatter &fmt, const Type &val, const label n=1)
Component-wise write of a value (N times)
Definition: foamVtkOutputTemplates.C:35
fvCFD.H
radiationModel.H
combustion
Info<< "Creating combustion model\n"<< endl;autoPtr< CombustionModel< psiReactionThermo > > combustion(CombustionModel< psiReactionThermo >::New(thermo, turbulence()))
turbulentFluidThermoModel.H