Mesh over a pill


150
views
0
3 months ago by
Davide  
Hello,

I would like to generate a mesh in "slightly complex" domains, for example a 3d pill-shape domain. Here I copy a simple code:

-----------------------------------------------------------------
from fenics import *
from dolfin import *
import mshr as mshr

Omega = mshr.Sphere(Point(0,0,0), 5) + mshr.Cylinder(Point(0,0,0), Point(10,0,0), 5, 5) + mshr.Sphere(Point(10,0,0), 5)

domain_mesh = mshr.generate_mesh(Omega,20)
-----------------------------------------------------------------

In this way, the code takes ages to work and actually I feel it gets stuck.  If instead I use the code:


-----------------------------------------------------------------
from fenics import *
from dolfin import *
import mshr as mshr

Omega = mshr.Sphere(Point(0,0,0), 5, 3) + mshr.Cylinder(Point(0,0,0), Point(10,0,0), 5, 5, 15) + mshr.Sphere(Point(10,0,0), 5, 3)

domain_mesh = mshr.generate_mesh(Omega,20)
-----------------------------------------------------------------

In which I am simply defining the values for the precision in Sphere and Cylinder, this generates a very heterogeneous mesh, with very tiny elements around the boundary between the half spheres and the cylinder (see picture). I believe this is generated by the fact that the sides of the 2 polyhedra (half spheres and cylinder) are not matching, so the question is actually how can I match these through the polyhedral approximation, getting a more uniform mesh.

I would be grateful if you could help,

Thanks in advance,

Davide


  
Community: FEniCS Project
1
Try gmsh for greater control http://gmsh.info/.
written 3 months ago by Nate  
1
Or Salome https://www.salome-platform.org/
written 3 months ago by klunkean  
Thank you very much, I will try both!
written 3 months ago by Davide  

1 Answer


0
3 months ago by
I'd say try pygalmesh https://github.com/nschloe/pygalmesh (a small project of mine).


Please login to add an answer/comment or follow this question.

Similar posts:
Search »