| 61 | which becomes, |
| 62 | |
| 63 | [[latex($\frac{\rho_i^{n+1}(u_i^{n+1} - u_i^{n+1/2})}{dt} = -\frac{\rho_i^{n+1/2}(\phi_{i+1}^{n+1/2}- \phi_i^{n+1/2})}{dx}$)]] |
| 64 | |
| 65 | since |
| 66 | |
| 67 | [[latex($\rho_i^{n+1} = \rho_i^{n+1/2}$)]] |
| 68 | |
| 69 | we can just cancel the rho's and solve for the updated u, |
| 70 | |
| 71 | [[latex($u_i^{n+1}=-\frac{dt}{dx}[\phi_{i+1}^{n+1/2}-\phi_i^{n+1/2} ] + u_i^{n+1/2}$)]] |
| 72 | |
| 73 | This requires a dt (which is the same for the hydro step, solved using the CFL condition), and a gravitational potential phi. Phi is solved using the Jacobi solver, with the source function given by |
| 74 | |
| 75 | [[latex($f(i)=4 \pi G (\rho_i^{n+1/2} - \bar{\rho})$)]] |
| 76 | |
| 77 | and boundary conditions |
| 78 | |
| 79 | [[latex($\phi(0) = \phi(mx), ~\phi(mx+1) = \phi(1)$)]] |
| 80 | |
| 81 | To solve the 2nd source term ODE, |