[Yt-svn] yt-commit r701 - branches/yt-generalization/yt/lagos
joishi at wrangler.dreamhost.com
joishi at wrangler.dreamhost.com
Mon Jul 28 14:17:03 PDT 2008
Author: joishi
Date: Mon Jul 28 14:17:02 2008
New Revision: 701
URL: http://yt.spacepope.org/changeset/701
Log:
* started to make a mess: enzo/orion fields sometimes collide, both in terms of units (energy) and the default fields in a StaticOutput (momenta for orion, velocities for enzo)
Modified:
branches/yt-generalization/yt/lagos/DataReadingFuncs.py
branches/yt-generalization/yt/lagos/DerivedFields.py
branches/yt-generalization/yt/lagos/OrionDefs.py
Modified: branches/yt-generalization/yt/lagos/DataReadingFuncs.py
==============================================================================
--- branches/yt-generalization/yt/lagos/DataReadingFuncs.py (original)
+++ branches/yt-generalization/yt/lagos/DataReadingFuncs.py Mon Jul 28 14:17:02 2008
@@ -206,7 +206,11 @@
# one field has nElements*bytesPerReal bytes and is located
# nElements*bytesPerReal*field_index from the offset location
- field_index = self.field_indexes[yt2orionFieldsDict[field]]
+ if yt2orionFieldsDict.has_key(field):
+ fieldname = yt2orionFieldsDict[field]
+ else:
+ fieldname = field
+ field_index = self.field_indexes[fieldname]
inFile.seek(int(nElements*bytesPerReal*field_index),1)
field = na.fromfile(inFile,count=nElements,dtype=dtype)
field = field.reshape(self.ActiveDimensions[::-1]).swapaxes(0,2)
Modified: branches/yt-generalization/yt/lagos/DerivedFields.py
==============================================================================
--- branches/yt-generalization/yt/lagos/DerivedFields.py (original)
+++ branches/yt-generalization/yt/lagos/DerivedFields.py Mon Jul 28 14:17:02 2008
@@ -486,7 +486,9 @@
data["x-velocity"]**2.0
+ data["y-velocity"]**2.0
+ data["z-velocity"]**2.0 )
-add_field("ThermalEnergy", units=r"\rm{ergs}/\rm{g}")
+ add_field("ThermalEnergy", units=r"\rm{ergs}/\rm{cm^3}")
+# for Orion, units are different...how to do this?
+# add_field("ThermalEnergy", units=r"\rm{ergs}/\rm{g}")
def _Entropy(field, data):
return data["Density"]**(-2./3.) * \
@@ -854,11 +856,16 @@
# Now we add all the fields that we want to control, but we give a null function
# This is every Enzo field we can think of. This will be installation-dependent,
+#if data.pf["HydroMethod"] == 'orion':
+_default_fields = ["Density","Temperature","Gas_Energy","Total_Energy",
+ "x-velocity","y-velocity","z-velocity",
+ "x-momentum","y-momentum","z-momentum"]
+# else:
+# _default_fields = ["Density","Temperature","Gas_Energy","Total_Energy",
+# "x-velocity","y-velocity","z-velocity"]
+_default_fields += [ "%s_Density" % sp for sp in _speciesList ]
-_enzo_fields = ["Density","Temperature","Gas_Energy","Total_Energy",
- "x-velocity","y-velocity","z-velocity"]
-_enzo_fields += [ "%s_Density" % sp for sp in _speciesList ]
-for field in _enzo_fields:
+for field in _default_fields:
add_field(field, function=lambda a, b: None, take_log=True,
validators=[ValidateDataField(field)], units=r"\rm{g}/\rm{cm}^3")
fieldInfo["x-velocity"].projection_conversion='1'
@@ -890,6 +897,14 @@
f._convert_function = _convertVelocity
f.take_log = False
+def _convertMomentum(data):
+ return data.convert("x-velocity")*data.convert("Density")*1e5 # want this in cm/s not km/s
+for ax in ['x','y','z']:
+ f = fieldInfo["%s-momentum" % ax]
+ f._units = r"\rm{erg\ s}/\rm{cm^3}"
+ f._convert_function = _convertMomentum
+ f.take_log = False
+
fieldInfo["Temperature"].units = r"K"
if __name__ == "__main__":
Modified: branches/yt-generalization/yt/lagos/OrionDefs.py
==============================================================================
--- branches/yt-generalization/yt/lagos/OrionDefs.py (original)
+++ branches/yt-generalization/yt/lagos/OrionDefs.py Mon Jul 28 14:17:02 2008
@@ -41,6 +41,9 @@
"Density": "density",
"Gas_Energy": "eden",
"Temperature": "temperature",
+ "x-momentum": "xmom",
+ "y-momentum": "ymom",
+ "z-momentum": "zmom"
}
orion2ytFieldsDict = {}
More information about the yt-svn
mailing list