next up previous
Next: Sequential program Up: Short example application programs Previous: Archetype file mesh_uparms.h

1D heat equation

In this example, the goal is to solve the 1D heat diffusion equation:

displaymath687

using the approximation:

displaymath688

A sequential program for this computation is straightforward. It maintains two copies of variable U, one for the current time step (uk) and one for the next time step (ukp1). At each time step, it computes the values of ukp1 based on the values of uk. Observe that the two boundary points are handled differently -- they maintain a constant value.

An equivalent parallel program using the mesh archetype is not much more complicated:

Observe that the code executed by the host and grid processes has the same high-level structure -- both execute the time-step loop, for example. This ensures that proper synchronization is maintained.




next up previous
Next: Sequential program Up: Short example application programs Previous: Archetype file mesh_uparms.h

Berna L Massingill
Mon Jun 8 19:35:58 PDT 1998