FEM: task panel mechanical material: add thermomech related changes

This commit is contained in:
Bernd Hahnebach 2016-08-01 21:57:28 +01:00 committed by wmayer
parent ce4f8b4cf9
commit 26dabdfca7
2 changed files with 213 additions and 4 deletions

View File

@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>MechanicalMaterial</class> <class>ThermalMechanicalMaterial</class>
<widget class="QWidget" name="MechanicalMaterial"> <widget class="QWidget" name="ThermalMechanicalMaterial">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>253</width> <width>370</width>
<height>541</height> <height>713</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
@ -232,6 +232,160 @@
</layout> </layout>
</widget> </widget>
</item> </item>
<item>
<widget class="QGroupBox" name="GroupQuantities_5">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>1677215</height>
</size>
</property>
<property name="title">
<string>Temperature-Dependant Material Properties</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_8">
<item>
<layout class="QFormLayout" name="formLayout_3">
<property name="fieldGrowthPolicy">
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
</property>
<item row="0" column="0">
<widget class="QLabel" name="label_12">
<property name="text">
<string>Thermal Conductivity:</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_13">
<property name="text">
<string>Expansion Coefficient:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="Gui::InputField" name="input_fd_expansion_coefficient">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>80</width>
<height>20</height>
</size>
</property>
<property name="text">
<string>12 um/m/K</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="singleStep" stdset="0">
<double>2.000000000000000</double>
</property>
<property name="maximum" stdset="0">
<double>2000000000.000000000000000</double>
</property>
<property name="unit" stdset="0">
<string notr="true">m/m/K</string>
</property>
<property name="decimals" stdset="0">
<number>3</number>
</property>
<property name="value" stdset="0">
<double>0.000000000000000</double>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_14">
<property name="text">
<string>Specific Heat:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="Gui::InputField" name="input_fd_specific_heat">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>80</width>
<height>20</height>
</size>
</property>
<property name="text">
<string>500 J/kg/K</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="singleStep" stdset="0">
<double>2.000000000000000</double>
</property>
<property name="maximum" stdset="0">
<double>2050000000.000000000000000</double>
</property>
<property name="unit" stdset="0">
<string notr="true">J/kg/K</string>
</property>
<property name="decimals" stdset="0">
<number>3</number>
</property>
<property name="value" stdset="0">
<double>0.000000000000000</double>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="Gui::InputField" name="input_fd_thermal_conductivity">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>80</width>
<height>20</height>
</size>
</property>
<property name="text">
<string>50 W/m/K</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="singleStep" stdset="0">
<double>2.000000000000000</double>
</property>
<property name="maximum" stdset="0">
<double>2000000000.000000000000000</double>
</property>
<property name="unit" stdset="0">
<string notr="true">W/m/K</string>
</property>
<property name="decimals" stdset="0">
<number>3</number>
</property>
<property name="value" stdset="0">
<double>0.000000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item> <item>
<widget class="QGroupBox" name="GroupQuantities_3"> <widget class="QGroupBox" name="GroupQuantities_3">
<property name="maximumSize"> <property name="maximumSize">

View File

