Вы находитесь на странице: 1из 7

# Numerical Methods in Chemical Engineering

## Consider the reaction of methane, with water at high temperatures

CH4 + 2H2O

CO2 + 3H2

Steam reforming of methane has been proposed as one way to produce clean
Hydrogen for the 'Hydrogen economy'. In any reactor containing CO2 and
H2, the shift reaction will also occur.
CO2 + H2

CO + H2O

## So we have a reactor as follows

CH4
CO
CO2
H2
H2O

H2O
CH4

and we want to know, what the composition of the outlet stream is, if the
system is allowed to reach equilibrium. To solve this problem we can use the
method of minimum reactions. There are 5 species of interest (i.e. 5 unknown
flows leaving the reactor we need to solve for). The amounts of H, C and O
entering the system must be equal to the amounts leaving; this generates three
elemental balance equations.

constant.

- 16 -

## Numerical Methods in Chemical Engineering

5.5.1 The element balance equations
0 = E j ij N i

(5-8)

where Ej and Ni are the number of moles of element j entering and species i
leaving the system the system per unit time; i the number of atoms of j in
one molecule of species i.
e.g.
NCH4 +

NCO + NCO2

4 NCH4

= EC

(5-9)

+ 2 NH2 + 2 NH2O = EH

(5-10)

+ NH2O = EO

(5-11)

NCO + 2NCO2

CH 4
1

EC
E = C
H H
EO
O

4
0
CH 4

1
4
0

C
H
O

CO CO2
1
1
0
1

0
2

CO CO2
1
0
1

1
0
2

H2
0
2
0
H2
0
2
0

N CH 4
H 2O
N CO

0
N CO2
2

N H2

1
N H O
2 IN
N CH 4
H 2O
N CO

0
N CO2
2

N H2

1
N H O
2 OUT

## 5.5.2 The equilibrium equations

For the steam reforming reaction
3

Kp

PH 2 PCO2
o o
P P
= P yH2

=
o
2
PH 2O PCH 4 P y H 2O
o o
P P

( ) (y ) P
=
( ) (y ) P
3

- 17 -

CH 4

(N ) (N )
(N ) (N )

CO2

H2

CO2

H 2O

CH 4

## Numerical Methods in Chemical Engineering

Taking natural logs

( )

Ln K p

P
= Ln o
P Ni
i

+ 3Ln N H 2 + Ln N CO2 2 Ln N H 2O Ln N CH 4

(5-12)

## For the water-gas shift

Kp

PH 2O PCO
o o
P P
y H 2O ( y CO ) N H 2O (N CO )

=
=
=
y H 2 y CO2
N H 2 N CO2
PCO2 PH 2
o o
P P

