Skip to content

Commit

Permalink
FEM: calculix writer, better information in the regard of units
Browse files Browse the repository at this point in the history
  • Loading branch information
berndhahnebach committed Jul 13, 2020
1 parent be1abcb commit af70ea4
Show file tree
Hide file tree
Showing 18 changed files with 372 additions and 74 deletions.
38 changes: 32 additions & 6 deletions src/Mod/Fem/femsolver/calculix/writer.py
Expand Up @@ -44,6 +44,37 @@
from femtools import geomtools


# Interesting forum topic: https://forum.freecadweb.org/viewtopic.php?&t=48451
# TODO somehow set units at beginning and every time a value is retrieved use this identifier
# this would lead to support of unit system, force might be retrieved in base writer!


# the following text will be at the end of the main calculix input file
units_information = """***********************************************************
** About units:
** See ccx manual, ccx does not know about any unit.
** Golden rule: The user must make sure that the numbers he provides have consistent units.
** The user is the FreeCAD calculix writer module ;-)
**
** The unit system which is used at Guido Dhodts company: mm, N, s, K
** Since Length and Mass are connected by Force, if Length is mm the Mass is in t to get N
** The following units are used to write to inp file:
**
** Length: mm (this includes the mesh geometry)
** Mass: t
** TimeSpan: s
** Temperature: K
**
** This leads to:
** Force: N
** Pressure: N/mm^2
** Density: t/mm^2
** Gravity: mm/s^2
** Thermal conductivity: t*mm/K*s^3
** Specific Heat: kJ/t/K = mm^2/s^2/K
"""


class FemInputWriterCcx(writerbase.FemInputWriter):
def __init__(
self,
Expand Down Expand Up @@ -1307,12 +1338,7 @@ def write_footer(self, f):
))
f.write("**\n")
f.write("**\n")
f.write("**\n")
f.write("** Units\n")
f.write("**\n")
f.write("** Geometry (mesh data) --> mm\n")
f.write("** Materials (Young's modulus) --> N/mm2 = MPa\n")
f.write("** Loads (nodal loads) --> N\n")
f.write(units_information)
f.write("**\n")

