Skip to content
Snippets Groups Projects
Commit 3c64394f authored by Max Orok's avatar Max Orok
Browse files

Add first draft of t17.py

parent 694dc368
No related branches found
No related tags found
No related merge requests found
# This file reimplements gmsh/tutorial/t17.geo in Python.
#
# Anisotropic background mesh
import gmsh
import math
model = gmsh.model
factory = model.geo
gmsh.initialize()
gmsh.option.setNumber("General.Terminal", 1)
factory.addPoint(-1, -1, 0)
factory.addPoint(1, -1, 0)
factory.addPoint(1, 1, 0)
factory.addPoint(-1, 1, 0)
factory.addLine(1, 2, 1)
factory.addLine(2, 3, 2)
factory.addLine(3, 4, 3)
factory.addLine(4, 1, 4)
factory.addCurveLoop([1, 2, 3, 4], 1)
factory.addPlaneSurface([1], 1)
factory.synchronize()
# add a post-processing view to use as a size field
gmsh.merge("t17.pos")
field = gmsh.model.mesh.field
# The field is of type "PostView"
bg_field = field.add("PostView")
# "IView" is the index of the view you want to use.
field.setNumber(bg_field, "IView", 0)
# set the field as a background mesh
field.setAsBackgroundMesh(bg_field)
# use bamg
gmsh.option.setNumber("Mesh.SmoothRatio", 3)
gmsh.option.setNumber("Mesh.AnisoMax", 1000)
gmsh.option.setNumber("Mesh.Algorithm", 7)
gmsh.model.mesh.generate(2)
gmsh.write("t17.msh")
gmsh.fltk.run()
gmsh.finalize()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment