Professional Documents
Culture Documents
CFD Homework #2: Name: Duong Tien Trung Student ID: 201783553 Problem 1
CFD Homework #2: Name: Duong Tien Trung Student ID: 201783553 Problem 1
Numerical method:
Introduce 5 nodes which are equally spaced within the domain [0,1].
−2.0625 1 0 𝑢1 −0.00390625
[ 1 −2.0625 1 𝑢
] ( 2 ) = ( −0.015625 )
0 1 −2.0625 𝑢3 −0.03515625
Solve the above system by using matrix multiplication in Excel, we obtain the solution:
𝑢1 = 0.0172, 𝑢2 = 0.0316, 𝑢3 = 0.0324.
Type the equations (5), (6) and (7) into cell u1, u2, u3 respectively, we also get the solution.
From the obtained solution, the graph comparing the numerical solution and exact solution
is drawn as below:
Problem 1
0.04
0.035
0.03
0.025
0.02
u
Note that the value of the dependent variable at time level n is known from a previous solution
or given as initial data; i.e., the computed values at n+1 depend only on the past history.
We can solve this problem by using Excel.
At time t=0, we have the initial condition as follows:
From the obtained solutions, the graph comparing the solutions for numerous time steps is
drawn as follows:
Explicit method
1
0.9
0.8
0.7
t=0.04
0.6
t=0.08
0.5
u
0.4 t=0.12
0.3 t=0.16
0.2 t=0.20
0.1 t=infinite
0
0 0.25 0.5 0.75 1
x
Problem 3: Implicit method
One-dimensional heat equation:
𝜕𝑢 𝜕 2 𝑢
= 0 ≤ 𝑥 ≤ 1, 𝑡 ≥ 0 (1)
𝜕𝑡 𝜕𝑥 2
Initial condition:
𝑢(0, 𝑥) = 0
Boundary condition:
𝑢(𝑡, 0) = 0 𝑎𝑛𝑑 𝑢(𝑡, 1) = 1
For now, 𝜕𝑢⁄𝜕𝑡 will be represented by a backward difference approximation:
𝜕𝑢 𝑢𝑖𝑛+1 − 𝑢𝑖𝑛
≅ (2)
𝜕𝑡 ∆𝑡
Using the second-order central differencing of order ∆𝑥 2 for the diffusion term:
𝑛+1
𝜕 2 𝑢 𝑢𝑖+1 − 2𝑢𝑖𝑛+1 + 𝑢𝑖−1
𝑛+1
≅
𝜕𝑥 2 ∆𝑥 2
Therefore, the equation (2) can be approximated by the following difference equation:
𝑢𝑖𝑛+1 − 𝑢𝑖𝑛 𝑢𝑖+1
𝑛+1
− 2𝑢𝑖𝑛+1 + 𝑢𝑖−1
𝑛+1
≅ (3)
∆𝑡 ∆𝑥 2
𝑛+1 𝑛+1 𝑛+1
In this equation, there are three unknowns: 𝑢𝑖−1 , 𝑢𝑖 and 𝑢𝑖+1 . The figure below shows
the grid points involved in equation (3).
From equation (4), the solution at time t=0.01 can be expressed as below:
∆𝑡 ∆𝑡
𝑢11 = [𝑢10 + ( 𝑢 1
2 + 𝑢 1)
0 ] / (1 + 2 ) (5)
∆𝑥 2 ∆𝑥 2
∆𝑡 ∆𝑡
𝑢21 = [𝑢20 + 2
(𝑢31 + 𝑢11 )] / (1 + 2 2 ) (6)
∆𝑥 ∆𝑥
∆𝑡 ∆𝑡
𝑢31 = [𝑢30 + ( 𝑢 1
+ 𝑢 1)
] / (1 + 2 ) (7)
∆𝑥 2 4 2
∆𝑥 2
Enable the interactive calculation check-box:
Type the equations (5), (6) and (7) into cell u1, u2, u3 respectively, we also get the solution
for time t=0.01:
Therefore, we obtain solutions for other time steps:
From the obtained solutions, the graph comparing the solutions for numerous time steps is
drawn as follows:
Implicit method
1
0.9
0.8
0.7
t=0.04
0.6
0.5 t=0.08
u
0.4 t=0.12
0.3
t=0.16
0.2
t=0.20
0.1
0 t=infinite
0 0.25 0.5 0.75 1