Merge pull request #16380 from FEA-eng/fluid_mat_fix

FEM: Fluid material properties fix
This commit is contained in:
Chris Hennes
2024-09-08 16:27:37 -05:00
committed by GitHub
3 changed files with 21 additions and 22 deletions

View File

@@ -183,7 +183,7 @@
<double>2.000000000000000</double>
</property>
<property name="maximum">
<double>2000000000.000000000000000</double>
<double>99999999999.000000000000000</double>
</property>
<property name="unit" stdset="0">
<string notr="true">kg/m^3</string>
@@ -252,7 +252,7 @@
<double>2.000000000000000</double>
</property>
<property name="maximum">
<double>90000000000.000000000000000</double>
<double>99999999999.000000000000000</double>
</property>
<property name="unit" stdset="0">
<string notr="true">Pa</string>
@@ -362,7 +362,7 @@
<double>0.000001000000000</double>
</property>
<property name="maximum">
<double>1000.000000000000000</double>
<double>99999999999.000000000000000</double>
</property>
<property name="unit" stdset="0">
<string notr="true">m^2/s</string>
@@ -431,7 +431,7 @@
<double>2.000000000000000</double>
</property>
<property name="maximum">
<double>2000000000.000000000000000</double>
<double>99999999999.000000000000000</double>
</property>
<property name="unit" stdset="0">
<string notr="true">W/m/K</string>
@@ -478,7 +478,7 @@
<double>2.000000000000000</double>
</property>
<property name="maximum">
<double>2000000000.000000000000000</double>
<double>99999999999.000000000000000</double>
</property>
<property name="unit" stdset="0">
<string notr="true">m/m/K</string>
@@ -525,7 +525,7 @@
<double>2.000000000000000</double>
</property>
<property name="maximum">
<double>2050000000.000000000000000</double>
<double>99999999999.000000000000000</double>
</property>
<property name="unit" stdset="0">
<string notr="true">J/kg/K</string>

View File

@@ -82,8 +82,9 @@ def write_femelement_material(f, ccxwriter):
TEC = FreeCAD.Units.Quantity(mat_obj.Material["ThermalExpansionCoefficient"])
TEC_in_mmK = TEC.getValueAs("mm/mm/K").Value
elif mat_obj.Category == "Fluid":
DV = FreeCAD.Units.Quantity(mat_obj.Material["DynamicViscosity"])
DV_in_tmms = DV.getValueAs("t/mm/s").Value
KV = FreeCAD.Units.Quantity(mat_obj.Material["KinematicViscosity"])
KV_in_mm2s = KV.getValueAs("mm^2/s").Value
DV_in_tmms = KV_in_mm2s * density_in_tonne_per_mm3
# write material properties
f.write(f"** FreeCAD material name: {mat_info_name}\n")

View File

@@ -567,20 +567,18 @@ class _TaskPanel(base_femtaskpanel._BaseTaskPanel):
old_value = Units.Quantity(self.material[matProperty]).Value
# value = float(inputfield_text) # this fails on locale with comma
# https://forum.freecad.org/viewtopic.php?f=18&t=56912&p=523313#p523313
if value:
if not (1 - variation < float(old_value) / value < 1 + variation):
material = self.material
if qUnit != "":
material[matProperty] = str(value) + " " + qUnit
else:
material[matProperty] = str(value)
self.material = material
if self.has_transient_mat is False:
self.add_transient_material()
else:
self.set_transient_material()
else:
pass # some check or default value set can be done here
if not (1 - variation < float(old_value) / value < 1 + variation):
material = self.material
if qUnit != "":
material[matProperty] = str(value) + " " + qUnit
else:
material[matProperty] = str(value)
self.material = material
if self.has_transient_mat is False:
self.add_transient_material()
else:
self.set_transient_material()
# print(inputfield_text)
# mechanical input fields