Title: PETE 301
1PETE 301
- Partial Differential Equations
2Partial Differential Equations (PDEs)
- Physical meaning of PDE
- Initial and boundary conditions
- Classification
- parabolic vs. hyperbolic
- linear vs. nonlinear
- Solution Methods
- Analytical, numerical, transformation methods
3Classification
Laplace steady-state Elliptic
Diffusitivity (heat cond) transient Parabolic
Wave transient Hyperbolic
4Example Diffusivity Equation
- Expresses conservation of mass
- Slightly compressible fluid
- Porous media
- Single phase flow
5Linearity
- If does not depend on p the
- equation is linear.
- If does depend on p the
- equation is nonlinear.
6Coordinate Systems
These equations are for 2D problems. To go to 3D
add .
7Transient versus Steady-State
Neeeds initial and boundary conditions
Neeeds only boundary conditions
8Derivatives
- The diffusivity equation includes derivatives of
pressure in space and in time. - To solve the diffusivity equation numerically we
must find ways to represent these derivatives.
9Taylor Series
10First Derivative (Forward)
11First Derivative (Backward)
12First Derivative (Central)
13Second Derivative (Central)
14Accuracy
- Getting the derivatives approximated correctly is
an important part of getting an accurate
numerical solution. - How accurate are these Taylor series forms?
15Accuracy
- Experiment with the spreadsheet to learn for
yourself how Dx and Dt affect the accuracy of the
derivative. - How accurate is a second derivative term (space)
? - How accurate is a first derivative term (time)?
16Accuracy
- You can study the accuracy of the derivatives (as
a function of Dx) by plotting the absolute error
between the true f(x) and the calculated f(x).
Also f(x) - You may want to consider using logarithmic axes
on these plots.
17Accuracy
- You should have found that the space derivative
is O(Dx2) and the time derivative is O(Dt). - Knowing this if you wanted to improve the
accuracy of your solution and could halve either
Dx or Dt which would you choose?
18Linear ReservoirConstant Pressure Boundaries
ft day psi 1/psi md cp
p const
p const
(left)
(right)
L
0
x
19Uni_Names
20Diffusivity Numerical Solution
- First discretize the region on interest over both
space and time.
21Diffusivity Numerical Solution
- Replace the analytical derivatives by numerical
approximations. - Central difference in space
- Backward difference in time
- Right now we are not stating what timestep (n or
n1) the terms on the left are being evaluated.
22Implicit Solution Template
t
n1
t
n
t
1
t
x
x
x
x
i
i1
i-1
23Implicit - Time Level of Terms
- An implicit solution scheme means that the
pressures at the nodes will be evaluated at the
new timestep (n1) in second derivative (space)
term.
24Boundary Conditions
- We must specify the conditions of the left and
right boundaries - constant pressure
- pi const (I 1 or n)
- constant rate
25System of Equations
Thomas algorithm
26Thomas Algorithm
The problem Axb can be solved very efficiently
when A is a tridiagonal matrix. The matrix
itself is not stored. Only three vectors a,b and
c are stored. These hold the values on the
matrix diagonals.
27n int, inp a(n) real, inp b(n)
real, inp c(n) real, inp d(n) real,
inp x(n) real, out
Sub Thomas(a() As Double, b() As Double, c() As
Double, _ d() As
Double, x() As Double) 'Tridiagonal system of
equations Dim n As Integer, i As Integer n
UBound(b) ReDim w(n) As Double, g(n) As Double
w(1) b(1) g(1) d(1) / w(1) For i 2 To
n w(i) b(i) - a(i) c(i - 1) / w(i - 1)
g(i) (d(i) - a(i) g(i - 1)) / w(i) Next i
x(n) g(n) For i n - 1 To 1 Step -1 x(i)
g(i) - c(i) x(i 1) / w(i) Next i End Sub
28Sub VBA111() ' Linear reservoir constant
pressures at the two end points Dim nx As
Integer, nt As Integer, ipr As Integer 'Input R
eDim a(nx) As Double, b(nx) As Double, c(nx) As
Double ReDim d(nx) As Double, p(nx) As Double '
dx xlen / (nx - 1) dt tend / nt alpha
phi mu ct / (0.00633 k) dx 2 /
dt 'Initialization t 0 'Time steps For it
1 To nt 'make a, b, c, d, Call Thomas(a,
b, c, d, p) Next it End With End Sub
Program Structure
29Explicit Solution Scheme
- Discretize the region of interest
- Discretize the diffusivity equation
- Central difference in space
- Forward difference in time
30Finite Difference Template
31Explicit Solution
- Explicit equations
- Left boundary (i 1)
- Interior points (i 2,?,nx-1)
- Right boundary (i nx)
(or no flow)
(or no flow)
32Stability
- Implicit stable
- Explicit at ? less than 2 it is unstable!