Ejemplo n.º 1
0
# Element type 3 is quad. (2 is triangle. See user manual for more element types)

elType = 3 

# Degrees of freedom per node.

dofsPerNode = 1 

coords, edof, dofs, bdofs, elementmarkers = cfm.createGmshMesh(g, 
                                                               elSizeFactor = 0.05, 
                                                               elType = elType, 
                                                               dofsPerNode = dofsPerNode)

# ---- Visualise mesh -------------------------------------------------------

# Draw geometry

cfv.drawGeometry(g)

# Draw mesh

vv.figure()
cfv.drawMesh(coords=coords, edof=edof, dofsPerNode=dofsPerNode, elType=elType, filled=True)

# Enter main loop

app = vv.use()
app.Create()
app.Run()
Ejemplo n.º 2
0
    g.setCurveMarker(curveID, 80)

#MESHING:
elType = 2 #Element type 2 is triangle. (3 is quad. See user manual for more element types)
dofsPerNode= 2 #Degrees of freedom per node.

mesher = GmshMeshGenerator(g)
mesher.elSizeFactor = 0.05
mesher.elType = elType
mesher.dofsPerNode = 2

#Mesh the geometry:
# The first four return values are the same as those that trimesh2d() returns.
# value elementmarkers is a list of markers, and is used for finding the marker of a given element (index).
coords, edof, dofs, bdofs, elementmarkers = mesher.create()

#VISUALISATION:
#Hold left mouse button to pan.
#Hold right mouse button to zoom.
pcv.drawGeometry(g, labelCurves=True)#Draws the geometry.

vv.figure() #New figure window

pcv.drawMesh(coords=coords, edof=edof, dofsPerNode=dofsPerNode, elType=elType, filled=True, title="Example 02") #Draws the mesh.

vv.gca().axis.showGrid = True #Show grid

# Enter main loop:
app = vv.use()
app.Create()
app.Run()