[yt-users] How to generate ghost zones?

Nathan Goldbaum nathan12343 at gmail.com
Wed May 3 10:03:30 PDT 2017


Hi Kalina,

We have a way of generating ghost zones using internal APIs that you may be
able to use.

What sort of ghost zone information do you need? Something like for a given
grid patch, you want to be able to compute a field in the grid and some
ghost zones surrounding the grid?

If so, something like this should work:

    import yt

    # available for download at yt-project.org/data
    ds = yt.load('IsolatedGalaxy/galaxy0030/galaxy0030')

    # grab a grid object, ds.index.grids is a python list containing
    # references to all of the grids in the simulation
    grid = ds.index.grids[0]

    gz_grid = grid.retrieve_ghost_zones(3, 'density')

    print(gz_grid['density'].shape)

    print(grid['density'].shape)

This should print "(38, 38, 38)" and "(32, 32, 32)".

Note that this will only work for patch AMR data (e.g. FLASH, Enzo, Boxlib,
etc). Also note that the retrieve_ghost_zones function takes a "smoothed"
keyword argument, which if set to True will use interpolation to estimate
field values and if set to False (the default) will use nearest neighbor
sampling.

-Nathan

On Wed, May 3, 2017 at 11:50 AM, Kalina Borkiewicz <kalina at illinois.edu>
wrote:

> I see in the yt 3.3 change log that "ghost zone generation" is a thing,
> but I can't seem to find anything else about this.
>
> I would like to generate ghost zones for FLASH data. I tried
> retrieve_ghost_zones() but that gives an error, and I can't find any other
> ghost zone-related functions. Could I get some advice?
>
> Thanks,
> Kalina
>
> _______________________________________________
> 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/20170503/af7de78b/attachment-0001.html>


More information about the yt-users mailing list