[BUG] RAMSES: temperature units are incorrect
PR Summary
For RAMSES, temperatures are returned in T/µ, so it should not be included in the definition of the temperature unit.
To be clear, this does not affect the values of the temperature fields read from disk. However, should one read from disk a field akin to a temperature and assume it is expressed in code_temperature, there will be a factor 0.76 off.
PR Checklist
- [x] Adds a test for any bugs fixed. Adds tests for new features.
I'm not sure how to test this, but the introduction of the factor 0.76 comes from some comment by Sam Geen on Bitbucket 11 years ago, and has been implemented by Nathan back then. I couldn't find a trace of the comments, tho, so I'm not sure what this pertained to.
Overall, this correctly ensures that
import yt
import unyt as u
ds = yt.load_sample("output_00080")
print(ds.quan(100, "code_temperature").to("K") / (ds.quan(100, "(code_length/code_time)**2") / u.kb * u.mp).to("K"))
# 1.000664892048028 dimensionless
The reason why the difference isn't exactly 1 is due to RAMSES frontends using the proton mass from physical_constants, which is different from u.mp (see #5180).
Looks to me that we should include this bugfix alongside some fix for https://github.com/yt-project/yt/issues/5180, but probably shouldn't include just this one in 4.4.1 unless you consider it critical
IMO the fix here is separate enough from #5180 that we should just merge it since it's ready to go (I should have looked through open issues tagged to 4.4.1 before now...). only downside is I might not get to cutting the release by the end of the day since we'll have to wait for tests, but not a big deal at this point.
ya, i'm just gonna merge :)