[yt-users] Area of Surface Cell

Melinda Soares-Furtado msoares.physics at gmail.com
Sun Jul 13 16:30:47 PDT 2014


That worked really well.
I got the ratio of 0.99589582454 when comparing the two flux computations.

My prior area calculation relied on importing the triangle vertices into an
IDL script from a .csv file.
I think an accumulation of floating point round-off errors contributed to
the discrepancy in the IDL script.

Thanks, Nathan!

Regards,
Melinda Soares-Furtado
msoares at princeton.edu
http://cargo.ucsc.edu/msoares
415-860-0438



On Sat, Jul 12, 2014 at 9:43 PM, Nathan Goldbaum <nathan12343 at gmail.com>
wrote:

> Many apologies Matt, you're completely right.  I spoke too soon and missed
> the obvious answer - shame on me for not trying it out first! The key is to
> use either the triangles or vertices attributes of the surface object -
> whichever makes it easier for you to think about it since they both contain
> the same information about the surface.
>
> I've pasted a fully worked example of what Melinda is trying to do here:
>
> http://paste.yt-project.org/show/4904/
>
> An equivalent script for yt-3.0 is pasted here:
>
> http://paste.yt-project.org/show/4905/
>
> I think the cython routine does the same thing as this - just in a manner
> that is much faster and scales better in parallel.
>
> On my machine this prints 0.99589582454 - I'm not quite sure why its not 1
> - maybe there is some accumulation of floating point round-off error
> somewhere?  FWIW, I get the same answer in 2.x and 3.0.
>
> Interestingly, due to the issue from this trello card:
>
> https://trello.com/c/SFuSSoIo
>
> and the fact that surfaces need vertex centered data, 3.0 is substantially
> slower at this than 2.x.
>
> Anyway, hope that helps Melinda.
>
> Nathan
>
>
> On Sat, Jul 12, 2014 at 2:23 PM, Msoares.physics at gmail.com <
> msoares.physics at gmail.com> wrote:
>
>> Thanks, Michael. I did that last night, but it raised some concerns when
>> the total flux I computed was off by a factor of 1.6 from the calculate
>> flux command. I assumed the triangles were equal. Thanks again.
>>
>> On Jul 12, 2014, at 2:19 PM, Michael Zingale <
>> michael.zingale at stonybrook.edu> wrote:
>>
>> This sound like what you want, in which case, I would also suggest taking
>> the cross product of two edges to evaluate the normal direction of that
>> local triangle.  I'll likely want to play with this later in the summer
>> (after I'm done traveling), since this is good functionality for stellar
>> simulations.
>>
>>
>> On Sat, Jul 12, 2014 at 4:14 PM, Matthew Turk <matthewturk at gmail.com>
>> wrote:
>>
>>> Hi Melinda and Nathan,
>>>
>>> I'm currently boarding my flight, but I just saw this. You can get the
>>> area by examining the triangle vertices which hang off the surface object.
>>> You can compute the area this way by using them as corners of the triangles
>>> and inputting that into an area calculation.
>>>
>>> Matt
>>> On Jul 12, 2014 2:40 PM, "Nathan Goldbaum" <nathan12343 at gmail.com>
>>> wrote:
>>>
>>>> Hi Melinda,
>>>>
>>>> Looking at the code, it looks like yt doesn't expose the individual
>>>> flux or area values, only returning the total flux from the
>>>> `calculate_isocontour_flux` function.
>>>>
>>>> That said, these values are calculated inline in the
>>>> march_cubes_grid_flux function but are not cached or returned to the user.
>>>>  In principle it should be possible to cache and return them to do the
>>>> analysis you're trying to do, but it will require modifying yt.
>>>>  march_cubes_grid_flux is defined in the cython file
>>>> yt/utilities/lib/marching_cubes.pyx.
>>>>
>>>> I think this would be a generally useful modification to yt, so if you
>>>> do go down the path of doing this we would certainly welcome your patch as
>>>> a pull request.
>>>>
>>>> That said, since you only care about fluxes across a spherical surface,
>>>> it should be possible to take advantage of the symmetry of the sphere to
>>>> calculate the fluxes without doing the marching cubes isosurface
>>>> calculation.  In the past, I've had a lot of success calculating fluxes
>>>> across cylindrical surfaces by first exporting AMR data from yt to a
>>>> uniform fixed resolution using a covering_grid data object and then
>>>> postprocessing using custom code.
>>>>
>>>> Take a look at my radial_flux_analyzer, which does this calculation:
>>>> https://bitbucket.org/ngoldbaum/galaxy_analysis_fork/src.
>>>>
>>>> I think it would be generally useful to extend what it does to spheres
>>>> and other simple geometric shapes.  In principle it should also be possible
>>>> to do the same fast calculation inside of yt its self using the
>>>> multiresolution AMR data, but that has so far proven unnecessary for my
>>>> purposes.
>>>>
>>>> Sorry to not have a more concrete solution for you.
>>>>
>>>> -Nathan
>>>>
>>>>
>>>>
>>>>
>>>> On Sat, Jul 12, 2014 at 12:18 AM, Melinda Soares-Furtado <
>>>> msoares.physics at gmail.com> wrote:
>>>>
>>>>> I created a surface using *surf = p1.h.surface(sp,"Radius",cluster_radius)*
>>>>>
>>>>> and then gathered the density values for the cells in this surface with
>>>>>
>>>>> *dens = surf['Density'], *which I can export as a textfile.
>>>>>
>>>>> I now need to get the area of each cell, but I'm having trouble doing this.
>>>>>
>>>>> Any advice?
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> 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
>>>
>>>
>>
>>
>> --
>> Michael Zingale
>> Associate Professor
>>
>> Dept. of Physics & Astronomy • Stony Brook University • Stony Brook, NY
>> 11794-3800
>> *phone*:  631-632-8225
>> *e-mail*: Michael.Zingale at stonybrook.edu
>> *web*: http://www.astro.sunysb.edu/mzingale
>>
>> _______________________________________________
>> 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/20140713/91b64094/attachment.html>


More information about the yt-users mailing list