-
Notifications
You must be signed in to change notification settings - Fork 75
Support new rescale mass runtime parameter option #496
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
Draft
BaronYou
wants to merge
13
commits into
gamer-project:main
Choose a base branch
from
BaronYou:Rescale_mass
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or 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
…ameter.cpp Main.cpp
…ding restarting the simulation
…r space convention fix and update FormatVersion in Output_DumpData_Total_HDF5
Member
Contributor
|
@BaronYou Just a reminder. Please check the suggestion above. |
Contributor
|
@BaronYou Is PR ready for review? If so, please click the |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This PR adds new runtime parameters
ELBDM_RESCALE_MASS_ERROR, which enablesGAMERto rescale total mass to its initial total mass every certain number of steps.Purpose
In base level only simulation, the algorithm ensures total mass conservation. Which means the total mass error only comes from numerical error. Every step accumulates an error of$\sim10^{-7}$ relative to its initial mass. If a simulation is required to run $\sim10^6$ steps, this error will have a significant influence on the result. Run the simulation with double precision is an easy way to resolve this problem, as it accumulates a much smaller error of $\sim10^{-13}$ each step. However, this will cause the run to be very expensive. Therefore, we try to fix the mass error caused by numerical error in single precision run, which allow us to keep both efficiency and accuracy.
New
In
Input_Parameter, addedELBDM_RESCALE_MASS_ERRORandELBDM_RESCALE_MASS_STEPSTurn this feature on by setting
ELBDM_RESCALE_MASS_ERROR == 1and specify how many steps you want to rescale total mass to its initial value, by setting
ELBDM_RESCALE_MASS_STEPS == 100In default,
GAMERwill rescale total mass every 100 steps ifELBDM_RESCALE_MASS_ERRORis turned on.Effect
As shown in the figure below, compare the rescale method with single and double precision run, resolves the problem described in above.

Method