[yt-users] Reading athena output

Timothy Waters waterst3 at unlv.nevada.edu
Mon Dec 1 22:37:59 PST 2014


Hi,

There are several ways, but assuming you have vtk files as in the example
here
http://yt-project.org/doc/examining/loading_data.html?highlight=athena
this function returns a dictionary of specified variables:

def get2DAthenaData(vtk_file,variables):
data = {}
ds = yt.load(vtk_file)
gs = ds.index.select_grids(ds.index.max_level)
grid = gs[0] #assuming SMR wasn't used
for var in variables:
data[var] = grid[var][:,:,0]
return data

Example usage:
data = get2DAthenaData('kh.0010.vtk', ['density','pressure','vorticity_z'])
rho = data['density']
p = data['pressure']
w = data['vorticity_z']
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.

If you instead want to make 2D images, you can just generate the dataset ds
and then look into FixedResolutionBuffer.

-Tim

On Sat, Nov 29, 2014 at 12:51 PM, almog yalin <almog.yalin at gmail.com> wrote:

> Hi.
>
> 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.
>
> Thanks in Advance,
> Almog
>
>
>
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.spacepope.org/pipermail/yt-users-spacepope.org/attachments/20141201/29b11a65/attachment.htm>


More information about the yt-users mailing list