FEM: elmer writer, make use of new unit schema FEM: mm, N

This commit is contained in:
Bernd Hahnebach
2020-07-15 07:55:58 +02:00
committed by wwmayer
parent 0c9e6c6158
commit 8f3cb220b1

View File

@@ -54,12 +54,6 @@ _ELMERGRID_OFORMAT = "2"
_SOLID_PREFIX = "Solid"
# TODO constants and units
# should be only one system for all solver and not in each solver
# https://forum.freecadweb.org/viewtopic.php?t=47895
# https://forum.freecadweb.org/viewtopic.php?t=48451
def _getAllSubObjects(obj):
s = ["Solid" + str(i + 1) for i in range(len(obj.Shape.Solids))]
s.extend(("Face" + str(i + 1) for i in range(len(obj.Shape.Faces))))
@@ -101,6 +95,19 @@ class Writer(object):
self._writeStartinfo()
def _handleUnits(self):
# TODO constants and units
# should be only one system for all solver and not in each solver
# https://forum.freecadweb.org/viewtopic.php?t=47895
# https://forum.freecadweb.org/viewtopic.php?t=48451
# https://forum.freecadweb.org/viewtopic.php?f=10&t=48642
# The FreeCAD unit schema is only used to determine the schema number
# all definition are done here ATM
# keep in mind a unit schema might not be consistent:
# Length could be mm and Area could be m2 and Volume could be cm3
# as long as only the seven base units are retrieved from a unit schema
# the units are consistent
# TODO retrieve the seven base units from FreeCAD unit schema
# instead of hard coding them here for a second once
self.unit_schema = 0
self.unit_system = { # standard FreeCAD Base units = unit schema 0
"L": "mm",
@@ -132,7 +139,22 @@ class Writer(object):
"N": "mol",
"J": "cd",
}
elif self.unit_schema > 1:
elif self.unit_schema == 8:
# see also unit comment in calculix writer
Console.PrintMessage(
"The FEM unit schema mm/N/s is used. "
"Elmer sif-file writing is done in FEM-units.\n"
)
self.unit_system = {
"L": "mm",
"M": "t",
"T": "s",
"I": "A",
"O": "K",
"N": "mol",
"J": "cd",
}
elif self.unit_schema > 1 and self.unit_schema != 8:
Console.PrintMessage(
"Unit schema: {} not supported by Elmer writer. "
"The FreeCAD standard unit schema mm/kg/s is used. "