From 31fd5be0c48fa020aba9b283db38519004ce04ca Mon Sep 17 00:00:00 2001 From: Bernd Hahnebach Date: Tue, 20 Jul 2021 09:53:22 +0200 Subject: [PATCH] FEM: calculix writer, use generic elset variable names --- .../calculix/write_constraint_fluidsection.py | 28 +++++++++---------- .../calculix/write_femelement_geometry.py | 22 +++++++-------- .../calculix/write_femelement_matgeosets.py | 10 +++---- 3 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/Mod/Fem/femsolver/calculix/write_constraint_fluidsection.py b/src/Mod/Fem/femsolver/calculix/write_constraint_fluidsection.py index 1c07af5e5e..b5819bcbd7 100644 --- a/src/Mod/Fem/femsolver/calculix/write_constraint_fluidsection.py +++ b/src/Mod/Fem/femsolver/calculix/write_constraint_fluidsection.py @@ -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] diff --git a/src/Mod/Fem/femsolver/calculix/write_femelement_geometry.py b/src/Mod/Fem/femsolver/calculix/write_femelement_geometry.py index e38b044ee1..5a695d9974 100644 --- a/src/Mod/Fem/femsolver/calculix/write_femelement_geometry.py +++ b/src/Mod/Fem/femsolver/calculix/write_femelement_geometry.py @@ -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) diff --git a/src/Mod/Fem/femsolver/calculix/write_femelement_matgeosets.py b/src/Mod/Fem/femsolver/calculix/write_femelement_matgeosets.py index 01f0f6720f..daa27e6749 100644 --- a/src/Mod/Fem/femsolver/calculix/write_femelement_matgeosets.py +++ b/src/Mod/Fem/femsolver/calculix/write_femelement_matgeosets.py @@ -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")