3. Introduction
The one-dimension diffusion reaction equation can be written
in terms of a dependent variable, π, as
π·
π2
π
ππ₯2
= π1 π + π0
Where
π· is the coefficient of diffusion
π1 and π0 are the reaction terms
π is gas concentration
4. Introduction
The finite element method cuts a structure into several elements then reconnects the
elements at nodes that hold the elements back together resulting in sets of
simultaneous algebraic equations. This project uses the finite element method to solve
the diffusion - reaction equation and also to solve the coupled equations:
π·1
π2 π1
ππ₯2
= π1 π1 π2 + π1 π₯
π·2
π2 π2
ππ₯2
= π2 π1 π2 + π2 π₯
where π1 and π2 are separate gases or liquids.
5. Aims of the project
The aims of the project are:
β’ To solve the one-dimension diffusion-reaction equation analytically
β’ To solve the same equation using the Finite Element method and
compare results with the analytical solutions
β’ To use the Finite Element method to find the numerical solution of
coupled diffusion-reaction equations
6. Analytical Solutions for the diffusion β
reaction equation
The solution to the four differential equations associated with the one-
dimension diffusion-reaction equation have been calculated using the
boundary conditions π₯ = 1, π = 0 and π₯ = 0, π = 1.
4 separate cases:
π0 = 0, π1 > 0
π0 = 0, π1 < 0
π0 β 0, π1 > 0
π0 β 0, π1 < 0
7. The first equation to be solved was
π·
π2 π
ππ₯2
β π1 π = 0, π1 > 0,
8. The general solution for this equation is
πΆ = π΄π
π1
π· π₯
+ π΅π
β
π1
π· π₯
and when the boundary conditions are applied, the solutions
are
π΄ = 1 β
π
π1
π·
π
π1
π· β π
β
π1
π·
,
π΅ =
π
π1
π·
π
π1
π· β π
β
π1
π·
9.
10. The second equation to be solved was
π·
π2 π
ππ₯2
β π1 π = 0, π1 < 0,
The general solution for this equation is
πΆ = π΄πππ
π1
π·
π₯ + π΅π ππ
π1
π·
π₯
When the boundary conditions were applied, these solutions were
obtained
π΄ = 1,
π΅ = β cot
π1
π·
11.
12. After solving the homogeneous equations, the inhomogeneous
equation can now be solved, this is
π·
π2 π
ππ₯2
β π1 π = π0, π0 β 0,
for π1 > 0 and π1 < 0.
13. For the case when π1 > 0, the general solution is
πΆ = π΄π
π1
π· π₯
+ π΅π
π1
π· π₯
β
π0
π1
,
When the boundary conditions are applied, the solutions are
π΅ =
π
π1
π· 1 +
π0
π1
β
π0
π1
π
π1
π· β π
β
π1
π·
,
π΄ = 1 β π΅ +
π0
π1
14. By varying the values of π0 and π1 we can see that gas removal takes place in
this reaction, but this model only works for certain values. On the second
graph the curve goes below the π₯-axis, this would mean that there is a
negative concentration, which is physically impossible.
15. The final case to be solved was
π·
π2 π
ππ₯2
β π1 π = π0, π0 β 0, π1 < 0
16. We can say that the general solution for this equation is
πΆ = π΄ πππ
βπ1
π·
π₯ + π΅ sin
βπ1
π·
π₯ β
π0
π1
After applying the boundary conditions, the values of A and B
are found to be
π΄ = 1 +
π0
π1
,
π΅ =
π0
π1
πππ ππ
βπ1
π·
β 1 +
π0
π1
cot
βπ1
π·
17.
18. The Finite Element Method for the diffusion
β reaction equation
The finite element method uses three element contribution matrices to
form a global system equation. These matrices are:
1. The element mass matrix
π π
=
πΏ
6
2 1
1 2
where π is the element number and πΏ is the element length.
19. 2. The element stiffness matrix
πΎ π =
1
πΏ
1 β1
β1 1
3. The right hand side vector
π π
= β
πΏ
2
1
1
20. These matrices form the global system equation
π·πΎ + π1 π π = π
where π is a vector of the same order as the total nodes in the system.
MATLAB can be used to solve this equation for π.
21. No. of Elements Finite Element Method solution
4 0.329422
8 0.330028
16 0.330178
32 0.330216
64 0.330225
128 0.330228
256 0.330228
512 0.330228
1024 0.330228
2048 0.330228
This table shows values of π using π0 = 1 and π1 = 1 using an increasing number of
elements. These values can be compared with the analytical solutions and an error term
can be calculated.
22. No. of elements Exact Solution FEM Solution Error
4 0.330228 0.329442 0.000807
8 0.330228 0.330028 0.000200
16 0.330228 0.330178 0.000050
32 0.330228 0.330216 0.000013
64 0.330228 0.330225 0.000003
128 0.330228 0.330228 0.000001
256 0.330228 0.330228 0.000000
512 0.330228 0.330228 0.000000
1024 0.330228 0.330228 0.000000
2048 0.330228 0.330228 0.000000
This table shows results for π0 = 1 and π1 = 1. As the number of elements increases, the
error decreases and the finite element method solution converges to the analytical solution.
23. The Finite Element Method for the coupled
diffusion β reaction equations
The finite element method can now be used to to solve these coupled diffusion β
reaction equations
π·1
π2 π
ππ₯2
= π1 π + π0
π·2
d2q
ππ₯2
= π2 π + π3
where π and π are separate gases or liquids.
24. As there are two equations in this system, extra terms need to be added to calculate
values of π and π. The solution of π is calculated using the previous solution of π,
and the solution of π is found by using the previous value of π. Alterations must be
made to the element mass matrix to accommodate this change.
When solving for π, the element mass matrix becomes
π π =
πΏ
6
2 1
1 2
ππ 0
0 ππ+1
25. When solving for π, the element mass matrix becomes
π π
=
πΏ
6
2 1
1 2
ππ 0
0 ππ+1
where π denotes the previous solution for π and π, and π + 1 represents the current
values of π and π.
Using MATLAB, solutions of π and π at each node for different numbers of
elements can be found.
26. Node π π
1 0.000000 1.000000
2 0.060542 0.815427
3 0.138203 0.647226
4 0.234214 0.496013
5 0.349396 0.362198
6 0.484065 0.245939
7 0.637987 0.147118
8 0.810385 0.065349
9 1.000000 0.000000
This table shows the finite element method solution using eight elements for π0 = 1, π1 =
2, π2 = 1, π3 = 2.
27. The results from the table can be displayed graphically. The graph shows that for these π values, as the
concentration of π increases, the concentration of π decreases at approximately the same rate. We can also
see the finite element solutions for increasing numbers of elements, taking values from the middle node:
28. This table shows the finite element solutions, using the same π values for an increasing
number of elements. Similar to the single equation, the solutions differ as the number of
elements increases.
No. of Elements FEM Solution for π FEM solution for π
2 0.353536 0.364268
4 0.350266 0.362633
8 0.349396 0.362198
16 0.349176 0.362088
32 0.349121 0.362060
64 0.349107 0.362053
128 0.349103 0.362052
256 0.349102 0.362051
29. As there is no analytical solution for the coupled equations, a solution is calculated at
a large number of elements and is taken as an exact value. This solution is then
compared to the solution calculated at each number of elements.
30. Elements π exact FEM soln. Error in π π exact FEM soln. Error in π
2 0.349102 0.349291 0.000189 0.362051 0.362145 0.000094
4 0.349102 0.349149 0.000047 0.362051 0.362075 0.000024
8 0.349102 0.349114 0.000012 0.362051 0.362057 0.000006
16 0.349102 0.349105 0.000003 0.362051 0.362053 0.000001
32 0.349102 0.349103 0.000001 0.362051 0.36051 0.000000
64 0.349102 0.349102 0.000000 0.362051 0.362051 0.000000
128 0.349102 0.349102 0.000000 0.362051 0.362051 0.000000
256 0.349102 0.349102 0.000000 0.362051 0.362051 0.000000
As the number of elements increases, the error term decreases and the finite element
solution converges to the βexactβ solution calculated.
31. Conclusions
β’ Gas removal and gas production depends on the signs of the reaction terms.
β’ The finite element method solutions for the diffusion β reaction equation always
converges to the analytical solution.
β’ For both the single and coupled diffusion β reaction equations, as the number of elements
doubles, the error term divides approximately by four, this is π(β2
) behaviour.