PETE 301 - PowerPoint PPT Presentation

1 / 32
About This Presentation
Title:

PETE 301

Description:

ReDim w(n) As Double, g(n) As Double. w(1) = b(1) g(1) = d(1) / w(1) For i = 2 To n ... inp b(n) : real, inp c(n) : real, inp d(n) : real, inp. x(n) : real, out ... – PowerPoint PPT presentation

Number of Views:99
Avg rating:3.0/5.0
Slides: 33
Provided by: rosalin8
Category:
Tags: pete | double

less

Transcript and Presenter's Notes

Title: PETE 301


1
PETE 301
  • Partial Differential Equations

2
Partial Differential Equations (PDEs)
  • Physical meaning of PDE
  • Initial and boundary conditions
  • Classification
  • parabolic vs. hyperbolic
  • linear vs. nonlinear
  • Solution Methods
  • Analytical, numerical, transformation methods

3
Classification
Laplace steady-state Elliptic
Diffusitivity (heat cond) transient Parabolic
Wave transient Hyperbolic
4
Example Diffusivity Equation
  • Expresses conservation of mass
  • Slightly compressible fluid
  • Porous media
  • Single phase flow

5
Linearity
  • If does not depend on p the
  • equation is linear.
  • If does depend on p the
  • equation is nonlinear.

6
Coordinate Systems
  • Cartesian
  • Radial

These equations are for 2D problems. To go to 3D
add .
7
Transient versus Steady-State
Neeeds initial and boundary conditions
Neeeds only boundary conditions
8
Derivatives
  • 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.

9
Taylor Series
10
First Derivative (Forward)
11
First Derivative (Backward)
12
First Derivative (Central)
13
Second Derivative (Central)
14
Accuracy
  • Getting the derivatives approximated correctly is
    an important part of getting an accurate
    numerical solution.
  • How accurate are these Taylor series forms?

15
Accuracy
  • 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)?

16
Accuracy
  • 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.

17
Accuracy
  • 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?

18
Linear ReservoirConstant Pressure Boundaries
ft day psi 1/psi md cp
p const
p const
(left)
(right)
L
0
x
19
Uni_Names
20
Diffusivity Numerical Solution
  • First discretize the region on interest over both
    space and time.

21
Diffusivity 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.

22
Implicit Solution Template
t
n1
t
n
t
1
t
x
x
x
x
i
i1
i-1
23
Implicit - 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.

24
Boundary Conditions
  • We must specify the conditions of the left and
    right boundaries
  • constant pressure
  • pi const (I 1 or n)
  • constant rate

25
System of Equations
Thomas algorithm
26
Thomas 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.
27
n 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
28
Sub 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
29
Explicit Solution Scheme
  • Discretize the region of interest
  • Discretize the diffusivity equation
  • Central difference in space
  • Forward difference in time

30
Finite Difference Template
31
Explicit Solution
  • Explicit equations
  • Left boundary (i 1)
  • Interior points (i 2,?,nx-1)
  • Right boundary (i nx)

(or no flow)
(or no flow)
32
Stability
  • Implicit stable
  • Explicit at ? less than 2 it is unstable!
Write a Comment
User Comments (0)
About PowerShow.com