<meta http-equiv="Content-Type" content="text/html; charset=utf-8"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Dec 1, 2014 at 10:37 PM, Timothy Waters <span dir="ltr"><<a href="mailto:waterst3@unlv.nevada.edu" target="_blank">waterst3@unlv.nevada.edu</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">Hi,<div><br></div><div>There are several ways, but assuming you have vtk files as in the example here</div><div><a href="http://yt-project.org/doc/examining/loading_data.html?highlight=athena" target="_blank">http://yt-project.org/doc/examining/loading_data.html?highlight=athena</a><br></div><div>this function returns a dictionary of specified variables:</div><div><br></div><div><div>def get2DAthenaData(vtk_file,variables):</div><div><span style="white-space:pre-wrap">       </span>data = {}</div><div><span style="white-space:pre-wrap">        </span>ds = yt.load(vtk_file)</div><div><span style="white-space:pre-wrap">   </span>gs = ds.index.select_grids(ds.index.max_level)</div><div><span style="white-space:pre-wrap">   </span>grid = gs[0] #assuming SMR wasn't used</div></div></div></blockquote><div><br></div><div><div>If you *did* use SMR, you can construct a fixed resolution covering grid or smoothed covering grid. The examples in the docs use 3D data, but it should work with 2D data as well.</div><div><br></div><div><a href="http://yt-project.org/doc/examining/low_level_inspection.html#examining-grid-data-in-a-fixed-resolution-array">http://yt-project.org/doc/examining/low_level_inspection.html#examining-grid-data-in-a-fixed-resolution-array</a></div></div><div> </div><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><div><span style="white-space:pre-wrap">    </span>for var in variables:</div><div><span style="white-space:pre-wrap">            </span>data[var] = grid[var][:,:,0]</div><div><span style="white-space:pre-wrap">     </span>return data</div></div><div><br></div><div>Example usage:</div><div>data = get2DAthenaData('kh.0010.vtk', ['density','pressure','vorticity_z'])</div><div>rho = data['density']</div><div>p = data['pressure']</div><div>w = data['vorticity_z']</div><div>So if you just want to have access to 1D profiles to compare with a 1D solution, rho[:,0] would be the 1D density profile along x at the first y index.  </div><div><br></div><div>If you instead want to make 2D images, you can just generate the dataset ds and then look into FixedResolutionBuffer.</div></div></blockquote><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> </div><div><br></div><div>-Tim</div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Sat, Nov 29, 2014 at 12:51 PM, almog yalin <span dir="ltr"><<a href="mailto:almog.yalin@gmail.com" target="_blank">almog.yalin@gmail.com</a>></span> wrote:<br></div></div><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><div class="h5"><div dir="ltr"><div><div><div>Hi.<br><br></div>I ran a 2D simulation with Athena and exported the data to vtk files. I was even able to load the file with yt and inspect some of its elements. What I would like to do is to compare the density from the simulation to an analytic solution (which I can evaluate at the grid points). The problem is I cannot figure out how to extract the relevant information from the yt.frontends.athena.data_structures.AthenaDataset object. What I expect are 2d arrays of the x coordinate, y coordinate and density.<br><br></div>Thanks in Advance,<br></div>Almog<br><div><div><div><br><br></div></div></div></div>
<br></div></div>_______________________________________________<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">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>