[yt-users] cloud in cell mesh construction for particle data

Nathan Goldbaum nathan12343 at gmail.com
Thu Jun 5 15:49:37 PDT 2014


On Thu, Jun 5, 2014 at 3:36 PM, John ZuHone <jzuhone at gmail.com> wrote:

> Hi Brendan,
>
> Which version of yt are you using?
>
> If you're using 3.0, this is actually fairly easy. If you look in
> yt.fields.particle_fields.py, around line 85, you can see how this is
> done for the "particle_density" and "particle_mass" fields. Basically you
> can call a "deposit" method which takes the particle field quantity you
> want deposited and deposits it into cells. The underlying calculation is
> done using Cython, so it's fast.
>

And you shouldn't ever actually need to call these "deposit" functions,
since "deposit" is exposed as a field type for all datasets that contain
particles.

Here is a notebook that does this for Enzo AMR data:

http://nbviewer.ipython.org/gist/ngoldbaum/5e19e4e6cc2bf330149c

This dataset contains about a million particles and generates a CIC
deposition for the whole domain in about 6 seconds from a cold start.


>
> If you're using 2.x, then you can do the same thing, but it's not as
> straightforward. You can see how this works in
> yt.data_objects.universal_fields.py, around line 986, where the
> "particle_density" field is defined. Basically, it calls CICDeposit_3,
> which is in yt.utilities.lib.CICDeposit.pyx.
>
> Let me know if you need any more clarification.
>
> Best,
>
> John Z
>
> On Jun 5, 2014, at 6:07 PM, Brendan Griffen <brendan.f.griffen at gmail.com>
> wrote:
>
> > Hi,
> >
> > I was wondering if there were any Cython routines within yt which takes
> particle data and converts it into a cloud-in-cell based mesh which can be
> written to a file of my choosing.
>

What sort of mesh were you looking for?  yt will internally construct an
octree if it is fed particle data.  I'm not sure whether this octree can be
saved to disk for later analysis.

It's also possible to create a uniform resolution covering grid containing
field data for a deposited quantity, which can be quite easily saved to
disk in a number of ways.


> I heard a while ago there was some such functionality but it could be too
> far down the yt rabbit hole to be used as a standalone? Is this true? I
> have my own Python code for doing it but it just isn't fast enough and
> thought I'd ask the yt community if there were any wrapper tools available
> to boost the speed.
> >
> > Thanks.
> > Brendan
> > _______________________________________________
> > 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/20140605/afd48797/attachment.htm>


More information about the yt-users mailing list