diff --git a/src/Mod/Fem/App/CMakeLists.txt b/src/Mod/Fem/App/CMakeLists.txt
index 886479d0a5..ed1a49848b 100644
--- a/src/Mod/Fem/App/CMakeLists.txt
+++ b/src/Mod/Fem/App/CMakeLists.txt
@@ -103,6 +103,7 @@ SET(FemObjectsScripts_SRCS
PyObjects/_FemConstraintBodyHeatSource.py
PyObjects/_FemConstraintFlowVelocity.py
PyObjects/_FemConstraintInitialFlowVelocity.py
+ PyObjects/_FemConstraintElectrostaticPotential.py
PyObjects/_FemElementFluid1D.py
PyObjects/_FemElementGeometry1D.py
PyObjects/_FemElementGeometry2D.py
@@ -144,6 +145,7 @@ SET(FemEquationsElmer_SRCS
femsolver/elmer/equations/nonlinear.py
femsolver/elmer/equations/elasticity.py
femsolver/elmer/equations/electrostatic.py
+ femsolver/elmer/equations/fluxsolver.py
femsolver/elmer/equations/heat.py
femsolver/elmer/equations/flow.py
)
@@ -172,6 +174,7 @@ SET(FemGuiScripts_SRCS
PyGui/_CommandFemConstraintBodyHeatSource.py
PyGui/_CommandFemConstraintFlowVelocity.py
PyGui/_CommandFemConstraintInitialFlowVelocity.py
+ PyGui/_CommandFemConstraintElectrostaticPotential.py
PyGui/_CommandFemElementFluid1D.py
PyGui/_CommandFemElementGeometry1D.py
PyGui/_CommandFemElementGeometry2D.py
@@ -209,6 +212,7 @@ SET(FemGuiScripts_SRCS
PyGui/_ViewProviderFemConstraintBodyHeatSource.py
PyGui/_ViewProviderFemConstraintFlowVelocity.py
PyGui/_ViewProviderFemConstraintInitialFlowVelocity.py
+ PyGui/_ViewProviderFemConstraintElectrostaticPotential.py
PyGui/_ViewProviderFemElementFluid1D.py
PyGui/_ViewProviderFemElementGeometry1D.py
PyGui/_ViewProviderFemElementGeometry2D.py
@@ -234,6 +238,7 @@ SET(FemGuiScripts_SRCS
PyGui/TaskPanelFemSolverCalculix.ui
PyGui/TaskPanelFemFlowVelocity.ui
PyGui/TaskPanelFemInitialFlowVelocity.ui
+ PyGui/TaskPanelFemElectrostaticPotential.ui
)
SET(FemTests_SRCS
diff --git a/src/Mod/Fem/CMakeLists.txt b/src/Mod/Fem/CMakeLists.txt
index 6545f33160..121d7257ed 100755
--- a/src/Mod/Fem/CMakeLists.txt
+++ b/src/Mod/Fem/CMakeLists.txt
@@ -53,6 +53,7 @@ INSTALL(
PyObjects/_FemConstraintBodyHeatSource.py
PyObjects/_FemConstraintFlowVelocity.py
PyObjects/_FemConstraintInitialFlowVelocity.py
+ PyObjects/_FemConstraintElectrostaticPotential.py
PyObjects/_FemElementFluid1D.py
PyObjects/_FemElementGeometry1D.py
PyObjects/_FemElementGeometry2D.py
@@ -103,6 +104,7 @@ INSTALL(
femsolver/elmer/equations/nonlinear.py
femsolver/elmer/equations/elasticity.py
femsolver/elmer/equations/electrostatic.py
+ femsolver/elmer/equations/fluxsolver.py
femsolver/elmer/equations/heat.py
femsolver/elmer/equations/flow.py
DESTINATION
@@ -140,6 +142,7 @@ INSTALL(
PyGui/_CommandFemConstraintBodyHeatSource.py
PyGui/_CommandFemConstraintFlowVelocity.py
PyGui/_CommandFemConstraintInitialFlowVelocity.py
+ PyGui/_CommandFemConstraintElectrostaticPotential.py
PyGui/_CommandFemAnalysis.py
PyGui/_CommandFemConstraintSelfWeight.py
PyGui/_CommandFemElementFluid1D.py
@@ -177,6 +180,7 @@ INSTALL(
PyGui/_ViewProviderFemConstraintBodyHeatSource.py
PyGui/_ViewProviderFemConstraintFlowVelocity.py
PyGui/_ViewProviderFemConstraintInitialFlowVelocity.py
+ PyGui/_ViewProviderFemConstraintElectrostaticPotential.py
PyGui/_ViewProviderFemElementFluid1D.py
PyGui/_ViewProviderFemElementGeometry1D.py
PyGui/_ViewProviderFemElementGeometry2D.py
@@ -202,6 +206,7 @@ INSTALL(
PyGui/TaskPanelFemSolverCalculix.ui
PyGui/TaskPanelFemFlowVelocity.ui
PyGui/TaskPanelFemInitialFlowVelocity.ui
+ PyGui/TaskPanelFemElectrostaticPotential.ui
DESTINATION
Mod/Fem/PyGui
)
diff --git a/src/Mod/Fem/Gui/Workbench.cpp b/src/Mod/Fem/Gui/Workbench.cpp
index 800b2187cb..17210f8cf7 100755
--- a/src/Mod/Fem/Gui/Workbench.cpp
+++ b/src/Mod/Fem/Gui/Workbench.cpp
@@ -109,6 +109,10 @@ Gui::ToolBarItem* Workbench::setupToolBars() const
<< "FEM_ConstraintFluidBoundary"
<< "FEM_ConstraintFlowVelocity";
+ Gui::ToolBarItem* electrostat = new Gui::ToolBarItem(root);
+ electrostat->setCommand("Electrostatic Constraints");
+ *electrostat << "FEM_ConstraintElectrostaticPotential";
+
Gui::ToolBarItem* solve = new Gui::ToolBarItem(root);
solve->setCommand("Solve");
*solve << "FEM_SolverCalculix"
@@ -116,6 +120,7 @@ Gui::ToolBarItem* Workbench::setupToolBars() const
<< "Separator"
<< "FEM_EquationHeat"
<< "FEM_EquationElasticity"
+ << "FEM_EquationFluxsolver"
<< "FEM_EquationElectrostatic"
<< "FEM_EquationFlow"
<< "Separator"
@@ -220,6 +225,7 @@ Gui::MenuItem* Workbench::setupMenuBar() const
<< "FEM_EquationHeat"
<< "FEM_EquationElasticity"
<< "FEM_EquationElectrostatic"
+ << "FEM_EquationFluxsolver"
<< "FEM_EquationFlow"
<< "Separator"
<< "FEM_SolverControl"
diff --git a/src/Mod/Fem/InitGui.py b/src/Mod/Fem/InitGui.py
index 88fa63d901..caaac5c489 100644
--- a/src/Mod/Fem/InitGui.py
+++ b/src/Mod/Fem/InitGui.py
@@ -50,6 +50,7 @@ class FemWorkbench (Workbench):
import PyGui._CommandFemConstraintBodyHeatSource
import PyGui._CommandFemConstraintFlowVelocity
import PyGui._CommandFemConstraintInitialFlowVelocity
+ import PyGui._CommandFemConstraintElectrostaticPotential
import PyGui._CommandFemElementFluid1D
import PyGui._CommandFemElementGeometry1D
import PyGui._CommandFemElementGeometry2D
diff --git a/src/Mod/Fem/ObjectsFem.py b/src/Mod/Fem/ObjectsFem.py
index 449c30b8bf..e599592d82 100644
--- a/src/Mod/Fem/ObjectsFem.py
+++ b/src/Mod/Fem/ObjectsFem.py
@@ -67,6 +67,17 @@ def makeConstraintDisplacement(doc, name="ConstraintDisplacement"):
return obj
+def makeConstraintElectrostaticPotential(doc, name="ConstraintElectrostaticPotential"):
+ '''makeConstraintElectrostaticPotential(document, [name]): makes a Fem ElectrostaticPotential object'''
+ obj = doc.addObject("Fem::ConstraintPython", name)
+ import PyObjects._FemConstraintElectrostaticPotential
+ PyObjects._FemConstraintElectrostaticPotential.Proxy(obj)
+ if FreeCAD.GuiUp:
+ import PyGui._ViewProviderFemConstraintElectrostaticPotential
+ PyGui._ViewProviderFemConstraintElectrostaticPotential.ViewProxy(obj.ViewObject)
+ return obj
+
+
def makeConstraintFixed(doc, name="ConstraintFixed"):
'''makeConstraintFixed(document, [name]): makes a Fem ConstraintFixed object'''
obj = doc.addObject("Fem::ConstraintFixed", name)
diff --git a/src/Mod/Fem/PyGui/TaskPanelFemElectrostaticPotential.ui b/src/Mod/Fem/PyGui/TaskPanelFemElectrostaticPotential.ui
new file mode 100644
index 0000000000..193ab067f8
--- /dev/null
+++ b/src/Mod/Fem/PyGui/TaskPanelFemElectrostaticPotential.ui
@@ -0,0 +1,105 @@
+
+
+ Form
+
+
+
+ 0
+ 0
+ 400
+ 300
+
+
+
+ Constraint Properties
+
+
+
+ QFormLayout::AllNonFixedFieldsGrow
+
+ -
+
+
+ Potential:
+
+
+
+ -
+
+
-
+
+
+ false
+
+
+ 1.000000000000000
+
+
+ V
+
+
+
+ -
+
+
+ unspecified
+
+
+ true
+
+
+
+
+
+ -
+
+
+ Potential Constant
+
+
+
+
+
+
+
+ Gui::InputField
+ QLineEdit
+
+
+
+
+
+
+ potentialBox
+ toggled(bool)
+ potentialTxt
+ setEnabled(bool)
+
+
+ 230
+ 44
+
+
+ 230
+ 18
+
+
+
+
+ potentialBox
+ toggled(bool)
+ potentialTxt
+ setDisabled(bool)
+
+
+ 230
+ 44
+
+
+ 230
+ 18
+
+
+
+
+
diff --git a/src/Mod/Fem/PyGui/_CommandFemConstraintElectrostaticPotential.py b/src/Mod/Fem/PyGui/_CommandFemConstraintElectrostaticPotential.py
new file mode 100644
index 0000000000..065dda05fa
--- /dev/null
+++ b/src/Mod/Fem/PyGui/_CommandFemConstraintElectrostaticPotential.py
@@ -0,0 +1,60 @@
+# ***************************************************************************
+# * *
+# * Copyright (c) 2017 - Markus Hovorka *
+# * *
+# * 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__ = "AddConstraintElectrostaticPotential"
+__author__ = "Markus Hovorka"
+__url__ = "http://www.freecadweb.org"
+
+## @package CommandFemConstraintElectrostaticPotential
+# \ingroup FEM
+
+import FreeCAD
+from .FemCommands import FemCommands
+import FreeCADGui
+from PySide import QtCore
+
+
+class _CommandFemConstraintElectrostaticPotential(FemCommands):
+ "The FEM_ConstraintElectrostaticPotential command definition"
+ def __init__(self):
+ super(_CommandFemConstraintElectrostaticPotential, self).__init__()
+ self.resources = {
+ 'Pixmap': 'fem-constraint-electrostatic-potential',
+ 'MenuText': QtCore.QT_TRANSLATE_NOOP(
+ "FEM_ConstraintElectrostaticPotential",
+ "Constraint Potenial"),
+ 'ToolTip': QtCore.QT_TRANSLATE_NOOP(
+ "FEM_ConstraintElectrostaticPotential",
+ "Creates a FEM constraint electrostatic potential")}
+ self.is_active = 'with_analysis'
+
+ def Activated(self):
+ FreeCAD.ActiveDocument.openTransaction(
+ "Create FemConstraintElectrostaticPotential")
+ FreeCADGui.addModule("ObjectsFem")
+ FreeCADGui.doCommand(
+ "FemGui.getActiveAnalysis().Member += "
+ "[ObjectsFem.makeConstraintElectrostaticPotential(FreeCAD.ActiveDocument)]")
+
+
+FreeCADGui.addCommand('FEM_ConstraintElectrostaticPotential', _CommandFemConstraintElectrostaticPotential())
diff --git a/src/Mod/Fem/PyGui/_CommandFemEquation.py b/src/Mod/Fem/PyGui/_CommandFemEquation.py
index f0fe7753ea..47092a0ae7 100644
--- a/src/Mod/Fem/PyGui/_CommandFemEquation.py
+++ b/src/Mod/Fem/PyGui/_CommandFemEquation.py
@@ -96,6 +96,18 @@ class Electrostatic(_Base):
'ToolTip': "Creates a FEM equation for electrostatic"
}
+class Fluxsolver(_Base):
+
+ def getSpecifier(self):
+ return "Fluxsolver"
+
+ def GetResources(self):
+ return {
+ 'Pixmap': 'fem-equation-fluxsolver',
+ 'MenuText': "Flux Solver Equation",
+ 'ToolTip': "Creates a FEM equation for solving the flux or gradient"
+ }
+
class Flow(_Base):
@@ -113,4 +125,5 @@ class Flow(_Base):
Gui.addCommand('FEM_EquationHeat', Heat())
Gui.addCommand('FEM_EquationElasticity', Elasticity())
Gui.addCommand('FEM_EquationElectrostatic', Electrostatic())
+Gui.addCommand('FEM_EquationFluxsolver', Fluxsolver())
Gui.addCommand('FEM_EquationFlow', Flow())
diff --git a/src/Mod/Fem/PyGui/_ViewProviderFemConstraintElectrostaticPotential.py b/src/Mod/Fem/PyGui/_ViewProviderFemConstraintElectrostaticPotential.py
new file mode 100644
index 0000000000..67868b8aaf
--- /dev/null
+++ b/src/Mod/Fem/PyGui/_ViewProviderFemConstraintElectrostaticPotential.py
@@ -0,0 +1,121 @@
+# ***************************************************************************
+# * *
+# * Copyright (c) 2017 - Markus Hovorka *
+# * *
+# * 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__ = "Elmer Solver Object"
+__author__ = "Markus Hovorka, Bernd Hahnebach"
+__url__ = "http://www.freecadweb.org"
+
+
+import FreeCAD as App
+import FemUtils
+import FemConstraint
+from FreeCAD import Units
+
+import FreeCADGui as Gui
+from . import FemSelectionWidgets
+
+
+class ViewProxy(FemConstraint.ViewProxy):
+
+ def getIcon(self):
+ return ":/icons/fem-constraint-electrostatic-potential.svg"
+
+ def setEdit(self, vobj, mode=0):
+ task = _TaskPanel(vobj.Object)
+ Gui.Control.showDialog(task)
+
+ def unsetEdit(self, vobj, mode=0):
+ Gui.Control.closeDialog()
+
+ def doubleClicked(self, vobj):
+ if Gui.Control.activeDialog():
+ Gui.Control.closeDialog()
+ Gui.ActiveDocument.setEdit(vobj.Object.Name)
+ return True
+
+
+class _TaskPanel(object):
+
+ def __init__(self, obj):
+ self._obj = obj
+ self._refWidget = FemSelectionWidgets.BoundarySelector()
+ self._refWidget.setReferences(obj.References)
+ self._paramWidget = Gui.PySideUic.loadUi(
+ App.getHomePath() + "Mod/Fem/PyGui/TaskPanelFemElectrostaticPotential.ui")
+ self._initParamWidget()
+ self.form = [self._refWidget, self._paramWidget]
+ analysis = FemUtils.findAnalysisOfMember(obj)
+ self._mesh = FemUtils.getSingleMember(analysis, "Fem::FemMeshObject")
+ self._part = self._mesh.Part if self._mesh is not None else None
+ self._partVisible = None
+ self._meshVisible = None
+
+ def open(self):
+ if self._mesh is not None and self._part is not None:
+ self._meshVisible = self._mesh.ViewObject.isVisible()
+ self._partVisible = self._part.ViewObject.isVisible()
+ self._mesh.ViewObject.hide()
+ self._part.ViewObject.show()
+
+ def reject(self):
+ self._restoreVisibility()
+ return True
+
+ def accept(self):
+ if self._obj.References != self._refWidget.references():
+ self._obj.References = self._refWidget.references()
+ self._applyWidgetChanges()
+ self._obj.Document.recompute()
+ self._restoreVisibility()
+ return True
+
+ def _restoreVisibility(self):
+ if self._mesh is not None and self._part is not None:
+ if self._meshVisible:
+ self._mesh.ViewObject.show()
+ else:
+ self._mesh.ViewObject.hide()
+ if self._partVisible:
+ self._part.ViewObject.show()
+ else:
+ self._part.ViewObject.hide()
+
+ def _initParamWidget(self):
+ unit = "V"
+ q = Units.Quantity("{} {}".format(self._obj.Potential, unit))
+
+ self._paramWidget.potentialTxt.setText(
+ q.UserString)
+ self._paramWidget.potentialBox.setChecked(
+ not self._obj.PotentialEnabled)
+ self._paramWidget.potentialConstantBox.setChecked(
+ self._obj.PotentialConstant)
+
+ def _applyWidgetChanges(self):
+ unit = "V"
+ self._obj.PotentialEnabled = \
+ not self._paramWidget.potentialBox.isChecked()
+ if self._obj.PotentialEnabled:
+ quantity = Units.Quantity(self._paramWidget.potentialTxt.text())
+ self._obj.Potential = float(quantity.getValueAs(unit))
+ self._obj.PotentialConstant = self._paramWidget.potentialConstantBox.isChecked()
diff --git a/src/Mod/Fem/PyObjects/_FemConstraintElectrostaticPotential.py b/src/Mod/Fem/PyObjects/_FemConstraintElectrostaticPotential.py
new file mode 100644
index 0000000000..ca79cb3e8f
--- /dev/null
+++ b/src/Mod/Fem/PyObjects/_FemConstraintElectrostaticPotential.py
@@ -0,0 +1,46 @@
+# ***************************************************************************
+# * *
+# * Copyright (c) 2017 - Markus Hovorka *
+# * *
+# * 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__ = "Elmer Solver Object"
+__author__ = "Markus Hovorka, Bernd Hahnebach"
+__url__ = "http://www.freecadweb.org"
+
+
+import FemConstraint
+
+
+class Proxy(FemConstraint.Proxy):
+
+ Type = "Fem::ConstraintElectrostaticPotential"
+
+ def __init__(self, obj):
+ super(Proxy, self).__init__(obj)
+ obj.addProperty(
+ "App::PropertyFloat", "Potential",
+ "Parameter", "Potential"),
+ obj.addProperty(
+ "App::PropertyBool", "PotentialEnabled",
+ "Parameter", "Potential Enabled"),
+ obj.addProperty(
+ "App::PropertyBool", "PotentialConstant",
+ "Parameter", "Potential Constant")
diff --git a/src/Mod/Fem/femsolver/elmer/equations/fluxsolver.py b/src/Mod/Fem/femsolver/elmer/equations/fluxsolver.py
new file mode 100644
index 0000000000..cf2ac90210
--- /dev/null
+++ b/src/Mod/Fem/femsolver/elmer/equations/fluxsolver.py
@@ -0,0 +1,74 @@
+# ***************************************************************************
+# * *
+# * Copyright (c) 2017 - Markus Hovorka *
+# * *
+# * 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__ = "Fluxsolver"
+__author__ = "Markus Hovorka"
+__url__ = "http://www.freecadweb.org"
+
+
+import FemUtils
+from ... import equationbase
+from . import linear
+
+
+def create(doc, name="Fluxsolver"):
+ return FemUtils.createObject(
+ doc, name, Proxy, ViewProxy)
+
+
+class Proxy(linear.Proxy, equationbase.FluxsolverProxy):
+
+ Type = "Fem::FemEquationElmerFluxsolver"
+
+ def __init__(self, obj):
+ super(Proxy, self).__init__(obj)
+ obj.addProperty(
+ "App::PropertyBool", "CalculateFlux",
+ "Fluxsolver", "Select type of solver for linear system")
+ obj.addProperty(
+ "App::PropertyString", "FluxVariable",
+ "Fluxsolver", "Insert variable name for flux calculation")
+ #obj.addProperty(
+ #"App::PropertyBool", "CalculateFluxAbs",
+ #"Fluxsolver", "Select calculation of abs of flux")
+ #obj.addProperty(
+ #"App::PropertyBool", "CalculateFluxMagnitude",
+ #"Fluxsolver", "Select calculation of magnitude of flux")
+ obj.addProperty(
+ "App::PropertyBool", "CalculateGrad",
+ "Fluxsolver", "Select calculation of gradient")
+ #obj.addProperty(
+ #"App::PropertyBool", "CalculateGradAbs",
+ #"Fluxsolver", "Select calculation of abs of gradient")
+ #obj.addProperty(
+ #"App::PropertyBool", "CalculateGradMagnitude",
+ #"Fluxsolver", "Select calculation of magnitude of gradient")
+ #obj.addProperty(
+ #"App::PropertyBool", "EnforcePositiveMagnitude",
+ #"Fluxsolver", "Select calculation of positive magnitude")
+
+ obj.Priority = 5
+
+
+class ViewProxy(linear.ViewProxy, equationbase.FluxsolverViewProxy):
+ pass
diff --git a/src/Mod/Fem/femsolver/elmer/solver.py b/src/Mod/Fem/femsolver/elmer/solver.py
index b6a23c455b..5c1f1d90a8 100644
--- a/src/Mod/Fem/femsolver/elmer/solver.py
+++ b/src/Mod/Fem/femsolver/elmer/solver.py
@@ -35,6 +35,7 @@ from . import tasks
from .equations import heat
from .equations import elasticity
from .equations import electrostatic
+from .equations import fluxsolver
from .equations import flow
@@ -52,6 +53,7 @@ class Proxy(solverbase.Proxy):
"Heat": heat,
"Elasticity": elasticity,
"Electrostatic": electrostatic,
+ "Fluxsolver": fluxsolver,
"Flow": flow,
}
diff --git a/src/Mod/Fem/femsolver/elmer/writer.py b/src/Mod/Fem/femsolver/elmer/writer.py
index d3adc943b8..cd2f990be0 100644
--- a/src/Mod/Fem/femsolver/elmer/writer.py
+++ b/src/Mod/Fem/femsolver/elmer/writer.py
@@ -107,6 +107,7 @@ class Writer(object):
self._handleHeat()
self._handleElasticity()
self._handleElectrostatic()
+ self._handleFluxsolver()
self._handleFlow()
self._addOutputSolver()
@@ -294,7 +295,7 @@ class Writer(object):
self._addSolver(body, solverSection)
if activeIn:
self._handleElectrostaticConstants()
- #self._handleElectrostaticBndConditions()
+ self._handleElectrostaticBndConditions()
#self._handleElectrostaticInitial(activeIn)
#self._handleElectrostaticBodyForces(activeIn)
self._handleElectrostaticMaterial(activeIn)
@@ -306,7 +307,7 @@ class Writer(object):
s["Variable"] = self._getUniqueVarName("Potential")
s["Variable DOFs"] = 1
s["Calculate Electric Field"] = equation.CalculateElectricField
- s["Calculate Electric Flux"] = equation.CalculateElectricFlux
+ #s["Calculate Electric Flux"] = equation.CalculateElectricFlux
s["Calculate Electric Energy"] = equation.CalculateElectricEnergy
s["Calculate Surface Charge"] = equation.CalculateSurfaceCharge
s["Displace mesh"] = False
@@ -334,6 +335,42 @@ class Writer(object):
name, "Relative Permittivity",
float(m["RelativePermittivity"]))
+ def _handleElectrostaticBndConditions(self):
+ for obj in self._getMember("Fem::ConstraintElectrostaticPotential"):
+ if obj.References:
+ for name in obj.References[0][1]:
+ if obj.Potential:
+ potential = getFromUi(obj.Potential, "V", "M*L^2/(T^3 * I)")
+ self._boundary(name, "Potential", potential)
+ if obj.PotentialConstant:
+ self._boundary(name, "Potential Constant", True)
+ self._handled(obj)
+
+
+
+
+ def _handleFluxsolver(self):
+ activeIn = []
+ for equation in self.solver.Group:
+ if FemUtils.isOfType(equation, "Fem::FemEquationElmerFluxsolver"):
+ if equation.References:
+ activeIn = equation.References[0][1]
+ else:
+ activeIn = self._getAllBodies()
+ solverSection = self._getFluxsolverSolver(equation)
+ for body in activeIn:
+ self._addSolver(body, solverSection)
+
+ def _getFluxsolverSolver(self, equation):
+ s = self._createLinearSolver(equation)
+ s["Equation"] = "Flux Solver" # equation.Name
+ s["Procedure"] = sifio.FileAttr("FluxSolver/FluxSolver")
+ s["Flux Variable"] = equation.FluxVariable
+ s["Calculate Flux"] = equation.CalculateFlux
+ s["Calculate Grad"] = equation.CalculateGrad
+ return s
+
+
def _handleElasticity(self):
activeIn = []
for equation in self.solver.Group:
diff --git a/src/Mod/Fem/femsolver/equationbase.py b/src/Mod/Fem/femsolver/equationbase.py
index 8d8eee77b5..348bad3647 100644
--- a/src/Mod/Fem/femsolver/equationbase.py
+++ b/src/Mod/Fem/femsolver/equationbase.py
@@ -96,6 +96,16 @@ class ElectrostaticProxy(BaseProxy):
pass
+class FluxsolverViewProxy(BaseViewProxy):
+
+ def getIcon(self):
+ return ":/icons/fem-equation-fluxsolver.svg"
+
+
+class FluxsolverProxy(BaseProxy):
+ pass
+
+
class FlowProxy(BaseProxy):
pass