[Yt-svn] yt-commit r465 - trunk/yt/lagos
britton at wrangler.dreamhost.com
britton at wrangler.dreamhost.com
Tue May 13 10:37:48 PDT 2008
Author: britton
Date: Tue May 13 10:37:47 2008
New Revision: 465
URL: http://yt.spacepope.org/changeset/465
Log:
Added option to include thermal energy in IsBound function with 'include_thermal_energy=True'.
13 May, 2008
Britton Smith
Modified:
trunk/yt/lagos/DerivedQuantities.py
Modified: trunk/yt/lagos/DerivedQuantities.py
==============================================================================
--- trunk/yt/lagos/DerivedQuantities.py (original)
+++ trunk/yt/lagos/DerivedQuantities.py Tue May 13 10:37:47 2008
@@ -155,13 +155,17 @@
add_quantity("BaryonSpinParameter", function=_BaryonSpinParameter,
combine_function=_combBaryonSpinParameter, n_ret=4)
-def _IsBound(data, truncate = True):
+def _IsBound(data, truncate = True, include_thermal_energy = False):
# Kinetic energy
bv_x,bv_y,bv_z = data.quantities["BulkVelocity"]()
kinetic = 0.5 * (data["CellMass"] * (
(data["x-velocity"] - bv_x)**2
+ (data["y-velocity"] - bv_y)**2
+ (data["z-velocity"] - bv_z)**2 )).sum()
+ # Add thermal energy to kinetic energy
+ if (include_thermal_energy):
+ thermal = (data["Gas_Energy"] * data["CellMass"]).sum()
+ kinetic += thermal
# Gravitational potential energy
# We only divide once here because we have velocity in cgs, but radius is
# in code.
More information about the yt-svn
mailing list