| 106 | |
| 107 | The main body of the routine loops through all of the cells in the mesh, starting with each z, y, and then x. Since we are only concerned with modifying the 2D geometry for cylindrical, we really are looping through y first and then x. This means that for each y value (can think of it as a 'row' in the 2D mesh), we loop through each cell in x on that row, and calculate any modifications to the stencil that need to happen. After these mods are made, the 5 (in this special case) stencil values are fed into the 5 matrix values slots for that particular cell of the grid. And the loops continues. These values are then sent off to Hypre for solution. |
| 108 | |
| 109 | ==== 2.5D Mod ==== |
| 110 | |
| 111 | What we then need to add is a modification in these loops for cylindrical. This modification is going to need both the dx of the patch, and the x position of the cell (also patch dependent). Instead of calculating for each iteration of the loop, we can try and save some computation time and put the calculation of x and dx before the loop. |
| 112 | |
| 113 | Dx for the patch is easy, that is just, |
| 114 | |
| 115 | ''' levels(Info%level)% dx''' |
| 116 | |
| 117 | To get all of the x_i's of the cells in the patch we can allocate an array 'x_i' that has length = number of cells along x axis of patch, |
| 118 | |
| 119 | '''Allocate x(Info%mGlobal(1,1): Info%mGlobal(1,2))''' |
| 120 | |
| 121 | For a page describing patch specific quantities, refer here. |
| 122 | |
| 123 | Now to populate this array, we loop through: |
| 124 | |
| 125 | '''Do i = Info%mGlobal(1,1), Info%mGlobal(1,2)[[br]] |
| 126 | '''x(i) = gXbounds(1,1) + (i - half)*dx[[br]]''' |
| 127 | '''End Do''' |
| 128 | |
| 129 | This starts at the lower left hand corner of the mesh (gXbounds(1,1)) and marches over i*dx_patch times (subtracting off the .5dx to get to the cell center). |
| 130 | |
| 131 | Another way to do this would have been to use the lower x position of the patch itself, say: |
| 132 | |