[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:
Uwe
2022-08-07 16:17:55 +02:00
parent bcc25f9bc7
commit 753a034708
2 changed files with 34 additions and 0 deletions

View File

@@ -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

View File

@@ -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: