grid::CorrectForRefinedFluxes when density, total energy, or internal energy are <= 0.

2 views
Skip to first unread message

James Larrue

unread,
Mar 13, 2015, 4:21:26 PM3/13/15
to enzo...@googlegroups.com
I just made a pull request that addresses issues I had with negative total energy in grid::CorrectForRefinedFluxes (enzo-dev).  David Collins said this issue has come up before and maybe Cameron, Nathan, or Brian would have some thoughts on it.

The PR is probably the easiest place to discuss it, so this note is just to draw the attention of interested people to the PR:

https://bitbucket.org/enzo/enzo-dev/pull-request/266/results-no-longer-dependent-on-order-of/diff

James


== Description from the PR ==

I was investigating a simulation that ended up with negative total energy in grid::CorrectForRefinedFluxes. (The fact that it had negative total energy is an issue unrelated to this pull request.) I found that the results I received were dependent on the ordering of the fields in the BaryonField[] array. I believe the results should be independent of the order in which the fields are stored.

What happened was that the negative total energy was recognized as "bad", so the correction to total energy was undone and all further corrections were set to zero. However, there was nothing done to corrections on previous fields. Therefore, any field that was stored before total energy in BaryonField[] would keep its correction, while total energy and any field after total energy would have no correction. Changing the position of a field from before total energy to after total energy in BaryonField[] (or the reverse) would change the results.

A second issue I had in my case was that the velocity correction was much larger than the pre-correction velocity. When a large number was subtracted from a small number, then added back again, the result was not equal to the original small number: v_tiny - v_huge + v_huge != v_tiny.

The current PR addresses the first issue by undoing the current correction and all previous corrections, in addition to setting all future corrections to zero (for the offending cell only). The second issue is addressed by processing density, total energy, and internal energy before the other fields, thereby reducing the number of fields that would be affected by an "undo". This does not provide a perfect fix for issue #2, but it seemed better than nothing.

dcollins4096 mentioned this issue has come up before, so perhaps somebody has ideas on a different solution.

Reply all
Reply to author
Forward
0 new messages