0% found this document useful (0 votes)
20 views

16.elliptic PDE

pde

Uploaded by

abkat080
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views

16.elliptic PDE

pde

Uploaded by

abkat080
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

16.

Solution of elliptic partial differential equation

12/22/2015
Recall in the first lecture of this course ….
Assume…
• you know how to use a computer to compute;
• but have not done any serious numerical computations,
• and only know some very basic numerics.

This course will teach you…


• FORTRAN programing language to compute,
• good habits to write structural Fortran programs,
• to write test driver to test the Fortran program written by you or others,
• to use well developed and optimized libraries, such as LAPACK, FFTW,
• to do parallel computing in multi-process computer using OpenMP
• to use the these skills to solve partial differential equations governing simple
physical systems, such as Poisson equation, wave equation, heat equation.
… and using these basic blocks plus some extra hard work, eventually you are able to
develop your own numerical program to simulate the more realistic physical system,
such as …
Numerical simulation of flow motion
• A popular tool due to the burst in power of computing.
• Substitute for experiment when measurement is inaccessible.
Governing equations for motion of an incompressible fluid
• Property variables to describe the flow:
velocity: = , , ,
= , , , ̂+ , , , ̂+ , , ,
pressure: = ( , , , )

• Equations governing the flow:


incompressibility of fluid (solenoidal condition):

+ + =0 ⋅ =0

momentum conservation:
1 1
=− − − − + + + =− ⋅ − +

1 =− − ( )
=− − − − + + +

1
=− − − − + + +

• 4 unknowns with 4 equations


Numerical solution based on explicit scheme
Harlow, F.H. & Welch, J.E., 1965. Numerical calculation of time-dependent viscous
incompressible flow of fluid with free surface. Phys. Fluids, 8(12), 2182−2189.

• Define velocity and pressure at discrete time instance = Δ : and


⋅ =0 ⋅ =0


=− − ( ) ≈ = ≈− − ( )
Δ
i.e., after obtaining and at , marching towards to get

• But, 1. How is the solenoidal condition ⋅ = 0 satisfied?


2. What is the equation for the pressure ?

• Take divergence of the discretized momentum equation:


⋅ ≈− − ( )
Δ
• Take divergence of the time-discretized momentum equation:
− ⋅ − ⋅
⋅ ≈− − ⟹ ≈− ⋅ − ⋅ ( )
Δ Δ

• Ideally, ⋅ = 0 and ⋅ = 0, since the solenoidal condition ⋅ = 0 must be


satisfied at every time instance.

• But due to numerical approximation, the solenoidal condition may not be satisfied exactly.
Let say, there is a small value of ⋅ at = .

• We then project that ⋅ = 0 at = .


− ⋅ 1
∴ ≈− ⋅ − ⋅ ⟹ ≈ ⋅ − ⋅ ( )
Δ Δ
• This is an elliptic-type partial differential equation called Poisson equation:

+ + = , ,

• So the solenoidal condition at = is satisfied by solving the pressure Poisson equation.


This means that pressure is a tuning property to make sure the flow remain solenoidal.
Discrete Fourier Transform in Higher Dimension

• One-dimensional: =

=0 1 2 −1
= =
0 =

1
=

• Two-dimensional:

−1

, = , = ,
=

1 1 2
, = , 1
=0
=0 1 2 −1
=
Numerical Solution of Poisson Equation

• Elliptic-type partial differential equation for


= , in a rectangular domain:

+ = ,

• Discrete representation of the continuous function:


= , ⟹ , = ( , ) −1

= , ⟹ , = ( , )
=

• Numerical solution of the equation means 2


1
finding discrete , satisfies the discretized equation:
=0
=0 1 2 −1
+ ≈ , =
, ,
Rectangular domain with periodic conditions in both directions

, at each grid point can be represented by a discrete Fourier series with


the coefficients to be determined:

, = ̂ , + = ,

= 0, 1, 2, … , −1 = 0, 1, 2, … , −1 −1

=
Similarly,

2
, = , 1
=0
=0 1 2 −1
=

Since , are given ⟹ , are known.


+ = ,

, = ̂ , , = ,

• Substitute , and , into Poisson equation:

2 2
̂ , + ̂ , = ,

