On Mon, Feb 27, 2017 at 12:34 PM, C.S. Howard <howardcs@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.calculate_isocontour_flux.html#yt.data_objects.data_containers.YTSelectionContainer3D.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.calculate_flux.html#yt.data_objects.construction_data_containers.YTSurface.calculate_flux
 

Cheers and thanks for the help,
Corey



_______________________________________________
yt-users mailing list
yt-users@lists.spacepope.org
http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org