[FEM] Elmer: fix for electricforce
- the default is to execute this solver after previous solution converged. This has to be output via the Exec Solver parameter
This commit is contained in:
@@ -32,6 +32,7 @@ from femtools import femutils
|
||||
from ... import equationbase
|
||||
from . import linear
|
||||
|
||||
SOLVER_EXEC_METHODS = ["After Timestep", "Always"]
|
||||
|
||||
def create(doc, name="Electricforce"):
|
||||
return femutils.createObject(
|
||||
@@ -44,6 +45,19 @@ class Proxy(linear.Proxy, equationbase.ElectricforceProxy):
|
||||
|
||||
def __init__(self, obj):
|
||||
super(Proxy, self).__init__(obj)
|
||||
|
||||
obj.addProperty(
|
||||
"App::PropertyEnumeration",
|
||||
"ExecSolver",
|
||||
"Electric Force",
|
||||
(
|
||||
"That solver is only executed after solution converged\n"
|
||||
"To execute always, change to 'Always'"
|
||||
)
|
||||
)
|
||||
|
||||
obj.ExecSolver = SOLVER_EXEC_METHODS
|
||||
obj.ExecSolver = "After Timestep"
|
||||
obj.Priority = 5
|
||||
|
||||
|
||||
|
||||
@@ -48,6 +48,7 @@ from femtools import constants
|
||||
from femtools import femutils
|
||||
from femtools import membertools
|
||||
from .equations import elasticity
|
||||
from .equations import electricforce
|
||||
from .equations import flow
|
||||
from .equations import heat
|
||||
|
||||
@@ -784,12 +785,31 @@ class Writer(object):
|
||||
self._addSolver(body, solverSection)
|
||||
|
||||
def _getElectricforceSolver(self, equation):
|
||||
# check if we need to update the equation
|
||||
self._updateElectricforceSolver(equation)
|
||||
# output the equation parameters
|
||||
s = self._createEmptySolver()
|
||||
s["Equation"] = "Electric Force" # equation.Name
|
||||
s["Procedure"] = sifio.FileAttr("ElectricForce/StatElecForce")
|
||||
s["Exec Solver"] = equation.ExecSolver
|
||||
s["Stabilize"] = equation.Stabilize
|
||||
return s
|
||||
|
||||
def _updateElectricforceSolver(self, equation):
|
||||
# updates older Electricforce equations
|
||||
if not hasattr(equation, "ExecSolver"):
|
||||
equation.addProperty(
|
||||
"App::PropertyEnumeration",
|
||||
"ExecSolver",
|
||||
"Electric Force",
|
||||
(
|
||||
"That solver is only executed after solution converged\n"
|
||||
"To execute always, change to 'Always'"
|
||||
)
|
||||
)
|
||||
equation.ExecSolver = electricforce.SOLVER_EXEC_METHODS
|
||||
equation.ExecSolver = "After Timestep"
|
||||
|
||||
def _handleElasticity(self):
|
||||
activeIn = []
|
||||
for equation in self.solver.Group:
|
||||
|
||||
Reference in New Issue
Block a user