FEM: material task panel, check if material properties have the appropriate units
This commit is contained in:
@@ -161,36 +161,63 @@ class _TaskPanelFemMaterial:
|
||||
webbrowser.open("http://matweb.com")
|
||||
|
||||
def check_material_keys(self):
|
||||
if 'Density' not in self.material:
|
||||
if 'Density' in self.material:
|
||||
if 'Density' not in str(Units.Unit(self.material['Density'])):
|
||||
print('Density in material data seams to have no unit or a wrong unit (reset the value): ' + self.material['Name'])
|
||||
self.material['Density'] = '0 kg/m^3'
|
||||
else:
|
||||
print('Density not found in material data of: ' + self.material['Name'])
|
||||
self.material['Density'] = '0 kg/m^3'
|
||||
if self.obj.Category == 'Solid':
|
||||
# mechanical properties
|
||||
if 'YoungsModulus' not in self.material:
|
||||
if 'YoungsModulus' in self.material:
|
||||
if 'Pressure' not in str(Units.Unit(self.material['YoungsModulus'])): # unit type of YoungsModulus is Pressure
|
||||
print('YoungsModulus in material data seams to have no unit or a wrong unit (reset the value): ' + self.material['Name'])
|
||||
self.material['YoungsModulus'] = '0 MPa'
|
||||
else:
|
||||
print('YoungsModulus not found in material data of: ' + self.material['Name'])
|
||||
self.material['YoungsModulus'] = '0 MPa'
|
||||
if 'PoissonRatio' not in self.material:
|
||||
if 'PoissonRatio' not in self.material: # PoissonRatio does not have a unit, we do not gone check for a unit
|
||||
print('PoissonRatio not found in material data of: ' + self.material['Name'])
|
||||
self.material['PoissonRatio'] = '0'
|
||||
if self.obj.Category == 'Fluid':
|
||||
# Fluidic properties
|
||||
if 'KinematicViscosity' not in self.material:
|
||||
if 'KinematicViscosity' in self.material:
|
||||
if 'KinematicViscosity' not in str(Units.Unit(self.material['KinematicViscosity'])):
|
||||
print('KinematicViscosity in material data seams to have no unit or a wrong unit (reset the value): ' + self.material['Name'])
|
||||
self.material['KinematicViscosity'] = '0 m^2/s'
|
||||
else:
|
||||
print('KinematicViscosity not found in material data of: ' + self.material['Name'])
|
||||
self.material['KinematicViscosity'] = '0 m^2/s'
|
||||
if 'VolumetricThermalExpansionCoefficient' not in self.material:
|
||||
if 'VolumetricThermalExpansionCoefficient' in self.material:
|
||||
if 'ThermalExpansionCoefficient' not in str(Units.Unit(self.material['VolumetricThermalExpansionCoefficient'])): # unit type of VolumetricThermalExpansionCoefficient is ThermalExpansionCoefficient
|
||||
print('VolumetricThermalExpansionCoefficient in material data seams to have no unit or a wrong unit (reset the value): ' + self.material['Name'])
|
||||
self.material['VolumetricThermalExpansionCoefficient'] = '0 m/m/K'
|
||||
else:
|
||||
print('VolumetricThermalExpansionCoefficient not found in material data of: ' + self.material['Name'])
|
||||
self.material['VolumetricThermalExpansionCoefficient'] = '0 m/m/K'
|
||||
# Thermal properties
|
||||
if 'ThermalConductivity' not in self.material:
|
||||
if 'ThermalConductivity' in self.material:
|
||||
if 'ThermalConductivity' not in str(Units.Unit(self.material['ThermalConductivity'])):
|
||||
print('ThermalConductivity in material data seams to have no unit or a wrong unit (reset the value): ' + self.material['Name'])
|
||||
self.material['ThermalConductivity'] = '0 W/m/K'
|
||||
else:
|
||||
print('ThermalConductivity not found in material data of: ' + self.material['Name'])
|
||||
self.material['ThermalConductivity'] = '0 W/m/K'
|
||||
if 'ThermalExpansionCoefficient' not in self.material:
|
||||
if 'ThermalExpansionCoefficient' in self.material:
|
||||
if 'ThermalExpansionCoefficient' not in str(Units.Unit(self.material['ThermalExpansionCoefficient'])):
|
||||
print('ThermalExpansionCoefficient in material data seams to have no unit or a wrong unit (reset the value): ' + self.material['Name'])
|
||||
self.material['ThermalExpansionCoefficient'] = '0 um/m/K'
|
||||
else:
|
||||
print('ThermalExpansionCoefficient not found in material data of: ' + self.material['Name'])
|
||||
self.material['ThermalExpansionCoefficient'] = '0 um/m/K'
|
||||
if 'SpecificHeat' not in self.material:
|
||||
if 'SpecificHeat' in self.material:
|
||||
if 'SpecificHeat' not in str(Units.Unit(self.material['SpecificHeat'])):
|
||||
print('SpecificHeat in material data seams to have no unit or a wrong unit (reset the value): ' + self.material['Name'])
|
||||
self.material['SpecificHeat'] = '0 J/kg/K'
|
||||
else:
|
||||
print('SpecificHeat not found in material data of: ' + self.material['Name'])
|
||||
self.material['SpecificHeat'] = '0 J/kg/K'
|
||||
# Electromagnetic properties
|
||||
|
||||
def ym_changed(self, value):
|
||||
# FreeCADs standard unit for stress is kPa
|
||||
|
||||
Reference in New Issue
Block a user