Enginefoam Tutorial With Different Flame-Wrinkling (Xi) Model
Enginefoam Tutorial With Different Flame-Wrinkling (Xi) Model
Sandip Wadekar
2018-11-29
Subsection
Subsection
Premixed combustion
Fuel and oxidizer are mixed prior to the ignition.
Reaction occurs at the surface of the flame.
Flame front propagates from burnt mixture to un-burnt mixture.
Flame propagation can be defined by the progress variable c
T − Tu
c= (1)
Tb − Tu
For the burnt gas c = 1, and for un-burnt gases c = 0.
Subsection
engineFoam solver
The engineFoam solver involves:
Compressible
Transient
Heat transfer
Chemistry
Turbulence
Combustion
Premixed fuel-oxidizer
Partially-premixed fuel-oxidizer
moving mesh
time defined in crank-angle degree (CAD)
Subsection
closure problem
Fluid flow:
Conservation of mass
Conservation of momentum
Conservation of energy
Equation of state
Combustion:
progress/regress variable
species/mass-fraction equation
Subsection
cd $WM_PROJECT_USER_DIR
cp -r $FOAM_APP/solvers/combustion/engineFoam myengineFoam
cd myengineFoam
Check: engineFoam.C
EXE = $(FOAM_USER_APPBIN)/myengineFoam
Then compile the solver: wmake
Subsection
engineFoam.C
#include "fvCFD.H"
#include "engineTime.H"
#include "engineMesh.H"
#include "psiuReactionThermo.H"
#include "turbulenceModel.H"
#include "laminarFlameSpeed.H"
#include "ignition.H"
#include "Switch.H"
#include "OFstream.H"
#include "mathematicalConstants.H"
#include "pimpleControl.H"
#include "fvIOoptionList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
int main(int argc, char *argv[])
{
#include "setRootCase.H"
#include "createEngineTime.H"
#include "createEngineMesh.H"
#include "readCombustionProperties.H"
#include "createFields.H"
#include "createFvOptions.H"
#include "initContinuityErrs.H"
#include "readEngineTimeControls.H"
#include "compressibleCourantNo.H"
#include "setInitialDeltaT.H"
#include "startSummary.H"
pimpleControl pimple(mesh);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Subsection
engineFoam.C
while (runTime.run())
{
#include "readEngineTimeControls.H"
#include "compressibleCourantNo.H"
#include "setDeltaT.H"
runTime++;
Info<< "Crank angle = " << runTime.theta() << " CA-deg" << endl;
Info<< "This is myengineFoam " << endl;
mesh.move();
#include "rhoEqn.H"
// --- Pressure-velocity PIMPLE corrector loop
while (pimple.loop())
{
#include "UEqn.H"
#include "ftEqn.H"
#include "bEqn.H"
#include "EauEqn.H"
#include "EaEqn.H"
...
...
}
Subsection
src/engine/engineTime/engineTime.C file
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::engineTime::timeAdjustment()
{
deltaT_ = degToTime(deltaT_);
endTime_ = degToTime(endTime_);
if
(
writeControl_ == wcRunTime
|| writeControl_ == wcAdjustableRunTime
)
{
writeInterval_ = degToTime(writeInterval_);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
//- Construct from objectRegistry arguments
Foam::engineTime::engineTime
(
const word& name,
const fileName& rootPath,
const fileName& caseName,
const fileName& systemName,
const fileName& constantName,
const fileName& dictName
)
:
Subsection
src/engine/engineTime/engineTime.C file
Time
(
name,
rootPath,
caseName,
systemName,
constantName
),
dict_
(
IOobject
(
"engineGeometry",
constant(),
*this,
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
)
),
rpm_(dict_.lookup("rpm")),
conRodLength_(dimensionedScalar("conRodLength", dimLength, 0)),
bore_(dimensionedScalar("bore", dimLength, 0)),
stroke_(dimensionedScalar("stroke", dimLength, 0)),
clearance_(dimensionedScalar("clearance", dimLength, 0))
{
// geometric parameters are not strictly required for Time
dict_.readIfPresent("conRodLength", conRodLength_);
dict_.readIfPresent("bore", bore_);
dict_.readIfPresent("stroke", stroke_);
Sandip Wadekar CFD with OpenSource Software, 2018 2018-11-29 10 / 38
engineFoam tutorial
Subsection
src/engine/engineTime/engineTime.C file
dict_.readIfPresent("clearance", clearance_);
timeAdjustment();
startTime_ = degToTime(startTime_);
value() = degToTime(value());
deltaTSave_ = deltaT_;
deltaT0_ = deltaT_;
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::scalar Foam::engineTime::degToTime(const scalar theta) const
{
// 6 * rpm => deg/s
return theta/(6.0*rpm_.value());
}
Foam::scalar Foam::engineTime::timeToDeg(const scalar t) const
{
// 6 * rpm => deg/s
return t*(6.0*rpm_.value());
}
Foam::scalar Foam::engineTime::pistonPosition(const scalar theta) const
{
return
(
conRodLength_.value()
+ stroke_.value()/2.0
+ clearance_.value()
)
Subsection
src/engine/engineTime/engineTime.C file
- (
stroke_.value()*::cos(degToRad(theta))/2.0
+ ::sqrt
(
sqr(conRodLength_.value())
- sqr(stroke_.value()*::sin(degToRad(theta))/2.0)
)
);
}
Foam::dimensionedScalar Foam::engineTime::pistonDisplacement() const
{
return dimensionedScalar
(
"pistonDisplacement",
dimLength,
pistonPosition(theta() - deltaTheta()) - pistonPosition().value()
);
}
Foam::dimensionedScalar Foam::engineTime::pistonSpeed() const
{
return dimensionedScalar
(
"pistonSpeed",
dimVelocity,
pistonDisplacement().value()/(deltaTValue() + VSMALL)
);
}
Subsection
bEqn.H file
This file contains:
Transport equation of regression variable
Reaction source term
Models for laminar flame speed
unstrained
equilibrium
transport
Models for flame wrinkling:
fixed
algebraic (or weller model)
transport
Subsection
bEqn.H: Implementation
Transport equation of regression variable:
∂ µt
(ρb) + ∇.(ρũb) − ∇.( ∇b) = −ρu Su Ξ|∇b| (2)
∂t Sct
Subsection
Subsection
Xi == scalar(1) +
(scalar(1) + (2*XiShapeCoef)*(scalar(0.5)-b))
*XiCoef*sqrt(up/(Su + SuMin))*Reta;
Subsection
Subsection
muppala
0.46 u0 ∆ 0.3 p 0.2
Ξ=1+ Re∆ 0.25 ( ) ( ) (5)
Le SL p0
Subsection
zimont
u0 ∆ 3/4 ∆ 1/4
Ξ = 1 + 0.51 ( ) ( ) (6)
SL δL
Subsection
createFields.H
need to add the cellvolu before compiling
volScalarField cellVolu // Included
(
IOobject
(
"cellVolu",
runTime.timeName(),
mesh,
IOobject::NO_READ,
IOobject::AUTO_WRITE
),
mesh,
dimensionedScalar("zero", dimVolume, 0.0)
);
cd $WM_PROJECT_USER_DIR/myengineFoam
wmake
Subsection
Case set-up
Case description
Constant
Initial and boundary conditions
system
Subsection
Subsection
engineGeometry :
engineMesh layered;
Subsection
g:
dimensions [0 1 -2 0 0 0 0];
value (0 0 0);
Subsection
Model Description
LRR Launder-Reece-Rodi RSTM
LaunderGibsonRSTM Launder-Gibson RSTM
LaunderSharmaKE Launder-Sharma low-Re k − model
RNGkEpsilon RNG k − model
SpalartAllmaras Spalart-Allmaras 1-eqn mixing-length model
kEpsilon Standard k − model
kOmegaSST k − ω − SSt model
laminar Dummy turbulence model for laminar flow
realizableKE Realizable k − model
v2f v 2 − f model
Table: RANS turbulence model for compressible flow
Subsection
keyword : thermoType
Possible options for thermoType for combustion
thermoType
{
type heheuPsiThermo;
mixture inhomogeneousMixture;
transport sutherland;
thermo janaf;
equationOfState perfectGas;
specie specie;
energy absoluteEnthalpy;
//energy absoluteInternalEnergy;
}
Subsection
Property Type
Mixture egrMixture
properties homogeneousMixture
inhomogeneousMixture
veryInhomogeneousMixture
Transport const
properties sutherland
properties janaf
properties
Subsection
>
Subsection
Subsection
constant/combustionProperties
keyword : laminarFlameSpeedCorrelation
1. Gulders
2. GuldersEGR
3. constant
The implementation can be found in:
src/thermophysicalModels/laminarFlameSpeed/Gulders/Gulders.C
src/thermophysicalModels/laminarFlameSpeed/GuldersEGR/GuldersEGR.C
keyword : fuel
keyword : Su
If the laminar flame speed is chosen as constant then it take define value of Su
here.
src/thermophysicalModels/laminarFlameSpeed/constant/constant.C
Sandip Wadekar CFD with OpenSource Software, 2018 2018-11-29 30 / 38
engineFoam tutorial
Subsection
constant/combustionProperties
keyword : equivalenceRatio
It is defined as a ratio of fuel-air ratio to the stoichiometric fuel-air ratio,
as:
2 Tu α pu β
Su (φ, Tu , pu ) = Z W φη e−ξ(φ−σ) ( ) ( ) (7)
T0 p0
The values of model constants are also define depending upon the fuel
used under the GuldersCoeffs, as:
Propane
{ W 0.446;
eta 0.12;
xi 4.95;
alpha 1.77;
beta -0.2;
f 2.3;
}
Sandip Wadekar CFD with OpenSource Software, 2018 2018-11-29 31 / 38
engineFoam tutorial
Subsection
constant/combustionProperties
keyword : XiModel
1. fixed
2. algebraic
3. transport
Subsection
constant/combustionProperties
keyword : ignite
ignite yes;
keyword : ignitionSites
{
location (0.03 0 0.091);
diameter 0.002;
start -15;
duration 20;
strength 4;
}
Subsection
boundary conditions
Subsection
boundary conditions
p pressure zeroGradient
Su laminar flame speed zeroGradient
T burnt fixed value
Temperature uniform 433;
Tu unburnt fixed value
Temperature uniform 433;
U velocity fixed value
uniform (0 0 0);
Xi flame wrinkling zeroGradient
Subsection
Results
Qualitative comparison
>
Figure: Regression variable (b) at 0 crank angle degree.
Subsection
Results
Quantitative comparison
Subsection