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

Desika Narayanan dnarayan at haverford.edu
Thu Jun 5 17:04:20 PDT 2014


Hey Brendan,

A couple of extra tools you might find helpful in conjunction with Nathan's
example of depositing the particles onto an octree are at:

http://paste.yt-project.org/show/4737/

Where I load a gadget snapshot, and then recover the coordinates and width
of each cell.

In response to your last question - the particles are deposited into an
octree grid (so, you'll see that the cell sizes aren't all the same size).
  I don't know if depositing onto a regular NxNxN mesh is possible, though
would be interested to hear if so.

-d


On Thu, Jun 5, 2014 at 7:58 PM, Brendan Griffen <brendan.f.griffen at gmail.com
> wrote:

> Thanks. I'll get the "bleeding edge" version first then try your
> suggestions. Though I want to return the NxNxN array and be able to write
> this mesh to a file. It is *only* using the cic part of yt and it should
> return the mesh to be written? Just wanted to clarify?
>
> Thanks.
> Brendan
>
>
> On Thu, Jun 5, 2014 at 6:49 PM, Nathan Goldbaum <nathan12343 at gmail.com>
> wrote:
>
>>
>>
>>
>> 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
>>>
>>
>>
>> _______________________________________________
>> 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/239ed606/attachment.html>


More information about the yt-users mailing list