Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lecture 19 MA471 Fall 2003.

Similar presentations


Presentation on theme: "Lecture 19 MA471 Fall 2003."— Presentation transcript:

1 Lecture 19 MA471 Fall 2003

2 Course Summary So Far Writing a serial card playing game.
Using MPI to convert the card playing game to run on multiple processors: Blocking point to point communication Non-blocking p2p. Global communication. 1-dimensional finite volume scheme for a basic: Serial implementation. Parallel implementation. Profiling the parallel code with upshot. Trouble shooting bottlenecks (i.e. delaying global error reduction). 2-dimensional finite volume scheme introduced. Bandwidth reduction (example algorithm Cuthill-McKee). Load balancing with Karypis’ Metis software. Introduction to solving simple electrical circuit problems. Using “direct” factorization methods (LU or Cholesky) Practical limit for solving on a serial computer. Using “iterative” solution methods (Jacobi, Gauss-Seidel, Conjugate-Gradient) Practical issues relating to parallel implementation. Using a sparse matrix methods with iterative methods. Sufficient conditions for the Jacobi method to converge. An approach for distributed storage and action of a sparse matrix on a parallel computer.

3 Remaining Topics We will discuss some simple finite difference methods for the heat equation. We may also cover details of spectral methods. Multigrid. Projects.

4 The Heat Equation in 1-D Examples of diffusion?

5 1-D Diffusion Equation We consider the motion of a tracer solute in a fluid with zero mean velocity. We will denote the concentration of the tracer by C(x,t) The tracer will diffuse by random particle motion. The diffusion equation is:

6 Diffusion An underlying assumption of diffusion equation is that mechanical dispersion, like molecular diffusion, can be described by Fick’s first law: where F is the mass flux of solute per unit area per unit time and D is the effective diffusion coefficient in a porous medium. Fick.s law states that particle flux is directly proportional to the spatial concentration gradient. But it is not the spatial concentration gradient that causes particle movement, i.e. particles do not .push. each other (Crank, 1976). Particles exhibit random motion on the molecular level. This random motion ensures that a tracer will diffuse, decreasing the concentration gradient (Crank, 1976). Crank, J., The Mathematics of Diffusion. Oxford University Press, New York.

7 Diagram of Diffusion Model
b a b Assume that each particle is jumping with a rate of R(delta) jumps per second which take it a distance of delta or more then there will be a number of jumps out of the left delta width ~= -R(delta)*0.5*delta*(C(b) + C(b-delta)) We count the number of jumps in from the right delta width ~= +R(delta)*0.5*delta*(C(b+delta)+C(b)) Summing:

8 Rough Derivation of Fickian Diffusion
Consider the x=b end of the section. We are going to “monitor” the random motions of a particle in and out of the region: Assume that each particle is jumping with a rate of R jumps per second then there will be a flux of out of the b end (similar at the a end) We apply tracer counting:

9 [ Note continuity assumptions ]
We now recall that R is a function of delta and clearly R must be inversely proportional to delta. i.e. as the region we are monitoring shrinks to zero, the rate of random motions into and out of the control region increases… We denote and obtain:

10 2-D Diffusion We can follow the same line of reasoning to obtain the 2-D diffusion equation: We are now going to create a very basic finite difference numerical scheme which we will use to solve this equation:

11 First: Taylor’s Theorem with Cauchy Remainder
i.e.

12 Approximation of the Second Derivatives
We use Taylor’s theorem twice:

13 cont We add those two approximations together:

14 Approximate Formula For Second x-derivative
Similarly:

15 The Separate Parts

16 Two Discrete Schemes Forward Euler: Backwards Euler:
For the second we end up having to solve a linear system – so that’s the one we will consider

17 Index Notation We will assume that we store the approximation to C on a Cartesian grid, with horizontal spacing dx and vertical spacing dy. We will compute the values of C at all these points in time increments of dt.

18 Time Stepping The discrete scheme looks like:
Assume dx = dy and set then: Tidying up:

19 Boundary Conditions Assume:
i.e. the concentrate is zero at the boundary.

20 Summary The scheme now looks like:
This is nothing more than a linear system. We need to solve for We only need to store where M is the number of data points in each coordinate direction.

21 Implementation Build a matrix (with N=M*M rows and columns) representing the system: with Where we drop terms at the boundary given by: Evaluate an initial condition for C at the datapoints (grid of values). At every time step solve the linear system for the update value of C.

22 y x

23 Stencil y x i.e.

24 Example Matlab Code Build matrix:
12-38) set the non-zero entries of the matrix 12-28) the if statements determine if the boundary condition is invoked. 36) set diagonal term = 1+4lambda

25 Jacobi Iterator 40-41) build sparse matrices for jacobi
43-49) build right hand side vector 52) initial guess for C 59-74) Jacobi iteration 70-73) plot contours of C computed as iteration continues.

26 Solving


Download ppt "Lecture 19 MA471 Fall 2003."

Similar presentations


Ads by Google