CHEE 502: Advanced Chemical Engineering Analysis Class Notes - Fall 2008
CHEE 502: Advanced Chemical Engineering Analysis Class Notes - Fall 2008
CHEE 502: Advanced Chemical Engineering Analysis Class Notes - Fall 2008
INTRODUCTION
MATHEMATICAL MODELING
(1) Conceptual description of the process. Usually, this step involves the formulation of a
"model" problem that we hope that can represent the real physical problem that we are trying to
model. This step usually involves formulating simplifying assumptions or hypothesis about the
system's behavior.
(2) Establish the conservation principles to be used. Find the appropriate version of the mass
and/or energy conservation equations. If the equations are differential equations, find the
appropriate boundary and/or initial conditions to be applied.
(3) Determine the physical properties and constitutive equations to be used (e.g, ideal gas
equation of state, Fourier's law of heat conduction.)
(4) Make plausible assumptions to simplify these equations as much as possible. The
assumptions must be verified, either a priori or a posteriori.
(5) Simplify the equations to form a coherent, well-posed system.
(6) Solve the equations, either analytically or numerically.
Advanced Chemical Engineering Analysis – Fall 2008 1
(7) Before the solution is used, the model must be validated. Typically, this involves finding a
similar but simpler problem for which a solution is known, and then simplifying the model to
verify that the simpler problem is adequately described.
(8) Since the model never can be validated exactly for the problem considered, at this point
there are no assurances that the mathematical solution found is correct. To increase the level of
confidence in the model, study the response of the model to variation in conditions and
parameters (i.e., a sensitivity analysis to be used for validation purposes).
(9) Apply the model.
The main focus of this course will be point (6) above, but the rest of the steps in model
development will be presented when relevant. The course is organized in terms of specific
models. Each chapter will start with the formulation of a model and then the mathematical tools
necessary to solve the model will be explored. The following mathematical techniques will be
explored:
Analytical methods:
Numerical methods:
MODEL 1
The Adiabatic, Continuous-Flow Stirred Tank Reactor (CSTR)
Mathematical Aspects
(1) Solution of nonlinear algebraic equations.
(2) Solution of simple ordinary differential equations.
(3) Numerical solution of initial value problems.
Figure 1. Continuously-stirred tank reactor (CSTR) and notation used in the mole
balance of species A.
(4) The reactor is adiabatic: all energy interactions between the reactor and its surroundings
occur through inlet and outlet flows. In addition, we will consider that there is no viscous
Advanced Chemical Engineering Analysis – Fall 2008 3
The terms on the right-hand side of this equation will be positive whenever mass of species
enters or is created by chemical reaction, and negative whenever mass of species leaves or is
destroyed by chemical reaction. In reactive systems, the species balance is expressed more
commonly in terms of moles. Let A be the chemical species for which we write the mass
conservation principle. To convert equation (1) to moles, we divide both sides by the molecular
weight of A, and the balance becomes
The time rate of change of the The net rate at which moles
=
total moles of A in the reactor of A enter the reactor
The net rate at which (2)
+ moles of A are created
by chemical reaction
To express equation (2) in mathematical form, we first will define an intensive property to
quantify the reaction rate. Let RA be the rate of reaction of A, representing the net number of
moles of A that are created by chemical reaction per unit time and per unit volume of reaction
mixture. Equation (2) can be written as (refer to Figure 1 for notation):
d (Vc A )
= Qc Ai − Qc A + R A V (3)
dt
In general, the rate of reaction will depend on the concentrations of the various species that
participate in the chemical reactions that occur in the mixture. For example, if species A
undergoes an irreversible, elementary decomposition:
A → Pr oducts (4)
R A = −kc A (5)
Advanced Chemical Engineering Analysis – Fall 2008 4
where k is the reaction rate constant, which can be expressed as a function of temperature using
Arrhenius equation,
E
− a
k = k 0 e RT (6)
where k0 is a constant, Ea is the activation energy of the reaction, R is the gas constant and T is
the absolute temperature in the reactor. First, let us consider the case in which the temperature is
constant, then k will be constant and equation (3) can be solved analytically. Knowing that this is
a constant volume system, equation (3) can be rearranged as follows,
dc A Q Q
+ k + c A = c Ai (7)
dt V V
c A = c A 0 , t=0 (8)
The quantity tR=V/Q is the residence time in the reactor and its use in equation (7) leads to
dc A 1 1
+ k + c A = c Ai (9)
dt tR tR
Equation (9) can be integrated by direct separation and integration. Alternatively, the equation
can be solved using the integrating factor technique, which is applicable to first order ordinary
differential equations of the form
dy
+ αy = f ( t ) (10)
dt
The integrating factor technique is based on the use of the following identity
d ( ye αt ) dy αt
= e αt + e αy (11)
dt dt
Note that, if we multiply equation (10) by e αt , then the left-hand side of the resulting
equation is precisely the right-hand side of equation (11). Therefore, equation (10) becomes
d ( ye αt )
= e αt f ( t ) (12)
dt
t
ye αt − y 0 = ∫ e αt f ( t )dt (14)
0
t
y ( t ) = e − αt y 0 + ∫ e αt f ( t )dt (15)
0
−(1+ kt R ) t
t
c c
c A = Ai + c A 0 − Ai e R (16)
1 + kt R 1 + kt R
This equation predicts that a steady state will be reached at long times:
c Ai
lim c A ( t ) = = c Ass , steady state (17)
t →∞ 1 + kt R
− (1+ kt R )
t
c A = c Ass + (c A 0 − c Ass )e tR (18)
Figure 2 shows the behavior of this solution: the concentration will increase or decrease
monotonically with time, depending on whether the initial concentration in the reactor is lower
or higher than the steady state value, respectively. The steady state value will be approached
asymptotically.
The application of this energy balance to the reactor is presented in detail in Appendix A. Here
we will state the final equation obtained (equation A.29):
Advanced Chemical Engineering Analysis – Fall 2008 6
cA
cA0
cA0>cAss
cAss
cA0<cAss
cA0
t
Figure 2. Qualitative behavior of the concentration of A with time, when A undergoes a first
order consumption in an isothermal CSTR.
dT R
ρVC p = ρQC p (Ti − T) − V A ∆H r + q (20)
dt νA
where ρ and Cp are the density and heat capacity of the mixture, respectively (Cp has been
assumed constant), q is the net heat transfer rate to the reactor (energy per unit time), ∆Hr is the
enthalpy of reaction at T and P (enthalpy change in the reaction per unit mole of A reacted),
defined as the difference between enthalpy of products and enthalpy of reactants, and
− 1, if A is a reactant
νA = (21)
+ 1, if A is a product
For the case of reaction (4), using the reaction rate (5) in equation (20) leads to
dT
ρVC p = ρQC p (Ti − T ) − Vkc A ∆H r + q (22)
dt
The formulation of the problem of an adiabatic reactor with a first-order reactions is obtained by
substituting equation (6) into equations (9) and (22), letting q=0, to get
Advanced Chemical Engineering Analysis – Fall 2008 7
dc A 1
E
− a 1
+ k 0 e RT + cA = c Ai (23)
dt tR tR
E
dT − a
ρVC p = ρQC p (Ti − T ) − Vk 0 e RT c A ∆H r (24)
dt
This is a system of two first-order, coupled, nonlinear ODEs. They are subject to the initial
conditions
c A = c A 0 , t=0 (25)
T = T0 , t=0 (26)
Before we explore the solution of this problem, we will formulate it in dimensionless form. We
define the following dimensionless variables:
c
x= A (27)
c Ai
T
θ= (note the need to use absolute temperatures) (28)
Ti
t
τ= (29)
tR
γ
dx −
= 1 − x − αxe θ (30)
dτ
γ
dθ −
= 1 − θ − αβ xe θ (31)
dτ
x = x 0 , τ=0 (32)
θ = θ0 , τ=0 (33)
where
α = tR k0 (34)
Advanced Chemical Engineering Analysis – Fall 2008 8
∆H r c Ai
β= (35)
ρC p Ti
(note that β<0 for exothermic reaction and β>0 for endothermic reaction; here, we will assume
that the enthalpy of reaction can be considered constant.)
Ea
γ= (36)
RTi
c
x 0 = A0 (37)
c Ai
T
θ0 = 0 (38)
Ti
The solution of the system of ODEs will yield the evolution of temperature and concentration
of A in the reactor. There is no known analytical solution to this problem, although a relation
between dimensionless concentration and temperature can be found analytically, as shown in
Appendix B. Later in this chapter we will explore a numerical solution to this problem but for
now let us focus on the steady state solution, which will have practical significance as defining a
continuous operating condition for the reactor. If we assume that a steady state solution exists,
then this solution can be found by setting the time derivatives equal to zero in equations (30) and
(31):
γ
−
0 = 1 − x − αxe θ (39)
γ
−
0 = 1 − θ − αβ xe θ (40)
This is a system with two nonlinear equations and two unknowns (x and θ) that will represent the
steady-state dimensionless concentration and temperature. This system cannot be solved
explicitly but it can be reduced to a single equation by solving equation (39) for x,
1
x= (41)
1 + αe − γ / θ
and substituting this into equation (40) to get a single equation with a single unknown (θ):
αβ e − γ / θ
1− θ = (42)
1 + αe − γ / θ
The solution of this equation can be found by a numerical method. Any numerical method will
require an iterative procedure that must start with an initial guess for the solution. We will
Advanced Chemical Engineering Analysis – Fall 2008 9
explore the solution of this equation using the Newton-Raphson method later in this chapter.
Another method to solve nonlinear equations like this one is through a graphical construction.
Even though this type of approach might be inaccurate and inefficient, it allows one to analyze
the solution from a physical perspective. We will explore this option first. The type of result
obtained will depend on whether the reaction is exothermic or endothermic, so we will treat the
two cases separately.
(1) Endothermic reaction (∆Hr>0 ⇒ β>0)
The graphical solution will be found by plotting the functions on both sides of equation (42)
vs. θ, and finding the point at which both functions intersect. Note that, in this case, both
functions are positive since β>0. The two sides of equation (42) can be physically interpreted as
follows. The left-hand side,
E f (θ) = 1 − θ (43)
represents, in dimensionless form, the energy lost by the fluid that goes through the reactor,
while the right-hand side,
αβ e − γ / θ
E r (θ) = (44)
1 + αe − γ / θ
represents the thermal energy consumed by the reaction progress. The steady state solution is the
value of θ for which Er=Ef. To find the solution graphically, we plot Ef vs. θ, which will be a
straight line of slope -1, and Er vs. θ, which will be a monotonically increasing function that at
large θ tends asymptotically to αβ/(1+α). The solution is the intersection of the two functions.
This is illustrated in Figure 3. Clearly, the shapes of the two functions assure that there will be a
unique solution.
(2) Exothermic reaction (∆Hr<0 ⇒ β<0)
In this case it is convenient to change the signs in the definition of the functions that intersect
in equation (42). Let
E f (θ) = θ − 1 (45)
Now this function represents the energy gained by the fluid that goes through the reactor, while
− αβ e − γ / θ
E r (θ) = (46)
1 + αe − γ / θ
represents the thermal energy liberated by the reaction progress. The type of graphical solution in
this case depends on the values of the parameters α, β, and γ. Two different cases are possible, as
illustrated in Figure 4.
The fact that three steady state solutions may be possible (Figure 4b) for an exothermic
reaction complicates the modeling effort considerably. Two important questions can be asked at
this point: (1) which steady state (if any) will be achieved for a particular operation of the
reactor, and (2) are all three steady states physically realizable? The answer to question (1) will
be based on the temporal evolution of the system, which will be treated later. The main factor to
Advanced Chemical Engineering Analysis – Fall 2008 10
consider in answering question (2) is the stability of the steady state. A steady state condition is
stable if when the system experiences a perturbation that takes it away from the steady state, it
tends to evolve in time back to the original steady state. Since all systems experience
perturbations to their operating conditions, unstable steady states will not be achieved in practice.
-1
Er(θ)
Ef(θ)
solution
θ
Figure 3. Qualitative illustration of the graphical solution of equation (42) for an endothermic
reaction.
Ef(θ)
Er(θ) SS3
1
SS2
Ef(θ)
Er(θ)
SS1
θ θ
(a) (b)
Figure 4. Qualitative illustration of the graphical solution of equation (42) for an exothermic
reaction: (a) single solution, (b) multiple solutions.
Advanced Chemical Engineering Analysis – Fall 2008 11
To analyze the stability of the steady states in Figure 4b, let us consider what happens to the
system when the reactor temperature experiences a perturbation. If the system is displaced from
a steady state, then the energy balance must consider transient terms, so we must go back to
equation (31). In terms of the definitions in equations (45) and (46), equation (31) can be written
as
dθ
= E r (θ) − E f (θ) (47)
dτ
Take the case in which a perturbation increases slightly the temperature of the reactor (Figure
5). A slight increase in the steady state temperature of SS1 (Figure 4b) will take the system to a
point at which Ef>Er (P1 in Figure 5). According to equation (47), the energy balance dictates
that the temperature should decrease with time from that perturbed point (dθ/dτ<0). This will
bring the system back to SS1. We say that SS1 is a stable steady state. For SS2, on the other
hand, a slight increase in temperature will take the system to a point at which Er>Ef. According
to equation (47), this means that dθ/dτ>0, which implies that the temperature will increase with
time and, therefore, instead of going back to SS2, the system will evolve towards SS3! We say
that SS2 is an unstable steady state. The same arguments show that SS3 is stable. Also,
perturbations that decrease the temperature will have similar results. In the case of SS2, a slight
decrease in temperature will induce an evolution of the system towards SS1. Hence, even though
SS2 is a solution of the steady state energy balance, this point cannot be achieved in practice. We
will return to this point later in the chapter.
The graphical solution method is not the best way to solve a nonlinear equation, such as
equation (42), because of its relatively low accuracy. Here, we will consider a numerical method
to solve nonlinear equations: the Newton-Raphson method.
f(x)=0 (48)
where f is a nonlinear function of x that is continuous and that has a continuous derivative with
respect to x. The Newton-Raphson method is based on a Taylor series expansion of the function
f(x) around a base point x=x0,
1
f ( x ) = f ( x 0 ) + f ' ( x 0 )( x − x 0 ) + f " ( x 0 )( x − x 0 ) 2 + L (49)
2!
where the primes denote derivatives with respect to x. The series can be truncated at any point by
using Taylor's theorem. The NR method is based on a truncation of the series at the second order
term. According to Taylor's theorem,
1
f ( x ) = f ( x 0 ) + f ' ( x 0 )( x − x 0 ) + f " (ξ)( x − x 0 ) 2 (50)
2!
is an exact representation of the function for a specific (unknown) value of ξ that lies between x0
Advanced Chemical Engineering Analysis – Fall 2008 12
and x.
Ef
Er
P2
Er>Ef
P1 Ef>Er
P3
Ef>Er
θ
Figure 5. Perturbations to the steady state of an adiabatic reactor (Figure 4) that increase
slightly the reactor temperature: P1, P2 and P3 are the perturbed states. The arrows indicate the
trend of the system evolution with time in each case.
The NR method is an iterative procedure in which equation (50) is applied at a base point
x=xi, where i denotes the number of the iteration being performed, the function is evaluated at
x=xi+1, and the second term is truncated to produce the approximation
f ( x i +1 ) ≈ f ( x i ) + f ' ( x i )( x i +1 − x i ) (51)
The value xi is a known value of x for which f(xi)≠0. Equation (51) is applied to find a new
value, xi+1, aiming at f(xi+1)=0. Using this in equation (51) and rearranging leads to
f (x i )
x i +1 = x i − (52)
f '(x i )
Because equation (51) is an approximation, this equation does not guarantee that f(xi+1)=0.
However, xi+1 should be a better approximation to the solution than xi, which means that
successive application of equation (52) might eventually converge to the solution. Graphically, in
a y-x plane, equation (52) is equivalent to extrapolating to y=0 a straight line y=y(x) that passes
through the point (xi,f(xi)) and whose slope is f'(xi) (Figure 6).
To estimate error propagation in the NR method, let xs be an exact solution,
Advanced Chemical Engineering Analysis – Fall 2008 13
f(xs)=0 (53)
Figure 6. Graphical representation of the Newton-Raphson method. From a point x=xi, a better
approximation to the solution (xi+1) is found by extrapolating (for this case; in other cases this
step may be an interpolation) to y=0 a straight line that coincides with the function f(x) at x=xi
and has the same derivative as the function at that point.
For a given step in the iterative procedure, an estimate of the solution is the value xi. Since
equation (50) is exact, we can evaluate it at x=xs, with x0=xi, and use equation (53) to get
1
0 = f ( x i ) + f ' ( x i )( x s − x i ) + f " (ξ)(x s − x i ) 2 (54)
2!
where ξ is between xi and xs. We define the absolute error of the method at a given iteration by
Ei = x s − x i (55)
Subtracting equation (51) from equation (54) (recalling that we are letting f(xi+1)=0) leads to
1
0 = f ' ( x i )( x s − x i +1 ) + f " (ξ)( x s − x i ) 2 (56)
2!
f " (ξ )
x s − x i +1 = − (x s − x i ) 2 (57)
2f ' ( x i )
Advanced Chemical Engineering Analysis – Fall 2008 14
Taking the absolute value of this equation and using the definition of error in equation (55) leads
to
f " (ξ ) 2
E i +1 = E (58)
2f ' ( x i ) i
This equation states that the error at a given iteration is directly proportional to the square of the
error at the previous iteration. This behavior is called quadratic convergence.
The success of the NR method, in terms of the number of iterations required to find a solution
and on the fact that a solution can be found at all, will depend on how close the initial guess is to
the solution. For cases in which there are multiple solutions, the NR method should be able to
predict all the solutions from appropriate (different) choices of the initial guess.
H SO
CH 2 − CH − CH 3 + H 2 O 2
4 → CH − CH − CH
2 3
(59)
In excess water, the kinetics of this reaction is first order in propylene oxide (A) concentration.
Furthermore, the reaction is exothermic so that multiple steady states are possible in an adiabatic
CSTR. Kinetic and thermodynamic data for this reaction are:
Ea
k0=3.21×109 s-1, = 9058 K
R
kJ kJ
ρC p = 3950 , ∆H r = −102,000
m 3K kmol A
kmol m3
c Ai = 2.3 , Q = 3.5 ×10 − 3
m3 s
Ti=297 K, V=1.2 m3
V 1.2 m 3
tR = = = 343 s
Q 3.5 ×10 - 3 m 3 / s
With the information given we can calculate the dimensionless constants from equations (34) to
Advanced Chemical Engineering Analysis – Fall 2008 15
(36) to get
To solve this problem, we apply the NR method to solve equation (42). First of all, we rewrite
the equation as
αβ e − γ / θ
f (θ) = θ − 1 + (60)
1 + αe − γ / θ
so that equation (42) is equivalent to f(θ)=0. Differentiation of equation (60) with respect to θ
yields, after manipulations,
αβγe γ / θ 1
f ' ( θ) = 1 + (61)
(e γ / θ + α) 2 θ 2
Application of the NR method (equation 52) for different initial values of θ yields three different
solutions. Values obtained for each iteration are plotted in Figure 7 for the three different
solutions. Convergence is very fast in this case: after 4 iterations, the error is below 10-9 for each
case. The dimensionless temperature for each solution and the dimensionless concentration
(calculated from equation 41) are shown in Table 1.
Table 1. Three steady state solutions for the adiabatic conversion of propylene oxide to
propylene glycol.
Steady state θ x
SS1 1.0209 0.896
SS2 1.1000 0.500
SS3 1.1647 0.177
In this case, as explained before, SS2 is unstable, but both SS1 and SS3 are physically
achievable. In principle, SS3 would be the most attractive solution, because of the high
conversion achieved. Note that there is a large difference in conversion between SS1 and SS3. It
is evident that deciding which steady state will be achieved in a particular operation is of great
practical significance. In general, the final steady state of processes with multiple steady states
can be determined by performing a simulation of the temporal evolution of the process from a
specific initial condition. In this case, this would involve the solution of equations (30) and (31)
subject to initial conditions (32) and (33). Solution of this system of ODEs must be done
numerically. In what follows, we explore numerical methods for the solution of this type of
problem.
dy1
= f1 ( t , y1 , y 2 ) (62)
dt
dy 2
= f 2 ( t , y1 , y 2 ) (63)
dt
1.2
θ
1.18
1.16
1.14
1.12
1.1
1.08
1.06
1.04
1.02
1
0 1 2 3 4
Number of iterations
Since the boundary conditions are specified at the same boundary (t=0), this is an initial value
problem (IVP), which defines a class of problems whose solution can be found by a certain type
of numerical algorithms. The numerical methods that we will explore for IVPs are based on the
use of Taylor series expansions to represent the dependent variables, and on the discretization of
the solution domain into specific subdomains. The methods fall into the category of what are
called finite difference methods. The simplest of these is Euler's method.
Advanced Chemical Engineering Analysis – Fall 2008 17
dy 1 d2y
y( t ) = y( t 0 ) + ( t 0 )( t − t 0 ) + (ξ)( t − t 0 ) 2 (66)
dt 2 dt 2
Figure 8. Discretization of the independent variable (t) into equally-spaced intervals (finite
differences) of length h, defined by the discretization points t0, t1 …
Consider the Taylor series expansion (66) using as base point t0=ti, and evaluating the series at
t=ti+1,
dy 1 d2y
y( t i +1 ) = y( t i ) + ( t i )( t i +1 − t i ) + (ξ)( t i +1 − t i ) 2 (67)
dt 2 dt 2
Since
h = t i +1 − t i (68)
we have
h2
y i +1 = y i + hy' ( t i ) + y" (ξ) (68)
2
h2
y" (ξ) = O(h 2 ) (69)
2
(note that y"(ξ) will tend to y"(ti) as h→0). We then can write equation (68) as follows,
Now consider that the function y satisfies the initial value problem
dy
= f ( t , y) (71)
dt
y i +1 = y i + hf ( t i , y i ) + O(h 2 ) (73)
ŷ i +1 = ŷ i + hf ( t i , ŷ i ) (74)
where the circumflex will be used to denote approximate value of the dependent variable. The
sequential application of equation (74) from i=0, 1, 2… (starting from ŷ 0 = y 0 , the initial
condition) leads to calculation of approximate values of the solution at the discretization points.
Note that the values of ŷ i +1 depend only on the value of the dependent variable in the previous
discretization point ( ŷi ). This means that the calculation can be performed explicitly from
equation (74) regardless of the complexity of the function f. Because of this characteristic,
Euler's method is an explicit method.
At this point, we are ready to solve the transient mole and energy balances for the adiabatic
CSTR. First, we generalize Euler's method (equation 73) to a system of two ODEs (equations 62
and 63). The appropriate discretized equations are:
γ
−
x̂ i +1 = x̂ i + h1 − x̂ i − αx̂ i e θ
ˆi
, i=0, 1, 2… (77)
Advanced Chemical Engineering Analysis – Fall 2008 19
γ
−
ˆθi +1 = θˆ i + h1 − θˆ i − αβ x̂ i e θˆ i
, i=0, 1, 2… (78)
The evolution of the dimensionless concentration and temperature (and eventually the steady
state that is reached) will depend on the initial conditions. As an illustration of the use of Euler's
method, consider the production of propylene glycol with initially no propylene oxide in the
reactor and a reactor temperature equal to the feed temperature:
x0=0 (79)
θ0=1 (80)
It is expected that the solution found by the application of equations (77) and (78) from the
initial conditions (79) and (80) converges to the exact solution at low enough values of h.
However, an appropriate value of h cannot be defined a priori. The usual procedure employed is
to generate solutions for various decreasing values of h until the solution becomes independent
of h. For example, Figure 9 shows the solution found for the dimensionless concentration as a
function of dimensionless times for various values of h. The solution for h=0.02 is exact for the
scale of the plot. Note that the solution for h=1 is quite inaccurate, but h=0.25 leads to a solution
that is relatively close to the exact solution.
x 1
0.8
0.6
0.4 h=1
h=0.5
0.2 h=0.25
h=0.02
0
0 1 2 3 4 5
τ
Figure 9. Dimensionless concentration vs. time curves generated by Euler's method for various
values of h for the production of ethylene glycol in an adiabatic CSTR with initial conditions
(79) and (80).
Advanced Chemical Engineering Analysis – Fall 2008 20
1
x
0.9
0.8
θ0=0.90
0.7
θ0=1.08
0.6
0.5
0.4
0.3
θ0=1.20
0.2
0.1
0
0 1 2 3 4 5
τ
(a)
1.2
θ
θ0=1.20
1.1
θ0=1.08
θ0=0.90
0.9
0.8
0 1 2 3 4 5
τ
(b)
Figure 10. Evolution of dimensionless concentration (a) and temperature (b) for the
production of ethylene glycol in an adiabatic CSTR with x0=0 and various initial temperatures.
Advanced Chemical Engineering Analysis – Fall 2008 21
One of the advantages of being able to generate the transient solution is to find out which
steady state the system will approach. Figure 10 shows the exact solution for various choices of
the initial temperature showing how choice of initial condition dictates whether SS1 or SS3
(Table 1) will be achieved.
Error analysis
The numerical solution found by Euler's method differs from the exact solution due to the
truncation of high-order terms in equation (73). In this section we will analyze the magnitude of
the error of the approximate solution. First we rewrite equation (68) as
y i +1 = y i + hf ( t i , y i ) + d i +1 (81)
h2
d i +1 = y" (ξ) (82)
2
where ti<ξ<ti+1. The parameter di+1 is called local truncation error, because it is the term of the
expansion that is dropped to generate Euler's method (equation 74). The best way to characterize
the accuracy of the method is by the error, which is defined as the difference between the exact
and approximate values of the function,
e i = y i − ŷ i (83)
Since the method starts with the initial condition, it is obvious that e0=0. After the calculation at
the first discretization point, the error will be equal to the local truncation error, since this will
represent the only difference between the exact and approximate solutions (equation 81, see also
Figure 11). However, for the calculation at the second discretization point and beyond, the error
will be increased by the local truncation error, but errors made in previous points will propagate,
making ei greater in magnitude than di for i≥2 (Figure 11).
To analyze quantitatively the propagation of errors, we start by subtracting equation (74) from
equation (81). Using the definition of the error (83), this leads to
e i +1 = ei + h[f ( t i , y i ) − f ( t i , ŷ i )] + d i +1 (84)
The error is best characterized in terms of the absolute value of the difference between the exact
and approximate solutions. Taking the absolute value of both sides of this equation and recalling
the identity
a+b+c ≤ a + b + c (85)
leads to
ei +1 ≤ ei + h f ( t i , y i ) − f ( t i , ŷ i ) + d i +1 (86)
f ( t i , y i ) − f ( t i , ŷ i ) ∂f
= (87)
y i − ŷ i ∂y t , η
i i
Figure 11. Propagation of errors in sequential numerical methods for IVPs: the local truncation
error adds to the overall error at each step, but since the starting values for each step are
approximate values already, the total error will include accumulation of successive truncation
errors.
where ηi is between yi and ŷ i . Here we will assume that the partial derivative in equation (87) is
bounded. Let L be an upper bound for the magnitude of the derivative, so that
∂f
≤ L , for all t (88)
∂y
f ( t i , y i ) − f ( t i , ŷ i ) ≤ L ei (89)
To find a bound for the local truncation error, we use equation (82). Let M be an upper bound for
the magnitude of y"(t),
We then have
Advanced Chemical Engineering Analysis – Fall 2008 23
h2
d i +1 ≤ M (91)
2
h2
ei +1 ≤ ei (1 + hL) + M (92)
2
We can evaluate this inequality sequentially starting at i=0 (recall that e0=0) to get
h2
e1 ≤ M (93)
2
h2 h 3ML
e 2 ≤ e1 (1 + hL) + M ≤ h 2M + (94)
2 2
h2 3h 2 M 3h 3ML L2 h 4 M
e 3 ≤ e 2 (1 + hL) + M≤ + + (95)
2 2 2 2
which leads to
ih 2 M
ei ≤ + higher order terms (96)
2
But, when we evaluate the solution at a given ti, the number of steps required to get there (i) is
t
i= i (97)
h
so that
t hM
ei ≤ i + higher order terms (98)
2
e i = O( h ) (99)
That is, even though the local truncation error is of O(h2), the propagation of errors in Euler's
method leads to an actual error of O(h). This reduction in the order of the error by one unit
always happens in sequential finite difference methods. Because of this, we say that Euler's
method is of first order.
To illustrate the variation of the error at a point in time, consider the example treated before of
Advanced Chemical Engineering Analysis – Fall 2008 24
production of ethylene glycol in an adiabatic CSTR. Figure 12 shows how the error at τ=1
changes with h in a log-log scale. Equation (99) implies a linear relation in this scale with slope
1. As we can see, the results follow this trend closely, especially at low values of h.
Euler's method is very convenient due to its simplicity. However, the accuracy of the method
can be improved by improving the level of approximation over that in equation (73). In what
follows, we will explore other methods to solve IVPs that have lower error orders.
e 1.0E+00
1.0E-01
1.0E-02
1.0E-03
1.0E-04 1
1.0E-05
1.0E-06
1.0E-07
0.001 0.01 0.1 1
h
Figure 12. Euler's method error at τ=1 as a function of h for the production of ethylene glycol
in an adiabatic CSTR with initial conditions: x0=0 and θ0=1. The error is calculated from
equation (83) using as exact solution the Euler solution at h=10-4. Filled symbols: error in x,
open symbols: error in θ. The solid line is a straight line of slope 1.
dy 1 d2y 1 d3y
y( t i +1 ) = y( t i ) + ( t i )( t i +1 − t i ) + ( t i )( t i +1 − t i ) 2 + (ξ)( t i +1 − t i ) 3 (100)
dt 2 dt 2 3! dt 3
h2
y i +1 = y i + hy' ( t i ) + y" ( t i ) + O(h 3 ) (101)
2
Advanced Chemical Engineering Analysis – Fall 2008 25
To solve the basic IVP given by equations (71) and (72), we first notice that
y' = f ( t , y) (102)
df ( t , y)
y" = (103)
dt
It is important to recognize that the derivative on the right-hand side of this equation is still a
total derivative with respect to t, since y=y(t). To evaluate this derivative, we start by expressing
the total differential of f by
∂f ∂f
df = dt + dy (104)
∂t ∂y
Dividing by dt leads to
df ∂f ∂f dy
= + (105)
dt ∂t ∂y dt
∂f ∂f
y" = + f (106)
∂t ∂y
h 2 ∂f ∂f
y i +1 = y i + hf ( t i , y i ) + ( t i , y i ) + ( t i , y i ) f ( t i , y i ) + O( h 3 ) (107)
2 ∂t ∂y
Truncation of this series leads to an approximation with local truncation error of O(h3):
h 2 ∂f ∂f
ŷ i +1 = ŷ i + hf ( t i , ŷ i ) + ( t i , ŷ i ) + ( t i , ŷ i )f ( t i , ŷ i ) (108)
2 ∂t ∂y
This equation is used sequentially from the initial condition. The method is called Taylor's
second order method. The error is of O(h2), so it performs better than Euler's method as h is
decreased. However, the increase in accuracy for a given h comes with a price: computational
effort has increased considerably for each step. In fact, if the function f and its derivatives are
complex enough, most of the computational effort of this type of method will be associated with
function and derivative evaluations. Each step in the calculation required one function evaluation
for Euler's method (74) whereas now it requires three function and derivative evaluations
(equation 108). This means that the computational effort may have increased by a factor of 3
Advanced Chemical Engineering Analysis – Fall 2008 26
(that is assuming that the derivatives of f in equation 108 are both nonzero). Even so, Taylor's
second order method is better than Euler's method in terms of the accuracy of the solution for a
given level of computational effort, especially for fine discretization grids (low h). Nevertheless,
it would be interesting to find out if it is possible to develop a method with local truncation error
of O(h3) but that requires less computational effort. In what follows, we explore a class of
methods that accomplishes this.
(3) Runge-Kutta methods
Methods based on Taylor series expansions, such as Euler's and Taylor's, lead to an
approximation that has the form
ŷ i +1 = ŷ i + hSn ( t i , ŷ i ) (109)
where Sn is a series (here n denotes the order of the method) whose algebraic complexity
increases with n. For example, for Taylor's second order method, we have (equation 108):
h ∂f ∂f
S2 = f ( t i , ŷ i ) + ( t i , ŷ i ) + ( t i , ŷ i )f ( t i , ŷ i ) (110)
2 ∂t ∂y
This particular series contains the function f and its two first-order partial derivatives. From this
point of view, it looks like a Taylor series expansion for f. In fact, for a function of two variables,
the first-order Taylor series expansion around a point (t0,y0) is given by
∂f ∂f 1 ∂ 2f
f ( t , y) = f ( t 0 , y 0 ) + ( t 0 , y 0 )( t − t 0 ) + ( t 0 , y 0 )( y − y 0 ) + (ξ, η)( t − t 0 ) 2
∂t ∂y 2 ∂t 2
(111)
1 ∂ 2f ∂ 2f
+ (ξ, η)( y − y 0 ) 2 + (ξ, η)( t − t 0 )( y − y 0 )
2 ∂y 2 ∂t∂y
where ξ is between t0 and t, and η is between y0 and y. If we use as base point a generic point
(t,y) and evaluate the series at a point (t+α,y+β ), equation (111) can be written as
∂f ∂f
f ( t + α, y + β) = f ( t, y) + ( t, y)α + ( t , y)β + R (ξ, η) (112)
∂t ∂y
1 ∂ 2f 1 ∂ 2f ∂ 2f
R (ξ, η) = (ξ, η)α 2 + (ξ, η)β 2 + (ξ, η)αβ (113)
2 ∂t 2 2 ∂y 2 ∂t∂y
where ξ is between t and t+α, and η is between y and y+β. If we compare equation (112) with
equation (110) we can see that, if we neglect the residual, we can make the approximation
S2 ( t i , ŷ i ) ≈ f ( t i + α, ŷ i + β) (114)
Advanced Chemical Engineering Analysis – Fall 2008 27
by letting
h
α= (115)
2
h
β= f ( t i , ŷ i ) (116)
2
Since α,β=O(h), then R=O(h2), which means that neglecting R will not incur in an error of
higher order than already made in the truncation that leads to equation (110). Using equation
(114), we can now propose a scheme based on equation (109):
ŷ i +1 = ŷ i + hf ( t i + α, ŷ i + β) (117)
This new method preserves the order of Taylor's second order method (local truncation error of
O(h3) and error of O(h2)) while requiring only two function evaluations (equations 116 and 117),
one less than Taylor's method. Even though this might not seem like an exceptional advantage,
the savings in computational effort of this approach with respect to Taylor's methods increase
substantially as the order of the method is increased. The explicit finite-difference method
represented by equation (117) is a second-order Runge-Kutta method.
One of the most widely used methods to solve IVPs is the fourth-order Runge-Kutta method
(RK-4). Its derivation follows the ideas developed above and will not be presented here. The
basic equation is
1
ŷ i +1 = ŷ i + (k1 + 2k 2 + 2k 3 + k 4 ) (118)
6
where
k1 = hf ( t i , ŷ i ) (119)
k 2 = hf ( t i + h / 2, ŷ i + k1 / 2) (120)
k 3 = hf ( t i + h / 2, ŷ i + k 2 / 2) (121)
k 4 = hf ( t i + h , ŷ i + k 3 ) (122)
This method has a local truncation error of O(h5) and an error of O(h4).
gets more complicated due to the possible dependence of the functions on the rest of the
dependent variables. For example, for equations (62) and (63), we can show that
∂f1 ∂f1 ∂f
y1" = + f1 + 1 f 2 (123)
∂t ∂y1 ∂y 2
and
∂f 2 ∂f 2 ∂f
y"2 = + f1 + 2 f 2 (124)
∂t ∂y1 ∂y 2
so that the equations for Taylor's second-order method for a system of two ODEs are
h 2 ∂f1
ŷ1,i +1 = ŷ1,i + hf1 ( t i , ŷ1,i , ŷ 2,i ) + [ ( t i , ŷ1,i , ŷ 2,i ) + ∂f1 ( t i , ŷ1,i , ŷ 2,i )f1 ( t i , ŷ1,i , ŷ 2,i )
2 ∂t ∂y1
(125)
∂f
+ 1 ( t i , ŷ1,i , ŷ 2,i )f 2 ( t i , ŷ1, i , ŷ 2, i )]
∂y 2
h 2 ∂f 2
ŷ 2, i +1 = ŷ 2,i + hf 2 ( t i , ŷ1,i , ŷ 2,i ) + [ (t i , ŷ1,i , ŷ 2,i ) + ∂f 2 ( t i , ŷ1,i , ŷ 2,i )f1 ( t i , ŷ1,i , ŷ 2,i )
2 ∂t ∂y1
(126)
∂f
+ 2 ( t i , ŷ1, i , ŷ 2, i )f 2 ( t i , ŷ1,i , ŷ 2,i )]
∂y 2
The extension of the RK-4 to systems simply consists in calculating the k factors (119) to
(122) for each ODE separately. For example, for the system of two ODEs considered here, a set
of k's is calculated in each step for each ODE as follows,
and the values of the dependent variables for the next step are calculated by
1
ŷ j, i +1 = ŷ j,i + (k1, j + 2k 2, j + 2k 3, j + k 4, j ) , j=1,2 (131)
6
Figure 13 shows a comparison of the error at a point obtained in the solution of the problem
stated by equations (30) and (31) with data for production of ethylene glycol. These results show
Advanced Chemical Engineering Analysis – Fall 2008 29
1.0E+01
e
1.0E-01
1.0E-03
1.0E-05
1.0E-07
1.0E-09
1.0E-11 Euler
1.0E-13 Taylor 2nd order
Runge-Kutta 4th order
1.0E-15
0.001 0.01 0.1 1
h
Figure 13. Errors at τ=1 as a function of h for the production of ethylene glycol in an adiabatic
CSTR with initial conditions: x0=0 and θ0=1. The straight lines are arbitrary lines placed on the
results for each method with slopes: 1 (Euler), 2 (Taylor 2nd order), 4 (RK-4).
Advanced Chemical Engineering Analysis – Fall 2008 30
Appendix A
Derivation of the thermal energy balance on a CSTR
In this appendix we will show how an energy balance in the reactor (equation 19) leads to the
final energy balance used (equation 20). First of all, we make the following assumptions: (1)
kinetic energy changes are negligible, (2) viscous dissipation is negligible, and (3) there is no
mechanical work performed in the reactor (this would mean that the shaft work done by stirring
devices has a negligible contribution to the energy balance). These assumptions decouple
thermal energy from mechanical energy, so that all effects due to mechanical energy interactions
are neglected. Let n be the total moles in the reactor at a given time, and U be the molar internal
energy of the mixture inside the reactor (internal energy per unit mol of mixture). The energy
accumulation term can be expressed as
Input and output of energy will be due to input and output of mass and, in general, heat
exchange with the surroundings, so that
where F represents total molar flow rate (moles/time), H is molar enthalpy (enthalpy/mole), the
subindices i and e denote inlet and exit, respectively, and q is the heat transfer rate (energy/time)
from the surroundings to the reactor. Note that we have used the fact that He=H, the molar
enthalpy of the mixture inside the reactor, since perfect mixing has been assumed. The molar
internal energy of the mixture in the reactor is related to the enthalpy by
nU = nH − PV (A.3)
so that
Constant pressure and volume makes the second term on the right-hand side of this equation
vanish. Collecting terms (equations A.1 and A.2) into the energy balance leads to
d (nH)
= Fi H i − Fe H + q (A.5)
dt
To quantify the enthalpies, we will consider that the mixture is an ideal solution for
simplicity. That is, the enthalpy of the mixture is the sum of the enthalpies of its N components
(i.e., the enthalpy of mixing is negligible):
Advanced Chemical Engineering Analysis – Fall 2008 31
N
nH = ∑ n jH j (A.6)
j =1
Similarly,
N
Fi H i = ∑ Fj,i H j,i (A.7)
j=1
where Fj,i represents the molar flow rate of component j in the inlet flow. Also
N
Fe H = ∑ Fj, e H j (A.8)
j =1
N dH j dn j N N
∑ n j +Hj = ∑ Fj,i H j,i − ∑ Fj, e H j + q (A.9)
j=1 dt dt j=1 j=1
The mole balance for species j can be written as follows (equivalent to equation 3)
dn j
= Fj,i − Fj, e + R jV (A.10)
dt
N dH j N N
∑ nj = ∑ Fj, i (H j, i − H j ) − V ∑ R jH j + q (A.11)
j=1 dt j=1 j=1
Since components are converted by the chemical reactions, reference states for enthalpy
calculations cannot be component specific. It is customary to choose the chemical elements that
compose the species in the mixture as a basis to establish a reference state, since elements will be
conserved (neglecting element transmutation by nuclear reactions.) Therefore, the enthalpies of
all compounds are calculated with respect to an element-specific reference state: the enthalpy of
all pure elements at their natural state at 25ºC and 1 atm (standard conditions) is zero.
Because of this, the enthalpy of each component inside the reactor and at the inlet flow can be
expressed as follows
H j = ∆H 0f , j + ∆H j (A.12)
H j , i = ∆H 0f , j + ∆H j,i (A.13)
Advanced Chemical Engineering Analysis – Fall 2008 32
where ∆H f0, j is the molar enthalpy of formation of component j at standard conditions (25ºC and
1 atm), and ∆H j and ∆H j,i are the molar enthalpy changes of component j between the standard
state and the reactor and inlet conditions, respectively.
Substitution of equations (A.12) and (A.13) into equation (A.11) yields, after manipulations
(note that the enthalpies of formation are constant,)
N d (∆H j ) N N
∑n j dt
= ∑ Fj,i (∆H j, i − ∆H j ) − V ∑ R j (∆H f0, j + ∆H j ) + q (A.14)
j=1 j=1 j=1
T
∆H j = ∫ Ĉ pjdT (A.15)
Tref
where Tref=25ºC. Note that, if there is a change of phase between the standard state and the state
of the component j in the reactor, an enthalpy difference for the phase change would have to be
added to this equation, but this term will eventually cancel out. Similarly, ∆H j,i − ∆H j is the
enthalpy change of component j between the inlet and outlet conditions in the reactor, so that
T
∆H j, i − ∆H j = − ∫ Ĉ pjdT (A.16)
Ti
The reaction term in equation (A.14) represents the change in enthalpy per unit time that
occurs as the reactions proceed. Here, for simplicity, we will consider that there is only one
chemical reaction occurring and that this reaction involves component A. The reaction will be
written so that the stoichiometric coefficient for each compound j, νj, is positive if the compound
is a product and negative if it is a reactant, and the stoichiometric coefficient for A is unity (±1).
For example, in a multicomponent mixture where the following reaction occurs
A + 2B → C (A.17)
we have: νA=-1, νB=-2, νC=1, and νj=0 for all other components in the mixture (j≠A, B, C). Note
that, for all components, a stoichiometric balance yields
νj
Rj = RA (A.18)
νA
N RA N
∑ R j (∆H f0, j + ∆H j ) = ∑
ν A j=1
ν j (∆H 0f , j + ∆H j ) (A.19)
j=1
The summation term on the right-hand side of this equation represents the change in enthalpy
that occurs because of the reaction per mole of A reacted, at the conditions at which the reaction
is taking place. This is the enthalpy of reaction:
N
∆H r = ∑ ν j (∆H 0f , j + ∆H j ) (A.20)
j=1
Note that, since the stoichiometric coefficients are positive for reaction products, ∆H r represents
an enthalpy difference of products minus reactants. This means that ∆H r < 0 implies that
thermal energy is "liberated" by the reaction (exothermic reaction) whereas when ∆H r > 0
implies that the reaction "consumes" thermal energy (endothermic reaction).
Using equations (A.15), (A.16), (A.19) and (A.20), equation (A.14) becomes
N N T
dT R
∑ n jĈ pj dt
= − ∑ Fj, i ∫ Ĉ pjdT − V A ∆H r + q
νA
(A.21)
j=1 j=1 Ti
Since the mixture is an ideal solution, we can define an average molar heat capacity for the
mixture as
N
Ĉ p = ∑ x jĈ pj (A.22)
j=1
N
∑ n jĈ pj = nĈ p (A.23)
j=1
N T T
∑ Fj,i ∫ Ĉ pjdT = Fi ∫ Ĉ p dT (A.24)
j=1 Ti Ti
where Fi is the total inlet molar flow rate. Equation (A.21) can be written as
T
dT R
nĈ p = − Fi ∫ Ĉ p dT − V A ∆H r + q (A.25)
dt νA
Ti
Finally, this equation is usually expressed in terms of heat capacity, Cp, instead of molar heat
Advanced Chemical Engineering Analysis – Fall 2008 34
Similarly,
Fi Ĉ p = ρQC p (A.27)
T
dT R
ρVC p = −ρQ ∫ C p dT − V A ∆H r + q (A.28)
dt νA
Ti
If the heat capacity can be approximated to be constant in the range of temperatures considered,
we have
dT R
ρVC p = ρQC p (Ti − T) − V A ∆H r + q (A.29)
dt νA
Appendix B
An analytical relation between dimensionless concentration and temperature in the
adiabatic CSTR with first-order reaction
Even though there is no known analytical solution for the ODE system represented by
equations (30) to (33), an analytical relation between x and θ can be obtained. To find this
relation, multiply equation (30) by β and then subtract equation (31). This eliminates the
nonlinear term, yielding
dx dθ
β − = β(1 − x ) − (1 − θ) (B.1)
dτ dτ
Now, let
u = βx − θ (B.2)
du
+ u = β −1 (B.3)
dτ
u = Ae − τ + β − 1 (B.4)
where A is an integration constant, which can be evaluated from the initial conditions (32) and
(33). Doing this and substituting back equation (B.2) into equation (B.4) leads to the final result,
after manipulations
Appendix C
A note on the solution of multiple linear, non-homogeneous, first order ODEs, and
linear, non-homogeneous, second-order ODEs
Multiple first-order ODEs are common in reactor design problems. If reaction kinetics is
nonlinear or the energy balance is one of the equations, the solution of the system of equations
must be obtained numerically. For problems that result in systems of linear, first-order ODEs,
analytical solutions can be found. This appendix sketches how to solve this type of system for
the case of two coupled ODEs.
Consider the system of ODEs
dx
= αx + βy + f1 ( t ) (C.1)
dt
dy
= γx + δy + f 2 ( t ) (C.2)
dt
where the coefficients will be considered constants, for simplicity. This system of two first-order
ODEs can be transformed into a single second-order ODE as follows. First, take the derivative of
equation (C.2) with respect to t:
d2y dx dy df
=γ +δ + 2 (C.3)
dt 2 dt dt dt
d2y dy df
− δ − γβy = γαx + γf1 + 2 (C.4)
dt 2 dt dt
Now, to eliminate x from this equation, we substitute it from equation (C.2). This leads to, after
rearrangements:
d2y dy df
− (δ + α) + (αδ − γβ) y = γf1 − αf 2 + 2 (C.5)
dt 2 dt dt
This shows how two first-order ODEs can be transformed into a second-order ODE. The new
ODE is linear and non-homogeneous with constant coefficients. We will explore now the
solution of this type of equation.
Equation (C.5) is a particular case of the ODE
d2y dy
+ a1 ( t ) + a 2 ( t ) y = f ( t ) (C.6)
dt 2 dt
This differential equation is non-homogeneous because y≡0 does not satisfy it (as long as f(t)≠0
Advanced Chemical Engineering Analysis – Fall 2008 37
d 2 yh dy
+ a1 ( t ) h + a 2 ( t ) y h = 0 (C.7)
dt 2 dt
It can be shown that this equation has two independent solutions, y1(t) and y2(t) (consequence of
it being second order.) Since the equation is linear, any function that is a linear combination of
the two solutions is also a solution. Hence, the general solution of equation (C.7) is
y h ( t ) = C1y1 ( t ) + C 2 y 2 ( t ) (C.8)
where C1 and C2 are arbitrary constants. This can be proven by substituting equation (C.8) into
equation (C.7) and remembering that y1(t) and y2(t) are basic solutions. The solution (C.8) is
undetermined until two additional (boundary) conditions are used to evaluate the constants C1
and C2.
Going back to the original equation (C.6), it is sometimes possible to find a specific function
that satisfies the differential equation by inspection or by the application of specific techniques.
This solution of the non-homogeneous equation is called particular solution, yp(t). This solution
does not necessarily satisfy the boundary conditions. The general solution of equation (C.6) will
be
y( t ) = y h ( t ) + y p ( t ) (C.9)
since substitution of this equation into equation (C.6) leads to the identity:
d 2 yh dy h d 2 yp dy p
dt 2 + a 1 ( t ) + a 2 ( t ) y h + + a1 ( t ) + a 2 (t ) y p = f (t ) (C.10)
2
444442dt444443 dt dt
1 1444442444443
=0 =f (t)
Example
Consider the ODE
d2y dy
− 4 + 5y = t 2 (C.11)
dt 2 dt
d 2 yh dy
− 4 h + 5y h = 0 (C.12)
dt 2 dt
r 2 − 4r + 5 = 0 (C.13)
Advanced Chemical Engineering Analysis – Fall 2008 38
which are
1
r± = 2 ± 16 − 20 = 2 ± i (C.14)
2
y h ( t ) = C1e r+ t + C 2 e r− t (C.15)
To deal with the imaginary part of the exponentials we make use of Euler's formula:
Using the roots from equation (C.14) and this formula, equation (C.15) can be rewritten as
A particular solution to equation (C.11) has polynomial form. When the non homogeneous part
of the equation is a polynomial, it can be shown that the particular solution of a linear ODE with
constant coefficients is a polynomial of the same degree as the non homogeneous term. We then
propose
y p ( t ) = At 2 + Bt + C (C.19)
Substituting this equation into equation (C.11) and equating terms of the same power in the
result, the coefficients A, B and C can be found. In this case, this leads to
t 2 8t 22
y p (t ) = + + (C.20)
5 25 125
t 2 8t 22
y( t ) = C 3e 2 t cos t + C 4 e 2 t sin t + + + (C.21)
5 25 125
The only remaining thing to do is to find the constants C3 and C4 from the application of two
boundary conditions.