ArticlePDF Available

Abstract and Figures

After applying the Finite Element Method (FEM) to the diffusion-type and wave-type Partial Differential Equations (PDEs), a first order and a second order Ordinary Differential Equation (ODE) systems are obtained respectively. These ODE systems usually present high stiffness, so numerical methods with good stability properties are required in their resolution. MATLAB offers a set of open source adaptive step functions for solving ODEs. One of these functions is the ode15s recommended to solve stiff problems and which is based on the Backward Differentiation Formulae (BDF). We describe the error estimation and the step size control implemented in this function. The ode15s is a variable order algorithm, and even though it has an adaptive step size implementation, the advancing formula and the local error estimation that uses correspond to the constant step size formula. We have focused on the second order accurate and unconditionally stable BDF (BDF2) and we have implemented a real adaptive step size BDF2 algorithm using the same strategy as the BDF2 implemented in the ode15s, resulting the new algorithm more efficient than the one implemented in MATLAB.
Content may be subject to copyright.
Implementation of an Adaptive BDF2 Formula and
Comparison with the MATLAB Ode15s
E. Alberdi Celaya
1
, J. J. Anza Aguirrezabala
2
, and P. Chatzipantelidis
3
1
Department of Applied Mathematics, University of the Basque Country UPV/EHU, Bilbao, Spain
elisabete.alberdi@ehu.es
2
Department of Applied Mathematics, University of the Basque Country UPV/EHU, Bilbao, Spain
juanjose.anza@ehu.es
3
Department of Mathematics, University of Crete, Heraklion-Crete, Greece
chatzipa@math.uoc.gr
Abstract
After applying the Finite Element Metho d (FEM) to the diffusion-type and wave-type
Partial Differential Equations (PDEs), a first order and a second order Ordinary Differen-
tial Equation (ODE) systems are obtained respectively. These ODE systems usually present
high stiffness, so numerical methods with good stability properties are required in their reso-
lution. MATLAB offers a set of open source adaptive step functions for solving ODEs. One
of these functions is the ode15s recommended to solve stiff problems and which is based on
the Backward Differentiation Formulae (BDF). We describe the error estimation and the step
size control implemented in this function. The ode15s is a variable order algorithm, and even
though it has an adaptive step size implementation, the advancing formula and the lo cal error
estimation that uses correspond to the constant step size formula. We have focused on the
second order accurate and unconditionally stable BDF (BDF2) and we have implemented a
real adaptive step size BDF2 algorithm using the same strategy as the BDF2 implemented in
the ode15s, resulting the new algorithm more efficient than the one implemented in MATLAB.
Keywords: PDEs, stiff ODEs, Backward Differentiation Formula, adaptive BDF2
1 Introduction
Numerous phenomena of science and engineering are modelled mathematically using systems of
Partial Differential Equations (PDEs). Mass, momentum and energy balances, with appropri-
ate constitutive laws are the basis of a broad class of Boundary Condition (BC) problems from
which the macroscopic movement of solids, fluids and gases with their corresp onding forces
can be deduced. Similarly, flow solutions for heat and mass transport problems can be ob-
tained, and interaction problems between different media (mechanical, thermal, chemical, or
electromagnetic) can be studied.
Procedia Computer Science
Volume 29, 2014, Pages 1014–1026
ICCS 2014. 14th International Conference on Computational Science
1014 Selection and peer-review under responsibility of the Scientific Programme Committee of ICCS 2014
doi: 10.1016/j.procs.2014.05.091
c
The Authors. Published by Elsevier B.V.
Open access under CC BY-NC-ND license.
The mathematical modelling of the continuous media by means of differential equations
shows the existing relationship between different applications which lead to similar boundary
value problems. For example, the Laplace generalized PDE, which represents the behaviour of
many stationary problems, is given by:
·
Cu

Conductive flux
+ Du

Convective f lux
+
Eu

Absortion
= f

