Skip to content

Commit

Permalink
[FEM] fix material task dialog for fluids
Browse files Browse the repository at this point in the history
- this fixes a mistake from commit ef08867
- 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
  • Loading branch information
donovaly committed Jul 23, 2022
1 parent 44a3582 commit 1f7374e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
18 changes: 8 additions & 10 deletions src/Mod/Fem/femtaskpanels/task_material_common.py
Expand Up @@ -141,8 +141,8 @@ def __init__(self, obj):
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)
Expand Down Expand Up @@ -265,10 +265,9 @@ def do_not_set_thermal_zeros(self):
# 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 ""
Expand Down Expand Up @@ -475,7 +474,7 @@ def check_material_keys(self):
"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"]
Expand All @@ -487,10 +486,9 @@ def check_material_keys(self):
)
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:
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Material/FluidMaterial/Water.FCMat
Expand Up @@ -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
Expand Down

0 comments on commit 1f7374e

Please sign in to comment.