[yt-dev] Issue #1321: Gadget Temperature field assumes zero ionization if ElectronAbundance field is not present. (yt_analysis/yt)

John ZuHone issues-reply at bitbucket.org
Tue Feb 14 15:14:06 PST 2017


New issue 1321: Gadget Temperature field assumes zero ionization if ElectronAbundance field is not present.
https://bitbucket.org/yt_analysis/yt/issues/1321/gadget-temperature-field-assumes-zero

John ZuHone:

In the Gadget frontend, it is assumed that if the `("PartType0", "ElectronAbundance")` field is not present, that the gas is not ionized and therefore this affects the mean molecular weight and conversely the computation of the temperature. Lines 71-89 of `yt/frontends/gadget/fields.py`:

```python
    def setup_gas_particle_fields(self, ptype):
        if (ptype, "ElectronAbundance") in self.ds.field_list:
            def _temperature(field, data):
                # Assume cosmic abundances
                x_H = 0.76
                gamma = 5.0/3.0
                a_e = data[ptype, 'ElectronAbundance']
                mu = 4.0 / (3.0 * x_H + 1.0 + 4.0 * x_H * a_e)
                ret = data[ptype, "InternalEnergy"]*(gamma-1)*mu*mp/kb
                return ret.in_units(self.ds.unit_system["temperature"])
        else:
            def _temperature(field, data):
                # Assume cosmic abundances
                x_H = 0.76
                gamma = 5.0/3.0
                # Assume zero ionization
                mu = 4.0 / (3.0 * x_H + 1.0)
                ret = data[ptype, "InternalEnergy"]*(gamma-1)*mu*mp/kb
                return ret.in_units(self.ds.unit_system["temperature"])
```

It seems as if this is too restrictive of an assumption--there is no reason to think that simulations would not be perhaps fully ionized instead. We should find a more flexible way to define this field, perhaps by setting a field parameter for `mu`.

Responsible: jzuhone


More information about the yt-dev mailing list