( )
( )(

(
) (

)
)(

## Taking natural logs

( ) = Ln(N ) + Ln(N

Ln K p

H 2O

CO

) Ln(N H

) Ln(N )

(5-13)

CO2

## 5.5.3 Thermodynamic data

The values of Kp as a function of temperature given below
30
y = 2.616E-05x 2 - 7.491E-02x + 6.251E+01
R2 = 9.979E-01

25

Ln(Kp)

20
15

Ln(Kp1)

10

Ln(Kp2)

R2 = 9.970E-01

0
-5
600

800

1000

1200

1400

Temperature (K)

- 18 -

## Numerical Methods in Chemical Engineering

A function I have written to calculate these values is:
function [LnKp1,LnKp2] = LnKp(T)
LnKp1 = 2.616e-5*T^2 - 7.491e-2*T + 6.251e1;
LnKp2 = -6.095e-6*T^2 + 1.692e-2*T - 1.116e1;
return

## 5.5.4 Solving the equations

The equation set we have to solve is
NCH4 + NCO + NCO2

f1 (5-9)

- EH

= 0

f2(5-10)

+ NH2O - EO = 0

f3(5-11)

+ 2 NH2 + 2 NH2O

4 NCH4
NCO + 2 NCO2

Ln o
P Ni
i

- EC = 0

## Ln(N H 2O ) + Ln( N CO ) Ln(N H 2 ) Ln(N CO2 ) Ln(Kp 2 ) = 0

f4(5-12)
f5(5-13)

We need to write a function which returns the left hand side of these
equations
function [residual] = f(N)
global Stoichiometry
global E
global T
global P_Po
%the element balance equations
residual(1:3) = Stoichiometry*N - E
%the equilibrium constants
[LnKp1,LnKp2] = LnKp(T)
%equilibrium equations
residual(4)= -LnKp1 + log(P_Po/sum(N))+3*log(N(4)) +...
log(N(3))-2*log(N(5))-log(N(1))
residual(5)=- LnKp2
+ log(N(5))+log(N(2))- log(N(3))log(N(4))
return

- 19 -

## Numerical Methods in Chemical Engineering

We also need the Jacobian:
The first 3 rows of the Jacobian are just the stoichiometry matrix. The row for
equation (5-12), i.e. the 4th row is made up of the following terms.

f
f
1
1
3
1
f 4
f
1
1
1
=

, 4 = 0
, 4 =

, 4 =

N 1 N 1 N i N 2
N i N 3 N 3 N i N 4 N 4 N i
i

f 4
2
1
=

N 5 N 5 N i
i

## The 5th row of the Jacobian is made up of

f 5
f
f 5
1
1 f 5
1 f 5
1
= 0,
, 5 =
,
,
=
=
=
N 2 N 2 N 3 N 3 N 4 N 4 N 5 N 5
N1

## function [Jac] = jac(N)

global Stoichiometry
Jac(1:3,:) = Stoichiometry;
%row 4 (for
Jac(4,1) =
Jac(4,2) =
Jac(4,3) =
Jac(4,4) =
Jac(4,5) =

the steam
-1/N(1) 0
1/N(3) 3/N(4) -2/N(5) -

reforming reaction)
1/sum(N);
1/sum(N);
1/sum(N);
1/sum(N);
1/sum(N);

%row 5 (for
Jac(5,1) =
Jac(5,2) =
Jac(5,3) =
Jac(5,4) =
Jac(5,5) =

0;
+1/N(2);
-1/N(3);
-1/N(4);
+1/N(5);

return

- 20 -

## Numerical Methods in Chemical Engineering

5.5.5 Full solution to the equilibrium problem in Matlab
%MAIN FUNCTION
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function main
global T
global E
global Stoichiometry
global P_Po
%set the inlet flows [CH4;CO;CO2;H2;H2O]
Nin = [10;0;0;0;1];
%set the temperature (K)
T = 900;
%set the pressure (Po = 1 bar)
P_Po = 1;
%set the stiociometry matrix
Stoichiometry = [ 1, 1, 1, 0, 0;...
4, 0, 0, 2, 2;...
0, 1, 2, 0, 1];
%Calculate the flows of elements entering the system
E = Stoichiometry*Nin;
%solve the system of equations
[N] = NewtonReduced(@f,@jac,[1,1,1,1,1]',100*eps);
%print the solution
disp(N)
return
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Function that computes the Jacobian
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [Jac] = jac(N)
global Stoichiometry
Jac(1:3,:) = Stoichiometry;
%row 4 (for
Jac(4,1) =
Jac(4,2) =
Jac(4,3) =
Jac(4,4) =
Jac(4,5) =

the steam
-1/N(1) 0
1/N(3) 3/N(4) -2/N(5) -

reforming reaction)
1/sum(N);
1/sum(N);
1/sum(N);
1/sum(N);
1/sum(N);

- 21 -

%row 5 (for
Jac(5,1) =
Jac(5,2) =
Jac(5,3) =
Jac(5,4) =
Jac(5,5) =

## the water-gas shift)

0;
+1/N(2);
-1/N(3);
-1/N(4);
+1/N(5);

return
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Function that computes equilibrium constants
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function [LnKp1,LnKp2] = LnKp(T)
LnKp1 = 2.616e-5*T^2 - 7.491e-2*T + 6.251e1;
LnKp2 = -6.095e-6*T^2 + 1.692e-2*T - 1.116e1;
return
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Function that computes the function values
equations to be solved)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

(set

of

## function [residual] = f(N)

global Stoichiometry
global E
global T
global P_Po
%the element balance equations
residual(1:3) = Stoichiometry*N - E;
%the equilibrium constants
[LnKp1,LnKp2] = LnKp(T);
%equilibrium equations
residual(4)
=
-LnKp1
+
log(P_Po/sum(N))+3*log(N(4))
+
log(N(3))-2*log(N(5))-log(N(1));
residual(5) =
- LnKp2
+ log(N(5))+log(N(2))- log(N(3))log(N(4));
residual = residual';
return

- 22 -