Download Transient Diffusion Equation-Numerical Methods in Engineering-Lecture 16 Slides-Civil Engineering and Geological Sciences and more Slides Numerical Methods in Engineering in PDF only on Docsity!
CE 341/441 - Lecture 16 - Fall 2004
p. 16.
LECTURE 16NUMERICAL SOLUTION OF THE TRANSIENT DIFFUSION EQUATION US-ING THE FINITE DIFFERENCE (FD) METHOD • Solve the p.d.e.• Initial conditions (i.c.’s)• Boundary conditions (b.c.’s)• Notes
- We can also specify derivative b.c.’s but we must have at least one functional value
b.c. for uniqueness.
- This p.d.e. is classified as a parabolic type p.d.e.• The equation can represent heat conduction and mass diffusion.
u ∂ t
-^
D
2 u ∂ x
2
=
u x t
t^ o , (^
)^
u
x ( (^)
u x
x^1
t ,
(^
)^
u
**
1
t ( )
u x
x^2
t ,
(^
)^
** u 2
t ( )
CE 341/441 - Lecture 16 - Fall 2004
p. 16.
Explicit Solution Procedure • Evaluate the p.d.e. at point
(^
and
- Let’s use a forward difference approximation to evaluate
at
accurate
i^
j , (^
)^
i^
spatial index
j^
temporal index
t
j+
j j-
2 1 j=
(i,j)
i=
1
2
i-
i^
i+
n-
n^
i=n+
x
∆
t^
∆
x
known valuesunknown values
u ∂ t
-^
i^
j ,
∂ u^ ∂
t
i^
j ,
u^ i
j
1
,^
u^
i^
j ,
t
O
t (^
CE 341/441 - Lecture 16 - Fall 2004
p. 16.
- Notes on solving the discrete approximations to the p.d.e.
- Let’s examine the FD molecule:• One discrete equation can be written for each node (such that the number of
unknowns equals the number of equations)
- We can compute unknown nodal values of
at the new time level directly from
values of the previous time level (i.e. they are not coupled at the new time level).The order in which the computations are performed in
space
does not matter since
the values at the new time level are entirely dependent on values at previous timelevels.
- Explicit Formula - one unknown pivotal (or nodal) value is directly expressed in
terms of known pivotal values.
j+1 j-
j
i-
i^
i+
known valuesunknown values u
CE 341/441 - Lecture 16 - Fall 2004
p. 16.
- Notes on time marching and accuracy - The process advancing from a known time level(s) to the unknown time level is
called “time marching”.
- The solution is known at time level
, starting with the initial conditions at
- This explicit solution to the transient diffusion equation is
accurate in time
and
accurate in space.
- Notes on stability - Stability relates to the unstable amplification or stable damping of the range of
wavelength components which comprise a numerical solution. An unstable solu-tion increases until we have reached numerical overflow on the computerperforming the calculations.
- The major shortcoming of explicit methods is stability.• This particular explicit difference solution becomes unstable when:
⇒
- Therefore there are restrictions on the time step size in order to have a stable solu-
tion! Thus this solution is
conditionally stable
j^
j^
O
t (^
O
(^2) x
(^
D
t ∆
x (^
-^
t^
1 ---^2
x (^
D
CE 341/441 - Lecture 16 - Fall 2004
p. 16.
results in a stable numerical solution
- Solution is stable and remains stable as
ρ
D
t ∆
(^2) x
-^
ρ =0.
t=0.048 (j+1=10)
t=0.096 (j+1=20)
t=0.192 (j+1=40)
u 0.5 0.4 0.3 0.2 0.1 0.
0.
0.
0.
0.
0.
0.
0.
0.
0.
1.
x
t^
CE 341/441 - Lecture 16 - Fall 2004
p. 16.
results in an unstable numerical solution
- Notes on instabilities
- The most rapid unstable growth appears to be for wavelength components in the
solution which are on the order of
- The amplitudes of the short wavelength solution components experience unbounded
growth in the case
ρ
D
t ∆
(^2) x
-^
0.1 0.
ρ =0.
t=0.052 (j+1=10)
t=0.104 (j+1=20)
t=0.208 (j+1=40)
0.5 0.4 0.3 0.
u
x
0.
0.
0.
0.
0.
0.
0.
0.
0.
1.
x ⋅
ρ
CE 341/441 - Lecture 16 - Fall 2004
p. 16.
- Use a central difference for
at
- Substituting into the p.d.e.:• Re-arrange such that unknown values appear on the left hand side of the equation:
u ∂
(^2) x
i^
j^
(^
u ∂
(^2) x
i^
j^
1
,
(^2) x
-^
u^ i
1
j^
1
, +^
u^
i^
j^
1
,^
u^ i
1
j^
[^
]
(^1) ----- ∆ t
u
i^
j^
1
,^
u^
i^
j ,
[^
]^
D ∆ x (^
-^
u^
i^
1
j^
1
, +^
u^
i^
j^
1
,^
u^ i
1
j^
[^
]
u
i^
1
j^
1 + ,
-^
x (^
tD -------------
^
^
^
u
i^
j^
1 + ,^
u
i^
1
j^
1 + , +
+
–^
x (^
tD ----------------
- u
i^
j ,
CE 341/441 - Lecture 16 - Fall 2004
p. 16.
- Notes on Implicit Solution to the transient diffusion equation -^
,^
,^
are the unknown values.
-^
is the only known value.
- FD molecule for this representation:• Equations for adjacent nodes will be dependent on adjacent values!!•^
We can no longer “explicitly” solve for each unknown value independently butmust solve for all unknowns simultaneously as a set of linear equations
→
u^ i^^ “Implicit solution”
1
-^
j^
1
,^
u^
i^
j^
1
,^
u^ i
1 +^
j^
1
,
u^ i
j ,
j+1 j-
j
i-
i^
i+
known values
molecule #2 i+
molecule #
unknown values
CE 341/441 - Lecture 16 - Fall 2004
p. 16.
- Notes on simultaneous equation solution
- The matrix is always diagonally dominant, and there are therefore no roundoff error
problems in the solution of this system of simultaneous equations. Solve this tri-diagonal, symmetric set of equations by a Gauss-elimination type procedure.
-^
If
,^
,^
are constants we do not need to re-set and triangularize the matrix at
every time step, otherwise we must re-set and re-solve the matrix every
- To solve this system of equations requires
operations, the same order is
required for an explicit formulation. This however changes for 2D and 3D prob-lems!!
unconditionally stable
(i.e. the method is stable for all values of
and
still accuracy limitations
on both
and
(which are required to limit trun-
cation error!).
can be many times larger for an implicit scheme than for an explicit
scheme (10 to 100 times), leading to computational savings.
- Truncation order of implicit and explicit methods is the same (order
in space and
order
in time). However the actual error will vary due to the coefficients of the trun-
cation terms.
x^
t^
D
t
O n
(^
t
x
t^
x
t
x (^
t
CE 341/441 - Lecture 16 - Fall 2004
p. 16.
Crank-Nicolson Implicit (C-N) Method • Evaluate time derivative at point
using a forward difference (or at point
using a backward difference).
- Evaluate the 2nd spatial derivative using the average of the central difference expres-
sions at
and
- Applying these two steps to the transient diffusion equation leads to:• Arranging knowns and unknowns:
i^
j , (^
)^
i^
j^
i^
j , (^
)^
i^
j^
(^
(^1) ----- ∆ t
u
i^
j^
1
,^
u^
i^
j ,
[^
]^
D ∆ x (^
-^
1 ---^2
u^ i
1
j^
1
, +^
u^
i^
j^
1
,^
u^ i
1
j^
(^
)^
u^
i^
1
j , +^
2 u
i^
j ,
u^
i^
1
j ,
(^
[^
]
u
i^
1
j^
1 + ,
-^
x (^
tD ----------------
u
i^
j^
1 + ,^
u
i^
1
j^
1 + , +
+
–^
u
-^
i^
1
j ,
-^
x (^
tD ----------------
–^
u^
i^
j ,^
u
i^
1
j , +
CE 341/441 - Lecture 16 - Fall 2004
p. 16.
- An alternative interpretation of the C-N solution is to estimate the p.d.e. at
- The time derivative term can be thought of as being a central representation of
at
- The 2nd spatial derivative may be thought of as being a central representation of
at
,^
and
are then estimated using values at full
nodes with an interpolation procedure.
- Defining full and intermediate nodes as:
i^
j^
^
^
u ∂ t
i^
j^
^
^
u
2 ∂
(^2) x
i^
j^
^
^
ui^
1
-^
j^
1 --- 2
,^
ui
j
1 --- 2
,^
ui
1 +^
j^
1 --- 2
,
j+
j
i-
i^
i+
x^
x^
x
j+1/
CE 341/441 - Lecture 16 - Fall 2004
p. 16.
- We can interpret the C-N solution as:
⇒
- Now we can use linear interpolation:• Substituting leads to:
∂ u
i^
j^
1
(^2) ⁄
, ∂
t
-^
D
u
2 i
j
1
(^2) ⁄
, ∂ x
2
u^
i^
j^
1
,^
u^ i
j ,
t
-^
D
u^
i^
1
j^
1
(^2) ⁄
, +^
u^
i^
j^
1
(^2) ⁄
,
-^
u^
i^
1
-^
j^
1
(^2) ⁄
,
(^2) x
^
^
u^
i^
1 +^
j^
1
(^2) ⁄
,
1 ---^2
u^ i
1 +^
j^
1
,^
u^ i
1 +^
j ,
(^
u^
i^
j^
1
(^2) ⁄
,
1 ---^2
u^
i^
j^
1
,^
u^ i
j ,
(^
u^
i^
1
-^
j^
1
(^2) ⁄
,
1 ---^2
u^
i^
1
-^
j^
1
,^
u^
i^
1
-^
j ,
(^
(^1) ----- ∆ t
u
i^
j^
1 + ,^
u
i^
j ,
[^
]^
D ∆ x (^
-^
1 ---^2
u
i^
1
j^
1 + , +^
u^
i^
j^
1 + ,^
u
i^
1
j^
(^
)^
u
i^
1
j , +^
2 u
i^
j ,^
u
i^
1
j ,
+
(^
[^
]