From f1799f27b0b015ca5768fbebeab65bf051193a0e Mon Sep 17 00:00:00 2001 From: Uwe Date: Mon, 20 Mar 2023 07:03:56 +0100 Subject: [PATCH] [FEM] fine-tune flow examples - use a more sensible velocity distribution - change inlet temperature for 2 examples - also change step size for nonlinear iterations for more convenience for practical usage --- src/Mod/Fem/femexamples/equation_flow_elmer_2D.py | 4 ++-- .../femexamples/equation_flow_initial_elmer_2D.py | 2 +- .../femexamples/equation_flow_turbulent_elmer_2D.py | 12 +++++++----- src/Mod/Fem/femsolver/elmer/equations/nonlinear.py | 2 +- 4 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/Mod/Fem/femexamples/equation_flow_elmer_2D.py b/src/Mod/Fem/femexamples/equation_flow_elmer_2D.py index 28b022b8e6..5bf55721eb 100644 --- a/src/Mod/Fem/femexamples/equation_flow_elmer_2D.py +++ b/src/Mod/Fem/femexamples/equation_flow_elmer_2D.py @@ -179,7 +179,7 @@ def setup(doc=None, solvertype="elmer"): # constraint inlet velocity FlowVelocity_Inlet = ObjectsFem.makeConstraintFlowVelocity(doc, "FlowVelocity_Inlet") FlowVelocity_Inlet.References = [(BooleanFragments, "Edge5")] - FlowVelocity_Inlet.VelocityXFormula = "Variable Coordinate 2; Real MATC \"-0.01*(tx-1)*(2-tx)\"" + FlowVelocity_Inlet.VelocityXFormula = "Variable Coordinate 2; Real MATC \"10*(tx+50e-3)*(50e-3-tx)\"" FlowVelocity_Inlet.VelocityXUnspecified = False FlowVelocity_Inlet.VelocityXHasFormula = True FlowVelocity_Inlet.VelocityYUnspecified = False @@ -214,7 +214,7 @@ def setup(doc=None, solvertype="elmer"): # constraint inlet temperature Temperature_Inlet = ObjectsFem.makeConstraintTemperature(doc, "Temperature_Inlet") - Temperature_Inlet.Temperature = 350.0 + Temperature_Inlet.Temperature = 300.0 Temperature_Inlet.NormalDirection = Vector(-1, 0, 0) Temperature_Inlet.References = [(BooleanFragments, "Edge5")] analysis.addObject(Temperature_Inlet) diff --git a/src/Mod/Fem/femexamples/equation_flow_initial_elmer_2D.py b/src/Mod/Fem/femexamples/equation_flow_initial_elmer_2D.py index 384575558a..7edb3331ca 100644 --- a/src/Mod/Fem/femexamples/equation_flow_initial_elmer_2D.py +++ b/src/Mod/Fem/femexamples/equation_flow_initial_elmer_2D.py @@ -223,7 +223,7 @@ def setup(doc=None, solvertype="elmer"): # constraint inlet temperature Temperature_Inlet = ObjectsFem.makeConstraintTemperature(doc, "Temperature_Inlet") - Temperature_Inlet.Temperature = 350.0 + Temperature_Inlet.Temperature = 300.0 Temperature_Inlet.NormalDirection = Vector(-1, 0, 0) Temperature_Inlet.References = [(BooleanFragments, "Edge5")] analysis.addObject(Temperature_Inlet) diff --git a/src/Mod/Fem/femexamples/equation_flow_turbulent_elmer_2D.py b/src/Mod/Fem/femexamples/equation_flow_turbulent_elmer_2D.py index a203da2160..454509b974 100644 --- a/src/Mod/Fem/femexamples/equation_flow_turbulent_elmer_2D.py +++ b/src/Mod/Fem/femexamples/equation_flow_turbulent_elmer_2D.py @@ -134,8 +134,8 @@ def setup(doc=None, solvertype="elmer"): equation_flow.LinearIterativeMethod = "Idrs" equation_flow.LinearPreconditioning = "ILU1" equation_flow.setExpression("LinearTolerance", "1e-6") - equation_flow.NonlinearIterations = 30 - equation_flow.NonlinearNewtonAfterIterations = 30 + equation_flow.NonlinearIterations = 40 + equation_flow.NonlinearNewtonAfterIterations = 40 equation_flow.RelaxationFactor = 0.1 equation_flow.setExpression("NonlinearTolerance", "1e-4") equation_flow.Variable = "Flow Solution[Velocity:2 Pressure:1]" @@ -144,8 +144,8 @@ def setup(doc=None, solvertype="elmer"): equation_heat.LinearIterativeMethod = "Idrs" equation_heat.LinearPreconditioning = "ILU1" equation_heat.setExpression("LinearTolerance", "1e-6") - equation_heat.NonlinearIterations = 30 - equation_heat.NonlinearNewtonAfterIterations = 30 + equation_heat.NonlinearIterations = 40 + equation_heat.NonlinearNewtonAfterIterations = 40 equation_heat.setExpression("NonlinearTolerance", "1e-4") equation_heat.Priority = 5 equation_heat.RelaxationFactor = 0.1 @@ -185,8 +185,10 @@ def setup(doc=None, solvertype="elmer"): # constraint inlet velocity FlowVelocity_Inlet = ObjectsFem.makeConstraintFlowVelocity(doc, "FlowVelocity_Inlet") FlowVelocity_Inlet.References = [(BooleanFragments, "Edge5")] - FlowVelocity_Inlet.VelocityX = "20.0 mm/s" + FlowVelocity_Inlet.VelocityXFormula = "Variable Coordinate 2; Real MATC \"10*(tx+50e-3)*(50e-3-tx)\"" FlowVelocity_Inlet.VelocityXUnspecified = False + FlowVelocity_Inlet.VelocityXHasFormula = True + FlowVelocity_Inlet.VelocityYUnspecified = False analysis.addObject(FlowVelocity_Inlet) # constraint wall velocity diff --git a/src/Mod/Fem/femsolver/elmer/equations/nonlinear.py b/src/Mod/Fem/femsolver/elmer/equations/nonlinear.py index a0229a076f..2498ade7b2 100644 --- a/src/Mod/Fem/femsolver/elmer/equations/nonlinear.py +++ b/src/Mod/Fem/femsolver/elmer/equations/nonlinear.py @@ -76,7 +76,7 @@ class Proxy(linear.Proxy): ) ) - obj.NonlinearIterations = (500, 1, int(1e6), 50) + obj.NonlinearIterations = (500, 1, int(1e6), 10) obj.NonlinearNewtonAfterIterations = (3, 1, 100, 1) # 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