Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issues with AMR grids: grid creation #203

Open
smarandeshmukh opened this issue Aug 20, 2018 · 2 comments
Open

Issues with AMR grids: grid creation #203

smarandeshmukh opened this issue Aug 20, 2018 · 2 comments

Comments

@smarandeshmukh
Copy link

Hi,

I was trying to create my own AMR grid for some testing purposes. I have frequently run into the following problem. As an example, I create an AMR grid with two levels: (a) Level 1 -> One large cube of unit length (e.g. 1pc) (b) Level 2 -> this large cube has been subdivided into 8 smaller cubes similar to an octree. Hyperion complains while running the fortran binaries, saying that the walls are not aligned.

############################################################
An example:
level = amr.add_level()
grid = level.add_grid()
grid.xmin, grid.xmax, grid.ymin, grid.ymax, grid.zmin, grid.zmax = 0, pc, 0, pc, 0, pc #Level 1
grid.nx,...,nz = 1,1,1

level = amr.add_level()
grid = level.add_grid()
grid.xmin, grid.xmax, grid.ymin, grid.ymax, grid.zmin, grid.zmax = 0, pc/2, 0, pc/2, 0, pc/2 #Level 2
grid.nx,...,nz = 1,1,1
...
grid.xmin, grid.xmax, grid.ymin, grid.ymax, grid.zmin, grid.zmax = pc/2, pc, pc/2, pc, pc/2, pc #Level 2
grid.nx,...,nz = 1,1,1
###########################################################

The offending line has been highlighted in bold and hyperion says that grid 2 is not aligned with parent cell in level 1 in the xdirection
After examining the source code, I think I have identified the issue (grid_geometry_amr.f90, line 258):

if(.not.aligned(grid%xmin, grid_ref%xmin, grid_ref%width(1))) then

Is there a reason why only the xmin boundaries are checked for alignment? Shouldn't it be a check for xmin OR xmax?
Thanks!

@astrofrog
Copy link
Contributor

@smarandeshmukh - this looks like a typo, I think the call to aligned should include xmin and xmax.

@astrofrog
Copy link
Contributor

Coming back to this, I wonder if the issue is that the level 2 grid should actually have 2,2,2 cells, not 1,1,1? I never got a chance to investigate, but if anyone can take a look, please post your findings here!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants