computationally efficient dimension reduction of

30
University of Wisconsin -- Engine Research Center Frontiers in Computational Physics: Energy Sciences Zurich, Jun 3-5, 2015 slide 1 Computationally efficient dimension reduction of combustion chemistry via Principal Components Analysis based domain partitioning Federico Perini , Rolf D. Reitz University of Wisconsin-Madison, USA Frontiers in Computational Physics: Energy Sciences Zurich, Switzerland June 5, 2015 Acknowledgements U.S. D.O.E. Office of Vehicle Technologies, PMs Leo Breton, Gupreet Singh Sandia National Laboratories

Upload: others

Post on 13-Apr-2022

8 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Computationally efficient dimension reduction of

University of Wisconsin -- Engine Research Center

Frontiers in Computational Physics: Energy Sciences – Zurich, Jun 3-5, 2015

slide 1

Computationally efficient dimension reduction of combustion chemistry

via Principal Components Analysis based domain partitioning

Federico Perini, Rolf D. Reitz

University of Wisconsin-Madison, USA

Frontiers in Computational Physics: Energy Sciences

Zurich, Switzerland

June 5, 2015

Acknowledgements

U.S. D.O.E. Office of Vehicle Technologies, PMs Leo Breton, Gupreet Singh

Sandia National Laboratories

Page 2: Computationally efficient dimension reduction of

University of Wisconsin -- Engine Research Center

Frontiers in Computational Physics: Energy Sciences – Zurich, Jun 3-5, 2015

slide 2

Summary - Motivation

Combustion research has been guided in the last decade by advances in computer modeling

The success of advanced combustion strategies relies on local mixture reactivity crucial to controllability, but also emissions

Need to incorporate realistic combustion chemistry in multi-

dimensional simulations for quantitative predictions in ignition and pollutant formation

Long-term goal: Well-resolved multi-physics modeling of ICE flows, sprays, and chemistry

Page 3: Computationally efficient dimension reduction of

University of Wisconsin -- Engine Research Center

Frontiers in Computational Physics: Energy Sciences – Zurich, Jun 3-5, 2015

slide 3

Chemical Kinetics in CFD simulations

Usually part of an operator-splitting scheme

Each cell is treated as an adiabatic well-stirred reactor “Embarassingly” parallel problem

Very stiff ODE system need for appropriate integrators

Only the overall changes in species mass fractions and cell internal energy are passed to the flow solver

Skeletal mechanism or on-the-fly reduction

Reduce number of integrations storage/retrieval, multi-zone approaches, clustering

Page 4: Computationally efficient dimension reduction of

University of Wisconsin -- Engine Research Center

Frontiers in Computational Physics: Energy Sciences – Zurich, Jun 3-5, 2015

slide 4

Potential for speed-up

ODE system level (1 reactor)

finite volume domain level (N reactors)

Page 5: Computationally efficient dimension reduction of

University of Wisconsin -- Engine Research Center

Frontiers in Computational Physics: Energy Sciences – Zurich, Jun 3-5, 2015

slide 5

A new Modern Fortran library for standalone reactor calculations or the simulation of chemically reactive systems of gaseous mixtures

SpeedCHEM chemistry solver

Solution of chemical kinetic ODE systems

,,,1,

1

,

1

,

ss n

i

riik

n

i

iik nkMM

,1

,, k

n

k

ikikii q

W

dt

dY r

,1

1

sn

i

i

i

i

v dt

dY

W

U

cdt

dT

mass cons.

energy cons. (adiabatic const. V)

Provide the fastest accurate kinetics for large-size mechanisms, but with focus

on efficiency for practical multi-dimensional simulations (ns 100-1000)

Linear scaling of the solution time vs. problem size

101

102

103

104

10-3

10-2

10-1

100

101

102

103

104

number of species

CP

U t

ime

[s]

SpeedCHEM ignition delay time calculation scaling

Direct dense Jacobian

SpeedCHEM, direct sparse

SpeedCHEM, Krylov

ns

ns

3

available at http://www.erc.wisc.edu/chemicalreaction.php Perini et al., Energy&Fuels 26 (8), 4804-4822, 2012 Perini et al., Comb Flame 161(5), 1180-1195, 2014

Page 6: Computationally efficient dimension reduction of

University of Wisconsin -- Engine Research Center

Frontiers in Computational Physics: Energy Sciences – Zurich, Jun 3-5, 2015

slide 6

Solution space reduction approach

The idea of grouping cells with similar reactivity is not new*

