FEM: calculix writer, make use of the member objs everywhere

This commit is contained in:
Bernd Hahnebach
2021-07-16 07:56:27 +02:00
parent 7df9e7fe63
commit 6a76c7668d
6 changed files with 26 additions and 20 deletions

View File

@@ -78,7 +78,7 @@ def write_constraint(f, femobj, disp_obj, ccxwriter):
elif not disp_obj.zFree:
f.write("{},3,3,{:.13G}\n".format(disp_obj.Name, disp_obj.zDisplacement))
if ccxwriter.beamsection_objects or ccxwriter.shellthickness_objects:
if ccxwriter.member.geos_beamsection or ccxwriter.member.geos_shellthickness:
if disp_obj.rotxFix:
f.write("{},4\n".format(disp_obj.Name))
elif not disp_obj.rotxFree:

View File

@@ -57,7 +57,10 @@ def get_after_write_constraint():
def write_meshdata_constraint(f, femobj, fix_obj, ccxwriter):
if (
ccxwriter.femmesh.Volumes
and (len(ccxwriter.shellthickness_objects) > 0 or len(ccxwriter.beamsection_objects) > 0)
and (
len(ccxwriter.member.geos_shellthickness) > 0
or len(ccxwriter.member.geos_beamsection) > 0
)
):
if len(femobj["NodesSolid"]) > 0:
f.write("*NSET,NSET={}Solid\n".format(fix_obj.Name))
@@ -79,7 +82,10 @@ def write_constraint(f, femobj, fix_obj, ccxwriter):
if (
ccxwriter.femmesh.Volumes
and (len(ccxwriter.shellthickness_objects) > 0 or len(ccxwriter.beamsection_objects) > 0)
and (
len(ccxwriter.member.geos_shellthickness) > 0
or len(ccxwriter.member.geos_beamsection) > 0
)
):
if len(femobj["NodesSolid"]) > 0:
f.write("*BOUNDARY\n")
@@ -101,7 +107,7 @@ def write_constraint(f, femobj, fix_obj, ccxwriter):
f.write(fix_obj.Name + ",1\n")
f.write(fix_obj.Name + ",2\n")
f.write(fix_obj.Name + ",3\n")
if ccxwriter.beamsection_objects or ccxwriter.shellthickness_objects:
if ccxwriter.member.geos_beamsection or ccxwriter.member.geos_shellthickness:
f.write(fix_obj.Name + ",4\n")
f.write(fix_obj.Name + ",5\n")
f.write(fix_obj.Name + ",6\n")

View File

@@ -43,7 +43,7 @@ from femmesh import meshtools
# as it is none standard constraint method compared to all other constraints
def handle_fluidsection_liquid_inlet_outlet(inpfile, ccxwriter):
if not ccxwriter.fluidsection_objects:
if not ccxwriter.member.geos_fluidsection:
return inpfile
# Fluid sections:
@@ -139,7 +139,7 @@ def handle_fluidsection_liquid_inlet_outlet(inpfile, ccxwriter):
# split method into separate methods and move some part into base writer
# see also method handle_fluidsection_liquid_inlet_outlet
def write_constraints_fluidsection(f, ccxwriter):
if not ccxwriter.fluidsection_objects:
if not ccxwriter.member.geos_fluidsection:
return
if ccxwriter.analysis_type not in ["thermomech"]:
return
@@ -158,7 +158,7 @@ def write_constraints_fluidsection(f, ccxwriter):
)
# get nodes
ccxwriter.get_constraints_fluidsection_nodes()
for femobj in ccxwriter.fluidsection_objects:
for femobj in ccxwriter.member.geos_fluidsection:
# femobj --> dict, FreeCAD document object is femobj["Object"]
fluidsection_obj = femobj["Object"]
f.write("** " + fluidsection_obj.Label + "\n")

View File

