Beruflich Dokumente
Kultur Dokumente
We will treat the lake as complete mix reactor and write a mass balance on it:
d
Vol ⋅ c = W ( t) − Q ⋅ c − k ⋅ Vol ⋅ c − v ⋅ A s ⋅ c
dt
Now lets lump all the lake constants together. Divide by the lake volume, Vol, then factor "c" out of the
equation. This way we isolate all the lake constants.
d W (t) Q k ⋅ Vol ⋅ c As W ( t) Q v
c = − ⋅c − − v⋅ ⋅c = + − − k⋅c − ⋅c
dt Vol Vol Vol Vol Vol Vol z
The lake volume, Vol, divided by the lake bottom area, As, is the lake depth, z
Q v
the lumped parameter λ is then given by: λ := + k+
Vol z
d W ( t)
We end up with c= − ( λ ) ⋅ c . The solution to this differential equation is another equation relating c
dt Vol
and t
W
⋅ 1 − e
(− λ )⋅ t
canalytical ( t) =
λ ⋅ Vol
mg
At t = 0 the lake receives a step loading of W := 50 ⋅ 106 gm/year and has an initial concentration cinit := 15 ⋅
liter
. Use Euler's method as well as Huen's predictor-corrector method to simulate the lake concentration from 0 to
20 yr using a time step of 1 year. Compare numerical and analytical results.
1
W (− λ ) ⋅ t
t := 0 .. 19 canalytical ( t) := ⋅ 1 − e
λ ⋅ Vol
Concentration vs time
150
135
120
105
90
canalytical( t)
75
60
45
30
15
0
0 2 4 6 8 10 12 14 16 18 20
t
From pg. 50, the governing differential equation, based on a mass balance of contaminant is:
d
Vol ⋅ c = W ( t) − Q ⋅ c − k ⋅ v ⋅ c − v ⋅ A s⋅ c
dt
d W ( t)
c= − (λ ) ⋅ c
dt Vol
rewrite the ODE in finite difference form and rearrange to get the recursive form:
ci + 1 − ci W ( t)
= − λ ⋅ ci ===========>
∆t Vol W
ci +1 = ( c) i + − λ ⋅ ci ⋅ ∆ t
Vol
W
1. Now, if we designate − λ ⋅ ci as fi (aka the predictor f) we can compute the concentration at time
Vol
step (i+1) in terms of the concentration at time step i. ci+ 1 = ci + fi ⋅ ∆ t . If we stopped here and repeated the
process using the just computed ci+1 as the next ci we would be using the Euler explicit procedure.
However Euler's method is not considered very accurate. We will refine it as shown below.
2. Take the value of ci just computed and use it to compute a second value of f based on ci+1 call the second
f , fi+1 or the "corrector f"
W
fi+ 1 = − λ ⋅ ci +1
Vol
2
3. Compute the final value of ci+1 as: ci plus the "average f" times ∆ t. In symbols we get:
1
ci +1 = ci + ⋅ ( ∆ t) ⋅ (fi + fi+ 1)
2
This approach is more accurate in the transient region before steady state is reached. The procedure is
implemented below using Mathcad programming
3
Here Mathcad has made use of its ability to use matrices or vectors as single elements of larger matrices or
vectors. The concentration values are stored as a 30 by 1 vector which is itself a single element in 5 by 1
vector.
soln0, 1 = 30
135
120
conci
105
cp
i 90
fp 75
i
60
fi
45
30
15
0
0 3 6 9 12 15 18 21 24 27 30
i ⋅ ∆ t , ( i⋅ ∆ t) , i ⋅ ∆ t , i⋅ ∆ t
Huen predictor corrector solution
Huen predictor concentration
predictor coefficient
initial coefficient
We can zoom in on the transient portion of the plot to examine how the predictor solution and corrector
solution differ.
Transient Region
150
135
120
105
conci
90
cp 75
i
60
45
30
15
0
0 0.3 0.6 0.9 1.2 1.5 1.8 2.1 2.4 2.7 3
i ⋅ ∆ t , ( i⋅ ∆ t)
Huen predictor corrector solution
Huen predictor solution (Eulers method)
4
Finally we can compare the analytical and numerical solutions. As the value of ∆ t in the numerical procedure
gets smaller, the 2 solutions will approach each other.
135
120
105
conci 90
canalytical( t) 75
60
45
30
15
0
0 3 6 9 12 15 18 21 24 27 30
i⋅ ∆ t , t
Huen predictor corrector solution
Analytical solution