[yt-users] Surface extraction in FLASH

Nathan Goldbaum nathan12343 at gmail.com
Mon Feb 27 13:43:01 PST 2017


On Mon, Feb 27, 2017 at 3:37 PM, C.S. Howard <howardcs at mcmaster.ca> wrote:

> Hi Nathan,
>
> Thanks for the reply! As I mentioned earlier, I'm not interested in the
> total flux of photons across the surface, but the total number of photons
> crossing it. The flux in each cell can vary and is not spherically
> symmetric so I cannot find the total flux and multiply by 4*pi*r^2, for
> example.
>
> This means that, for each cell, I need to take the dot product between the
> flux and the area vector of the small bit of the surface in that cell (to
> get the outwards flux), and multiply by the area of the surface in that
> cell. This is all fine, as long as I know the shape of the surface within
> each cell.
>
> I think I'm just confused what the returned triangles actually are.
> Looking at the info for the marching cubes algorithm didn't clear things up
> because it seems there can be multiply triangles within one cell depending
> on the shape of the surface.
>

The union of all of the triangles constitutes the surface. With the worked
example I was using earlier:

In [4]: surf['density'].shape
Out[4]: (98399,)

In [5]: surf.triangles.shape
Out[5]: (98399, 3, 3)

Note how the shape of surf['density'] is the same as the number of
triangles, surf['density'] is just the density value sampled "at" each of
the triangles.

Does that help?


>
> Thanks again,
> Corey
>
>
>
> On Mon, Feb 27, 2017 at 1:44 PM, Nathan Goldbaum <nathan12343 at gmail.com>
> wrote:
>
>>
>>
>> On Mon, Feb 27, 2017 at 12:34 PM, C.S. Howard <howardcs at mcmaster.ca>
>> wrote:
>>
>>> Hi all,
>>>
>>> I'm trying to calculate the total amount of photons crossing a spherical
>>> surface using FLASH simulation data. I noticed yt has a surface extraction
>>> method, and I used this to extract the spherical surface. I only have the
>>> flux of photons in each cell and therefore need to mulitply by the
>>> cross-sectional area of each cell to get what I need.
>>>
>>> I have a couple questions about this surface extraction method:
>>> - What exactly does it return?
>>>
>>
>> It's not clear what you're referring to in this question. What does what
>> return?
>>
>>
>>> - Can I get the cross sectional area of each cell on the surface (as
>>> seen from the center of the simulation volume)
>>>
>>
>> Sure:
>>
>> ad = ds.all_data()
>>
>> # create surface at an isodensity of 5x10^-27 g/cm^3
>> surf = ds.surface(ad, "density", 5e-27)
>>
>> # sample the "density" field at the isodensity surface
>> surf['density']
>>
>> # The locations of all of the vertices of the surface
>> surf.vertices
>>
>> # Coordinates of the vertices of the triangles that make up the surface
>> surf.triangles
>>
>> For the dataset I'm looking at to help write this e-mail, the
>> surf.vertices.shape is (3, 295197) (i.e. one 3D coordinate for every
>> vertex) and surf.triangles.shape is (98399, 3, 3) (i.e. for each triangle
>> [the first axis] there are three vertices [the second axis], each with
>> three coordinates [the last axis]. Note also that there are exactly a third
>> as many triangles as vertices.
>>
>>
>>> - If not, is there a better way to do this using yt?
>>>
>>
>> yt can calculate the flux of a vector field across a surface:
>>
>> http://yt-project.org/docs/dev/reference/api/generated/yt.
>> data_objects.data_containers.YTSelectionContainer3D.calculat
>> e_isocontour_flux.html#yt.data_objects.data_containers.Y
>> TSelectionContainer3D.calculate_isocontour_flux
>>
>> This method is defined on any 3D data object. If you already have a
>> surface object, there's also the calculate_flux method:
>>
>> http://yt-project.org/docs/dev/reference/api/generated/yt.
>> data_objects.construction_data_containers.YTSurface.calculat
>> e_flux.html#yt.data_objects.construction_data_containers.
>> YTSurface.calculate_flux
>>
>>
>>>
>>> Cheers and thanks for the help,
>>> Corey
>>>
>>>
>>>
>>> _______________________________________________
>>> 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/20170227/8173a86d/attachment.html>


More information about the yt-users mailing list