Changes between Version 26 and Version 27 of u/erica/CylindricalGravity
- Timestamp:
- 01/15/15 12:22:32 (10 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
u/erica/CylindricalGravity
v26 v27 113 113 Dx for the patch is easy, that is just, 114 114 115 dx = levels(Info%level)% dx 115 [[latex($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 [[latex($Allocate ~x(Info\%mGlobal(1,1): Info\%mGlobal(1,2))$)]] 120 120 121 121 (For a refresher page describing patch specific quantities, refer here) … … 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 [[latex($Do ~i = Info\%mGlobal(1,1), Info\%mGlobal(1,2)$)]] 126 [[latex($~x(i) = GxBounds(1,1) + (i - half)*dx$)]] 127 [[latex($End ~Do$)]] 128 128 129 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). … … 134 134 Once we have these 2 things calculated, we can then add in the meat and potatoes: 135 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]]136 [[latex($If ~(iCylindrical > 0)~Then$)]] 137 [[latex($~tempStencilValues(1) = 1-dx/2x(i)$)]] [[br]] 138 [[latex($tempStencilValues(2) = 1+dx/2x(i)$)]] 139 [[latex($End~ If$)]][[br]] 140 140 141 141 Then set the matrixvalues for the stencil of the ith cell, by doing 142 142 143 matrixvalues(m:m+4) = tempStencilValues(1:5) 143 [[latex($matrixvalues(m:m+4) = tempStencilValues(1:5)$)]] 144 144 145 145 where m increases by 5 for each cell in the mesh. For example, 146 146 147 matrixvalues(:)=(-4,1,1,1,1, -4, 1, 1, 1, 1, -4, 1, 1, 1, 1, ...., -4, 1, 1, 1, 1) 147 [[latex($matrixvalues(:)=(-4,1,1,1,1, -4, 1, 1, 1, 1, -4, 1, 1, 1, 1, ...., -4, 1, 1, 1, 1)$)]] 148 148 149 149 for regular 2D Cartesian geometry.