In this chapter we consider implicit discretizations of space- and time-derivatives. Unlike the explicit discretizations presented in the previous chapter, here we express a derivative at one grid point in terms of function values as well as derivative values at adjacent grid points (spatial discretization) or in terms of previous and current time levels (temporal discretization). This, in turn, implies that there is implicit coupling, and thus matrix inversion is required to obtain the solution.
The material of this chapter serves to introduce solutions of tridiagonal systems and correspondingly parallel computing of sparse linear systems using MPI. We also introduce two new MPI functions: MPI_Barrier, used for synchronizing processes, and MPI_Wtime, used for obtaining the wallclock timing information.
- Section 6.1.4: void ThomasAlgorithm(int N, double *b, double *a, double *c, double *x, double *q) function definition
- Section 6.1.4: void ThomasAlgorithLU(int N, double *b, double *a, double *c, double *l, double *u, double *d) function definition
- Section 6.1.4: void ThomasAlgorithm_per(int N, double *b, double *a, double *c, double *x, double *q) function definition
- Section 6.1.5: void ThomasAlgorithm_P(int mynode, int numnodes, int N, double *b, double *a, double *c, double *x, double *q) function definition
Go to the file SCchapter6.h for function/class declarations
Go to the file SCchapter6.cpp for function/class definitionsIn the case that an entire program (meaning that a main() function is provided) is presented in the text, we classify this as a driver program. Unlike the functions/classes above, driver programs are complete C++ programs which can be compiled and executed. As you read through the book, you will see that driver programs are often times created by using functions/classes which are in the SCchapter files. We denote driver programs which are explicitly given in the text of the book in red. In some chapters, we present very few driver programs explicitly in the text, however we provide some example driver programs which demonstrate how to use the functions/classes with in SCchapter files. Such driver programs are denoted in black.
Section 6.1.4: Program to demonstrate the use of the Thomas Algorithm routine | chapter6c0.cpp |
Section 6.1.5: MPI - Program to demonstrate the use of the parallel Thomas Algorithm routine | chapter6c1P.cpp |