[Yt-svn] yt: added correct units for B-fields in enzo.

hg at spacepope.org hg at spacepope.org
Mon Nov 8 21:15:40 PST 2010


hg Repository: yt
details:   yt/rev/2bf5524cb6bf
changeset: 3509:2bf5524cb6bf
user:      J.S. Oishi <jsoishi at gmail.com>
date:
Mon Nov 08 21:15:09 2010 -0800
description:
added correct units for B-fields in enzo.

diffstat:

 yt/frontends/enzo/fields.py |  11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diffs (28 lines):

diff -r f1b6415806b3 -r 2bf5524cb6bf yt/frontends/enzo/fields.py
--- a/yt/frontends/enzo/fields.py	Mon Nov 08 09:37:17 2010 -0800
+++ b/yt/frontends/enzo/fields.py	Mon Nov 08 21:15:09 2010 -0800
@@ -212,7 +212,8 @@
 
 _default_fields = ["Density","Temperature",
                    "x-velocity","y-velocity","z-velocity",
-                   "x-momentum","y-momentum","z-momentum"]
+                   "x-momentum","y-momentum","z-momentum",
+                   "Bx", "By", "Bz"]
 # else:
 #     _default_fields = ["Density","Temperature","Gas_Energy","Total_Energy",
 #                        "x-velocity","y-velocity","z-velocity"]
@@ -382,6 +383,14 @@
 add_field('IsStarParticle', function=_IsStarParticle,
           particle_type = True)
 
+def _convertBfield(data): 
+    return na.sqrt(4*na.pi*data.convert("Density")*data.convert("x-velocity")**2)
+for field in ['Bx','By','Bz']:
+    f = EnzoFieldInfo[field]
+    f._convert_function=_convertBfield
+    f._units=r"\mathrm{Gau\ss}"
+    f.take_log=False
+    
 #
 # Now we do overrides for 2D fields
 #



More information about the yt-svn mailing list