The Implementation of A Stochastic Reactor (Stor) Combustion Model
The Implementation of A Stochastic Reactor (Stor) Combustion Model
The Implementation of A Stochastic Reactor (Stor) Combustion Model
Author:
Shijie Xu Peer reviewed by:
Lund University William Hay
[email protected] Mohammad Arabnejad
[email protected] Håkan Nilsson
Disclaimer: This is a student project work, done as part of a course where OpenFOAM and some other
OpenSource software are introduced to the students. Any reader should be aware that it might not be free of
errors. Still, it might be useful for someone who would like learn some details similar to the ones presented
in the report and in the accompanying files. The material has gone through a review process. The role of the
reviewer is to go through the tutorial and make sure that it works, that it is possible to follow, and to some
extent correct the writing. The reviewer has no responsibility for the contents.
• How to use a Lagrangian-Euler solver ‘sprayFoam’ to simulate the spray and combustion process. How
to set your own spray parameters, including injector configuration, chemical mechanism and combustion
model.
• How to use our group new-build stochastic reactor (StoR) combustion model to simulate turbulence
combustion case under liquid-gas phase.
• How to use the chemistry coordinate mapping approach (CCM)[1] developed by our group to speedup
your chemical reaction calculation.
The theory of it:
• A general description of the stochastic reactor (StoR) combustion model based on Probability Distri-
bution Function (PDF) method. How it can take turbulence combustion interaction into account and
improve the accuracy.
• The theory of the chemistry coordinate mapping (CCM) chemistry speedup approach. How it can
improve computing efficiency in finite-rate chemistry based simulation.
• The idea of the combination of those two approaches will be described in detail.
How it is implemented:
• A detailed description of the implementation of StoR combustion model.
• How to implement the case setup for ‘sprayFoam’ to use both StoR combustion model and CCM
chemistry speedup approach.
How to modify it:
• The combustion model will be modified from an existing eddy dissipation concept (EDC) combustion
model.
1
Prerequisites
The reader is expected to know the following in order to get maximum benefit out of this report:
• Basic theory of turbulence combustion;
• Run standard document tutorials like sprayFoam tutorial or reactingFoam
• It is strongly recommonded to gain a brief insight into the the chemistry coordinate mapping approach
(CCM) from the following journals, if you think they are useful, please cite them:
Jangi, Mehdi, and Xue-Song Bai. “Multidimensional chemistry coordinate mapping approach for
combustion modelling with finite-rate chemistry." Combustion Theory and Modelling 16.6 (2012):
1109-1132.
Jangi, Mehdi, Rixin Yu, and Xue-Song Bai. “A multi-zone chemistry mapping approach for direct nu-
merical simulation of auto-ignition and flame propagation in a constant volume enclosure." Combustion
Theory and Modelling 16.2 (2012): 221-249.
2
Contents
1 Introduction 4
1.1 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.2 Motivation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2 Theory 5
2.1 Probability density function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2.2 The chemistry coordinate mapping approach . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.3 The combination of PDF and CCM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
3 Implementation 9
3.1 The structure of combustion model library . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
3.2 The creation of a case with StoR model . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
3.3 The modification of StoR model . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
4 Tutorials 23
4.1 Case introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
4.2 Case modification . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
4.3 Results and discussion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
3
Chapter 1
Introduction
1.1 Background
Turbulence combustion involves the complex interactions between fluid dynamics, thermodynamics and
chemical processes[2]. Fuel spray and combustion has been widely used in energy conversion apparatus, such
as vehicle engine and gas turbine, which is a typical turbulence combustion including a wide range of temporal
and spatial scales. Consequently, turbulence and combustion interaction (TCI) need to be considered.
In OpenFOAMv1806, a number of combustion models are implemented to take turbulence and combustion
interaction (TCI) into account, such as partial stired reactor(PaSR), eddy dissipation concept (EDC) and so
on. It is worth mentioning that well stired reactor(WSR) also exists, which is so-called laminar combustion
model in OpenFOAM.
1.2 Motivation
Recently, our group proposed a stochastic reactor (StoR) to take turbulence and combustion interaction into
account. By coupling with chemistry speedup method, it can improve the accuracy of chemical reaction
source terms calculation without increasing the computational cost.
The purpose of this project is to implement a stochastic reactor (StoR) combustion model based on
presumed Probability Distribution Function (PDF) method. The chemistry coordinate mapping approach
(CCM) is utilized to improve the computational efficiency. This project can be divided into two parts: the
first part deals with the implementation of StoR combustion model; and the second part concerns with the
creation of a case that will use both StoR combustion model and CCM chemistry speedup approach.
The models shown in this project is only a demo program, the PDF is presumed and stochastic reactor only
consisting of three temperature states. In the future, in order to reach higher accuracy and lower computational
cost, I will develop two solvers to optimize the combination of those two models for both gas phase and liquid-
gas phase combustion separately. We named it as ‘multi-zones stochastic reactor (MStoR)’, which can achieve
deep integration. If interested, feel free to contact me or our group (Division of Fluid Mechanics, Lund
University) for detailed information and cooperation.
4
Chapter 2
Theory
This chapter is designed to introduce the theory of the combustion model and chemistry speedup approach. In
the following paragraphs, those parts are presented in order: the basic theory of Probability density function,
a brief introduction to chemistry coordinate mapping approach, and the combination of PDF and CCM.
φ = φ + φ0. (2.1)
∫ ∞
E(φ) = φ ≡ ψ fφ (ψ)dψ. (2.2)
−∞
∫ ∞
D(φ) = φ 02 ≡ E([φ − φ]2 ) = (ψ − φ)2 fφ (ψ)dψ. (2.3)
−∞
Given a function Q, if Q is a function of φ, then the expectation, or the ensemble average, Q can be exactly
calculated by Eq.2.4[4]. For linear function, Q(φ) is equal to Q(φ̄), but for non-linear function, the analytical
solution for the integration in Eq. 2.4 is not easy to find. An alternative method is to discrete the PDF function
into finite segments. ∫ ∞
Q(φ) = Q(ψ) fφ (ψ)dψ. (2.4)
−∞
∫ ∞ N
Õ −1 ∫ φi+1
Q(ψ) fφ (ψ)dψ = Q(ψ) fφ (ψ)dψ, φ1 = −∞, φ N = ∞.
−∞ i=1 φi
(2.5)
N
Õ −1 ∫ φi+1
= Q(φi ) fφ (ψ)dψ, ψi ∈ [φi, φi+1 ].
i=1 φi
5
2.2. THE CHEMISTRY COORDINATE MAPPING APPROACH CHAPTER 2. THEORY
Let us denote the PDF definite integration within segment [φi, φi+1 ] in Eq.2.5 as αi . Then Q(φ), the aver-
aged value of Q, can be approximately evaluated by a set of discrete magnitudes of Q(φi ) and corresponding
coefficients αi .
N
Õ ∫ ψi+1
Q(φ) = αi Q(φi ), αi ≡ fφ (ψ)dψ. (2.6)
i=1 ψi
Fig. 2.1. The concept of finite rate chemistry method without chemistry speedup.
The chemistry coordinate mapping (CCM) approach is a promising speedup method in reactive flow
simulation. In CCM method, a multidimensional thermodynamic space is adopted for solving chemistry in
phase space instead of physical space. This method provides an efficient and high precision mapping procedure
between the physical space and the chemistry phase space, each of the chemistry phase space corresponds to
one or more cells in physical space, resulting in a speedup of the numerical integration [1]. Fig.2.2 illustrates
the idea of CCM method. As shown in the second line, the composition variables in physical space at time
step tn are mapped into a thermodynamic space according to its value. Then, chemistry solver is applied for
source term from the second line to the third line, only based on the mapped thermodynamic space. In the last
step, the results are distributed back to physical space according to its original corresponding relationship.
6
2.3. THE COMBINATION OF PDF AND CCM CHAPTER 2. THEORY
φ1 φ2 φ3 t = tn
φ1 φ2 φ3 t = tn
α1 α2 α3
Fig. 2.3. The idea of the combination of PDF discretization and coordinate mapping approach.
Given any of the composition variable φ with expectation φ and variance σ, the expectation can be
approximated as the averaged value within the specific cell in physical space, while the variance of this
7
2.3. THE COMBINATION OF PDF AND CCM CHAPTER 2. THEORY
composition variable is not available in CFD system, and should to be modeled. Focusing on an arbitrary cell
in physical space, the composition variable states are rearranged in order of magnitudes φ1 < φ2 < ... < φ N .
Therefore, the expectation of any function Q of composition variable state Q(φ) can be piecewise fitted by a
linear interpolation L(φ) based on a set of discrete magnitudes Q(φi ). After a serieous of derivation (too long
to put into the report, if interesting, Email me.), the set of coefficients α solved.
0, φi < [φ − 3σ, φ + 3σ]
E φ (φ1 <φ<φ2 )−φ2 [Fφ (φ2 )−Fφ (φ1 )]
, φi = φ − 3σ
φ1 −φ2
< φ < φ φ
(φ ) − φ (φi+1 ) − Fφ (φi )
E φ i i+1 i+1 F
αi =
φi − φi+1 (2.7)
φi ∈ (φ − 3σ, φ + 3σ)
< φ < φ φ
E φ (φ i−1 i ) − i−1 Fφ (φ i ) − Fφ (φ i−1 )
,
−
φi−1 − φi
E (φ <φ<φ N )−φ N −1 [Fφ (φ N )−Fφ (φ N −1 )]
− φ N −1 , φi = φ + 3σ
φ N −1 −φ N
8
Chapter 3
Implementation
Here, we will investigate the structure of combustion model in OpenFOAM, and try to modify an existing
EDC combustion model to our stochastic reactor model.
OFv1806
cd $WM_PROJECT_DIR/src/combustionModels
The following steps are similar with the modification of ‘kOmegaSSTF’ for Turbulence model classes in
the tutorials of the course exercise. If you have installed ‘tree’ software, let us follow the instruction to look
into those classes structure by using ‘tree’ command.
tree $WM_PROJECT_DIR/src/combustionModels
Fig. 3.1 shows the tree structure of combustion models in OpenFOAM, where we can find the ‘laminar’,
or well stirred reactor (WSR) model. In this model, the composition variables (T, Y) in each computational
fluid dynamics (CFD) cell is regarded as homogeneous. The eddy dissipation concept (EDC) model is listed
as well. In EDC, the mixture within CFD cell is divided into two states Φ = Φ(T, Y), the volume of two
states and the state composition variables (T, Y) such as temperature and species mass fraction, are modeled
by local turbulence parameters.
As we can see in Fig. 3.2, the stochastic reactor can consist of various states. In theory, the estimation of
chemical reaction term will be more accurate if abundant stochastic states are used. From this viewpoint, the
concept of our stochastic reactor (StoR) model is similar to eddy dissipation concept (EDC), so we will copy
and revise the files which is related to ‘EDC’.
Therefore, we copy the whole directory into user project folder $WM_PROJECT_USER_DIR without
changing anything.
foam
cp -r --parents src/combustionModels $WM_PROJECT_USER_DIR
cd $WM_PROJECT_USER_DIR/src/combustionModels
9
3.1. THE STRUCTURE OF COMBUSTION MODEL LIBRARY CHAPTER 3. IMPLEMENTATION
$FOAM_SRC/combustionModels
combustionModel
CombustionModel
diffusion
diffusionMulticomponent
doc
eddyDissipationModelBase
eddyDissipationDiffusionModel
FSD
infinitelyFastChemistry
singleStepCombustion
zoneCombustion
noCombustion
laminar
laminar.C
laminar.H
laminars.C
PaSR
PaSR.C
PaSR.H
PaSRs.C
EDC
EDC.C
EDC.H
EDCs.C
Make
files
options
10
3.1. THE STRUCTURE OF COMBUSTION MODEL LIBRARY CHAPTER 3. IMPLEMENTATION
It takes about 2 minutes to finish the compilation. When the compilation is finished, we can check the
location of new compiled library by using ‘which’ and ‘grep’ command.
If you see the following information in the output, it means that new compiled ‘.so’ file can be found in
$FOAM_USER_LIBBIN folder and it can be used by existing solvers. The new compiled ‘.so’ file will be
used instead of the ones in the main installation, since the environment variable LD_LIBRARY_PATH points
at $FOAM_USER_LIBBIN directory before pointing at the original directory ($FOAM_LIBBIN).
1 / ∗ ∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗ OUTPUT INFORMATION ∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗ ∗ /
2 l i b c o m b u s t i o n M o d e l s . s o => $FOAM_USER_LIBBIN / l i b c o m b u s t i o n M o d e l s . s o . . .
φ(x2 ) = φ2 t = tn
φ1 φ2 φ3 t = tn
α1 α2 α3
φ∗ (x2 ) t = tn + ∆t
Now we need to find out the files which are related to the ‘EDC’, copy them and revise according to the
new model. We can do this by searching for keywords ‘EDC’ as below:
grep -r EDC
You will get the following results, where some of the repeat files are hidden and eddyDissipation-
ModelBase.C and eddyDissipationModelBase.H can be ignored because the key words are ‘CEDC’. Thus
EDC/EDC.C, EDC/EDC.H, EDC/EDCs.C and Make/files need to be modified. Those files are marked in the
directory tree with grey dotted line in Fig. 3.1.
1 / ∗ ∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗ OUTPUT INFORMATION ∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗ ∗ /
2 EDC / EDC . C : # i n c l u d e "EDC . H"
3 ...
4 EDC / EDC . H : Foam : : c o m b u s t i o n M o d e l s : : EDC
5 ...
6 EDC / EDCs . C : # i n c l u d e "EDC . H"
7 ...
8 eddyDissipationModelBase / eddyDissipationModelBase .C: CEDC_ ( . . .
9 ...
10 e d d y D i s s i p a t i o n M o d e l B a s e / e d d y D i s s i p a t i o n M o d e l B a s e .H: s c a l a r CEDC_
11 ...
12 Make / f i l e s : EDC / EDCs . C
Copy the EDC folder and rename it as StoR. Rename the files in StoR directory.
11
3.1. THE STRUCTURE OF COMBUSTION MODEL LIBRARY CHAPTER 3. IMPLEMENTATION
cp -r EDC StoR
mv StoR/EDC.C StoR/StoR.C
mv StoR/EDC.H StoR/StoR.H
mv StoR/EDCs.C StoR/StoRs.C
Then, we need to replace the keywords ‘EDC’ with ‘StoR’
By typing above command, the copy and revision of EDC/EDC.C, EDC/EDC.H and EDC/EDCs.C files
are finished. Then we need to add a new line
1 StoR / S t o R s . C
into Make/files, to let the compiler knows that a new added model ‘StoR’ needs to be compiled.
vi Make/files
wmakeLnInclude -u .
wmake
So far, a new combustion model named ‘StoR’ has been created, which includes the identical operation
with ‘EDC’ model but different name. Next, we will create a case to run ‘sprayFoam’ solver with ‘StoR’
model to test it.
12
3.2. THE CREATION OF A CASE WITH STOR MODEL CHAPTER 3. IMPLEMENTATION
pwd
It should be still in ‘$WM_PROJECT_USER_DIR/src/combustionModels’, since we will come back to
revise combustion model, you can choose jump to case path or stay here to run the case in distance. It
is important that we need to jump back to ‘$WM_PROJECT_USER_DIR/src/combustionModels’ directory
after finish this section. The command of this section is independent of current path.
Copy a spray combustion tutorial ‘aachenBomb’ to ‘$FOAM_RUN’ directory, renamed it as ‘aachen-
BombStoR’. Replace the constant/combustionProperties file from ‘SandiaD_LTS’ case, which employs a
‘EDC’ combustion model.
cp -r $FOAM_TUTORIALS/lagrangian/sprayFoam/aachenBomb \
$FOAM_RUN/aachenBombStoR
cp -r $FOAM_TUTORIALS/combustion/reactingFoam/RAS/SandiaD_LTS\
/constant/combustionProperties $FOAM_RUN/aachenBombStoR/constant
13
3.3. THE MODIFICATION OF STOR MODEL CHAPTER 3. IMPLEMENTATION
If the information in the output is like the following outputs and no error printed, it means that StoR model
has been added into combustion model.
1 / ∗ ∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗ OUTPUT INFORMATION ∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗ ∗ /
2 ...
3 C r e a t i n g c o m b u s t i o n model
4
5 S e l e c t i n g c o m b u s t i o n model StoR
6 Selecting chemistry solver
7 {
8 solver ode ;
9 method standard ;
10 }
11 ...
vi StoR/StoRs.C
This is a template file, a Static Member Data Enum for EDC combustion model version is defined (line
13-26), we do not need it any more, comments it as follows. Reserve the headers included and namespace
Foam dictionary.
1 / ∗ ∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗ StoRs .C ∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗ ∗ /
2
3 ...
4
5 # i n c l u d e " m a k e C o m b u s t i o n T y p e s . H"
6
7 # i n c l u d e " p s i R e a c t i o n T h e r m o . H"
8 # i n c l u d e " r h o R e a c t i o n T h e r m o . H"
9 # i n c l u d e " S t o R . H"
10
11 / / ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ S t a t i c Member Data ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ //
12 /∗
13 c o n s t Foam : : Enum
14 <
15 Foam : : c o m b u s t i o n M o d e l s : : S t o R v e r s i o n s
16 >
17 Foam : : c o m b u s t i o n M o d e l s : : S t o R v e r s i o n N a m e s
18 {
19 { S t o R v e r s i o n s : : v1981 , " v1981 " } ,
20 { S t o R v e r s i o n s : : v1996 , " v1996 " } ,
21 { S t o R v e r s i o n s : : v2005 , " v2005 " } ,
22 { S t o R v e r s i o n s : : v2016 , " v2016 " } ,
23 };
24
25 c o n s t Foam : : c o m b u s t i o n M o d e l s : : S t o R v e r s i o n s
14
3.3. THE MODIFICATION OF STOR MODEL CHAPTER 3. IMPLEMENTATION
26 Foam : : c o m b u s t i o n M o d e l s : : S t o R d e f a u l t V e r s i o n ( S t o R v e r s i o n s : : v2005 ) ;
27 ∗/
28
29 // ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ //
30
31 n a m e s p a c e Foam
32 {
33
34 makeCombustionTypes ( StoR , p s i R e a c t i o n T h e r m o ) ;
35 makeCombustionTypes ( StoR , r h o R e a c t i o n T h e r m o ) ;
36
37 }
38
39 / / ∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗ / /
Then open StoR/StoR.H file to modify the declaration of StoR class and its members. In this file, I only
modify the private data and functions.
vi StoR/StoR.H
15
3.3. THE MODIFICATION OF STOR MODEL CHAPTER 3. IMPLEMENTATION
36 s c a l a r truncationForPDF_ ;
37 s c a l a r F i e l d P _ i _ ; / / The p o s i b i l i t y f o r Zone i i n spanZoneForPDF ;
38 s c a l a r F i e l d T _ i _ ; / / The n o r m a l i z e d t e m p e r a t u r e v a l u e f o r Zone i ;
39
40 / / − F i l t e r parameter
41 laplaceFilter spaceFilter_ ;
42 s c a l a r d e v i a t i o n S i m i l a r C o e f f _ ; / / s i m i l a r i t y model f o r d e v i a t i o n ;
43
44 / /− volScalarField
45 v o l S c a l a r F i e l d Tsgs_ ;
46 v o l S c a l a r F i e l d Qdot_ ;
47 P t r L i s t < f v S c a l a r M a t r i x > R_ ;
48
49 / / P r i v a t e Member F u n c t i o n s
50
51 / / − Disallow copy c o n s t r u c t
52 StoR ( c o n s t StoR & ) ;
53
54 / / − Disallow d e f a u l t bitwise assignment
55 v o i d o p e r a t o r = ( c o n s t StoR & ) ;
56
57
58 / / − The f o l l o w i n g s a r e f o r S t o R c o m b u s t i o n model
59 / / − The f u n c t i o n s f o r p r e s u m e d PDF
60 tmp < s c a l a r > PDF_Norm ( s c a l a r , s c a l a r , s c a l a r ) ;
61 tmp < s c a l a r > PDF_Density ( s c a l a r , word ) ;
62 tmp < s c a l a r > PDF_Accumulate ( s c a l a r , word ) ;
63 tmp < s c a l a r > P D F _ E x p e c t i o n ( s c a l a r , word ) ;
64 tmp < s c a l a r > P D F _ E x p e c t i o n ( s c a l a r , s c a l a r , word ) ;
65 tmp < s c a l a r > PDF_Density ( s c a l a r , s c a l a r , s c a l a r , word ) ;
66 tmp < s c a l a r > PDF_Accumulate ( s c a l a r , s c a l a r , s c a l a r , word ) ;
67 tmp < s c a l a r > P D F _ E x p e c t i o n ( s c a l a r , s c a l a r , s c a l a r , word ) ;
68 tmp < s c a l a r > P D F _ E x p e c t i o n ( s c a l a r , s c a l a r , s c a l a r , s c a l a r , word ) ;
69 tmp < s c a l a r F i e l d > A l p h a _ C a l c u l a t i o n ( s c a l a r , s c a l a r , s c a l a r , word ) ;
70 tmp < s c a l a r F i e l d > N o r m T _ C a l c u l a t i o n ( s c a l a r , s c a l a r , s c a l a r , word ) ;
71
72
73 public :
74
75 / / − Runtime t y p e i n f o r m a t i o n
76 TypeName ( " S t o R " ) ;
77
78
79 / / Constructors
80
81 / / − C o n s t r u c t from components
82 StoR
83 (
84 c o n s t word& modelType ,
85 c o n s t fvMesh& mesh ,
86 c o n s t word& c o m b u s t i o n P r o p e r t i e s ,
87 c o n s t word& phaseName
88 );
89
16
3.3. THE MODIFICATION OF STOR MODEL CHAPTER 3. IMPLEMENTATION
90
91 / /− Destructor
92 v i r t u a l ~ StoR ( ) ;
93
94
95 / / Member F u n c t i o n s
96
97 / / − Correct combustion rate
98 v i r t u a l void c o r r e c t ( ) ;
99
100 / / − Fuel consumption r a t e matrix .
101 v i r t u a l tmp < f v S c a l a r M a t r i x > R ( v o l S c a l a r F i e l d& Y) c o n s t ;
102
103 / / − Heat r e l e a s e r a t e [ kg / m / s 3 ]
104 v i r t u a l tmp < v o l S c a l a r F i e l d > Qdot ( ) c o n s t ;
105
106 / / − Update p r o p e r t i e s f r o m g i v e n d i c t i o n a r y
107 v i r t u a l bool read ( ) ;
108
109 };
110
111
112 // ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ //
113
114 } / / End namespace c o m b u s t i o n M o d e l s
115 } / / End namespace Foam
116
117 // ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ //
As we can see, the header #include "laplaceFilter.H" has been added for the calculation of temperature
variance, the member variable spaceFilter_ is a laplaceFilter which depends on this header. The theory of
the variance calculation will be introduced in Eq.4.1, which is calculated from the temperature distribution.
Apart from that, we create a volScalarField Tsgs_ to store the variance of local temperature. The other private
data are PDF_Name_ and spanZoneForPDF_, which are the categories of presumed PDF and the amount
of stochastic states for each cells. The truncationForPDF_ is used to bound the temperature fluctuations of
stochastic states. Since there is a limitation of temperature in physic, but some of the PDF is unbounded, the
default value of truncationForPDF_ is unity, means that the temperature of stochastic states are limited in the
region of [T − 3σ, T + 3σ], where σ is the variance of the local temperature.
scalarField P_i_ and T_i_ are the most important value which is used to specific the possibility and
normalized temperature value for all the stochastic states. For example, we choose states T − σ, T and T + σ
as three temperature states, then it is possibility could be calculated according to Eq.2.7 and stored in P_i_.
In addition, two virables are created for the storage of heat release rate and species consumption for each
of the cells and species. There are Qdot_ and R_ respectively. Those two variables are the essential outputs
for the source term of species transportation and energy equation. They can be accessed by calling function
Qdot() and R(). Those two functions will be rewritten in StoR/StoR.C file.
Apart from that, you can found a series of private functions, such as PDF_Norm(scalar, scalar, scalar),
PDF_Density(scalar, word), Alpha_Calculation(scalar,scalar,scalar,word) and so on. Those are the stochastic
posibility P_i_ calculation functions, it is the implementation of Eq.2.7.
After modifying the StoR/StoR.H file, save it and open the last file StoR/StoR.C to edit by typing
vi StoR/StoR.C
17
3.3. THE MODIFICATION OF STOR MODEL CHAPTER 3. IMPLEMENTATION
4
5 # i n c l u d e " S t o R . H"
6 # i n c l u d e " f i x e d V a l u e F v P a t c h F i e l d s . H"
7 / / ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ Constructors ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ ∗ //
8
9 t e m p l a t e < c l a s s Type >
10 Foam : : c o m b u s t i o n M o d e l s : : StoR <Type > : : StoR
11 (
12 c o n s t word& modelType ,
13 c o n s t fvMesh& mesh ,
14 c o n s t word& c o m b u s t i o n P r o p e r t i e s ,
15 c o n s t word& phaseName
16 )
17 :
18 l a m i n a r <Type > ( modelType , mesh , c o m b u s t i o n P r o p e r t i e s , phaseName ) ,
19 PDF_Name_ ( t h i s −> c o e f f s ( ) . t e m p l a t e l o o k u p O r D e f a u l t <word >
20 ( " temperaturePDF " , " N o r m a l D i s t r i b u t i o n " ) ) ,
21 spanZoneForPDF_ ( 3 ) ,
22 truncationForPDF_ (2) ,
23 t r u n c a t i o n F o r P D F _ ( t h i s −> c o e f f s ( ) . l o o k u p O r D e f a u l t ( " t r u n c a t i o n F o r P D F " , 1 ) ) ,
24 / / The p o s i b i l i t y f o r Zone i i n spanZoneForPDF ;
25 P _ i _ ( spanZoneForPDF_ ) ,
26 / / The n o r m a l i z e d t e m p e r a t u r e v a l u e f o r Zone i ;
27 T _ i _ ( spanZoneForPDF_ ) ,
28 / / c o e f f _ =12 , means t h a t u s e n e a r 6 p o i n t s t o c a l c u l a t e t h e f i l t e r d d a t a
29 s p a c e F i l t e r _ ( mesh , 12 ) ,
30 d e v i a t i o n S i m i l a r C o e f f _ ( t h i s −> c o e f f s ( ) .
31 lookupOrDefault ( " deviationSimilarCoeff " , 1)) ,
32 Tsgs_
33 (
34 IOobject
35 (
36 " Tsgs " ,
37 mesh . t i m e ( ) . timeName ( ) ,
38 mesh ,
39 I O o b j e c t : : NO_READ,
40 I O o b j e c t : : AUTO_WRITE
41 ),
42 mesh ,
43 d i m e n s i o n e d S c a l a r ( " Tsgs " , dimTemperature , 0.0 ) ,
44 f i x e d V a l u e F v P a t c h F i e l d < s c a l a r > : : typeName
45 ),
46 Qdot_
47 (
48 IOobject
49 (
50 " Qdot " ,
51 t h i s −>mesh ( ) . t i m e ( ) . timeName ( ) ,
52 t h i s −>mesh ( ) ,
53 I O o b j e c t : : NO_READ,
54 I O o b j e c t : : NO_WRITE ,
55 false
56 ),
57 t h i s −>mesh ( ) ,
18
3.3. THE MODIFICATION OF STOR MODEL CHAPTER 3. IMPLEMENTATION
19
3.3. THE MODIFICATION OF STOR MODEL CHAPTER 3. IMPLEMENTATION
112 i f ( t h i s −> a c t i v e ( ) )
113 {
114 v o l S c a l a r F i e l d& T = t h i s −> t h e r m o ( ) . T ( ) ;
115 c o n s t v o l S c a l a r F i e l d T_org = t h i s −> t h e r m o ( ) . T ( ) ;
116 v o l S c a l a r F i e l d T _ F i l t e r = 0∗ T_org ;
117 T _ F i l t e r = s p a c e F i l t e r _ ( T_org ) ;
118 Tsgs_ = s q r t ( d e v i a t i o n S i m i l a r C o e f f _
119 ∗ mag ( s p a c e F i l t e r _ ( ( T _ F i l t e r − T_org ) ∗ ( T _ F i l t e r − T_org ) ) ) ) ;
120 Tsgs_ . c o r r e c t B o u n d a r y C o n d i t i o n s ( ) ;
121
122
123 scalar deltaT = 0.;
124 d e l t a T = t h i s −>mesh ( ) . t i m e ( ) . d e l t a T V a l u e ( ) ;
125
126 f o r ( l a b e l i = 0 ; i < spanZoneForPDF_ ; i ++)
127 {
128 / / Update t h e s t o c h a s t i c t e m p e r a t u r e
129 T = T _ i _ [ i ] ∗ T s g s _ + T_org ;
130 / / Run t h e r e a c t i o n c a l c u l a t i o n , g e t r e a c t i o n r a t e
131 t h i s −> c h e m i s t r y P t r _ −> s o l v e ( d e l t a T ) ;
132 / / Get t h e w e i g h t e d r e a c t i o n r a t e f o r a g r i d
133 Qdot_ . r e f ( ) += P _ i _ [ i ] ∗ t h i s −> c h e m i s t r y P t r _ −>Qdot ( ) ;
134 / / Get t h e w e i g h t e d r e a c t i o n s o u r c e t e r m f o r e a c h s p e c i e s
135 f o r A l l ( R_ , s p e c i e s I )
136 R_ [ s p e c i e s I ] += P _ i _ [ i ] ∗ t h i s −> c h e m i s t r y P t r _ −>RR( s p e c i e s I ) ;
137 }
138
139 T = T_org ;
140 }
141
142 }
143
144 t e m p l a t e < c l a s s Type >
145 Foam : : tmp <Foam : : f v S c a l a r M a t r i x >
146 Foam : : c o m b u s t i o n M o d e l s : : StoR <Type > : : R ( v o l S c a l a r F i e l d& Y) c o n s t
147 {
148 tmp < f v S c a l a r M a t r i x > t S u ( new f v S c a l a r M a t r i x (Y, dimMass / dimTime ) ) ;
149
150 f v S c a l a r M a t r i x& Su = t S u . r e f ( ) ;
151
152 i f ( t h i s −> a c t i v e ( ) )
153 {
154 const label specieI =
155 t h i s −> t h e r m o ( ) . c o m p o s i t i o n ( ) . s p e c i e s ( ) [ Y . member ( ) ] ;
156 Su += R_ [ s p e c i e I ] ;
157 }
158
159 r e t u r n tSu ;
160 }
161
162
163 t e m p l a t e < c l a s s Type >
164 Foam : : tmp <Foam : : v o l S c a l a r F i e l d >
165 Foam : : c o m b u s t i o n M o d e l s : : StoR <Type > : : Qdot ( ) c o n s t
20
3.3. THE MODIFICATION OF STOR MODEL CHAPTER 3. IMPLEMENTATION
166 {
167 r e t u r n Qdot_ ;
168 }
169
170
171 t e m p l a t e < c l a s s Type >
172 b o o l Foam : : c o m b u s t i o n M o d e l s : : StoR <Type > : : r e a d ( )
173 {
174 i f ( Type : : r e a d ( ) )
175 {
176 PDF_Name_ = t h i s −> c o e f f s ( ) . t e m p l a t e l o o k u p O r D e f a u l t <word >
177 ( " temperaturePDF " , " N o r m a l D i s t r i b u t i o n " ) ;
178 t r u n c a t i o n F o r P D F _ = t h i s −> c o e f f s ( ) . l o o k u p O r D e f a u l t
179 ( " truncationForPDF " , 1 ) ;
180 d e v i a t i o n S i m i l a r C o e f f _ = t h i s −> c o e f f s ( ) . l o o k u p O r D e f a u l t
181 ( " deviationSimilarCoeff " , 1);
182 spanZoneForPDF_ = 3 ;
183
184 P _ i _ = A l p h a _ C a l c u l a t i o n ( spanZoneForPDF_ , t r u n c a t i o n F o r P D F _ [ 0 ] ,
185 t r u n c a t i o n F o r P D F _ [ t r u n c a t i o n F o r P D F _ . s i z e ( ) − 1 ] , PDF_Name_ ) ;
186 T _ i _ = N o r m T _ C a l c u l a t i o n ( spanZoneForPDF_ , t r u n c a t i o n F o r P D F _ [ 0 ] ,
187 t r u n c a t i o n F o r P D F _ [ t r u n c a t i o n F o r P D F _ . s i z e ( ) − 1 ] , PDF_Name_ ) ;
188
189 I n f o << " S t o R C o m b u s t i o n Model c o n s t r u c t e d : p r e s u m e d PDF name i s "
190 << PDF_Name_ << " and T r u n c a t i o n s a r e " << t r u n c a t i o n F o r P D F _
191 << e n d l
192 << " S t o R p o s i b i l i t y c o e f f a r r a y a r e " << P _ i _
193 << " n o r m a l i z e d v a r i a n c e s a r e " << T _ i _ << e n d l ;
194
195 return true ;
196 }
197 else
198 {
199 return false ;
200 }
201 }
202
203 ...
Recompile the combustion model with new revised StoR model
wmake
Now, you can see the print information for new developed StoR model, it is generated by construction
function when a StoR class object is created.
1 / ∗ ∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗ OUTPUT INFORMATION ∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗ ∗ /
2 ...
3
4 C r e a t i n g c o m b u s t i o n model
21
3.3. THE MODIFICATION OF STOR MODEL CHAPTER 3. IMPLEMENTATION
5
6 S e l e c t i n g c o m b u s t i o n model StoR
7
8 ...
9
10 S e l e c t i n g ODE s o l v e r s e u l e x
11 using i n t e g r a t e d reaction r a t e
12 StoR C o m b u s t i o n Model c o n s t r u c t e d :
13 p r e s u m e d PDF name i s N o r m a l D i s t r i b u t i o n
14 and T r u n c a t i o n s a r e 2( −1 1 )
15 p o s i b i l i t y coeff array are 3(0.24 0.52 0.24)
16 n o r m a l i z e d v a r i a n c e s a r e 3( −1 0 1 )
17 ...
22
Chapter 4
Tutorials
In Chapter 3, we use one tutorial case ‘aachenBomb’ to generate two cases ‘aachenBombStoR’ and ‘aachen-
BombCCM’ for StoR model and CCM approach separately. We will then dig into the tutorial case and explain
the case geometry, injector configuration and chemical mechanism for a typical sprayFoam combustion case.
Then, we will create our third case ‘aachenBombCCMStoR’ to run the ‘sprayFoam’ solver with both StoR
model and CCM approach.
23
4.1. CASE INTRODUCTION CHAPTER 4. TUTORIALS
24 {
25 model1
26 {
27 type coneNozzleInjection ;
28 SOI 0;
29 massTotal 6 . 0 e −6;
30 p a r c e l B a s i s T y p e mass ;
31 injectionMethod disc ;
32 flowType flowRateAndDischarge ;
33 outerDiameter 1 . 9 e −4;
34 innerDiameter 0;
35 duration 1 . 2 5 e −3;
36 position (0 0.0995 0 ) ;
37 direction ( 0 −1 0 ) ;
38 p a r c e l s P e r S e c o n d 20000000;
39 flowRateProfile table
40 (
41 (0 0.1272)
42 ( 4 . 1 6 6 6 7 e −05 6.1634)
43 ( 8 . 3 3 3 3 3 e −05 9.4778)
44 (0.000125 9.5806)
45 ...
46 (0.001251 0.0000)
47 (1000 0.0000)
48 );
49
50 Cd constant 0.9;
51
52 thetaInner constant 0.0;
53 thetaOuter constant 10.0;
54
55 sizeDistribution
56 {
57 type RosinRammler ;
58
59 RosinRammlerDistribution
60 {
61 minValue 1 e −06;
62 maxValue 0.00015;
63 d 0.00015;
64 n 3;
65 }
66 }
67 }
68 }
69
70 d i s p e r s i o n M o d e l none ;
71
72 patchInteractionModel standardWallInteraction ;
73
74 heatTransferModel RanzMarshall ;
75
76 compositionModel singlePhaseMixture ;
77
24
4.1. CASE INTRODUCTION CHAPTER 4. TUTORIALS
78 phaseChangeModel l i q u i d E v a p o r a t i o n B o i l ;
79
80 s u r f a c e F i l m M o d e l none ;
81
82 a t o m i z a t i o n M o d e l none ;
83
84 breakupModel R e i t z D i w a k a r ; / / ReitzKHRT ;
85
86 s t o c h a s t i c C o l l i s i o n M o d e l none ;
87
88 radiation off ;
89
90 standardWallInteractionCoeffs
91 {
92 type rebound ;
93 }
94
95 RanzMarshallCoeffs
96 {
97 BirdCorrection true ;
98 }
99
100 singlePhaseMixtureCoeffs
101 {
102 phases
103 (
104 liquid
105 {
106 C7H16 1;
107 }
108 );
109 }
110
111 liquidEvaporationBoilCoeffs
112 {
113 enthalpyTransfer enthalpyDifference ;
114
115 activeLiquids ( C7H16 ) ;
116 }
117
118 ReitzDiwakarCoeffs
119 {
120 s o l v e O s c i l l a t i o n E q yes ;
121 Cbag 6;
122 Cb 0.785;
123 Cstrip 0.5;
124 Cs 10;
125 }
126 ...
127 }
128
129
130 cloudFunctions
131 {}
25
4.1. CASE INTRODUCTION CHAPTER 4. TUTORIALS
132
133
134 / / ∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗ / /
The constantProperties dictionary is used to define the liquid properties in the injector, such as temperature,
density and heat capacity. The dictionary subModels contains the definition of injector parameter, break-up
model etc. Table.4.1 shows the 12 models for particles force.
Model
BrownianMotion
SRF
SaffmanMeiLiftForce
TomiyamaLift
distortedSphereDrag
gravity
nonInertialFrame
nonSphereDrag
paramagnetic
pressureGradient
sphereDrag
virtualMass
Table.4.2 shows the available injector models. They define the shape of injector nozzle, whether it is a
cone nozzle or a patch or set manually. The SOI (Line 28) is a abbreviation of ‘start of injection’, defining the
injection time after the start of simulation. massTotal is the total mass of the injection process which has a
dimension of kg, the SOI time and massTotal will combine with flowRateProfile table to get the mass flow rate
and calculate how much mass of fuel should be injected at each time step. injectionMethod is either point or
disc. flowType is a very import parameter and it is used to calculate the partical initial velocity profile. Three
choices are available: ‘constantVelocity’, ‘pressureDrivenVelocity’ or ‘flowRateAndDischarge’. It means that
the initial velocity can be specified with a constant value or calculate from the pressure difference between
injector and ambient pressure. ‘flowRateAndDischarge’ means that the velocities of particles are calculated
from flow rate profile. It is worth mentioning that those velocity are the magnitude and the direction of it are
calculated from a random process according to the injector type and cone angle.
Model
cellZoneInjection
coneInjection
coneNozzleInjection
fieldActivatedInjection
inflationInjection
injectedParticleDistributionInjection
injectedParticleInjection
manualInjection
none
patchFlowRateInjection
patchInjection
The outerDiameter and innerDiameter are used to specificed the size of the injector. Since we chose it
as coneNozzleInjection, the shape of the injector is defined as a ring with a inner circle and outer circle and
26
4.1. CASE INTRODUCTION CHAPTER 4. TUTORIALS
fuel is injected between the inner ring and outer ring. duration is the valid injection duration. position is
the location of injector, and the direction is the main axis for fuel injection. parcelsPerSecond is an esential
parameter. Since the total number of particles is too many to captured one by one in reality, we imagine a
parcel to contain some particels those have the same size, velocity and thermal properties. This is a kind of
simplication, the parcelsPerSecond defines the parcel number, the more parcel it has the less particles in each
parcel are. flowRateProfile table consists of a series of vectors with two components, the left one is the time
(dimension, second) and the right side is the height of profile. There is no physical meaning for the value of
the right side, it will be normalized according to duration time and massTotal to get the mass injection at each
time step by interpolation.
The parameter Cd is the charge coefficient and it has a value between 0 and 1, determing the intial velocity
magnitude if we chose the flowType as flowRateAndDischarge. thetaInner and thetaOuter are the shape of
corresponding spray cone, the cone is regarded as hollow, which has a inner taper angle and outer taper angle.
Model
RosinRammler
binned
exponential
fixedValue
general
massRosinRammler
multiNormal
normal
uniform
sizeDistribution is the dictionary for the specification of initial particle size. Table.4.3 shows the 9 available
distributions. If RosinRammler is choosen, the particle size will be distributed randomly according to the
RosinRammler size distribution funtion. In some case, we may set it as an uniform distribtuion, it means that
the initial particle size is only controlled by breakup and evaporation process.
The following models configuration are the definition of models for particles after injector, including the
break-up model, evapoarion model and collision model. Some of it can be found in Per Carlsson’s report [5].
As we can see in singlePhaseMixtureCoeffs dictionary, the fuel n-Heptane (C7 H16 ) is injected.
After injection and evaporation, liquid fuel will transform to gas phase and react with oxygen, the reaction
of the gas phase are defined in constant/thermalphysicalProperties.
1 / ∗ ∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗ thermophysicalProperties ∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗ ∗ /
2 ...
3 CHEMKINFile "$FOAM_CASE / c h e m k i n / chem . i n p " ;
4 CHEMKINThermoFile "$FOAM_CASE / c h e m k i n / t h e r m . d a t " ;
5 CHEMKINTransportFile "$FOAM_CASE / c h e m k i n / t r a n s p o r t P r o p e r t i e s " ;
6
7 newFormat yes ;
8
9 inertSpecie N2 ;
10
11 liquids
12 {
13 C7H16 ;
14 }
15
16 solids
17 {}
18 / / ∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗ / /
27
4.2. CASE MODIFICATION CHAPTER 4. TUTORIALS
where we can found that the location of CHEMKINFile, CHEMKINThermoFile and CHEMKINTrans-
portFile are specified in line 3-5, the solver will call for the functions in thermal class to read thermophysi-
calProperties and find the chemkin file location, read the reactions, species and its thermal properties from
those three files. It is worth mentioning that in the old version of OpenFOAM, CHEMKINTransportFile is not
necessary. The liquids dictionary defines the liquid phase properties which is needed in OpenFOAM liquid
library.
Let’s have a look at the CHEMKINFile, which is located in "$FOAM_CASE/chemkin/chem.inp", ELE-
MENTS keyword is the list of total elements in reaction solver system, SPECIE list is the reaction species
such as fuel oxygen products and intermidiate products. REACTIONS defines the total reaction in the system.
Each reaction consists of reactants products and three coefficients which is corresponding to the Arrhenius
theory. Some of the reactions contain the reverse reaction. In this tutorial, a one step reaction is employed.
1 / ∗ ∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗ $FOAM_CASE / c h e m k i n / chem . i n p ∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗ ∗ /
2 ELEMENTS
3 H O C N AR
4 END
5 SPECIE
6 C7H16 O2 N2 CO2 H2O
7 END
8 REACTIONS
9 C7H16 + 11O2 => 7CO2 + 8H2O 5 . 0 0 E+8 0 . 0 15780.0! 1
10 FORD / C7H16 0 . 2 5 /
11 FORD / O2 1 . 5 /
12 END
The explanation and modifaction of combustionProperties and chemistryProperties files will be introduced
in section 4.2
foam
cp -r $FOAM_TUTORIALS/lagrangian/sprayFoam/aachenBomb\
$FOAM_RUN/aachenBombCCMStoR
cd $FOAM_RUN/aachenBombCCMStoR
Go into the folder and revise the combustionProperties file as follows. In this revised file, combustion
model is set as StoR and active is set as true which means that the chemical reaction calculation is on.
Sometime we need to turn it off, for example, when we use sprayFoam to simulate the spray and evaporation
process without combustion.
vi constant/combustionProperties
28
4.2. CASE MODIFICATION CHAPTER 4. TUTORIALS
where C is a scale coefficient which can be determined from dynamical method [6].edenotes the filtered
value with filter width e
∆, accordingly,bdenotes the filtered value with filter width b
∆. In this work, the method
∆ = 2e
[7] is applied, with the assumption that b ∆, then:
1
φei jk = 6φ̃i, j,k + φ̃i−1, j,k + φ̃i+1, j,k + φ̃i, j−1,k + φ̃i, j+1,k + φ̃i, j,k−1 + φ̃i, j,k+1 .
b (4.2)
12
After revising the combustionProperties, lets come to modify the chemistryProperties file which is located
in constant/chemistryProperties and it is used to specify the chemistry model. We only need to add a line in
chemistryType dictionary to turn CCM on and the other coefficients will be read from constant/CCMProperties
files.
vi constant/chemistryProperties
29
4.2. CASE MODIFICATION CHAPTER 4. TUTORIALS
19 eps 0.05;
20 }
Let’s have a look at constant/CCMProperties file, which will be loaded at the construction of CCM class
object or calling readCCMproperties() function when we turn CCM on in chemistryProperties. In this file, the
dimension of CCM is specifed by min:max:SpanZoneJe, min:max:SpanZoneT and min:max:SpanZoneXi.
These are three mapping dimension for mass fraction, temperature and scalar dispassion rate. Apart from that,
sometimes we need the concentration of some key species as additional CCM dimension. More information
about that can be found in [1]. In this case, we use three basic dimension and inert species N2 as CCM
mapping dimension.
1 / ∗ ∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗ c o n s t a n t / CCMProperties ∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗ ∗ /
2
3 ...
4
5 babaCCM on ;
6 ratioOxygenToCarbonElementInFuel 0 ; / / f u e l : C7H16 ;
7 chemicallyFrozenT chemicallyFrozenT [0 0 0 1 0] 6 0 0 . ;
8 maxFlammabilityLimit maxFlammabilityLimit [0 0 0 0 0] 20;
9 minFlammabilityLimit m i n F l a m m a b i l i t y L i m i t [ 0 0 0 0 0 ] 1 e −6;
10
11 ...
12
13 min : max : S p a n Z o n e J e 0 20 0 . 0 1 ;
14 min : max : SpanZoneT 300 3000 5 ;
15 min : max : SpanZoneXi 0 1 0.025;
16
17 ...
In line 5, we can see the babaCCM is a switch for CCM application, chemicallyFrozenT is the temperature
limit for the reaction, when the temperature of the cell is lower then chemicallyFrozenT, we think the chemical
reaction is negligible, the same with maxFlammabilityLimit and minFlammabilityLimit, they define the mass
fraction limitation, when it is lower than minFlammabilityLimit or higher than maxFlammabilityLimit, it is
a inert cell, the chemical reaction is negligible. All of those inert cells will be mapped into one CCM cell.
After modifying those combustionProperties, chemistryProperties and CCMProperties, the case setup is
done. But for convenience, we create two batch files to run the case automatically.
Create two batch files and edit them by using ‘touch’ and ‘vi’ command.
vi Allrun
vi Allclean
30
4.2. CASE MODIFICATION CHAPTER 4. TUTORIALS
3 # ! / bin / sh
4 cd ${0% / ∗ } | | e x i t 1 # Run f r o m t h i s d i r e c t o r y
5 . $WM_PROJECT_DIR / b i n / t o o l s / C l e a n F u n c t i o n s # Tutorial clean functions
6
7 cleanCase
8
9 #−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−
Allocate execution rights to the batch files by using command ‘chmod’, check the privilege of Allclean
and Allrun files:
You can get the following results, means that batch files is executable now.
1 / ∗ ∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗ OUTPUT INFORMATION ∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗∗ ∗ /
2 −rwxr −xr −x 1 . . . . . . 243 nov 24 1 2 : 0 2 A l l c l e a n ∗
3 −rwxr −xr −x 1 . . . . . . 289 nov 24 1 2 : 0 2 A l l r u n ∗
Run the case and wait for completion, see the usage of StoR combustion model CCM chemistry approach,
and find out the total execution time.
./Allrun
more $FOAM_RUN/aachenBombCCMStoR/log.sprayFoam
tail $FOAM_RUN/aachenBombCCMStoR/log.sprayFoam
31
4.3. RESULTS AND DISCUSSION CHAPTER 4. TUTORIALS
30 r h o max / min : 2 9 . 3 5 1 2 8 . 9 7 7 7 9
31 smoothSolver : ...
32 smoothSolver : ...
33 E x e c u t i o n T i m e = 2 5 8 0 4 . 4 s ClockTime = 25805 s
34
35 p a r t i c l e D i s t r i b u t i o n d i s t r i b t i o n 1 output :
36 End
In order to compare the results and computational efficiency under the usage of combustion model and
chemistry speedup approach, we can run a default tutorial case ‘aachenBomb’ without any modification as a
contrast. The command is as follows:
cp -r $FOAM_TUTORIALS/lagrangian/sprayFoam/aachenBomb\
$FOAM_RUN/aachenBomb
cd $FOAM_RUN/aachenBomb
cp $FOAM_RUN/aachenBombCCMStoR/All* $FOAM_RUN/aachenBomb
./Allclean
./Allrun
Fig.4.1 shows the temperature variance distribution calculated by StoR combustion model at ignition time.
The larger variance indicates the strong turbulence interaction. This fluctuation will affect the ignition time.
This figure shows that the temperature variance along the liquid particles is not negligible. StoR and PaSR
combustion can take turbulence interaction into account, in theory, therefore they can predict ignition time
more correct.
Fig.4.2 shows the active CCM zones in computational domain at ignition time. The cell with same zone
number share identical CCM zone. As can be seen, all of the blue color share one CCM zone which will be
calculate only once. The maximum zone number is 5900, while the total cell is 160000. This will speed up
the reaction calculation more than 30 times.
32
4.3. RESULTS AND DISCUSSION CHAPTER 4. TUTORIALS
Fig. 4.2. The active zone number in CCM map for the aachenBombCCM case.
33
4.3. RESULTS AND DISCUSSION CHAPTER 4. TUTORIALS
Fig. 4.3. Temperature distribution of the case with StoR combusion model.
Fig. 4.4. Temperature distribution of the case with PaSR combusion model.
Fig. 4.5. Temperature distribution of the case with WSR combusion model.
34
Study questions
35
Bibliography
[1] M. Jangi and X.-S. Bai, “Multidimensional chemistry coordinate mapping approach for combustion
modelling with finite-rate chemistry,” Combustion Theory and Modelling, vol. 16, no. 6, pp. 1109–1132,
2012.
[2] S. Xu, S. Huang, R. Huang, W. Wei, X. Cheng, Y. Ma, and Y. Zhang, “Estimation of turbulence
characteristics from piv in a high-pressure fan-stirred constant volume combustion chamber,” Applied
Thermal Engineering, vol. 110, pp. 346–355, 2017.
[3] D. Haworth, “Progress in probability density function methods for turbulent reacting flows,” Progress in
Energy and Combustion Science, vol. 36, no. 2, pp. 168–259, 2010.
[4] S. B. Pope, “Pdf methods for turbulent reactive flows,” Progress in energy and combustion science,
vol. 11, no. 2, pp. 119–192, 1985.
[5] C. P., “A dieselfoam tutorial.” In Proceedings of CFD with OpenSource Software, 2008, Edited by Nilsson.
H., 2008.
[6] C. D. Pierce and P. Moin, “A dynamic model for subgrid-scale variance and dissipation rate of a conserved
scalar,” Physics of Fluids, vol. 10, no. 12, pp. 3041–3044, 1998.
[7] H. Forkel and J. Janicka, “Large-eddy simulation of a turbulent hydrogen diffusion flame,” Flow, Turbu-
lence and Combustion, vol. 65, no. 2, pp. 163–175, 2000.
36