Changes between Version 35 and Version 36 of u/erica/CylindricalGravity
- Timestamp:
- 01/15/15 14:06:41 (10 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
u/erica/CylindricalGravity
v35 v36 105 105 The routine begins by allocating an array to hold all of the coefficients for all of the stencil's cells for each of the cells in the patch. This array is aptly called 'matrixvalues' and is mx*my*mz*num_stencil_values long (where mx,y,z are the number of cells in each direction of the patch, and num_stencil_values is self explanatory). 106 106 107 The main body of the routine loops through all of the cells in the patch, 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 thensent off to Hypre for solution.107 The main body of the routine loops through all of the cells in the patch, 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 a 2D matrix), 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 the case of 2D) stencil values are fed into the 5 matrix value slots for that particular cell of the grid. And the loops continues. These values are sent off to Hypre for solution. 108 108 109 109 ==== 2.5D Mod ==== … … 115 115 [[latex($dx = levels(Info\%level)\% dx$)]] 116 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,117 To get all of the x positions 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 118 119 119 [[latex($Allocate ~x(Info\%mGlobal(1,1): Info\%mGlobal(1,2))$)]] … … 132 132 133 133 134 Once we have these 2 things calculated, we can then add in the meat and potatoes:134 Once we have these parameters calculated, we can then add in the fix for 2.5D: 135 135 136 136 [[latex($If ~(iCylindrical > 0)~Then$)]] … … 143 143 [[latex($matrixvalues(m:m+4) = tempStencilValues(1:5)$)]] 144 144 145 where m increases by 5 for each cell in the mesh. For example, 145 Note, for 2/2.5D, m increases by 5 for each cell in the mesh. 146 147 For example, 146 148 147 149 [[latex($matrixvalues(:)=(-4,1,1,1,1, -4, 1, 1, 1, 1, -4, 1, 1, 1, 1, ...., -4, 1, 1, 1, 1)$)]] 148 150 149 for regular 2D Cartesian geometry. 150 151 This means that matrixvalues(1) is the center cell stencil coefficient of the 1st cell in the mesh, matrix(6) is the center cell stencil coefficient of the 2nd cell in the mesh, and so on. 151 for regular 2D Cartesian geometry. This means that matrixvalues(1) is the center cell stencil coefficient of the 1st cell in the mesh, matrix(6) is the center cell stencil coefficient of the 2nd cell in the mesh, and so on. 152 152 153 153