0% found this document useful (0 votes)
265 views13 pages

A Modified Version of The Reactingfoam Tutorial For Les

This document provides instructions for modifying an existing reactingFoam solver from RAS to LES modeling. Key steps include changing includes to use LES libraries instead of RAS, modifying source files to substitute LES for RAS, and adjusting constant folder files to reference the chemical mechanism and properties files.

Uploaded by

mjk
Copyright
© Attribution Non-Commercial (BY-NC)
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)
265 views13 pages

A Modified Version of The Reactingfoam Tutorial For Les

This document provides instructions for modifying an existing reactingFoam solver from RAS to LES modeling. Key steps include changing includes to use LES libraries instead of RAS, modifying source files to substitute LES for RAS, and adjusting constant folder files to reference the chemical mechanism and properties files.

Uploaded by

mjk
Copyright
© Attribution Non-Commercial (BY-NC)
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/ 13

Piero Iudiciani

A modified version of the reactingFoam tutorial for LES

PhD course in CFD with OpenSource software, december 2009


Outline

• change the reactingFoam solver from RAS to LES


• download the original tutorial from the openWiki:
• change the chemkin reaction mechanism
• run

Håkan Nilsson, Chalmers / Applied Mechanics / Fluid Dynamics 1


Piero Iudiciani

Creating a new solver


This tutorial works on version 1.5.x, thus we have to source it
export FOAM_INST_DIR=/chalmers/sw/unsup/OpenFOAM;
. /chalmers/sw/unsup/OpenFOAM/OpenFOAM-1.5.x/etc/bashrc
cp -r $FOAM_APP/solvers/combustion/reactingFoam/ reactingFoamLES
cd reactingFoamLES
Then we copy some files from the course repository that will be necessary in the following:
cp ˜/pieroRepository/tutFiles.tar.gz .
tar xzf tutFiles.tar.gz
rm tutFiles.tar.gz

Håkan Nilsson, Chalmers / Applied Mechanics / Fluid Dynamics 2


Piero Iudiciani

Modifying the source file


In particular we change the line
#include "compressible/RASModel/RASModel.H"
into
#include "compressible/LESModel/LESModel.H"
and we add the line: (all the LES solvers, i.e. coodles have this line in the source file)
#define divDevRhoReff divDevRhoBeff

Håkan Nilsson, Chalmers / Applied Mechanics / Fluid Dynamics 3


Piero Iudiciani

Modifying creatFields.H
again in createFields.H we substitute RAS with LES in lines 61-63 and we also comment lines 72-74:

Info << "Creating turbulence model.\n" << nl;


Info << "Creating turbulence model.\n" << nl;
autoPtr<compressible::RASModel> turbulence
autoPtr<compressible::LESModel> turbulence
(
(
compressible::RASModel::New
compressible::LESModel::New
(
(
rho,
rho,
U,
U,
phi,
phi,
thermo()
thermo()
)
)
);
//Info<< "Creating field DpDt\n" << endl;
Info<< "Creating field DpDt\n" << endl;
//volScalarField DpDt =
volScalarField DpDt =
// fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);
fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p);

Håkan Nilsson, Chalmers / Applied Mechanics / Fluid Dynamics 4


Piero Iudiciani

Compiling
We then change the file Make/files into:
reactingFoamLES.C

EXE = $(FOAM_USER_APPBIN)/reactingFoamLES
In the file Make/files again we change the RAS libraries with the LES ones, and add
-I$(LIB_SRC)/turbulenceModels/LES/LESdeltas/lnInclude\

EXE_INC = \ EXE_INC = \
-I../XiFoam \ -I../XiFoam \
-I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \
-I$(LIB_SRC)/turbulenceModels/RAS \ -I$(LIB_SRC)/turbulenceModels/LES \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ -I$(LIB_SRC)/turbulenceModels/LES/LESdeltas/lnInclude \
| |
| |
EXE_LIBS = \ EXE_LIBS = \
-lcompressibleRASModels \ -lcompressibleLESModels \
-lcombustionThermophysicalModels\ -lcombustionThermophysicalModels \

We are now ready to compile:


wclean
rm -r Make/linuxGccDP*
wmake

Håkan Nilsson, Chalmers / Applied Mechanics / Fluid Dynamics 5


Piero Iudiciani

Set up the case


A tutorial file for reactingFoam is found on the OpenWiki
We can download directly from the webpage

http://openfoamwiki.net/index.php/Tut_reactingFoam_firstTutorial

or we get it typing directly in the shell:

wget http://openfoamwiki.net/images/b/b6/ReactingFoamCase.tar.gz

Once downloaded we extract the files in the folder ReactingFoamCase:

mkdir ReactingFoamCase
mv ReactingFoamCase.tar.gz ReactingFoamCase
cd ReactingFoamCase
tar xzf ReactingFoamCase.tar.gz
rm ReactingFoamCase.tar.gz

Håkan Nilsson, Chalmers / Applied Mechanics / Fluid Dynamics 6


Piero Iudiciani

chemkin folder
The files *inp* contain the chemical reaction mechanisms, with the chemical elements, the species involved and
all the chemical reactions in the mechanism. For example the file chem.inp contains a simple one step reaction
mechanism for heptane (C7H16):
ELEMENTS
H O C N
END
SPECIE
C7H16 O2 N2 CO2 H2O
END
REACTIONS
C7H16 + 11O2 => 7CO2 + 8H2O 5.00E+8 0.0 15780.0! 1
FORD / C7H16 0.25 /
FORD / O2 1.5 /
END

