<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Feb 27, 2017 at 3:37 PM, C.S. Howard <span dir="ltr"><<a href="mailto:howardcs@mcmaster.ca" target="_blank">howardcs@mcmaster.ca</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div><div><div><div>Hi Nathan,<br><br></div>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.<br><br></div>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. <br><br></div>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.<br></div></div></div></blockquote><div><br></div><div>The union of all of the triangles constitutes the surface. With the worked example I was using earlier:<div><br></div><div><div>In [4]: surf['density'].shape</div><div>Out[4]: (98399,)</div><div><br></div><div>In [5]: surf.triangles.shape</div><div>Out[5]: (98399, 3, 3)</div><div><br></div><div>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.</div></div></div><div><br></div><div>Does that help?</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div><br></div>Thanks again,<br></div>Corey<br><div><div><br><br></div></div></div><div class="gmail-HOEnZb"><div class="gmail-h5"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Feb 27, 2017 at 1:44 PM, Nathan Goldbaum <span dir="ltr"><<a href="mailto:nathan12343@gmail.com" target="_blank">nathan12343@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span>On Mon, Feb 27, 2017 at 12:34 PM, C.S. Howard <span dir="ltr"><<a href="mailto:howardcs@mcmaster.ca" target="_blank">howardcs@mcmaster.ca</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div><div><div><div><div><div>Hi all,<br><br></div>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. <br><br></div>I have a couple questions about this surface extraction method:<br></div>- What exactly does it return?<br></div></div></div></div></div></blockquote><div><br></div></span><div>It's not clear what you're referring to in this question. What does what return?<br></div><span><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div><div><div></div>- Can I get the cross sectional area of each cell on the surface (as seen from the center of the simulation volume)</div></div></div></div></blockquote><div><br></div></span><div>Sure:</div><div><br></div><div><div>ad = ds.all_data()</div><div><br></div><div># create surface at an isodensity of 5x10^-27 g/cm^3</div><div>surf = ds.surface(ad, "density", 5e-27)</div></div><div><br></div><div># sample the "density" field at the isodensity surface</div><div>surf['density']<br></div><div><br></div><div># The locations of all of the vertices of the surface</div><div>surf.vertices</div><div><br></div><div># Coordinates of the vertices of the triangles that make up the surface</div><div>surf.triangles</div><div><br></div><div>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.</div><span><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div><div></div>- If not, is there a better way to do this using yt?<br></div></div></div></blockquote><div><br></div></span><div>yt can calculate the flux of a vector field across a surface:</div><div><br></div><div><a href="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" target="_blank">http://yt-project.org/docs/dev<wbr>/reference/api/generated/yt.<wbr>data_objects.data_containers.Y<wbr>TSelectionContainer3D.calculat<wbr>e_isocontour_flux.html#yt.<wbr>data_objects.data_containers.Y<wbr>TSelectionContainer3D.calculat<wbr>e_isocontour_flux</a><br></div><div><br></div><div>This method is defined on any 3D data object. If you already have a surface object, there's also the calculate_flux method:</div><div><br></div><div><a href="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" target="_blank">http://yt-project.org/docs/dev<wbr>/reference/api/generated/yt.<wbr>data_objects.construction_data<wbr>_containers.YTSurface.calculat<wbr>e_flux.html#yt.data_objects.<wbr>construction_data_containers.<wbr>YTSurface.calculate_flux</a><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span><div dir="ltr"><div><div><br></div>Cheers and thanks for the help,<br></div>Corey<br><div><div><div><div><div><div><div><br><br></div></div></div></div></div></div></div></div>
<br></span>______________________________<wbr>_________________<br>
yt-users mailing list<br>
<a href="mailto:yt-users@lists.spacepope.org" target="_blank">yt-users@lists.spacepope.org</a><br>
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" rel="noreferrer" target="_blank">http://lists.spacepope.org/lis<wbr>tinfo.cgi/yt-users-spacepope.o<wbr>rg</a><br>
<br></blockquote></div><br></div></div>
<br>______________________________<wbr>_________________<br>
yt-users mailing list<br>
<a href="mailto:yt-users@lists.spacepope.org" target="_blank">yt-users@lists.spacepope.org</a><br>
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" rel="noreferrer" target="_blank">http://lists.spacepope.org/lis<wbr>tinfo.cgi/yt-users-spacepope.<wbr>org</a><br>
<br></blockquote></div><br></div>
</div></div><br>______________________________<wbr>_________________<br>
yt-users mailing list<br>
<a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a><br>
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" rel="noreferrer" target="_blank">http://lists.spacepope.org/<wbr>listinfo.cgi/yt-users-<wbr>spacepope.org</a><br>
<br></blockquote></div><br></div></div>