[yt-svn] commit/yt: ngoldbaum: Merged in chummels/yt (pull request #2105)
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Wed Apr 6 11:06:18 PDT 2016
1 new commit in yt:
https://bitbucket.org/yt_analysis/yt/commits/068a53069cdf/
Changeset: 068a53069cdf
Branch: yt
User: ngoldbaum
Date: 2016-04-06 18:06:06+00:00
Summary: Merged in chummels/yt (pull request #2105)
Adding neutral species aliases as described in YTEP 0003
Affected #: 2 files
diff -r 179a73a7e7f479572d0b9039feee73f75360fd3d -r 068a53069cdff7da3ad9597a7bb868fcafabecb2 yt/fields/species_fields.py
--- a/yt/fields/species_fields.py
+++ b/yt/fields/species_fields.py
@@ -114,6 +114,24 @@
particle_type = particle_type,
units = unit_system["number_density"])
+def add_species_aliases(registry, ftype, alias_species, species):
+ """
+ This takes a field registry, a fluid type, and two species names.
+ The first species name is one you wish to alias to an existing species
+ name. For instance you might alias all "H_p0" fields to "H_" fields
+ to indicate that "H_" fields are really just neutral hydrogen fields.
+ This function registers field aliases for the density, number_density,
+ mass, and fraction fields between the two species given in the arguments.
+ """
+ registry.alias((ftype, "%s_density" % alias_species),
+ (ftype, "%s_density" % species))
+ registry.alias((ftype, "%s_fraction" % alias_species),
+ (ftype, "%s_fraction" % species))
+ registry.alias((ftype, "%s_number_density" % alias_species),
+ (ftype, "%s_number_density" % species))
+ registry.alias((ftype, "%s_mass" % alias_species),
+ (ftype, "%s_mass" % species))
+
def add_nuclei_density_fields(registry, ftype,
particle_type = False):
unit_system = registry.ds.unit_system
@@ -181,4 +199,10 @@
# Skip it
continue
func(registry, ftype, species, particle_type)
+ # Adds aliases for all neutral species from their raw "MM_"
+ # species to "MM_p0_" species to be explicit.
+ # See YTEP-0003 for more details.
+ if (ChemicalFormula(species).charge == 0):
+ alias_species = "%s_p0" % species.split('_')[0]
+ add_species_aliases(registry, "gas", alias_species, species)
add_nuclei_density_fields(registry, ftype, particle_type=particle_type)
diff -r 179a73a7e7f479572d0b9039feee73f75360fd3d -r 068a53069cdff7da3ad9597a7bb868fcafabecb2 yt/utilities/chemical_formulas.py
--- a/yt/utilities/chemical_formulas.py
+++ b/yt/utilities/chemical_formulas.py
@@ -29,6 +29,9 @@
charge = -int(ionization[1:])
else:
raise NotImplementedError
+ elif self.formula_string.startswith('El'):
+ molecule = self.formula_string
+ charge = -1
else:
molecule = self.formula_string
charge = 0
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-svn-spacepope.org/attachments/20160406/4d7c5367/attachment.html>
More information about the yt-svn
mailing list