Skip to content

Commit 2aa27c8

Browse files
committed
Fem: Remove unused functions
1 parent 277b83f commit 2aa27c8

File tree

2 files changed

+29
-133
lines changed

2 files changed

+29
-133
lines changed

src/Mod/Fem/femmesh/meshtools.py

-97
Original file line numberDiff line numberDiff line change
@@ -2343,24 +2343,6 @@ def get_three_non_colinear_nodes(
23432343
return [node_1, node_2, node_3]
23442344

23452345

2346-
# ************************************************************************************************
2347-
def write_D_network_element_to_inputfile(
2348-
fileName
2349-
):
2350-
# replace B32 elements with D elements for fluid section
2351-
f = open(fileName, "r+")
2352-
lines = f.readlines()
2353-
f.seek(0)
2354-
for line in lines:
2355-
if line.find("B32") == -1:
2356-
f.write(line)
2357-
else:
2358-
dummy = line.replace("B32", "D")
2359-
f.write(dummy)
2360-
f.truncate()
2361-
f.close()
2362-
2363-
23642346
# ************************************************************************************************
23652347
def use_correct_fluidinout_ele_def(
23662348
FluidInletoutlet_ele,
@@ -2505,85 +2487,6 @@ def compact_mesh(
25052487
# may be return another value if the mesh was compacted, just check last map entries
25062488
return (new_mesh, node_map, elem_map)
25072489

2508-
# ************************************************************************************************
2509-
def beam_reduced_integration(
2510-
fileName
2511-
):
2512-
# replace B3x elements with B3xR elements
2513-
f = open(fileName, "r+")
2514-
lines = f.readlines()
2515-
f.seek(0)
2516-
for line in lines:
2517-
if line.find("B32") != -1:
2518-
line = line.replace("B32", "B32R")
2519-
if line.find("B31") != -1:
2520-
line = line.replace("B31", "B31R")
2521-
f.write(line)
2522-
2523-
f.truncate()
2524-
f.close()
2525-
2526-
def plane_stress(
2527-
fileName
2528-
):
2529-
# replace shell elements with plane stress elements
2530-
f = open(fileName, "r+")
2531-
lines = f.readlines()
2532-
f.seek(0)
2533-
for line in lines:
2534-
if line.find("S3") != -1:
2535-
line = line.replace("S3", "CPS3")
2536-
if line.find("S6") != -1:
2537-
line = line.replace("S6", "CPS6")
2538-
if line.find("S4") != -1:
2539-
line = line.replace("S4", "CPS4")
2540-
if line.find("S8") != -1:
2541-
line = line.replace("S8", "CPS8")
2542-
f.write(line)
2543-
2544-
f.truncate()
2545-
f.close()
2546-
def plane_strain(
2547-
fileName
2548-
):
2549-
# replace shell elements with plane strain elements
2550-
f = open(fileName, "r+")
2551-
lines = f.readlines()
2552-
f.seek(0)
2553-
for line in lines:
2554-
if line.find("S3") != -1:
2555-
line = line.replace("S3", "CPE3")
2556-
if line.find("S6") != -1:
2557-
line = line.replace("S6", "CPE6")
2558-
if line.find("S4") != -1:
2559-
line = line.replace("S4", "CPE4")
2560-
if line.find("S8") != -1:
2561-
line = line.replace("S8", "CPE8")
2562-
f.write(line)
2563-
2564-
f.truncate()
2565-
f.close()
2566-
def axisymmetric(
2567-
fileName
2568-
):
2569-
# replace shell elements with axisymmetric elements
2570-
f = open(fileName, "r+")
2571-
lines = f.readlines()
2572-
f.seek(0)
2573-
for line in lines:
2574-
if line.find("S3") != -1:
2575-
line = line.replace("S3", "CAX3")
2576-
if line.find("S6") != -1:
2577-
line = line.replace("S6", "CAX6")
2578-
if line.find("S4") != -1:
2579-
line = line.replace("S4", "CAX4")
2580-
if line.find("S8") != -1:
2581-
line = line.replace("S8", "CAX8")
2582-
f.write(line)
2583-
2584-
f.truncate()
2585-
f.close()
2586-
25872490
# ************************************************************************************************
25882491
def sub_shape_at_global_placement(obj, sub_name):
25892492
sub_sh = obj.getSubObject(sub_name)

src/Mod/Fem/femsolver/calculix/write_mesh.py

+29-36
Original file line numberDiff line numberDiff line change
@@ -36,33 +36,40 @@ def write_mesh(ccxwriter):
3636

3737
element_param = 1 # highest element order only
3838
group_param = False # do not write mesh group data
39-
if ccxwriter.split_inpfile is True:
39+
40+
# Use reduced integration beam elements if this option is enabled in ccx solver settings
41+
vol_variant = "standard"
42+
edge_variant = "beam"
43+
if ccxwriter.solver_obj.BeamReducedIntegration:
44+
edge_variant = "beam reduced"
45+
# Check to see if fluid sections are in analysis and use D network element type
46+
if ccxwriter.member.geos_fluidsection:
47+
edge_variant = "network"
48+
49+
# Use 2D elements if model space is not set to 3D
50+
if ccxwriter.solver_obj.ModelSpace == "3D":
51+
face_variant = "shell"
52+
elif ccxwriter.solver_obj.ModelSpace == "plane stress":
53+
face_variant = "stress"
54+
elif ccxwriter.solver_obj.ModelSpace == "plane strain":
55+
face_variant = "strain"
56+
elif ccxwriter.solver_obj.ModelSpace == "axisymmetric":
57+
face_variant = "axisymmetric"
58+
59+
if ccxwriter.split_inpfile:
4060
write_name = "femesh"
4161
file_name_split = ccxwriter.mesh_name + "_" + write_name + ".inp"
4262
ccxwriter.femmesh_file = join(ccxwriter.dir_name, file_name_split)
4363

4464
ccxwriter.femmesh.writeABAQUS(
4565
ccxwriter.femmesh_file,
4666
element_param,
47-
group_param
67+
group_param,
68+
volVariant=vol_variant,
69+
faceVariant=face_variant,
70+
edgeVariant=edge_variant
4871
)
4972

50-
# Check to see if fluid sections are in analysis and use D network element type
51-
if ccxwriter.member.geos_fluidsection:
52-
meshtools.write_D_network_element_to_inputfile(ccxwriter.femmesh_file)
53-
54-
# Use reduced integration beam elements if this option is enabled in ccx solver settings
55-
if ccxwriter.solver_obj.BeamReducedIntegration:
56-
meshtools.beam_reduced_integration(ccxwriter.femmesh_file)
57-
58-
# Use 2D elements if model space is not set to 3D
59-
if ccxwriter.solver_obj.ModelSpace == "plane stress":
60-
meshtools.plane_stress(ccxwriter.femmesh_file)
61-
if ccxwriter.solver_obj.ModelSpace == "plane strain":
62-
meshtools.plane_strain(ccxwriter.femmesh_file)
63-
if ccxwriter.solver_obj.ModelSpace == "axisymmetric":
64-
meshtools.axisymmetric(ccxwriter.femmesh_file)
65-
6673
inpfile = codecs.open(ccxwriter.file_name, "w", encoding="utf-8")
6774
inpfile.write("{}\n".format(59 * "*"))
6875
inpfile.write("** {}\n".format(write_name))
@@ -73,26 +80,12 @@ def write_mesh(ccxwriter):
7380
ccxwriter.femmesh.writeABAQUS(
7481
ccxwriter.femmesh_file,
7582
element_param,
76-
group_param
83+
group_param,
84+
volVariant=vol_variant,
85+
faceVariant=face_variant,
86+
edgeVariant=edge_variant
7787
)
7888

79-
# Check to see if fluid sections are in analysis and use D network element type
80-
if ccxwriter.member.geos_fluidsection:
81-
# inpfile is closed
82-
meshtools.write_D_network_element_to_inputfile(ccxwriter.femmesh_file)
83-
84-
# Use reduced integration beam elements if this option is enabled in ccx solver settings
85-
if ccxwriter.solver_obj.BeamReducedIntegration:
86-
meshtools.beam_reduced_integration(ccxwriter.femmesh_file)
87-
88-
# Use 2D elements if model space is not set to 3D
89-
if ccxwriter.solver_obj.ModelSpace == "plane stress":
90-
meshtools.plane_stress(ccxwriter.femmesh_file)
91-
if ccxwriter.solver_obj.ModelSpace == "plane strain":
92-
meshtools.plane_strain(ccxwriter.femmesh_file)
93-
if ccxwriter.solver_obj.ModelSpace == "axisymmetric":
94-
meshtools.axisymmetric(ccxwriter.femmesh_file)
95-
9689
# reopen file with "append" to add all the rest
9790
inpfile = codecs.open(ccxwriter.femmesh_file, "a", encoding="utf-8")
9891
inpfile.write("\n\n")

0 commit comments

Comments
 (0)