Fem: Add partial support for hexahedral elements - fixes #12526

This commit is contained in:
marioalexis
2024-03-02 10:25:59 -03:00
committed by Chris Hennes
parent 8e3fed1ad5
commit 673f5d0745
3 changed files with 47 additions and 0 deletions

View File

@@ -151,6 +151,17 @@ class GmshTools():
else:
self.HighOrderOptimize = "0"
# SubdivisionAlgorithm
algoSubdiv = self.mesh_obj.SubdivisionAlgorithm
if algoSubdiv == "All Quadrangles":
self.SubdivisionAlgorithm = "1"
elif algoSubdiv == "All Hexahedra":
self.SubdivisionAlgorithm = "2"
elif algoSubdiv == "Barycentric":
self.SubdivisionAlgorithm = "3"
else:
self.SubdivisionAlgorithm = "0"
# mesh groups
if self.mesh_obj.GroupsOfNodes is True:
self.group_nodes_export = True
@@ -858,6 +869,20 @@ class GmshTools():
geo.write("Mesh.Algorithm3D = " + self.algorithm3D + ";\n")
geo.write("\n")
geo.write("// subdivision algorithm\n")
geo.write("Mesh.SubdivisionAlgorithm = " + self.SubdivisionAlgorithm + ";\n")
geo.write("\n")
geo.write("// incomplete second order elements\n")
if (self.SubdivisionAlgorithm == "1"
or self.SubdivisionAlgorithm == "2"
or self.mesh_obj.RecombineAll):
sec_order_inc = "1"
else:
sec_order_inc = "0"
geo.write("Mesh.SecondOrderIncomplete = " + sec_order_inc + ";\n")
geo.write("\n")
geo.write("// meshing\n")
# remove duplicate vertices
# see https://forum.freecad.org/viewtopic.php?f=18&t=21571&start=20#p179443

View File

@@ -73,6 +73,12 @@ class MeshGmsh(base_fempythonobject.BaseFemPythonObject):
"Elastic",
"Fast curving"
]
known_mesh_SubdivisionAlgorithms = [
"None",
"All Quadrangles",
"All Hexahedra",
"Barycentric"
]
def __init__(self, obj):
super(MeshGmsh, self).__init__(obj)
@@ -305,3 +311,13 @@ class MeshGmsh(base_fempythonobject.BaseFemPythonObject):
"For each group create not only the elements but the nodes too."
)
obj.GroupsOfNodes = False
if not hasattr(obj, "SubdivisionAlgorithm"):
obj.addProperty(
"App::PropertyEnumeration",
"SubdivisionAlgorithm",
"FEM Gmsh Mesh Params",
"Mesh subdivision algorithm"
)
obj.SubdivisionAlgorithm = MeshGmsh.known_mesh_SubdivisionAlgorithms
obj.SubdivisionAlgorithm = "None"

View File

@@ -35,6 +35,12 @@ Mesh.Algorithm = 2;
// 3D mesh algorithm (1=Delaunay, 2=New Delaunay, 4=Frontal, 7=MMG3D, 9=R-tree, 10=HTX)
Mesh.Algorithm3D = 1;
// subdivision algorithm
Mesh.SubdivisionAlgorithm = 0;
// incomplete second order elements
Mesh.SecondOrderIncomplete = 0;
// meshing
Geometry.Tolerance = 1e-06; // set geometrical tolerance (also used for merging nodes)
Mesh 3;