Source
(1)
where
C and E are physical constants and D a vector that depends on the problem. This is the
case
of the heat transfer problem where the unknown function
u(x) represents the temperature.
If the convective and absorbing terms are not considered, the Laplace-Poisson PDE is obtained:
· (Cu)=f (2)
Equation
(2) governs the potential problem, which has many applications such as the flux
of an incompressible and non-viscous fluid, the torsion of a profile of any section, the simple
heat conduction or the mass diffusion without convection. All these examples are stationary
but it is enough to add an additional source term related to the inertia to time change to extend
any of these models to the general transient case, with Initial Conditions (IC) and Boundary
Conditions (BC). The simplest representative cases are the diffusion and the wave equation.
The latter is obtained by taking
f = G · u
tt
(x,t):
· Cu(x,t)=G · u
tt
(x,t) u =
G
C
u
tt
(3)
If the unknown function
u(x,t)
represents the transverse displacement of a stretched string
with a force
T (C = T ) and density ρ (G = ρ), the PDE governs the transverse vibrations of
the elastic string.
The analytical solution of PDEs in a general domain is not possible and it is necessary the
use of numerical methods, being the Finite Element Method (FEM) the most capable in general
to deal with any shape domains. After applying the Finite Element Method to the diffusion-type
and wave-type PDEs with boundary conditions and initial conditions, a first order and a second
order Ordinary Differential Equation (ODE) systems are obtained respectively. The process to
obtain approximate solutions of these problems using the FEM, consists of discretizing the
domain in elements and nodes. The solution approach is based on the elimination of the spatial
derivatives of the PDE and this leads to a system of ODEs.
The ODE system that results after the FEM discretization presents high stiffness, which
means that the greater the ratio of the eigenvalues of the Jacobian matrix, the more stiff the
system of ODEs [5, 7, 11]. This means that a non-significant part of the solution requires very
small step sizes to avoid instability of the whole solution. When we are solving systems of stiff
ODEs by numerical integration, it is important to use an accurate algorithm with good stability
properties. Since they were introduced, the Backward Differentiation Formulae (BDF) [4] have
been widely used due to their good stability prop erties.
The software package MATLAB offers a set of codes to solve initial value problems [10, 12]:
y
(t
)=f (t, y(t)) ,y(t
0
)=y
0
(4)
on a finite time interval
T =[t
0
,t
n
]. Some of these ode solvers are recommended to solve nonstiff
problems. This is the case of the two explicit Runge-Kutta codes implemented in MATLAB:
the ode23 which is based on the Bogacki-Shampine 3(2) pair [1] and the ode45 based on the
Implementation of an adaptive BDF2 formula Alb erdi, Anza and Chatzipantelidis
1015
Dormand Prince (5,4) pair [3]. The ode113 is another nonstiff ode solver, which is a PECE
implementation of the Adams Bashforth-Moulton methods [14].
For stiff problems, the most popular code implemented in MATLAB is the ode15s which
uses the Backward Differentiation Formulae (BDF) [4] and the Numerical Differentiation For-
mulae (NDF) [15]. This paper studies the algorithm that supports the ode15s: the underlying
methods, the local error estimation and the adaptation of the step size to verify the specified
error tolerance. The ode15s is a variable order and variable step size algorithm, although it uses
an advancing formula and a local error estimation of the constant step size formula. We have
focused on the second order accurate BDF (BDF2), which is A-stable. We have implemented a
real adaptive step size BDF2 algorithm using the same strategy as the BDF2 implemented in
the ode15s, resulting the one implemented by us more efficient.
The article is organized as follows: characteristics of the ode15s have been studied in Section
2. In Section 3 the implementation of the variable step size new BDF2 is explained. In Section
4 some examples are solved and the number of steps given and the errors obtained are analysed.
Finally, some conclusions are presented in Section 5.
2 The Ode Solver Ode15s
The ode15s is based on the BDF methods [4], and it is possible to use the BDFs of orders
1 5. The final s”oftheode15s indicates that the algorithm is suggested to solve stiff
differential equations [13]. By default ode15s uses NDF methods [15] which based on BDF
methods, anticipate a backward difference of order (
k + 1) when working in order k.Thisterm
has
a positive effect on the local truncation error, making the NDFs more accurate than the
BDFs and not much less stable, see Table 1. This implies that the NDF2 can achieve the same
accuracy as the BDF2 with a step size 26% bigger. This modification was proposed for orders
k =1, 2, 3, 4, because it is inefficient for orders greater than 4.
The code always starts solving in order k = 1, and the maximum order to be reached can be
giv
en to the code as data. Assuming that the values
y
n
+1
, y
n
+2
, ...,
y
n+k1
are available, which
are the approximations to the exact solution at the points
t
n
+ h, t
n
+2h, ..., t
n
+(k 1)h,the
BDFs and NDFs compute the value
y
n+k
y(t
n+k
) using the following expressions:
BDFs:
k
j
=1
1
j
j
y
n+k
=
hf
n+k
.
NDFs:
k
j
=1
1
j
j
y
n+k
=
hf
n+k
+
κγ
k
k
+1
y
n+k
.
being f
n+k
= f(t
n+k
,y
n+k
)andγ
k
=
k
j
=1
1
j
.
k κ %step size A(α)ofBDFs A(α)ofNDFs
1 -0.1850 26% 90
90
2 -1/9 26% 90
90
3 -0.0823 26% 86
80
4 -0.0415 12% 73
66
Table 1: NDFs of Klopfenstein and Shampine: efficiency and stability with respect to BDFs.
In [15] an alternative form to write the left-hand side of these two expressions is given, which
Implementation of an adaptive BDF2 formula Alb erdi, Anza and Chatzipantelidis
1016
is the same for both cases:
k
j
=1
1
j
j
y
n+k
= γ
k
y
n+k
y
(0)
n+k
+
k
j
=1
γ
j
j
y
n+k1
(5)
where:
γ
j
=
j
l
=1
1
l
y
(0)
n+k
=
k
j
=0
j
y
n+k1
=
0
y
n+k1
+ y
n+k1
+ ... +
k
y
n+k1
y
n+k
y
(0)
n+k
=
k
+1
y
n+k
(6)
Taking into account expression (5) the NDFs can be written as follows:
(1
κ) γ
k
y
n+k
y
(0)
n+k
+
k
j
=1
γ
j
j
y
n+k1
= hf
n+k
(7)
where the values of
κ are in the Table 1. BDF methods are obtained for κ =0.
2.1 Error Estimation in the Ode15s
The ode15s uses the lo cal truncation error as the error estimation:
est
LT E = Ch
k+1
y
k
+1
(t
n
)+O
h
k
+2
(8)
be
ing
C the error constant of the method and k the order of the BDF or NDF formula in which
the o
de15s is solving.
Backward differences are used to calculate an approximation of
y
k
+1
(t
n
). An approximation
of
y(t) is obtained by using the backward interpolating polynomial of Newton that passes from
the (
k + 2) points {(t
n+i
,y
n+i
)}
for i = 1, 0, 1, 2, ..., k:
y(t) Q(t
)=y
n+k
+
k
+1
j
=1
j
y
n+k
1
j!h
j
j1
m
=0
(t t
n+km
)(9)
And the (
k + 1)th derivative of expression (9) is calculated:
Q
(k
+1)
(t)=
k
+1
y
n+k
1
(k +1)!h
k
+1
(k +1)!=
k
+1
y
n+k
1
h
k
+1
(10)
Obtaining:
y
(k
+1)
(t) Q
(k
+1)
(t)=
k
+1
y
n+k
1
h
k
+1
(11)
Substituting the approximation (11) in (8), the error estimation of the ode15s in terms of
backward differences is obtained:
LT E
C ·∇
k+1
y
n+k
= est (12)
Implementation of an adaptive BDF2 formula Alb erdi, Anza and Chatzipantelidis
1017
2.2 Step Size Control in the Ode15s
The first step size can be given to the code as data [6]. Nevertheless, a failed step is easily
repaired by the control of the step of the algorithm. Alternatively the ode15s can automatically
set a trial first step size.
The ode15s is not allowed to change either the order or the step size until a minimum of
(k + 2) consecutive steps are given using the same order formula and the same step size. If one
step
is unsuccessful, the order of the method or the step size are reduced. When the compulsory
(k + 2) successful steps are given, it is possible to change the order and the step size. In this
case, the step sizes which correspond to orders (
k 1) (for k>1), k and (k + 1) (whenever the
maximum order defined has not been reached) are calculated.
After advancing from
t
n1
to t
n
with step size h using the k-order BDF/NDF formula, the
local error estimation of the ode15s is:
est
LT E = h
k
+1
φ(t
n
)+O(h
k
+2
) (13)
We will suppose that we have just given a step using a step size
h and that we are interested
in
calculating the next step size which corresponds to order
k. This step size could be a new step
or the repetition of the previous step because it has not been verified the tolerance requirement.
In b oth cases, the next step size is calculated by multiplying the previous step size by a constant
σ. Hence, the next step size will be (σ · h) and the lo cal error will be [13]:
(σ · h)
k
+1
φ(t
n
+1
)+
O
(σh)
k
+2
(14)
By making use of Taylor’s developments:
φ(t
n
+1
)=
φ(t
n
)+
(t
n
)+O
h
2
(15)
Expression (14) turns into:
(σ · h)
k
+1
φ(t
n
+1
)+
O
(σh)
k
+2
= σ
k
+1
h
k
+1
φ(t
n
)+O
h
k
+2
= σ
k
+1
est
+ O
h
k
+2
(16)
Expression
(16) gives the local error made with a step size (
σ · h). The largest step size that
will
pass the error test is calculated by chosing
σ so that σ
k
+1
est≈Rtol is verified, where
Rtol is the specified tolerance. This step size is:
σ · h =
Rtol
est
1
/k+1
· h (17)
Because a failed step is expensive, the co des use a fraction of the predicted step. The ode15s
uses a safety factor
F
S
=
5
6
and the new step size for order k is:
h
k
= F · h
(18)
where
F = F
S
· σ
. A new variable z is defined as follows:
z =1.2
est
Rtol
1/(k
+1)
(19)
Taking into account (19) the factor
F =1/z represen
ts the hyperbola of Figure 1. Two regions
can be clearly distinguished, separated by
est = Rtol,where
z
S
=1.2 is verified. In this
case, the factor F takes the value of the safety factor: F
S
=
5
6
. For a trial step h,theode15s
Implementation of an adaptive BDF2 formula Alb erdi, Anza and Chatzipantelidis
1018
z
S
F
U
F
L
F
S
z
U
z
L
z
F
failed step
successful
step
Figure 1: The factor F as function of the variable z.
computes the values of est and z, and the step is considered successful if z z
S
=1.2is
verified.
When the given step is successful, that is to say
z [0, 1.2], or equivalently F
5
6
,
,an
upper threshold
F
U
= 10 is e stablished and the step size of the k-order method is defined as:
h
k
=
F
U
·
h, z z
U
F ·
h, z
S
<z z
U
(20)
where
F
U
= 10, z
U
=
1
F
U
=0.1andz
S
=1.2.
In a similar way, the step sizes
h
k1
and h
k
+1
whichcorrespondtothemethodsoforders
(k 1) and (k + 1) are calculated, being the safety factors
10
13
and
10
14
respectively. The error
estimations of the methods of order (
k 1) and (k + 1) are calculated, est
k1
and est
k+1
.
And the actual step size is multiplied by the factors F
k1
=
1
z
k1
and F
k
+1
=
1
z
k
+1
respectively:
z
k1
=1.3 ·
est
k1
Rtol
1
/k
,z
k+1
=1
.4 ·
est
k+1
Rtol
1/(k
+2)
(21)
The step sizes
h
k1
and h
k
+1
are defined as follows, being the upper thresholds
F
k1
,U
=10
and
F
k
+1,U
= 10:
h
k1
=
F
k1
,U
· h, z
k1
z
k1,U
F
k1
· h, z
k1,S
<z
k1
z
k1,U
(22)
h
k
+1
=
F
k
+1,U
· h, z
k+1
z
k
+1,U
F
k
+1
· h, z
k+1,S
<z
k+1
z
k
+1,U
(23)
where
z
k1
,U
=0
.1, z
k1
,S
=1
.3, z
k
+1,U
=0
.1andz
k
+1,S
=1
.4.
When the step sizes
h
k
, h
k1
and h
k
+1
are available, the process that the ode15s follows to
set the next step size is this one:
Implementation of an adaptive BDF2 formula Alb erdi, Anza and Chatzipantelidis
1019
1. If h
k1
>h
k
is verified, the following assignments are made: h
new
= h
k1
and k
new
=
k
1. If h
k1
>h
k
is not verified, h
new
= h
k
and k
new
= k are considered.
2. Next,
h
k
+1
and
h
new
are compared. If
h
k
+1
>h
new
,thevalue
h
k
+1
is stored in
h
new
and
one unit is added to the order
k
new
.
3. Finally, the value h
new
is compared with the step size
h used in the last step. If h
new
>h
,
the next step size will b e h
new
and it will be given with order
k
new
. If not, the order and
the step size of the last step are maintained.
When the given step is unsuccessful, the step is repeated. The step size of the
k-order
form
ula is calculated using a lower threshold
F
L
=0.1 as follows:
h
k
=
F ·
h, z
S
<z z
L
F
L
·
h, z > z
L
(24)
where
z
L
=
1
F
L
=10andz
S
=1.2 as before.
When k>1, the step size for order (
k 1) is also calculated as:
h
k1
=
F
k1
·
h, z
k1,S
<z
k1
z
k1,L
F
k1
,L
· h, z
k1
>z
k1,L
(25)
where
F
k1
,L
=0
.1, z
k1
,L
=
1
F
k1
,L
=10and
z
k1
,S
=1
.3 as before.
If
h
k1
>h
k
, the next step will be given using the (k 1)-order formula and the step size
will be the minimum value between the present step
h and h
k1
.
In second or posterior trials after an unsuccessful step, the new step size is calulated by
dividing by 2 the actual step.
3 Adaptive step size BDF2
Even though the ode15s changes the step size depending on the local error estimation, the
advancing formula that uses for the BDFs or NDFs is the constant step size formula. We will
focus on the second order accurate and unconditionally stable BDF2. The advancing formula
used by the ode15s for this method is:
3
2
y
n
+2
2y
n
+1
+
1
2
y
n
=
hf
n+2
(26)
which is the constant step size formula. And the same happens with the expression used to
approximate the local truncation error (12).
Nevertheless, the advancing formula of the adaptive step size BDF2 is given by the next
expression [6]:
y
n
+2
(1 + w
n
+1
)
2
1+2w
n
+1
y
n
+1
+
w
2
n
+1
1+2w
n
+1
y
n
= h
n
+2
1+
w
n
+1
1+2w
n
+1
f
n
+2
(27)
being
w
n
+1
= h
n
+2
/h
n+1
, h
n
+2
= t
n
+2
t
n
+1
and
h
n
+1
= t
n
+1
t
n
.
Taking into account the adaptive advancing formula of the BDF2, the local truncation error
of
the adaptive step size BDF2 becomes:
LT E
= y(t
n
+2
) y
n
+2
h
2
n
+2
(h
n
+1
+ h
n
+2
)
6
y
(3)
(t
n
+2
) (28)
Implementation of an adaptive BDF2 formula Alb erdi, Anza and Chatzipantelidis
1020
Approximating the third derivative of (28) by:
y
(3)
(t
n
+2
)
1
h
2
n
+2
y
n
+2
y
n
+1
h
n
+2
1+
h
n
+2
h
n
+1
y
n
+1
y
n
h
n
+1
+
h
n
+2
h
n
+1
h
n
(y
n
y
n1
)
(29)
and substituting (29) in (28), the expression of the local truncation error of the adaptive step
size BDF2 is obtained:
LT E
(h
n
+1
+ h
n
+2
)
6
y
n
+2
y
n
+1
h
n
+2
1+
h
n
+2
h
n
+1
y
n
+1
y
n
h
n
+1
+
h
n
+2
h
n
+1
h
n
(y
n
y
n1
)
(30)
being
h
n
= t
n
t
n1
.
4 Numerical Results
In this section some problems are solved using the BDF2 in two different ways:
Case A: The advancing formula (26) and the local truncation error (12) of the constant
step
size BDF2 have been implemented. This is the way in which the ode15s operates
but it also changes the order of the method. In this case the order is fixed:
k =2. The
same criterion used in the ode15s to change the step size depending on the local error
estimation has been implemented: the step size that follows a successful step is calculated
using (20) and the failed steps are repeated by dividing the step size by 2.
Case B: The adaptive advancing formula (27) and the adaptive local truncation error (30)
of
the BDF2 are implemented. The new step size is defined depending on the local error
estimation, in the same way as in the Case A.
The initialization of both algorithms (Case A and B) has been done in the same way. The use
of the local truncation error as the local error control requires three previous values,
y
n1
, y
n
,
y
n
+1
. Hence, two additional values are required in the beginning, which have been calculated
by the trapezoidal rule. In both cases, the first step size
h
0
has been taken as:
h
0
=
T
steps
ode15
s
(31)
being
T thetimeintervalandsteps
ode15
s
the number of steps given by the ode15s when solving
the same problem. The second step size
h
1
has been given using the same value as h
0
.
4.1 Example 1
Consider the problem [16]:
y
(t
)=λ(y(t) g(t)) + g
(t),T=[0, 2.5],y(0) = 1 (32)
being
λ = 10
6
and g(t)=sin(10t)+t. Its exact solution is given by:
y(t)=e
λt
+ g(t) (33)
In Table 2 the number of steps given by each algorithm when different values of Rtol are
considered are tabulated. The number of steps given by the ode15s is also included. We can
observe that the algorithm that uses the variable step formula (Case B) gives less steps than
Implementation of an adaptive BDF2 formula Alb erdi, Anza and Chatzipantelidis
1021
the other. For Rtol =10
3
the total computational time of the algorithm of the Case B is
four times smaller than the one of the Case A. And for Rtol =10
4
, the algorithm of the Case
B is 50 times quicker than the one of the Case A. In Figure 2 we can see the euclidean norm
of the error (difference between the exact value and the numerical value) during the interval
of integration. We can observe that the errors of the algorithm B are smaller than the ones
obtained with the algorithm A. The ode15s is superior as it works in variable order 1
5and
in this problem it gives many steps in order 4.
Rtol Case A Case B ode15s
10
3
8638
steps 874 steps 160 steps
10
4
78175
steps 3024 steps 206 steps
Table 2: Number of steps given in example 1.
0 0.5 1 1.5 2 2.5
10
−14
10
−12
10
−10
10
−8
10
−6
10
−4
10
−2
10
0
10
2
t
error
Example 1, Rtol=10
−3
Case A
Case B
Ode15s
0 0.5 1 1.5 2 2.5
10
−14
10
−12
10
−10
10
−8
10
−6
10
−4
10
−2
10
0
10
2
t
error
Example 1, Rtol=10
−4
Case A
Case B
Ode15s
Figure 2: Euclidean norm of the error during the simulation in example 1.
4.2 Example 2
Consider the system of differential equations considered in [8]:
y
1
=
20y
1
0.25y
2
19.75y
3
y
2
=20y
1
20.25y
2
+0.25y
3
y
3
=20y
1
19.75y
2
0.25y
3
,
T
=[0, 10],y(0)
= (1
, 0, 1)
T
(34)
The exact solution of this problem is:
y
1
(t
)=
1
2
e
0.5t
+ e
20t
(cos 20t +sin20t)
y
2
(t
)=
1
2
e
0.5t
e
20t
(cos 20t sin 20t)
y
3
(t
)=
1
2
e
0.5t
+ e
20t
(cos 20t sin 20t)
The variable step size algorithm (Case B) requires less steps than the algorithm A, Table
3.
The computational time of both algorithms is similar for Rtol =10
3
;forRtol =10
4
the
algorithm B is 3 times quicker and it is 16 times quicker for Rtol =10
5
. The errors obtained
by the algorithm B are also smaller than the ones obtained by the algorithm A, see Figure 3.
Again, the o
de15s is superior as many steps are given in order 4.
Implementation of an adaptive BDF2 formula Alb erdi, Anza and Chatzipantelidis
1022
Rtol Case A Case B ode15s
10
3
430
steps 126 steps 64 steps
10
4
3385
steps 329 steps 89 steps
10
5
28979
steps 1202 steps 122 steps
Table 3: Number of steps given in example 2.
0 2 4 6 8 10
10
−7
10
−6
10
−5
10
−4
10
−3
10
−2
10
−1
10
0
t
error
Example 2, Rtol=10
−3
Case A
Case B
Ode15s
0 2 4 6 8 10
10
−7
10
−6
10
−5
10
−4
10
−3
10
−2
10
−1
10
0
t
error
Example 2, Rtol=10
−4
Case A
Case B
Ode15s
0 2 4 6 8 10
10
−8
10
−7
10
−6
10
−5
10
−4
10
−3
10
−2
10
−1
10
0
t
error
Example 2, Rtol=10
−5
Case A
Case B
Ode15s
Figure 3: Euclidean norm of the error during the simulation in example 2.
4.3 Example 3
We consider the following stiff system considered by Hosseini and Hojjati in [9].
y
1
= 0.1y
1
49.9y
2
y
2
=
50y
2
y
3
=70y
2
120y
3
,
T
=[0, 1],y(0)
= (2
, 1, 2)
T
(35)
with stiffness ratio 1200 and exact solution:
y
1
(t
)=e
50t
+ e
0.1t
y
2
(t
)=e
50t
y
3
(t
)=e
50t
+ e
120t
Agai
n the algorithm of the case B requires less computational time, about 10 times less than
the algorithm A for Rtol =10
5
and the results are superior, see Table 4 and Figure 4.
Implementation of an adaptive BDF2 formula Alb erdi, Anza and Chatzipantelidis
1023
Rtol Case A Case B ode15s
10
3
75 steps 40 steps 68 steps
10
4
702
steps 275 steps 87 steps
10
5
13224
steps 727 steps 104 steps
Table 4: Number of steps given in example 3.
0 0.2 0.4 0.6 0.8 1
10
−8
10
−7
10
−6
10
−5
10
−4
10
−3
10
−2
10
−1
10
0
t
error
Example 3, Rtol=10
−4
Case A
Case B
Ode15s
0 0.2 0.4 0.6 0.8 1
10
−10
10
−8
10
−6
10
−4
10
−2
10
0
t
error
Example 3, Rtol=10
−5
Case A
Case B
Ode15s
Figure 4: Euclidean norm of the error during the simulation in example 3.
4.4 Example 4
We consider the following stiff system as considered by Cash in [2]:
y
1
=
αy
1
βy
2
+(α + β 1)e
t
y
2
=
βy
1
αy
2
+(α β 1)e
t
,
T
=[0, 20],y(0)
= (1
, 1)
T
(36)
The eigenvalues of the Jacobian matrix are
α ± βi,
and its exact solution is this one:
y
1
(t)=y
2
(t)=e
t
. We have solved the problem for α =1 =15. InTable5thenumber
of steps given in each case is tabulated. The variable step size algorithm (Case B) requires
less steps than the algorithm A. In all the cases the computational time of the algorithm B
is smaller than the one of the algorithm A: 10 times smaller for Rtol =10
3
, 3 times smaller
for Rtol =10
4
and 30 times smaller for Rtol =10
5
. Again, the results obtained with the
algorithm B are smaller than the ones obtained with the algorithm A, see Figure 5. This time
the adaptive BDF2 algorithm is also more efficient than the ode15s. Thisisbecausetheode15s
only reaches order 3 in this problem. In Figure 6 we can see the error estimations and the step
sizes given by the ode15s in this problem. The order in which each step has been given has
been represented too.
Rtol Case A Case B ode15s
10
3
403
steps 41 steps 414 steps
10
4
3607
steps 353 steps 399 steps
10
5
35311
steps 654 steps 387 steps
Table 5: Number of steps given in example 4.
Implementation of an adaptive BDF2 formula Alb erdi, Anza and Chatzipantelidis
1024
0 5 10 15 20
10
−9
10
−8
10
−7
10
−6
10
−5
10
−4
10
−3
10
−2
10
−1
t
error
Example 4, Rtol=10
−3
Case A
Case B
Ode15s
0 5 10 15 20
10
−9
10
−8
10
−7
10
−6
10
−5
10
−4
10
−3
10
−2
10
−1
t
error
Example 4, Rtol=10
−4
Case A
Case B
Ode15s
Figure 5: Euclidean norm of the error during the simulation in example 4.
0 5 10 15 20
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
x 10
−3
t
error estimation
0 5 10 15 20
0
0.02
0.04
0.06
0.08
0.1
0.12
new step size
t
+ order 2
o order 1
* order 3
Figure 6: Error estimation and step sizes for example 4 in ode15s, Rtol =10
3
.
5 Conclusions
When we are solving systems of stiff ODEs by numerical integration, it is crucial the use of
algorithms with good accuracy and stability properties. It can be concluded from this analysis
that in general, the adaptive BDF2 algorithm is more efficient than the one that uses the
constant step size advancing formulae.
Acknowledgements. The first author was partially funded by the Basque Government Con-
solidated Research Group Grant IT649-13 on “Mathematical Modeling, Simulation, and Indus-
trial Applications (M2SI)”.
References
[1] P. Bogacki and L. F. Shampine. A 3(2) pair of Runge-Kutta formulas. Appl. Math. Lett., 2:1–9,
1989.
[2] J. R. Cash. On the integration of stiff systems of ODEs using extended backward differentiation
formula. Numer. Math., 34 (2):235–246, 1980.
Implementation of an adaptive BDF2 formula Alb erdi, Anza and Chatzipantelidis
1025
[3] J. R. Dormand and P. J. Prince. A family of embedded Runge-Kutta formulae. J. Comput. Appl.
Math., 6 (1):19–26, 1980.
[4] C.W.Gear. Numerical initial value problems in Ordinary Differential Equations. Prentice Hall,
New Jersey, 1971.
[5] E. Hairer and G. Wanner. Solving ordinary differential equations, II, Stiff and Differential Algebraic
Problems. Springer, Berlin, 1991.
[6] E. Hairer, G. Wanner, and S. P. N ørsett. Solving ordinary differential equations, I, Nonstiff
problems. Springer, Berlin, 1993.
[7] M.T.Heath.Scientific Computing. An introductory survey. Mc Graw Hill, New York, 1997.
[8] G. Hojjati, M. Y. Rahimi Ardabili, and S. M. Hosseini. A-EBDF: an adaptative method for
numerical solution of stiff systems of ODEs. Math. Comput. Simul., 66:33–41, 2004.
[9] S. M. Hosseini and G. Hojjati. Matrix-free MEBDF method for numerical solution of systems of
ODEs. Math. Comput. Modell., 29:67–77, 1999.
[10] The Math Works Inc. http://www.mathworks.com.
[11] J. D. Lambert. Computational Methods in Ordinary Differential Equations. Wiley, London, 1973.
[12] L. F. Shampine and R. M. Corless. Initial value problems for ODEs in problem solving environ-
ments. J. Comput. Appl. Math., 125:31–40, 2000.
[13] L. F. Shampine, I. Gladwell, and S. Thompson. Solving ODEs with Matlab. Cambridge University
Press, New York, 2003.
[14] L. F. Shampine and M. K. Gordon. Computer Solution of Ordinary Differential Equations: The
Initial Value Problem. W. H. Freeman, San Francisco, 1975.
[15] L. F. Shampine and M. W. Reichelt. The MATLAB ODE Suite. SIAM J. Sci. Comput.,18
(1):1–22, 1997.
[16] J. Vigo-Aguiar, J. Martin-Vaquero, and R. Criado. On the stability of exponential fitting BDF
algorithms. Journal of Computational and Applied Mathematics, 175:183–194, 2005.
Implementation of an adaptive BDF2 formula Alb erdi, Anza and Chatzipantelidis
1026
... The partial differential equations (PDEs) for interpellet mass transfer and the kinetic model were converted to ordinary differential equations (ODEs) using the method of lines (MOL), and then the ODE15S function in MATLAB R2018a was used to solve them. The ODE15S is a variable-step, variable-order (VSVO) solver that is based on the backward differentiation formula (BDF) of orders 1 to 5 [41,42]. As a result of the flexibility in choosing the step size, simulations are more efficient than those using fixed-step integration algorithms [43]. ...
... As a result of the flexibility in choosing the step size, simulations are more efficient than those using fixed-step integration algorithms [43]. This code is specifically designed to solve stiff differential equations [41]. ...
Article
Exposure to ozone can cause several adverse health effects on human beings. Carbon-based filters are usually used for the removal of ozone from indoor air. The main problem with Carbon-based filters technology is the exhaustion of carbon because of irreversible reactions with ozone. Therefore, the knowledge of the service life of filters is crucial for building engineers and designers. Since testing at low indoor concentrations is time-consuming and expensive, the existing standards suggest experimenting with high concentrations. Thus, predictive models need to be developed to estimate the service life of filters. This work provides a model to estimate the breakthrough curves of three different combined (multi-layer) filters. The model augmented mass transfer equations with a reaction rate model and divided them into interpellet mass transfer and kinetic models. First, the reaction rate parameters were measured by fitting the model onto experimental data of all filters challenged with 9 ppm or 90 ppm of ozone. This was followed by validating the model for lower concentrations. In addition, to show the model validity for real-life application, its prediction was compared with the experimental data collected using the full-scale experimental setup and higher velocity. There was excellent agreement between the model prediction and the experimental results for all filters. Furthermore, an inter-model comparison was performed to determine the importance of different mass transfer steps. The results showed internal diffusion and axial dispersion as rate-limiting steps along with reaction. Finally, a sensitivity analysis was conducted on reaction kinetic parameters, axial dispersion coefficient, external mass transfer coefficient, and activated carbon particle porosity, which indicated negligible effects of external mass transfer and porosity variations.
... The entire calculation process is achieved using the commercial software MATLAB, and Eq. (9)is numerically solved using the MATLAB function ODE15s [38]. The pseudocode of the entire reduced-plate model transmission method is presented in Table 1. ...
Article
A reduced-plate model transmission method is developed in this study to accurately and efficiently analyze the vehicle-pavement interaction dynamics over long travel distances. A wide pavement is reduced to many small areas (referred to as the reduced-plate models) along the vehicle-moving trajectory, and each reduced-plate model accounts for the vibration of the plate structure caused by the moving vehicle in a small period. All reduced-plate models are assumed as stationary in the global coordinate system, and the vehicle moves from one reduced-plate model to another. The dynamic equations of the reduced-plate model are derived using the modal su-perposition method (MSM) and Lagrange's equations, and the calculation results of one reduced-plate model are considered as the initial conditions of the next reduced-plate model. Because only the reduced-plate model that is located inside the vehicle needs to be calculated in different periods, the number of degrees of freedom of the model is significantly reduced, and its calculation efficiency is increased. In addition, the present model is simple and better reflects the real situation of the vehicle-pavement interaction. After validating the present model, it is used in the vehicle-pavement interaction dynamic analysis during a long-distance travel. The calculation results obtained from the reduced-plate model transmission method are in good agreement with the MSM results for an entire plate, and the calculation time of the reduced-plate model transmission method is only one-third of that using the MSM for the entire plate. The calculation results further show that road roughness has a significant influence on the vehicle-pavement interaction dynamics in different situations. The Young's modulus and thickness of the base course layer also have a leading influence on pavement dynamic responses in the vehicle-pavement interaction system, where the variation of these parameters can lead to excessive responses of the pavement structure.
... Prior to turn-on of the heat source, the model calculates the response of the optic under zero load, time stepping until it reaches t = 0.05 s. Time stepping is accomplished using an adaptive backward differentiation formula (BDF) [15] to estimate the size of the next time step based on changes in observables at the current time step. Each time step requires a complete, converged model solution as described in Fig. 5. Due to the significant resources required to calculate a single time step it is therefore desirable to minimize the number of steps needed to reach the desired end time while capturing sufficient detail of the response dynamics. ...
Article
Full-text available
We used COMSOL Multiphysics to design a prototype actively cooled “flow-cell” substrate targeted at high-average-power applications, fabricated the prototype from cordierite ceramic, and tested the substrate under load in our thermal loading test stand. Sub-aperture testing revealed average-power handling up to 3.88-W/cm^2 absorbed power density, in excellent agreement with model predictions. Gratings fabricated on 2-in.-diam cordierite coupons were subjected to laser-damage testing and showed a damage threshold of 250 mJ/cm^2.
... ODE15s is a variable step continuous implicit solver based on the backward differentiation and the numerical differentiation formulae of the Gear's first order implicit method. This method can be used for backward differentiation of orders 1 to 5 and stiff differential equations (Celaya et al., 2014). The initial concentration of vanillin was 1 mol L −1 , while that of all other species were zero. ...
Article
Full-text available
Vanillin is a major fine chemical in the flavoring industry and one of the pyrolysates from lignin. In order to understand the primary decomposition pathways of vanillin, analytical fast pyrolysis experiments were performed in the temperature range of 500°C–650°C, and the primary pyrolysates were quantified. The proposed pyrolysis chemistry involves 31 elementary reactions of 23 species. Thermodynamic and kinetic analyses were performed using quantum chemical density functional theory calculations. Reaction pathways for the formation of three major phenolics, viz., guaiacol, 5-formylsalicyaldehyde and 4-hydroxybenzaldehyde, that accounted for ∼80 wt% yield at 650°C, were proposed. Based on the bond dissociation energies (BDEs) of homolytic cleavage of the various bonds in vanillin, the primary reaction is shown to involve the cleavage of O–CH 3 bond whose BDE is 61.4 kcal mol ⁻¹ . New bimolecular reactions such as ipso-addition involving the reaction of vanillin with hydrogen and methyl radicals were proposed. The generation of 4-hydroxy methoxybenzyl radical was found to be vital for the formation of guaiacol, while 4-hydroxy-3-(λ ³ -methoxyl) benzaldehyde radical was the key intermediate for the formation of 5-formylsalicyaldehyde. Multiple pathways for the formation of guaiacol, 5-formylsalicyaldehyde, catechol and 4-hydroxybenzaldehyde were evaluated. In order to track the time evolution of vanillin and its major pyrolysates, a detailed kinetic model was developed using the elementary reactions and their Arrhenius rate parameters. Based on the kinetic model, it is inferred that the timescale of fast pyrolysis is captured well by the model.
... We discretize the time interval into t 0 < t 1 < … < t n < … < t f and define the time-step size as Δt n = t n − t n− 1 , approximate ξ(t n ), ξ (t n ), ζ + (t n ) and ζ + (t n ), respectively, as ξ n , ξ n , ζ +n and ζ +n , and express the time increments as Δ • = • n+1 − • n for • = ξ,ξ,ζ + ,ζ + . We use a secondorder approximation of the time derivative at t n+1 as follows [109], ...
Article
We describe a phase-field model for the electrodeposition process that forms dendrites within metal-anode batteries. We derive the free energy functional model, arriving at a system of partial differential equations that describe the evolution of a phase field, the lithium-ion concentration, and an electric potential. We formulate, discretize, and solve the set of partial differential equations describing the coupled electrochemical interactions during a battery charge cycle using an open-source finite element library. The open-source library allows us to use parallel solvers and time-marching adaptivity. We describe two-and three-dimensional simulations ; these simulations agree with experimentally-observed dendrite growth rates and morphologies reported in the literature.
... This transformation changes the system of partial differential equations (PDEs) into the system of ordinary differential equations (ODEs). The resulting system of ODEs is solved using a well established MATLAB ODE solver like ode15s, ode23 [116,117], etc. The partial derivatives in equation (3.29) are approximated as follows ...
... , respectively, as ξ n ,ξ n , ζ +n and˙ ζ +n , and express the time increments as ∆• = • n+1 − • n for • = ξ,ξ, ζ + ,˙ ζ + . We use a second-order approximation of the time derivative at t n+1 as follows [98], ...
Preprint
Full-text available
We describe a phase-field model for the electrodeposition process that forms dendrites within metal-anode batteries. We formulate, discretize, and solve the set of partial differential equations describing the coupled electrochemical interactions during a battery charge cycle using an open-source finite element library. We derive the free energy functional model, arriving at a system of partial differential equations that describe the evolution of a phase field, the lithium-ion concentration, and an electric potential. The open-source library allows us to use parallel solvers and time-marching adaptivity. We describe two- and three-dimensional numerical experiments; these simulations agree with experimentally-observed dendrite growth rates and morphologies reported in the literature.
... where BS is the boundary of the reduced plate area. These dynamic equations are solved numerically using the stiff differential equations solver ode15 s [21] in MATLAB. ...
A new moving Kirchhoff-Love plate element is developed in this work to accurately and efficiently calculate the dynamic response of vehicle-pavement interaction. Since the vehicle can only affect a small region nearby, the wide pavement is reduced to a small reduced plate area around the vehicle. The vehicle loads moving along an arbitrary trajec-tory is considered, and the arbitrary Lagrangian-Eulerian (ALE) method is used here for coordinate conversion. The reduced plate area is spatially discretized using the current moving plate element (MPE), where its governing equations are derived using Lagrange's equations. The moving plate element is validated by different plate subjected to moving load cases. Then a vehicle-pavement interaction case with constant and variable speed is analyzed here. The calculation results from the moving plate element are in good agreement with those from the modal superposition method (MSM), and the calculation time with the moving plate element is only one-third of that using the MSM. It is also found that the moving load velocity and ground damping have great influences on reduced plate area length of the RBM. The moving plate element is accurate and more efficient than the MSM in calculating the dynamic response of the vehicle-pavement interaction .
Article
Full-text available
A program is presented for solving initial value problems for ODEs numerically in Maple. We draw upon our experience with a number of closely related solvers to illustrate the differences between solving such problems in general scientific computation and in the problem solving environments Maple and MATLAB.
Book
Full-text available
From the Publisher: This book is for people who need to solve ordinary differential equations (ODEs), both initial value problems (IVPs) and boundary value problems (BVPs) as well as delay differential equations (DDEs). These topics are usually taught in separate courses of length one semester each, but solving ODEs with Matlab provides a sound treatment of all three in about 250 pages. The chapters on each of these topics begin with a discussion of "the facts of life" for the problem, mainly by means of examples. Numerical methods for the problem are then developed - but only the methods most widely used. Although the treatment of each method is brief and technical issues are minimized, the issues important in practice and for understanding the codes are discussed. Often solving a real problem is much more than just learning how to call a code. The last part of each chapter is a tutorial that shows how to solve problems by means of small but realistic examples.
Article
In this paper, we present the details of a new method which is a hybrid method of MF-BDF and MEBDF. To obtain this new method which we call MF-MEBDF, we compose the matrix free properties of the first method and the accuracy of MEBDF, elaborately. Application of this new method to some important stiff problems show that MF-MEBDF is generally faster than MEBDF and more accurate than MF-BDF and MEBDF. Since in MEBDF, the LU factorization is used, we expect MF-MEBDF to be more efficient than the other two methods for large stiff systems of ODEs.
Article
A class of extended backward differentiation formulae suitable for the approximate numerical integration of stiff systems of first order ordinary differential equations is derived. An algorithm is described whereby the required solution is predicted using a conventional backward differentiation scheme and then corrected using an extended backward differentiation scheme of higher order. This approach allows us to developL-stable schemes of order up to 4 andL()-stable schemes of order up to 9. An algorithm based on the integration formulae derived in this paper is illustrated by some numerical examples and it is shown that it is often superior to certain existing algorithms.
Article
A family of embedded Runge-Kutta formulae RK5 (4) are derived. From these are presented formulae which have (a) ‘small’ principal truncation terms in the fifth order and (b) extended regions of absolute stability.
Article
We present BDF type formulas capable of the exact integration (with only round-off errors) of differential equations whose solutions are linear combinations of an exponential with parameter λ and ordinary polynomials. For λ=0 new formulas reduces to the classical BDF formulas. Plots of their 0-stability regions in terms of λ are provided. Plots of their regions absolute stability that include all the negative real axis are provided. Numerical examples shows the efficiency of the proposed codes, specially when we are integrating stiff oscillatory problems.