1 Discretizing The Concentration Equation Mike Grimm Math 1110 March 11, 2002.
-
Upload
nathan-young -
Category
Documents
-
view
213 -
download
0
Transcript of 1 Discretizing The Concentration Equation Mike Grimm Math 1110 March 11, 2002.
2
The Concentration Equation
• Recall:
• Where:
)()(c)(
cDcut
waterofdensityThentcoeffieciediffusionTheD
velocityu
3
Reducing the Equation
• Since D and are both constants they can be factored out:
• Then:
))(())(( cDcut
c
))(()( cD
cut
c
4
Reducing the Right Hand Side
We will now reduce each part of the equation separately.
1. Reducing: ))(( cD
*We know from calculus:
2
2
2
2
)(y
c
x
cc
So,
)())((2
2
2
2
y
c
x
cDc
D
5
Reducing the Left Hand Side
2. Reducing: )( cut
c
From calculus we have the theorem:
uccucu
)(However,
y
u
x
uu yx
6
Reducing the LHS (cont.)
We know that there is no irrotational flow, therefore:
0
y
u
x
uu yx
So we are left with:
cut
c
7
Reducing the LHS (Cont. 2)
Since we have, and ),( yx uuu
y
cj
x
cic
Then, we get:
)()(y
cu
x
cu
t
ccu
t
cyx
8
Our Final Reduced Equation
)(2
2
2
2
y
c
x
cD
y
cu
x
cu
t
cyx
By combining The LHS and RHS we can find our reduced equation:
We can then solve for the partial derivative of c with respect to t.
y
cu
x
cu
y
c
x
cD
t
cyx
)(2
2
2
2
9
Storing Concentrations
We are going to have to create a matrix called, concentration, to hold the approximate solutions.
This matrix will consist of the number of nodes by the number of time intervals. So concentration will be:
1532 rows x N columns where
tdelta
timeN
10
Discretizing the Equation
• Now that we have the equation for the concentration at a any point and any time, we need to solve that equation.
• The Problem: This equation cannot be solved because there are an infinite number of positions and infinite times.
• What we must do is create an approximation of that solution.
11
Discretizing the Partial Derivative
We know that we can approximate By the definition of the derivative: t
c
t
tkctkc
t
c
),()1,(
Where c( k, t+1) is the concentration at position, k, at a certain time and c(k, t) is the concentration at position, k, at the previous time interval.
12
Discretizing the Second Partials
We can also discretize2
2
2
2
y
c
x
c
We Know that:
22
2
)(
),,(2),,(),,(
x
tyxctyxxctyxxc
x
c
Similarly,
22
2
)(
),,(2),,(),,(
y
tyxctyyxctyyxc
y
c
13
Discretizing the Second Partials
So, is approximately,2
2
2
2
y
c
x
c
2)(
),,(2),,(),,(
x
tyxctyxxctyxxc
2)(
),,(2),,(),,(
y
tyxctyyxctyyxc
14
Discretizing the Partials with respect to X.
We also have, and .
x
c
y
c
An approximation for the partial with respect to x is :
)(2
),,(),,(
x
tyxxctyxxc
x
c
15
Discretizing the Partials with respect to y.
An approximation for the partial with respect to x is :
)(2
),,(),,(
y
tyyxctyyxc
y
c
16
Our Final Discretized Equation
)(
),()1,(
t
tkctkc
2)(
),,(2),,(),,((
x
tyxctyxxctyxxcD
)
)(
),,(2),,(),,(2y
tyxctyyxctyyxc
)
)(2
),,(),,((
x
tyxxctyxxcux
))(2
),,(),,((
y
tyyxctyyxcuy
17
How this Equation Works• The unknown in this equation is the term:
• We know Delta x and Delta y, because those are the increments in which we created the original grid.
• c(k,t) is the concentration at that node, k, at the previous time interval.
• The other terms are just the North, South, East, and West Neighbors of the central node, K, at the previous time.
)1,( tkc
18
How the Equation Works 2
• Matt created the programs nbfind.m and nb.m to search through and locate all neighboring nodes to node k. Now we know each neighbor and can use that neighbor to calculate the central node,K, at the next time, t+1.
19
The Equation with Neighboring Nodes
))(
2
)(
2(
)( 22
1
y
ccc
x
cccD
t
cc mk
mS
mN
mk
mW
mE
mk
mk
))(2
())(2
(y
ccu
x
ccu
mS
mN
y
mW
mE
x
Note: Here, m, denotes the level of time.
20
Conditions
To approximate the solution we must first have the Initial and boundary conditions.– Initial conditions: c(x, y, 0) = g(x) for all x, y
in our domain. Where g(x) is some function to be specified later.
– Boundary conditions: c(x, y, t) = 0 for x, y on our boundary at any time, t.
21
Creating the Algorithm
• Create a matrix, concentrations, that is 1532x(the number of time intervals we will check).
• Set initial condition• Loop through the nodes to determine if it is
and interior node.• If it is an interior node, use the recursive
equation to calculate the concentration, if not then, it is a boundary node and use the boundary condition