使用 gmsh 的环形圆盘的四边形网格

问题描述 投票:0回答:0

我正在尝试为环形圆盘几何体生成四边形网格。我能够使用

gmsh
:

为矩形生成此网格
import gmsh
import sys

gmsh.initialize()

gmsh.model.add("t1")

lc = 1e-2
p1 = gmsh.model.geo.addPoint(0, 0, 0, lc, 1)
p2 = gmsh.model.geo.addPoint(0.02, 0, 0, lc, 2)
p3 = gmsh.model.geo.addPoint(0.02, 0.02, 0, lc, 3)
p4 = gmsh.model.geo.addPoint(0, 0.02, 0, lc, 4)

gmsh.model.geo.addLine(p1, p2, 1)
gmsh.model.geo.addLine(p2, p3, 2)
gmsh.model.geo.addLine(p3, p4, 3)
gmsh.model.geo.addLine(p4, p1, 4)
gmsh.model.geo.addCurveLoop([1, 2, 3, 4], 1)

gmsh.model.geo.addPlaneSurface([1], 1)

# the number of synchronization points.
gmsh.model.geo.synchronize()

gmsh.option.setNumber("Mesh.MeshSizeMin", 0.001)
gmsh.option.setNumber("Mesh.MeshSizeMax", 0.003)
gmsh.model.mesh.setAlgorithm(2,1,8)
gmsh.model.mesh.generate(2)
gmsh.model.mesh.recombine()

# ... and save it to disk
gmsh.write("rect.stl")

if '-nopopup' not in sys.argv:
    gmsh.fltk.run()

gmsh.finalize()

这导致了这个网格:

我想生成这样的四边形网格:

这里是为圆盘生成网格的代码(为了简化,我包含了圆盘的四分之一):

import gmsh
import sys

# Before using any functions in the Python API, Gmsh must be initialized:
gmsh.initialize()

gmsh.model.add("t1")

lc = 1e-2
p1 = gmsh.model.geo.addPoint(0, 0, 0, lc, 1)
p2 = gmsh.model.geo.addPoint(0.02, 0, 0, lc, 3)
p3 = gmsh.model.geo.addPoint(0, 0.02, 0, lc, 2)
p4 = gmsh.model.geo.addPoint(0, 0.01, 0, lc, 5)
p5 = gmsh.model.geo.addPoint(0.01, 0, 0, lc, 4)
p6 = gmsh.model.geo.addPoint(-0.02, 0, 0, lc, 6)
p7 = gmsh.model.geo.addPoint(-0.01, 0, 0, lc, 7)
p8 = gmsh.model.geo.addPoint(0, -0.02, 0, lc, 8)
p9 = gmsh.model.geo.addPoint(0, -0.01, 0, lc, 9)
# 
gmsh.model.geo.addCircleArc(p2, p1, p3, 1)
gmsh.model.geo.addLine(p3, p4, 2)
gmsh.model.geo.addCircleArc(p4, p1, p5, 3)
gmsh.model.geo.addLine(p5, p2, 4)
gmsh.model.geo.addCurveLoop([1, 2, 3, 4], 1)

gmsh.model.geo.addPlaneSurface([1], 1)

# the number of synchronization points.
gmsh.model.geo.synchronize()

gmsh.option.setNumber("Mesh.MeshSizeMin", 0.001)
gmsh.option.setNumber("Mesh.MeshSizeMax", 0.003)
gmsh.model.mesh.setAlgorithm(2,1,8)
gmsh.model.mesh.generate(2)
gmsh.model.mesh.recombine()

# ... and save it to disk
gmsh.write("disc.stl")

if '-nopopup' not in sys.argv:
    gmsh.fltk.run()

gmsh.finalize()

导致不规则网格:

如何完成图片中相同的网格2

mesh finite-element-analysis gmsh
© www.soinside.com 2019 - 2024. All rights reserved.