Shichen -
In addition to Daniel’s pointer to hexahedral Gmsh meshes, which I was unaware of, here are a couple of other approaches:
* Is it critical that the subdomains be rectilinear grids? If not, then a relatively easy thing to do is to mesh the domain uniformly with Gmsh, and then remesh with a “background” variable to specify the cells sizes you want in different domains. I offer an example here:
https://gist.github.com/guyer/c46051ddb7c4ad9fdf80ac57205945b1
If you only define the outer bounds of the combined grids and attempt to refine that, Gmsh tends to produce an irregular boundary between them. Most of the GEO script is about creating two separate, adjacent volumes. While writing the GEO script is not entertaining, something like FreeCAD should make that pretty easy.
* If you need to have grids, then it’s necessary to create grafting cells that have four faces on one side of the cube and one face on the opposite. I’ve put together a notebook that does this at:
https://gist.github.com/guyer/0972a8366d399b8a15098de168553556
This is not a general solution, as it only works along the y-axis and it makes a lot of assumptions.
Note, in order for this second notebook to work, it requires the
https://github.com/usnistgov/fipy/tree/graft_grid branch that I just pushed. Beware: somehow, I’ve broken the checks for concatenating meshes that don’t align.
- Jon
> <figure1.png>
> figure 2:
> <figure1.png><figure2.png>