Fem: Remove unused functions

This commit is contained in:
marioalexis
2024-04-13 16:37:02 -03:00
parent be65d1a252
commit 8d13863bfd
2 changed files with 29 additions and 133 deletions

View File

@@ -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)

View File

@@ -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")