wiki:CodeExplanation/SourceTerms

Version 3 (modified by Jonathan, 13 years ago) ( diff )

Source terms in AstroBEAR. All source terms are currently handled in a strang split way. That is - each hydro advance step is bracketed by two source steps of a half time step. Out of curiosity I browsed the athena source code to see how their CTU implementation handles source terms (since I couldn't find it in their CTU paper)

1D CTU

  • Reconstruct left and right states (wr,wl)
  • Add gradphi to normal velocity components at interface states
  • wr(i)+=phi(i)-phi(i-1)
  • wl(i)+=phi(i)-phi(i-1)
  • Add other source terms using the reconstructed left and right states wl+=s(wl)
  • wr+=s(wr)
  • get fluxes
  • calculate cell centered time centered values of density, momentum, and energy using original values and fluxes
  • Update time centered momentum with gravo-source terms using original density and phi (no energy source term) pdV work done in fluxes??? - not sure what is going on here??? and calculate the time centered cell centered pressure
  • 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
  • For self gravity do something slightly more complicated……

which is just where which requires . Since we can substitute for and we have which reduces to where we can identify the equivalent momentum flux as

  • But casting it this way gives you strict momentum conservation. If the source term were just then momentum would be conserved but since in each cell there is a factor of that currently enters, it modifies the differenced quantity from cell to cell. In theory these all cancel but only because … 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.
  • Also athena stores combined kinetic/thermal/magnetic with gravitational… So . This results in so the energy source term for self gravity can be written as a total divergence. We need at cell edges, but is available from the mass flux and can be averaged using adjacent cells.
  • Add cooling terms using time centered density and pressure
  • Add fluxes and store fluxes at edges as well as mass flux everywhere
  • After calculating new modify momentum and energy by effectively using time centered . This allows for second order without storing .

I'm still puzzled about the time centered cell centered pressure being calculated without subtracting off the gravitational energy - and if is subtracted off earlier - then why no potential heating? Seems like this would underestimate the cooling strength… Possible bug?



Note: See TracWiki for help on using the wiki.