Hi Elizabeth

The following is probably not exactly what you're looking for, since it operates on fields as opposed to grids, but this would be one way forward:

grids = pf.h.select_grids(0)
for g in grids:
    rho = g['Density']
    for dim in [0,1,2]:
        rho = np.repeat(rho,4,axis=dim)
    ## do stuff with expanded rho array

Cheers,

Mike
    


On Wed, Jan 16, 2013 at 3:28 PM, Elizabeth Tasker <tasker@astro1.sci.hokudai.ac.jp> wrote:
Hi Matt,

Thanks for your reply!

>>
>> For this, we'd like to grab all the cells on one AMR level, divide them so that they have a fixed cell size and output.
>
> I'm not entirely sure I understand this process... :(

So, if I have a root grid with cells of size 64 pc and 2 levels of AMR, I'd like to gather up all the level 0, 64pc cells and chop them up to make them 16 pc. Then take all the level 1, 32 pc cells and chop them to make them 16 pc.

Then dump to a file of any type :)

>
>>
>> Is there a quick way of doing this in yt?
>>
>> I *think* the answer will be no, since (for example) covering_grid will grab the best data available to make the mesh, not just the data from a single level. Is that right? We specifically need to avoid interpolation.
>>
>> If so, probably it's easiest just to grab the cells on one level via:
>>
>> gridnum = [g for g in pf.h.grids if g.Level == l]
>
> You can also do this with pf.h.select_grids( level )

Great, that's neater.

>
>>
>> then divide them into the right size. Is there a way of passing a grid to covering_grid to make it a particular size? i.e. something like:
>>
>> for g in gridnum:
>>        grid_fixedcellsize = g.covering_grid(......)
>
> Covering grids go up to a given level, specified in the constructor,
> which might accomplish what you're looking for; i.e., you specify a
> left edge, a level (which fixes the dx) and a dimensionality (which
> fixes the right_edge).  What you are describing here is similar to
> what's done if you do:
>
> g.retrieve_ghost_zones( N, [field_list], smoothed = False)
>
> You can also explore grid_collection, which accepts any list of grids
> and then returns a data object.
>
> If you describe a bit more exactly the format you want to get out,
> perhaps I can give a better example?  I think what you're describing
> is probably doable, I'm just not sure precisely what it will look like
> so I can't quite envision it.
>


The format isn't really important. I was just looking for an easy way to take grids which have cell size 64 pc and produce grids with cell size 16 pc (or whatever size I want) **just** from those grids (i.e. not by grabbing the lower level grids).

Does that make more sense?

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



--
*********************************************************************
*                                                                   *
*  Dr. Michael Kuhlen              Theoretical Astrophysics Center  *
*  email: mqk@astro.berkeley.edu   UC Berkeley                      *
*  cell phone: (831) 588-1468      B-116 Hearst Field Annex # 3411  *
*  skype username: mikekuhlen      Berkeley, CA 94720               *
*                                                                   *
*********************************************************************