FEM: elmer writer, only write denisty if really needed, partitially revert 2d73444a66, unit test fix in separate commit
This commit is contained in:
@@ -636,11 +636,24 @@ class Writer(object):
|
||||
return None
|
||||
|
||||
def _handleElasticityMaterial(self, bodies):
|
||||
# density
|
||||
# is needed for self weight constraints and frequency analysis
|
||||
density_needed = False
|
||||
for equation in self.solver.Group:
|
||||
if femutils.is_of_type(equation, "Fem::EquationElmerElasticity"):
|
||||
if equation.DoFrequencyAnalysis is True:
|
||||
density_needed = True
|
||||
break # there could be a second equation without frequency
|
||||
gravObj = self._getSingleMember("Fem::ConstraintSelfWeight")
|
||||
if gravObj is not None:
|
||||
density_needed = True
|
||||
# temperature
|
||||
tempObj = self._getSingleMember("Fem::ConstraintInitialTemperature")
|
||||
if tempObj is not None:
|
||||
refTemp = self._getFromUi(tempObj.initialTemperature, "K", "O")
|
||||
for name in bodies:
|
||||
self._material(name, "Reference Temperature", refTemp)
|
||||
# get the material data for all boddies
|
||||
for obj in self._getMember("App::MaterialObject"):
|
||||
m = obj.Material
|
||||
refs = (
|
||||
@@ -649,12 +662,11 @@ class Writer(object):
|
||||
else self._getAllBodies()
|
||||
)
|
||||
for name in (n for n in refs if n in bodies):
|
||||
# density has to be written even without self weight constraint
|
||||
# https://forum.freecadweb.org/viewtopic.php?f=18&t=56590#p487117
|
||||
self._material(
|
||||
name, "Density",
|
||||
self._getDensity(m)
|
||||
)
|
||||
if density_needed is True:
|
||||
self._material(
|
||||
name, "Density",
|
||||
self._getDensity(m)
|
||||
)
|
||||
self._material(
|
||||
name, "Youngs Modulus",
|
||||
self._getYoungsModulus(m)
|
||||
|
||||
Reference in New Issue
Block a user