[yt-svn] commit/yt: xarthisius: Merged in atmyers/yt (pull request #1252)

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Wed Nov 5 19:55:23 PST 2014


1 new commit in yt:

https://bitbucket.org/yt_analysis/yt/commits/13e9e2fc55a8/
Changeset:   13e9e2fc55a8
Branch:      yt
User:        xarthisius
Date:        2014-11-06 03:55:12+00:00
Summary:     Merged in atmyers/yt (pull request #1252)

Adding Orion sink/star particle tests
Affected #:  3 files

diff -r 61b8f5675cc23c5e0b3635c70766ab5d0cd71bbb -r 13e9e2fc55a831b17c34aeb7d3030d1ed2752e71 yt/frontends/boxlib/fields.py
--- a/yt/frontends/boxlib/fields.py
+++ b/yt/frontends/boxlib/fields.py
@@ -97,6 +97,8 @@
         # Now, let's figure out what fields are included.
         if any(f[1] == "xmom" for f in self.field_list):
             self.setup_momentum_to_velocity()
+        elif any(f[1] == "xvel" for f in self.field_list):
+            self.setup_velocity_to_momentum()
         self.add_field(("gas", "thermal_energy"),
                        function=_thermal_energy,
                        units="erg/g")
@@ -112,11 +114,22 @@
         def _get_vel(axis):
             def velocity(field, data):
                 return data["%smom" % axis]/data["density"]
+            return velocity
         for ax in 'xyz':
             self.add_field(("gas", "velocity_%s" % ax),
                            function=_get_vel(ax),
                            units="cm/s")
 
+    def setup_velocity_to_momentum(self):
+        def _get_mom(axis):
+            def momentum(field, data):
+                return data["%svel" % axis]*data["density"]
+            return momentum
+        for ax in 'xyz':
+            self.add_field(("gas", "momentum_%s" % ax),
+                           function=_get_mom(ax),
+                           units=mom_units)
+
 
 class CastroFieldInfo(FieldInfoContainer):
 

diff -r 61b8f5675cc23c5e0b3635c70766ab5d0cd71bbb -r 13e9e2fc55a831b17c34aeb7d3030d1ed2752e71 yt/frontends/boxlib/tests/test_orion.py
--- a/yt/frontends/boxlib/tests/test_orion.py
+++ b/yt/frontends/boxlib/tests/test_orion.py
@@ -43,6 +43,14 @@
         test_radtube.__name__ = test.description
         yield test
 
+star = "StarParticles/plrd01000"
+ at requires_ds(star)
+def test_star():
+    ds = data_dir_load(star)
+    yield assert_equal, str(ds), "plrd01000"
+    for test in small_patch_amr(star, _fields):
+        test_star.__name__ = test.description
+        yield test
 
 @requires_file(rt)
 def test_OrionDataset():

diff -r 61b8f5675cc23c5e0b3635c70766ab5d0cd71bbb -r 13e9e2fc55a831b17c34aeb7d3030d1ed2752e71 yt/frontends/chombo/tests/test_outputs.py
--- a/yt/frontends/chombo/tests/test_outputs.py
+++ b/yt/frontends/chombo/tests/test_outputs.py
@@ -47,6 +47,15 @@
         test_tb.__name__ = test.description
         yield test
 
+iso = "IsothermalSphere/data.0000.3d.hdf5"
+ at requires_ds(iso)
+def test_iso():
+    ds = data_dir_load(iso)
+    yield assert_equal, str(ds), "data.0000.3d.hdf5"
+    for test in small_patch_amr(iso, _fields):
+        test_iso.__name__ = test.description
+        yield test
+
 _zp_fields = ("rhs", "phi", "gravitational_field_x",
               "gravitational_field_y")
 zp = "ZeldovichPancake/plt32.2d.hdf5"

Repository URL: https://bitbucket.org/yt_analysis/yt/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.



More information about the yt-svn mailing list