c cientific omputing ADiCape in a large-scale industrial problem - - PowerPoint PPT Presentation

c
SMART_READER_LITE
LIVE PREVIEW

c cientific omputing ADiCape in a large-scale industrial problem - - PowerPoint PPT Presentation

c cientific omputing ADiCape in a large-scale industrial problem Monika Petera, Martin Bcker, Arno Rasch Institute for Scientific Computing RWTH Aachen University AD Workshop - Nice 2005 AACHEN c cientific Optimization Problem


slide-1
SLIDE 1

AD Workshop - Nice 2005

AACHEN

c

  • mputing

cientific

ADiCape in a large-scale industrial problem

Monika Petera, Martin Bücker, Arno Rasch Institute for Scientific Computing RWTH Aachen University

slide-2
SLIDE 2

AD Workshop - Nice 2005

AACHEN

c

  • mputing

cientific

Optimization Problem

The Model: A system of differential and algebraic equations (DAE):

) ), , ( ( t t p x F x M = &

) , ), , ( ( min

f p

t p t p x Φ

Goal: To minimize the objective function: at the final time where:

  • set of state variables
  • subset of parameters from

x p

f

t

x

slide-3
SLIDE 3

AD Workshop - Nice 2005

AACHEN

c

  • mputing

cientific

Modeling languages

A model can be written in a one of modeling languages, e.g. gPROMS, Modelica, and is usually represented as a system of mathematical equations An equation oriented approach does not make any assumptions about how to solve a model or what quantities are considered known and unknown. CapeML – A Common Model Exchange Language for Chemical Process Modeling designed for supporting the modeling process. CapeML is a neutral model exchange representation based on the XML standard.

“CapeML – A Model Exchange Language for Chemical Process Modeling” - L.v.Wedel (TR May 2002)

slide-4
SLIDE 4

AD Workshop - Nice 2005

AACHEN

c

  • mputing

cientific

A fragment of CapeML code

<Equation> <BalancedEquation myID="V-0"> <Expression> <Term> <Factor> <FunctionCall fcn.name=“sin"> <Expression> <Term> <Factor> <VariableOccurrence definition="V-car-alpha“/> </Factor> </Term> </Expression> </FunctionCall> </Factor> </Term> </Expression>

beta alpha = ) sin(

<Expression> <Term> <Factor> <VariableOccurrence definition="V-car-beta“/> </Factor> </Term> </Expression> </BalancedEquation> </Equation>

slide-5
SLIDE 5

AD Workshop - Nice 2005

AACHEN

c

  • mputing

cientific

DyOS- Dynamic Optimization Software

takes 90% of the computational time commercial CapeML

ESO

model server

ESO (Equation Set Object) - an internal representation of the computation tree.

Process System Engineering RWTH Aachen University

DAE

slide-6
SLIDE 6

AD Workshop - Nice 2005

AACHEN

c

  • mputing

cientific

The model of the Distillation Column

The model consists of 3 submodels:

  • Swamp (1)
  • Condenser (1)
  • Tray (4)

and a set of connecting equations.

Liquid_inlet Vapour_outlet Condenser Swamp Tray 1 Tray 2 Tray 3 Tray 4

slide-7
SLIDE 7

AD Workshop - Nice 2005

AACHEN

c

  • mputing

cientific

Jacobian sparsity structure

nV

connecting equations Swamp Condenser Tray (4) # equations

206 = nF

nF

# variables

410 = nV

# nonzeros

% 1 . 1 919 ≈ = nnz

slide-8
SLIDE 8

AD Workshop - Nice 2005

AACHEN

c

  • mputing

cientific

Newton Step

LU- scaled system Jacobian matrix state variables:

)) ( ( ) ( ) ( ) (

1 1

p x F LU p x p x

k k k − +

− =

j

h M x t p x F LU − ∂ ∂ = )) , ( (

dp d

derivatives:

)) ( ( ) ( ) (

1

p x F p x LU

k k

= ∆ ⋅

+

p p x p x F p s LU

k k k

∂ ∂ ∂ ∂ = ∆ ⋅

+

) ( ) ( ) ( ) (

1

) ( ) ( p s p x dp d

k k

=

⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ ⋅ ∂ ∂ − =

− +

) ( ) ( ) ( ) ( ) (

1 1

p s p x F LU p s p s

k k k k

slide-9
SLIDE 9

AD Workshop - Nice 2005

AACHEN

c

  • mputing

cientific

Integration Algorithm

Compute for j=1,...,jmax while convergence criterion not satisfied for k=0,...,j-1 )) , ( ( p x F x A ∂ ∂ =

j j j

h M A LU n H h − = = /

Reuse LU decomposition Process System Engineering RWTH Aachen University AD seeding with

k

s

  • M. Schlegel and W. Marquardt and R. Ehrig and U. Nowak:

“Sensitivity Analysis of Linearly-implicit Differential-algebraic Systems by One-step Extrapolation” 2004

⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛ ⋅ − = − =

− + − + k k k k k k k k

s dx p x dF LU s s p x F LU x x )) ( ( ) ( )) ( ( ) (

1 1 1 1

slide-10
SLIDE 10

AD Workshop - Nice 2005

AACHEN

c

  • mputing

cientific

CapeML

ESO

model server

ESO of DAE System

Modeling languages model.mo CapeML model.xml ESO Transform to CapeML XML init_vars.xml

slide-11
SLIDE 11

AD Workshop - Nice 2005

AACHEN

c

  • mputing

cientific

XSLT – Transform language

ADiCape is based on XSLT Transformation Language. On any XML-based language document eg. in CapeML, an XSLT stylesheet is applied, to generate new document. CapeML document Stylesheet transformed CapeML XSLT processor ADiCape consists of 2 XSLT Stylesheets (at the moment)

slide-12
SLIDE 12

AD Workshop - Nice 2005

AACHEN

c

  • mputing

cientific

ADiCape_var.xsl

⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎦ ⎤ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎣ ⎡ = =

410 22 1

... ... v Temp v v V ⎥ ⎥ ⎥ ⎥ ⎥ ⎥ ⎦ ⎤ ⎢ ⎢ ⎢ ⎢ ⎢ ⎢ ⎣ ⎡ = = = = ∇ ] 410 [ _ ... 1 ] 22 [ _ ... ] 1 [ _ Temp g Temp g Temp g Temp

gradients for the dF/dTemp XML init_vars.xml

<Variable myID="V_m_S.Temp" name="S.Temp" varID="V_SWAMP_Temp" view=“ovar"> <Experiment number="1" initial_value="85" result_value="0"/>

name="S.Temp" ADiCape_var.xsl

<Vector name="S.g_Temp" varID="V_SWAMP_g_Temp" dimension="410" view=“ovar"> <VectorVariable myID="V_m_S.g_Temp[22]" name="S.g_Temp[22]" index="22"> <Experiment number="1" initial_value="1" result_value="0"/>

name="S.g_Temp" dimension="410" index="22" initial_value="1"

slide-13
SLIDE 13

AD Workshop - Nice 2005

AACHEN

c

  • mputing

cientific

ADiCape

Modeling languages model.mo CapeML model.xml CapeML g_model.xml XML g_init_vars.xml XSLT ADiCape_eq ESO Transform to CapeML XML init_vars.xml XSLT ADiCape_var

slide-14
SLIDE 14

AD Workshop - Nice 2005

AACHEN

c

  • mputing

cientific

ADiCape_eq.xsl

) ( ' )) ( ( ' ))' ( ( x g x g f x g f ⋅ = ... ... ) ( 1 ) ln( ) sin( ) cos( ) cos( ) sin( ' expr expr expr expr expr expr f f −

