From e0a2e3313223eecd30e3c7cf765c525f4e53b6bf Mon Sep 17 00:00:00 2001 From: Bernd Hahnebach Date: Wed, 26 Feb 2020 20:55:49 +0100 Subject: [PATCH] FEM: constants, add new module --- src/Mod/Fem/CMakeLists.txt | 1 + src/Mod/Fem/femtools/constants.py | 56 +++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 src/Mod/Fem/femtools/constants.py diff --git a/src/Mod/Fem/CMakeLists.txt b/src/Mod/Fem/CMakeLists.txt index 77a341b59a..76003ccfbe 100755 --- a/src/Mod/Fem/CMakeLists.txt +++ b/src/Mod/Fem/CMakeLists.txt @@ -221,6 +221,7 @@ SET(FemTools_SRCS femtools/__init__.py femtools/membertools.py femtools/ccxtools.py + femtools/constants.py femtools/errors.py femtools/femutils.py femtools/tokrules.py diff --git a/src/Mod/Fem/femtools/constants.py b/src/Mod/Fem/femtools/constants.py new file mode 100644 index 0000000000..f1a215b278 --- /dev/null +++ b/src/Mod/Fem/femtools/constants.py @@ -0,0 +1,56 @@ +# *************************************************************************** +# * Copyright (c) 2020 Bernd Hahnebach * +# * * +# * This program is free software; you can redistribute it and/or modify * +# * it under the terms of the GNU Lesser General Public License (LGPL) * +# * as published by the Free Software Foundation; either version 2 of * +# * the License, or (at your option) any later version. * +# * for detail see the LICENCE text file. * +# * * +# * This program is distributed in the hope that it will be useful, * +# * but WITHOUT ANY WARRANTY; without even the implied warranty of * +# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * +# * GNU Library General Public License for more details. * +# * * +# * You should have received a copy of the GNU Library General Public * +# * License along with this program; if not, write to the Free Software * +# * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * +# * USA * +# * * +# *************************************************************************** +""" Collection of natural constants for the Fem module. + +This module contains natural constants for the Fem module. +All constants are in SI units. +""" + + +__title__ = "Constants" +__author__ = "Bernd Hahnebach" +__url__ = "http://www.freecadweb.org" + + +def gravity(): + return "9.82 m/s^2" + + +def stefan_boltzmann(): + return "5.67e-8 W/(m^2*K^4)" + + +def permittivity_of_vakuum(): + return "8.8542e-12 s^4*A^2/(m*kg)" + + +def boltzmann_constant(): + return "1.3807e-23 J/K" + + +""" +from FreeCAD import Units +from femtools import constants +Units.Quantity(constants.gravity()).getValueAs("mm/s^2") + +""" + +# TODO: a unit test to be sure these values are returned!