Numerical Assignment2018 1
Numerical Assignment2018 1
Faculty of Engineering
Rivers State University of Science and Technology, Port Harcourt
ASSIGNMENT
Note: You are expected to submit both CD and hard copies of your assignment on or 23/06/18 at RM 6
Petroleum Engineering Department Building.
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.
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.
Q3. For All Students
1. Develop a user-friendly computer program for systems of equation using the fourth-order Runge-Kutta
method. Use your program to duplicate the computation of the system of equation below. The initial
conditions are y(0) = 2 and z(0) = 4. Solve over the range x = 0 to 1. Use a step size of 0.2 Use
MATLAB’s plotting capabilities to graph your result.
𝑑𝑦
= −2𝑦 + 5𝑒 −𝑡
𝑑𝑡
𝑑𝑧 𝑦𝑧 2
= −
𝑑𝑡 2
The motion of a damped spring-mass system is described by the following ordinary differential equation.
𝑑2𝑥 𝑑𝑥
𝑚 2 +𝑐 + 𝑘𝑥 = 0
𝑑𝑡 𝑑𝑡
Where x = displacement from equilibrium position (m), t = time (s), m = 10kg, and c = the damping
coefficient (N.s/m). The damping coefficient takes on three values of 5(underdamped), 40(critically
damped), and 200 (overdamped). The spring constant k = 40 N/m. The initial velocity is zero, and the initial
displacement x = 1 m. Solve this equation by writing a User-Friendly program for time period 0 ≤ x ≤ 15s.
Plot the displacement versus time for each of the three values of damping coefficient on the same curve.
Petroleum Engineers
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 (a) that
the two extremes of the reservoir are in no flow condition.
(b) Assume a constant pressure at left hand side of the reservoir to be 6000psia. 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.
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.