Fem: Enable expression for the heat flux constraint task panel

This commit is contained in:
marioalexis
2024-10-08 15:26:28 -03:00
committed by Chris Hennes
parent 736f03caf2
commit 40531158f2
7 changed files with 200 additions and 138 deletions

View File

@@ -49,22 +49,22 @@ def write_meshdata_constraint(f, femobj, heatflux_obj, ccxwriter):
if heatflux_obj.ConstraintType == "Convection":
heatflux_key_word = "FILM"
heatflux_facetype = "F"
# SvdW: add factor to force heatflux to units system of t/mm/s/K
heatflux_values = "{:.13G},{:.13G}".format(
heatflux_obj.AmbientTemp, heatflux_obj.FilmCoef * 0.001
heatflux_obj.AmbientTemp.getValueAs("K").Value,
heatflux_obj.FilmCoef.getValueAs("t/s^3/K").Value,
)
elif heatflux_obj.ConstraintType == "Radiation":
heatflux_key_word = "RADIATE"
heatflux_facetype = "R"
heatflux_values = "{:.13G},{:.13G}".format(
heatflux_obj.AmbientTemp, heatflux_obj.Emissivity
heatflux_obj.AmbientTemp.getValueAs("K").Value, heatflux_obj.Emissivity
)
elif heatflux_obj.ConstraintType == "DFlux":
heatflux_key_word = "DFLUX"
heatflux_facetype = "S"
heatflux_values = f"{heatflux_obj.DFlux * 0.001:.13G}"
heatflux_values = "{:.13G}".format(heatflux_obj.DFlux.getValueAs("t/s^3").Value)
f.write(f"*{heatflux_key_word}\n")
for ref_shape in femobj["HeatFluxFaceTable"]:

View File

@@ -117,12 +117,12 @@ class Heatwriter:
if obj.References:
for name in obj.References[0][1]:
if obj.ConstraintType == "Convection":
film = self.write.getFromUi(obj.FilmCoef, "W/(m^2*K)", "M/(T^3*O)")
temp = self.write.getFromUi(obj.AmbientTemp, "K", "O")
film = obj.FilmCoef.getValueAs("W/(m^2*K)").Value
temp = obj.AmbientTemp.getValueAs("K").Value
self.write.boundary(name, "Heat Transfer Coefficient", film)
self.write.boundary(name, "External Temperature", temp)
elif obj.ConstraintType == "DFlux":
flux = self.write.getFromUi(obj.DFlux, "W/m^2", "M*T^-3")
flux = obj.DFlux.getValueAs("W/m^2").Value
self.write.boundary(name, "Heat Flux BC", True)
self.write.boundary(name, "Heat Flux", flux)
self.write.handled(obj)