Periodicity reconstruction in OCC
Dear Professor Geuzaine,
currently working on an Additive Manufacturing project in J.P.Ponthot Lab, i am writing python scripts to build, quite automatically, meshes of VER of Aluminium with Si inclusions.
The model is built using Python API of gmsh and i only use OCC objects to build the model. The model is composed of : - a box - one or many ellipsoid (formally spheres objects dilated and rotated to get ellipsoids) - if an ellipsoid cross the box boundary, symetricals copies are built - ellipsoid are cutted by the box and finally the box is cutted by the remaining part of the ellipsoids - the surfaces of each side of the cube are detected (by BoundingBoxes) and sorted to ensure the same order - the Periodicity of the 6 sides are defined - finally the mesh is performed
While building non regression tests I encourted problems on quite simple tests (1 ellipsoid crossing a line => with 3 symetries) depending of the direction of the ellipsoid : - it work if the ellipsoid cross the X0Y0 line (test meshVerFSP3D_LineX0Y0.py) - it does not work if the ellipsoid cross the Y1Z0 Line (test meshVerFSP3D_LineY1Z0)
The problem seems to come from the periodicity conditions applied on the 6 sides of the box
and particularly in this case on the periodicity between the Z0 and Z1 sides through a Z translation (mesherVerFSP3D.py lines 217 and 240):
transZ = [1,0,0,0, 0,1,0,0, 0,0,1,p['ver'].Lz, 0,0,0,1]
gmsh.model.mesh.setPeriodic(2,p['ver'].sideZ1, p['ver'].sideZ0, transZ)
see below for the full output :
Using getBoundary command i listed the lines of each surface (after the cuts) of the Z0 and Z1 sides of the box. for the corresponding surfaces 15 and 22 it give : on Side Z0 : the surface 15 is composed of lines 31 and 33 on Side Z1 : the surface 22 is composed of lines 42 and 44
But while computing periodicity, the output tells me (where cure 44 would have to be linked to 33 instead of 31) Info : Setting curve master 42 - 31 Info : Setting curve master 44 - 31 Of course while meshing meshing curve 44(Line) as a copy of curve 31(BSpline) fails: Info : [ 20%] Meshing curve 31 (BSpline) Info : [ 50%] Meshing curve 42 (BSpline) as a copy of curve 31 Info : [ 60%] Meshing curve 44 (Line) as a copy of curve 31 Warning : Could not converge parametrisation of (0.434324,0.120541,1) on curve 44, taking parameter with lowest error Warning : Could not converge parametrisation of (0.565676,0.120541,1) on curve 44, taking parameter with lowest error finally meshing surface 22 as a copy of 15 also fails... Info : [ 70%] Meshing surface 22 (Plane) as a copy of surface 15 Error : Could not find periodic counterpart of triangle nodes 44 35 6 Error : Could not find periodic counterpart of triangle nodes 5 34 44 Error : Could not find periodic counterpart of triangle nodes 34 35 44
I tryied to enforce the periodicity on curves (boundaries of the box) by hand I tryied to unaligned the ellipsoid from the axis through small rotations, or some smalls translations with no effect on the problem, changing the 2DMesher, ... I also checked that i synchronized the occ & gmsh kernel as often as needed (certainly too often)
the behavior is identical using (i did not go further on sytems testings):
- Win10 / Python3.7.7 / gmsh sdk 4.5.6
- Win10 / Python3.7.7 / gmsh sdk 4.6.0
- Debian 10 / python 3.7.7 / gmsh sdk 4.5.6
It really looks like a bug in the OCC detection of corresponding lines of surfaces Do you have an idea how could i workaround it ? I put you the python scripts generating the Error (just
Thanks in advances
Luc Papeleux
#=========================================================================== Output meshVerFSP3D_LineY1Z0:
Debug Periodicity
p['ver'].sideX0 [23]
surf 23 composed of curves : [(1, 45), (1, 46), (1, 47), (1, 48)]
p['ver'].sideX1 [28]
surf 28 composed of curves : [(1, 51), (1, 56), (1, 59), (1, 60)]
p['ver'].sideY0 [24, 21, 16]
surf 24 composed of curves : [(1, 32), (1, 41), (1, 43), (1, 45), (1, 49), (1, 50), (1, 51), (1, 52), (1, 53)]
surf 21 composed of curves : [(1, 41), (1, 43), (1, 44)]
surf 16 composed of curves : [(1, 32), (1, 33)]
p['ver'].sideY1 [26, 19, 13]
surf 26 composed of curves : [(1, 27), (1, 35), (1, 36), (1, 47), (1, 54), (1, 55), (1, 57), (1, 58), (1, 59)]
surf 19 composed of curves : [(1, 35), (1, 36), (1, 40)]
surf 13 composed of curves : [(1, 27), (1, 30)]
p['ver'].sideZ0 [15, 27, 12]
surf 15 composed of curves : [(1, 31), (1, 33)]
surf 27 composed of curves : [(1, 26), (1, 28), (1, 31), (1, 48), (1, 49), (1, 50), (1, 57), (1, 58), (1, 60)]
surf 12 composed of curves : [(1, 26), (1, 28), (1, 30)]
p['ver'].sideZ1 [22, 25, 18]
surf 22 composed of curves : [(1, 42), (1, 44)]
surf 25 composed of curves : [(1, 34), (1, 37), (1, 42), (1, 46), (1, 52), (1, 53), (1, 54), (1, 55), (1, 56)]
surf 18 composed of curves : [(1, 34), (1, 37), (1, 40)]
fin Debug Periodicity
Info : Setting mesh master using transformation
Info : Setting curve master 60 - 48
Info : Setting curve master 51 - 45
Info : Setting curve master 59 - 47
Info : Setting curve master 56 - 46
Info : Setting mesh master using transformation
Info : Setting curve master 27 - 32
Info : Setting curve master 35 - 41
Info : Setting curve master 55 - 52
Info : Setting curve master 36 - 43
Info : Setting curve master 58 - 50
Info : Setting curve master 54 - 53
Info : Setting curve master 59 - 51
Info : Setting curve master 57 - 49
Info : Setting curve master 47 - 45
Info : Setting mesh master using transformation
Info : Setting curve master 35 - 41
Info : Setting curve master 36 - 43
Info : Setting curve master 40 - 44
Info : Setting mesh master using transformation
Info : Setting curve master 30 - 33
Info : Setting curve master 27 - 32
Info : Setting mesh master using transformation
Info : Setting curve master 42 - 31
Info : Setting curve master 44 - 31
Info : Setting mesh master using transformation
Info : Setting curve master 52 - 50
Info : Setting curve master 34 - 28
Info : Setting curve master 55 - 58
Info : Setting curve master 37 - 26
Info : Setting curve master 54 - 57
Info : Setting curve master 42 - 31
Info : Setting curve master 46 - 48
Info : Setting curve master 53 - 49
Info : Setting curve master 56 - 60
Info : Setting mesh master using transformation
Info : Setting curve master 34 - 28
Info : Setting curve master 40 - 30
Info : Setting curve master 37 - 26
Info : Reconstructing periodicity for curve connection 27 - 32
Info : Reconstructing periodicity for curve connection 30 - 33
Info : Reconstructing periodicity for curve connection 34 - 28
Info : Reconstructing periodicity for curve connection 35 - 41
Info : Reconstructing periodicity for curve connection 36 - 43
Info : Reconstructing periodicity for curve connection 37 - 26
Info : Reconstructing periodicity for curve connection 40 - 30
Info : Reconstructing periodicity for curve connection 42 - 31
Info : Reconstructing periodicity for curve connection 44 - 31
Info : Reconstructing periodicity for curve connection 46 - 48
Info : Reconstructing periodicity for curve connection 47 - 45
Info : Reconstructing periodicity for curve connection 51 - 45
Info : Reconstructing periodicity for curve connection 52 - 50
Info : Reconstructing periodicity for curve connection 53 - 49
Info : Reconstructing periodicity for curve connection 54 - 57
Info : Reconstructing periodicity for curve connection 55 - 58
Info : Reconstructing periodicity for curve connection 56 - 60
Info : Reconstructing periodicity for curve connection 57 - 49
Info : Reconstructing periodicity for curve connection 58 - 50
Info : Reconstructing periodicity for curve connection 59 - 51
Info : Reconstructing periodicity for curve connection 60 - 48
Info : Reconstructing periodicity for surface connection 13 - 16
Info : Reconstructing periodicity for surface connection 18 - 12
Info : Reconstructing periodicity for surface connection 19 - 21
Info : Reconstructing periodicity for surface connection 22 - 15
Info : Reconstructing periodicity for surface connection 25 - 27
Info : Reconstructing periodicity for surface connection 26 - 24
Info : Reconstructing periodicity for surface connection 28 - 23
Info : Meshing 1D...
Info : [ 0%] Meshing curve 25 (TrimmedCurve)
Info : [ 10%] Meshing curve 26 (BSpline)
Info : [ 10%] Meshing curve 28 (BSpline)
Info : [ 20%] Meshing curve 31 (BSpline)
Info : [ 20%] Meshing curve 32 (BSpline)
Info : [ 30%] Meshing curve 33 (Line)
Info : [ 30%] Meshing curve 34 (BSpline) as a copy of curve 28
Info : [ 40%] Meshing curve 37 (BSpline) as a copy of curve 26
Info : [ 40%] Meshing curve 38 (TrimmedCurve)
Info : [ 50%] Meshing curve 41 (BSpline)
Info : [ 50%] Meshing curve 42 (BSpline) as a copy of curve 31
Info : [ 50%] Meshing curve 43 (BSpline)
Info : [ 60%] Meshing curve 44 (Line) as a copy of curve 31
Warning : Could not converge parametrisation of (0.434324,0.120541,1) on curve 44, taking parameter with lowest error
Warning : Could not converge parametrisation of (0.565676,0.120541,1) on curve 44, taking parameter with lowest error
Info : [ 60%] Meshing curve 45 (Line)
Info : [ 70%] Meshing curve 47 (Line) as a copy of curve 45
Info : [ 70%] Meshing curve 48 (Line)
Info : [ 70%] Meshing curve 49 (Line)
Info : [ 70%] Meshing curve 50 (Line)
Info : [ 80%] Meshing curve 51 (Line) as a copy of curve 45
Info : [ 80%] Meshing curve 52 (Line) as a copy of curve 50
Info : [ 80%] Meshing curve 53 (Line) as a copy of curve 49
Info : [ 90%] Meshing curve 57 (Line) as a copy of curve 49
Info : [100%] Meshing curve 58 (Line) as a copy of curve 50
Info : [100%] Meshing curve 59 (Line) as a copy of curve 51
Info : [100%] Meshing curve 60 (Line) as a copy of curve 48
Info : [100%] Meshing curve 27 (BSpline) as a copy of curve 32
Info : [100%] Meshing curve 30 (Line) as a copy of curve 33
Info : [100%] Meshing curve 35 (BSpline) as a copy of curve 41
Info : [100%] Meshing curve 36 (BSpline) as a copy of curve 43
Info : [100%] Meshing curve 40 (Line) as a copy of curve 30
Info : [100%] Meshing curve 46 (Line) as a copy of curve 48
Info : [100%] Meshing curve 54 (Line) as a copy of curve 57
Info : [100%] Meshing curve 55 (Line) as a copy of curve 58
Info : [100%] Meshing curve 56 (Line) as a copy of curve 60
Info : Done meshing 1D (Wall 0.153s, CPU 0.140625s)
Info : Meshing 2D...
Info : [ 0%] Meshing surface 11 (BSpline surface, Frontal-Delaunay)
Info : [ 10%] Meshing surface 12 (Plane, Frontal-Delaunay)
Info : [ 20%] Meshing surface 14 (BSpline surface, Frontal-Delaunay)
Info : [ 30%] Meshing surface 15 (Plane, Frontal-Delaunay)
Info : [ 30%] Meshing surface 16 (Plane, Frontal-Delaunay)
Info : [ 40%] Meshing surface 17 (BSpline surface, Frontal-Delaunay)
Info : [ 40%] Meshing surface 18 (Plane) as a copy of surface 12
Info : [ 50%] Meshing surface 20 (BSpline surface, Frontal-Delaunay)
Info : [ 60%] Meshing surface 21 (Plane, Frontal-Delaunay)
Info : [ 70%] Meshing surface 22 (Plane) as a copy of surface 15
Error : Could not find periodic counterpart of triangle nodes 44 35 6
Error : Could not find periodic counterpart of triangle nodes 5 34 44
Error : Could not find periodic counterpart of triangle nodes 34 35 44
Info : [ 70%] Meshing surface 23 (Plane, Frontal-Delaunay)
Info : [ 80%] Meshing surface 24 (Plane, Frontal-Delaunay)
Info : [ 90%] Meshing surface 26 (Plane) as a copy of surface 24
Info : [ 90%] Meshing surface 27 (Plane, Frontal-Delaunay)
Info : [100%] Meshing surface 28 (Plane) as a copy of surface 23
Info : [100%] Meshing surface 13 (Plane) as a copy of surface 16
Info : [100%] Meshing surface 19 (Plane) as a copy of surface 21
Error : Periodic meshing of surface 19 with surface 21: curve 40 has 1 vertices, whereas correspondant 44 has 2
Error : Could not find periodic counterpart of triangle nodes 53 58 228
Error : Could not find periodic counterpart of triangle nodes 53 12 58
Error : Could not find periodic counterpart of triangle nodes 58 57 228
Info : [100%] Meshing surface 25 (Plane) as a copy of surface 27
Info : Done meshing 2D (Wall 0.103s, CPU 0.0625s)
Info : Meshing 3D...
Info : 3D Meshing 5 volumes with 1 connected component
Info : Tetrahedrizing 413 nodes...
Info : Done tetrahedrizing 421 nodes (Wall 0.0120001s, CPU 0.015625s)
Error : No elements in volume 1 2 3 4 5
Info : Done meshing 3D (Wall 0.017s, CPU 0.015625s)
Info : Reconstructing periodicity for curve connection 27 - 32
Info : Reconstructing periodicity for curve connection 30 - 33
Info : Reconstructing periodicity for curve connection 34 - 28
Info : Reconstructing periodicity for curve connection 35 - 41
Info : Reconstructing periodicity for curve connection 36 - 43
Info : Reconstructing periodicity for curve connection 37 - 26
Info : Reconstructing periodicity for curve connection 40 - 30
Info : Reconstructing periodicity for curve connection 42 - 31
Info : Reconstructing periodicity for curve connection 44 - 31
Info : Reconstructing periodicity for curve connection 46 - 48
Info : Reconstructing periodicity for curve connection 47 - 45
Info : Reconstructing periodicity for curve connection 51 - 45
Info : Reconstructing periodicity for curve connection 52 - 50
Info : Reconstructing periodicity for curve connection 53 - 49
Info : Reconstructing periodicity for curve connection 54 - 57
Info : Reconstructing periodicity for curve connection 55 - 58
Info : Reconstructing periodicity for curve connection 56 - 60
Info : Reconstructing periodicity for curve connection 57 - 49
Info : Reconstructing periodicity for curve connection 58 - 50
Info : Reconstructing periodicity for curve connection 59 - 51
Info : Reconstructing periodicity for curve connection 60 - 48
Info : Reconstructing periodicity for surface connection 13 - 16
Info : Reconstructing periodicity for surface connection 18 - 12
Info : Reconstructing periodicity for surface connection 19 - 21
Info : Reconstructing periodicity for surface connection 22 - 15
Info : Reconstructing periodicity for surface connection 25 - 27
Info : Reconstructing periodicity for surface connection 26 - 24
Info : Reconstructing periodicity for surface connection 28 - 23
Info : 413 nodes 1010 elements
Error : ------------------------------
Error : Mesh generation error summary
Error : 2 warnings
Error : 8 errors
Error : Check the full log for details
Error : ------------------------------
#=========================================================================== gmshTools3D.py mesherVerFSP3D.py meshVerFSP3D_LineX0Y0.py meshVerFSP3D_LineY1Z0.py #===========================================================================