Skip to content

Commit

Permalink
FEM: ccx input writer, splitted, improve heatflux constraint
Browse files Browse the repository at this point in the history
  • Loading branch information
berndhahnebach committed Apr 24, 2020
1 parent b2dbd8c commit c0aa89e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
30 changes: 17 additions & 13 deletions src/Mod/Fem/femsolver/calculix/writer.py
Expand Up @@ -231,16 +231,7 @@ def write_calculix_splitted_input_file(self):
self.write_constraints_force(inpfileMain, True)
self.write_constraints_pressure(inpfileMain, True)
self.write_constraints_temperature(inpfileMain)

if self.analysis_type == "thermomech" and self.heatflux_objects:
inpfileMain.write("\n***********************************************************\n")
inpfileMain.write("** Convective heat transfer (heat flux)\n")
inpfileMain.write("** written by write_constraints_heatflux\n")
inpfileMain.write("*INCLUDE,INPUT=" + self.mesh_name + "_Node_Heatlfux.inp \n")
inpfileHeatflux = open(self.include + "_Node_Heatlfux.inp", "w")
self.write_constraints_heatflux(inpfileHeatflux)
inpfileHeatflux.close()

self.write_constraints_heatflux(inpfileMain, True)
self.write_constraints_fluidsection(inpfileMain)

# output and step end
Expand Down Expand Up @@ -1279,16 +1270,29 @@ def write_constraints_temperature(self, f):
))
f.write("\n")

def write_constraints_heatflux(self, f):
def write_constraints_heatflux(self, f, splitted=None):
if not self.heatflux_objects:
return
if not self.analysis_type == "thermomech":
return

# write constraint to file
write_name = "constraints_heatflux_element_face_heatflux"
f.write("\n***********************************************************\n")
f.write("** Heatflux constraints\n")
f.write("** {}\n".format(write_name.replace("_", " ")))
f.write("** written by {} function\n".format(sys._getframe().f_code.co_name))

if splitted is True:
file_name_splitt = self.mesh_name + "_" + write_name + ".inp"
f.write("** {}\n".format(write_name.replace("_", " ")))
f.write("*INCLUDE,INPUT={}\n".format(file_name_splitt))
inpfile_splitt = open(join(self.dir_name, file_name_splitt), "w")
self.write_faceheatflux_constraints_heatflux(inpfile_splitt)
inpfile_splitt.close()
else:
self.write_faceheatflux_constraints_heatflux(f)

def write_faceheatflux_constraints_heatflux(self, f):
# write heat flux faces to file
for hfobj in self.heatflux_objects:
heatflux_obj = hfobj["Object"]
f.write("** " + heatflux_obj.Label + "\n")
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Fem/femtest/data/ccx/spine_thermomech.inp
Expand Up @@ -165,7 +165,7 @@ FemConstraintTemperature,11,11,310.93


***********************************************************
** Heatflux constraints
** constraints heatflux element face heatflux
** written by write_constraints_heatflux function
** FemConstraintHeatflux
*FILM
Expand Down

0 comments on commit c0aa89e

Please sign in to comment.