0% found this document useful (0 votes)
60 views38 pages

Enginefoam Tutorial With Different Flame-Wrinkling (Xi) Model

This document provides a tutorial for using the engineFoam solver in OpenFOAM. It begins with a brief introduction to premixed turbulent combustion and an overview of the engineFoam solver. It then discusses how to set up a case by defining properties, initial and boundary conditions. The document outlines the files involved in engineFoam, including the engineFoam.C file and files for defining the flame wrinkling models and transport equations. It also provides information on modifying engineFoam to create a new solver called myengineFoam. The tutorial concludes with discussing how to run the case and view results.

Uploaded by

dlutbyf
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
60 views38 pages

Enginefoam Tutorial With Different Flame-Wrinkling (Xi) Model

This document provides a tutorial for using the engineFoam solver in OpenFOAM. It begins with a brief introduction to premixed turbulent combustion and an overview of the engineFoam solver. It then discusses how to set up a case by defining properties, initial and boundary conditions. The document outlines the files involved in engineFoam, including the engineFoam.C file and files for defining the flame wrinkling models and transport equations. It also provides information on modifying engineFoam to create a new solver called myengineFoam. The tutorial concludes with discussing how to run the case and view results.

Uploaded by

dlutbyf
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 38

engineFoam tutorial

engineFoam tutorial with different flame-wrinkling (Xi)


model

Sandip Wadekar

Mechanics and Maritime Sciences,


Chalmers University of Technology,
Gothenburg, Sweden

2018-11-29

Sandip Wadekar CFD with OpenSource Software, 2018 2018-11-29 1 / 38


engineFoam tutorial

Subsection

A Brief tutorial for engineFoam in OpenFOAM

A brief introduction of premixed turbulent combustion.


engineFoam solver:
engineFoam.C file
src/engine/engineTime/engineTime.C file
bEqn.H file
bEqn.H : new flame wrinkling models
Setup a case:
thermophysical and combustion properties
Initial and boundary conditions
run the case
Results

Sandip Wadekar CFD with OpenSource Software, 2018 2018-11-29 2 / 38


engineFoam tutorial

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.

But in engineFoam solver, the flame front propagation is modeled by


regression variable b, with the relation b = c − 1.
Flame propagation is modeled by solving transport equation of
regression variable.
Sandip Wadekar CFD with OpenSource Software, 2018 2018-11-29 3 / 38
engineFoam tutorial

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)

Sandip Wadekar CFD with OpenSource Software, 2018 2018-11-29 4 / 38


engineFoam tutorial

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

Sandip Wadekar CFD with OpenSource Software, 2018 2018-11-29 5 / 38


engineFoam tutorial

Subsection

create new engineFoam solver

Copy and rename the solver

cd $WM_PROJECT_USER_DIR
cp -r $FOAM_APP/solvers/combustion/engineFoam myengineFoam
cd myengineFoam

Now, we also need to modify the files in Make directory,

sed -i s/"engineFoam"/"myengineFoam"/g Make/files


sed -i s/"FOAM_APPBIN"/"FOAM_USER_APPBIN"/g Make/files

Check: engineFoam.C
EXE = $(FOAM_USER_APPBIN)/myengineFoam
Then compile the solver: wmake

Sandip Wadekar CFD with OpenSource Software, 2018 2018-11-29 6 / 38


engineFoam tutorial

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);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

Sandip Wadekar CFD with OpenSource Software, 2018 2018-11-29 7 / 38


engineFoam tutorial

Subsection

engineFoam.C

Info<< "\nStarting time loop\n" << endl;

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"
...
...
}

Sandip Wadekar CFD with OpenSource Software, 2018 2018-11-29 8 / 38


engineFoam tutorial

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
)
:

Sandip Wadekar CFD with OpenSource Software, 2018 2018-11-29 9 / 38


engineFoam tutorial

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()
)

Sandip Wadekar CFD with OpenSource Software, 2018 2018-11-29 11 / 38


engineFoam tutorial

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)
);
}

Sandip Wadekar CFD with OpenSource Software, 2018 2018-11-29 12 / 38


engineFoam tutorial

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

Sandip Wadekar CFD with OpenSource Software, 2018 2018-11-29 13 / 38


engineFoam tutorial

Subsection

bEqn.H: Implementation
Transport equation of regression variable:
∂ µt
(ρb) + ∇.(ρũb) − ∇.( ∇b) = −ρu Su Ξ|∇b| (2)
∂t Sct

This equation is implemented as follow:


fvScalarMatrix bEqn
(
fvm::ddt(rho, b)
+ mvConvection->fvmDiv(phi, b)
+ fvm::div(phiSt, b, "div(phiSt,b)")
- fvm::Sp(fvc::div(phiSt), b)
- fvm::laplacian(turbulence->alphaEff(), b)
==
fvOptions(rho, b)
);
Sandip Wadekar CFD with OpenSource Software, 2018 2018-11-29 14 / 38
engineFoam tutorial

Subsection

