FEM: calculix writer, add write before and write after to constraints modules
This commit is contained in:
@@ -44,6 +44,22 @@ def get_constraint_title():
|
||||
return "Centrif Constraints"
|
||||
|
||||
|
||||
def get_before_write_meshdata_constraint():
|
||||
return ""
|
||||
|
||||
|
||||
def get_after_write_meshdata_constraint():
|
||||
return ""
|
||||
|
||||
|
||||
def get_before_write_constraint():
|
||||
return ""
|
||||
|
||||
|
||||
def get_after_write_constraint():
|
||||
return ""
|
||||
|
||||
|
||||
def write_meshdata_constraint(f, femobj, centrif_obj, ccxwriter):
|
||||
f.write("*ELSET,ELSET={}\n".format(centrif_obj.Name))
|
||||
# use six to be sure to be Python 2.7 and 3.x compatible
|
||||
|
||||
@@ -38,6 +38,22 @@ def get_constraint_title():
|
||||
return "Contact Constraints"
|
||||
|
||||
|
||||
def get_before_write_meshdata_constraint():
|
||||
return ""
|
||||
|
||||
|
||||
def get_after_write_meshdata_constraint():
|
||||
return ""
|
||||
|
||||
|
||||
def get_before_write_constraint():
|
||||
return ""
|
||||
|
||||
|
||||
def get_after_write_constraint():
|
||||
return ""
|
||||
|
||||
|
||||
def write_meshdata_constraint(f, femobj, contact_obj, ccxwriter):
|
||||
# slave DEP
|
||||
f.write("*SURFACE, NAME=DEP{}\n".format(contact_obj.Name))
|
||||
|
||||
@@ -38,6 +38,22 @@ def get_constraint_title():
|
||||
return "Displacement constraint applied"
|
||||
|
||||
|
||||
def get_before_write_meshdata_constraint():
|
||||
return ""
|
||||
|
||||
|
||||
def get_after_write_meshdata_constraint():
|
||||
return ""
|
||||
|
||||
|
||||
def get_before_write_constraint():
|
||||
return ""
|
||||
|
||||
|
||||
def get_after_write_constraint():
|
||||
return "\n"
|
||||
|
||||
|
||||
def write_meshdata_constraint(f, femobj, disp_obj, ccxwriter):
|
||||
f.write("*NSET,NSET={}\n".format(disp_obj.Name))
|
||||
for n in femobj["Nodes"]:
|
||||
|
||||
@@ -38,6 +38,22 @@ def get_constraint_title():
|
||||
return "Fixed Constraints"
|
||||
|
||||
|
||||
def get_before_write_meshdata_constraint():
|
||||
return ""
|
||||
|
||||
|
||||
def get_after_write_meshdata_constraint():
|
||||
return ""
|
||||
|
||||
|
||||
def get_before_write_constraint():
|
||||
return ""
|
||||
|
||||
|
||||
def get_after_write_constraint():
|
||||
return ""
|
||||
|
||||
|
||||
def write_meshdata_constraint(f, femobj, fix_obj, ccxwriter):
|
||||
if (
|
||||
ccxwriter.femmesh.Volumes
|
||||
|
||||
@@ -34,6 +34,14 @@ def get_sets_name():
|
||||
return "constraints_force_node_loads"
|
||||
|
||||
|
||||
def get_before_write_meshdata_constraint():
|
||||
return "*CLOAD\n"
|
||||
|
||||
|
||||
def get_after_write_meshdata_constraint():
|
||||
return ""
|
||||
|
||||
|
||||
def write_meshdata_constraint(f, femobj, force_obj, ccxwriter):
|
||||
direction_vec = femobj["Object"].DirectionVector
|
||||
for ref_shape in femobj["NodeLoadTable"]:
|
||||
|
||||
@@ -34,6 +34,14 @@ def get_sets_name():
|
||||
return "constraints_heatflux_element_face_heatflux"
|
||||
|
||||
|
||||
def get_before_write_meshdata_constraint():
|
||||
return ""
|
||||
|
||||
|
||||
def get_after_write_meshdata_constraint():
|
||||
return ""
|
||||
|
||||
|
||||
def write_meshdata_constraint(f, femobj, heatflux_obj, ccxwriter):
|
||||
if heatflux_obj.ConstraintType == "Convection":
|
||||
heatflux_key_word = "FILM"
|
||||
|
||||
@@ -41,6 +41,22 @@ def get_constraint_title():
|
||||
return "PlaneRotation Constraints"
|
||||
|
||||
|
||||
def get_before_write_meshdata_constraint():
|
||||
return ""
|
||||
|
||||
|
||||
def get_after_write_meshdata_constraint():
|
||||
return ""
|
||||
|
||||
|
||||
def get_before_write_constraint():
|
||||
return ""
|
||||
|
||||
|
||||
def get_after_write_constraint():
|
||||
return ""
|
||||
|
||||
|
||||
def write_meshdata_constraint(f, femobj, fric_obj, ccxwriter):
|
||||
# write nodes to file
|
||||
if not ccxwriter.femnodes_mesh:
|
||||
|
||||
@@ -34,6 +34,14 @@ def get_sets_name():
|
||||
return "constraints_pressure_element_face_loads"
|
||||
|
||||
|
||||
def get_before_write_meshdata_constraint():
|
||||
return ""
|
||||
|
||||
|
||||
def get_after_write_meshdata_constraint():
|
||||
return ""
|
||||
|
||||
|
||||
def write_meshdata_constraint(f, femobj, prs_obj, ccxwriter):
|
||||
rev = -1 if prs_obj.Reversed else 1
|
||||
f.write("*DLOAD\n")
|
||||
|
||||
@@ -38,6 +38,22 @@ def get_constraint_title():
|
||||
return "SectionPrint Constraints"
|
||||
|
||||
|
||||
def get_before_write_meshdata_constraint():
|
||||
return ""
|
||||
|
||||
|
||||
def get_after_write_meshdata_constraint():
|
||||
return ""
|
||||
|
||||
|
||||
def get_before_write_constraint():
|
||||
return ""
|
||||
|
||||
|
||||
def get_after_write_constraint():
|
||||
return ""
|
||||
|
||||
|
||||
def write_meshdata_constraint(f, femobj, sectionprint_obj, ccxwriter):
|
||||
f.write("*SURFACE, NAME=SECTIONFACE{}\n".format(sectionprint_obj.Name))
|
||||
for i in femobj["SectionPrintFaces"]:
|
||||
|
||||
@@ -44,6 +44,22 @@ def write_meshdata_constraint(f, femobj, temp_obj, ccxwriter):
|
||||
f.write("{},\n".format(n))
|
||||
|
||||
|
||||
def get_before_write_meshdata_constraint():
|
||||
return ""
|
||||
|
||||
|
||||
def get_after_write_meshdata_constraint():
|
||||
return ""
|
||||
|
||||
|
||||
def get_before_write_constraint():
|
||||
return ""
|
||||
|
||||
|
||||
def get_after_write_constraint():
|
||||
return ""
|
||||
|
||||
|
||||
def write_constraint(f, femobj, temp_obj, ccxwriter):
|
||||
NumberOfNodes = len(femobj["Nodes"])
|
||||
if temp_obj.ConstraintType == "Temperature":
|
||||
|
||||
@@ -38,6 +38,22 @@ def get_constraint_title():
|
||||
return "Tie Constraints"
|
||||
|
||||
|
||||
def get_before_write_meshdata_constraint():
|
||||
return ""
|
||||
|
||||
|
||||
def get_after_write_meshdata_constraint():
|
||||
return ""
|
||||
|
||||
|
||||
def get_before_write_constraint():
|
||||
return ""
|
||||
|
||||
|
||||
def get_after_write_constraint():
|
||||
return ""
|
||||
|
||||
|
||||
def write_meshdata_constraint(f, femobj, tie_obj, ccxwriter):
|
||||
# slave DEP
|
||||
f.write("*SURFACE, NAME=TIE_DEP{}\n".format(tie_obj.Name))
|
||||
|
||||
@@ -41,6 +41,22 @@ def get_constraint_title():
|
||||
return "Transform Constraints"
|
||||
|
||||
|
||||
def get_before_write_meshdata_constraint():
|
||||
return ""
|
||||
|
||||
|
||||
def get_after_write_meshdata_constraint():
|
||||
return ""
|
||||
|
||||
|
||||
def get_before_write_constraint():
|
||||
return ""
|
||||
|
||||
|
||||
def get_after_write_constraint():
|
||||
return ""
|
||||
|
||||
|
||||
def write_meshdata_constraint(f, femobj, trans_obj, ccxwriter):
|
||||
if trans_obj.TransformType == "Rectangular":
|
||||
f.write("*NSET,NSET=Rect{}\n".format(trans_obj.Name))
|
||||
|
||||
@@ -292,10 +292,15 @@ class FemInputWriterCcx(writerbase.FemInputWriter):
|
||||
self,
|
||||
f,
|
||||
femobjs,
|
||||
write_before="",
|
||||
write_after="",
|
||||
con_module=None
|
||||
):
|
||||
if not femobjs:
|
||||
return
|
||||
|
||||
analysis_types = con_module.get_analysis_types()
|
||||
if analysis_types != "all" and self.analysis_type not in analysis_types:
|
||||
return
|
||||
|
||||
def constraint_sets_loop_writing(the_file, femobjs, write_before, write_after):
|
||||
if write_before != "":
|
||||
f.write(write_before)
|
||||
@@ -307,12 +312,8 @@ class FemInputWriterCcx(writerbase.FemInputWriter):
|
||||
if write_after != "":
|
||||
f.write(write_after)
|
||||
|
||||
if not femobjs:
|
||||
return
|
||||
|
||||
analysis_types = con_module.get_analysis_types()
|
||||
if analysis_types != "all" and self.analysis_type not in analysis_types:
|
||||
return
|
||||
write_before = con_module.get_before_write_meshdata_constraint()
|
||||
write_after = con_module.get_after_write_meshdata_constraint()
|
||||
|
||||
# write sets to file
|
||||
write_name = con_module.get_sets_name()
|
||||
@@ -335,8 +336,6 @@ class FemInputWriterCcx(writerbase.FemInputWriter):
|
||||
self,
|
||||
f,
|
||||
femobjs,
|
||||
write_before="",
|
||||
write_after="",
|
||||
con_module=None
|
||||
):
|
||||
|
||||
@@ -347,6 +346,9 @@ class FemInputWriterCcx(writerbase.FemInputWriter):
|
||||
if analysis_types != "all" and self.analysis_type not in analysis_types:
|
||||
return
|
||||
|
||||
write_before = con_module.get_before_write_constraint()
|
||||
write_after = con_module.get_after_write_constraint()
|
||||
|
||||
# write constraint to file
|
||||
f.write("\n{}\n".format(59 * "*"))
|
||||
f.write("** {}\n".format(con_module.get_constraint_title()))
|
||||
@@ -389,7 +391,6 @@ class FemInputWriterCcx(writerbase.FemInputWriter):
|
||||
self.write_constraints_data(
|
||||
f,
|
||||
femobjs=self.displacement_objects,
|
||||
write_after="\n",
|
||||
con_module=con_displacement
|
||||
)
|
||||
|
||||
@@ -561,7 +562,6 @@ class FemInputWriterCcx(writerbase.FemInputWriter):
|
||||
self.write_constraints_sets(
|
||||
f,
|
||||
femobjs=self.force_objects,
|
||||
write_before="*CLOAD\n",
|
||||
con_module=con_force
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user