GalacticDynamics-Oxford / Agama

Action-based galaxy modeling framework
Other
76 stars 38 forks source link

Allow setting value of G #16

Closed adrn closed 3 years ago

adrn commented 3 years ago

In the theme of #15, to use Gala and Agama side-by-side with units, it would be useful to be able to set the value of the gravitational constant. It looks like the default value in Agama is based on an older value of the constant -- the latest (2018) CODATA value from NIST (in CGS units) is: 6.6743 x 10^-8 (ref: https://physics.nist.gov/cgi-bin/cuu/Value?bg|search_for=g)

eugvas commented 3 years ago

hmm, the currently use value differs by <0.01%, are you really aiming at this level of accuracy?! :) I will update the hardcoded value, but don't think it would make sense to let the user change it manually.. (Meanwhile, in the Python interface, the variable agama.G stores the value of gravitational constant in the currently selected dimensional units. Since there is no concept of a read-only variable (i.e. constant) in Python, the malicious user may actually change this value, but this will have no effect on the unit conversion performed inside the library - it is only provided for the user convenience).

adrn commented 3 years ago

hmm, the currently use value differs by <0.01%, are you really aiming at this level of accuracy?!

I was comparing output from Agama potentials with potential classes in Gala and Galpy, so I noticed it then! But I agree in most real-world cases it won't matter... Still, it probably makes sense to adopt the latest value either way. Thanks for the response!

eugvas commented 3 years ago

the latest commit has a new value for G and other astrophysical constants (Msun, parsec), hopefully they better agree with astropy.

adrn commented 3 years ago

Thanks!