2 2
− ̂ , − ̂ , = , = , =

,
⟹ ̂ , =−
+

• This is valid when and are not both equal to zero.


• = 0 and = 0 corresponds to the constant mode.

• This is because the solution of the Poisson equation subject to periodic boundary conditions in
both direction is indeterminant,
i.e. any constant, , = , can be the solution.

∴ For the well posedness of the problem, ̂ , ≡ 0.


Rectangular domain periodic condition in one direction
= given

+ = ,
periodic periodic

=0 1 2 −1
= given

• Since , is periodic in direction only, it can be represented as:

= − ̂

= , = ̂ ⟹
̂
=
Similarly,

= , =
• Substitute the expansions of , and , into the Poisson equation:

̂ 2
− ̂ + = =

̂
⇒ − ̂ =

• This is an ordinary differential equation for ̂ subject to the upper and lower boundary conditions
of Dirichlet type for different .
• If 2nd-order finite-difference scheme is used to approximate the differentiation of :

̂ = given = ̂ , given

̂ = ̂ ,

̂ +1
̂ , −2 ̂ , + ̂ ,
− ̂ = − ̂ , = ,
−1 △
2
∆= =

̂ = 0 given =0 ̂ , given
 Discretized equation for ̂ = ̂ : ̂ , −2 ̂ , + ̂ ,
, − ̂ , = ,

known
−1 ̂ , − 2+ ∆ ̂ , + ̂ , =△ ,
−2

+1
̂ , − 2+ ∆ ̂ , + ̂ , =△ ,
−1

2
1 ̂ − 2+ ∆ ̂ + ̂ =△
, , , ,
=0 known

 The discretized equation can be represented as a system of linear equation:

− 2+ ∆ 1 , △ , − ,
, ⋮
⋮ ⋮
− 2+ ∆ 1 △ ,
1 ,
1 − 2+ ∆ 1 , = △ ,
1 − 2+ ∆ 1 , △ ,
⋮ ⋮
, ⋮
1 − 2+ ∆ , △ , − ,

 The ( − 1)× − 1 matrix is a tridiagonal, and can be solved efficiently for various .
 Only need to consider = 0 to /2 for real DFT.
Homework 18
■ Write a subroutine solving Poisson equation in a rectangular domain with periodic boundary
conditions in direction and Dirichlet conditions on the other two boundaries.
■ Use routine in Lapack to solve the tridiagonal system of linear equation. Use FFFTW to do
discrete Fourier transform. Use random numbers between −1 and 1.
■ In calling the subroutine, the following data are input :
• the length and width of the rectangular domain and
• the numbers of discrete grids and
• the source function , , = 0 ~ ( − 1), = 1 ~ ( − 1)
• the boundary value on the bottom and top , and , , = 0 ~ ( − 1)
■ Write a test driver (use the second approach in the following) to assess the maximum error
calling the subroutine to confirm if the Poisson solver has been implemented correctly.
given

( − 1)
periodic in periodic in

+ = ,
2
1
=0
=0 1 2 ( −1)
given
Two approaches to test the Poisson solver
 The first approach:
• Invent a known analytical function , and compute ANALYTICALLY the right-hand-side
source function of the Poisson equation ( , ) and the boundary conditions:
′ ′
, = +

,0 = ′ ,0

, = ′ ,

• Given the analytical source function , and the boundary conditions , and , , the Poisson
equation is then solved for , , and the numerical solution is compared with the known
function , .
−1

+ ≈ , =
, ,
2
1
=0
=0 1 2 −1
=
• Such an approach can be used to test the convergence of the solver by increase the grid points.
 The second approach:

• Generating the solutions , and the boundary conditions , and , using random numbers.

• The source function is then computed numerically using spectral scheme in the periodic direction
and finite-difference scheme in the other direction.
′ ′ −1
, = +
, ,
=
spectral finite
scheme difference 2
1
, = , , = , =0
=0 1 2 −1
=
• Given the source function , and the boundary conditions , , , , the Poisson equation is
then solved numerically.

+ = ,
, ,

• The numerical results , should be equal to the original given random numbers , since the
forward (computing the source function) and inverse (solving the equation) operators are identical.

• Such approach is for debugging the code.

You might also like