You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
importytimportnumpyasnpds=yt.load(PATH_TO_OUTPUT) # may need adaptingcenter=ds.arr([0.48722672, 0.50215806, 0.50503517], "code_length")
sp=ds.sphere(center, (100, "kpc"))
# sp["gas", "metallicity"] # commenting this line generates another result. cooling=sp["gas", "cooling_metal"]
print(cooling.min(), cooling.max(), np.isnan(cooling).sum())
Results
# When sp["gas", "metallicity"] is commented out
2.0029169125304782e-101 cm**3*erg/s 8.56002136482532e-22 cm**3*erg/s 0
# When it is not
1.3095962168963732e-105 cm**3*erg/s 6.197260629648163e-20 cm**3*erg/s 0
Expected outcome
The two cases should yield the same results.
Extra information
yt version: development version
Python version: 3.12
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 code data["gas", "metallicity"] first and then data["gas", "cooling_metal"], the result is ok. 2) you call directly data["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!
The text was updated successfully, but these errors were encountered:
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.
cphyc
changed the title
BUG REPORT - Problem loading fields, erroneous data - main version
BUG: some RAMSES fields return different values depending on order of operations
Apr 18, 2024
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.
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!
The text was updated successfully, but these errors were encountered: