FEM: typo fixes
+ some whitespace formatting
This commit is contained in:
@@ -116,7 +116,7 @@ class FemGmshTools():
|
||||
self.algorithm3D = '1'
|
||||
|
||||
def create_mesh(self):
|
||||
print("\nWe gone start GMSH FEM mesh run!")
|
||||
print("\nWe are going to start GMSH FEM mesh run!")
|
||||
print(' Part to mesh: Name --> ' + self.part_obj.Name + ', Label --> ' + self.part_obj.Label + ', ShapeType --> ' + self.part_obj.Shape.ShapeType)
|
||||
print(' CharacteristicLengthMax: ' + str(self.clmax))
|
||||
print(' CharacteristicLengthMin: ' + str(self.clmin))
|
||||
@@ -136,7 +136,7 @@ class FemGmshTools():
|
||||
def get_dimension(self):
|
||||
# Dimension
|
||||
# known_element_dimensions = ['From Shape', '1D', '2D', '3D']
|
||||
# if not given, GMSH uses the hightest available.
|
||||
# if not given, GMSH uses the highest available.
|
||||
# A use case for not "From Shape" would be a surface (2D) mesh of a solid
|
||||
if self.dimension == 'From Shape':
|
||||
shty = self.part_obj.Shape.ShapeType
|
||||
@@ -159,7 +159,7 @@ class FemGmshTools():
|
||||
self.dimension = '3' # dimension 3 works for 2D and 1d shapes as well
|
||||
else:
|
||||
self.dimension = '0'
|
||||
FreeCAD.Console.PrintError('Could not retrive Dimension from shape type. Please choose dimension.')
|
||||
FreeCAD.Console.PrintError('Could not retrieve Dimension from shape type. Please choose dimension.')
|
||||
elif self.dimension == '3D':
|
||||
self.dimension = '3'
|
||||
elif self.dimension == '2D':
|
||||
@@ -224,7 +224,8 @@ class FemGmshTools():
|
||||
|
||||
def get_group_data(self):
|
||||
self.group_elements = {}
|
||||
# TODO solids, faces, edges and vertexes seam not work together in one group, some print or make them work together
|
||||
# TODO: solids, faces, edges and vertexes don't seem to work together in one group,
|
||||
# some print or make them work together
|
||||
|
||||
# mesh groups and groups of analysis member
|
||||
if not self.mesh_obj.MeshGroupList:
|
||||
@@ -267,7 +268,9 @@ class FemGmshTools():
|
||||
if (part.Proxy.Type == "FeatureBooleanFragments" or part.Proxy.Type == "FeatureSlice" or part.Proxy.Type == "FeatureXOR"):
|
||||
error_message = " The mesh to shape is a boolean split tools Compound and the mesh has mesh region list. GMSH could return unexpected meshes in such circumstances. It is strongly recommended to extract the shape to mesh from the Compound and use this one."
|
||||
FreeCAD.Console.PrintError(error_message + "\n")
|
||||
# TODO no gui popup because FreeCAD will be in a endless prind loop as long as the pop up is on --> my be find a better solution for either of both --> thus the pop up is in task panel
|
||||
# TODO: no gui popup because FreeCAD will be in a endless print loop
|
||||
# as long as the pop up is on --> maybe find a better solution for
|
||||
# either of both --> thus the pop up is in task panel
|
||||
for mr_obj in self.mesh_obj.MeshRegionList:
|
||||
# print(mr_obj.Name)
|
||||
# print(mr_obj.CharacteristicLength)
|
||||
@@ -280,12 +283,12 @@ class FemGmshTools():
|
||||
search_ele_in_shape_to_mesh = False
|
||||
if not self.part_obj.Shape.isSame(sub[0].Shape):
|
||||
# print(" One element of the meshregion " + mr_obj.Name + " is not an element of the Part to mesh.")
|
||||
# print(" But we gone try to find it in the Shape to mesh :-)")
|
||||
# print(" But we are going to try to find it in the Shape to mesh :-)")
|
||||
search_ele_in_shape_to_mesh = True
|
||||
for elems in sub[1]:
|
||||
# print(elems) # elems --> element
|
||||
if search_ele_in_shape_to_mesh:
|
||||
# we gone try to find the element it in the Shape to mesh and use the found element as elems
|
||||
# we're going to try to find the element in the Shape to mesh and use the found element as elems
|
||||
ele_shape = FemMeshTools.get_element(sub[0], elems) # the method getElement(element) does not return Solid elements
|
||||
found_element = FemMeshTools.find_element_in_shape(self.part_obj.Shape, ele_shape)
|
||||
if found_element:
|
||||
@@ -333,7 +336,7 @@ class FemGmshTools():
|
||||
search_ele_in_shape_to_mesh = False
|
||||
if not self.part_obj.Shape.isSame(sub[0].Shape):
|
||||
# print(" One element of the mesh boundary layer " + mr_obj.Name + " is not an element of the Part to mesh.")
|
||||
# print(" But we going to find it in the Shape to mesh :-)")
|
||||
# print(" But we're going to find it in the Shape to mesh :-)")
|
||||
search_ele_in_shape_to_mesh = True
|
||||
for elems in sub[1]:
|
||||
# print(elems) # elems --> element
|
||||
@@ -356,7 +359,7 @@ class FemGmshTools():
|
||||
setting['hwall_n'] = Units.Quantity(mr_obj.MinimumThickness).Value
|
||||
setting['ratio'] = mr_obj.GrowthRate
|
||||
setting['thickness'] = sum([setting['hwall_n'] * setting['ratio'] ** i for i in range(mr_obj.NumberOfLayers)])
|
||||
setting['hwall_t'] = setting['thickness'] # setting['hwall_n'] * 5 # tangetial cell dimension
|
||||
setting['hwall_t'] = setting['thickness'] # setting['hwall_n'] * 5 # tangential cell dimension
|
||||
|
||||
# hfar: cell dimension outside boundary should be set later if some character length is set
|
||||
if self.clmax > setting['thickness'] * 0.8 and self.clmax < setting['thickness'] * 1.6:
|
||||
@@ -364,13 +367,13 @@ class FemGmshTools():
|
||||
else:
|
||||
setting['hfar'] = setting['thickness'] # set a value for safety, it may works as background mesh cell size
|
||||
# from face name -> face id is done in geo file write up
|
||||
#fan angle setup is not implemented yet
|
||||
#TODO: fan angle setup is not implemented yet
|
||||
if self.dimension == '2':
|
||||
setting['EdgesList'] = belem_list
|
||||
elif self.dimension == '3':
|
||||
setting['FacesList'] = belem_list
|
||||
else:
|
||||
FreeCAD.Console.PrintError("boundary layer is only supported for 2D and 3D mesh")
|
||||
FreeCAD.Console.PrintError("boundary layer is only supported for 2D and 3D mesh")
|
||||
self.bl_setting_list.append(setting)
|
||||
else:
|
||||
FreeCAD.Console.PrintError("The mesh boundary layer: " + mr_obj.Name + " is not used to create the mesh because the reference list is empty.\n")
|
||||
@@ -420,7 +423,7 @@ class FemGmshTools():
|
||||
geo.write('Merge "' + self.temp_file_geometry + '";\n')
|
||||
geo.write("\n")
|
||||
if self.group_elements:
|
||||
# print(' We gone have found elements to make mesh groups for.')
|
||||
# print(' We are going to have to find elements to make mesh groups for.')
|
||||
geo.write("// group data\n")
|
||||
# we use the element name of FreeCAD which starts with 1 (example: 'Face1'), same as GMSH
|
||||
for group in self.group_elements:
|
||||
@@ -465,7 +468,7 @@ class FemGmshTools():
|
||||
geo.write("// min, max Characteristic Length\n")
|
||||
geo.write("Mesh.CharacteristicLengthMax = " + str(self.clmax) + ";\n")
|
||||
if len(self.bl_setting_list):
|
||||
# if minLength must smaller than first layer of boundary_layer, it is safer to set it as zero (defualt value) to avoid error
|
||||
# if minLength must smaller than first layer of boundary_layer, it is safer to set it as zero (default value) to avoid error
|
||||
geo.write("Mesh.CharacteristicLengthMin = " + str(0) + ";\n")
|
||||
else:
|
||||
geo.write("Mesh.CharacteristicLengthMin = " + str(self.clmin) + ";\n")
|
||||
@@ -508,7 +511,7 @@ class FemGmshTools():
|
||||
geo.write("// meshing\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("Geometry.Tolerance = " + str(self.geotol) + "; // set geometrical tolerance (also used for merging nodes)\n")
|
||||
geo.write("Mesh " + self.dimension + ";\n")
|
||||
geo.write("Coherence Mesh; // Remove duplicate vertices\n")
|
||||
else:
|
||||
@@ -519,7 +522,7 @@ class FemGmshTools():
|
||||
if self.analysis and self.group_elements:
|
||||
geo.write("// For each group save not only the elements but the nodes too.;\n")
|
||||
geo.write("Mesh.SaveGroupsOfNodes = 1;\n")
|
||||
geo.write("// Needed for Group meshing too, because for one material there is no group defined;\n") # belongs to Mesh.SaveAll but anly needed if there are groups
|
||||
geo.write("// Needed for Group meshing too, because for one material there is no group defined;\n") # belongs to Mesh.SaveAll but only needed if there are groups
|
||||
geo.write("// Ignore Physical definitions and save all elements;\n")
|
||||
geo.write("Mesh.SaveAll = 1;\n")
|
||||
geo.write('Save "' + self.temp_file_mesh + '";\n')
|
||||
|
||||
@@ -65,7 +65,7 @@ class FemInputWriter():
|
||||
self.analysis_type = analysis_type
|
||||
self.dir_name = dir_name
|
||||
if not dir_name:
|
||||
print('Error: FemInputWriter has no working_dir --> we gone make a temporary one!')
|
||||
print('Error: FemInputWriter has no working_dir --> we are going to make a temporary one!')
|
||||
self.dir_name = FreeCAD.ActiveDocument.TransientDir.replace('\\', '/') + '/FemAnl_' + analysis_obj.Uid[-4:]
|
||||
self.dir_name = os.path.join(self.dir_name, '') # check dir_name has a slash at the end, if not add one
|
||||
if not os.path.isdir(self.dir_name):
|
||||
@@ -194,8 +194,9 @@ class FemInputWriter():
|
||||
# it only works if either Volumes or Shellthicknesses or Beamsections are in the material objects
|
||||
# it means it does not work for mixed meshes and multiple materials, this is checked in check_prerequisites
|
||||
if self.femmesh.Volumes:
|
||||
# we only could do this for volumes, if a mseh contains volumes we gone use them in the analysis
|
||||
# but a mesh could contain the element faces of the volumes as faces and the edges of the faces as edges, there we have to check of some gemetric objects
|
||||
# we only could do this for volumes, if a mesh contains volumes we're going to use them in the analysis
|
||||
# but a mesh could contain the element faces of the volumes as faces and the edges of the faces as edges,
|
||||
# there we have to check of some geometric objects
|
||||
all_found = False
|
||||
if self.femmesh.GroupCount:
|
||||
all_found = FemMeshTools.get_femelement_sets_from_group_data(self.femmesh, self.material_objects)
|
||||
@@ -203,7 +204,8 @@ class FemInputWriter():
|
||||
if all_found is False:
|
||||
if not self.femelement_table:
|
||||
self.femelement_table = FemMeshTools.get_femelement_table(self.femmesh)
|
||||
# we gone use the binary search for get_femelements_by_femnodes(), thus we need the parameter values self.femnodes_ele_table
|
||||
# we're going to use the binary search for get_femelements_by_femnodes()
|
||||
# thus we need the parameter values self.femnodes_ele_table
|
||||
if not self.femnodes_mesh:
|
||||
self.femnodes_mesh = self.femmesh.Nodes
|
||||
if not self.femnodes_ele_table:
|
||||
|
||||
@@ -345,7 +345,8 @@ class FemInputWriterCcx(FemInputWriter.FemInputWriter):
|
||||
self.get_element_geometry2D_elements()
|
||||
elif len(self.beamsection_objects) > 1:
|
||||
self.get_element_geometry1D_elements()
|
||||
# we will need to split the beams even for one beamobj because no beam in z-direction can be used in ccx without a special adjustment
|
||||
# we will need to split the beams even for one beamobj
|
||||
# because no beam in z-direction can be used in ccx without a special adjustment
|
||||
# thus they need an own ccx_elset --> but this is ccx specific and thus should not be in input writer!
|
||||
elif len(self.fluidsection_objects) > 1:
|
||||
self.get_element_fluid1D_elements()
|
||||
@@ -357,8 +358,10 @@ class FemInputWriterCcx(FemInputWriter.FemInputWriter):
|
||||
# create the ccx_elsets
|
||||
if len(self.material_objects) == 1:
|
||||
if self.femmesh.Volumes:
|
||||
# we only could do this for volumes, if a mseh contains volumes we gone use them in the analysis
|
||||
# but a mesh could contain the element faces of the volumes as faces and the edges of the faces as edges, there we have to check of some gemetric objects
|
||||
# we only could do this for volumes, if a mesh contains volumes
|
||||
# we're going to use them in the analysis
|
||||
# but a mesh could contain the element faces of the volumes as faces
|
||||
# and the edges of the faces as edges, there we have to check for some geometric objects
|
||||
self.get_ccx_elsets_single_mat_solid()
|
||||
elif len(self.shellthickness_objects) == 1:
|
||||
self.get_ccx_elsets_single_mat_single_shell()
|
||||
@@ -374,8 +377,10 @@ class FemInputWriterCcx(FemInputWriter.FemInputWriter):
|
||||
self.get_ccx_elsets_single_mat_multiple_fluid()
|
||||
elif len(self.material_objects) > 1:
|
||||
if self.femmesh.Volumes:
|
||||
# we only could do this for volumes, if a mseh contains volumes we gone use them in the analysis
|
||||
# but a mesh could contain the element faces of the volumes as faces and the edges of the faces as edges, there we have to check of some gemetric objects
|
||||
# we only could do this for volumes, if a mseh contains volumes
|
||||
# we're going to use them in the analysis
|
||||
# but a mesh could contain the element faces of the volumes as faces
|
||||
# and the edges of the faces as edges, there we have to check for some geometric objects
|
||||
self.get_ccx_elsets_multiple_mat_solid() # volume is a bit special, because retriving ids from group mesh data is implemented
|
||||
elif len(self.shellthickness_objects) == 1:
|
||||
self.get_ccx_elsets_multiple_mat_single_shell()
|
||||
|
||||
@@ -384,7 +384,7 @@ def get_femelementface_sets_from_group_data(femmesh, fem_object):
|
||||
if femmesh.getGroupElementType(g) == "Face":
|
||||
print("Constraint: " + obj.Name + " --> " + "faces are in mesh group: " + grp_name)
|
||||
group_faces = femmesh.getGroupElements(g) # == ref_shape_femelements
|
||||
return group_faces # an empty tuple is returned if no femelements where found
|
||||
return group_faces # an empty tuple is returned if no femelements were found
|
||||
|
||||
|
||||
def get_femelement_sets_from_group_data(femmesh, fem_objects):
|
||||
@@ -495,7 +495,7 @@ def get_force_obj_edge_nodeload_table(femmesh, femelement_table, femnodes_mesh,
|
||||
print(' sum_node_load: ', sum_node_load)
|
||||
print(' frc_obj.Force: ', frc_obj.Force)
|
||||
print(' the reason could be simply a circle length --> see method get_ref_edge_node_lengths')
|
||||
print(' the reason could also be an problem in retrieving the ref_edge_node_length')
|
||||
print(' the reason could also be a problem in retrieving the ref_edge_node_length')
|
||||
|
||||
# try debugging of the last bad refedge
|
||||
print('DEBUGGING')
|
||||
@@ -623,13 +623,13 @@ def get_force_obj_face_nodeload_table(femmesh, femelement_table, femnodes_mesh,
|
||||
|
||||
ratio = sum_node_load / frc_obj.Force
|
||||
if ratio < 0.99 or ratio > 1.01:
|
||||
print('Deviation sum_node_load to frc_obj.Force is more than 1% : ', ratio)
|
||||
print('Deviation sum_node_load to frc_obj.Force is more than 1% : ', ratio)
|
||||
print(' sum_ref_face_node_area: ', sum_ref_face_node_area)
|
||||
print(' sum_ref_face_area: ', sum_ref_face_area)
|
||||
print(' sum_node_load: ', sum_node_load)
|
||||
print(' frc_obj.Force: ', frc_obj.Force)
|
||||
print(' the reason could be simply a circle area --> see method get_ref_face_node_areas')
|
||||
print(' the reason could also be an problem in retrieving the ref_face_node_area')
|
||||
print(' the reason could also be a problem in retrieving the ref_face_node_area')
|
||||
|
||||
return force_obj_node_load_table
|
||||
|
||||
@@ -647,14 +647,14 @@ def get_ref_edgenodes_table(femmesh, femelement_table, refedge):
|
||||
nodecount += 1
|
||||
if nodecount > 1:
|
||||
refedge_fem_volumeelements.append(elem)
|
||||
# for every refedge_fem_volumeelement look which of his nodes is in refedge_nodes --> add all these nodes to edge_table
|
||||
# for every refedge_fem_volumeelement look which of its nodes is in refedge_nodes --> add all these nodes to edge_table
|
||||
for elem in refedge_fem_volumeelements:
|
||||
fe_refedge_nodes = []
|
||||
for node in femelement_table[elem]:
|
||||
if node in refedge_nodes:
|
||||
fe_refedge_nodes.append(node)
|
||||
edge_table[elem] = fe_refedge_nodes # { volumeID : ( edgenodeID, ... , edgenodeID )} # only the refedge nodes
|
||||
# FIXME duplicate_mesh_elements: as soon as contact ans springs are supported the user should decide on which edge the load is applied
|
||||
# FIXME: duplicate_mesh_elements: as soon as contact and springs are supported the user should decide on which edge the load is applied
|
||||
edge_table = delete_duplicate_mesh_elements(edge_table)
|
||||
elif is_face_femmesh(femmesh):
|
||||
refedge_fem_faceelements = []
|
||||
@@ -673,7 +673,7 @@ def get_ref_edgenodes_table(femmesh, femelement_table, refedge):
|
||||
if node in refedge_nodes:
|
||||
fe_refedge_nodes.append(node)
|
||||
edge_table[elem] = fe_refedge_nodes # { faceID : ( edgenodeID, ... , edgenodeID )} # only the refedge nodes
|
||||
# FIXME duplicate_mesh_elements: as soon as contact ans springs are supported the user should decide on which edge the load is applied
|
||||
# FIXME: duplicate_mesh_elements: as soon as contact ans springs are supported the user should decide on which edge the load is applied
|
||||
edge_table = delete_duplicate_mesh_elements(edge_table)
|
||||
elif is_edge_femmesh(femmesh):
|
||||
refedge_fem_edgeelements = get_femelements_by_femnodes_std(femelement_table, refedge_nodes)
|
||||
@@ -734,8 +734,8 @@ def get_ref_facenodes_table(femmesh, femelement_table, ref_face):
|
||||
if has_no_face_data(femmesh):
|
||||
print('No face date in volume mesh. We try to use getccxVolumesByFace() to retrive the volume elments of the ref_face!')
|
||||
# there is no face data
|
||||
# the problem if we retrive the nodes ourself is they are not sorted we just have the nodes. We need to sourt them according
|
||||
# the shell mesh notaion of tria3, tria6, quad4, quad8
|
||||
# the problem if we retrieve the nodes ourself is they are not sorted we just have the nodes.
|
||||
# We need to sort them according the shell mesh notation of tria3, tria6, quad4, quad8
|
||||
ref_face_nodes = femmesh.getNodesByFace(ref_face)
|
||||
# try to use getccxVolumesByFace() to get the volume ids of element with elementfaces on the ref_face --> should work for tetra4 and tetra10
|
||||
ref_face_volume_elements = femmesh.getccxVolumesByFace(ref_face) # list of tupels (mv, ccx_face_nr)
|
||||
@@ -789,7 +789,7 @@ def build_mesh_faces_of_volume_elements(face_table, femelement_table):
|
||||
vol_node_ct = len(femelement_table[veID])
|
||||
face_node_indexs = sorted(face_nodenumber_table[veID])
|
||||
if vol_node_ct == 10: # tetra10 --> tria6 face
|
||||
if face_node_indexs == [1, 2, 3, 5, 6, 7]: # node order of face in tetra10 volume element
|
||||
if face_node_indexs == [1, 2, 3, 5, 6, 7]: # node order of face in tetra10 volume element
|
||||
node_numbers = (1, 2, 3, 5, 6, 7) # node order of a tria6 face of tetra10
|
||||
elif face_node_indexs == [1, 2, 4, 5, 8, 9]:
|
||||
node_numbers = (1, 4, 2, 8, 9, 5)
|
||||
@@ -800,7 +800,7 @@ def build_mesh_faces_of_volume_elements(face_table, femelement_table):
|
||||
else:
|
||||
FreeCAD.Console.PrintError("Error in build_mesh_faces_of_volume_elements(): hexa20: face not found!" + str(face_node_indexs) + "\n")
|
||||
elif vol_node_ct == 4: # tetra4 --> tria3 face
|
||||
if face_node_indexs == [1, 2, 3]: # node order of face in tetra4 volume element
|
||||
if face_node_indexs == [1, 2, 3]: # node order of face in tetra4 volume element
|
||||
node_numbers = (1, 2, 3) # node order of a tria3 face of tetra4
|
||||
elif face_node_indexs == [1, 2, 4]:
|
||||
node_numbers = (1, 4, 2, 8)
|
||||
@@ -811,7 +811,7 @@ def build_mesh_faces_of_volume_elements(face_table, femelement_table):
|
||||
else:
|
||||
FreeCAD.Console.PrintError("Error in build_mesh_faces_of_volume_elements(): hexa20: face not found!" + str(face_node_indexs) + "\n")
|
||||
elif vol_node_ct == 20: # hexa20 --> quad8 face
|
||||
if face_node_indexs == [1, 2, 3, 4, 9, 10, 11, 12]: # node order of face in hexa20 volume element
|
||||
if face_node_indexs == [1, 2, 3, 4, 9, 10, 11, 12]: # node order of face in hexa20 volume element
|
||||
node_numbers = (1, 2, 3, 4, 9, 10, 11, 12) # node order of a quad8 face of hexa20
|
||||
elif face_node_indexs == [5, 6, 7, 8, 13, 14, 15, 16]:
|
||||
node_numbers = (5, 8, 7, 6, 16, 15, 14, 13)
|
||||
@@ -827,7 +827,7 @@ def build_mesh_faces_of_volume_elements(face_table, femelement_table):
|
||||
FreeCAD.Console.PrintError("Error in build_mesh_faces_of_volume_elements(): hexa20: face not found!" + str(face_node_indexs) + "\n")
|
||||
elif vol_node_ct == 8: # hexa8 --> quad4 face
|
||||
face_node_indexs = sorted(face_nodenumber_table[veID])
|
||||
if face_node_indexs == [1, 2, 3, 4]: # node order of face in hexa8 volume element
|
||||
if face_node_indexs == [1, 2, 3, 4]: # node order of face in hexa8 volume element
|
||||
node_numbers = (1, 2, 3, 4) # node order of a quad8 face of hexa8
|
||||
elif face_node_indexs == [5, 6, 7, 8]:
|
||||
node_numbers = (5, 8, 7, 6)
|
||||
@@ -842,7 +842,7 @@ def build_mesh_faces_of_volume_elements(face_table, femelement_table):
|
||||
else:
|
||||
FreeCAD.Console.PrintError("Error in build_mesh_faces_of_volume_elements(): hexa20: face not found!" + str(face_node_indexs) + "\n")
|
||||
elif vol_node_ct == 15: # penta15 --> tria6 and quad8 faces
|
||||
if face_node_indexs == [1, 2, 3, 7, 8, 9]: # node order of face in penta15 volume element
|
||||
if face_node_indexs == [1, 2, 3, 7, 8, 9]: # node order of face in penta15 volume element
|
||||
node_numbers = (1, 2, 3, 7, 8, 9) # node order of a tria6 face of penta15
|
||||
elif face_node_indexs == [4, 5, 6, 10, 11, 12]:
|
||||
node_numbers = (4, 6, 5, 12, 11, 10) # tria6
|
||||
@@ -855,7 +855,7 @@ def build_mesh_faces_of_volume_elements(face_table, femelement_table):
|
||||
else:
|
||||
FreeCAD.Console.PrintError("Error in build_mesh_faces_of_volume_elements(): penta15: face not found!" + str(face_node_indexs) + "\n")
|
||||
elif vol_node_ct == 6: # penta6 --> tria3 and quad4 faces
|
||||
if face_node_indexs == [1, 2, 3]: # node order of face in penta6 volume element
|
||||
if face_node_indexs == [1, 2, 3]: # node order of face in penta6 volume element
|
||||
node_numbers = (1, 2, 3) # node order of a tria3 face of penta6
|
||||
elif face_node_indexs == [4, 5, 6]:
|
||||
node_numbers = (4, 6, 5) # tria3
|
||||
@@ -881,7 +881,7 @@ def build_mesh_faces_of_volume_elements(face_table, femelement_table):
|
||||
def get_ref_facenodes_areas(femnodes_mesh, face_table):
|
||||
# calculate the appropriate node_areas for every node of every mesh face (mf)
|
||||
# G. Lakshmi Narasaiah, Finite Element Analysis, p206ff
|
||||
# FIXME only gives exact results in case of a real triangle. If for S6 or C3D10 elements
|
||||
# FIXME: only gives exact results in case of a real triangle. If for S6 or C3D10 elements
|
||||
# the midnodes are not on the line between the end nodes the area will not be a triangle
|
||||
# see http://forum.freecadweb.org/viewtopic.php?f=18&t=10939&start=40#p91355 and ff
|
||||
# same applies for the quads, results are exact only if mid nodes are on the line between corner nodes
|
||||
@@ -1017,7 +1017,7 @@ def get_ref_facenodes_areas(femnodes_mesh, face_table):
|
||||
|
||||
def get_ref_shape_node_sum_geom_table(node_geom_table):
|
||||
# shape could be Edge or Face, geom could be length or area
|
||||
# summ of legth or area for each node of the ref_shape
|
||||
# sum of legth or area for each node of the ref_shape
|
||||
node_sum_geom_table = {}
|
||||
for n, A in node_geom_table:
|
||||
# print(n, ' --> ', A)
|
||||
@@ -1029,8 +1029,9 @@ def get_ref_shape_node_sum_geom_table(node_geom_table):
|
||||
|
||||
|
||||
def get_mesh_group_elements(mesh_group_obj, aPart):
|
||||
'''the Reference shapes of the mesh_group_object are searched in the Shape of aPart. If found in shape they are added to a dict
|
||||
{MeshGroupIdentifier : ['ShapeType of the Elements'], [ElementID, ElementID, ...], ...}
|
||||
'''the Reference shapes of the mesh_group_object are searched in the Shape of aPart.
|
||||
If found in shape they are added to a dict
|
||||
{MeshGroupIdentifier : ['ShapeType of the Elements'], [ElementID, ElementID, ...], ...}
|
||||
'''
|
||||
group_elements = {} # { name : [element, element, ... , element]}
|
||||
if mesh_group_obj.References:
|
||||
@@ -1042,8 +1043,9 @@ def get_mesh_group_elements(mesh_group_obj, aPart):
|
||||
|
||||
|
||||
def get_analysis_group_elements(aAnalysis, aPart):
|
||||
''' all Reference shapes of all Analysis member are searched in the Shape of aPart. If found in shape they are added to a dict
|
||||
{ConstraintName : ['ShapeType of the Elements'], [ElementID, ElementID, ...], ...}
|
||||
''' all Reference shapes of all Analysis member are searched in the Shape of aPart.
|
||||
If found in shape they are added to a dict
|
||||
{ConstraintName : ['ShapeType of the Elements'], [ElementID, ElementID, ...], ...}
|
||||
'''
|
||||
group_elements = {} # { name : [element, element, ... , element]}
|
||||
empty_references = []
|
||||
@@ -1060,12 +1062,14 @@ def get_analysis_group_elements(aAnalysis, aPart):
|
||||
group_elements = get_anlysis_empty_references_group_elements(group_elements, aAnalysis, aPart.Shape)
|
||||
else:
|
||||
FreeCAD.Console.PrintError('Problem: more than one object with empty references.\n')
|
||||
print('We gone try to get the empty material references anyway.\n')
|
||||
# FemElementGeometry2D, ElementGeometry1D and FemElementFluid1D could have empty references, but on solid meshes only materials should have empty references
|
||||
print('We are going to try to get the empty material references anyway.\n')
|
||||
# FemElementGeometry2D, ElementGeometry1D and FemElementFluid1D could have empty references,
|
||||
# but on solid meshes only materials should have empty references
|
||||
for er in empty_references:
|
||||
print(er.Name)
|
||||
group_elements = get_anlysis_empty_references_group_elements(group_elements, aAnalysis, aPart.Shape)
|
||||
# check if all groups have at least one element, it does not mean ALL reference shapes for a group have been found
|
||||
# check if all groups have at least one element,
|
||||
# it doesn't mean ALL reference shapes for a group have been found
|
||||
for g in group_elements:
|
||||
# print(group_elements[g])
|
||||
if len(group_elements[g]) == 0:
|
||||
@@ -1086,7 +1090,7 @@ def get_reference_group_elements(obj, aPart):
|
||||
'''
|
||||
aShape = aPart.Shape
|
||||
if hasattr(obj, "UseLabel") and obj.UseLabel:
|
||||
key = obj.Label # TODO check the character of the Label, only allow underline and standard english character
|
||||
key = obj.Label # TODO: check the character of the Label, only allow underline and standard english character
|
||||
else:
|
||||
key = obj.Name
|
||||
elements = []
|
||||
@@ -1119,10 +1123,10 @@ def get_reference_group_elements(obj, aPart):
|
||||
# Part.show(aShape)
|
||||
# Part.show(ref_shape)
|
||||
else:
|
||||
FreeCAD.Console.PrintError('This should not happen, please debugg!\n')
|
||||
FreeCAD.Console.PrintError('This should not happen, please debug!\n')
|
||||
# in this case we would not have needed to use the is_same_geometry() inside find_element_in_shape()
|
||||
# AFAIK we could have used the Part methods isPartner() or even isSame()
|
||||
# We gone find out when we need to debugg this :-)!
|
||||
# We're gonna find out when we need to debug this :-)!
|
||||
return (key, sorted(elements))
|
||||
|
||||
|
||||
@@ -1230,7 +1234,7 @@ def find_element_in_shape(aShape, anElement):
|
||||
|
||||
|
||||
def get_vertexes_by_element(aShape, anElement):
|
||||
# we gone extent the method find_element_in_shape and return the vertexes
|
||||
# we're going to extend the method find_element_in_shape and return the vertexes
|
||||
# import Part
|
||||
ele_vertexes = []
|
||||
ele_st = anElement.ShapeType
|
||||
|
||||
@@ -49,7 +49,7 @@ def reset_mesh_deformation(resultobj):
|
||||
resultobj.Mesh.ViewObject.applyDisplacement(0.0)
|
||||
|
||||
|
||||
## Resets reslut mesh color
|
||||
## Resets result mesh color
|
||||
# @param result object
|
||||
def reset_mesh_color(resultobj):
|
||||
if FreeCAD.GuiUp:
|
||||
@@ -75,7 +75,7 @@ def show_displacement(resultobj, displacement_factor=0.0):
|
||||
# - U1, U2, U3 - deformation
|
||||
# - Uabs - absolute deformation
|
||||
# - Sabs - Von Mises stress
|
||||
# @param limit cutoff value. All values over the limit are treated as equal to the limit. Useful for filtering out hot spots.
|
||||
# @param limit cutoff value. All values over the limit are treated as equal to the limit. Useful for filtering out hotspots.
|
||||
def show_result(resultobj, result_type="Sabs", limit=None):
|
||||
if result_type == "None":
|
||||
reset_mesh_color(resultobj.Mesh)
|
||||
@@ -85,7 +85,7 @@ def show_result(resultobj, result_type="Sabs", limit=None):
|
||||
values = resultobj.StressValues
|
||||
elif result_type == "Uabs":
|
||||
values = resultobj.DisplacementLengths
|
||||
# TODO the result object does have more result types to show, implement them
|
||||
# TODO: the result object does have more result types to show, implement them
|
||||
else:
|
||||
match = {"U1": 0, "U2": 1, "U3": 2}
|
||||
d = zip(*resultobj.DisplacementVectors)
|
||||
@@ -98,7 +98,7 @@ def show_result(resultobj, result_type="Sabs", limit=None):
|
||||
## Sets mesh color using list of values. Internally used by show_result function.
|
||||
# @param self The python object self
|
||||
# @param values list of values
|
||||
# @param limit cutoff value. All values over the limit are treated as equel to the limit. Useful for filtering out hot spots.
|
||||
# @param limit cutoff value. All values over the limit are treated as equal to the limit. Useful for filtering out hotspots.
|
||||
def show_color_by_scalar_with_cutoff(resultobj, values, limit=None):
|
||||
if limit:
|
||||
filtered_values = []
|
||||
|
||||
@@ -530,8 +530,8 @@ def get_refshape_type(fem_doc_object):
|
||||
# in GUI defined frc_obj all frc_obj have at leas one ref_shape and ref_shape have all the same shape type
|
||||
# for material object:
|
||||
# in GUI defined material_obj could have no RefShape and RefShapes could be different type
|
||||
# we gone need the RefShapes to be the same type inside one fem_doc_object
|
||||
# TODO here: check if all RefShapes inside the object really have the same type
|
||||
# we're going to need the RefShapes to be the same type inside one fem_doc_object
|
||||
# TODO: check if all RefShapes inside the object really have the same type
|
||||
import FemMeshTools
|
||||
if hasattr(fem_doc_object, 'References') and fem_doc_object.References:
|
||||
first_ref_obj = fem_doc_object.References[0]
|
||||
|
||||
@@ -172,7 +172,7 @@ class FemToolsZ88(FemTools.FemTools):
|
||||
# print(self.z88_testrun.state())
|
||||
# out = self.z88_testrun.readAllStandardOutput()
|
||||
# print(out + '\n') # in some cases output will be cutted, see gmsh macro --> same problem
|
||||
# TODO search out for "Vektor GS" and "Vektor KOI" and print values, may be compare with z88_params value
|
||||
# TODO: search out for "Vektor GS" and "Vektor KOI" and print values, may be compare with z88_params value
|
||||
self.z88_solve_run()
|
||||
|
||||
def z88_solverun_started(self):
|
||||
|
||||
@@ -135,7 +135,7 @@ class _TaskPanelFemMeshGmsh:
|
||||
self.form.l_time.setText('Time: {0:4.1f}: '.format(time.time() - self.Start))
|
||||
self.console_message_gmsh = ''
|
||||
self.gmsh_runs = True
|
||||
self.console_log("We gone start ...")
|
||||
self.console_log("We are going to start ...")
|
||||
self.get_active_analysis()
|
||||
import FemGmshTools
|
||||
gmsh_mesh = FemGmshTools.FemGmshTools(self.obj, self.analysis)
|
||||
|
||||
@@ -102,7 +102,7 @@ class _ViewProviderFemMeshGmsh:
|
||||
else:
|
||||
FreeCAD.Console.PrintError('Active analysis is not in active document.')
|
||||
else:
|
||||
print('No active analysis in active document, we gone have a look if the GMSH FEM mesh object belongs to a non active analysis.')
|
||||
print('No active analysis in active document, we are going to have a look if the GMSH FEM mesh object belongs to a non active analysis.')
|
||||
found_mesh_analysis = False
|
||||
for o in gui_doc.Document.Objects:
|
||||
if o.isDerivedFrom('Fem::FemAnalysisPython'):
|
||||
@@ -110,7 +110,7 @@ class _ViewProviderFemMeshGmsh:
|
||||
if m == self.Object:
|
||||
found_mesh_analysis = True
|
||||
FemGui.setActiveAnalysis(o)
|
||||
print('The analysis the GMSH FEM mesh object belongs too was found and activated: ' + o.Name)
|
||||
print('The analysis the GMSH FEM mesh object belongs to was found and activated: ' + o.Name)
|
||||
gui_doc.setEdit(vobj.Object.Name)
|
||||
break
|
||||
if not found_mesh_analysis:
|
||||
|
||||
@@ -342,7 +342,7 @@ class FemTest(unittest.TestCase):
|
||||
self.assertEqual(read_npressure, expected_npressure, "Values of read npressure result data are unexpected")
|
||||
|
||||
def test_pyimport_all_FEM_modules(self):
|
||||
# we gone try to import all python modules from FreeCAD Fem
|
||||
# we're gonna try to import all python modules from FreeCAD Fem
|
||||
pymodules = []
|
||||
|
||||
# collect all Python modules in Fem
|
||||
|
||||
@@ -113,7 +113,7 @@ def importFrd(filename, analysis=None, result_name_prefix=None):
|
||||
FreeCAD.Console.PrintError('Problem on frd file import. No nodes found in frd file.\n')
|
||||
|
||||
|
||||
# read a calculix result file and extract the nodes, displacement vectores and stress values.
|
||||
# read a calculix result file and extract the nodes, displacement vectors and stress values.
|
||||
def readResult(frd_input):
|
||||
print('Read results from: ' + frd_input)
|
||||
inout_nodes = []
|
||||
|
||||
@@ -397,7 +397,7 @@ def fill_femresult_mechanical(results, result_set, span):
|
||||
npress_min, npress_avg, npress_max]
|
||||
# do not forget to adapt the def get_stats in FemResultTools module as well as the TestFem module
|
||||
# stat_types = ["U1", "U2", "U3", "Uabs", "Sabs", "MaxPrin", "MidPrin", "MinPrin", "MaxShear", "Peeq", "Temp", "MFlow", "NPress"]
|
||||
# TODO a dictionary would be far robust than a list, but needs adapten in VTK too because of VTK result import
|
||||
# TODO: a dictionary would be far robust than a list, but needs adapten in VTK too because of VTK result import
|
||||
|
||||
return results
|
||||
|
||||
|
||||
@@ -182,7 +182,7 @@ def read_z88_mesh(z88_mesh_input):
|
||||
FreeCAD.Console.PrintError("Not supported at the moment\n")
|
||||
return {}
|
||||
elif z88_element_type == 21:
|
||||
# schale16, mixture made from hexa8 und hexa20 (thickness is linear)
|
||||
# schale16, mixture made from hexa8 and hexa20 (thickness is linear)
|
||||
FreeCAD.Console.PrintError("Z88 Element No. 21, schale16\n")
|
||||
FreeCAD.Console.PrintError("Not supported at the moment\n")
|
||||
return {}
|
||||
|
||||
@@ -60,7 +60,7 @@ FreeCAD_to_Fenics_XDMF_dict = {
|
||||
}
|
||||
|
||||
# we need numpy functions to later access and process large data sets in a fast manner
|
||||
# also the hd5 support better works together with numpy
|
||||
# also the hd5 support works better together with numpy
|
||||
|
||||
|
||||
def numpy_array_to_str(npa):
|
||||
|
||||
Reference in New Issue
Block a user