# Multi-resolution Meshes

## Creating a Multi-resolution Mesh

```
The multi-resolution meshes, if implemented, should match the requirements specified in Nie et al. 2017: https://pubs.geoscienceworld.org/ssa/bssa/article/107/5/2183/506706/Fourth-Order-Staggered-Grid-Finite-Difference

Specifically, I would expect the input parameters to include:

N_layer : the number of discretization, 1 for uniform (ordinary) mesh, 2 for two-layer meshes, and so on.

ratio :  the factor of ratio of grid spacing between the coarser and finer meshes. Typically, we use three, but technically AWP supports other odd numbers, e.g. 5 or 7. A larger factor will increase the difficulty in constructing the meshes (e.g. divisibility), so it’s rarely used. I will stick with factor of three below.

NX, NY :  the same as ordinary configuration, for the top finest layer (that means the second layer should be of size (NX / 3, NY / 3), and the third layer is (NX / 9, NY / 9) and so on. So the program may need check the input parameter to make sure it’s divisible by 3 (for two-layer meshes) or 9 (for three-layer meshes), or round the number to closest multiple of 3 (9). Also, note the the x-direction upsampling is different from that in y direction.

X direction (at indices 1, 4, 7):

*  *  *  *  *  *  *  *  *           Fine grid
^        ^         ^                 Coarse grid

Y direction (at indices 2, 5, 8):
*  *  *  *  *  *  *  *  *           Fine grid
\$        \$         \$             Coarse grid

NZ : this should be an array of length N_layer, specifying the number of grids in vertical direction for each layer. There is a very tricky thing in determining the intersection location, cause AWP implemented DM by including a 7-point overlapping zone. Let me explain this using an example:

Let NZ = (108, 400, 800), if using the ordinary uniform index to describe the locations of the starting and ending position:
Index (1-based)
The first layer should be :             1 - 108
The second layer is :                 101 - 1298
The third layer is :                     1277 - 8476

We used to encounter some memory problems with UCVM if the mesh to be queries is too large, yet with DM-style query, this problem can be solved. I would suggest generating separate files for each discretization.

Zhifeng Hu also prepared a small Python script to check the correctness of mesh construction, which may be helpful for your development.

```