function intrinsic:

Templates: <xsl:template match="Equation"> <xsl:template match=“Expression"> <xsl:template match=“FunctionCall"> <xsl:template match="VariableOccurence">

chain rule of differentiation:

' ' )' ( g f g f g f ⋅ + ⋅ ⋅ = ⋅

2 '

' ' g g f g f g f ⋅ − ⋅ = ⎟ ⎟ ⎠ ⎞ ⎜ ⎜ ⎝ ⎛

differentiation of math-operations:

' ' )' ( g f g f ± = ±

<Equation> <BalancedEquation myID="V-0"> <Distribution domain="V-g_i"/> <Expression> <Term> <Factor> <FunctionCall fcn.name=“cos"> <Expression> <Term> <Factor> <VariableOccurrence definition="V-car-alpha“/> </Factor> </Term> </Expression> </FunctionCall> </Factor> <Factor mul.op=“MUL”> <VariableOccurrence definition="V-car-g_alpha“/> <DomainOccurrence domain=“V-g_i"/> </Factor> </Term> </Expression> … <Equation> <BalancedEquation myID="V-0"> <Expression> <Term> <Factor> <FunctionCall fcn.name=“sin"> <Expression> <Term> <Factor> <VariableOccurrence definition="V-car-alpha“/> </Factor> </Term> </Expression> </FunctionCall> </Factor> </Term> </Expression> …

