Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
sliptonic committed Feb 26, 2020
2 parents e4e4d9f + 3d4013b commit 4b62adb
Show file tree
Hide file tree
Showing 28 changed files with 1,096 additions and 63 deletions.
1 change: 1 addition & 0 deletions src/Mod/Fem/CMakeLists.txt
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Fem/femcommands/manager.py
Expand Up @@ -28,7 +28,7 @@
# @{

import FreeCAD
import femtools.femutils as femutils
from femtools import femutils

if FreeCAD.GuiUp:
import FreeCADGui
Expand Down
Expand Up @@ -33,8 +33,8 @@
from . import ViewProviderFemConstraint

# for the panel
import femtools.femutils as femutils
import femtools.membertools as membertools
from femtools import femutils
from femtools import membertools
from FreeCAD import Units
from . import FemSelectionWidgets

Expand Down
Expand Up @@ -33,8 +33,8 @@
from . import ViewProviderFemConstraint

# for the panel
import femtools.femutils as femutils
import femtools.membertools as membertools
from femtools import femutils
from femtools import membertools
from FreeCAD import Units
from . import FemSelectionWidgets

Expand Down
Expand Up @@ -33,8 +33,8 @@
from . import ViewProviderFemConstraint

# for the panel
import femtools.femutils as femutils
import femtools.membertools as membertools
from femtools import femutils
from femtools import membertools
from FreeCAD import Units


Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Fem/femguiobjects/_ViewProviderFemMeshGmsh.py
Expand Up @@ -390,7 +390,7 @@ def run_gmsh(self):
self.gmsh_runs = True
self.console_log("We are going to start ...")
self.get_active_analysis()
import femmesh.gmshtools as gmshtools
from femmesh import gmshtools
gmsh_mesh = gmshtools.GmshTools(self.obj, self.analysis)
self.console_log("Start Gmsh ...")
error = ""
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Fem/feminout/importCcxFrdResults.py
Expand Up @@ -127,7 +127,7 @@ def importFrd(

# complementary result object calculations
import femresult.resulttools as restools
import femtools.femutils as femutils
from femtools import femutils
if not res_obj.MassFlowRate:
# information 1:
# only compact result if not Flow 1D results
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Fem/femmesh/gmshtools.py
Expand Up @@ -35,7 +35,7 @@
import Fem
from FreeCAD import Units
from . import meshtools
import femtools.femutils as femutils
from femtools import femutils


class GmshTools():
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Fem/femresult/resulttools.py
Expand Up @@ -27,7 +27,7 @@
# @{

import FreeCAD
import femtools.femutils as femutils
from femtools import femutils
import numpy as np
from math import isnan

Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Fem/femsolver/calculix/solver.py
Expand Up @@ -30,7 +30,7 @@
import glob

import FreeCAD
import femtools.femutils as femutils
from femtools import femutils

from .. import run
from .. import solverbase
Expand Down
4 changes: 2 additions & 2 deletions src/Mod/Fem/femsolver/calculix/tasks.py
Expand Up @@ -32,8 +32,8 @@
import os.path

import FreeCAD
import femtools.femutils as femutils
import femtools.membertools as membertools
from femtools import femutils
from femtools import membertools
import feminout.importCcxFrdResults as importCcxFrdResults
import feminout.importCcxDatResults as importCcxDatResults

Expand Down
6 changes: 5 additions & 1 deletion src/Mod/Fem/femsolver/calculix/writer.py
Expand Up @@ -63,6 +63,9 @@ def __init__(
self.dir_name,
"{}_inout_nodes.txt".format(self.mesh_object.Name)
)
from femtools import constants
from FreeCAD import Units
self.gravity = Units.Quantity(constants.gravity()).getValueAs("mm/s^2")

def write_calculix_input_file(self):
timestart = time.process_time()
Expand Down Expand Up @@ -1095,9 +1098,10 @@ def write_constraints_selfweight(self, f):
f.write("** " + selwei_obj.Label + "\n")
f.write("*DLOAD\n")
f.write(
"{},GRAV,9810,{},{},{}\n"
"{},GRAV,{},{},{},{}\n"
.format(
self.ccx_eall,
self.gravity,
selwei_obj.Gravity_x,
selwei_obj.Gravity_y,
selwei_obj.Gravity_z
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Fem/femsolver/elmer/equations/elasticity.py
Expand Up @@ -26,7 +26,7 @@
## \addtogroup FEM
# @{

import femtools.femutils as femutils
from femtools import femutils
from ... import equationbase
from . import linear

Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Fem/femsolver/elmer/equations/electrostatic.py
Expand Up @@ -26,7 +26,7 @@
## \addtogroup FEM
# @{

import femtools.femutils as femutils
from femtools import femutils
from ... import equationbase
from . import linear

Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Fem/femsolver/elmer/equations/equation.py
Expand Up @@ -28,7 +28,7 @@

import FreeCAD as App
from ... import equationbase
import femtools.membertools as membertools
from femtools import membertools

if App.GuiUp:
import FreeCADGui as Gui
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Fem/femsolver/elmer/equations/flow.py
Expand Up @@ -26,7 +26,7 @@
## \addtogroup FEM
# @{

import femtools.femutils as femutils
from femtools import femutils
from . import nonlinear
from ... import equationbase

Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Fem/femsolver/elmer/equations/fluxsolver.py
Expand Up @@ -26,7 +26,7 @@
## \addtogroup FEM
# @{

import femtools.femutils as femutils
from femtools import femutils
from ... import equationbase
from . import linear

Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Fem/femsolver/elmer/equations/heat.py
Expand Up @@ -26,7 +26,7 @@
## \addtogroup FEM
# @{

import femtools.femutils as femutils
from femtools import femutils
from . import nonlinear
from ... import equationbase

Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Fem/femsolver/elmer/solver.py
Expand Up @@ -26,7 +26,7 @@
## \addtogroup FEM
# @{

import femtools.femutils as femutils
from femtools import femutils

from .. import run
from .. import solverbase
Expand Down
4 changes: 2 additions & 2 deletions src/Mod/Fem/femsolver/elmer/tasks.py
Expand Up @@ -31,8 +31,8 @@
import sys

import FreeCAD
import femtools.femutils as femutils
import femtools.membertools as membertools
from femtools import femutils
from femtools import membertools

from .. import run
from .. import settings
Expand Down
15 changes: 8 additions & 7 deletions src/Mod/Fem/femsolver/elmer/writer.py
Expand Up @@ -34,9 +34,10 @@
from FreeCAD import Units
from FreeCAD import Console
import Fem
import femtools.femutils as femutils
import femtools.membertools as membertools
import femmesh.gmshtools as gmshtools
from femmesh import gmshtools
from femtools import constants
from femtools import femutils
from femtools import membertools
from .. import settings
from . import sifio

Expand All @@ -60,10 +61,10 @@


CONSTS_DEF = {
"Gravity": "9.82 m/s^2",
"StefanBoltzmann": "5.67e-8 W/(m^2*K^4)",
"PermittivityOfVacuum": "8.8542e-12 s^4*A^2/(m*kg)",
"BoltzmannConstant": "1.3807e-23 J/K",
"Gravity": constants.gravity(),
"StefanBoltzmann": constants.stefan_boltzmann(),
"PermittivityOfVacuum": constants.permittivity_of_vakuum(),
"BoltzmannConstant": constants.boltzmann_constant(),
}


Expand Down
4 changes: 2 additions & 2 deletions src/Mod/Fem/femsolver/run.py
Expand Up @@ -40,8 +40,8 @@
import tempfile

import FreeCAD as App
import femtools.femutils as femutils
import femtools.membertools as membertools
from femtools import femutils
from femtools import membertools
from . import settings
from . import signal
from . import task
Expand Down
2 changes: 1 addition & 1 deletion src/Mod/Fem/femsolver/z88/solver.py
Expand Up @@ -30,7 +30,7 @@
import glob

import FreeCAD
import femtools.femutils as femutils
from femtools import femutils

from .. import run
from .. import solverbase
Expand Down
4 changes: 2 additions & 2 deletions src/Mod/Fem/femsolver/z88/tasks.py
Expand Up @@ -31,8 +31,8 @@
import os.path

import FreeCAD
import femtools.femutils as femutils
import femtools.membertools as membertools
from femtools import femutils
from femtools import membertools
import feminout.importZ88O2Results as importZ88O2Results

from .. import run
Expand Down
4 changes: 2 additions & 2 deletions src/Mod/Fem/femtools/ccxtools.py
Expand Up @@ -32,8 +32,8 @@
import sys
import subprocess
import FreeCAD
import femtools.femutils as femutils
import femtools.membertools as membertools
from femtools import femutils
from femtools import membertools
from PySide import QtCore
if FreeCAD.GuiUp:
from PySide import QtGui
Expand Down
56 changes: 56 additions & 0 deletions src/Mod/Fem/femtools/constants.py
@@ -0,0 +1,56 @@
# ***************************************************************************
# * Copyright (c) 2020 Bernd Hahnebach <bernd@bimstatik.org> *
# * *
# * 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!

0 comments on commit 4b62adb

Please sign in to comment.