@ -51,6 +51,10 @@ class _TaskPanelMechanicalMaterial:
QtCore.QObject.connect(self.form.spinBox_poisson_ratio, QtCore.SIGNAL("valueChanged(double)"), self.pr_changed) QtCore.QObject.connect(self.form.spinBox_poisson_ratio, QtCore.SIGNAL("valueChanged(double)"), self.pr_changed)
QtCore.QObject.connect(self.form.input_fd_density, QtCore.SIGNAL("valueChanged(double)"), self.density_changed) QtCore.QObject.connect(self.form.input_fd_density, QtCore.SIGNAL("valueChanged(double)"), self.density_changed)
QtCore.QObject.connect(self.form.pushButton_Reference, QtCore.SIGNAL("clicked()"), self.add_references) QtCore.QObject.connect(self.form.pushButton_Reference, QtCore.SIGNAL("clicked()"), self.add_references)
QtCore.QObject.connect(self.form.input_fd_thermal_conductivity, QtCore.SIGNAL("valueChanged(double)"), self.tc_changed)
QtCore.QObject.connect(self.form.input_fd_expansion_coefficient, QtCore.SIGNAL("valueChanged(double)"), self.tec_changed)
QtCore.QObject.connect(self.form.input_fd_specific_heat, QtCore.SIGNAL("valueChanged(double)"), self.sh_changed)
self.form.list_References.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) self.form.list_References.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
self.form.list_References.connect(self.form.list_References, QtCore.SIGNAL("customContextMenuRequested(QPoint)"), self.references_list_right_clicked) self.form.list_References.connect(self.form.list_References, QtCore.SIGNAL("customContextMenuRequested(QPoint)"), self.references_list_right_clicked)
@ -155,6 +159,42 @@ class _TaskPanelMechanicalMaterial:
material['PoissonRatio'] = unicode(value) material['PoissonRatio'] = unicode(value)
self.material = material self.material = material
def tc_changed(self, value):
import Units
old_tc = Units.Quantity(self.material['ThermalConductivity']).getValueAs("W/m/K")
variation = 0.001
if value:
if not (1 - variation < float(old_tc) / value < 1 + variation):
# ThermalConductivity has changed
material = self.material
value_in_W_per_mK = value * 1e-3 # To compensate for use of SI units
material['ThermalConductivity'] = unicode(value_in_W_per_mK) + " W/m/K"
self.material = material
def tec_changed(self, value):
import Units
old_tec = Units.Quantity(self.material['ThermalExpansionCoefficient']).getValueAs("um/m/K")
variation = 0.001
if value:
if not (1 - variation < float(old_tec) / value < 1 + variation):
# ThermalExpansionCoefficient has changed
material = self.material
value_in_um_per_mK = value * 1e6 # To compensate for use of SI units
material['ThermalExpansionCoefficient'] = unicode(value_in_um_per_mK) + " um/m/K"
self.material = material
def sh_changed(self, value):
import Units
old_sh = Units.Quantity(self.material['SpecificHeat']).getValueAs("J/kg/K")
variation = 0.001
if value:
if not (1 - variation < float(old_sh) / value < 1 + variation):
# SpecificHeat has changed
material = self.material
value_in_J_per_kgK = value * 1e-6 # To compensate for use of SI units
material['SpecificHeat'] = unicode(value_in_J_per_kgK) + " J/kg/K"
self.material = material
def choose_material(self, index): def choose_material(self, index):
if index < 0: if index < 0:
return return
@ -193,6 +233,21 @@ class _TaskPanelMechanicalMaterial:
density = FreeCAD.Units.Quantity(matmap['Density']) density = FreeCAD.Units.Quantity(matmap['Density'])
density_with_new_unit = density.getValueAs(density_new_unit) density_with_new_unit = density.getValueAs(density_new_unit)
self.form.input_fd_density.setText("{} {}".format(density_with_new_unit, density_new_unit)) self.form.input_fd_density.setText("{} {}".format(density_with_new_unit, density_new_unit))
if 'ThermalConductivity' in matmap:
tc_new_unit = "W/m/K"
tc = FreeCAD.Units.Quantity(matmap['ThermalConductivity'])
tc_with_new_unit = tc.getValueAs(tc_new_unit)
self.form.input_fd_thermal_conductivity.setText("{} {}".format(tc_with_new_unit, tc_new_unit))
if 'ThermalExpansionCoefficient' in matmap:
tec_new_unit = "um/m/K"
tec = FreeCAD.Units.Quantity(matmap['ThermalExpansionCoefficient'])
tec_with_new_unit = tec.getValueAs(tec_new_unit)
self.form.input_fd_expansion_coefficient.setText("{} {}".format(tec_with_new_unit, tec_new_unit))
if 'SpecificHeat' in matmap:
sh_new_unit = "J/kg/K"
sh = FreeCAD.Units.Quantity(matmap['SpecificHeat'])
sh_with_new_unit = sh.getValueAs(sh_new_unit)
self.form.input_fd_specific_heat.setText("{} {}".format(sh_with_new_unit, sh_new_unit))
def add_transient_material(self, material): def add_transient_material(self, material):
material_name = self.get_material_name(material) material_name = self.get_material_name(material)