You are on page 1of 3

Rivers State University

CEG 802 Numerical Methods and Computer Programming

ASSIGNMENT

Question 1.

The advection-diffusion equation is used to compute the distribution of concentration along the length of a
rectangular chemical reactor

𝜕𝑐 𝜕 2𝑐 𝜕𝑐
=𝐷 2−𝑈 − 𝑘𝑐
𝜕𝑡 𝜕𝑥 𝜕𝑥
Where c = concentration (mg/m3), t = time (min), D = a diffusion coefficient (m2/min), x = distance along
the tank’s longitudinal axis (m) where x = 0 at tank’s inlet, U = velocity in the x direction (m/min), and k = a
reaction rate (min-1) whereby the chemical decays to another form. Develop a User Friendly for an explicit
scheme to solve this equation numerically. Test it for k = 0.15 and k = 0.25, D = 100, and U = 1 for a tank
of length 10m. Use Δx= 1m, and a step size Δt = 0.005 and 0.0025. Assume that the inflow concentration is
100 and the initial concentration in the tank is zero. Perform the simulation from t = 0 to 120 and plot the
final resulting concentrations versus x for the various k’s and Δt’s. Discuss your results.

Question 2.

Under a number of simplifying assumptions, an analog of Fourier’s law can be represented in one-
dimensional form as

𝑑𝑉
𝐷 = −𝜀
𝑑𝑥
Where D is called the electric flux density, ε = permittivity of material, and V = electrostatic potential.
Similarly a Poisson’s equation for electrostatic fields can be represented in one dimension as

𝑑2𝑉 𝜌𝜗
= −
𝑑𝑥 2 𝜀
Where ρυ = charge density. Use finite-difference technique with Δx = 2 to determine V for a wire where
V(0) = 1000, V(20) = 0, ε = 2, L = 20, ρυ = 30. Develop a user-friendly computer program in Matlab and
test it with your problem. Compare your results.

Question 3.

Determine the temperature distribution of a long, thin horizontal rod of 5 cm described by the heat
conduction equation

𝜕2 𝑇 𝜕𝑇
𝑘 =
𝜕𝑥 2 𝜕𝑡

Assume that the right boundary is insulated and the left boundary (x = 0) is represented by

𝜕𝑇
−𝑘 ′ (0) = ℎ(𝑇𝑎 − 𝑇0 )
𝜕𝑥
Where 𝑘 ′ = coefficient of thermal conductivity (W/m. oC), h = convective heat transfer coefficient (W/m2.
o
C), Ta = constant temperature (oC), and T0 = temperature of the rod at x = 0 (oC). Develop both explicit and
implicit schemes to solve this equation numerically. Solve for temperature as a function of time using a spatial
step of Δx = 1cm and the following parameter values: k = 2 x 10-5m2/s, 𝑘 ′ = 10 𝑊/𝑚2.oC, h = 25 W/m2.0C
and Ta = 50 oC. Assume that the initial temperature of the rod is zero. Use the value of λ=1/4. Develop a user-
friendly program for the explicit scheme and test it with the data above.

Question 4.

A Mechanical Engineering study indicates that fluid flow through a pipe is related to a pipe diameter and slope
as seen below. The result of the study is tabulated below. Use the Multiple Linear Regression to analyse this
data. Then use the resulting model to predict the flow through a pipe with diameter of 2.5ft and slope of
0.025ft/ft. Develop a User-Friendly program in MATLAB for this problem and test the program using these
data. The power equation to be evaluated is given as

𝑸 = 𝒂𝟎 𝑫𝒂𝟏 𝑺𝒂𝟐

EXPT Diameter (ft) Slope (ft/ft) Flow rate ft3/s


1 1 0.001 1.4
2 2 0.001 8.3
3 3 0.001 24.2
4 1 0.01 4.7
5 2 0.01 28.9
6 3 0.01 84.0
7 1 0.05 11.1
8 2 0.05 69.0
9 3 0.05 200.0

Where Q = flow rate ft3/s; S = slope (ft/ft); D = pipe diameter (ft) and a0, a1 and a2 are coefficients.

Question 5

The equation for single-phase, 1D slightly compressible flow through porous media is given as

