erc seminar sparse analytical jacobian - federico perini...outline motivation and challenges the...
TRANSCRIPT
SpeedCHEMSpeedCHEMA Sparse Analytical Jacobian Chemistry code
for Engine Simulations with Detailed Chemistry
Federico PeriniDipartimento di Ingegneria “Enzo Ferrari”
University of Modena, Italy
University of Wisconsin-Madison Engine Research Center, October 9th 2012
1
October 9th, 2012
Outline Motivation and challenges
Outline
The Sparse Analytical Jacobian approach Chemical Kinetics for Internal Combustion Engine simulations Sparsity and structure of the problem’s Jacobian matrix Effect of reaction mechanism size on sparsity
A d f h l i f h i l ki i i SA A code for the solution of chemical kinetics using SAJ Validation at adiabatic constant-volume reactors ODE solver choice, accuracy and problems
Modelling of a Heavy-Duty Diesel Engine CFD simulation methodology and grid characteristics Impact of grid resolution, and mechanism dimensions
Conclusions
2
Motivation and challengesMotivation and challenges New combustion concepts (HCCI/PCCI, RCCI) show impressive improvements in
conversion efficiencyy ICE indicated efficiency >50% strong dependency on fuel chemistry and local mixture reactivity
i l / h l i l b ti d l l k f l ti i d lli simple/phenomenological combustion models lack of resolution in modelling: the whole range of operating conditions
of practical systems presence of exhaust gases in the mixture Sizes of biofuels mechanisms presence of exhaust gases in the mixture simultaneous operation with multiple fuels
Practical reaction mechanisms for104
r MD +C H
methyl 9 decenoate (LLNL)methyl esters (NUI)
2000 to 2008before 2000after 2008
(from Perini, Ph.D.Thesis, 2011)
Internal Combustion Enginesimulations range from 30 to 200 species 103
104
f rea
ctio
ns, n
nC7H16
methyl cyclohexane (LLNL)
MB (LLNL)
MD (LLNL)methyl 5 decenoate (LLNL)
small hydrocarbons (Konnov)MB (NUI)
after 2008
p Total CPU times typically unviable for practical
engineering design (cases should run overnight)
102
10
num
ber o
fethanol (LLNL)
methyl formate (LLNL)
dimethyl carbonate (LLNL)
DME (LLNL)
ethanol (Saxena)
biodiesel (Golovitchev)
Ethers (NUI)
2012-01-0143101 102 103 104
10
number of species, n s
nr = 5 ns
ns = 30 200
Chemical Kinetics in ICE CFD
Usually part of an operator-splitting scheme Each cell is treated as an adiabatic well-stirred
reactor◦ embarassingly parallel problem
KineticsMechanism
g y p p◦ very stiff IVP◦ only overall changes in species mass fractions and
internal energy are passed to the flow solver
Approach to the Approach to the
internal energy are passed to the flow solver
FluidFlow
solverGrid
ODE solver
ppsolution should be
tailored to the problem
ppsolution should be
tailored to the problem
4
solver
Sparse Analytical Jacobian approach Chemical Kinetics is a sparse problem => Jacobian matrix
ERC n-heptane LLNL n-heptane LLNL PRF29 x 52 160 x 1540 1034 x 4236
Mechanism n n non-zero sparsity Usually not more than 3 4 Mechanism ns nr non zero sparsity1. ERC n-heptane 29 52 412 54.2%2. LLNL n-heptane 160 1540 3570 86.2%3 LLNL PRF 1034 4236 22551 97 9%
Usually, not more than 3-4 species per reaction
Significant even at small
5
3. LLNL PRF 1034 4236 22551 97.9%4. LLNL MD 2878 8555 166703 99.4% mechanisms
Jacobian matrix sparsity effectsJ p y
100
101
Analytical JacobianFinite difference JacobianODE system fun 103
104
ns3
ns2
10-2
10-1
valu
atio
n [s
]
ODE system fun.
ERC
LLNLreducedn-hept 102
10
me,
18
IVPs
[s]
LLNLdetailed
PRF
LLNLreducedn-hept
s
ns2
ns
10-5
10-4
10-3
time
per e
v
LLNLmethyl
decanoate
ERCn-hept
LLNLdetailed
PRF100
101
tota
l CPU
tim
ERCn-hept
PRF
101 102 103 10410-6
10
number of species
PRF
101 102 10310-1
number of species
Analytical JacobianFinite difference Jacobian
Reduce scaling of the computational demand for evaluating the Jacobian matrix: ns
2 => ns
Reduce matrix storage requirements: ns2 => ns
Scaling of the costs for matrix factorization: ns3 => ns
I ( d i ) f N ’ i i h d
6
Improve (quadratic) convergence of Newton’s iterative method
Tabulation of temperature-dependentquantitiesquantities
Interpolation errors can be very low e g at degree 4 interpolation Interpolation errors can be very low e.g. at degree-4 interpolation
Fixed temperature steps make storage simpler, data contiguous, and interpolating polynomial coefficients simple to compute
2012-01-1974
CPU time reduction of more than 1 order of magnitude
Tabulation of temperature-dependentquantities II effect on total CPU timequantities II – effect on total CPU time
6%CPU time efforts, LLNL n-heptane mech.
50%44%44%
numerical factorizationODE function and Jacobiansolver-related
The relative importance of tabulation decreases at increasing mechanism dimensions
Anyway, it accounts for about -50% CPU time in comparison with the non-tabulated case
At large reaction mechanisms, the solution of the linear system accounts for almost 50% time
Results: constant-volume reactors 18 ignition cases for each mechanism
p0 = 2.0, 20.0 barT 750 1000 1500 K
100LLNL PRF mech.
COC8H18
C7H16
T0 = 750, 1000, 1500 K 0 = 0.5, 1.0, 2.0 10-5
frac
tions
[-] CO
HO2
OH
8 18
H2O
100ERC n-heptane mech.
15
10-10
mol
e f
CHEMKINSpeedCHEM
OH
CO210-5
10
ns [-
]
C7H16 CO
H2O
0 0.002 0.004 0.006 0.008 0.0110-15
Time [s]
100LLNL n-heptane mech.
10-10
mol
e fr
actio
n
OH
HO2
10-5
tions
[-]
C7H16
H2O
CO
0 0.002 0.004 0.006 0.008 0.0110-15
Time [s]
m
CHEMKINSpeedCHEMCO2
10-10
mol
e fr
act
HO2OH
Time [s]
Program CHEMKIN-II present codeODE solver VODE LSODESrelative tolerance 10-4 10-4
9 0 0.002 0.004 0.006 0.008 0.0110-15
Time [s]
CHEMKINSpeedCHEMCO2
relative tolerance 10 4 10 4
absolute tolerance 10-13 10-13
Results: constant-volume reactors II Almost linear speedup in comparison with a reference code that uses FD
103
104
102
103
SpeedCHEMCHEMKINspeedup
ns
102
10
U ti
me
[s]
101
10
dup
fact
or
p p
ERCn-heptane
LLNL
100
101C
PU
10-1
100
spee
LLNLPRF
LLNLn-heptane
101
102
103
ns
At typical mechanism dimension, the speedup is of almost one order ofmagnitude
Nota Bene: two different solvers were used!
10
Nota Bene: two different solvers were used!
Results: constant-volume reactors III10
6
Chemkin-PROCantera
104
me
[s]
Present code (LSODES)Chemkin-II
LLNLMD
102C
PU ti
m
ERCn-heptane
ns3
100
p
LLNLn-heptane
ns2
Program Cantera Chemkin-PRO CHEMKIN-II SpeedCHEM
101
102
103
10410
ns
g p
ODE solver CVODE Internal(DASPK?) VODE LSODES
relative tolerance 10-4 10-4 10-4 10-4
11
absolute tolerance 10-13 10-13 10-13 10-13
* All cases run on a 32-bit 3.0GHz Pentium IV machine with 1GB RAM
Different solvers do have differentperformanceperformance…
12
14 x 104 ERC mech, ns = 29, nr = 52
integrator steps 1 9
2ERC mech, ns = 29, nr = 52
6
8
10
12
mbe
r of
[-]
integrator stepsmatrix decompfunction evalsJacobian evals
1.6
1.7
1.8
1.9
U ti
me
[s]
0
2
4
6
num
1.3
1.4
1.5CPU
DASPK GAM LSODES MEBDF RADAU5 RODAS VODES0
DASPK GAM LSODES MEBDF RADAU5 RODAS VODES
All of the solvers have been implemented sparse solution of All of the solvers have been implemented sparse solution oflinear systems (Yale sparse matrix package, 1983)
The same truncation error handling has different meaningsg g
ATOLtyRTOLtyty nnn ˆ
… and stricter tolerances do not alwaysmean better resultsmean better results
1025
error (species)40
CPU time
casesi
n tdTT 01
1015
1020
error (species)error (temperature)
30
35CPU time
casesi
sn t njj
i iT
dYY
dTt
0
10 0
1
105
1010
erro
r val
ue
20
25
CPU
tim
e [s
]
i j j
jj
iY d
Yt10
10
10-5
100
10
15
10-15
10-10
10-5
10-10
relative tolerance, RTOL
10
-1510
-1010
-55
LLNL n-heptane mech
SpeedCHEM + LSODES solver
Reference solution has RTOL = 1d 15 Reference solution has RTOL = 1d-15
Modelling of a Heavy-Duty Diesel Engineg y y g
Caterpillar SCOTE 3401 Engine detailsEngine type direct injection diesel
Extensive experimental measurementsby Hardy, UW-ERC (SAE 2006-01-
Engine type direct-injection diesel
Number of cylinders 1
Valves per cylinder 4
Bore x Stroke [mm] 137 2 x 165 1 E i ti diti
0026)
Bore x Stroke [mm] 137.2 x 165.1
Conrod length [mm] 261.6
Compression ratio [-] 16:1
Unit displacement [L] 2.44
Engine operating conditions
Rotating speed [rev/min] 1737
Engine load [-] 57%p [ ]
Chamber Turbulence Quiescent
Piston bowl geometry Mexican hat
Intake temperature [K] 305.15
Injection rate [g/s] 1.94
Pilot injection start [°atdc] -65 -50
Pilot injection length [s] 1000 1450
Main injection start [°atdc] -5 20
Main injection length [s] 1950
EGR f ti 0 %
Two-stage combustion High sensitivity to emissions No interaction between spray jets EGR fraction 0 %
Boost pressure [kPa] 186.2 220.6
No interaction between spray jets
pilot SOI, main SOI, boost pressure
14
sweeps
CFD simulation setupp KIVA-4 code developed at LANL (Torres & Trujillo, JCP 2006)
Model improvements Model improvements Detailed chemistry capability using CHEMKIN-II (CONV) orpresent code Dynamic injection spray angle computation (Reitz and Bracco, SAE790494) Smooth grid snapping algorithm
Diesel fuel modelling tetradecane (C14H30) liquid spray properties n-heptane (nC7H16) ignition chemistry
NOx formation mechanism from GRI-mech 5 additional species, 12 reactions
Grid Coarse Refined
Cells at BDC 16950 42480
15
Average resolution 2.2 mm 1.1 mm
Azimuth resolution 4.0 deg 3.3 deg
Results: Caterpillar SCOTE 3401p
140
160ERC n-heptane mech., coarse mesh
ar) 420
480
/CA
)
experimentCHEMKIN-II
t d25
30ERC n-heptane
350
400LLNL n-heptane (4CPU)
chemkinpresent code
60
80
100
120
er p
ress
ure
(b
180
240
300
360
eat R
elea
se (J
/present code
15
20
time
[h]
200
250
300
-75.4%-48.8%
0
20
40
60
In-c
ylin
d
0
60
120
180
Rat
e of
He
nj 5
10CPU
t
100
150
160ERC n-heptane mech., refined mesh
480
i t
-80 -60 -40 -20 0 20 40 60 80
min
CA degrees ATDC coarse refined0
5
coarse refined
0
50
80
100
120
140
ress
ure
(bar
)
240
300
360
420
Rel
ease
(J/C
A)experiment
CHEMKINpresent code
Excellent agreement of the new solver coupling vs. Chemkin-II
20
40
60
80
In-c
ylin
der p
r
60
120
180
240
Rat
e of
Hea
t R
Average CPU time reduction (includedflow-field part): 75 4% (LLNL) 48 8% (ERC)
16
0 0
-80 -60 -40 -20 0 20 40 60 80
min
j
CA degrees ATDC
75.4% (LLNL) 48.8% (ERC)
Caterpillar SCOTE 3401: coarse vs. refined
refined grid’s peak in AHRR due to ignition ofalmost-quiescent mixture in the squish region Injection axis cutplane, -16°ATDC
volume averaging and reduced spray penetration in the coarse grid reduces the AHRR peak and delays ignition
160LLNL n-heptane mech., present code
480
100
120
140
sure
(bar
)
300
360
420
ase
(J/C
A)experiment
coarse meshrefined mesh
40
60
80
100
linde
r pre
ss
120
180
240
300
f Hea
t Rel
ea0
20
40
In-c
yl
0
60
120
Rat
e o
nj
In both grids the fuel vapor jet isdeviated to the cylinder head
17
-80 -60 -40 -20 0 20 40 60 80
mi
CA degrees ATDC
Caterpillar SCOTE 3401: NOx emissionsp x pilot pulse SOI main pulse SOI35
40
Experimentcoarse, ERC, present coderefined ERC present code
Parameter sweeps
boost pressure
20
25
30
Ox [g
/kg f]
refined, ERC, present coderefined, ERC, CHEMKINcoarse, LLNL, present coderefined, LLNL, present codecoarse, LLNL, CHEMKIN
ERC mechanism+ refined grid case( ) outperforms the others
5
10
15NO
( ) p◦ peak in AHRR after pilot injection leads to mismatched
NOx trend
◦ Coarse grid has greater temperature
40
-68 -66 -64 -62 -60 -58 -56 -54 -52 -50 -480
pilot pulse SOI [deg. ATDC]
45Experiment
◦ Coarse grid has greater temperature distribution mixing ◦ NOx are underestimated
Very good agreement
25
30
35
g f]
Experimentcoarse, ERC, present coderefined, ERC, present codecoarse, ERC, CHEMKINrefined, ERC, CHEMKINcoarse, LLNL, present coderefined LLNL present code 25
30
35
40
g f]Experimentrefined, ERC, present codecoarse, ERC, present codecoarse, LLNL, present coderefined, LLNL, present codecoarse, LLNL, CHEMKIN
y g gbetween chemistrysolvers
10
15
20
NO
x [g/k
g refined, LLNL, present code
10
15
20
25
NO
x [g/k
18-10 -5 0 5 10 15 20 250
5
main pulse SOI [deg. ATDC]
185 190 195 200 205 210 215 220 2250
5
boost pressure [kPa]
Conclusions
A new code for the integration of sparse reaction kinetics of i t h b d l dgaseous mixtures has been developed
The code has been coupled with KIVA-4, to model a heavy-duty Diesel engine operated in a two-stage combustion modeDiesel engine operated in a two stage combustion mode
Comparison with a reference academic chemistry code showed Comparison with a reference academic chemistry code showed excellent agreement
Speedups of the order of 2 times => 30+ times were achieved at a range of mechanism dimensions vs. FD code
CPU times for refined grid + detailed mech. were < 25h on 4CPUTh l i i bl i i d il d i h i i The solver is suitable to incorporate semi-detailed reaction mechanisms in practical engine simulations
19
There’s plenty of room at the bottomp y
Find out optimal ODE integration method at different reactivity (and stiffness) conditions
Investigate the accuracy of sparse semi-implicit integrators
Find suitable Jacobian preconditioners
Explore ODE solvers accuracy using quadruple-precision arithmetics
Investigate the role of transport in ICE simulations with detailed Investigate the role of transport in ICE simulations with detailed chemistry integration
20
Thanks for your attention!Thanks for your attention!Questions?Q
Acknowledgements Prof. Giuseppe Cantore and prof. Emanuele Galligani Prof. Rolf Reitz, Dr. Youngchul Ra, Dr. A. Krishnasamy, ERC staff & students VM Motori (Cento Italy) for funding the present work with a research grant
21
VM Motori (Cento, Italy) for funding the present work with a research grant
Backup
22
Jacobian matrix sparsity assumptionJ p y p
Three-body and more complex pressure-dependent reactionsinvolve the whole mixture concentrationinvolve the whole mixture concentration
sn
itot
YC
In constant-pressure environments, Ctot is constant In constant volume environments C has non negative derivative
i i
tot W1
In constant-volume environments, Ctot has non-negative derivative with each species
s
n
i
itot njWW
YYY
C s
,...,11
Dense lines in the Jacobian matrix
ji ijj WWYY 1
23
Jacobian matrix sparsity assumptionJ p y p
Simplifying assumption: 0 tot
YC jY
Affected is the Jacobian only, not the problem formulation
24
Jacobian matrix sparsity assumptionJ p y p Comparison between complete and sparser formulation
25 2012-01-0143
Chemical Kinetics IVPs
26
Interpolation of temperature-dependent quantitiesp p p q
27
Interpolation of temperature-dependent quantitiesp p p q
28
Interpolation of temperature-dependent quantitiesp p p q
n = 1 n = 2
n = 4
nn
n
i
iin xaxaxaaxaxp
2210
0
29
Species thermodynamic properties databases35 150
4h5
25
30100
c4h5c5h3oc5h4oc5h4ohc5h5o
15
20
Cp/
R [-
]
c4h5c5h3o5h4
50
U/R
T [-]
c5h5ooc6h4o
0 500 1000 1500 2000 2500 30005
10
c5h4oc5h4ohc5h5ooc6h4o
0 500 1000 1500 2000 2500 3000-50
0
0 500 1000 1500 2000 2500 3000
temperature [K]0 500 1000 1500 2000 2500 3000
temperature [K]
100
110
c4h5c5h3o
h4
150
c4h5c5h3o
h4
70
80
90
R [-
]
c5h4oc5h4ohc5h5ooc6h4o
50
100
RT
[-]
c5h4oc5h4ohc5h5ooc6h4o
50
60
S/R
0
H/R
300 500 1000 1500 2000 2500 300030
40
temperature [K]
0 500 1000 1500 2000 2500 3000
-50
temperature [K]
Effect of RTOL and ATOL on local errorconstraintconstraint
ATOLtyRTOLtyty ˆ
100Impact of ODE solver's weighting factor on desired accuracy
ATOLtyRTOLtyty nnn
10-10
10
RTOL |y|RTOL |y| + ATOL
RTOL effect
10-20
ATOL effect
-40
10-30
ATOL effect
10-50
10-40
10-30
10-20
10-10
100
10-50
1040
solid lines: RTOL = 1e-4 ATOL = 1e-15dashed lines: RTOL = 1e-8 ATOL = 1e-30
2012-01-197431
10 10 10 10 10 10y