# ********************************************************************************************
Expand Down
24 changes: 20 additions & 4 deletions src/Mod/Fem/femtest/data/calculix/box_frequency.inp
Expand Up @@ -476,10 +476,26 @@ S, E
** analysis name --> Analysis
**
**
***********************************************************
** About units:
** See ccx manual, ccx does not know about any unit.
** Golden rule: The user must make sure that the numbers he provides have consistent units.
** The user is the FreeCAD calculix writer module ;-)
**
** The unit system which is used at Guido Dhodts company: mm, N, s, K
** Since Length and Mass are connected by Force, if Length is mm the Mass is in t to get N
** The following units are used to write to inp file:
**
** Units
** Length: mm (this includes the mesh geometry)
** Mass: t
** TimeSpan: s
** Temperature: K
**
** Geometry (mesh data) --> mm
** Materials (Young's modulus) --> N/mm2 = MPa
** Loads (nodal loads) --> N
** This leads to:
** Force: N
** Pressure: N/mm^2
** Density: t/mm^2
** Gravity: mm/s^2
** Thermal conductivity: t*mm/K*s^3
** Specific Heat: kJ/t/K = mm^2/s^2/K
**
24 changes: 20 additions & 4 deletions src/Mod/Fem/femtest/data/calculix/box_static.inp
Expand Up @@ -607,10 +607,26 @@ RF
** analysis name --> Analysis
**
**
***********************************************************
** About units:
** See ccx manual, ccx does not know about any unit.
** Golden rule: The user must make sure that the numbers he provides have consistent units.
** The user is the FreeCAD calculix writer module ;-)
**
** The unit system which is used at Guido Dhodts company: mm, N, s, K
** Since Length and Mass are connected by Force, if Length is mm the Mass is in t to get N
** The following units are used to write to inp file:
**
** Units
** Length: mm (this includes the mesh geometry)
** Mass: t
** TimeSpan: s
** Temperature: K
**
** Geometry (mesh data) --> mm
** Materials (Young's modulus) --> N/mm2 = MPa
** Loads (nodal loads) --> N
** This leads to:
** Force: N
** Pressure: N/mm^2
** Density: t/mm^2
** Gravity: mm/s^2
** Thermal conductivity: t*mm/K*s^3
** Specific Heat: kJ/t/K = mm^2/s^2/K
**
24 changes: 20 additions & 4 deletions src/Mod/Fem/femtest/data/calculix/ccxcantilever_faceload.inp
Expand Up @@ -426,10 +426,26 @@ RF
** analysis name --> Analysis
**
**
***********************************************************
** About units:
** See ccx manual, ccx does not know about any unit.
** Golden rule: The user must make sure that the numbers he provides have consistent units.
** The user is the FreeCAD calculix writer module ;-)
**
** The unit system which is used at Guido Dhodts company: mm, N, s, K
** Since Length and Mass are connected by Force, if Length is mm the Mass is in t to get N
** The following units are used to write to inp file:
**
** Units
** Length: mm (this includes the mesh geometry)
** Mass: t
** TimeSpan: s
** Temperature: K
**
** Geometry (mesh data) --> mm
** Materials (Young's modulus) --> N/mm2 = MPa
** Loads (nodal loads) --> N
** This leads to:
** Force: N
** Pressure: N/mm^2
** Density: t/mm^2
** Gravity: mm/s^2
** Thermal conductivity: t*mm/K*s^3
** Specific Heat: kJ/t/K = mm^2/s^2/K
**
24 changes: 20 additions & 4 deletions src/Mod/Fem/femtest/data/calculix/ccxcantilever_hexa20.inp
Expand Up @@ -460,10 +460,26 @@ RF
** analysis name --> Analysis
**
**
***********************************************************
** About units:
** See ccx manual, ccx does not know about any unit.
** Golden rule: The user must make sure that the numbers he provides have consistent units.
** The user is the FreeCAD calculix writer module ;-)
**
** The unit system which is used at Guido Dhodts company: mm, N, s, K
** Since Length and Mass are connected by Force, if Length is mm the Mass is in t to get N
** The following units are used to write to inp file:
**
** Units
** Length: mm (this includes the mesh geometry)
** Mass: t
** TimeSpan: s
** Temperature: K
**
** Geometry (mesh data) --> mm
** Materials (Young's modulus) --> N/mm2 = MPa
** Loads (nodal loads) --> N
** This leads to:
** Force: N
** Pressure: N/mm^2
** Density: t/mm^2
** Gravity: mm/s^2
** Thermal conductivity: t*mm/K*s^3
** Specific Heat: kJ/t/K = mm^2/s^2/K
**
24 changes: 20 additions & 4 deletions src/Mod/Fem/femtest/data/calculix/ccxcantilever_nodeload.inp
Expand Up @@ -423,10 +423,26 @@ RF
** analysis name --> Analysis
**
**
***********************************************************
** About units:
** See ccx manual, ccx does not know about any unit.
** Golden rule: The user must make sure that the numbers he provides have consistent units.
** The user is the FreeCAD calculix writer module ;-)
**
** The unit system which is used at Guido Dhodts company: mm, N, s, K
** Since Length and Mass are connected by Force, if Length is mm the Mass is in t to get N
** The following units are used to write to inp file:
**
** Units
** Length: mm (this includes the mesh geometry)
** Mass: t
** TimeSpan: s
** Temperature: K
**
** Geometry (mesh data) --> mm
** Materials (Young's modulus) --> N/mm2 = MPa
** Loads (nodal loads) --> N
** This leads to:
** Force: N
** Pressure: N/mm^2
** Density: t/mm^2
** Gravity: mm/s^2
** Thermal conductivity: t*mm/K*s^3
** Specific Heat: kJ/t/K = mm^2/s^2/K
**
Expand Up @@ -431,10 +431,26 @@ RF
** analysis name --> Analysis
**
**
***********************************************************
** About units:
** See ccx manual, ccx does not know about any unit.
** Golden rule: The user must make sure that the numbers he provides have consistent units.
** The user is the FreeCAD calculix writer module ;-)
**
** The unit system which is used at Guido Dhodts company: mm, N, s, K
** Since Length and Mass are connected by Force, if Length is mm the Mass is in t to get N
** The following units are used to write to inp file:
**
** Units
** Length: mm (this includes the mesh geometry)
** Mass: t
** TimeSpan: s
** Temperature: K
**
** Geometry (mesh data) --> mm
** Materials (Young's modulus) --> N/mm2 = MPa
** Loads (nodal loads) --> N
** This leads to:
** Force: N
** Pressure: N/mm^2
** Density: t/mm^2
** Gravity: mm/s^2
** Thermal conductivity: t*mm/K*s^3
** Specific Heat: kJ/t/K = mm^2/s^2/K
**
Expand Up @@ -38433,10 +38433,26 @@ RF
** analysis name --> Analysis
**
**
***********************************************************
** About units:
** See ccx manual, ccx does not know about any unit.
** Golden rule: The user must make sure that the numbers he provides have consistent units.
** The user is the FreeCAD calculix writer module ;-)
**
** The unit system which is used at Guido Dhodts company: mm, N, s, K
** Since Length and Mass are connected by Force, if Length is mm the Mass is in t to get N
** The following units are used to write to inp file:
**
** Units
** Length: mm (this includes the mesh geometry)
** Mass: t
** TimeSpan: s
** Temperature: K
**
** Geometry (mesh data) --> mm
** Materials (Young's modulus) --> N/mm2 = MPa
** Loads (nodal loads) --> N
** This leads to:
** Force: N
** Pressure: N/mm^2
** Density: t/mm^2
** Gravity: mm/s^2
** Thermal conductivity: t*mm/K*s^3
** Specific Heat: kJ/t/K = mm^2/s^2/K
**
Expand Up @@ -5365,10 +5365,26 @@ RF
** analysis name --> Analysis
**
**
***********************************************************
** About units:
** See ccx manual, ccx does not know about any unit.
** Golden rule: The user must make sure that the numbers he provides have consistent units.
** The user is the FreeCAD calculix writer module ;-)
**
** The unit system which is used at Guido Dhodts company: mm, N, s, K
** Since Length and Mass are connected by Force, if Length is mm the Mass is in t to get N
** The following units are used to write to inp file:
**
** Units
** Length: mm (this includes the mesh geometry)
** Mass: t
** TimeSpan: s
** Temperature: K
**
** Geometry (mesh data) --> mm
** Materials (Young's modulus) --> N/mm2 = MPa
** Loads (nodal loads) --> N
** This leads to:
** Force: N
** Pressure: N/mm^2
** Density: t/mm^2
** Gravity: mm/s^2
** Thermal conductivity: t*mm/K*s^3
** Specific Heat: kJ/t/K = mm^2/s^2/K
**
24 changes: 20 additions & 4 deletions src/Mod/Fem/femtest/data/calculix/constraint_sectionprint.inp
Expand Up @@ -3479,10 +3479,26 @@ RF
** analysis name --> Analysis
**
**
***********************************************************
** About units:
** See ccx manual, ccx does not know about any unit.
** Golden rule: The user must make sure that the numbers he provides have consistent units.
** The user is the FreeCAD calculix writer module ;-)
**
** The unit system which is used at Guido Dhodts company: mm, N, s, K
** Since Length and Mass are connected by Force, if Length is mm the Mass is in t to get N
** The following units are used to write to inp file:
**
** Units
** Length: mm (this includes the mesh geometry)
** Mass: t
** TimeSpan: s
** Temperature: K
**
** Geometry (mesh data) --> mm
** Materials (Young's modulus) --> N/mm2 = MPa
** Loads (nodal loads) --> N
** This leads to:
** Force: N
** Pressure: N/mm^2
** Density: t/mm^2
** Gravity: mm/s^2
** Thermal conductivity: t*mm/K*s^3
** Specific Heat: kJ/t/K = mm^2/s^2/K
**
24 changes: 20 additions & 4 deletions src/Mod/Fem/femtest/data/calculix/constraint_tie.inp
Expand Up @@ -18671,10 +18671,26 @@ RF
** analysis name --> Analysis
**
**
***********************************************************
** About units:
** See ccx manual, ccx does not know about any unit.
** Golden rule: The user must make sure that the numbers he provides have consistent units.
** The user is the FreeCAD calculix writer module ;-)
**
** The unit system which is used at Guido Dhodts company: mm, N, s, K
** Since Length and Mass are connected by Force, if Length is mm the Mass is in t to get N
** The following units are used to write to inp file:
**
** Units
** Length: mm (this includes the mesh geometry)
** Mass: t
** TimeSpan: s
** Temperature: K
**
** Geometry (mesh data) --> mm
** Materials (Young's modulus) --> N/mm2 = MPa
** Loads (nodal loads) --> N
** This leads to:
** Force: N
** Pressure: N/mm^2
** Density: t/mm^2
** Gravity: mm/s^2
** Thermal conductivity: t*mm/K*s^3
** Specific Heat: kJ/t/K = mm^2/s^2/K
**
Expand Up @@ -29207,10 +29207,26 @@ RF
** analysis name --> Analysis
**
**
***********************************************************
** About units:
** See ccx manual, ccx does not know about any unit.
** Golden rule: The user must make sure that the numbers he provides have consistent units.
** The user is the FreeCAD calculix writer module ;-)
**
** The unit system which is used at Guido Dhodts company: mm, N, s, K
** Since Length and Mass are connected by Force, if Length is mm the Mass is in t to get N
** The following units are used to write to inp file:
**
** Units
** Length: mm (this includes the mesh geometry)
** Mass: t
** TimeSpan: s
** Temperature: K
**
** Geometry (mesh data) --> mm
** Materials (Young's modulus) --> N/mm2 = MPa
** Loads (nodal loads) --> N
** This leads to:
** Force: N
** Pressure: N/mm^2
** Density: t/mm^2
** Gravity: mm/s^2
** Thermal conductivity: t*mm/K*s^3
** Specific Heat: kJ/t/K = mm^2/s^2/K
**

0 comments on commit af70ea4

Please sign in to comment.