<div dir="ltr"><div>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.</div>

<div><br></div><div>I've pasted a fully worked example of what Melinda is trying to do here: </div><div><br></div><div><a href="http://paste.yt-project.org/show/4904/">http://paste.yt-project.org/show/4904/</a><br></div>

<div><br></div><div>An equivalent script for yt-3.0 is pasted here: </div><div><br></div><div><a href="http://paste.yt-project.org/show/4905/">http://paste.yt-project.org/show/4905/</a><br></div><div><br></div><div>I think the cython routine does the same thing as this - just in a manner that is much faster and scales better in parallel.</div>

<div><br></div><div>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.</div>

<div><br></div><div>Interestingly, due to the issue from this trello card:</div><div><br></div><div><a href="https://trello.com/c/SFuSSoIo">https://trello.com/c/SFuSSoIo</a><br></div><div><br></div><div>and the fact that surfaces need vertex centered data, 3.0 is substantially slower at this than 2.x.</div>

<div><br></div><div>Anyway, hope that helps Melinda.</div><div><br></div><div>Nathan</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Jul 12, 2014 at 2:23 PM, <a href="mailto:Msoares.physics@gmail.com">Msoares.physics@gmail.com</a> <span dir="ltr"><<a href="mailto:msoares.physics@gmail.com" target="_blank">msoares.physics@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="auto"><div>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.<br>

</div><div><div class="h5"><div><br>On Jul 12, 2014, at 2:19 PM, Michael Zingale <<a href="mailto:michael.zingale@stonybrook.edu" target="_blank">michael.zingale@stonybrook.edu</a>> wrote:<br><br></div><blockquote type="cite">

<div><div dir="ltr">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.</div>


<div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Jul 12, 2014 at 4:14 PM, Matthew Turk <span dir="ltr"><<a href="mailto:matthewturk@gmail.com" target="_blank">matthewturk@gmail.com</a>></span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><p dir="ltr">Hi Melinda and Nathan,</p>
<p dir="ltr">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.</p>




<p dir="ltr">Matt</p><div><div>
<div class="gmail_quote">On Jul 12, 2014 2:40 PM, "Nathan Goldbaum" <<a href="mailto:nathan12343@gmail.com" target="_blank">nathan12343@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">



<div dir="ltr">Hi Melinda,<div><br></div><div>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.</div>



<div>

<br></div><div>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.</div>





<div><br></div><div>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.</div><div><br></div><div>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.  </div>





<div><br></div><div>Take a look at my radial_flux_analyzer, which does this calculation: <a href="https://bitbucket.org/ngoldbaum/galaxy_analysis_fork/src" target="_blank">https://bitbucket.org/ngoldbaum/galaxy_analysis_fork/src</a>. </div>





<div><br></div><div>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.</div>





<div><br></div><div>Sorry to not have a more concrete solution for you.</div><div><br></div><div>-Nathan</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Sat, Jul 12, 2014 at 12:18 AM, Melinda Soares-Furtado <span dir="ltr"><<a href="mailto:msoares.physics@gmail.com" target="_blank">msoares.physics@gmail.com</a>></span> wrote:<br>





<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div><pre style="margin-top:0px;margin-bottom:0px;padding:0px;text-align:justify">

<font face="tahoma, sans-serif"><span style="color:rgb(0,0,0);line-height:22.399999618530273px">I created a surface using </span><span style="color:rgb(0,0,0);line-height:22.399999618530273px"><b>surf = p1.h.surface(sp,"Radius",cluster_radius)</b></span></font></pre>






<pre style="margin-top:0px;margin-bottom:0px;padding:0px;text-align:justify"><font color="#000000" face="tahoma, sans-serif"><span style="line-height:22.399999618530273px">and then gathered the density values for the cells in this surface with</span></font></pre>






<pre style="margin-top:0px;margin-bottom:0px;padding:0px;text-align:justify"><font color="#000000" face="tahoma, sans-serif"><span style="line-height:22.399999618530273px"><b>dens = surf['Density'], </b>which I can export as a textfile.</span></font></pre>






<pre style="margin-top:0px;margin-bottom:0px;padding:0px;text-align:justify"><font color="#000000" face="tahoma, sans-serif"><span style="line-height:22.399999618530273px">I now need to get the area of each cell, but I'm having trouble doing this.</span></font></pre>






<pre style="margin-top:0px;margin-bottom:0px;padding:0px;text-align:justify"><font color="#000000" face="tahoma, sans-serif"><span style="line-height:22.399999618530273px">Any advice?</span></font></pre><pre style="margin-top:0px;margin-bottom:0px;padding:0px;text-align:justify">

<br></pre><div><div dir="ltr"><div><div><div><br></div></div></div></div></div>
</div></div>
<br>_______________________________________________<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" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
<br></blockquote></div><br></div>
<br>_______________________________________________<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" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
<br></blockquote></div>
</div></div><br>_______________________________________________<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" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div>Michael Zingale</div><div>Associate Professor</div><div><br></div><div>Dept. of Physics & Astronomy • Stony Brook University • Stony Brook, NY 11794-3800</div>


<div><i>phone</i>:  <a href="tel:631-632-8225" value="+16316328225" target="_blank">631-632-8225</a></div><div><i>e-mail</i>: <a href="mailto:Michael.Zingale@stonybrook.edu" target="_blank">Michael.Zingale@stonybrook.edu</a></div>

<div><i>web</i>: <a href="http://www.astro.sunysb.edu/mzingale" target="_blank">http://www.astro.sunysb.edu/mzingale</a></div>

</div>
</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>yt-users mailing list</span><br><span><a href="mailto:yt-users@lists.spacepope.org" target="_blank">yt-users@lists.spacepope.org</a></span><br>

<span><a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a></span><br></div></blockquote></div></div></div><br>_______________________________________________<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" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
<br></blockquote></div><br></div></div>