FEM: elmer writer, equation elasticity, only write needed material values

This commit is contained in:
Bernd Hahnebach
2020-07-07 12:31:35 +02:00
parent d8a2da610f
commit c3da895a1f
8 changed files with 11 additions and 24 deletions

View File

@@ -82,10 +82,6 @@ def setup_base(doc=None, solvertype="ccxtools"):
mat["YoungsModulus"] = "200000 MPa"
mat["PoissonRatio"] = "0.30"
mat["Density"] = "7900 kg/m^3"
if solvertype == "elmer":
# set ThermalExpansionCoefficient
# FIXME elmer elasticity needs the dictionary key "ThermalExpansionCoefficient"
mat["ThermalExpansionCoefficient"] = "0.012 mm/m/K"
material_object.Material = mat
# mesh

View File

@@ -109,9 +109,6 @@ def setup_cantileverbase(doc=None, solvertype="ccxtools"):
mat["YoungsModulus"] = "210000 MPa"
mat["PoissonRatio"] = "0.30"
mat["Density"] = "7900 kg/m^3"
if solvertype == "elmer":
# set ThermalExpansionCoefficient, elmer elasticity needs it FIXME
mat["ThermalExpansionCoefficient"] = "0.012 mm/m/K"
material_object.Material = mat
# fixed_constraint

View File

@@ -598,6 +598,7 @@ class Writer(object):
return None
def _handleElasticityMaterial(self, bodies):
gravObj = self._getSingleMember("Fem::ConstraintSelfWeight")
tempObj = self._getSingleMember("Fem::ConstraintInitialTemperature")
if tempObj is not None:
refTemp = getFromUi(tempObj.initialTemperature, "K", "O")
@@ -611,10 +612,11 @@ class Writer(object):
else self._getAllBodies()
)
for name in (n for n in refs if n in bodies):
self._material(
name, "Density",
self._getDensity(m)
)
if gravObj:
self._material(
name, "Density",
self._getDensity(m)
)
self._material(
name, "Youngs Modulus",
self._getYoungsModulus(m)
@@ -623,10 +625,11 @@ class Writer(object):
name, "Poisson ratio",
float(m["PoissonRatio"])
)
self._material(
name, "Heat expansion Coefficient",
convert(m["ThermalExpansionCoefficient"], "O^-1")
)
if tempObj:
self._material(
name, "Heat expansion Coefficient",
convert(m["ThermalExpansionCoefficient"], "O^-1")
)
def _getDensity(self, m):
density = convert(m["Density"], "M/L^3")

View File

@@ -105,7 +105,6 @@ class TestSolverElmer(unittest.TestCase):
# elmer needs gmsh mesho object
# FIXME error message on Python solver run
# the examples do use a gmsh mesh object thus ok
# FIXME elmer elasticity needs the dict key "ThermalExpansionCoefficient" in material
base_name = get_namefromdef("test_")
analysis_dir = testtools.get_fem_test_tmp_dir(self.pre_dir_name + base_name)

View File

@@ -53,8 +53,6 @@ Body 1
End
Material 1
Density = Real 7.9e-06
Heat expansion Coefficient = Real 1.2e-05
Poisson ratio = Real 0.3
Youngs Modulus = Real 200000000.0
End

View File

@@ -53,8 +53,6 @@ Body 1
End
Material 1
Density = Real 7.9e-06
Heat expansion Coefficient = Real 1.2e-05
Poisson ratio = Real 0.3
Youngs Modulus = Real 210000000.0
End

View File

@@ -53,8 +53,6 @@ Body 1
End
Material 1
Density = Real 7.9e-06
Heat expansion Coefficient = Real 1.2e-05
Poisson ratio = Real 0.3
Youngs Modulus = Real 210000000.0
End

View File

@@ -53,8 +53,6 @@ Body 1
End
Material 1
Density = Real 7.9e-06
Heat expansion Coefficient = Real 1.2e-05
Poisson ratio = Real 0.3
Youngs Modulus = Real 210000000.0
End