Hello Yt users, I'm trying to obtain the maximum and minimum level of refinement of a data container in a simulation. What I am doing is the following: ds=yt.load(bname) sp_open=ds.disk(center,normal,radius,(res,'pc')) # smallest disk possible Where bname is the name of the snapshot, center, normal, radius, and res, are the desired center, normal, radius and height of the disk. I chose the resolution of the simulation as the height of the disk because I want it to represent a disk-like differential area and I the disk is located at the region of highest level of refinement. I tried to obtain the minimum and maximum levels of refinement over the sp_open subregion, however only max_level is implemented doing: sp_open.index.max_level Do you know how I can obtain the minimum level of refinement of a data container of a sub-region? Besides, when I print the level statistics of the subregion and the ones of the whole computational volume I get the same output. I print them using: sp_open.index.level_stats # subregion ds.index.level_stats # computational volume And I get: rec.array([( 1, 512, 0), ( 8, 4096, 1), ( 64, 32768, 2), ( 512, 262144, 3), ( 4096, 2097152, 4), (32768, 16777216, 5), ( 0, 0, 6), ( 0, 0, 7), ( 0, 0, 8), ( 0, 0, 9), ( 0, 0, 10), ( 0, 0, 11), ( 0, 0, 12), ( 0, 0, 13), ( 0, 0, 14), ( 0, 0, 15), ( 0, 0, 16), ( 0, 0, 17), ( 0, 0, 18), ( 0, 0, 19), ( 0, 0, 20), ( 0, 0, 21), ( 0, 0, 22), ( 0, 0, 23), ( 0, 0, 24), ( 0, 0, 25), ( 0, 0, 26), ( 0, 0, 27), ( 0, 0, 28), ( 0, 0, 29), ( 0, 0, 30), ( 0, 0, 31), ( 0, 0, 32), ( 0, 0, 33), ( 0, 0, 34), ( 0, 0, 35), ( 0, 0, 36), ( 0, 0, 37), ( 0, 0, 38), ( 0, 0, 39), ( 0, 0, 40), ( 0, 0, 41), ( 0, 0, 42), ( 0, 0, 43), ( 0, 0, 44), ( 0, 0, 45), ( 0, 0, 46), ( 0, 0, 47)], dtype=[('numgrids', '<i8'), ('numcells', '<i8'), ('level', '<i8')]) Which does not make sense to me, because the sub-region level statistics should not include coarse grids, even though this sub-region is in fact inside lower refinement regions. Shouldn't this statistics just print the lowest and highest refinement level inside the sub-region ? Thank you, -- Guido
Maybe you just want to find the extrema of the (“index” “grid_level”) field? That field gives the AMR level of every leaf zone in the data object. On Sun, Sep 8, 2019 at 1:02 PM Guido granda muñoz <guidogranda@gmail.com> wrote:
Hello Yt users, I'm trying to obtain the maximum and minimum level of refinement of a data container in a simulation. What I am doing is the following:
ds=yt.load(bname) sp_open=ds.disk(center,normal,radius,(res,'pc')) # smallest disk possible
Where bname is the name of the snapshot, center, normal, radius, and res, are the desired center, normal, radius and height of the disk. I chose the resolution of the simulation as the height of the disk because I want it to represent a disk-like differential area and I the disk is located at the region of highest level of refinement.
I tried to obtain the minimum and maximum levels of refinement over the sp_open subregion, however only max_level is implemented doing:
sp_open.index.max_level
Do you know how I can obtain the minimum level of refinement of a data container of a sub-region?
Besides, when I print the level statistics of the subregion and the ones of the whole computational volume I get the same output. I print them using:
sp_open.index.level_stats # subregion ds.index.level_stats # computational volume And I get: rec.array([( 1, 512, 0), ( 8, 4096, 1), ( 64, 32768, 2), ( 512, 262144, 3), ( 4096, 2097152, 4), (32768, 16777216, 5), ( 0, 0, 6), ( 0, 0, 7), ( 0, 0, 8), ( 0, 0, 9), ( 0, 0, 10), ( 0, 0, 11), ( 0, 0, 12), ( 0, 0, 13), ( 0, 0, 14), ( 0, 0, 15), ( 0, 0, 16), ( 0, 0, 17), ( 0, 0, 18), ( 0, 0, 19), ( 0, 0, 20), ( 0, 0, 21), ( 0, 0, 22), ( 0, 0, 23), ( 0, 0, 24), ( 0, 0, 25), ( 0, 0, 26), ( 0, 0, 27), ( 0, 0, 28), ( 0, 0, 29), ( 0, 0, 30), ( 0, 0, 31), ( 0, 0, 32), ( 0, 0, 33), ( 0, 0, 34), ( 0, 0, 35), ( 0, 0, 36), ( 0, 0, 37), ( 0, 0, 38), ( 0, 0, 39), ( 0, 0, 40), ( 0, 0, 41), ( 0, 0, 42), ( 0, 0, 43), ( 0, 0, 44), ( 0, 0, 45), ( 0, 0, 46), ( 0, 0, 47)], dtype=[('numgrids', '<i8'), ('numcells', '<i8'), ('level', '<i8')])
Which does not make sense to me, because the sub-region level statistics should not include coarse grids, even though this sub-region is in fact inside lower refinement regions. Shouldn't this statistics just print the lowest and highest refinement level inside the sub-region ?
Thank you, -- Guido _______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
Hi, I think Nathan's approach is the right one -- more specifically because `max_level` is not a property of the values inside a data container, but rather an instruction to the selection machinery not to select above that level. On Sun, Sep 8, 2019 at 2:17 PM Nathan <nathan.goldbaum@gmail.com> wrote:
Maybe you just want to find the extrema of the (“index” “grid_level”) field? That field gives the AMR level of every leaf zone in the data object.
On Sun, Sep 8, 2019 at 1:02 PM Guido granda muñoz <guidogranda@gmail.com> wrote:
Hello Yt users, I'm trying to obtain the maximum and minimum level of refinement of a data container in a simulation. What I am doing is the following:
ds=yt.load(bname) sp_open=ds.disk(center,normal,radius,(res,'pc')) # smallest disk possible
Where bname is the name of the snapshot, center, normal, radius, and res, are the desired center, normal, radius and height of the disk. I chose the resolution of the simulation as the height of the disk because I want it to represent a disk-like differential area and I the disk is located at the region of highest level of refinement.
I tried to obtain the minimum and maximum levels of refinement over the sp_open subregion, however only max_level is implemented doing:
sp_open.index.max_level
Do you know how I can obtain the minimum level of refinement of a data container of a sub-region?
Besides, when I print the level statistics of the subregion and the ones of the whole computational volume I get the same output. I print them using:
sp_open.index.level_stats # subregion ds.index.level_stats # computational volume And I get: rec.array([( 1, 512, 0), ( 8, 4096, 1), ( 64, 32768, 2), ( 512, 262144, 3), ( 4096, 2097152, 4), (32768, 16777216, 5), ( 0, 0, 6), ( 0, 0, 7), ( 0, 0, 8), ( 0, 0, 9), ( 0, 0, 10), ( 0, 0, 11), ( 0, 0, 12), ( 0, 0, 13), ( 0, 0, 14), ( 0, 0, 15), ( 0, 0, 16), ( 0, 0, 17), ( 0, 0, 18), ( 0, 0, 19), ( 0, 0, 20), ( 0, 0, 21), ( 0, 0, 22), ( 0, 0, 23), ( 0, 0, 24), ( 0, 0, 25), ( 0, 0, 26), ( 0, 0, 27), ( 0, 0, 28), ( 0, 0, 29), ( 0, 0, 30), ( 0, 0, 31), ( 0, 0, 32), ( 0, 0, 33), ( 0, 0, 34), ( 0, 0, 35), ( 0, 0, 36), ( 0, 0, 37), ( 0, 0, 38), ( 0, 0, 39), ( 0, 0, 40), ( 0, 0, 41), ( 0, 0, 42), ( 0, 0, 43), ( 0, 0, 44), ( 0, 0, 45), ( 0, 0, 46), ( 0, 0, 47)], dtype=[('numgrids', '<i8'), ('numcells', '<i8'), ('level', '<i8')])
Which does not make sense to me, because the sub-region level statistics should not include coarse grids, even though this sub-region is in fact inside lower refinement regions. Shouldn't this statistics just print the lowest and highest refinement level inside the sub-region ?
Thank you, -- Guido _______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
_______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
Hello Nathan and Matthew, Thank you for answering, I tried Nathan approach and doing that gives me an array of refinement levels. However, the dimension of this array is the same when I do "index.grid_levels" in the whole computational volume and in the sub-region (or smaller data object). And this dimension is equal to the number of grids I get when I so print_stats() of the whole computational volume. I think this is due to the hierarchy of AMR simulations, in other words, AMR level 5 is inside AMR level 4 and so on. My goal is to obtain the area of each cell in a data object regardless the fact that they have a different level of refinement, so that is why I've been trying to obtain what is the refinement level of every cell in a data object so I can estimate their size and area. Maybe there is another way to do this, do you know how? Cheers,
Maybe you want the cell_volume field? If it’s a 2D simulation that should be equivalent to the area of the cells. It’ll still have units of a 3D volume because yt treats 2D data as 3D but with a dummy z dimension with unit width for all zones. On Sun, Sep 8, 2019 at 2:44 PM Guido Granda Muñoz <guidogranda@gmail.com> wrote:
Hello Nathan and Matthew, Thank you for answering, I tried Nathan approach and doing that gives me an array of refinement levels. However, the dimension of this array is the same when I do "index.grid_levels" in the whole computational volume and in the sub-region (or smaller data object). And this dimension is equal to the number of grids I get when I so print_stats() of the whole computational volume. I think this is due to the hierarchy of AMR simulations, in other words, AMR level 5 is inside AMR level 4 and so on.
My goal is to obtain the area of each cell in a data object regardless the fact that they have a different level of refinement, so that is why I've been trying to obtain what is the refinement level of every cell in a data object so I can estimate their size and area. Maybe there is another way to do this, do you know how?
Cheers, _______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
Alternatively, you can try ad[‘dx’]. It will give you the sides for each cell, so if you pair it with np.unique(ad[‘dx’]), you can obtain the cell size corresponding to the level of refinement that you are interested in. Just a suggestion. Hope it helps! Cheers, BK Boon Kiat Oh PhD Student Institute for Astronomy University of Edinburgh Royal Observatory Blackford Hill Edinburgh EH9 3HJ On 8 Sep 2019, at 9:51 PM, Nathan <nathan.goldbaum@gmail.com<mailto:nathan.goldbaum@gmail.com>> wrote: Maybe you want the cell_volume field? If it’s a 2D simulation that should be equivalent to the area of the cells. It’ll still have units of a 3D volume because yt treats 2D data as 3D but with a dummy z dimension with unit width for all zones. On Sun, Sep 8, 2019 at 2:44 PM Guido Granda Muñoz <guidogranda@gmail.com<mailto:guidogranda@gmail.com>> wrote: Hello Nathan and Matthew, Thank you for answering, I tried Nathan approach and doing that gives me an array of refinement levels. However, the dimension of this array is the same when I do "index.grid_levels" in the whole computational volume and in the sub-region (or smaller data object). And this dimension is equal to the number of grids I get when I so print_stats() of the whole computational volume. I think this is due to the hierarchy of AMR simulations, in other words, AMR level 5 is inside AMR level 4 and so on. My goal is to obtain the area of each cell in a data object regardless the fact that they have a different level of refinement, so that is why I've been trying to obtain what is the refinement level of every cell in a data object so I can estimate their size and area. Maybe there is another way to do this, do you know how? Cheers, _______________________________________________ yt-users mailing list -- yt-users@python.org<mailto:yt-users@python.org> To unsubscribe send an email to yt-users-leave@python.org<mailto:yt-users-leave@python.org> _______________________________________________ yt-users mailing list -- yt-users@python.org<mailto:yt-users@python.org> To unsubscribe send an email to yt-users-leave@python.org<mailto:yt-users-leave@python.org>
Hello, It is a 3D simulation but I want the area of a cell along a given axis, for example the area along the x axis will be dy*dz. I was able to obtain this information using: dy= sp_open.fwidth[:,1] dz= sp_open.fwidth[:,2] where sp_open is the data container of interest. Thank you,
Hi Guido, I'm glad that worked out! Those fields are also available as ['index','dx'] and ['index','dy']. -Matt On Tue, Sep 10, 2019 at 10:44 AM Guido Granda Muñoz <guidogranda@gmail.com> wrote:
Hello, It is a 3D simulation but I want the area of a cell along a given axis, for example the area along the x axis will be dy*dz. I was able to obtain this information using: dy= sp_open.fwidth[:,1] dz= sp_open.fwidth[:,2] where sp_open is the data container of interest. Thank you, _______________________________________________ yt-users mailing list -- yt-users@python.org To unsubscribe send an email to yt-users-leave@python.org
participants (5)
-
Boon Kiat Oh
-
Guido granda muñoz
-
Guido Granda Muñoz
-
Matthew Turk
-
Nathan