Usually based on -T maps for engine calculations

Search for similar cells based on proximity (neighbors, ROI) or clustering (k-means)

Chemistry is solved for at each cluster, then conservatively re-distributed

*Babajimopoulos et al., Liang et al., Barths et al., Shi et al., Puduppakkam et al. , Perini et al.

Chemistry has to be solved on each cell of the mesh

Reactively similar cells are identified using a clustering algorithm Their thermophysical properties are averaged into ‘cluster’ cells

Chemical Kinetics are solved for at the ‘cluster’ cells

Changes in composition due to the reactions are mapped back

Updated species compositions are sent back to the flow solver as source terms

• The -T is specific to single-component fuel kinetics;

• Even with extremely large mechanisms, chemically reacting environments converge to low-dimensional manifolds;

• Inner homogeneity of the cell clusters should be defined and treated rigorously, i.e. by a general model dimensionality reduction method.

Why develop a different (better) approach?

Page 7: Computationally efficient dimension reduction of

University of Wisconsin -- Engine Research Center

Frontiers in Computational Physics: Energy Sciences – Zurich, Jun 3-5, 2015

slide 7

[1] PCA-based states space dimension reduction

Page 8: Computationally efficient dimension reduction of

University of Wisconsin -- Engine Research Center

Frontiers in Computational Physics: Energy Sciences – Zurich, Jun 3-5, 2015

slide 8

1st dimension reduction of the chemistry domain

Principal Component Analysis of the states space

Given a homogeneous reactor state

the instantaneous state of the whole CFD domain is given by the matrix of states of all active cells:

1

21

s

s

ndT

nYYYT y

cncnd yyyyY 1 32

Hp: Chemistry states converge to low-dimensional manifolds

dnpc

nd pc ,

Page 9: Computationally efficient dimension reduction of

University of Wisconsin -- Engine Research Center

Frontiers in Computational Physics: Energy Sciences – Zurich, Jun 3-5, 2015

slide 9

Principal Component Analysis of the states space

Principal Component Analysis (PCA) applies a linear transformation P

coordinates changed into a more convenient point of view:

where

is the matrix containing the first npc principal components.

Reduced dimensionality npc is based on a variance fraction threshold:

YΠPT

cpc nn

pcnpcnd πππΠ 21

If v = 0.01, 99% of the total state space variance in the domain is retained

1

1,var1,var

pcn

jvpc jn PP

Page 10: Computationally efficient dimension reduction of

University of Wisconsin -- Engine Research Center

Frontiers in Computational Physics: Energy Sciences – Zurich, Jun 3-5, 2015

slide 10

Principal Component Analysis of the states space

1] Linearity of the Y P transformation easy to compute

2] All principal components are orthonormal special properties

3] They are sorted in descending order of variance

Variance-covariance matrix of a dataset:

T

cndd YYCY

1

component principaleach along of variances thecontains

diagonal is

of thecontains

YC

ΠΠCC

P

YP

Y

then

nnthen

rseigenvecto

T

pcpc

ji,,cov Y

j,var Y

Page 11: Computationally efficient dimension reduction of

University of Wisconsin -- Engine Research Center

Frontiers in Computational Physics: Energy Sciences – Zurich, Jun 3-5, 2015

slide 11

[2] kd-tree + k-means mapping into homogeneous clusters

Page 12: Computationally efficient dimension reduction of

University of Wisconsin -- Engine Research Center

Frontiers in Computational Physics: Energy Sciences – Zurich, Jun 3-5, 2015

slide 12

Partitioning of the reduced states space

Aim: to group states into ‘clusters’ which retained variance fraction along each reduced dimension is less than v

[1] kd-tree partitioning of the dataset – O(log(nc))

Level 1: dimension 1 Level 2: dimension 2 Level 3: dimension 1 Etc…. 1

3 2

6 5 4

Node = median point of i-th dimension = split plane = subset

Page 13: Computationally efficient dimension reduction of

University of Wisconsin -- Engine Research Center

Frontiers in Computational Physics: Energy Sciences – Zurich, Jun 3-5, 2015

slide 13

Partitioning of the reduced states space

[2] bounding-box-constrained k-means – O(2npc nc)

Leaves of the kd-tree are the final variance-bound boxes Find the optimal cluster centers to the dataset, subject to: Points belong to any bounding cluster centers to their leaf K-means cluster initialization: box vertices

Chemical Kinetics ODE solved over clusters = thermodynamic averages of their member states

