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

> On Mar 29, 2022, at 9:15 PM, shichen zhou <[email protected]> wrote:
> 
> I am working on a CFD-DEM model in PFC 6.0 into which python3.6 and FiPy 3.3 
> are embedded. The fluid domain is a cuboid that is divided into two small 
> cuboids, one with dense meshing and the other one with coarse meshing. I 
> wanted to concatenate the two subdomains, and thus I wrote,
> 
> import fipy as fp        
> def _init_(self):
> self.mesh = fp.Grid3D(nx=10, ny=4, nz=10, dx=0.01, dy=0.01, dz=0.01) + 
> (fp.Grid3D(nx=5, ny=8, nz=5, dx=0.02, dy=0.02, dz=0.02) + ((0,), (0.04,), 
> (0,)))
> ... ...
> 
> As expected, the resulting mesh does not have the intended connectivity 
> (figure 1). To exchange data across the two subdomains, the nodes at the 
> intersurface need to be processed further. A transition subdomain should be 
> included (figure 2). I have no idea how to solve this issue. would you like 
> to give me some advice? To be noted that my operation system is Windows 10, 
> 64 bit. I would be appreciated it if you could help me.
> 
> figure 1
> <figure1.png>
> figure 2:
> <figure2.png>
> 
> -- 
> To unsubscribe from this group, send email to [email protected]
>  
> View this message at https://list.nist.gov/fipy
> <figure1.png><figure2.png>

-- 
To unsubscribe from this group, send email to [email protected]

View this message at https://list.nist.gov/fipy
--- 
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].

Reply via email to