bEqn.H: Laminar flame speed

The laminar flame speed can be calculated based on three different


models:
unstrained
equilibrium
transport

Implementation of the these models you can be found in to the line


111-161 of bEqn.H

Sandip Wadekar CFD with OpenSource Software, 2018 2018-11-29 15 / 38


engineFoam tutorial

Subsection

bEqn.H: Flame wrinkling factor

The flame wrinkling factor can be calculated based on three different


models:
fixed: Do nothing Xi is fixed
algebraic (weller model)
s
u0
Ξ∗eq = 1 + 0.62 Rη , (3)
Su
Ξ = 1 + 2(1 − b)(Ξ∗eq − 1) (4)

Xi == scalar(1) +
(scalar(1) + (2*XiShapeCoef)*(scalar(0.5)-b))
*XiCoef*sqrt(up/(Su + SuMin))*Reta;

Sandip Wadekar CFD with OpenSource Software, 2018 2018-11-29 16 / 38


engineFoam tutorial

Subsection

bEqn.H: Flame wrinkling factor


transport : Xi transport equation is solved
fvScalarMatrix XiEqn
(
fvm::ddt(rho, Xi)
+ fvm::div(phi + phiXi, Xi, "div(phiXi,Xi)")
- fvm::Sp(fvc::div(phiXi), Xi)
==
rho*R
- fvm::Sp(rho*(R - G), Xi)
- fvm::Sp
( rho*max
(
sigmat - sigmas,
dimensionedScalar(sigmat.dimensions(), Zero)
),
Xi
)
+ fvOptions(rho, Xi)
);
XiEqn.relax();
fvOptions.constrain(XiEqn);
XiEqn.solve();
fvOptions.correct(Xi);
// Correct boundedness of Xi
// ~~~~~~~~~~~~~~~~~~~~~~~~~
Xi.max(1.0);
Info<< "max(Xi) = " << max(Xi).value() << endl;
Info<< "max(XiEq) = " << max(XiEq).value() << endl;
}
Sandip Wadekar CFD with OpenSource Software, 2018 2018-11-29 17 / 38
engineFoam tutorial

Subsection

bEqn.H: New flame wrinkling models

muppala
0.46 u0 ∆ 0.3 p 0.2
Ξ=1+ Re∆ 0.25 ( ) ( ) (5)
Le SL p0

else if (XiModel == "muppala")


{
volScalarField delta = pow(cellVolu,1.0/3.0);
volScalarField up(uPrimeCoef*sqrt((2.0/3.0)*turbulence->k()));
volScalarField Ret((rho * up* delta)/(turbulence->mu()));
dimensionedScalar pref
(dimensionedScalar("pref", p.dimensions(), 100000));
Xi == scalar(1) +
((0.46/1.0) * pow(Ret,0.25)*pow(up/Su,0.3)*pow(p/pref,0.2));
Info << "Xi-Muppala" << max(Xi).value() << endl;
}

Sandip Wadekar CFD with OpenSource Software, 2018 2018-11-29 18 / 38


engineFoam tutorial

Subsection

bEqn.H: New flame wrinkling models

zimont
u0 ∆ 3/4 ∆ 1/4
Ξ = 1 + 0.51 ( ) ( ) (6)
SL δL

else if (XiModel == "zimont")


{
volScalarField delta = pow(cellVolu,1.0/3.0);
volScalarField up(uPrimeCoef*sqrt((2.0/3.0)*turbulence->k()));
volScalarField Ret((rho * up* delta)/(turbulence->mu()));
dimensionedScalar pref
(dimensionedScalar("pref", p.dimensions(), 100000));
volScalarField dl= ( thermo.muu() / (0.7 * rhou) ) / Su0;
Xi == scalar(1) + (0.51 * pow(Ret,0.75) * pow(delta/dl,0.25));
Info << "Xi-Zimont" << max(Xi).value() << endl;
}

Sandip Wadekar CFD with OpenSource Software, 2018 2018-11-29 19 / 38


engineFoam tutorial

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)
);

compile the solver

cd $WM_PROJECT_USER_DIR/myengineFoam
wmake

Sandip Wadekar CFD with OpenSource Software, 2018 2018-11-29 20 / 38


engineFoam tutorial

Subsection

Case set-up

Case description
Constant
Initial and boundary conditions
system

Sandip Wadekar CFD with OpenSource Software, 2018 2018-11-29 21 / 38


engineFoam tutorial

Subsection

Case set-up: description


KivaTest engine geometry is used (valve is not present).
premixed mixture of air-propane is used as a working fluid.
Case covers only compression (-180 to 0 cad), ignition (-15 cad) and
expansion phase (0 to 60 cad).

Sandip Wadekar CFD with OpenSource Software, 2018 2018-11-29 22 / 38


engineFoam tutorial

Subsection

Case set-up: constant

engineGeometry :

engineMesh layered;

conRodLength conRodLength [ 0 1 0 0 0 0 0 ] 0.147;

bore bore [ 0 1 0 0 0 0 0 ] 0.092;

stroke stroke [ 0 1 0 0 0 0 0 ] 0.08423;

clearance clearance [ 0 1 0 0 0 0 0 ] 0.00115;

rpm rpm [ 0 0 -1 0 0 0 0 ] 1500;

Sandip Wadekar CFD with OpenSource Software, 2018 2018-11-29 23 / 38


engineFoam tutorial

Subsection

Case set-up: constant

turbulenceProperties : 1. RASModel 2. LESModel


simulationType RASModel;
RASProperties :
RASModel LaunderSharmaKE;
turbulence on;
printCoeffs on;

g:
dimensions [0 1 -2 0 0 0 0];
value (0 0 0);

Sandip Wadekar CFD with OpenSource Software, 2018 2018-11-29 24 / 38


engineFoam tutorial

Subsection

Case set-up: constant

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

Sandip Wadekar CFD with OpenSource Software, 2018 2018-11-29 25 / 38


engineFoam tutorial

Subsection

Case set-up: constant/thermophysicalProperties

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;
}

Sandip Wadekar CFD with OpenSource Software, 2018 2018-11-29 26 / 38


engineFoam tutorial

Subsection

Case set-up: constant/thermophysicalProperties

Property Type

Thermophysical model heheuPsiThermo

Mixture egrMixture

properties homogeneousMixture

inhomogeneousMixture

veryInhomogeneousMixture

Transport const

properties sutherland

Basic thermophysical hConst

properties janaf

equation of state perfectGas

Derived thermophysical specie

properties

Table: Thermo-physical model


Sandip Wadekar CFD with OpenSource Software, 2018 2018-11-29 27 / 38
engineFoam tutorial

Subsection

Case set-up: constant/thermophysicalProperties

>

Sandip Wadekar CFD with OpenSource Software, 2018 2018-11-29 28 / 38


engineFoam tutorial

Subsection

Case set-up: constant/thermophysicalProperties


Keyword : stoichiometricAirFuelMassRatio
Now for the inhomogeneousMixture it will read the fuel, oxidant and
burnt products. Which are defined as follow:
fuel
{
specie
{
nMoles 1;
molWeight 114.23;
}
thermodynamics
{
Tlow 298.15;
Thigh 5000;
Tcommon 1000;
highCpCoeffs (19.3963 0.0488137 -1.55798e-05 2.17831e-09 -1.08391e-13 -37133.9 -78.8531 );
lowCpCoeffs ( 0.429357 0.0765769 8.41306e-06 -5.86603e-08 2.79414e-11 -30446.4 25.6735 );
}
transport
{
As 1.67212e-06;
Ts 170.672;
}
}

Sandip Wadekar CFD with OpenSource Software, 2018 2018-11-29 29 / 38


engineFoam tutorial

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

Now extented to:


4. muppala
5. zimont

Sandip Wadekar CFD with OpenSource Software, 2018 2018-11-29 32 / 38


engineFoam tutorial

Subsection

constant/combustionProperties

keyword : ignite
ignite yes;
keyword : ignitionSites
{
location (0.03 0 0.091);
diameter 0.002;
start -15;
duration 20;
strength 4;
}

Sandip Wadekar CFD with OpenSource Software, 2018 2018-11-29 33 / 38


engineFoam tutorial

Subsection

boundary conditions

We have following files in the time folder such as -180 :


alphat b epsilon ft fu k mut p Su T Tu U Xi
Variable Description Boundary condition at patches
(same at all the patches except moving patch)
alphat Thermal diffusivity type compressible::alphatWallFunction;
Prt 0.85;
value uniform 0;
b Regression variable zeroGradient;
epsilon Turbulent kinetic type compressible::epsilonWallFunction;
energy dissipation Cmu 0.09;
rate kappa 0.41;
E 9.8;
value uniform 450;
k Turbulent kinetic energy type compressible::kqRWallFunction;
value uniform 4;
mut Turbulent viscosity type mutkWallFunction;
Cmu 0.09;
kappa 0.41;
E 9.8;
value uniform 0;

Sandip Wadekar CFD with OpenSource Software, 2018 2018-11-29 34 / 38


engineFoam tutorial

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

Run the simulation :


./Allclean
./Allrun > log 2>&1 &

Sandip Wadekar CFD with OpenSource Software, 2018 2018-11-29 35 / 38


engineFoam tutorial

Subsection

Results
Qualitative comparison

>
Figure: Regression variable (b) at 0 crank angle degree.

Sandip Wadekar CFD with OpenSource Software, 2018 2018-11-29 36 / 38


engineFoam tutorial

Subsection

Results
Quantitative comparison

Figure: In-cylinder pressure (left) and temperature (right).

Sandip Wadekar CFD with OpenSource Software, 2018 2018-11-29 37 / 38


engineFoam tutorial

Subsection

Thanks for you attention!

Sandip Wadekar CFD with OpenSource Software, 2018 2018-11-29 38 / 38

You might also like