Håkan Nilsson, Chalmers / Applied Mechanics / Fluid Dynamics 7


Piero Iudiciani

chemkin folder
The file therm.dat instead contains for each species coefficients to compute heat capacity, hentalpy, enthropy,
heat of reactions. For example:
THERMO ALL
200.000 1000.000 5000.000
(CH2O)3 70590C 3H 6O 3 G 0200.00 4000.00 1500.00 1
0.01913678E+03 0.08578044E-01-0.08882060E-05-0.03574819E-08 0.06605143E-12 2
-0.06560876E+06-0.08432507E+03-0.04662286E+02 0.06091547E+00-0.04710536E-03 3
0.01968843E-06-0.03563271E-10-0.05665404E+06 0.04525265E+03 4
(CH3)2SICH2 61991H 8C 3SI 1 G 0200.00 2500.00 1500.00 1
0.01547852E+03 0.01065700E+00-0.01234345E-05-0.01293352E-07 0.02528715E-11 2
-0.06693076E+04-0.05358884E+03 0.02027522E+02 0.04408673E+00-0.03370024E-03 3
0.01484466E-06-0.02830898E-10 0.03931454E+05 0.01815821E+03 4
AL 62987AL 1 G 0200.00 5000.00 0600.00 1
0.02559589E+02-0.01063224E-02 0.07202828E-06-0.02121105E-09 0.02289429E-13 2
0.03890214E+06 0.05234522E+02 0.02736825E+02-0.05912374E-02-0.04033938E-05 3
0.02322343E-07-0.01705599E-10 0.03886795E+06 0.04363880E+02 4

The chemkin directory should be contained in constant:


mv chemkin/ constant/

Håkan Nilsson, Chalmers / Applied Mechanics / Fluid Dynamics 8


Piero Iudiciani

constant folder
In the constant/thermophysicalProperties file we change the path of the chemical files:
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

thermoType hMixtureThermo<reactingMixture>;

CHEMKINFile "/cluster/samples/reactingFoam/chemkin/chem.inp";
CHEMKINThermoFile "/cluster/samples/reactingFoam/chemkin/therm.dat";

inertSpecie N2;

becomes -------->

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

thermoType hMixtureThermo<reactingMixture>;

CHEMKINFile "chemkin/chem.inp";
CHEMKINThermoFile "chemkin/therm.dat";

inertSpecie N2;

Håkan Nilsson, Chalmers / Applied Mechanics / Fluid Dynamics 9


Piero Iudiciani

constant folder
From the tutFiles directory we copy the chemistryProperties file
cp ../reactingFoamLES/tutFiles/chemistryProperties constant/
where the sequential solver is selected:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

chemistry on;

turbulentReaction off;
Cmix Cmix [ 0 0 0 0 0 0 0 ] 1.0 ;

//chemistrySolver ODE;
//chemistrySolver EulerImplicit;
chemistrySolver sequential;

initialChemicalTimeStep 1.0e-8;

Håkan Nilsson, Chalmers / Applied Mechanics / Fluid Dynamics 10


Piero Iudiciani

constant folder
We also need a file for the LES properties, we take it from a LES tutorial, for example coodles:

cp /chalmers/sw/unsup/OpenFOAM/OpenFOAM-1.5.x/tutorials/coodles \
/pitzDaily/constant/LESProperties constant/
And we choose the Smagorinsky for the turbulence model:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

LESModel Smagorinsky;

printCoeffs off;

delta cubeRootVol;

system folder

In the file system/controlDict file we change the name of the application to reactingLESFoam

Håkan Nilsson, Chalmers / Applied Mechanics / Fluid Dynamics 11


Piero Iudiciani

0/ directory and boundary conditions


We remove the latest directory, and we recall that the Smagorinsky model needs a muSgs file in the 0/ directory.
The right dimensions should be assigned to the turbulent viscosity:
rm -r 0.055/
cp 0/k 0/muSgs
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [ 1 -1 -1 0 0 0 0 ];

internalField uniform 0.0;

boundaryField
{
inlet
{
type fixedValue;
value uniform 0.0;
}
lowerInlet
{
type fixedValue;
value uniform 0.0;
}

outlet
{
type zeroGradient;
}

upperWall
{
type zeroGradient;
}

We are now ready to run:


reactingFoamLES > log

Håkan Nilsson, Chalmers / Applied Mechanics / Fluid Dynamics 12


Piero Iudiciani

Use another mechanism


One might want to simulate different fuels or use a more detailed mechanism
cp ../reactingFoamLES/tutFiles/WD2steps.inp constant/chemkin/
ELEMENTS
C H O N
END
SPECIE
CH4 O2 CO H2O CO2 N2
END
REACTIONS
CH4 + 1.5O2 => CO + 2H2O 2.80E+09 0.0 48400.
FORD /CH4 -0.3/
FORD /O2 1.3/
CO2 => CO + 0.5O2 5.00E+08 0.0 40000.
FORD /CO2 1.0 /
CO + H2O + 0.5O2 => CO2 + H2O 3.98E+14 0.0 40000.
FORD /CO 1.0 /
FORD /H2O 0.5 /
FORD /O2 0.25/
END

cp 0/C7H16 0/CH4
Accordingly the constant/thermophysicalProperties file should be updated:
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
thermoType hMixtureThermo<reactingMixture>;

//CHEMKINFile "chemkin/chem.inp";
CHEMKINFile "chemkin/WD2steps.inp";
CHEMKINThermoFile "chemkin/therm.dat";

Håkan Nilsson, Chalmers / Applied Mechanics / Fluid Dynamics 13

You might also like