Hi Eric,<br><br>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.)<br>
<br>Britton<br><br><div class="gmail_quote">On Fri, Aug 26, 2011 at 9:46 PM, Matthew Turk <span dir="ltr"><<a href="mailto:matthewturk@gmail.com">matthewturk@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Hi Eric,<br>
<br>
(Thanks for re-sending.)<br>
<div><div></div><div class="h5"><br>
On Fri, Aug 26, 2011 at 3:31 PM, Eric Hallman <<a href="mailto:hallman13@gmail.com">hallman13@gmail.com</a>> wrote:<br>
> Hello all,<br>
>   I looked through the previous threads on yt-users, and I don't see this<br>
> particular problem described.  Hoping for some help.  So, the quantity<br>
> dark_matter_density is a CIC-deposited particle quantity, which becomes a<br>
> grid field.  I would like to do something like this:<br>
> for every grid voxel, calculate the mean dm particle *velocity* inside that<br>
> voxel<br>
> return as a grid field<br>
> Is that simple using CIC_deposit?  The only mean particle velocity I've seen<br>
> used in yt/enzo before is the one calculated for halos, by using HOP or FOF<br>
> identification.<br>
> thanks!<br>
<br>
</div></div>This has been done in the past for fields like the mean stellar<br>
metallicity.  In that case, cic_deposit was used to deposit both the<br>
total mass in metals and the total mass in particles, then they were<br>
divided.  What I would recommend you do is copy the logic in that<br>
field, but modify it to deposit a velocity-multiplied-by-mass, and<br>
then divide by the total deposited mass.<br>
<br>
Hope that helps,<br>
<br>
Matt<br>
<br>
> Eric<br>
> _______________________________________________<br>
> yt-users mailing list<br>
> <a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a><br>
> <a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
><br>
><br>
_______________________________________________<br>
yt-users mailing list<br>
<a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a><br>
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
</blockquote></div><br>