FEM: add elmer electric force equation object
This commit is contained in:
@@ -159,6 +159,7 @@ SET(FemSolverElmer_SRCS
|
||||
|
||||
SET(FemSolverElmerEquations_SRCS
|
||||
femsolver/elmer/equations/__init__.py
|
||||
femsolver/elmer/equations/electricforce.py
|
||||
femsolver/elmer/equations/electrostatic.py
|
||||
femsolver/elmer/equations/elasticity.py
|
||||
femsolver/elmer/equations/equation.py
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
<file>icons/FEM_ElementGeometry2D.svg</file>
|
||||
<file>icons/FEM_ElementRotation1D.svg</file>
|
||||
<file>icons/FEM_EquationElasticity.svg</file>
|
||||
<file>icons/FEM_EquationElectricforce.svg</file>
|
||||
<file>icons/FEM_EquationElectrostatic.svg</file>
|
||||
<file>icons/FEM_EquationFlow.svg</file>
|
||||
<file>icons/FEM_EquationFluxsolver.svg</file>
|
||||
|
||||
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 6.7 KiB |
@@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>154</height>
|
||||
<height>180</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@@ -41,7 +41,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<item row="5" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="capacitanceBodyBox">
|
||||
@@ -110,13 +110,20 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="capacityBody_label">
|
||||
<property name="text">
|
||||
<string extracomment="Enabled by 'Calculate Capacity Matrix' in Electrostatic equation">Capacity Body: </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QCheckBox" name="electricForcecalculationBox">
|
||||
<property name="text">
|
||||
<string>Calculate Electric Force</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
|
||||
@@ -158,6 +158,7 @@ Gui::ToolBarItem* Workbench::setupToolBars() const
|
||||
<< "FEM_EquationElectrostatic"
|
||||
<< "FEM_EquationFlow"
|
||||
<< "FEM_EquationFluxsolver"
|
||||
<< "FEM_EquationElectricforce"
|
||||
<< "FEM_EquationHeat"
|
||||
<< "Separator"
|
||||
<< "FEM_SolverControl"
|
||||
@@ -287,6 +288,7 @@ Gui::MenuItem* Workbench::setupMenuBar() const
|
||||
<< "FEM_EquationElectrostatic"
|
||||
<< "FEM_EquationFlow"
|
||||
<< "FEM_EquationFluxsolver"
|
||||
<< "FEM_EquationElectricforce"
|
||||
<< "FEM_EquationHeat"
|
||||
<< "Separator"
|
||||
<< "FEM_SolverControl"
|
||||
|
||||
@@ -638,6 +638,18 @@ def makeEquationElasticity(
|
||||
return obj
|
||||
|
||||
|
||||
def makeEquationElectricforce(
|
||||
doc,
|
||||
base_solver
|
||||
):
|
||||
"""makeEquationElectricforce(document, base_solver):
|
||||
creates a FEM Electricforce equation for a solver"""
|
||||
obj = doc.SolverElmer.addObject(
|
||||
doc.SolverElmer.Proxy.createEquation(doc.SolverElmer.Document, "Electricforce")
|
||||
)[0]
|
||||
return obj
|
||||
|
||||
|
||||
def makeEquationElectrostatic(
|
||||
doc,
|
||||
base_solver
|
||||
|
||||
@@ -294,6 +294,17 @@ class _EquationFluxsolver(CommandManager):
|
||||
self.do_activated = "add_obj_on_gui_selobj_noset_edit"
|
||||
|
||||
|
||||
class _EquationElectricforce(CommandManager):
|
||||
"The FEM_EquationElectricforce command definition"
|
||||
|
||||
def __init__(self):
|
||||
super(_EquationElectricforce, self).__init__()
|
||||
self.menuetext = "Electricforce equation"
|
||||
self.tooltip = "Creates a FEM equation for electric forces"
|
||||
self.is_active = "with_solver_elmer"
|
||||
self.do_activated = "add_obj_on_gui_selobj_noset_edit"
|
||||
|
||||
|
||||
class _EquationHeat(CommandManager):
|
||||
"The FEM_EquationHeat command definition"
|
||||
|
||||
@@ -821,6 +832,10 @@ FreeCADGui.addCommand(
|
||||
"FEM_EquationFluxsolver",
|
||||
_EquationFluxsolver()
|
||||
)
|
||||
FreeCADGui.addCommand(
|
||||
"FEM_EquationElectricforce",
|
||||
_EquationElectricforce()
|
||||
)
|
||||
FreeCADGui.addCommand(
|
||||
"FEM_EquationHeat",
|
||||
_EquationHeat()
|
||||
|
||||
@@ -62,13 +62,19 @@ class ConstraintElectrostaticPotential(base_fempythonobject.BaseFemPythonObject)
|
||||
"ElectricInfinity",
|
||||
"Parameter",
|
||||
"Electric Infinity"
|
||||
)
|
||||
),
|
||||
obj.addProperty(
|
||||
"App::PropertyBool",
|
||||
"ElectricForcecalculation",
|
||||
"Parameter",
|
||||
"Electric Force Calculation"
|
||||
),
|
||||
obj.addProperty(
|
||||
"App::PropertyInteger",
|
||||
"CapacitanceBody",
|
||||
"Parameter",
|
||||
"Capacitance Body"
|
||||
)
|
||||
),
|
||||
obj.addProperty(
|
||||
"App::PropertyBool",
|
||||
"CapacitanceBodyEnabled",
|
||||
|
||||
53
src/Mod/Fem/femsolver/elmer/equations/electricforce.py
Normal file
53
src/Mod/Fem/femsolver/elmer/equations/electricforce.py
Normal file
@@ -0,0 +1,53 @@
|
||||
# ***************************************************************************
|
||||
# * Copyright (c) 2020 Wilfried Hortschitz <w.hortschitz@gmail.com> *
|
||||
# * *
|
||||
# * 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 Electricforce"
|
||||
__author__ = "Wilfried Hortschitz"
|
||||
__url__ = "http://www.freecadweb.org"
|
||||
|
||||
## \addtogroup FEM
|
||||
# @{
|
||||
|
||||
from femtools import femutils
|
||||
from ... import equationbase
|
||||
from . import linear
|
||||
|
||||
|
||||
def create(doc, name="Electricforce"):
|
||||
return femutils.createObject(
|
||||
doc, name, Proxy, ViewProxy)
|
||||
|
||||
|
||||
class Proxy(linear.Proxy, equationbase.ElectricforceProxy):
|
||||
|
||||
Type = "Fem::EquationElectricforce"
|
||||
|
||||
def __init__(self, obj):
|
||||
super(Proxy, self).__init__(obj)
|
||||
obj.Priority = 5
|
||||
|
||||
|
||||
class ViewProxy(linear.ViewProxy, equationbase.ElectricforceViewProxy):
|
||||
pass
|
||||
|
||||
## @}
|
||||
@@ -33,6 +33,7 @@ from .equations import elasticity
|
||||
from .equations import electrostatic
|
||||
from .equations import flow
|
||||
from .equations import fluxsolver
|
||||
from .equations import electricforce
|
||||
from .equations import heat
|
||||
from .. import run
|
||||
from .. import solverbase
|
||||
@@ -54,6 +55,7 @@ class Proxy(solverbase.Proxy):
|
||||
"Elasticity": elasticity,
|
||||
"Electrostatic": electrostatic,
|
||||
"Fluxsolver": fluxsolver,
|
||||
"Electricforce": electricforce,
|
||||
"Flow": flow,
|
||||
}
|
||||
|
||||
|
||||
@@ -109,6 +109,16 @@ class FluxsolverProxy(BaseProxy):
|
||||
pass
|
||||
|
||||
|
||||
class ElectricforceViewProxy(BaseViewProxy):
|
||||
|
||||
def getIcon(self):
|
||||
return ":/icons/FEM_EquationElectricforce.svg"
|
||||
|
||||
|
||||
class ElectricforceProxy(BaseProxy):
|
||||
pass
|
||||
|
||||
|
||||
class FlowProxy(BaseProxy):
|
||||
pass
|
||||
|
||||
|
||||
@@ -114,6 +114,9 @@ class _TaskPanel(object):
|
||||
self._paramWidget.electricInfinityBox.setChecked(
|
||||
self._obj.ElectricInfinity)
|
||||
|
||||
self._paramWidget.electricForcecalculationBox.setChecked(
|
||||
self._obj.ElectricForcecalculation)
|
||||
|
||||
self._paramWidget.capacitanceBodyBox.setChecked(
|
||||
not self._obj.CapacitanceBodyEnabled)
|
||||
self._paramWidget.capacitanceBody_spinBox.setValue(
|
||||
@@ -142,6 +145,8 @@ class _TaskPanel(object):
|
||||
|
||||
self._obj.ElectricInfinity = self._paramWidget.electricInfinityBox.isChecked()
|
||||
|
||||
self._obj.ElectricForcecalculation = self._paramWidget.electricForcecalculationBox.isChecked()
|
||||
|
||||
self._obj.CapacitanceBodyEnabled = \
|
||||
not self._paramWidget.capacitanceBodyBox.isChecked()
|
||||
if self._obj.CapacitanceBodyEnabled:
|
||||
|
||||
Reference in New Issue
Block a user