On Mon, Dec 1, 2014 at 10:37 PM, Timothy Waters <waterst3@unlv.nevada.edu> wrote:
Hi,

There are several ways, but assuming you have vtk files as in the example here
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

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.

http://yt-project.org/doc/examining/low_level_inspection.html#examining-grid-data-in-a-fixed-resolution-array
 
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@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@lists.spacepope.org
http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org



_______________________________________________
yt-users mailing list
yt-users@lists.spacepope.org
http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org