Numerical Methods in Diffusion. J.C. LaCombe University of Nevada, Reno Reno, NV, USA [email protected] These lecture notes complement an online learning module and diffusion simulation software that can be found at: http://unr.edu/homepage/lacomj/Diffusion/index.htm. - PowerPoint PPT Presentation
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
In many real-world problems, the details of the system may not correspond to a known solution to the diffusion equation. In these cases, it is usually possible to produce a solution where the equation is solved through iterative techniques. This is generally a lot of work to do by hand. However, with the aid of a computer, this becomes possible. The techniques used to reach such solutions are known as numerical methods.
Situations that often require numerical methods include
The numerical methods we will use in this course solve complex diffusion problems by breaking up the system into manageable parts and solving the diffusion equations for each part simultaneously with all the other parts.
To do this, we discretize the problem mathematically by dividing up space into little elements or nodes and treating time as moving forward in small steps.
Recall: Fick’s 1st law simply tells us how solute will flow if there is a concentration gradient.
Recall: Fick’s 2nd law is simply a combination of Conservation of Mass with Fick’s 1st law.
2
2
2
2
2
1
y
C
x
C
t
C
D
CDt
C
Fick’s 2nd Law in 2-D Cartesian Coordinates.
Before we solve this, we need to re-write the equation into a discretized form. The approach presented here is known as a finite-difference solution approach.
Discretizing the Time DerivativeThe Diffusion Equation
Now that we have discretized Fick’s 2nd law in space (1), we must discretize it in time as well. To do this, we will introduce a new variable, p, that is an integer that represents the time step. The duration of each step is t. Thus, the total time, t, is written…
t
CC
t
C pnm
pnm
,1
,
tpt (6)
The finite-difference approximation to the time derivative (the LHS of Fick’s 2nd law) is then expressed as…
(7)
The superscript, p, denotes the time dependence. The time derivative is expressed in terms as the difference in concentrations between the new time (step p+1) and the previous time (step p).
The 2-D Diffusion EquationFick’s 2nd Law in Discretized Form
We present here a solution approach known as the explicit method. In this finite-difference scheme, the concentration at any node m,n at time t+t is calculated from knowledge of the concentration at the same and neighboring nodes for the preceding time t.
We now can combine (5a,b) and (7) to produce the discretized form of the diffusion equation, (1).
(8)
Note:
Other approaches, such as the implicit method, are more efficient with a computer, but require more complex algorithms. Nonetheless, the fundamental principles are the same as we are applying here. We will not be covering these other methods in this course.
Equation (8) is the general form of our solution. We can simplify the notation a bit if we use square elements, so that x = y. Additionally, we can form the following group of parameters, which is commonly known as the dimensionless Fourier Number, Fo.
(9)
pnm
pnm
pnm
pnm
pnm
pnm CFoCCCCFoC ,1,1,,1,11
, 41
2x
tDFo
Now, we can re-arrange (8) to solve for the concentration in node m,n at the new time step, p+1. This equation applies to any element/node on the interior of a component. The expression simplifies to…
(10)2-D Interior Node
The NEW composition in an element is calculated using the PREVIOUS compositions in the element and its neighbors.
The 1-D Diffusion EquationExplicit Method & Solution Stability
For the case of 1-D transport, Equation (8) would instead develop into the form of
pm
pm
pm
pm CFoCCFoC 2111
1
The accuracy of finite-difference solutions may be improved by decreasing the values of x and t (I.e., finer discretization). On the other hand, making these values larger will allow the calculation to proceed more quickly.
One additional limitation of the explicit method is that it is not always a stable solution. If the values of x and t are not small enough, it can cause the solution to oscillate (even when this is physically impossible).
To prevent such erroneous results when the solution is “unstable”, the values of x and t must meet certain criteria (details omitted). For interior nodes, these are,
21Fo
41Fo
1-D Stability Criteria
2-D Stability Criteria
2x
tDFo
Recalling,
So, once you pick a value of either x or t , the other value must be chosen so that the stability criteria is met. Simply re-arrange the equation for Fo to calculate the acceptable value.
The equations presented so far (10, 11) are for interior nodes. I.e., each element’s surroundings are geometrically the same in all directions.
We can develop similar equations for different element types, but we need to be clever, or it gets messy.
A surface node (with no flux flowing through the surface), can be modeled using the same equation as an interior node. All we need to do is include an imaginary node just outside the surface and set its composition to the same as the node just inside the surface. This has the effect of producing a zero net gradient through the surface.
I.e., if the surface node is then the no-flux condition is modeled by adding an imaginary node at m+1 and setting to achieve a state of no-flux at node m (no gradient means no net flux).
The method used on the previous slides to discretize the problem is not the only way to produce equations such as Equations (10)-(13).
Another method can be used to provide even greater flexibility with boundary conditions. It is simply based on conservation of mass (Recall that Fick’s 2nd law is also essentially this as well).
Let us consider the element surrounding each node to be subject to conservation of mass. This would be written as…
Solid State Diffusive Flux
Solute “Generated”
Stored Mass
+ =
In practice, this can be something like solute entering an element at external surface
Writing this for a generic interior node, we account for all possible influences. As before, minor changes can be made for an external node. Note that here, flux into the node is considered “positive”.
An earlier topic presented the analytical solution to the case of a binary diffusion couple. Let’s analyze this using a finite-difference model. Assume D = 110-9 cm2/s, and the initial compositions are Cl = 0.75, and CR = 0.25.
x110-3 cm
1 2 3 4 5 675.0lC 25.0RC
st
cmt
scm
500
101
101
2
129
23
First, the stability criteria for this 1-D arrangement is that Fo ½.
2
12
x
tDFo
Thus the maximum time step for a stable solution of this problem is 500 seconds.
To handle the “infinite” ends, we treat them as having no-flux conditions (I.e., the concentration gradient is zero at the ends) using Equation (13). This will be ok, provided that the concentration field never reaches the end during our simulation. The equations are written for each of the 6 elements…
pm
pm
pm
pnm CFoCCFoC 21111
,
ppp
pppp
pppp
pppp
pppp
ppp
CFoCFoC
CFoCCFoC
CFoCCFoC
CFoCCFoC
CFoCCFoC
CFoCFoC
651
6
5461
5
4351
4
3241
3
2131
2
121
1
212
21
21
21
21
212
These 6 equations must be solved at each time step, p.
There will be one equation for each node. Models with lots of elements involve solving lots of equations.
The new concentrations at each node are calculated by solving this matrix at each time step. At each step, you use the resulting concentrations from the previous step, Cp+1, as the new values of Cp. Likewise, to get it all started, you just use the initial concentrations at each node.
You can use whatever methods or software you want to solve the matrix. Even a spreadsheet will work…