@@ -42,16 +42,16 @@ def write_femelement_material(f, ccxwriter):
and not ccxwriter.solver_obj.ThermoMechSteadyState
):
return True
if ccxwriter.centrif_objects:
if ccxwriter.member.cons_centrif:
return True
if ccxwriter.selfweight_objects:
if ccxwriter.member.cons_selfweight:
return True
return False
f.write("\n{}\n".format(59 * "*"))
f.write("** Materials\n")
f.write("** see information about units at file end\n")
for femobj in ccxwriter.material_objects:
for femobj in ccxwriter.member.mats_linear:
# femobj --> dict, FreeCAD document object is femobj["Object"]
mat_obj = femobj["Object"]
mat_info_name = mat_obj.Material["Name"]
@@ -107,7 +107,7 @@ def write_femelement_material(f, ccxwriter):
# nonlinear material properties
if ccxwriter.solver_obj.MaterialNonlinearity == "nonlinear":
for nlfemobj in ccxwriter.material_nonlinear_objects:
for nlfemobj in ccxwriter.member.mats_nonlinear:
# femobj --> dict, FreeCAD document object is nlfemobj["Object"]
nl_mat_obj = nlfemobj["Object"]
if nl_mat_obj.LinearBaseMaterial == mat_obj:

View File

@@ -48,7 +48,7 @@ def write_mesh(ccxwriter):
)
# Check to see if fluid sections are in analysis and use D network element type
if ccxwriter.fluidsection_objects:
if ccxwriter.member.geos_fluidsection:
meshtools.write_D_network_element_to_inputfile(ccxwriter.femmesh_file)
inpfile = codecs.open(ccxwriter.file_name, "w", encoding="utf-8")
@@ -65,7 +65,7 @@ def write_mesh(ccxwriter):
)
# Check to see if fluid sections are in analysis and use D network element type
if ccxwriter.fluidsection_objects:
if ccxwriter.member.geos_fluidsection:
# inpfile is closed
meshtools.write_D_network_element_to_inputfile(ccxwriter.femmesh_file)

View File

@@ -31,9 +31,9 @@ def write_step_output(f, ccxwriter):
f.write("\n{}\n".format(59 * "*"))
f.write("** Outputs --> frd file\n")
if (
ccxwriter.beamsection_objects
or ccxwriter.shellthickness_objects
or ccxwriter.fluidsection_objects
ccxwriter.member.geos_beamsection
or ccxwriter.member.geos_shellthickness
or ccxwriter.member.geos_fluidsection
):
if ccxwriter.solver_obj.BeamShellResultOutput3D is False:
f.write("*NODE FILE, OUTPUT=2d\n")
@@ -43,13 +43,13 @@ def write_step_output(f, ccxwriter):
f.write("*NODE FILE\n")
# MPH write out nodal temperatures if thermomechanical
if ccxwriter.analysis_type == "thermomech":
if not ccxwriter.fluidsection_objects:
if not ccxwriter.member.geos_fluidsection:
f.write("U, NT\n")
else:
f.write("MF, PS\n")
else:
f.write("U\n")
if not ccxwriter.fluidsection_objects:
if not ccxwriter.member.geos_fluidsection:
f.write("*EL FILE\n")
if ccxwriter.solver_obj.MaterialNonlinearity == "nonlinear":
f.write("S, E, PEEQ\n")
@@ -58,11 +58,11 @@ def write_step_output(f, ccxwriter):
# dat file
# reaction forces: freecadweb.org/tracker/view.php?id=2934
if ccxwriter.fixed_objects:
if ccxwriter.member.cons_fixed:
f.write("** outputs --> dat file\n")
# reaction forces for all Constraint fixed
f.write("** reaction forces for Constraint fixed\n")
for femobj in ccxwriter.fixed_objects:
for femobj in ccxwriter.member.cons_fixed:
# femobj --> dict, FreeCAD document object is femobj["Object"]
fix_obj_name = femobj["Object"].Name
f.write("*NODE PRINT, NSET={}, TOTALS=ONLY\n".format(fix_obj_name))