[yt-svn] commit/yt: 3 new changesets
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Wed Apr 16 12:08:32 PDT 2014
3 new commits in yt:
https://bitbucket.org/yt_analysis/yt/commits/88e9dc63da2a/
Changeset: 88e9dc63da2a
Branch: yt-3.0
User: mzingale
Date: 2014-04-16 15:48:16
Summary: add CastroFieldInfo
remove unused imports
fix _setup1d bug (TypeError: can only assign an iterable)
Affected #: 2 files
diff -r a1842ded9f19a5ef60f14da86d71770fe08a7388 -r 88e9dc63da2a722a0c96e1b67179089aae43f1b4 yt/frontends/boxlib/data_structures.py
--- a/yt/frontends/boxlib/data_structures.py
+++ b/yt/frontends/boxlib/data_structures.py
@@ -43,7 +43,8 @@
from .fields import \
BoxlibFieldInfo, \
- MaestroFieldInfo
+ MaestroFieldInfo, \
+ CastroFieldInfo
from .io import IOHandlerBoxlib
# This is what we use to find scientific notation that might include d's
@@ -603,7 +604,9 @@
tmp.extend((1,1))
self.domain_dimensions = np.array(tmp)
tmp = list(self.periodicity)
- tmp[1:] = False
+ print tmp
+ tmp[1] = False
+ tmp[2] = False
self.periodicity = ensure_tuple(tmp)
def _setup2d(self):
@@ -728,6 +731,8 @@
class CastroDataset(BoxlibDataset):
+ _field_info_class = CastroFieldInfo
+
@classmethod
def _is_valid(cls, *args, **kwargs):
# fill our args
diff -r a1842ded9f19a5ef60f14da86d71770fe08a7388 -r 88e9dc63da2a722a0c96e1b67179089aae43f1b4 yt/frontends/boxlib/fields.py
--- a/yt/frontends/boxlib/fields.py
+++ b/yt/frontends/boxlib/fields.py
@@ -20,10 +20,6 @@
mh, boltzmann_constant_cgs, amu_cgs
from yt.fields.field_info_container import \
FieldInfoContainer
-from yt.fields.species_fields import \
- add_species_field_by_fraction
-from yt.utilities.chemical_formulas import \
- ChemicalFormula
rho_units = "code_mass / code_length**3"
mom_units = "code_mass / (code_time * code_length**2)"
@@ -114,6 +110,64 @@
function = _get_vel(ax),
units = "cm/s")
+class CastroFieldInfo(FieldInfoContainer):
+
+ known_other_fields = (
+ ("density", ("g/cm**3", ["density"], r"\rho")),
+ ("xmom", ("g*cm/s", ["momentum_x"], r"\rho u")),
+ ("ymom", ("g*cm/s", ["momentum_y"], r"\rho v")),
+ ("zmom", ("g*cm/s", ["momentum_z"], r"\rho w")),
+ # velocity components are not always present
+ ("x_velocity", ("cm/s", ["velocity_x"], r"u")),
+ ("y_velocity", ("cm/s", ["velocity_y"], r"v")),
+ ("z_velocity", ("cm/s", ["velocity_z"], r"w")),
+ ("rho_E", ("erg/cm**3", ["energy_density"], r"\rho E")),
+ # internal energy density (not just thermal)
+ ("rho_e", ("erg/cm**3", [], r"\rho e")),
+ ("Temp", ("K", ["temperature"], r"T")),
+ ("grav_x", ("cm/s**2", [], r"g\cdot e_x")),
+ ("grav_y", ("cm/s**2", [], r"g\cdot e_y")),
+ ("grav_z", ("cm/s**2", [], r"g\cdot e_z")),
+ ("pressure", ("dyne/cm**2", [], r"p")),
+ ("kineng", ("erg/cm**3", [], r"\frac{1}{2}\rho|U|**2")),
+ ("soundspeed", ("cm/s", ["sound_speed"], None)),
+ ("Machnumber", ("", ["mach_number"], None)),
+ ("entropy", ("erg/(g*K)", ["entropy"], r"s")),
+ ("magvort", ("1/s", ["vorticity_magnitude"], r"|\nabla \times U|")),
+ ("divu", ("1/s", [], r"\nabla \cdot U")),
+ ("eint_E", ("erg/g", [], r"e(E,U)")),
+ ("eint_e", ("erg/g", [], r"e")),
+ ("magvel", ("cm/s", ["velocity_magnitude"], r"|U|")),
+ ("radvel", ("cm/s", [], r"U\cdot e_r")),
+ ("magmom", ("g*cm/s", ["momentum_magnitude"], r"|\rho U|")),
+ ("maggrav", ("cm/s**2", [], r"|g|")),
+ ("phiGrav", ("erg/g", [], r"|\Phi|")),
+ )
+
+ def setup_fluid_fields(self):
+ # add X's
+ for _, field in self.pf.field_list:
+ if field.startswith("X("):
+ # We have a fraction
+ nice_name = field[2:-1]
+ self.alias(("gas", "%s_fraction" % nice_name), ("boxlib", field),
+ units = "")
+ def _create_density_func(field_name):
+ def _func(field, data):
+ return data[field_name] * data["gas", "density"]
+ return _func
+ func = _create_density_func(("gas", "%s_fraction" % nice_name))
+ self.add_field(name = ("gas", "%s_density" % nice_name),
+ function = func,
+ units = "g/cm**3")
+ # We know this will either have one letter, or two.
+ if field[3] in string.letters:
+ element, weight = field[2:4], field[4:-1]
+ else:
+ element, weight = field[2:3], field[3:-1]
+ weight = int(weight)
+ # Here we can, later, add number density.
+
class MaestroFieldInfo(FieldInfoContainer):
known_other_fields = (
@@ -166,7 +220,7 @@
)
def setup_fluid_fields(self):
- # Add omegadots, units of 1/s
+ # pick the correct temperature field
if self.pf.parameters["use_tfromp"]:
self.alias(("gas", "temperature"), ("boxlib", "tfromp"),
units = "K")
@@ -174,6 +228,7 @@
self.alias(("gas", "temperature"), ("boxlib", "tfromh"),
units = "K")
+ # Add X's and omegadots, units of 1/s
for _, field in self.pf.field_list:
if field.startswith("X("):
# We have a fraction
https://bitbucket.org/yt_analysis/yt/commits/aada2b6b22a8/
Changeset: aada2b6b22a8
Branch: yt-3.0
User: mzingale
Date: 2014-04-16 15:54:52
Summary: remove debugging print
Affected #: 1 file
diff -r 88e9dc63da2a722a0c96e1b67179089aae43f1b4 -r aada2b6b22a8f598174c75e3731afb7ae7f16bde yt/frontends/boxlib/data_structures.py
--- a/yt/frontends/boxlib/data_structures.py
+++ b/yt/frontends/boxlib/data_structures.py
@@ -604,7 +604,6 @@
tmp.extend((1,1))
self.domain_dimensions = np.array(tmp)
tmp = list(self.periodicity)
- print tmp
tmp[1] = False
tmp[2] = False
self.periodicity = ensure_tuple(tmp)
https://bitbucket.org/yt_analysis/yt/commits/4aec9367502b/
Changeset: 4aec9367502b
Branch: yt-3.0
User: MatthewTurk
Date: 2014-04-16 21:08:24
Summary: Merged in mzingale/yt/yt-3.0 (pull request #826)
add CastroFieldInfo, some minor bug fixes
Affected #: 2 files
diff -r 8a31afd9169a33f58551d35d75f0b5f3396d6fac -r 4aec9367502b6c9cac202fdbc97501e542fcccbf yt/frontends/boxlib/data_structures.py
--- a/yt/frontends/boxlib/data_structures.py
+++ b/yt/frontends/boxlib/data_structures.py
@@ -43,7 +43,8 @@
from .fields import \
BoxlibFieldInfo, \
- MaestroFieldInfo
+ MaestroFieldInfo, \
+ CastroFieldInfo
from .io import IOHandlerBoxlib
# This is what we use to find scientific notation that might include d's
@@ -603,7 +604,8 @@
tmp.extend((1,1))
self.domain_dimensions = np.array(tmp)
tmp = list(self.periodicity)
- tmp[1:] = False
+ tmp[1] = False
+ tmp[2] = False
self.periodicity = ensure_tuple(tmp)
def _setup2d(self):
@@ -728,6 +730,8 @@
class CastroDataset(BoxlibDataset):
+ _field_info_class = CastroFieldInfo
+
@classmethod
def _is_valid(cls, *args, **kwargs):
# fill our args
diff -r 8a31afd9169a33f58551d35d75f0b5f3396d6fac -r 4aec9367502b6c9cac202fdbc97501e542fcccbf yt/frontends/boxlib/fields.py
--- a/yt/frontends/boxlib/fields.py
+++ b/yt/frontends/boxlib/fields.py
@@ -20,10 +20,6 @@
mh, boltzmann_constant_cgs, amu_cgs
from yt.fields.field_info_container import \
FieldInfoContainer
-from yt.fields.species_fields import \
- add_species_field_by_fraction
-from yt.utilities.chemical_formulas import \
- ChemicalFormula
rho_units = "code_mass / code_length**3"
mom_units = "code_mass / (code_time * code_length**2)"
@@ -114,6 +110,64 @@
function = _get_vel(ax),
units = "cm/s")
+class CastroFieldInfo(FieldInfoContainer):
+
+ known_other_fields = (
+ ("density", ("g/cm**3", ["density"], r"\rho")),
+ ("xmom", ("g*cm/s", ["momentum_x"], r"\rho u")),
+ ("ymom", ("g*cm/s", ["momentum_y"], r"\rho v")),
+ ("zmom", ("g*cm/s", ["momentum_z"], r"\rho w")),
+ # velocity components are not always present
+ ("x_velocity", ("cm/s", ["velocity_x"], r"u")),
+ ("y_velocity", ("cm/s", ["velocity_y"], r"v")),
+ ("z_velocity", ("cm/s", ["velocity_z"], r"w")),
+ ("rho_E", ("erg/cm**3", ["energy_density"], r"\rho E")),
+ # internal energy density (not just thermal)
+ ("rho_e", ("erg/cm**3", [], r"\rho e")),
+ ("Temp", ("K", ["temperature"], r"T")),
+ ("grav_x", ("cm/s**2", [], r"g\cdot e_x")),
+ ("grav_y", ("cm/s**2", [], r"g\cdot e_y")),
+ ("grav_z", ("cm/s**2", [], r"g\cdot e_z")),
+ ("pressure", ("dyne/cm**2", [], r"p")),
+ ("kineng", ("erg/cm**3", [], r"\frac{1}{2}\rho|U|**2")),
+ ("soundspeed", ("cm/s", ["sound_speed"], None)),
+ ("Machnumber", ("", ["mach_number"], None)),
+ ("entropy", ("erg/(g*K)", ["entropy"], r"s")),
+ ("magvort", ("1/s", ["vorticity_magnitude"], r"|\nabla \times U|")),
+ ("divu", ("1/s", [], r"\nabla \cdot U")),
+ ("eint_E", ("erg/g", [], r"e(E,U)")),
+ ("eint_e", ("erg/g", [], r"e")),
+ ("magvel", ("cm/s", ["velocity_magnitude"], r"|U|")),
+ ("radvel", ("cm/s", [], r"U\cdot e_r")),
+ ("magmom", ("g*cm/s", ["momentum_magnitude"], r"|\rho U|")),
+ ("maggrav", ("cm/s**2", [], r"|g|")),
+ ("phiGrav", ("erg/g", [], r"|\Phi|")),
+ )
+
+ def setup_fluid_fields(self):
+ # add X's
+ for _, field in self.pf.field_list:
+ if field.startswith("X("):
+ # We have a fraction
+ nice_name = field[2:-1]
+ self.alias(("gas", "%s_fraction" % nice_name), ("boxlib", field),
+ units = "")
+ def _create_density_func(field_name):
+ def _func(field, data):
+ return data[field_name] * data["gas", "density"]
+ return _func
+ func = _create_density_func(("gas", "%s_fraction" % nice_name))
+ self.add_field(name = ("gas", "%s_density" % nice_name),
+ function = func,
+ units = "g/cm**3")
+ # We know this will either have one letter, or two.
+ if field[3] in string.letters:
+ element, weight = field[2:4], field[4:-1]
+ else:
+ element, weight = field[2:3], field[3:-1]
+ weight = int(weight)
+ # Here we can, later, add number density.
+
class MaestroFieldInfo(FieldInfoContainer):
known_other_fields = (
@@ -166,7 +220,7 @@
)
def setup_fluid_fields(self):
- # Add omegadots, units of 1/s
+ # pick the correct temperature field
if self.pf.parameters["use_tfromp"]:
self.alias(("gas", "temperature"), ("boxlib", "tfromp"),
units = "K")
@@ -174,6 +228,7 @@
self.alias(("gas", "temperature"), ("boxlib", "tfromh"),
units = "K")
+ # Add X's and omegadots, units of 1/s
for _, field in self.pf.field_list:
if field.startswith("X("):
# We have a fraction
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