
This package of Fortran 90 subroutines is designed to provide an application developer with an easy route to extend an existing serial code which uses a logically cartesian structured mesh into a parallel code with adaptive mesh refinement(AMR).
Alternatively, in its simplest use, and with minimal effort, it can operate as a domain decomposition tool for users who want to parallelize their serial codes, but who do not wish to use adaptivity.
The package builds a hierarchy of sub-grids to cover the computational domain, with spatial resolution varying to satisfy the demands of the application. These sub-grid blocks form the nodes of a tree data-structure (quad-tree in 2D or oct-tree in 3D). Each grid block has a logically cartesian mesh, and the index ranges are the same for every block. Thus, in 2D, if we begin with a 10x20 grid on one block covering the entire domain, the first refinement step would produce 4 child blocks, each with its own 10x20 mesh, but now with mesh spacing one-half that of its parent. Any or all of these children can themselves be refined, in the same manner. This process continues, until the domain is covered with a quilt-like pattern of blocks with the desired spatial resolution everywhere.
The package supports 1, 2 and 3D models.
A simple example is shown in the figure below in which a 6 x 4 grid is created on each block. The numbers assigned to each block designate the blocks location in the quad-tree below. The colors assigned to the nodes of the tree indicate one possible distribution of the blocks during a 4 processor calculation.

There are a some restrictions placed on the refinement process, which are described in detail in the Users Guide below. For example during the refinement process, the refinement level is not allowed to jump by more than 1 refinement level at any location in the spatial domain.
The package manages the creation of the grid blocks, builds and maintains the tree-structure which tracks the spatial relationships between blocks, distributes the blocks amongst the available processors and handles all inter-block and inter-processor communication. It can distribute the blocks in ways which maximize block locality and so minimize inter-processor communications.
The task facing the application developer is quite straightforward.
Templates and worked examples are provided in the software distribution for all of these tasks. The Fortran 90 pointers mechanism can be used to connect the amr package's data structures with those of the users application so that they do not need to edit the variable names in their code segments.
The design philosophy while developing this package has been to present the user with a clean well commented Fortran 90 source code, sufficiently simple in structure that the user would not be afraid to customize routines for their own particular use. We also strove for efficiency on cache-based multiprocessors.