Changes between Version 24 and Version 25 of u/erica/CylindricalGravity
- Timestamp:
- 01/13/15 17:44:15 (10 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
u/erica/CylindricalGravity
v24 v25 109 109 ==== 2.5D Mod ==== 110 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 timeand put the calculation of x and dx before the loop.111 What we then need to add is a modification in these loops for cylindrical. As stated above, this modification is going to need both the dx of the patch, and the x position of the cell (also patch dependent - because x(dx)). Instead of calculating for each iteration of the loop, we can try and save some computational power and put the calculation of x and dx before the loop. 112 112 113 113 Dx for the patch is easy, that is just, 114 114 115 ''' levels(Info%level)% dx''' 115 dx = levels(Info%level)% dx 116 116 117 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 118 119 '''Allocate x(Info%mGlobal(1,1): Info%mGlobal(1,2))''' 119 Allocate x(Info%mGlobal(1,1): Info%mGlobal(1,2)) 120 120 121 For a page describing patch specific quantities, refer here. 121 (For a refresher page describing patch specific quantities, refer here) 122 122 123 123 Now to populate this array, we loop through: 124 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''' 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 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).129 This starts at the ''global'' lower left hand corner of the entire box (gXbounds(1,1)) and marches over i*dx_patch spaces (subtracting off the .5dx to get to the cell center). 130 130 131 131 Another way to do this would have been to use the lower x position of the patch itself, say: 132 132 133 134 Once we have these 2 things calculated, we can then add in the meat and potatoes: 135 136 If (iCylindrical > 0) Then [[br]] 137 tempStencilValues(1) = 1-dx/2x(i) [[br]] 138 tempStencilValues(2) = 1+dx/2x(i) [[br]] 139 End If [[br]] 140 141 Then set the matrixvalues for the stencil of the ith cell = tempStencilValues