𝜕 𝐴𝑥 𝑘𝑥 𝜕𝑃 𝑉𝑏 ∅𝑐 𝜕𝑃
(𝛽𝑐 ) ∆𝑥 + 𝑞𝑠𝑐 =
𝜕𝑥 𝜇𝐵 𝜕𝑥 𝛼𝑐 𝐵 𝑜 𝜕𝑡

The forward difference approximation to the flow equation results in an explicit formulation which can be
represented as

𝛼𝑐 𝐵 𝑜 ∆𝑡 𝛼𝑐 𝐵 𝑜 ∆𝑡
𝑃𝑖𝑛+1 = 𝑃𝑖𝑛 + ( )+ ( 𝑛
) × [𝑇𝑖+1/2 𝑛
𝑃𝑖+1 − (𝑇 𝑛 1 + 𝑇 𝑛 1 ) 𝑃𝑖𝑛 + 𝑇𝑖−1/2
𝑛 𝑛
𝑃𝑖−1 ]
𝑉𝑏 ∅𝑐 𝑉𝑐 ∅𝑐 𝑖+
2
𝑖−
2

𝑥 𝑥𝐴 𝑘
Where 𝑇 = 𝛽𝑐 𝜇𝐵∆𝑥

Develop a user friendly computer program in Matlab to calculate the distribution of pressure in the reservoir
during the first year of production. Test your programme for the following reservoir data: The initial reservoir
pressure is 6000psia. The rock and fluid properties for this problem are: Δx = 1000ft, Δy = 1000ft, Δz = 75ft.
B = Bo = 1 RB/STB, c = 3.5 x 10-6 psi-1, k = 15md, Ø = 18%, µ = 10cp. Use Δt = 10 and 15. Assume that the
two extremes of the reservoir are in no flow condition. Use only five interior nodes. Plot the graphs in each
of the grid blocks for one year at the different sampling times given. Discuss your results.
Question 6

Under a number of simplifying assumptions, the steady-state height of water table in one dimensional,
unconfined groundwater aquifer can be modelled with the following second-order ODE:

𝑑2ℎ
𝐾ℎ̅ +𝑁 =0
𝑑𝑥 2
Where x = distance (m), K = hydraulic conductivity (m/d), h = height of the water table (m), h = the average
height of the water table (m), and N = infiltration rate. Solve for the height of the water table for x = 5m. Use
1000m where h(0) =10m and h(1000)=5m. Use the following parameters for the calculation: K = 1 m/d and
N = 0.1 m/d. Set the average height of the water table as the average boundary condition. Obtain your solution
using finite difference method (Δx =100). Develop a user friendly computer programme in Matlab language
and test your with the data given in this problem. Plot the calculated and model results together.

Question 7

The displacement of a structure is defined by the following equation for a damped oscillation:

𝑦 = 9𝑒 −𝑘𝑡 cos𝜔𝑡

Where k = 0.7 and ω = 4.

(a) Use the graphical method to make an estimate of the time required for the displacement to decrease to
3.5
(b) Use the Newton-Raphson method to determine the root to εs = 0.01%
(c) Use the secant method to determine the root to εs = 0.01%

Question 8

Use the classical fourth order RK method with h = 0.5 to solve the following problem over the interval from
x = 0 to 2.

𝑑𝑦
= 2𝑦𝑥 2 − 1.2𝑦
𝑑𝑥
Where y(0) = 1. Sketch the solution.

Fourth order RK formula is given as:


1
𝑦𝑖+1 = 𝑦𝑖 + (𝑘1 + 2𝑘2 + 2𝑘3 + 𝑘4 )ℎ
6

Where

𝑘1 = 𝑓(𝑥𝑖 , 𝑦𝑖 )

1 1
𝑘2 = 𝑓 (𝑥𝑖 + ℎ, 𝑦𝑖 + 𝑘1 ℎ )
2 2

1 1
𝑘3 = 𝑓 (𝑥𝑖 + ℎ, 𝑦𝑖 + 𝑘2 ℎ )
2 2

𝑘4 = 𝑓(𝑥𝑖 + ℎ, 𝑦𝑖 + 𝑘3 ℎ )

You might also like