From 2edf6abb2fe8fdaa602cd01bff2669be2bcee1c2 Mon Sep 17 00:00:00 2001 From: Uwe Date: Sat, 13 Aug 2022 05:51:26 +0200 Subject: [PATCH] [FEM] Elmer: add support to turn off solvers - 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 --- src/Mod/Fem/femsolver/elmer/equations/linear.py | 14 +++++++++++++- src/Mod/Fem/femsolver/elmer/writer.py | 12 ++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/Mod/Fem/femsolver/elmer/equations/linear.py b/src/Mod/Fem/femsolver/elmer/equations/linear.py index 6bdefca76d..c48395e2c4 100644 --- a/src/Mod/Fem/femsolver/elmer/equations/linear.py +++ b/src/Mod/Fem/femsolver/elmer/equations/linear.py @@ -46,15 +46,17 @@ LINEAR_ITERATIVE = [ "TFQMR", "GMRES", "GCR", + "Idrs" ] LINEAR_PRECONDITIONING = [ "None", "Diagonal", + "ILUT", "ILU0", "ILU1", "ILU2", "ILU3", - "ILU4", + "ILU4" ] @@ -118,6 +120,16 @@ class Proxy(equation.Proxy): "" ) 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", diff --git a/src/Mod/Fem/femsolver/elmer/writer.py b/src/Mod/Fem/femsolver/elmer/writer.py index fb7c148cf7..82e8b8801b 100644 --- a/src/Mod/Fem/femsolver/elmer/writer.py +++ b/src/Mod/Fem/femsolver/elmer/writer.py @@ -1489,6 +1489,17 @@ class Writer(object): 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 @@ -1497,6 +1508,7 @@ class Writer(object): 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