Files
create/src/Mod/Fem/femsolver/elmer/equations/deformation.py
Uwe 0fcea8b3bb [FEM] Elmer add support for nonlinear elasticity solver
- adds new equation "Deformation" (this name since the stress solver got in FreeCAD the misleading name "elasticity")

- this way change icon of elastic solver to make the difference clear
2023-03-22 03:27:27 +01:00

121 lines
4.3 KiB
Python

# ***************************************************************************
# * Copyright (c) 2023 Uwe Stöhr <uwestoehr@lyx.org> *
# * *
# * This file is part of the FreeCAD CAx development system. *
# * *
# * 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 *
# * *
# ***************************************************************************
__title__ = "FreeCAD FEM solver Elmer equation object Deformation"
__author__ = "Uwe Stöhr"
__url__ = "https://www.freecadweb.org"
## \addtogroup FEM
# @{
from femtools import femutils
from ... import equationbase
from . import linear
def create(doc, name="Deformation"):
return femutils.createObject(
doc, name, Proxy, ViewProxy)
class Proxy(linear.Proxy, equationbase.DeformationProxy):
Type = "Fem::EquationElmerDeformation"
def __init__(self, obj):
super(Proxy, self).__init__(obj)
obj.addProperty(
"App::PropertyBool",
"CalculatePangle",
"Deformation",
"Compute principal stress angles"
)
obj.addProperty(
"App::PropertyBool",
"CalculatePrincipal",
"Deformation",
"Compute principal stress components"
)
obj.addProperty(
"App::PropertyBool",
"CalculateStrains",
"Deformation",
"Compute the strain tensor"
)
obj.addProperty(
"App::PropertyBool",
"CalculateStresses",
"Deformation",
"Compute stress tensor and vanMises"
)
obj.addProperty(
"App::PropertyBool",
"InitializeStateVariables",
"Deformation",
"See Elmer manual for info"
)
obj.addProperty(
"App::PropertyBool",
"MixedFormulation",
"Deformation",
"See Elmer manual for info"
)
obj.addProperty(
"App::PropertyBool",
"NeoHookeanMaterial",
"Deformation",
(
"Uses the neo-Hookean material model"
)
)
obj.addProperty(
"App::PropertyBool",
"PlaneStress",
"Equation",
(
"Computes solution according to plane\nstress situation.\n"
"Applies only for 2D geometry."
)
)
obj.addProperty(
"App::PropertyString",
"Variable",
"Deformation",
"Only for a 2D model change the '3' to '2'"
)
obj.Priority = 10
obj.CalculatePrincipal = True
# according to Elmer tutorial and forum, for stresses direct solving
# is recommended -> tests showed 10 times faster and even more accurate
obj.LinearSolverType = "Direct"
obj.LinearDirectMethod = "Umfpack"
obj.Variable = "-dofs 3 Displacement"
class ViewProxy(linear.ViewProxy, equationbase.DeformationViewProxy):
pass
## @}