[yt-svn] commit/yt: brittonsmith: Add total energy field for when DualEnergyFormalism is on and for Zeus solver.

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Fri Jan 27 12:14:19 PST 2017


1 new commit in yt:

https://bitbucket.org/yt_analysis/yt/commits/23d0e83400c9/
Changeset:   23d0e83400c9
Branch:      yt
User:        brittonsmith
Date:        2017-01-27 18:45:30+00:00
Summary:     Add total energy field for when DualEnergyFormalism is on and for Zeus solver.
Affected #:  1 file

diff -r a5a82c6c5bc71020c97f55722cee22115bf452af -r 23d0e83400c92b26416052a26d89444bdd1de9ed yt/frontends/enzo/fields.py
--- a/yt/frontends/enzo/fields.py
+++ b/yt/frontends/enzo/fields.py
@@ -191,9 +191,26 @@
             self.add_output_field(("enzo", te_name), sampling_type="cell",
                 units="code_velocity**2")
             self.alias(("gas", "thermal_energy"), ("enzo", te_name))
-
+            def _ge_plus_kin(field, data):
+                ret = data[te_name] + 0.5*data["velocity_x"]**2.0
+                if data.ds.dimensionality > 1:
+                    ret += 0.5*data["velocity_y"]**2.0
+                if data.ds.dimensionality > 2:
+                    ret += 0.5*data["velocity_z"]**2.0
+                return ret
+            self.add_field(
+                ("gas", "total_energy"), sampling_type="cell",
+                function = _ge_plus_kin,
+                units = unit_system["specific_energy"])
         elif dual_energy == 1:
             self.add_output_field(
+                ("enzo", te_name), sampling_type="cell",
+                units = "code_velocity**2")
+            self.alias(
+                ("gas", "total_energy"),
+                ("enzo", te_name),
+                units = unit_system["specific_energy"])
+            self.add_output_field(
                 ("enzo", ge_name), sampling_type="cell",
                 units="code_velocity**2")
             self.alias(
@@ -220,7 +237,10 @@
             self.add_output_field(
                 ("enzo", te_name), sampling_type="cell",
                 units = "code_velocity**2")
-            self.alias(("gas", "total_energy"), ("enzo", te_name))
+            self.alias(
+                ("gas", "total_energy"),
+                ("enzo", te_name),
+                units = unit_system["specific_energy"])
             def _tot_minus_kin(field, data):
                 ret = data[te_name] - 0.5*data["velocity_x"]**2.0
                 if data.ds.dimensionality > 1:

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