Changes between Version 4 and Version 5 of CodeExplanation/SourceTerms
- Timestamp:
- 01/09/12 14:58:45 (13 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
CodeExplanation/SourceTerms
v4 v5 15 15 * For a static potential update the momentum using the time centered density and the energy using the mass fluxes times grad phi at the cell edges 16 16 * For self gravity do something slightly more complicated...... 17 [[latex($\Delta p=-\frac{\Delta t}{\Delta x} \left(F_{i+1/2}-F_{i-1/2} \right )$)]] which is just [[latex($\dot{p} = f_{grav}$)]] where [[latex($f_{grav}= \nabla F$)]] which requires [[latex($\nabla F=\rho \nabla \phi$)]]. Since [[latex($\nabla^2 \phi = 4\pi G (\rho-\bar{\rho})$)]] we can substitute for [[latex($\rho$)]] and we have [[latex($\nabla F = (\frac{\nabla^2\phi}{4 \pi G}+\bar{\rho}) \nabla \phi$)]] which reduces to [[latex($\nabla F=\nabla \left [ \frac{1}{2} \frac{\left (\nabla \phi\right )^2}{4 \pi G} +\bar{\rho} \phi \right ]$)]] where we can identify the equivalent momentum flux as [[latex($F=\frac{1}{2} \frac{\left (\nabla \phi\right )^2}{4 \pi G} + \bar{\rho} \phi$)]]17 [[latex($\Delta p=-\frac{\Delta t}{\Delta x} \left(F_{i+1/2}-F_{i-1/2} \right )$)]] which is just [[latex($\dot{p} = f_{grav}$)]] where [[latex($f_{grav}=-\nabla F$)]] which requires [[latex($\nabla F=\rho \nabla \phi$)]]. Since [[latex($\nabla^2 \phi = 4\pi G (\rho-\bar{\rho})$)]] we can substitute for [[latex($\rho$)]] and we have [[latex($\nabla F = (\frac{\nabla^2\phi}{4 \pi G}+\bar{\rho}) \nabla \phi$)]] which reduces to [[latex($\nabla F=\nabla\left [\frac{1}{2} \frac{\left (\nabla \phi\right )^2}{4 \pi G} \bar{\rho} \phi \right ]$)]] where we can identify the equivalent momentum flux as [[latex($F=\frac{1}{2} \frac{\left (\nabla \phi\right )^2}{4 \pi G} + \bar{\rho} \phi$)]] 18 18 * But casting it this way gives you strict momentum conservation. If the source term were just [[latex($\nabla \phi$)]] then momentum would be conserved but since in each cell there is a factor of [[latex($\rho$)]] that currently enters, it modifies the differenced quantity from cell to cell. In theory these all cancel but only because [[latex($\nabla^2\phi=\rho$)]]... In the above treatment - the density used in the source term is derived from the actual potential which allows the source term to be cast as a flux difference. This allows for the strict momentum conservation. 19 19