Page 14: Computationally efficient dimension reduction of

University of Wisconsin -- Engine Research Center

Frontiers in Computational Physics: Energy Sciences – Zurich, Jun 3-5, 2015

slide 14

[3] Forward Sensitivity Analysis based remapping to the full solution space

Page 15: Computationally efficient dimension reduction of

University of Wisconsin -- Engine Research Center

Frontiers in Computational Physics: Energy Sciences – Zurich, Jun 3-5, 2015

slide 15

Linearization of the solution space

Chem. Kin. ODE integration (tt+t) = path in full states space. Per given t, a mapping function

For y small enough,

1y

0yK

2y3y

0y

1yΚ

2yK

3yK

tt

t

nsns dtt0

,,:11yyfyKK 00

tt

t

nsndttpc ,,: 0

1ppfpκκ 0

From the reduced space,

yyy 0,0, cp

0,cyK

y

0,cy

yyKyK

y

0,

0,0,

cyj

icp

y

K

Matrix of linearized mapping gradients

Page 16: Computationally efficient dimension reduction of

University of Wisconsin -- Engine Research Center

Frontiers in Computational Physics: Energy Sciences – Zurich, Jun 3-5, 2015

slide 16

Sensitivity Analysis for linearized solution mapping

The linear mapping gradients correspond to first-order sensitivities of the ODE system w.r.t. the initial conditions

evaluated at the final integration time

IyS

ySyJySyS

y0,

,,,:,

0

t

tttt

y

K

ddyj

i

Dense system expensive, computed by CVODES together with the ODEs

defined a reduced sensitivity system, w.r.t. the initial PCs:

0pS

pSΠpyJpSpSpS

p0,

~

,~

,,~

,~

:,~

0 t

tttdp

ft

tp

Kk

i

nnpj

i

pcpc

O(ns2)

O(npc2)O(102)

Page 17: Computationally efficient dimension reduction of

University of Wisconsin -- Engine Research Center

Frontiers in Computational Physics: Energy Sciences – Zurich, Jun 3-5, 2015

slide 17

Sensitivity Analysis for linearized solution mapping

The ODE system solution at the cluster centers is eventually remapped back to each member point in the full space as:

pppκpκy 0,0,0, ,~

pcpp tStt

The formulation is intrinsically mass- and element- conserving because the reduced sensitivity system is an orthonormal transformation of the Jacobian

0,py ttc y

ttp y

0,cy

Page 18: Computationally efficient dimension reduction of

University of Wisconsin -- Engine Research Center

Frontiers in Computational Physics: Energy Sciences – Zurich, Jun 3-5, 2015

slide 18

Results

Page 19: Computationally efficient dimension reduction of

University of Wisconsin -- Engine Research Center

Frontiers in Computational Physics: Energy Sciences – Zurich, Jun 3-5, 2015

slide 19

Code setup for engine combustion

CFD solver: KIVA-ERC

with improved sumbodels

Chemistry solver:

Parameter Value

RTOL 10-4

ATOL 10-15

Integrator CVODES

Sensitivity Analysis

Forward,

simultaneous,

same tolerances

(unactive in full

chemistry cases)

Phenomenon Sub-model

Spray breakup KH-RT instability, Beale

and Reitz

Near-nozzle flow Gas-jet theory, Abani et al.

Droplet collision ROI w/ extended outcomes,

Munnannur and Reitz

Wall film O’Rourke and Amsden

Evaporation Discrete Multi-Component,

Ra and Reitz

Turbulence RNG k-epsilon, Han and

Reitz

Combustion SpeedCHEM, Perini et al.

Page 20: Computationally efficient dimension reduction of

University of Wisconsin -- Engine Research Center

Frontiers in Computational Physics: Energy Sciences – Zurich, Jun 3-5, 2015

slide 20

HCCI combustion in a light duty engine

Engine specifications

Bore x stroke [mm] 82.0 x 90.4

Unit displacement [cm3] 477.2

Compression ratio 16.4 : 1

Squish height at TDC [mm] 0.88

Bosch CRI2.2 Injector parameters

Sac volume [mm3] 0.23

Number of holes 7

Included angle [deg] 149

Nozzle diameter [mm] 0.14

Hole protrusion [mm] 0.3

Fuel properties for PLIF studies

Composition [mole fractions] 42% nC16H34

58% iso-C16H34

Fluorescent tracer [mass fraction] 0.5% 1-C11H10

Equivalent Cetane Number [-] 50.7

