Support new rescale mass runtime parameter option #496
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