import yt
from yt.units import dimensions
def _pressure(field, data):
return (data.ds.gamma - 1.0) *
data["density"] * data["thermal_energy"]
yt.add_field(("gas","pressure"), function=_pressure, units="auto",
dimensions=dimensions.pressure)