<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">
<div class="">Hi Nathan,</div>
<div class=""><br class="">
</div>
<div class="">Thanks a ton for your help, and the guidance in the notebook! The slowness should really be caused by the large data file I have. I followed your notebook to pass only a subset of the dataset, and it ran much faster! (And yes I do have yt's parallelism
 enabled.)</div>
<div class=""><br class="">
</div>
<div class="">I think letting users to provide a data object as the first argument in Streamlines will indeed be very helpful. Unfortunately I am currently quite swamped with other commitments, but I will make sure to file an issue on the issue tracker page. </div>
<div class=""><br class="">
</div>
<div class="">On the tutorial page it says the "data access along the streamline" functionality has not been implemented in the 3.x versions of yt. How involved will it be to implement it? This functionality would be very useful, or even crucial, in extracting
 the science from my simulations. </div>
<div class=""><br class="">
</div>
<div class="">Many thanks,</div>
<div class="">Benny</div>
<div class=""><br class="">
</div>
<div class=""><br class="">
</div>
<div>
<blockquote type="cite" class="">
<div class="">On Jun 30, 2017, at 3:45 PM, Nathan Goldbaum <<a href="mailto:nathan12343@gmail.com" class="">nathan12343@gmail.com</a>> wrote:</div>
<br class="Apple-interchange-newline">
<div class="">
<div dir="ltr" class="">Hi Benny,
<div class=""><br class="">
</div>
<div class="">Yes, this should work and will work (eventually) for your data. We mean octree AMR data like Ramses or ART, where each cell can be refined into 8 more cells, not like Flash, which implements an octee of grid patches.</div>
<div class=""><br class="">
</div>
<div class="">The slow operation here is generating vertex centered data. We have plans to make this faster (grid visitors) but those plans have not yet been implemented.</div>
<div class=""><br class="">
</div>
<div class="">Do you expect your streamline to span the full dataset? You might be able to get some speedups by only selecting from a subset of the dataset using a data object. Another option would be to tell the AMRKDtree to generate vertex centered data by
 extrapolating at grid boundaries instead of interpolating. This will be a lot faster, but will also be less accurate.</div>
<div class=""><br class="">
</div>
<div class="">Looking at the Streamlines class, the API for doing this is a bit awkward right now. It looks like you need to create a custom AMRKDTree and pass that to the Streamlines class. To show you how to do that, I've put together an example notebook
 that shows how to generate a streamline with a custom AMRKDtree instance:</div>
<div class=""><br class="">
</div>
<div class=""><a href="https://gist.github.com/anonymous/b80284a5c8fa09d94cf428163f97902d" class="">https://gist.github.com/anonymous/b80284a5c8fa09d94cf428163f97902d</a><br class="">
</div>
<div class=""><br class="">
</div>
<div class="">I first show how to switch from interpolation to extrapolation, then show how to create streamlines from a subset of the simulation volume.</div>
<div class=""><br class="">
</div>
<div class="">Finally, if you're able to run in parallel using yt's parallelism, constructing the AMRKDTree and generating vertex centered data should parallelize well.</div>
<div class=""><br class="">
</div>
<div class="">There are probably some things we could do to make it easier to opt out of the default AMRKDTree that the Streamlines class instantiates internally if you don't pass it one. One would be to give the Streamlines class a use_ghost_zones keyword
 argument, right now the AMRKDTree that gets generated by the Streamlines class is hard-coded to allways generate vertex centered data using ghost zones, which can be slow. Another option would be to let the Streamlines class optionally accept a data object
 as the first argument instead of a dataset. If you'd be interested in implementing one or more of these suggestions and submitting a pull request on GitHub I think it would be a very welcome and also wouldn't be very hard to implement, you'd basically only
 need to edit the Streamlines class. If you're not interested, that's ok too, but you might want to file an issue on our issue tracker so we don't forget about this opportunity to simplify the API.</div>
<div class=""><br class="">
</div>
<div class="">-Nathan</div>
</div>
<div class="gmail_extra"><br class="">
<div class="gmail_quote">On Fri, Jun 30, 2017 at 3:19 PM, Benny Tsang <span dir="ltr" class="">
<<a href="mailto:bthtsang@astro.as.utexas.edu" target="_blank" class="">bthtsang@astro.as.utexas.edu</a>></span> wrote:<br class="">
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word" class="">Hi yt friends,<br class="">
<br class="">
I'm trying to produce 3D streamlines using the AMR data from FLASH following the yt-project tutorial <a href="http://yt-project.org/doc/visualizing/streamlines.html" target="_blank" class="">http://yt-project.<wbr class="">org/doc/visualizing/<wbr class="">streamlines.html</a>. However,
 the execution was very slow (in particular, at the 'Streamlines' call). The code didn't complete one single streamline after an hour. <br class="">
<br class="">
Here's the excerpt of my code:
<div class="">—————</div>
<div class="">c = ds.domain_center<br class="">
<br class="">
</div>
<div class="">streamlines = Streamlines(ds, c, 'velx', 'vely', 'velz', length=1.0*pc, get_magnitude=False)<br class="">
streamlines.integrate_through_<wbr class="">volume()<br class="">
<br class="">
fig=plt.figure()<br class="">
ax = Axes3D(fig)<br class="">
for stream in streamlines.<wbr class="">streamlines:<br class="">
  stream = stream[np.all(stream != 0.0, axis=1)]<br class="">
  ax.plot3D(stream[:,0], stream[:,1], stream[:,2], alpha=0.1)<br class="">
<br class="">
plt.savefig('streamlines.png')</div>
<div class="">—————</div>
<div class=""><br class="">
</div>
<div class="">I have two thoughts:</div>
<div class="">1. My FLASH file is quite large (~10GB). It may just be slow because of the large AMR grid size. Are there any ways to read only the velocities off the grid or only a subsection of the grid?</div>
<span class="">2. FLASH's octree data structure may be incompatible with the AMRKDTree construction (first step in streamlines creation). In the doc string of AMRKDTree, it says "Not applicable to particle or octree-based datasets.". If it's the case, I may
 have to find another way out.</span>
<div class=""><span class=""><br class="">
</span></div>
<div class=""><span class="">Thank you very much for your time! Have a great weekend!</span></div>
<div class=""><span class=""><br class="">
</span></div>
<div class=""><span class="">Best,</span></div>
<div class=""><span class="">Benny</span></div>
</div>
<br class="">
______________________________<wbr class="">_________________<br class="">
yt-users mailing list<br class="">
<a href="mailto:yt-users@lists.spacepope.org" class="">yt-users@lists.spacepope.org</a><br class="">
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" rel="noreferrer" target="_blank" class="">http://lists.spacepope.org/<wbr class="">listinfo.cgi/yt-users-<wbr class="">spacepope.org</a><br class="">
<br class="">
</blockquote>
</div>
<br class="">
</div>
_______________________________________________<br class="">
yt-users mailing list<br class="">
<a href="mailto:yt-users@lists.spacepope.org" class="">yt-users@lists.spacepope.org</a><br class="">
http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org<br class="">
</div>
</blockquote>
</div>
<br class="">
</body>
</html>