Thanks for the reply, I forgot to provide the mesh. The following code generates the mesh in GMSH.
import gmsh
import sys
##################
gmsh.initialize()
gmsh.model.add("Model")
# ===================================== Goccmetry ======================
import gmsh
import sys
import math
gmsh.initialize()
Fl = 1e-3
lc = 0.0
h = 0.76e-3 / Fl
d1 = 1.13e-3 / Fl
d2 = d1
lb = 0.1e-3 / Fl
tb = 0.1e-3 / Fl
theta = math.atan(h / (0.5 * (0.00272 / Fl - d1))) #54.74
Points = [[0, 0, 0], [2 * lb + d1 + 2 * h / math.tan(theta), 0, 0],
[2 * lb + d1 + 2 * h / math.tan(theta), 2 * lb + d2 + 2 * h / math.tan(theta), 0],
[0, 2 * lb + d2 + 2 * h / math.tan(theta), 0]]
print(d1 + 2 * h / math.tan(theta))
PN = 1 # point Number
LN = 1 # Line Number
SN = 1 # Surface Number
VN = 1 # Volum Number
Vol_list = []
Sur_list = []
Sur_list2 = []
Sur_list3 = []
Sur_list4 = []
Sur_list5 = []
Sur_list6 = []
Edge_list_1 = [] # top edges
Edge_list_2 = [] # Bottom edges
Edge_list_3 = [] # Side edges
Edge_list_4 = [] # in-plane edges
Edge_list_5 = [] # corner edges
Edge_list_6 = [] # Base edges
i=0
gmsh.model.geo.addPoint(Points[i][0] + lb + h / math.tan(theta), Points[i][1] + lb + h / math.tan(theta), tb + h,
lc, PN)
PN += 1
gmsh.model.geo.addPoint(Points[i][0] + lb + h / math.tan(theta) + d1, Points[i][1] + lb + h / math.tan(theta),
tb + h, lc, PN)
PN += 1
gmsh.model.geo.addLine(PN - 2, PN - 1, LN)
Edge_list_1.append(LN)
LN += 1
gmsh.model.geo.addPoint(Points[i][0] + lb + h / math.tan(theta) + d1, Points[i][1] + lb + h / math.tan(theta) + d2,
tb + h, lc, PN)
PN += 1
gmsh.model.geo.addLine(PN - 2, PN - 1, LN)
Edge_list_1.append(LN)
LN += 1
gmsh.model.geo.addPoint(Points[i][0] + lb + h / math.tan(theta), Points[i][1] + lb + h / math.tan(theta) + d2,
tb + h, lc, PN)
PN += 1
gmsh.model.geo.addLine(PN - 2, PN - 1, LN)
Edge_list_1.append(LN)
LN += 1
gmsh.model.geo.addLine(PN - 1, PN - 4, LN)
Edge_list_1.append(LN)
LN += 1
#########
gmsh.model.geo.addPoint(Points[i][0] + lb, Points[i][1] + lb, tb, lc, PN)
PN += 1
gmsh.model.geo.addPoint(Points[i][0] + lb + 2 * h / math.tan(theta) + d1, Points[i][1] + lb, tb, lc, PN)
PN += 1
gmsh.model.geo.addLine(PN - 2, PN - 1, LN)
Edge_list_2.append(LN)
LN += 1
gmsh.model.geo.addPoint(Points[i][0] + lb + 2 * h / math.tan(theta) + d1,
Points[i][1] + lb + 2 * h / math.tan(theta) + d2, tb, lc, PN)
PN += 1
gmsh.model.geo.addLine(PN - 2, PN - 1, LN)
Edge_list_2.append(LN)
LN += 1
gmsh.model.geo.addPoint(Points[i][0] + lb, Points[i][1] + lb + 2 * h / math.tan(theta) + d2, tb, lc, PN)
PN += 1
gmsh.model.geo.addLine(PN - 2, PN - 1, LN)
Edge_list_2.append(LN)
LN += 1
gmsh.model.geo.addLine(PN - 1, PN - 4, LN)
Edge_list_2.append(LN)
LN += 1
####################
gmsh.model.geo.addLine(PN - 8, PN - 4, LN)
Edge_list_3.append(LN)
LN += 1
gmsh.model.geo.addLine(PN - 7, PN - 3, LN)
Edge_list_3.append(LN)
LN += 1
gmsh.model.geo.addLine(PN - 6, PN - 2, LN)
Edge_list_3.append(LN)
LN += 1
gmsh.model.geo.addLine(PN - 5, PN - 1, LN)
Edge_list_3.append(LN)
LN += 1
####################
gmsh.model.geo.addCurveLoop([LN - 12, LN - 11, LN - 10, LN - 9], SN)
gmsh.model.geo.addPlaneSurface([SN], SN)
SN += 1
Sur_list.append(SN - 1)
gmsh.model.geo.addCurveLoop([LN - 12, (LN - 3), -(LN - 8), -(LN - 4)], SN)
gmsh.model.geo.addPlaneSurface([SN], SN)
SN += 1
Sur_list.append(SN - 1)
gmsh.model.geo.addCurveLoop([LN - 11, (LN - 2), -(LN - 7), -(LN - 3)], SN)
gmsh.model.geo.addPlaneSurface([SN], SN)
SN += 1
Sur_list.append(SN - 1)
gmsh.model.geo.addCurveLoop([LN - 10, (LN - 1), -(LN - 6), -(LN - 2)], SN)
gmsh.model.geo.addPlaneSurface([SN], SN)
SN += 1
Sur_list.append(SN - 1)
gmsh.model.geo.addCurveLoop([LN - 9, (LN - 4), -(LN - 5), -(LN - 1)], SN)
gmsh.model.geo.addPlaneSurface([SN], SN)
SN += 1
Sur_list.append(SN - 1)
gmsh.model.geo.addCurveLoop([LN - 8, LN - 7, LN - 6, LN - 5], SN)
gmsh.model.geo.addPlaneSurface([SN], SN)
SN += 1
Sur_list.append(SN - 1)
print(SN)
gmsh.model.geo.addSurfaceLoop([SN - 1, SN - 2, SN - 3, SN - 4, SN - 5, SN - 6], VN)
gmsh.model.geo.addVolume([VN], VN)
Vol_list.append(VN)
VN += 1
gmsh.model.geo.addPoint(Points[i][0], Points[i][1], tb, lc, PN)
PN += 1
gmsh.model.geo.addPoint(Points[i][0] + lb + 2 * h / math.tan(theta) + d1 + lb, Points[i][1], tb, lc, PN)
PN += 1
gmsh.model.geo.addPoint(Points[i][0] + lb + 2 * h / math.tan(theta) + d1 + lb,
Points[i][1] + 2 * lb + 2 * h / math.tan(theta) + d2, tb, lc, PN)
PN += 1
gmsh.model.geo.addPoint(Points[i][0], Points[i][1] + 2 * lb + 2 * h / math.tan(theta) + d2, tb, lc, PN)
PN += 1
gmsh.model.geo.addLine(PN - 8, PN - 4, LN)
LN += 1
Edge_list_4.append(LN - 1)
gmsh.model.geo.addLine(PN - 7, PN - 3, LN)
LN += 1
Edge_list_4.append(LN - 1)
gmsh.model.geo.addLine(PN - 6, PN - 2, LN)
LN += 1
Edge_list_4.append(LN - 1)
gmsh.model.geo.addLine(PN - 5, PN - 1, LN)
LN += 1
Edge_list_4.append(LN - 1)
gmsh.model.geo.addLine(PN - 4, PN - 3, LN)
LN += 1
Edge_list_5.append(LN - 1)
gmsh.model.geo.addLine(PN - 3, PN - 2, LN)
LN += 1
Edge_list_5.append(LN - 1)
gmsh.model.geo.addLine(PN - 2, PN - 1, LN)
LN += 1
Edge_list_5.append(LN - 1)
gmsh.model.geo.addLine(PN - 1, PN - 4, LN)
LN += 1
Edge_list_5.append(LN - 1)
gmsh.model.geo.addCurveLoop([LN - 16, LN - 7, -(LN - 4), -(LN - 8)], SN)
gmsh.model.geo.addPlaneSurface([SN], SN)
SN += 1
Sur_list2.append(SN - 1)
gmsh.model.geo.addCurveLoop([LN - 15, LN - 6, -(LN - 3), -(LN - 7)], SN)
gmsh.model.geo.addPlaneSurface([SN], SN)
SN += 1
Sur_list3.append(SN - 1)
gmsh.model.geo.addCurveLoop([LN - 14, LN - 5, -(LN - 2), -(LN - 6)], SN)
gmsh.model.geo.addPlaneSurface([SN], SN)
SN += 1
Sur_list4.append(SN - 1)
gmsh.model.geo.addCurveLoop([LN - 13, LN - 8, -(LN - 1), -(LN - 5)], SN)
gmsh.model.geo.addPlaneSurface([SN], SN)
SN += 1
Sur_list5.append(SN - 1)
gmsh.model.geo.synchronize()
Corner_points = [PN - 4, PN - 3, PN - 2, PN - 1]
Left_down_corner = gmsh.model.getValue(0, Corner_points[0], [])
Right_down_corner = gmsh.model.getValue(0, Corner_points[1], [])
Right_up_corner = gmsh.model.getValue(0, Corner_points[2], [])
Left_up_corner = gmsh.model.getValue(0, Corner_points[3], [])
gmsh.model.geo.addPoint(Left_down_corner[0], Left_down_corner[1], 0, lc, PN)
PN += 1
gmsh.model.geo.addPoint(Right_down_corner[0], Right_down_corner[1], 0, lc, PN)
PN += 1
gmsh.model.geo.addPoint(Right_up_corner[0], Right_up_corner[1], 0, lc, PN)
PN += 1
gmsh.model.geo.addPoint(Left_up_corner[0], Left_up_corner[1], 0, lc, PN)
PN += 1
gmsh.model.geo.addLine(PN - 8, PN - 4, LN)
LN += 1
Edge_list_6.append(LN-1)
gmsh.model.geo.addLine(PN - 7, PN - 3, LN)
LN += 1
Edge_list_6.append(LN - 1)
gmsh.model.geo.addLine(PN - 6, PN - 2, LN)
LN += 1
Edge_list_6.append(LN - 1)
gmsh.model.geo.addLine(PN - 5, PN - 1, LN)
LN += 1
Edge_list_6.append(LN - 1)
gmsh.model.geo.addLine(PN - 4, PN - 3, LN)
LN += 1
Edge_list_5.append(LN - 1)
gmsh.model.geo.addLine(PN - 3, PN - 2, LN)
LN += 1
Edge_list_5.append(LN - 1)
gmsh.model.geo.addLine(PN - 2, PN - 1, LN)
LN += 1
Edge_list_5.append(LN - 1)
gmsh.model.geo.addLine(PN - 1, PN - 4, LN)
LN += 1
Edge_list_5.append(LN - 1)
gmsh.model.geo.addCurveLoop([LN - 12, LN - 7, -(LN - 4), -(LN - 8)], SN)
gmsh.model.geo.addPlaneSurface([SN], SN)
SN += 1
Sur_list2.append(SN - 1)
gmsh.model.geo.addCurveLoop([LN - 11, LN - 6, -(LN - 3), -(LN - 7)], SN)
gmsh.model.geo.addPlaneSurface([SN], SN)
SN += 1
Sur_list3.append(SN - 1)
gmsh.model.geo.addCurveLoop([LN - 10, LN - 5, -(LN - 2), -(LN - 6)], SN)
gmsh.model.geo.addPlaneSurface([SN], SN)
SN += 1
Sur_list4.append(SN - 1)
gmsh.model.geo.addCurveLoop([LN - 9, LN - 8, -(LN - 1), -(LN - 5)], SN)
gmsh.model.geo.addPlaneSurface([SN], SN)
SN += 1
Sur_list5.append(SN - 1)
gmsh.model.geo.synchronize()
Corner_points = [PN - 12, PN - 11, PN - 10, PN - 9]
Left_down_corner = gmsh.model.getValue(0, Corner_points[0], [])
Right_down_corner = gmsh.model.getValue(0, Corner_points[1], [])
Right_up_corner = gmsh.model.getValue(0, Corner_points[2], [])
Left_up_corner = gmsh.model.getValue(0, Corner_points[3], [])
gmsh.model.geo.addPoint(Left_down_corner[0], Left_down_corner[1], 0, lc, PN)
PN += 1
gmsh.model.geo.addPoint(Right_down_corner[0], Right_down_corner[1], 0, lc, PN)
PN += 1
gmsh.model.geo.addPoint(Right_up_corner[0], Right_up_corner[1], 0, lc, PN)
PN += 1
gmsh.model.geo.addPoint(Left_up_corner[0], Left_up_corner[1], 0, lc, PN)
PN += 1
gmsh.model.geo.addLine(PN - 8, PN - 4, LN)
LN += 1
Edge_list_4.append(LN-1)
gmsh.model.geo.addLine(PN - 7, PN - 3, LN)
LN += 1
Edge_list_4.append(LN - 1)
gmsh.model.geo.addLine(PN - 6, PN - 2, LN)
LN += 1
Edge_list_4.append(LN - 1)
gmsh.model.geo.addLine(PN - 5, PN - 1, LN)
LN += 1
Edge_list_4.append(LN - 1)
# ################3
gmsh.model.geo.addLine(PN - 4, PN - 16, LN)
LN += 1
Edge_list_6.append(LN - 1)
gmsh.model.geo.addLine(PN - 3, PN - 15, LN)
LN += 1
Edge_list_6.append(LN - 1)
gmsh.model.geo.addLine(PN - 2, PN - 14, LN)
LN += 1
Edge_list_6.append(LN - 1)
gmsh.model.geo.addLine(PN - 1, PN - 13, LN)
LN += 1
Edge_list_6.append(LN - 1)
################
gmsh.model.geo.addLine(PN - 4, PN - 3, LN)
LN += 1
Edge_list_5.append(LN - 1)
gmsh.model.geo.addLine(PN - 3, PN - 2, LN)
LN += 1
Edge_list_5.append(LN - 1)
gmsh.model.geo.addLine(PN - 2, PN - 1, LN)
LN += 1
Edge_list_5.append(LN - 1)
gmsh.model.geo.addLine(PN - 1, PN - 4, LN)
LN += 1
Edge_list_5.append(LN - 1)
# ################################
gmsh.model.geo.addCurveLoop([LN - 28, LN - 20, (LN - 12), (LN - 8)], SN)
gmsh.model.geo.addPlaneSurface([SN], SN)
SN += 1
Sur_list2.append(SN - 1)
Sur_list5.append(SN - 1)
gmsh.model.geo.addCurveLoop([LN - 16, LN - 11, -(LN - 4), -(LN - 12)], SN)
gmsh.model.geo.addPlaneSurface([SN], SN)
SN += 1
Sur_list2.append(SN - 1)
gmsh.model.geo.addCurveLoop([LN - 27, LN - 19, (LN - 11), (LN - 7)], SN)
gmsh.model.geo.addPlaneSurface([SN], SN)
SN += 1
Sur_list2.append(SN - 1)
Sur_list3.append(SN - 1)
gmsh.model.geo.addCurveLoop([LN - 4, LN - 7, -(LN - 36), -(LN - 8)], SN)
gmsh.model.geo.addPlaneSurface([SN], SN)
SN += 1
Sur_list2.append(SN - 1)
gmsh.model.geo.addSurfaceLoop(Sur_list2, VN)
gmsh.model.geo.addVolume([VN], VN)
Vol_list.append(VN)
VN += 1
############################
gmsh.model.geo.addCurveLoop([LN - 3, LN - 6, -(LN - 35), -(LN - 7)], SN)
gmsh.model.geo.addPlaneSurface([SN], SN)
SN += 1
Sur_list3.append(SN - 1)
gmsh.model.geo.addCurveLoop([LN - 15, LN - 10, -(LN - 3), -(LN - 11)], SN)
gmsh.model.geo.addPlaneSurface([SN], SN)
SN += 1
Sur_list3.append(SN - 1)
gmsh.model.geo.addCurveLoop([LN - 10, LN - 6, (LN - 26), (LN - 18)], SN)
gmsh.model.geo.addPlaneSurface([SN], SN)
SN += 1
Sur_list3.append(SN - 1)
gmsh.model.geo.addSurfaceLoop(Sur_list3, VN)
gmsh.model.geo.addVolume([VN], VN)
Vol_list.append(VN)
VN += 1
Sur_list4.append(SN - 1)
################################
gmsh.model.geo.addCurveLoop([LN - 14, LN - 9, -(LN - 2), -(LN - 10)], SN)
gmsh.model.geo.addPlaneSurface([SN], SN)
SN += 1
Sur_list4.append(SN - 1)
gmsh.model.geo.addCurveLoop([LN - 2, LN - 5, -(LN - 34), -(LN - 6)], SN)
gmsh.model.geo.addPlaneSurface([SN], SN)
SN += 1
Sur_list4.append(SN - 1)
gmsh.model.geo.addCurveLoop([LN - 9, LN - 5, (LN - 25), (LN - 17)], SN)
gmsh.model.geo.addPlaneSurface([SN], SN)
SN += 1
Sur_list4.append(SN - 1)
gmsh.model.geo.addSurfaceLoop(Sur_list4, VN)
gmsh.model.geo.addVolume([VN], VN)
Vol_list.append(VN)
VN += 1
Sur_list5.append(SN - 1)
###############################
gmsh.model.geo.addCurveLoop([LN - 13, LN - 12, -(LN - 1), -(LN - 9)], SN)
gmsh.model.geo.addPlaneSurface([SN], SN)
SN += 1
Sur_list5.append(SN - 1)
gmsh.model.geo.addCurveLoop([LN - 1, LN - 8, -(LN - 33), -(LN - 5)], SN)
gmsh.model.geo.addPlaneSurface([SN], SN)
SN += 1
Sur_list5.append(SN - 1)
gmsh.model.geo.addSurfaceLoop(Sur_list5, VN)
gmsh.model.geo.addVolume([VN], VN)
Vol_list.append(VN)
VN += 1
######################################
Sur_list6 = [SN-21, SN-9, SN-8, SN-4, SN-1]
gmsh.model.geo.addCurveLoop([LN - 4, LN - 3, (LN - 2), (LN - 1)], SN)
gmsh.model.geo.addPlaneSurface([SN], SN)
SN += 1
Sur_list6.append(SN - 1)
gmsh.model.geo.addSurfaceLoop(Sur_list6, VN)
gmsh.model.geo.addVolume([VN], VN)
Vol_list.append(VN)
VN += 1
# ===================================== Mesh Option ======================
## UP
N_up = 50
type_up = "Bump"
R_up = 0.5
## Bottom
N_bottom = N_up
type_bottom = "Bump"
R_bottom = 0.5
## Side
N_side = 60
type_side = "Bump"
R_side = 1
####
N_inPlane = 6
###
N_base= 6
# ----------------------- UP
for i in Edge_list_1:
gmsh.model.geo.mesh.setTransfiniteCurve(i, N_up, type_up, R_up)
for i in Edge_list_2:
gmsh.model.geo.mesh.setTransfiniteCurve(i, N_bottom, type_bottom, R_bottom)
for i in Edge_list_3:
gmsh.model.geo.mesh.setTransfiniteCurve(i, N_side, type_side, R_side)
for i in Edge_list_4:
gmsh.model.geo.mesh.setTransfiniteCurve(i, N_inPlane)#, type_side, R_side)
for i in Edge_list_5:
gmsh.model.geo.mesh.setTransfiniteCurve(i, N_bottom)#, type_side, R_side)
for i in Edge_list_6:
gmsh.model.geo.mesh.setTransfiniteCurve(i, N_base)#, type_side, R_side)
for i in Sur_list + Sur_list2 +Sur_list3 + Sur_list4 + Sur_list5 + Sur_list6:
gmsh.model.geo.mesh.setTransfiniteSurface(i)
for i in Sur_list + Sur_list2 +Sur_list3 + Sur_list4 + Sur_list5 + Sur_list6:
gmsh.model.geo.mesh.setRecombine(2, i)
for i in Vol_list:
gmsh.model.geo.mesh.setTransfiniteVolume(i)
gmsh.model.geo.remove_all_duplicates()
gmsh.model.geo.synchronize()
gmsh.model.addPhysicalGroup(3, Vol_list, name="Pyramid")
gmsh.option.setNumber('Mesh.MeshSizeMax', 0.005)
gmsh.model.geo.synchronize()
gmsh.model.mesh.generate(3)
# ##############
gmsh.write("Pyramid.msh")
######################
if '-nopopup' not in sys.argv:
gmsh.fltk.run()
#################################
gmsh.finalize()