Fuel properties for ignition studies

US #2 diesel fuel CN=47

HCCI-operated GM 1.9L light duty engine with a Primary Reference Fuel

Experiments run in single cylinder conf. at UW-DERC lab (Dempsey et al., 2013)

3 reaction mechanisms 2d axisymmetric grid, 3.1k cells

ns = 110 nr = 550

ns = 1034 nr = 4236

ns = 47 nr = 142

Page 21: Computationally efficient dimension reduction of

University of Wisconsin -- Engine Research Center

Frontiers in Computational Physics: Energy Sciences – Zurich, Jun 3-5, 2015

slide 21

[small] ERC PRF, ns=47, nr=142

All cases of v 110-2 do a pretty good job at capturing thermodynamic (pressure, HRR) quantities and species mass fractions (small!)

Means at least 99% of the total variance must be represented even in this simple case

-25 -20 -15 -10 -5 0 5 10 15 201

2

3

4

5

6

7

8

9x 10

6 ERC PRF, ns=47

crank angle [degrees ATDC]

pre

ssu

re [

Pa

]

0

50

100

150

200

hea

t rele

ase

[J

/deg

]

v = 1 10-3

v = 5 10-3

v = 1 10-2

v = 5 10-2

v = 1 10-1

full chem.

-25 -20 -15 -10 -5 0 5 10 15 2010

-8

10-7

10-6

10-5

10-4

ERC PRF, ns=47

crank angle [degrees ATDC]

CO

ma

ss f

ract

ion

[-]

10-20

10-15

10-10

NO

mass

fracti

on

[-]

v = 1 10-3

v = 5 10-3

v = 1 10-2

v = 5 10-2

v = 1 10-1

full chem.

Page 22: Computationally efficient dimension reduction of

University of Wisconsin -- Engine Research Center

Frontiers in Computational Physics: Energy Sciences – Zurich, Jun 3-5, 2015

slide 22

[small] ERC PRF, ns=47, nr=142

full chemistry PCASA, v = 5e-3

Page 23: Computationally efficient dimension reduction of

University of Wisconsin -- Engine Research Center

Frontiers in Computational Physics: Energy Sciences – Zurich, Jun 3-5, 2015

slide 23

[medium] ERC PRF-PAH, ns=110, nr=550

Similar high temperature ignition timing, higher LTHR peak

Similar performance as for the smaller mechanism

-25 -20 -15 -10 -5 0 5 10 15 2010

-8

10-7

10-6

10-5

10-4

ERC PRF-PAH, ns=110

crank angle [degrees ATDC]

CO

ma

ss f

ract

ion

[-]

10-20

10-15

10-10

NO

mass

fracti

on

[-]

v = 1 10-3

v = 5 10-3

v = 1 10-2

v = 5 10-2

v = 1 10-1

full chem.

-25 -20 -15 -10 -5 0 5 10 15 201

2

3

4

5

6

7

8

9x 10

6 ERC PRF-PAH, ns=110

crank angle [degrees ATDC]

pre

ssu

re [

Pa

]

0

50

100

150

200

heat

rele

ase

[J/d

eg]

v = 1 10-3

v = 5 10-3

v = 1 10-2

v = 5 10-2

v = 1 10-1

full chem.

Page 24: Computationally efficient dimension reduction of

University of Wisconsin -- Engine Research Center

Frontiers in Computational Physics: Energy Sciences – Zurich, Jun 3-5, 2015

slide 24

[large] LLNL, ns=1034, nr=4236

Detailed low-temperature chemistry is very well captured but no main ignition sensitivity to initial conditions, geometry simplification, mechanism validation only with zero- and one-dimensional models

From the PCASA reduction standpoint, the variance parameter seems insensitive to mechanism size as earlier, v 110-2

-25 -20 -15 -10 -5 0 5 10 15 201

2

3

4

5

6x 10

6 LLNL PRF, ns=1034

crank angle [degrees ATDC]

pre

ssu

re [

Pa

]

0

2

4

6

8

10

heat

rele

ase

[J/d

eg]

v = 1 10-3

v = 5 10-3

v = 1 10-2

v = 5 10-2

v = 1 10-1

full chem.

-25 -20 -15 -10 -5 0 5 10 15 20

10-20

10-15

10-10

10-5

LLNL PRF, ns=1034

crank angle [degrees ATDC]

CO

ma

ss f

ract

ion

[-]

10-16

10-14

10-12

10-10

10-8

OH

mass

fracti

on

[-]

