[yt-svn] commit/yt: brittonsmith: Merged in bwkeller/yt (pull request #1648)
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Thu Jul 23 09:27:08 PDT 2015
1 new commit in yt:
https://bitbucket.org/yt_analysis/yt/commits/f5d20191a6e2/
Changeset: f5d20191a6e2
Branch: yt
User: brittonsmith
Date: 2015-07-23 16:26:56+00:00
Summary: Merged in bwkeller/yt (pull request #1648)
[BUGFIX] Smoothing Lengths for Tipsy Datasets
Affected #: 1 file
diff -r fcc7f7abfff1f2d6c0598bc54b421121ab4d029b -r f5d20191a6e277fa4b3028052806d82023bd6c65 yt/frontends/tipsy/fields.py
--- a/yt/frontends/tipsy/fields.py
+++ b/yt/frontends/tipsy/fields.py
@@ -16,6 +16,8 @@
#-----------------------------------------------------------------------------
from yt.frontends.sph.fields import SPHFieldInfo
+from yt.fields.particle_fields import add_volume_weighted_smoothed_field, add_nearest_neighbor_field
+from yt.utilities.physical_constants import mp, kb
class TipsyFieldInfo(SPHFieldInfo):
aux_particle_fields = {
@@ -44,3 +46,29 @@
self.aux_particle_fields[field[1]] not in self.known_particle_fields:
self.known_particle_fields += (self.aux_particle_fields[field[1]],)
super(TipsyFieldInfo,self).__init__(ds, field_list, slice_info)
+
+ def setup_particle_fields(self, ptype, *args, **kwargs):
+
+ # setup some special fields that only make sense for SPH particles
+
+ if ptype in ("PartType0", "Gas"):
+ self.setup_gas_particle_fields(ptype)
+
+ super(TipsyFieldInfo, self).setup_particle_fields(
+ ptype, *args, **kwargs)
+
+
+ def setup_gas_particle_fields(self, ptype):
+
+ def _smoothing_length(field, data):
+ # For now, we hardcode num_neighbors. We should make this configurable
+ # in the future.
+ num_neighbors = 64
+ fn, = add_nearest_neighbor_field(ptype, "particle_position", self, num_neighbors)
+ return data[ptype, 'nearest_neighbor_distance_%d' % num_neighbors]
+
+ self.add_field(
+ (ptype, "smoothing_length"),
+ function=_smoothing_length,
+ particle_type=True,
+ units="code_length")
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