PISM, A Parallel Ice Sheet Model  stable v2.1.1 committed by Constantine Khrulev on 2024-12-04 13:36:58 -0900

◆ compute_horizontal_coordinates()

void pism::Grid::Impl::compute_horizontal_coordinates ( )

Compute horizontal spacing parameters dx and dy and grid coordinates using Mx, My, Lx, Ly and periodicity.

The grid used in PISM, in particular the PETSc DAs used here, are periodic in x and y. This means that the ghosted values foo[i+1][j], foo[i-1][j], foo[i][j+1], foo[i][j-1] for all 2D Vecs, and similarly in the x and y directions for 3D Vecs, are always available. That is, they are available even if i,j is a point at the edge of the grid. On the other hand, by default, dx is the full width 2 * Lx divided by Mx - 1. This means that we conceive of the computational domain as starting at the i = 0 grid location and ending at the i = Mx - 1 grid location, in particular. This idea is not quite compatible with the periodic nature of the grid.

The upshot is that if one computes in a truly periodic way then the gap between the i = 0 and i = Mx - 1 grid points should also have width dx. Thus we compute dx = 2 * Lx / Mx.

Definition at line 504 of file Grid.cc.

References pism::Grid::cell_area(), pism::grid::CELL_CENTER, pism::compute_coordinates(), pism::compute_horizontal_spacing(), pism::Grid::dx(), pism::Grid::dy(), pism::Grid::Lx(), pism::Grid::Ly(), pism::Grid::Mx(), pism::Grid::My(), pism::Grid::registration(), pism::Grid::x(), pism::Grid::x0(), pism::Grid::y(), and pism::Grid::y0().

Referenced by pism::Grid::Grid().