FEM: calculix writer, use generic elset variable names
This commit is contained in:
@@ -48,7 +48,7 @@ def handle_fluidsection_liquid_inlet_outlet(inpfile, ccxwriter):
|
||||
|
||||
# Fluid sections:
|
||||
# fluidsection Liquid inlet outlet objs requires special element definition
|
||||
# to fill ccxwriter.FluidInletoutlet_ele list the ccx_elset are needed
|
||||
# to fill ccxwriter.FluidInletoutlet_ele list the mat_geo_sets are needed
|
||||
# thus this has to be after the creation of mat_geo_sets
|
||||
# different pipe cross sections will generate mat_geo_sets
|
||||
|
||||
@@ -58,14 +58,14 @@ def handle_fluidsection_liquid_inlet_outlet(inpfile, ccxwriter):
|
||||
"{}_inout_nodes.txt".format(ccxwriter.mesh_name)
|
||||
)
|
||||
|
||||
def get_fluidsection_inoutlet_obj_if_setdata(ccx_elset):
|
||||
def get_fluidsection_inoutlet_obj_if_setdata(matgeoset):
|
||||
if (
|
||||
ccx_elset["ccx_elset"]
|
||||
matgeoset["ccx_elset"]
|
||||
# use six to be sure to be Python 2.7 and 3.x compatible
|
||||
and not isinstance(ccx_elset["ccx_elset"], six.string_types)
|
||||
and "fluidsection_obj" in ccx_elset # fluid mesh
|
||||
and not isinstance(matgeoset["ccx_elset"], six.string_types)
|
||||
and "fluidsection_obj" in matgeoset # fluid mesh
|
||||
):
|
||||
fluidsec_obj = ccx_elset["fluidsection_obj"]
|
||||
fluidsec_obj = matgeoset["fluidsection_obj"]
|
||||
if (
|
||||
fluidsec_obj.SectionType == "Liquid"
|
||||
and (
|
||||
@@ -77,12 +77,12 @@ def handle_fluidsection_liquid_inlet_outlet(inpfile, ccxwriter):
|
||||
return None
|
||||
|
||||
def is_fluidsection_inoutlet_setnames_possible(mat_geo_sets):
|
||||
for ccx_elset in mat_geo_sets:
|
||||
for matgeoset in mat_geo_sets:
|
||||
if (
|
||||
ccx_elset["ccx_elset"]
|
||||
and "fluidsection_obj" in ccx_elset # fluid mesh
|
||||
matgeoset["ccx_elset"]
|
||||
and "fluidsection_obj" in matgeoset # fluid mesh
|
||||
):
|
||||
fluidsec_obj = ccx_elset["fluidsection_obj"]
|
||||
fluidsec_obj = matgeoset["fluidsection_obj"]
|
||||
if (
|
||||
fluidsec_obj.SectionType == "Liquid"
|
||||
and (
|
||||
@@ -95,13 +95,13 @@ def handle_fluidsection_liquid_inlet_outlet(inpfile, ccxwriter):
|
||||
|
||||
# collect elementIDs for fluidsection Liquid inlet outlet objs
|
||||
# if they have element data (happens if not "eall")
|
||||
for ccx_elset in ccxwriter.mat_geo_sets:
|
||||
fluidsec_obj = get_fluidsection_inoutlet_obj_if_setdata(ccx_elset)
|
||||
for matgeoset in ccxwriter.mat_geo_sets:
|
||||
fluidsec_obj = get_fluidsection_inoutlet_obj_if_setdata(matgeoset)
|
||||
if fluidsec_obj is None:
|
||||
continue
|
||||
elsetchanged = False
|
||||
counter = 0
|
||||
for elid in ccx_elset["ccx_elset"]:
|
||||
for elid in matgeoset["ccx_elset"]:
|
||||
counter = counter + 1
|
||||
if (elsetchanged is False) \
|
||||
and (fluidsec_obj.LiquidSectionType == "PIPE INLET"):
|
||||
@@ -111,7 +111,7 @@ def handle_fluidsection_liquid_inlet_outlet(inpfile, ccxwriter):
|
||||
)
|
||||
elsetchanged = True
|
||||
elif (fluidsec_obj.LiquidSectionType == "PIPE OUTLET") \
|
||||
and (counter == len(ccx_elset["ccx_elset"])):
|
||||
and (counter == len(matgeoset["ccx_elset"])):
|
||||
# 3rd index is to track which line nr the element is defined
|
||||
ccxwriter.FluidInletoutlet_ele.append(
|
||||
[str(elid), fluidsec_obj.LiquidSectionType, 0]
|
||||
|
||||
@@ -32,14 +32,14 @@ def write_femelement_geometry(f, ccxwriter):
|
||||
|
||||
f.write("\n{}\n".format(59 * "*"))
|
||||
f.write("** Sections\n")
|
||||
for ccx_elset in ccxwriter.mat_geo_sets:
|
||||
if ccx_elset["ccx_elset"]:
|
||||
elsetdef = "ELSET={}, ".format(ccx_elset["ccx_elset_name"])
|
||||
material = "MATERIAL={}".format(ccx_elset["mat_obj_name"])
|
||||
for matgeoset in ccxwriter.mat_geo_sets:
|
||||
if matgeoset["ccx_elset"]:
|
||||
elsetdef = "ELSET={}, ".format(matgeoset["ccx_elset_name"])
|
||||
material = "MATERIAL={}".format(matgeoset["mat_obj_name"])
|
||||
|
||||
if "beamsection_obj"in ccx_elset: # beam mesh
|
||||
beamsec_obj = ccx_elset["beamsection_obj"]
|
||||
normal = ccx_elset["beam_normal"]
|
||||
if "beamsection_obj"in matgeoset: # beam mesh
|
||||
beamsec_obj = matgeoset["beamsection_obj"]
|
||||
normal = matgeoset["beam_normal"]
|
||||
if beamsec_obj.SectionType == "Rectangular":
|
||||
height = beamsec_obj.RectHeight.getValueAs("mm").Value
|
||||
width = beamsec_obj.RectWidth.getValueAs("mm").Value
|
||||
@@ -79,8 +79,8 @@ def write_femelement_geometry(f, ccxwriter):
|
||||
f.write(section_def)
|
||||
f.write(section_geo)
|
||||
f.write(section_nor)
|
||||
elif "fluidsection_obj"in ccx_elset: # fluid mesh
|
||||
fluidsec_obj = ccx_elset["fluidsection_obj"]
|
||||
elif "fluidsection_obj"in matgeoset: # fluid mesh
|
||||
fluidsec_obj = matgeoset["fluidsection_obj"]
|
||||
if fluidsec_obj.SectionType == "Liquid":
|
||||
section_type = fluidsec_obj.LiquidSectionType
|
||||
if (section_type == "PIPE INLET") or (section_type == "PIPE OUTLET"):
|
||||
@@ -101,8 +101,8 @@ def write_femelement_geometry(f, ccxwriter):
|
||||
"""
|
||||
f.write(section_def)
|
||||
f.write(section_geo)
|
||||
elif "shellthickness_obj"in ccx_elset: # shell mesh
|
||||
shellth_obj = ccx_elset["shellthickness_obj"]
|
||||
elif "shellthickness_obj"in matgeoset: # shell mesh
|
||||
shellth_obj = matgeoset["shellthickness_obj"]
|
||||
section_def = "*SHELL SECTION, {}{}\n".format(elsetdef, material)
|
||||
thickness = shellth_obj.Thickness.getValueAs("mm").Value
|
||||
section_geo = "{:.13G}\n".format(thickness)
|
||||
|
||||
@@ -35,13 +35,13 @@ def write_femelement_matgeosets(f, ccxwriter):
|
||||
f.write("\n{}\n".format(59 * "*"))
|
||||
f.write("** Element sets for materials and FEM element type (solid, shell, beam, fluid)\n")
|
||||
|
||||
for ccx_elset in ccxwriter.mat_geo_sets:
|
||||
for matgeoset in ccxwriter.mat_geo_sets:
|
||||
|
||||
f.write("*ELSET,ELSET={}\n".format(ccx_elset["ccx_elset_name"]))
|
||||
f.write("*ELSET,ELSET={}\n".format(matgeoset["ccx_elset_name"]))
|
||||
|
||||
# use six to be sure to be Python 2.7 and 3.x compatible
|
||||
if isinstance(ccx_elset["ccx_elset"], six.string_types):
|
||||
f.write("{}\n".format(ccx_elset["ccx_elset"]))
|
||||
if isinstance(matgeoset["ccx_elset"], six.string_types):
|
||||
f.write("{}\n".format(matgeoset["ccx_elset"]))
|
||||
else:
|
||||
for elid in ccx_elset["ccx_elset"]:
|
||||
for elid in matgeoset["ccx_elset"]:
|
||||
f.write(str(elid) + ",\n")
|
||||
|
||||
Reference in New Issue
Block a user