<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">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 class="" style="white-space:pre">      </span>data = {}</div><div><span class="" style="white-space:pre">  </span>ds = yt.load(vtk_file)</div><div><span class="" style="white-space:pre">     </span>gs = ds.index.select_grids(ds.index.max_level)</div><div><span class="" style="white-space:pre">     </span>grid = gs[0] #assuming SMR wasn't used</div><div><span class="" style="white-space:pre"> </span>for var in variables:</div><div><span class="" style="white-space:pre">              </span>data[var] = grid[var][:,:,0]</div><div><span class="" style="white-space:pre">       </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><br></div><div>-Tim</div></div><div class="gmail_extra"><br><div class="gmail_quote">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><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><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>_______________________________________________<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>