Skip to content

Commit

Permalink
[FEM] Elmer: add support to turn off solvers
Browse files Browse the repository at this point in the history
- with this property the linear solver is turned off. As consequence one can this way also disable the execution of an equation without the need to delete the equation object

- also add missing preconditioners
  • Loading branch information
donovaly committed Aug 13, 2022
1 parent 51deef0 commit 7d9855c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/Mod/Fem/femsolver/elmer/equations/linear.py
Expand Up @@ -46,15 +46,17 @@
"TFQMR",
"GMRES",
"GCR",
"Idrs"
]
LINEAR_PRECONDITIONING = [
"None",
"Diagonal",
"ILUT",
"ILU0",
"ILU1",
"ILU2",
"ILU3",
"ILU4",
"ILU4"
]


Expand Down Expand Up @@ -118,6 +120,16 @@ def __init__(self, obj):
""
)
obj.LinearIterations = 500
obj.addProperty(
"App::PropertyBool",
"LinearSystemSolverDisabled",
"Linear System",
(
"Disable the linear system.\n"
"Only use for special cases\n"
"and consult the Elmer docs."
)
)
obj.addProperty(
"App::PropertyFloat",
"SteadyStateTolerance",
Expand Down
12 changes: 12 additions & 0 deletions src/Mod/Fem/femsolver/elmer/writer.py
Expand Up @@ -1474,6 +1474,17 @@ def _updateLinearSolver(self, equation):
equation.setExpression("SteadyStateTolerance", str(equation.SteadyStateTolerance))
if equation.BiCGstablDegree == 0:
equation.BiCGstablDegree = 2
if not hasattr(equation, "LinearSystemSolverDisabled"):
equation.addProperty(
"App::PropertyBool",
"LinearSystemSolverDisabled",
"Linear System",
(
"Disable the linear system.\n"
"Only use for special cases\n"
"and consult the Elmer docs."
)
)

def _createLinearSolver(self, equation):
# first check if we have to update
Expand All @@ -1482,6 +1493,7 @@ def _createLinearSolver(self, equation):
s = sifio.createSection(sifio.SOLVER)
s.priority = equation.Priority
s["Linear System Solver"] = equation.LinearSolverType
s["Linear System Solver Disabled"] = equation.LinearSystemSolverDisabled
if equation.LinearSolverType == "Direct":
s["Linear System Direct Method"] = \
equation.LinearDirectMethod
Expand Down

0 comments on commit 7d9855c

Please sign in to comment.