Working on implementing conservative momentum conservation in 1D with self gravity
Need to:
Remove self gravity source term from source moduleAdd self gravity source terms to reconstructed left and right statesmodify final fluxes to include self gravity source terms.
Here's a plot showing momentum conservation with the new approach
However there were striations
These were due to the approximation it uses to calculate the density… Turns out when the errors in phi are large compared to the density this can cause these striations.
Here's a plot showing the relative error in the derived rho used in the source calculation and the actual rho.
Reducing hypres error tolerance from 1e-4 to 1e-8 improved the situation and lessend the striations
Finally here's a comparison of the old and new methods
Modify gravitational energy source terms.These modified fluxes will need to be stored in the fixup fluxes so they can be properly differenced between levels to ensure strict momentum conservation.this will require a second call to store fixup fluxes. Perhaps a generic routine in data declarations would be better for storing fixup fluxes, and emfs, etc…
extend same modifications to 2D and 3D by adding additional source terms in transverse flux update.
What to do about phi
- To be second order we need the gas potential before and after a hydro step.
- Normally the gas potential after a hydro step would be the same as that before the next hydro step (requiring 1 poisson solve per hydro step) however with accretion, the gas in each cell (and the corresponding gas potential) can change.
- Accretion, however, should not change the total potential (except for differences in softening) - so recalculating the particle potential should allow for modifying the gas potential without another poisson solve.
So a fixed grid algorithm would look like the following:
- Do a hydro step using original gas potential and predicted time centered particle potential.
- calculate new gas potential (poisson solve) and ghost
- momentum and energy flux correction
- Advance particles using back force from gas
- Calculate new sink potential
- Store new total potential
- Perform accretion
- Update new sink potential using new particle masses and difference gas potential keeping total potential fixed
- Repeat
For AMR we need a way to update the gas potential on level l at coarse grid boundaries independent of a level l poisson solve. This can be done using phi and phidot. Then whenever we set the gas potential for the poisson solve we use phi, phidot, and phisinks. So the algorithm looks like the following:
Root Level
- Do a hydro step using original gas potential and predicted time centered particle potential.
- Calculate new sink potential using predicted particle positions
- calculate new gas potential (poisson solve) and ghost
- momentum and energy flux correction using phi_Gas and phi_gas_old (stored in phi)
- Update total potential and time deriv using sink potential and gas potential. phi_new=phi_gas+phi_sinks phi_dot=phi_new-phi+old_phi_sinks
- Prolongate old fields and new total potential time deriv
- After finer level steps, particle positions and masses will be different. So update phisinks as well as phigas keeping phi constant.
Intermediate Level
- Do a hydro step using original gas potential and predicted time centered particle potential.
- Calculate new sink potential using predicted particle positions
- Update gas potential at coarse fine boundaries using phi, phidot, and predicted phi sinks
- calculate new gas potential (poisson solve) and ghost
- momentum and energy flux correction
- Update total potential and time deriv using sink potential and gas potential.
- Prolongate old fields and new total potential time deriv
- After finer level steps, particle positions and masses will be different. So update phisinks as well as phigas keeping phi constant.
- Repeat
Finest Level
- Check for new particles (do this after ghosting)
- Perform accretion
- After accretion, particle positions and masses will be different. So update phisinks as well as phigas keeping phi constant.
- Do a hydro step using gas potential and predicted time centered particle forces.
- Advance particles using back force from gas
- Calculate new sink potential using advanced particle positions
Calculate new sink potential using predicted particle positions- Update gas potential at coarse fine boundaries using phi, phidot, and phi sinks
- calculate new gas potential (poisson solve) and ghost
- momentum and energy flux correction
- Update total potential and time deriv using sink potential and gas potential.
After finer level steps, particle positions and masses will be different. So update phisinks as well as phigas keeping phi constant.- Repeat
Of course the calculation of the predicted particle positions on each level (other than the maxlevel) can be as sophisticated as necessary. One could use the original particle positions and velocities alone, or could advance the level's own version of the particles using the same advance algorithm as well as gas forces etc… Note this is necessary if one wants to thread these advances, since the particle masses may change due to accretion in the middle of a coarse level update. But this threading would still require use of the old time derivative to update the ghost zones instead of the forward time derivative.
Attachments (6)
- rho_error.png (51.3 KB) - added by 13 years ago.
- rho_error2.png (51.2 KB) - added by 13 years ago.
- momentumconservation.png (31.4 KB) - added by 13 years ago.
- striations.png (42.2 KB) - added by 13 years ago.
- 1DComparison.gif (2.6 MB) - added by 13 years ago.
- 1DComparison0010.png (60.7 KB) - added by 13 years ago.
Comments
No comments.