slide-15
SLIDE 15

AD Workshop - Nice 2005

AACHEN

c

  • mputing

cientific

ESO for the differentiated DAE

Modeling languages model.mo CapeML model.xml CapeML g_model.xml XML g_init_vars.xml XSLT ADiCape_eq ESO g_ESO Transform to CapeML XML init_vars.xml XML g_init_vars.xml XSLT ADiCape_var

slide-16
SLIDE 16

AD Workshop - Nice 2005

AACHEN

c

  • mputing

cientific

CapeML

ESO

model server

XML ESO

First derivatives

  • riginal DAE

ADiCape: Full Jacobian Jacobian times Matrix ESO g_ESO XML ESO m_eso m_g_eso DyOS Call Call Call

) (F get ) ' (F get

Sparse Jacobian matrices with known sparsity pattern: do not calculate “zeros” cut down number of operations save space

slide-17
SLIDE 17

AD Workshop - Nice 2005

AACHEN

c

  • mputing

cientific

Matrix compression

BUT HOW ??

Sparsity aware seeding with CPR – Curtis-Powell-Reid graph-coloring method!

slide-18
SLIDE 18

AD Workshop - Nice 2005

AACHEN

c

  • mputing

cientific

Sparsity aware seeding

dx dF seed dx dF ⋅ seed

* =

410 13 13 206

slide-19
SLIDE 19

AD Workshop - Nice 2005

AACHEN

c

  • mputing

cientific

Compressed Full Jacobian

size time full 206x410 55 min compressed 206x13 3.4 s factor 31.5 970 ?!

2.8 GHz Pentium 4 512MB cash

) 970 5 . 31 (

2 ≈

slide-20
SLIDE 20

AD Workshop - Nice 2005

AACHEN

c

  • mputing

cientific

Future Work

First derivatives

  • riginal DAE

Second derivatives ESO g_ESO XML ESO m_eso m_g_eso DyOS Call Call Call

) (F get ) ' (F get

h_ESO change DyOS System: new Optimizer (IPOPT)* which uses 2nd derivatives change Integration Algorithm

* A. Wächter and L. T. Biegler: “On the Implementation of a Primal-Dual Interior Point Filter Line Search Algorithm for Large-Scale Nonlinear Programming”, 2004

slide-21
SLIDE 21

AD Workshop - Nice 2005

AACHEN

c

  • mputing

cientific

Second derivatives

k k k k k k k k

s p x F p s LU p x F p x LU p x F LU p x p x ) ( ) ( ) ( )) ( ( ) ( ) ( )) ( ( ) ( ) ( ) (

1 1 1 1

∂ ∂ = ∆ ⋅ = ∆ ⋅ − =

+ + − +

dp d

s J ⋅

s H s d J

T

⋅ ⋅ + ⋅

k k T k k k k

s p x F s d p x F p d LU ⋅ ∂ ∂ ⋅ + ∂ ∂ = ∆ ⋅

+

) ( ) ( ) ( ) (

2 2 1

slide-22
SLIDE 22

AD Workshop - Nice 2005

AACHEN

c

  • mputing

cientific

Summary and Conclusions

ADiCape is a source transformation tool employing the forward mode of AD written for CapeML language with Curtis-Powell-Reid method, calculation of a compressed sparse Jacobian brings space savings and considerable speed-up We expect DyOS integrator performance to considerably improve with the use of AD-generated derivatives With the new optimizer and precise AD second derivatives we hope to considerably cut down the number of iterations of the Integrator.

slide-23
SLIDE 23

AD Workshop - Nice 2005

AACHEN

c

  • mputing

cientific

THANK YOU FOR YOUR ATTENTION !