FEM: calculix writer, add method is density needed

This commit is contained in:
UR-0
2021-06-09 12:06:07 +02:00
committed by Bernd Hahnebach
parent 05547d80e9
commit 3b323eb24b

View File

@@ -1662,17 +1662,21 @@ class FemInputWriterCcx(writerbase.FemInputWriter):
ccx_elset["ccx_mat_name"] = mat_obj.Material["Name"]
self.ccx_elsets.append(ccx_elset)
def is_DENSITY_card_needed(self):
if self.analysis_type == "frequency":
return True
if self.selfweight_objects:
return True
if self.analysis_type == "thermomech" and not self.solver_obj.ThermoMechSteadyState:
return True
return False
def write_materials(self, f):
f.write("\n***********************************************************\n")
f.write("** Materials\n")
f.write("** written by {} function\n".format(sys._getframe().f_code.co_name))
f.write("** Young\'s modulus unit is MPa = N/mm2\n")
if self.analysis_type == "frequency" \
or self.selfweight_objects \
or (
self.analysis_type == "thermomech"
and not self.solver_obj.ThermoMechSteadyState
):
if self.is_DENSITY_card_needed() is True:
f.write("** Density\'s unit is t/mm^3\n")
if self.analysis_type == "thermomech":
f.write("** Thermal conductivity unit is kW/mm/K = t*mm/K*s^3\n")
@@ -1688,12 +1692,7 @@ class FemInputWriterCcx(writerbase.FemInputWriter):
YM = FreeCAD.Units.Quantity(mat_obj.Material["YoungsModulus"])
YM_in_MPa = float(YM.getValueAs("MPa"))
PR = float(mat_obj.Material["PoissonRatio"])
if self.analysis_type == "frequency" \
or self.selfweight_objects \
or (
self.analysis_type == "thermomech"
and not self.solver_obj.ThermoMechSteadyState
):
if self.is_DENSITY_card_needed() is True:
density = FreeCAD.Units.Quantity(mat_obj.Material["Density"])
density_in_tonne_per_mm3 = float(density.getValueAs("t/mm^3"))
if self.analysis_type == "thermomech":
@@ -1718,12 +1717,7 @@ class FemInputWriterCcx(writerbase.FemInputWriter):
f.write("*ELASTIC\n")
f.write("{0:.0f}, {1:.3f}\n".format(YM_in_MPa, PR))
if self.analysis_type == "frequency" \
or self.selfweight_objects \
or (
self.analysis_type == "thermomech"
and not self.solver_obj.ThermoMechSteadyState
):
if self.is_DENSITY_card_needed() is True:
f.write("*DENSITY\n")
f.write("{0:.3e}\n".format(density_in_tonne_per_mm3))
if self.analysis_type == "thermomech":