| 60 | = Boundary Conditions = |
| 61 | |
| 62 | To test my code with the Jeans instability test, I used periodic boundary conditions on the box and the poisson solver. For periodic BCs on the elliptic solver, this required subtracting off the mean density from the vector for rho, and using this as the source function. |
| 63 | |
| 64 | = Code Outline = |
| 65 | |
| 66 | 1. Sets up problem scales |
| 67 | 2. Initializes the grid with the prescribed perturbations for Jeans instability |
| 68 | 2. Sets boundary conditions on box |
| 69 | 3. Finds max speed and uses CFL condition to get dt |
| 70 | 4. Takes a hydro step; i.e. solves the local Riemann problem, gets fluxes, updates cells |
| 71 | 5. Takes a source step, finds the mean of the density distribution, sets up the source term vector f=4 Pi G (rho-rhoavg), sends to the Jacobi solver, finds the solution for the gravitational potential phi, using phi, updates the velocity and energy of the cells |
| 72 | 6. Updates time and checks whether tfinal has been reached |
| 73 | 7. Sets boundary conditions on box |
| 74 | 8. Gets dt |
| 75 | 9. ... |
| 76 | |