Fortran

Guide To Learn

Going from 1-D to 2-D arrays

Extending the solver from one to two dimensions carries two major implications:

  • We’ll now be working on 2-D arrays instead of 1-D arrays.
  • We’ll be solving for two components of velocity (one for each of x and y axes) and water height, for a total of three equations.

In other words, whereas so far we’ve been solving for a single velocity u(:) and water height h(:), now we’ll be solving for velocities in x and y axes (u(:,:) and v(:,:), respectively), and for water height h(:,:). This is illustrated in figure 8.6.

Figure 8.6 Comparison of data arrays for water height and velocity between the 1-D and 2-D tsunami solvers

Also recall the halo points from the previous chapter, which we used to synchronize the array values along the edges with the neighboring tiles. In the 1-D solver, we were exchanging only one value on each side of the tile. However, in the 2-D solver, each data array has four edges and the same number of neighbors. We’ll defer this part until chapter 10, where we’ll look into it in more detail.

Going from 1-D to 2-D arrays

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top