Chapter 5: Tutorial

If DAGH is not already installed on your system refer to the appendix on how to obtain, install and compile DAGH. The source code and other associated files that will be used for the tutorials are all in the sub-directory /examples/Tutorials .


The Transport Equation

In our tutorial we will be studying the evolution of a simple 2-dimensional transport equation of the form
u,t + u,x + u,y = 0
where u represents some physical quantity and u,t represents the partial derivative of u with respect to t, and so on. The computational domain is a rectangle. The initial values of u are chosen from a gaussian distributed according to the initial parametrs chosen by the user. We will be using MacCormack scheme which is essentially a predictor-corrector method to study the evolution.


Code Structure in Pseudo-code

The MacCormack integration of the transport equation is presented in pseudo code. The driver replaces the main program and calls each of the subroutines at the appropriate places. The Fortran 90 code that implements the MacCormack integration scheme (sans the main program) is in the file transport.f. The boundaries are updated by calling a built-in DAGH function BoundaryUpdate rather than by using a Fortran subroutine to do the same. The reader should now examine the file transport.f to identify the corresponding subroutines in the pseudo code.


Main Program

End Main Program



Subroutine initial

End subroutine initial



Subroutine evolve

End subroutine evolve



Subroutine boundaries

End subroutine boundaries


All the subroutines except the subroutine boundaries are in the file transport.f and will be used in the example that follows. We will be using the transport equation to illustrate how to set up the driver for DAGH and run the program in three different situations. In the simplest case we will use just one grid and run our program on a single processor. We will then run the single grid on several processors. Finally we will implement the adaptive mesh refinement technique and run our program on multiple processors.


Next section: Unigrid Sequential Code

Return to: Table of Contents