v = 1 10-3

v = 5 10-3

v = 1 10-2

v = 5 10-2

v = 1 10-1

full chem.

Page 25: Computationally efficient dimension reduction of

University of Wisconsin -- Engine Research Center

Frontiers in Computational Physics: Energy Sciences – Zurich, Jun 3-5, 2015

slide 25

# of clusters, # of principal components

Both increase monotonically with reduced variance fraction

Instantaneous # of clusters not necessarily correlated w/ # of PCs

Peak of PCs and cell clusters during cool-flame LTHR region!

-50 0 50 1000

5

10

15

ERC PRF-PAH, ns=110

crank angle [degrees ATDC]

cell

clu

ster d

imen

sion

s [-

]

v = 1 10-3

v = 5 10

-3

v = 1 10

-2

v = 5 10

-2

v = 1 10-1

-40 -20 0 20 40 60 8010

0

101

102

103

LLNL PRF, ns=1034

crank angle [degrees ATDC]

cell

clu

sters

[-]

v = 1 10

-3

v = 5 10-3

v = 1 10-2

v = 5 10-2

v = 1 10

-1

Page 26: Computationally efficient dimension reduction of

University of Wisconsin -- Engine Research Center

Frontiers in Computational Physics: Energy Sciences – Zurich, Jun 3-5, 2015

slide 26

full 1e-3 5e-3 1e-2 5e-2 1e-10

2

4

6

8

10

9.57

2.07

1.090.70

0.48 0.50

9.77

2.27

1.290.91

0.68 0.69

tota

l w

all

tim

e [h

]

LLNL, ns=1034

spray

chemistry

advection

diffusion

communications

not mapped

CPU time performance

Chemistry dominates these sims. 9x speed-up for v = 5e-3

Peak in CPU time / timestep during low-temperature ignition

-50 0 50 1000

20

40

60

80

100

LLNL PRF, ns = 1034

crank angle [degrees ATDC]g

rid

in

dex

[m

s/ti

me-

step

]

v = 1 10-3

v = 5 10-3

v = 1 10-2

v = 5 10-2

v = 1 10-1

full chem.

Page 27: Computationally efficient dimension reduction of

University of Wisconsin -- Engine Research Center

Frontiers in Computational Physics: Energy Sciences – Zurich, Jun 3-5, 2015

slide 27

ns

v

PCASA vs. full chem. accuracy

1.5

1.5

2

2

2

2

2

2.5

3 3.5 4 4

4.5

5

47 110 10340.1%

1%

10%

Performance vs. accuracy

2

10

20

20

30

40

50

60

70

8090

ns

v

PCASA vs. full chem. speed-up

47 110 10340.1%

1%

10%

Detailed mechanisms are more sensitive to the variance tolerance

tendt

n

i fulli

fulliPCAi

PCA

s

Y

YYerr

1 ,

,,

The ‘trade-off region’ is for 0.001<v<0.005

Speed-ups of the order of 10-20 times at this simple case

Page 28: Computationally efficient dimension reduction of

University of Wisconsin -- Engine Research Center

Frontiers in Computational Physics: Energy Sciences – Zurich, Jun 3-5, 2015

slide 28

Conclusions

Computationally efficient solution of combustion chemical kinetics in multidimensional CFD codes achieved through dimension reduction:

1) Dimension reduction of domain states via PCA;

2) Variance-based partitioning of the reduced

space via kd-tree and k-means

3) Mass- and element-conserving remapping of the solution space based on Sensitivity Analysis with respect to the initial reduced states

Page 29: Computationally efficient dimension reduction of

University of Wisconsin -- Engine Research Center

Frontiers in Computational Physics: Energy Sciences – Zurich, Jun 3-5, 2015

slide 29

Conclusions

Application of the proposed reduction approach to HCCI engine combustion showed up to 2 orders of magnitude speed-up with respect to the full chemistry approach, regardless of the mechanism size

Need to test the approach against larger-scale, parallel simulations of spray engine combustion

The proposed method can be applied to other problems characterized by large numbers of stiff ODE system solutions

Page 30: Computationally efficient dimension reduction of

University of Wisconsin -- Engine Research Center

Frontiers in Computational Physics: Energy Sciences – Zurich, Jun 3-5, 2015

slide 30

[email protected]

Acknowledgements

U.S. D.O.E. Office of Vehicle Technologies, PMs Leo Breton, Gupreet Singh

Paul C. Miles, Stephen Busch - Sandia National Laboratories