Académique Documents
Professionnel Documents
Culture Documents
SUNDIALS
Radu erban
Center for Applied Scientific Computing
Lawrence Livermore National Laboratory
Background
LLNL has a long history of R&D in ODE and DAE methods and
software, and closely related areas, with emphasis on applications to
PDEs.
GEAR
1982 1983
ODEPACK
1988
1990
VODE
VODPK
DASSL
1994 1996
CVODE
DASPK
NKSOL
FORTRAN
today
PVODE
SensPVODE
IDA
SensIDA
KINSOL
SensKINSOL
CVODE
CVODES
IDA
KINSOL
IDAS
KINSOLS
SUNDIALS
1974
ANSI C
RS - 2
Background (cont.)
Starting in 1993, the push to solve large systems in parallel motivated
work to write or rewrite solvers in C:
RS - 3
Structure of SUNDIALS
Solvers
User main routine
User problem-defining function
User preconditioner function
CVODE
ODE
Integrator
Band
Linear
Solver
Dense
Linear
Solver
x = f(t,x), x(t0) = x0
F(t,x,x) = 0, x(t0) = x0
F(x) = 0
IDA
DAE
Integrator
Preconditioned
GMRES
Linear Solver
CVODE
IDA
KINSOL
KINSOL
Nonlinear
Solver
General
Preconditioner
Modules
Vector
Kernels
RS - 4
IDA
Variable-order, variable-step BDF
Nonlinear system solved by Newton
Linear systems solved by direct or SPGMR solvers
KINSOL
Inexact Newton method
Krylov solver: SPGMR (Scaled Preconditioned GMRES)
Preconditioners
Band preconditioner (CVODE)
Band-Block-Diagonal preconditioner (CVODE, IDA, KINSOL)
User-defined (setup and solve user routines)
RS - 5
Sensitivity Analysis
Sensitivity Analysis (SA) is the study of how the variation in the output of
a model (numerical or otherwise) can be apportioned, qualitatively or
quantitatively, to different sources of variation.
Applications:
Approaches:
Forward sensitivity analysis
Adjoint sensitivity analysis
RS - 6
Forward sensitivity
Fx& s&i + Fx si + Fpi = 0
, i = 1,K, N p
s
(
0
)
=
x
i
0 pi
g (t , x, p)
dg
= gxs + g p
dp
F ( x, x& , t , p ) = 0
x(0) = x0 ( p)
Adjoint sensitivity
(*F ) *F = g
x
x&
x
*
Fx& x p = ... at t = T
G( x, p) = 0T g (t , x, p)dt
dG = T ( g * F )dt (* F x ) |T
p
x& p 0
dp 0 p
RS - 7
F ( x, x& , t , p ) = 0
x (0) = x ( p )
0
find si=dx/dpi by simultaneously solving the original system with the Np
sensitivity systems obtained by differentiating the original system with
respect to each parameter in turn:
dg
dp
= g s+g
x
( F )
*
x& t =T
=0
T
dG
= (g p * Fp )dt + (* Fx& ) t =0 x0 p
dp 0
(*F ) *F = g
x
x&
x
*
Fx& x p = ... at t = T
G( x, p) = 0T g (t, x, p)dt
*
a
d
0
=
f
(
x
,
p
)
B = g xa
f d
f d
f a
A = d , B = a , C = d , (CB ) 1
x
x
x
dG = T ( g * F )dt (* F x ) |T
p
x& p 0
dp 0 p
d * (T ) = *C t =T
At t = T :
d * B = g xa *CB = g xa * = g xa (CB ) 1
f a ( x d , p ) = 0 Cx dp = f pa d * x dp = * f pa
d * (T ) = ( g xa (CB ) 1 C ) t =T
T
dG
= (g p + d * f pd + a* f pa )dt + (d * ) t =0 x0d p g xa (CB ) 1 f pa
0
dp
t =T
RS - 9
Adjoint system
( * Fx& ) * Fx = 0
*
= K at t = T
F ( x, x& ) = 0
F
F
,B=
, A1
A=
x&
x
( A* ) B* = 0
*
*
A = g x @T
x& d = f d ( x d , x a )
a
d
a
0 = f ( x , x )
f a
f a
f d
f d
A = d , B = a , C = d , D = a , D 1
x
x
x
x
& d = A* d C * a
0 = B* d + D* a
d = g * C * ( D* ) 1 g *
xd
xa
Hessenberg
index-2 DAE
Implicit
ODE
d (* Fx& x p )
T
dg
d dG
*
*
*
=
= (g p Fp ) t =T + Fp dt ( Fx& x p ) t =0
0
dp t =T dT dp
dT
Semi-explicit
index-1 DAE
Sensitivity of objective
function
x& d = f d ( x d , x a )
a
d
0 = f ( x )
f a
f d
f d
A = d , B = a , C = d , (CB ) 1
x
x
x
t =T
@T
& d = A* d C * a
0 = B* d
*
d = P* g * A*C * ( B*C * ) 1 g * dC ( B*C * ) 1 g * @ T
xd
xa
xa
dt
P = I B (CB ) 1 C
RS - 10
x& = Ax
& = A
*
d
a
0 = Cx + Dx
& = A C
0 = B + D
x& d = Ax d B ( D) 1 Cx d
& = A + C ( D ) B
RS - 11
& Fx* = g x*
F
=0
x&
RS - 12
nvSpec = NV_SpecInit_Parallel();
y0 = N_VNew(nvSpec);
Options
User main routine cvmem = CVodeCreate(BDF,NEWTON);
- sensitivity approach (simultaneous or staggered)
flag
= CVodeSet*();
Specification of problem
parameters
- sensitivity residuals: analytical,
flag
= CVodeMalloc(cvmem,rhs,t0,y0,
); FD(DQ), AD, CS
Activation of sensitivity
computation
- error control on sensitivity variables
flag
= CVSpgmr(cvmem,);
User problem-defining
function
- user-defined tolerances for sensitivity variables
y0S = N_VNewS(Ns,nvSpec);
User preconditioner function
flag = CVodeSetSens*();
flag = CVodeSensMalloc(cvmem,y0S,);
for(tout
CVODES = ) {
IDAS
KINSOLS
flag = CVode(,y,);
ODE
DAE
Nonlinear
flag = CVodeGetSens(,yS,);
Integrator
Integrator
Solver
}
NV_SpecFree_Parallel();
CVodeFree(cvmem);
Band
Dense
Preconditioned
General
Vector
Linear
Linear
GMRES
Preconditioner
Kernels
Solver
Solver
Linear Solver
Modules
RS - 13
CVODES
ODE
Integrator
Band
Linear
Solver
Dense
Linear
Solver
Implementation
- check point approach; total cost is 2 forward
solutions + 1 backward solution
- integrate any system backwards in time
- may require modifications to some user-defined
vector kernels
IDAS
DAE
Integrator
Preconditioned
GMRES
Linear Solver
KINSOLS
Nonlinear
Solver
General
Preconditioner
Modules
(Modified)
Vector
Kernels
RS - 15
ck0
t0
ck1
ck2
tf
RS - 16
Applications
Parallel CVODE is being used in a 3D tokamak turbulence model in LLNLs
Magnetic Fusion Energy Division. A typical run has 7 unknowns on a 64x64x40
mesh, with up to 60 processors
KINSOL with a HYPRE multigrid preconditioner is being applied within CASC to
solve a nonlinear Richards equation for pressure in porous media flows. Fully
scalable performance was obtained on up to 225 processors on ASCI Blue.
CVODE, KINSOL, IDA, with MG preconditioner, are being used to solve 3D
neutral particle transport problems in CASC. Scalable performance obtained on
up to 5800 processors on ASCI Red.
SensPVODE, SensKINSOL, SensIDA have been used to determine solution
sensitivities in neutral particle transport applications.
IDA and SensIDA are being used in a cloud and aerosol microphysics model at
LLNL to study cloud formation processes.
CVODES is used for sensitivity analysis of chemically reacting flows (SciDAC
collaboration with Sandia Livermore)
CVODES is used for sensitivity analysis of radiation transport (diffusion
approximation)
RS - 17
Availability
Open source BSD license
www.llnl.gov/CASC/sundials
Publications
www.llnl.gov/CASC/nsde
The SUNDIALS Team
Peter Brown
Keith Grant
Alan Hindmarsh
Steven Lee
Radu Serban
Dan Shumaker
Carol Woodward
Past contributors
Scott Cohen and Allan Taylor
RS - 19
UCRL-PRES-
AUSPICES
This document was prepared as an account of work sponsored by an agency of the United States
Government. Neither the United States Government nor the University of California nor any of their
employees, makes any warranty, express or implied, or assumes any legal liability or responsibility for the
accuracy, completeness, or usefulness of any information, apparatus, product, or process disclosed, or
represents that its use would not infringe privately owned rights. Reference herein to any specific
commercial product, process, or service by trade name, trademark, manufacturer, or otherwise, does not
necessarily constitute or imply its endorsement, recommendation, or favoring by the United States
Government or the University of California. The views and opinions of authors expressed herein do not
necessarily state or reflect those of the United States Government or the University of California, and shall
not be used for advertising or product endorsement purposes.
This work was performed under the auspices of the U.S. Department of Energy by the University of
California, Lawrence Livermore National Laboratory under Contract No. W-7405-Eng-48.
RS - 20