Hi James/Clare,
The issue here is our sanity check and whether/how we should rescale it. What we care about is the *relative* conservation, but for linear momentum the only relevant value is zero. And zero is still zero in any units.
Perhaps the better thing to do would be to use the linear momentum *per unit mass* as the check?
Of course, the I_WILL_NOT_PUBLISH_CRAP is just a warning, you are welcome to override it as long as you know what you’re doing. What is needed here is to quantify (in the code) how you are deciding (in person) that the conservation level is tolerable. I am also reluctant to describe this exit condition as a “crash”, it is just a warning, albeit a stern one.
Flicking to the users list as I would welcome sensible suggestions here.
Cheers,
Daniel
> On 17 Jun 2019, at 11:24 pm, Wurster, James <
J.Wu...@exeter.ac.uk> wrote:
>
> Hello Daniel
>
> I've been having an interesting discussion with Clare (cc'd) regarding conservation of linear momentum in Phantom. She is running a cluster simulation using setup_cluster, but has increased the mass to 1e6Msun and radius to 10pc. Using the default units, the simulation very rapidly crashes due to non-conservation of linear momentum; increasing the mass and distance unit allows the simulation to run much further. I've attached a plot of the linear momentum in code units.
>
> In both cases, the initial momentum should be zero, and in both cases, the initial numerical value is well below 1e-3. However, the momentum of the new-unit version remains below 0.1 so it can continue to run, whereas the default-unit version immediately jumps above 0.1 and crashes. Using I_WILL_NOT_PUBLISH_CRAP=yes, both units yield nearly identical values of momentum once converted to physical units. Thus, the difference in results (crashing vs running) is dependent completely upon the choice of the code units.
>
> Thus, the first question is Should one obtain different results solely based upon the choice of units? Second, Should these sanity checks be based upon physical rather than code units? My conclusion is that, since non-conservation tends to be a numerical problem, that we should leave it as is (i.e. based upon code units), but add a check upon initialisation to ensure that the selected units are reasonable for a given simulation.
>
> I would appreciate your thoughts on this.
> Thanks
> James
>
>
> --