[yt-users] Making grid fields from particles

Britton Smith brittonsmith at gmail.com
Sat Aug 27 04:05:32 PDT 2011


Hi Eric,

Just to add to what Matt said, the code and examples for doing this are in
yt/frontends/enzo/fields.py.  The function _star_field is used to calculate
mass-weighted grid fields for just the star particles using the
CIC_deposit.  In that function, you should see two calls to cic_deposit.
The first is with a field that is the product of the desired field and the
mass field, and the second is just for the mass field.  Then dividing them
gives the mass-weighted field.  Below that, there are some examples of
fields being created that use this function.  It looks like all you have to
do is name the field correctly and the _star_field function figures out
which particle data it should be using (i.e, metallicity, creation time,
etc.)

Britton

On Fri, Aug 26, 2011 at 9:46 PM, Matthew Turk <matthewturk at gmail.com> wrote:

> Hi Eric,
>
> (Thanks for re-sending.)
>
> On Fri, Aug 26, 2011 at 3:31 PM, Eric Hallman <hallman13 at gmail.com> wrote:
> > Hello all,
> >   I looked through the previous threads on yt-users, and I don't see this
> > particular problem described.  Hoping for some help.  So, the quantity
> > dark_matter_density is a CIC-deposited particle quantity, which becomes a
> > grid field.  I would like to do something like this:
> > for every grid voxel, calculate the mean dm particle *velocity* inside
> that
> > voxel
> > return as a grid field
> > Is that simple using CIC_deposit?  The only mean particle velocity I've
> seen
> > used in yt/enzo before is the one calculated for halos, by using HOP or
> FOF
> > identification.
> > thanks!
>
> This has been done in the past for fields like the mean stellar
> metallicity.  In that case, cic_deposit was used to deposit both the
> total mass in metals and the total mass in particles, then they were
> divided.  What I would recommend you do is copy the logic in that
> field, but modify it to deposit a velocity-multiplied-by-mass, and
> then divide by the total deposited mass.
>
> Hope that helps,
>
> Matt
>
> > Eric
> > _______________________________________________
> > yt-users mailing list
> > yt-users at lists.spacepope.org
> > http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
> >
> >
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20110827/5bb712d6/attachment.htm>


More information about the yt-users mailing list