[FEM] add support for 3D recombinations (#4706)
* [FEM] add support for 3D recombinations currently we only support surface recombinations but for some applications 3D recombinations are useful as well * add support for the recombination algorithms using a sensible algorithm is important to get useful results, see https://wiki.freecadweb.org/FEM_MeshGmshFromShape#Properties where I described examples
This commit is contained in:
@@ -125,6 +125,19 @@ class GmshTools():
|
||||
else:
|
||||
self.algorithm3D = "1"
|
||||
|
||||
# RecombinationAlgorithm
|
||||
algoRecombo = self.mesh_obj.RecombinationAlgorithm
|
||||
if algoRecombo == "Simple":
|
||||
self.RecombinationAlgorithm = "0"
|
||||
elif algoRecombo == "Blossom":
|
||||
self.RecombinationAlgorithm = "1"
|
||||
elif algoRecombo == "Simple full-quad":
|
||||
self.RecombinationAlgorithm = "2"
|
||||
elif algoRecombo == "Blossom full-quad":
|
||||
self.RecombinationAlgorithm = "3"
|
||||
else:
|
||||
self.algoRecombo = "0"
|
||||
|
||||
# HighOrderOptimize
|
||||
optimizers = self.mesh_obj.HighOrderOptimize
|
||||
if optimizers == "None":
|
||||
@@ -766,8 +779,15 @@ class GmshTools():
|
||||
)
|
||||
geo.write("\n")
|
||||
if hasattr(self.mesh_obj, "RecombineAll") and self.mesh_obj.RecombineAll is True:
|
||||
geo.write("// other mesh options\n")
|
||||
geo.write("// recombination for surfaces\n")
|
||||
geo.write("Mesh.RecombineAll = 1;\n")
|
||||
if hasattr(self.mesh_obj, "Recombine3DAll") and self.mesh_obj.Recombine3DAll is True:
|
||||
geo.write("// recombination for volumes\n")
|
||||
geo.write("Mesh.Recombine3DAll = 1;\n")
|
||||
if ( (hasattr(self.mesh_obj, "RecombineAll") and self.mesh_obj.RecombineAll is True)
|
||||
or (hasattr(self.mesh_obj, "Recombine3DAll") and self.mesh_obj.Recombine3DAll is True)):
|
||||
geo.write("// recombination algorithm\n")
|
||||
geo.write("Mesh.RecombinationAlgorithm = " + self.RecombinationAlgorithm + ";\n")
|
||||
geo.write("\n")
|
||||
|
||||
geo.write("// optimize the mesh\n")
|
||||
|
||||
@@ -60,6 +60,12 @@ class MeshGmsh(base_fempythonobject.BaseFemPythonObject):
|
||||
"R-tree",
|
||||
"HXT"
|
||||
]
|
||||
known_mesh_RecombinationAlgorithms = [
|
||||
"Simple",
|
||||
"Blossom",
|
||||
"Simple full-quad",
|
||||
"Blossom full-quad"
|
||||
]
|
||||
known_mesh_HighOrderOptimizers = [
|
||||
"None",
|
||||
"Optimization",
|
||||
@@ -169,7 +175,7 @@ class MeshGmsh(base_fempythonobject.BaseFemPythonObject):
|
||||
"App::PropertyBool",
|
||||
"OptimizeStd",
|
||||
"FEM Gmsh Mesh Params",
|
||||
"Optimize tetra elements"
|
||||
"Optimize tetrahedral elements"
|
||||
)
|
||||
obj.OptimizeStd = True
|
||||
|
||||
@@ -201,6 +207,25 @@ class MeshGmsh(base_fempythonobject.BaseFemPythonObject):
|
||||
)
|
||||
obj.RecombineAll = False
|
||||
|
||||
if not hasattr(obj, "Recombine3DAll"):
|
||||
obj.addProperty(
|
||||
"App::PropertyBool",
|
||||
"Recombine3DAll",
|
||||
"FEM Gmsh Mesh Params",
|
||||
"Apply recombination algorithm to all volumes"
|
||||
)
|
||||
obj.Recombine3DAll = False
|
||||
|
||||
if not hasattr(obj, "RecombinationAlgorithm"):
|
||||
obj.addProperty(
|
||||
"App::PropertyEnumeration",
|
||||
"RecombinationAlgorithm",
|
||||
"FEM Gmsh Mesh Params",
|
||||
"Recombination algorithm"
|
||||
)
|
||||
obj.RecombinationAlgorithm = MeshGmsh.known_mesh_RecombinationAlgorithms
|
||||
obj.RecombinationAlgorithm = "Simple"
|
||||
|
||||
if not hasattr(obj, "CoherenceMesh"):
|
||||
obj.addProperty(
|
||||
"App::PropertyBool",
|
||||
|
||||
Reference in New Issue
Block a user