Problem when concatenate two meshed using FiPy

31 views
Skip to first unread message

shichen zhou

unread,
Mar 29, 2022, 9:15:48 PM3/29/22
to fipy
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

Daniel Wheeler

unread,
Mar 31, 2022, 12:01:56 PM3/31/22
to fipy
Hi Shichen,

Thanks for your question. FiPy can't handle cells that don't have perfectly aligned faces. As you point out, you will need a transition region. For this you should use Gmsh, see https://www.ctcms.nist.gov/fipy/documentation/USAGE.html#meshing-with-gmsh. I believe that Gmsh can do unstructured hex meshes. I was looking around and found this,


It looks like it's a Gmsh generated mesh, but with an unstructured region with a hex mesh joining more structured regions. FiPy works well with Gmsh so go ahead and give it a go and get back to us if things don't work out.

Cheers,

Daniel

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


--
Daniel Wheeler

Guyer, Jonathan E. Dr. (Fed)

unread,
Mar 31, 2022, 12:56:36 PM3/31/22
to FIPY
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:
> <figure2.png>
>
> --
> To unsubscribe from this group, send email to fipy+uns...@list.nist.gov
>
> View this message at https://list.nist.gov/fipy
> <figure1.png><figure2.png>

Reply all
Reply to author
Forward
0 new messages