From 00f136077308df523804f68d317e1e8d37e8d1c4 Mon Sep 17 00:00:00 2001 From: Uwe Date: Sun, 31 Jul 2022 05:19:45 +0200 Subject: [PATCH] [FEM] Elmer: fix small number property handling - use an expression as discussed: https://forum.freecadweb.org/viewtopic.php?p=613897#p613897 --- src/Mod/Fem/femsolver/elmer/equations/linear.py | 9 +++++++-- src/Mod/Fem/femsolver/elmer/equations/nonlinear.py | 10 +++++++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/Mod/Fem/femsolver/elmer/equations/linear.py b/src/Mod/Fem/femsolver/elmer/equations/linear.py index 0153d33ad8..6da282f1a4 100644 --- a/src/Mod/Fem/femsolver/elmer/equations/linear.py +++ b/src/Mod/Fem/femsolver/elmer/equations/linear.py @@ -105,7 +105,11 @@ class Proxy(equation.Proxy): "Linear System", "" ) - obj.LinearTolerance = 1e-8 + # we must set an expression because we don't have a UI, the user has to + # view and edit the tolerance via the property editor and this does not + # yet allow to view and edit small numbers in scientific notation + # forum thread: https://forum.freecadweb.org/viewtopic.php?p=613897#p613897 + obj.setExpression('LinearTolerance', "1e-8") obj.addProperty( "App::PropertyInteger", "LinearIterations", @@ -119,7 +123,8 @@ class Proxy(equation.Proxy): "Steady State", "" ) - obj.SteadyStateTolerance = 1e-5 + # same as with LinearTolerance + obj.setExpression('SteadyStateTolerance', "1e-5") obj.addProperty( "App::PropertyBool", "Stabilize", diff --git a/src/Mod/Fem/femsolver/elmer/equations/nonlinear.py b/src/Mod/Fem/femsolver/elmer/equations/nonlinear.py index 2406f2e6cb..399ed28ce9 100644 --- a/src/Mod/Fem/femsolver/elmer/equations/nonlinear.py +++ b/src/Mod/Fem/femsolver/elmer/equations/nonlinear.py @@ -70,11 +70,15 @@ class Proxy(linear.Proxy): "Nonlinear System", "" ) - obj.NonlinearTolerance = 1e-8 obj.NonlinearIterations = 500 - obj.RelaxationFactor = 1 obj.NonlinearNewtonAfterIterations = 3 - obj.NonlinearNewtonAfterTolerance = 1e-3 + # for small numbers we must set an expression because we don't have a UI, + # the user has to view and edit the tolerance via the property editor and + # this does not yet allow to view and edit small numbers in scientific notation + # forum thread: https://forum.freecadweb.org/viewtopic.php?p=613897#p613897 + obj.setExpression('NonlinearTolerance', "1e-8") + obj.setExpression('NonlinearNewtonAfterTolerance', "1e-3") + obj.setExpression('RelaxationFactor', "1.0") # must often be < 1 down to 0.01 class ViewProxy(linear.ViewProxy):