[FEM] fix material task dialog for fluids

- this fixes a mistake from commit 821dc915
- it also consistently use the thermal expansion coefficient
- add code comments

now the material task dialog works with all fluid materials without errors or warnings
This commit is contained in:
Uwe
2022-07-23 04:59:10 +02:00
parent 3b6e5d7b79
commit 68659771f5
2 changed files with 9 additions and 11 deletions

View File

@@ -141,8 +141,8 @@ class _TaskPanel:
self.parameterWidget.label_category.setText(self.obj.Category)
if self.obj.Category == "Fluid":
self.parameterWidget.groupBox_mechanical.setVisible(0)
self.parameterWidget.label_expansion_coefficient.setVisible(0)
self.parameterWidget.input_fd_expansion_coefficient.setVisible(0)
self.parameterWidget.label_vol_expansion_coefficient.setVisible(0)
self.parameterWidget.input_fd_vol_expansion_coefficient.setVisible(0)
else:
self.parameterWidget.groupBox_fluidic.setVisible(0)
self.parameterWidget.label_vol_expansion_coefficient.setVisible(0)
@@ -265,10 +265,9 @@ class _TaskPanel:
# choose material ****************************************************************************
def get_material_card(self, material):
for a_mat in self.materials:
# check if every item of the current material fits to a known material card
# if all items were found we know it is the right card
unmatched_items = set(self.materials[a_mat].items()) ^ set(material.items())
# print(a_mat + " --> unmatched_items = " + str(len(unmatched_items)))
# if len(unmatched_items) < 4:
# print(unmatched_items)
if len(unmatched_items) == 0:
return a_mat
return ""
@@ -475,7 +474,7 @@ class _TaskPanel:
"ThermalExpansionCoefficient not found in {}\n"
.format(self.material["Name"])
)
self.material["VolumetricThermalExpansionCoefficient"] = "0 1/K"
self.material["ThermalExpansionCoefficient"] = "0 1/K"
if "VolumetricThermalExpansionCoefficient" in self.material:
# unit type VolumetricThermalExpansionCoefficient is ThermalExpansionCoefficient
vol_ther_ex_co = self.material["VolumetricThermalExpansionCoefficient"]
@@ -487,10 +486,9 @@ class _TaskPanel:
)
self.material["VolumetricThermalExpansionCoefficient"] = "0 1/K"
else:
if "ThermalExpansionCoefficient" in self.material:
the_index = "VolumetricThermalExpansionCoefficient" # line was to long
self.material[the_index] = self.material["ThermalExpansionCoefficient"]
else:
# as fallback only add VolumetricThermalExpansionCoefficient if there is no
# ThermalExpansionCoefficient
if "ThermalExpansionCoefficient" not in self.material:
self.material["VolumetricThermalExpansionCoefficient"] = "0 1/K"
# Thermal properties
if "ThermalConductivity" in self.material:

View File

@@ -17,7 +17,7 @@ PrandtlNumber = 7.56
SpecificHeat = 4182 J/kg/K
ThermalConductivity = 0.591 W/m/K
; https://en.wikipedia.org/wiki/Water
VolumetricThermalExpansionCoefficient = 2.07e-4 m/m/K
ThermalExpansionCoefficient = 2.07e-4 m/m/K
[Electrical]
RelativePermittivity = 80.0