Parallel Scientific Computing in C++ and MPI : A Seamless Approach to Parallel Algorithms and their Implementation - Sample Code Ch. 8
Article Index
Parallel Scientific Computing in C++ and MPI : A Seamless Approach to Parallel Algorithms and their Implementation
Sample Code Main
Sample Code Ch. 2
Sample Code Ch. 3
Sample Code Ch. 4
Sample Code Ch. 5
Sample Code Ch. 6
Sample Code Ch. 7
Sample Code Ch. 8
Sample Code Ch. 9
Sample Code Ch. 10
Compilation Guide
All Pages

Chapter 8 Overview

Book Chapter Introduction

In this chapter we continue with mixed discretizations for initial value problems (IVP) and boundary value problems (BVP), but our emphasis is on advection equations and wave propagation with and without dissipation. Specifically, we introduce two important non-dimensional numbers that define the accuracy and the stability of discretizations we present: The Courant number or CFL condition first proposed by Courant in 1928, and the (grid) Peclet number for advection-diffusion systems. We also provide C++ functions and corresponding results that illustrate the effects of numerical diffusion and numerical dispersion in pure advection and in advection-diffusion systems.

On the parallel computing side, we introduce the concept of non-blocking communications, specifically the use of MPI_Isend and MPI_Irecv. Non-blocking communications may lead to a reduction in the computational time by allowing the programmer to appropriately intertwine computation and communication.

SCchapter8 Introduction and Chapter 8 Driver Programs

Within the text, there are several places where the software suite is referenced. In some cases the code is explicitly placed within the text, and at other times within the text we merely alert you that the software is available on this CD. As you read through Chapter 8, you will find that the following function/classes were discussed.

  • Section 8.1.3: void EF_CentralDifference(int N, double CFL, double *uold, double *unew) function definition
  • Section 8.1.3: void EF_FirstOrderUpwind(int N, double CFL, double *uold, double *unew) function definition
  • Section 8.1.3: void LaxFriedrichs(int N, double CFL, double *uold, double *unew) function definition
  • Section 8.1.3: void LaxFriedrichsTadmor(int N, double CFL, double *uold, double *unew) function definition
  • Section 8.1.3: void LaxFriedrichsTadmor(int N, double CFL, double *uold, double *unew, double alpha) function definition
  • Section 8.1.4: void EF_SecondOrderUpwind(int N, double CFL, double *uold, double *unew) function definition
  • Section 8.1.4: void LaxWendroff(int N, double CFL, double *uold, double *unew) function definition
  • Section 8.1.4: void CrankNicolson_CentralDifference(int N, double CFL, double *uold, double *unew) function definition
  • Section 8.1.5: void AB2_CentralDifferenceNP(int N, double CFL, double **uold, double *unew) function definition
  • Section 8.2.2: void CrankNicolson_CentralDifference_AdvectionDiffusion(int N, double CFL, double DN, double *uold, double *unew) function definition

The declarations and definitions of these functions/classes can be found in the following files:

Go to the file SCchapter8.h for function/class declarations
Go to the file SCchapter8.cpp for function/class definitions

In 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 8.1.3: Program demonstrating the use of the Euler-Forward First-Order Upwind scheme

chapter8c0.cpp

Section 8.1.3: Program demonstrating the use of the Lax-Friedrichs scheme and Tadmor's Correction

chapter8c1.cpp

Section 8.1.: Program demonstrating the use of the Third-Order Adams-Bashforth/Central Difference scheme

chapter8c2.cpp

Section 8.2: Program demonstrating the use of the Crank-Nicolson/Central Difference for the advection-diffusion equation

chapter8c3.cpp