Closed V-Nathir closed 4 months ago
Hi, and welcome to yt! Thanks for opening your first issue. We have an issue template that helps us to gather relevant information to help diagnosing and fixing the issue.
@V-Nathir are the incorrect values always the same?
I did a quick check and I would say yes. The incorrect values are always the same.
Thank you, that's very helpful to know. If they are always the same, it's deterministic; if they are not bitwise identical, it might be coming from uninitialized memory.
Hi all, the bug is solved. I did the proper cheeks and looks good again. The solution provided by @cphyc in #4907 seems to work. Thanks a lot!!
With RAMSES datasets, the outcome of some fields depend on previous fields having been accessed or not.
For example, the following script yields two different results depending on whether the line querying
sp["gas", "metallicity"]
is commented out or not.Code for reproduction
Results
Expected outcome
The two cases should yield the same results.
Extra information
In fields.py script we can find the function
def create_cooling_fields(self) -> bool:
that has this line for computing "cooling_metal"cool = ( cool * data["gas", "metallicity"] / 0.02 ) # Ramses uses Zsolar=0.02
If the values of metallicity are checked (if they are >1 ) there are two possibilities: 1) you call in your codedata["gas", "metallicity"]
first and thendata["gas", "cooling_metal"]
, the result is ok. 2) you call directlydata["gas", "cooling_metal"]
the result is wrong; metallicities are >1.I think the FieldDetector saves values into metallicity and those values do not overwrite with the correct ones. I do not know if more fields have the same issue.
Cheers!