[Yt-svn] yt-commit r1271 - trunk/yt/lagos
mturk at wrangler.dreamhost.com
mturk at wrangler.dreamhost.com
Tue Apr 21 14:24:58 PDT 2009
Author: mturk
Date: Tue Apr 21 14:24:57 2009
New Revision: 1271
URL: http://yt.spacepope.org/changeset/1271
Log:
Two fixes / changes:
* If EOSType is set to 1 in Enzo, it will read EOSSoundSpeed from the file and use that as the sound speed. I don't like the way this is implemented right now, as the field containers are supposed to be more flexible than this. I think what is missing from them right now is a way to override in an instance.
* Changed the __repr__ of EnzoGrid and OrionGrid and AMRGridPatch so that the unit tests pass.
Modified:
trunk/yt/lagos/BaseGridType.py
trunk/yt/lagos/EnzoDefs.py
trunk/yt/lagos/OutputTypes.py
trunk/yt/lagos/UniversalFields.py
Modified: trunk/yt/lagos/BaseGridType.py
==============================================================================
--- trunk/yt/lagos/BaseGridType.py (original)
+++ trunk/yt/lagos/BaseGridType.py Tue Apr 21 14:24:57 2009
@@ -122,7 +122,7 @@
return cond
def __repr__(self):
- return "Grid_%04i" % (self.id)
+ return "AMRGridPatch_%04i" % (self.id)
def __int__(self):
return self.id
@@ -475,6 +475,9 @@
self.filename = os.path.join(self.hierarchy.directory, filename)
return
+ def __repr__(self):
+ return "EnzoGrid_%04i" % (self.id)
+
class OrionGridBase(AMRGridPatch):
_id_offset = 0
def __init__(self, LeftEdge, RightEdge, index, level, filename, offset, dimensions,start,stop,paranoia=False):
@@ -517,3 +520,6 @@
else:
self.Parent = []
+ def __repr__(self):
+ return "OrionGrid_%04i" % (self.id)
+
Modified: trunk/yt/lagos/EnzoDefs.py
==============================================================================
--- trunk/yt/lagos/EnzoDefs.py (original)
+++ trunk/yt/lagos/EnzoDefs.py Tue Apr 21 14:24:57 2009
@@ -75,6 +75,8 @@
"BoundaryConditionName": str,
"TopGridRank": int,
"TopGridDimensions": int,
+ "EOSSoundSpeed": float,
+ "EOSType": int,
}
mpc_conversion = {'mpc' : 1e0,
Modified: trunk/yt/lagos/OutputTypes.py
==============================================================================
--- trunk/yt/lagos/OutputTypes.py (original)
+++ trunk/yt/lagos/OutputTypes.py Tue Apr 21 14:24:57 2009
@@ -307,6 +307,7 @@
self.time_units = {}
if len(self.parameters) == 0:
self._parse_parameter_file()
+ if "EOSType" not in self.parameters: self.parameters["EOSType"] = -1
if self["ComovingCoordinates"]:
self._setup_comoving_units()
elif self.has_key("LengthUnit"):
@@ -457,6 +458,7 @@
self.parameters["HydroMethod"] = 'orion' # always PPM DE
self.parameters["InitialTime"] = 0. # FIX ME!!!
self.parameters["DualEnergyFormalism"] = 0 # always off.
+ self.parameters["EOSType"] = -1 # default
if self.fparameters.has_key("mu"):
self.parameters["mu"] = self.fparameters["mu"]
Modified: trunk/yt/lagos/UniversalFields.py
==============================================================================
--- trunk/yt/lagos/UniversalFields.py (original)
+++ trunk/yt/lagos/UniversalFields.py Tue Apr 21 14:24:57 2009
@@ -122,6 +122,9 @@
display_field = False)
def _SoundSpeed(field, data):
+ if data.pf["EOSType"] == 1:
+ return na.ones(data["Density"].shape, dtype='float64') * \
+ data.pf["EOSSoundSpeed"]
return ( data.pf["Gamma"]*data["Pressure"] / \
data["Density"] )**(1.0/2.0)
add_field("SoundSpeed", function=_SoundSpeed,
More information about the yt-svn
mailing list