FEM: gmsh tool, add CoherenceMesh option to remove duplicate vertices, set default to true

This commit is contained in:
Bernd Hahnebach
2017-06-26 21:26:13 +01:00
committed by wmayer
parent 4b2c5f51e4
commit 49dc28c54c
2 changed files with 18 additions and 1 deletions

View File

@@ -57,6 +57,11 @@ class FemGmshTools():
# clmin, CharacteristicLengthMin: float
self.clmin = Units.Quantity(self.mesh_obj.CharacteristicLengthMin).Value
# geotol, GeometryTolerance: float, 0.0 = 1e-08
self.geotol = Units.Quantity(self.mesh_obj.GeometryTolerance).Value
if self.geotol == 0.0:
self.geotol = 1e-08
# order
# known_element_orders = ['1st', '2nd']
self.order = self.mesh_obj.ElementOrder
@@ -380,7 +385,13 @@ class FemGmshTools():
geo.write("Mesh.Algorithm3D = " + self.algorithm3D + ";\n")
geo.write("\n")
geo.write("// meshing\n")
geo.write("Mesh " + self.dimension + ";\n")
# remove duplicate vertices, see https://forum.freecadweb.org/viewtopic.php?f=18&t=21571&start=20#p179443
if hasattr(self.mesh_obj, 'CoherenceMesh') and self.mesh_obj.CoherenceMesh is True:
geo.write("Geometry.Tolerance = " + str(self.geotol) + "; // set gemetrical tolerance (also used for merging nodes)\n")
geo.write("Mesh " + self.dimension + ";\n")
geo.write("Coherence Mesh; // Remove duplicate vertices\n")
else:
geo.write("Mesh " + self.dimension + ";\n")
geo.write("\n")
geo.write("// save\n")
geo.write("Mesh.Format = 2;\n") # unv

View File

@@ -78,6 +78,12 @@ class _FemMeshGmsh():
obj.addProperty("App::PropertyBool", "RecombineAll", "FEM GMSH Mesh Params", "Apply recombination algorithm to all surfaces")
obj.RecombineAll = False
obj.addProperty("App::PropertyBool", "CoherenceMesh", "FEM GMSH Mesh Params", "Removes all duplicate mesh vertices")
obj.CoherenceMesh = True
obj.addProperty("App::PropertyLength", "GeometryTolerance", "FEM GMSH Mesh Params", "Gemetrical Tolerance (0.0 = GMSH std = 1e-08 mm)")
obj.GeometryTolerance = 1e-06
obj.addProperty("App::PropertyEnumeration", "Algorithm2D", "FEM GMSH Mesh Params", "mesh algorithm 2D")
obj.Algorithm2D = _FemMeshGmsh.known_mesh_algorithm_2D
obj.Algorithm2D = 'Automatic' # ?