Please can you guide me on how to create a distorted quadrilateral, with the packages needed?
See for instance Mesh creation in serial and parallel — FEniCSx Documentation
Thank you for the link. But would it be possible to show me a small scrip on how to refine it?
I do not have a script at hand for that. You should consider using Gmsh for this.
Hi,
Although I never used gmsh before, I have managed to create a structured grid with gmsh.
I have two questions please:
1- how can change some positions of the nods, so I distort the quad???
2- Hoe can I save the nodes, cells with gmsh?
2- How can I read this file with fenicsx?
Thank you
Code attached:
Blockquote
import gmsh
import math
import sys
#=======================
model = gmsh.model
factory = model.geo
#==============
gmsh.initialize()
gmsh.option.setNumber(“General.Terminal”, 1)
#=============
lc = 1e-2
p1 = factory.addPoint(0, 0 , 0, lc, 1)
p2 = factory.addPoint(1, 0 , 0, lc, 2)
p3 = factory.addPoint(1, 1.1, 0, lc, 3)
p4 = factory.addPoint(0, 1.1, 0, lc, 4)
#==============
l1 = factory.addLine(1, 2, 1)
l2 = factory.addLine(3, 2, 2)
l3 = factory.addLine(3, 4, 3)
l4 = factory.addLine(4, 1, 4)
domain = factory.addCurveLoop([4, 1, -2, 3], 1)
#==================
factory.addPlaneSurface([domain])
#creating nodes
factory.mesh.setTransfiniteCurve(l1, 6)
factory.mesh.setTransfiniteCurve(l2, 6)
factory.mesh.setTransfiniteCurve(l3, 6)
factory.mesh.setTransfiniteCurve(l4, 6)
#I don’t understand this command??
factory.mesh.setTransfiniteSurface(1, “Left”, [1,2,3,4])
#==================Recombine the triangles into quads
factory.mesh.setRecombine(2, 1)
gmsh.model.geo.synchronize()
themesh = model.mesh.generate(dim=2)
gmsh.write(“quad.msh”)