From 81cf27a193fc08485c1646ece802013f5aac104b Mon Sep 17 00:00:00 2001 From: Jean-Christophe Giret Date: Mon, 15 Nov 2021 11:12:59 +0100 Subject: [PATCH 1/2] test: add failing test --- tests/mda/test_mda_chain.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/mda/test_mda_chain.py b/tests/mda/test_mda_chain.py index 752dacc868..8242e53fce 100644 --- a/tests/mda/test_mda_chain.py +++ b/tests/mda/test_mda_chain.py @@ -62,17 +62,21 @@ DISC_DESCR_16D = [ ] -def test_set_linear_solver_tolerance(sellar_disciplines): - """Test that the linear solver tolerance can be set at the object instantiation.""" +def test_set_tolerances(sellar_disciplines): + """Test that the MDA tolerances can be set at the object instantiation.""" mda_chain = MDAChain( sellar_disciplines, - tolerance=1e-12, + tolerance=1e-3, linear_solver_tolerance=1e-6, max_mda_iter=20, chain_linearize=False, ) + assert mda_chain.tolerance == 1e-3 assert mda_chain.linear_solver_tolerance == 1e-6 + assert mda_chain.mdo_chain.disciplines[0].tolerance == 1e-3 + assert mda_chain.mdo_chain.disciplines[0].linear_solver_tolerance == 1e-6 + def test_set_linear_solver_tolerance_from_options_constructor(sellar_disciplines): """Test that the tolerance cannot be set from the linear_solver_options dictionary. -- GitLab From a044cf722d7bdf15fffc38bc2bf921bc5ea12da8 Mon Sep 17 00:00:00 2001 From: Jean-Christophe Giret Date: Mon, 15 Nov 2021 11:18:45 +0100 Subject: [PATCH 2/2] fix: pass linear_solver_tolerance at sub-MDA instantiation --- src/gemseo/mda/mda_chain.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gemseo/mda/mda_chain.py b/src/gemseo/mda/mda_chain.py index 41f3eedd79..5a8b452e09 100644 --- a/src/gemseo/mda/mda_chain.py +++ b/src/gemseo/mda/mda_chain.py @@ -187,6 +187,7 @@ class MDAChain(MDA): sub_mda_disciplines, max_mda_iter=self.max_mda_iter, tolerance=self.tolerance, + linear_solver_tolerance=self.linear_solver_tolerance, grammar_type=self.grammar_type, coupling_structure=next(sub_coupling_structures_iterator), **sub_mda_options -- GitLab