(Mike's solution could also work!)
On Wed, Jan 16, 2013 at 6:28 PM, Elizabeth Tasker firstname.lastname@example.org wrote:
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 :)
Okay, sorry for being dense. But basically what I'm getting is that you want the functionality of covering grids, but you want to be able to restrict the grids from going above some level L, right?
And for the Level 1 case you mention above, do you want contributions from Level 0? (That's not so hard to do.)
To do this with a covering grid you could pre-allocate:
Li = 0 Lo = 3
cg = pf.h.covering_grid(Li, [0, 0, 0], pf.domain_dimensions * pf.refine_by**Li) output = np.empty(pf.domain_dimensions * pf.refine_by**Lo) nd = pf.refine_by**(Lo-li) for i in range(nd): for j in range(nd): for k in range(nd): output[i::nd,j::nd,k::nd] = cg[field]
(I think, but you might want to check that. There may also be fancier/easier ways.)
You could also do this if we allowed specification of a source for the covering grid, but I think that might require some subtle changes to how it masks child zones.
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?
Yes, it does. And actually, I think Cameron did this for a recent paper, so he may have additional suggestions. Let me know what you think of the solution I posted above?
Elizabeth _______________________________________________ yt-dev mailing list email@example.com http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org