-
Notifications
You must be signed in to change notification settings - Fork 126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix general asymmetry of x1f, dx1v Coordinates terms; ensure exact float64 symmetry of PPM stencils #98
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
felker
requested review from
c-white,
changgoo,
jmstone and
tomidakn
as code owners
April 13, 2018 16:44
felker
added
bug
Broken functionality or unexpected result
enhancement
Improve an existing Athena++ component
SMR/AMR
Relating to static and adaptive mesh refinement
labels
Apr 13, 2018
jmstone
approved these changes
Apr 13, 2018
After discussion with @jmstone , I repeated the |
This was referenced Apr 21, 2018
1 task
5 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
bug
Broken functionality or unexpected result
enhancement
Improve an existing Athena++ component
SMR/AMR
Relating to static and adaptive mesh refinement
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
@zhuzh1983 first reported that PPM was breaking symmetry in the Rayleigh-Taylor test in November 2017. In December 2017, I discovered that PLM also broke symmetry due to asymmetric round-off error in the Coordinates class, but the resulting differences were very small. A non-general fix to
Coordinates()
was designed and fixed PLM, but the PPM solution was still asymmetric.The issue persisted after redesigning the Reconstruction functions in Feb-Mar 2018. A general fix to
Coordinates()
for uniform, Cartesian meshes was designed, and the PPM-specific issue was diagnosed last week. Detailed report forthcoming.Changes to
x1
calculations, for example, include:x1f
inCoordinates()
class constructor to call a new inlined functionUniformMeshGeneratorX1()
inmesh.hpp
. This parameterizes the real cell faces in the calling MeshBlock by [-0.5, 0.5] instead of the [0,1] used by theDefaultMeshGeneratorX1()
function. It was designed to preserve exact floating point symmetry ofx1f
ifx1min=-x1max
and work fornx1
even (central face atx1f=0
) or odd (central cell hasx1v=0
).dx1v=dx1f=
constant for all cells incartesian.cpp
whenx1rat=1.0
.always added/subtracted the lower indexed quantities first, and hence this operation's round-off error dominated the final round-off error. I replaced such lines with:
Explicit comments (signed "KGF") were added to those changes, since they will be hard to maintain. The stencil biasing was never was in issue in PLM, since those stencils are only 2 cells wide.
This also replaced all
long int
andlong long int
usages in the code with more portable precise-widthint64_t
64-bit integers. See #95.Testing and validation
Tested on Rayleigh-Taylor problem, uniform Cartesian mesh of 100x200 cells and one MeshBlock. I created an explicit, double-precision unit in the last place (ULP) comparison routine based on the 32-bit analysis from https://randomascii.wordpress.com/2012/01/11/tricks-with-the-floating-point-format/. I added symmetry traps in:
calculate_fluxes.cpp
: checkwl, wr
statesadd_flux_divergence.cpp
: checku_out
before and after updatert-ppm-fixed-diffs.pdf shows the fixed solution in this test.
To-do
coarse_flag
check is not needed for current use ofUniformMeshGeneratorX1()
, and the continued use ofDefaultMeshGeneratorX1()
inmesh.cpp
is compatible. @tomidaknDEBUG_SYMMETRY
mode.