Changes between Version 23 and Version 24 of u/erica/CylindricalGravity


Ignore:
Timestamp:
01/13/15 17:32:09 (10 years ago)
Author:
Erica Kaminski
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • u/erica/CylindricalGravity

    v23 v24  
    104104
    105105The 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
     107The 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
     111What 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
     113Dx for the patch is easy, that is just,
     114
     115''' levels(Info%level)% dx'''
     116
     117To 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
     121For a page describing patch specific quantities, refer here.
     122
     123Now 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
     129This 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
     131Another way to do this would have been to use the lower x position of the patch itself, say:
     132