From 8d13863bfd3419c1bbf7ef5a8e40ed747a02ff3f Mon Sep 17 00:00:00 2001 From: marioalexis Date: Sat, 13 Apr 2024 16:37:02 -0300 Subject: [PATCH] Fem: Remove unused functions --- src/Mod/Fem/femmesh/meshtools.py | 97 -------------------- src/Mod/Fem/femsolver/calculix/write_mesh.py | 65 ++++++------- 2 files changed, 29 insertions(+), 133 deletions(-) diff --git a/src/Mod/Fem/femmesh/meshtools.py b/src/Mod/Fem/femmesh/meshtools.py index 35af3b8c93..845119f25e 100644 --- a/src/Mod/Fem/femmesh/meshtools.py +++ b/src/Mod/Fem/femmesh/meshtools.py @@ -2343,24 +2343,6 @@ def get_three_non_colinear_nodes( return [node_1, node_2, node_3] -# ************************************************************************************************ -def write_D_network_element_to_inputfile( - fileName -): - # replace B32 elements with D elements for fluid section - f = open(fileName, "r+") - lines = f.readlines() - f.seek(0) - for line in lines: - if line.find("B32") == -1: - f.write(line) - else: - dummy = line.replace("B32", "D") - f.write(dummy) - f.truncate() - f.close() - - # ************************************************************************************************ def use_correct_fluidinout_ele_def( FluidInletoutlet_ele, @@ -2505,85 +2487,6 @@ def compact_mesh( # may be return another value if the mesh was compacted, just check last map entries return (new_mesh, node_map, elem_map) -# ************************************************************************************************ -def beam_reduced_integration( - fileName -): - # replace B3x elements with B3xR elements - f = open(fileName, "r+") - lines = f.readlines() - f.seek(0) - for line in lines: - if line.find("B32") != -1: - line = line.replace("B32", "B32R") - if line.find("B31") != -1: - line = line.replace("B31", "B31R") - f.write(line) - - f.truncate() - f.close() - -def plane_stress( - fileName -): - # replace shell elements with plane stress elements - f = open(fileName, "r+") - lines = f.readlines() - f.seek(0) - for line in lines: - if line.find("S3") != -1: - line = line.replace("S3", "CPS3") - if line.find("S6") != -1: - line = line.replace("S6", "CPS6") - if line.find("S4") != -1: - line = line.replace("S4", "CPS4") - if line.find("S8") != -1: - line = line.replace("S8", "CPS8") - f.write(line) - - f.truncate() - f.close() -def plane_strain( - fileName -): - # replace shell elements with plane strain elements - f = open(fileName, "r+") - lines = f.readlines() - f.seek(0) - for line in lines: - if line.find("S3") != -1: - line = line.replace("S3", "CPE3") - if line.find("S6") != -1: - line = line.replace("S6", "CPE6") - if line.find("S4") != -1: - line = line.replace("S4", "CPE4") - if line.find("S8") != -1: - line = line.replace("S8", "CPE8") - f.write(line) - - f.truncate() - f.close() -def axisymmetric( - fileName -): - # replace shell elements with axisymmetric elements - f = open(fileName, "r+") - lines = f.readlines() - f.seek(0) - for line in lines: - if line.find("S3") != -1: - line = line.replace("S3", "CAX3") - if line.find("S6") != -1: - line = line.replace("S6", "CAX6") - if line.find("S4") != -1: - line = line.replace("S4", "CAX4") - if line.find("S8") != -1: - line = line.replace("S8", "CAX8") - f.write(line) - - f.truncate() - f.close() - # ************************************************************************************************ def sub_shape_at_global_placement(obj, sub_name): sub_sh = obj.getSubObject(sub_name) diff --git a/src/Mod/Fem/femsolver/calculix/write_mesh.py b/src/Mod/Fem/femsolver/calculix/write_mesh.py index aa17bd4533..4a4b632974 100644 --- a/src/Mod/Fem/femsolver/calculix/write_mesh.py +++ b/src/Mod/Fem/femsolver/calculix/write_mesh.py @@ -36,7 +36,27 @@ def write_mesh(ccxwriter): element_param = 1 # highest element order only group_param = False # do not write mesh group data - if ccxwriter.split_inpfile is True: + + # Use reduced integration beam elements if this option is enabled in ccx solver settings + vol_variant = "standard" + edge_variant = "beam" + if ccxwriter.solver_obj.BeamReducedIntegration: + edge_variant = "beam reduced" + # Check to see if fluid sections are in analysis and use D network element type + if ccxwriter.member.geos_fluidsection: + edge_variant = "network" + + # Use 2D elements if model space is not set to 3D + if ccxwriter.solver_obj.ModelSpace == "3D": + face_variant = "shell" + elif ccxwriter.solver_obj.ModelSpace == "plane stress": + face_variant = "stress" + elif ccxwriter.solver_obj.ModelSpace == "plane strain": + face_variant = "strain" + elif ccxwriter.solver_obj.ModelSpace == "axisymmetric": + face_variant = "axisymmetric" + + if ccxwriter.split_inpfile: write_name = "femesh" file_name_split = ccxwriter.mesh_name + "_" + write_name + ".inp" ccxwriter.femmesh_file = join(ccxwriter.dir_name, file_name_split) @@ -44,25 +64,12 @@ def write_mesh(ccxwriter): ccxwriter.femmesh.writeABAQUS( ccxwriter.femmesh_file, element_param, - group_param + group_param, + volVariant=vol_variant, + faceVariant=face_variant, + edgeVariant=edge_variant ) - # Check to see if fluid sections are in analysis and use D network element type - if ccxwriter.member.geos_fluidsection: - meshtools.write_D_network_element_to_inputfile(ccxwriter.femmesh_file) - - # Use reduced integration beam elements if this option is enabled in ccx solver settings - if ccxwriter.solver_obj.BeamReducedIntegration: - meshtools.beam_reduced_integration(ccxwriter.femmesh_file) - - # Use 2D elements if model space is not set to 3D - if ccxwriter.solver_obj.ModelSpace == "plane stress": - meshtools.plane_stress(ccxwriter.femmesh_file) - if ccxwriter.solver_obj.ModelSpace == "plane strain": - meshtools.plane_strain(ccxwriter.femmesh_file) - if ccxwriter.solver_obj.ModelSpace == "axisymmetric": - meshtools.axisymmetric(ccxwriter.femmesh_file) - inpfile = codecs.open(ccxwriter.file_name, "w", encoding="utf-8") inpfile.write("{}\n".format(59 * "*")) inpfile.write("** {}\n".format(write_name)) @@ -73,26 +80,12 @@ def write_mesh(ccxwriter): ccxwriter.femmesh.writeABAQUS( ccxwriter.femmesh_file, element_param, - group_param + group_param, + volVariant=vol_variant, + faceVariant=face_variant, + edgeVariant=edge_variant ) - # Check to see if fluid sections are in analysis and use D network element type - if ccxwriter.member.geos_fluidsection: - # inpfile is closed - meshtools.write_D_network_element_to_inputfile(ccxwriter.femmesh_file) - - # Use reduced integration beam elements if this option is enabled in ccx solver settings - if ccxwriter.solver_obj.BeamReducedIntegration: - meshtools.beam_reduced_integration(ccxwriter.femmesh_file) - - # Use 2D elements if model space is not set to 3D - if ccxwriter.solver_obj.ModelSpace == "plane stress": - meshtools.plane_stress(ccxwriter.femmesh_file) - if ccxwriter.solver_obj.ModelSpace == "plane strain": - meshtools.plane_strain(ccxwriter.femmesh_file) - if ccxwriter.solver_obj.ModelSpace == "axisymmetric": - meshtools.axisymmetric(ccxwriter.femmesh_file) - # reopen file with "append" to add all the rest inpfile = codecs.open(ccxwriter.femmesh_file, "a", encoding="utf-8") inpfile.write("\n\n")