Gowdy solver
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Finite Difference Approximation

At the core of finite difference approximation is a discretization of the spacetime, or a numerical grid (shown below). Then, a function f(t,r) is represented by values at a discrete set of points (m,n).

                p in M          <-->     (t,r)      <-->        (m,n)
         (point in a manifold)        (in a chart)        (discretized point)
                                           |                      |
                                           V                      V
                                         f(t,r)                 f(m,n)    

The points (m,n) are called the grid points or nodes. The grid points are chosen to reside at the center of grid cells (the other approach would be to associate the grid points with the vertices of the grid cells). 

The data structure GridPoint contains the set of fields {f,...} that are kept in the memory for the point (m,n). The numerical grid is an array of grid points grid[m][n] where a field f is directly accessible as grid[m][n].f, or using a macro as f(m,n)

The grid consists of the interior points, and the virtual points at the boundary. The virtual points are used to impose the boundary conditions. 

A cell-centered uniform grid with nLen grid points in each grid row is shown below (see also [1], p.192).

         left virtual                grid cell        grid point     right virtual
            point(s)                 .---^---.            |             point(s)
      .        |               n-1  '    n    '  n+1      |                |
      :   +----|----+-------+-------+---------+-------+---|---+-------+----|----+
     m+1  |    O    |       |       | (m+1,n) |       |   X   |       |    O    |
          +---------+-------+-------.=========.-------+-------+-------+---------+
      m   |         |       |(m,n-1)|  (m,n)  |(m,n+1)|       |       |         |
          +---------+-------+-------'========='-------+-------+-------+---------+
     m-1  |         |       |       |         |       |       |       |         |
      .   +---------'-------+-------+---------+-------+-------+-------'---------+
      :        0    |   1       2      . . .                    nLen  |  nLen+1
                    ^                                                 ^
                   r_min                                            r_max       

The cell-centered uniform grid implies:

     r = r_min + ( n - 1/2 ) delta_r
     delta_r = ( r_max - r_min ) / nLen
  • if nGhost = 1, n ranges between 1 and nLen; the boundary virtual points are grid[m][0] and grid[m][nLen+1]
  • m ranges between 1 and mLen, and wraps around; the slices grid[mLen+1]... are used for intermediate integration steps.

In parallel simulations, the grid is split across processes using MPI, allowing storage of large grid functions and parallel work on each part.