Docsity

Programming Assignment 3 - Computational Fluid Dynamics - Spring 2001 | MATH 365, Assignments of Mathematics

Toggle sidebar
bg1
Math/Physics 365 Computational Fluid Dynamics
The Finite-Difference Method in 2D: Poisson’s Equation
Programming Assignment 3
(Spring 2001–Pruett/Sochacki)
DATE ASSIGNED: Thursday, 22 Feb., 2001 DATE DUE: Thursday, 1 March, 2001
BACKGROUND: As a homework problem you showed that the pressure in a 2D incompressible flow
satisfies Poisson’s equation, namely ∇2p=2[uyvx−uxvy]
Thus, at each time step in the simulation of unsteady flow, it is necessary to solve Poisson’s equation,
which is computationally intensive. As a model problem consider, Poisson’s equation on a rectangular
domain with Dirichlet boundary conditions. That is,
pxx +pyy =f(x,y) = −3cos(2x)eyon (0<x<π/4,0<y<1)
p(x,0) = cos(2x);p(x,1) = ecos(2x)
p(0,y) = ey;p(π/4,y) = 0
In class, we developed the second-order “five-point-star” discretization for Poisson’s equation on a rect-
angular domain. The resulting matrix equation can be solved by a variety of computational methods that
range from crude to sophisticated and computationally intensive to lightning fast. Our text selects Succes-
sive Over Relaxation (SOR) as a compromise, which is a variant of the Gauss-Seidel method. A Fortran
90 program has been written for you to solve Poisson’s by either SOR, multigrid, or fast-direct meth-
ods. The program and peripheral plotting routines have been placed on the UNIX machines in directory
/home/dpruett/pickup as poisson.tar. Copy this file to your machine, create a directory, and then extract
the files by the command tar -xf poisson.tar. The main program is poisson.f90 and the respective MOD-
ULES are sor.f90,multi.f90, and fast.f90. Among other things poisson.f90 calls SYSTEM CLOCK to
compute the execution time required by the selected solver. Be sure to read the README file first.
ASSIGNMENT:
1. C-Level: Verify by direct substitution that the exact solution to the model problem is p(x,y) =
cos(2x)ey. (This is a pedagogical example; normally you wouldn’t know the exact solution.)
2. C-Level: Run program poisson.f90 in SOR mode for various values of mand nand convergence
criterion. Discuss how the number of iterations and the computational time vary as the grid is refined
or the convergence criterion is tightened. Use the MatLab routines converge.m and moving.m to
see how the solution evolves over time.
3. C-Level: By trial and error, find approximately optimal values of the relaxation parameter σfor
several selected resolutions.
4. B-level: Repeat the appropriate steps above in MULTIGRID mode. Compare and contrast SOR and
MULTIGRID methods in terms of their convergence properties relative to grid resolution.
5. A-Level: The optimal method for our model problem is a fast direct method based on Fast Fourier
Transforms (FFTs). Run the code again in FASTDIRECT mode. Compare your experience with
that in the C and B levels of the project.
6. A-Level: Experiment with various values of resolution mand n(using the method of choice) to
verify that the global error behaves as O(∆x2) + O(∆y2)as expected.

Partial preview of the text

Download Programming Assignment 3 - Computational Fluid Dynamics - Spring 2001 | MATH 365 and more Assignments Mathematics in PDF only on Docsity!

Math/Physics 365 Computational Fluid Dynamics

The Finite-Difference Method in 2D: Poisson’s Equation

Programming Assignment 3

(Spring 2001–Pruett/Sochacki)

DATE ASSIGNED: Thursday, 22 Feb., 2001 DATE DUE: Thursday, 1 March, 2001

BACKGROUND: As a homework problem you showed that the pressure in a 2D incompressible flow satisfies Poisson’s equation, namely ∇^2 p = 2 [ uyvx − uxvy ]

Thus, at each time step in the simulation of unsteady flow, it is necessary to solve Poisson’s equation, which is computationally intensive. As a model problem consider, Poisson’s equation on a rectangular domain with Dirichlet boundary conditions. That is,

pxx + pyy = f ( x , y ) = −3 cos( 2 x ) ey^ on ( 0 < x < π/ 4 , 0 < y < 1 ) p ( x , 0 ) = cos( 2 x ) ; p ( x , 1 ) = e cos( 2 x ) p ( 0 , y ) = ey^ ; p (π/ 4 , y ) = 0

In class, we developed the second-order “five-point-star” discretization for Poisson’s equation on a rect- angular domain. The resulting matrix equation can be solved by a variety of computational methods that range from crude to sophisticated and computationally intensive to lightning fast. Our text selects Succes- sive Over Relaxation (SOR) as a compromise, which is a variant of the Gauss-Seidel method. A Fortran 90 program has been written for you to solve Poisson’s by either SOR, multigrid, or fast-direct meth- ods. The program and peripheral plotting routines have been placed on the UNIX machines in directory /home/dpruett/pickup as poisson.tar. Copy this file to your machine, create a directory, and then extract the files by the command tar -xf poisson.tar. The main program is poisson.f90 and the respective MOD- ULES are sor.f90 , multi.f90 , and fast.f90. Among other things poisson.f90 calls SYSTEM CLOCK to compute the execution time required by the selected solver. Be sure to read the README file first.

ASSIGNMENT:

  1. C-Level: Verify by direct substitution that the exact solution to the model problem is p ( x , y ) = cos( 2 x ) ey. (This is a pedagogical example; normally you wouldn’t know the exact solution.)
  2. C-Level: Run program poisson.f90 in SOR mode for various values of m and n and convergence criterion. Discuss how the number of iterations and the computational time vary as the grid is refined or the convergence criterion is tightened. Use the MatLab routines converge.m and moving.m to see how the solution evolves over time.
  3. C-Level: By trial and error, find approximately optimal values of the relaxation parameter σ for several selected resolutions.
  4. B-level: Repeat the appropriate steps above in MULTIGRID mode. Compare and contrast SOR and MULTIGRID methods in terms of their convergence properties relative to grid resolution.
  5. A-Level: The optimal method for our model problem is a fast direct method based on Fast Fourier Transforms (FFTs). Run the code again in FASTDIRECT mode. Compare your experience with that in the C and B levels of the project.
  6. A-Level: Experiment with various values of resolution m and n (using the method of choice) to verify that the global error behaves as O (∆ x^2 ) + O (∆ y^2 ) as expected.