File tree Expand file tree Collapse file tree
test/tests/multisystem/restore_multiapp Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -604,7 +604,8 @@ class MultiApp : public MooseObject,
604604 const bool _no_restore;
605605
606606 // / The solution from the end of the previous solve, this is cloned from the Nonlinear solution during restore
607- std::vector<std::unique_ptr<libMesh::NumericVector<Real>>> _end_solutions;
607+ // / Outer indexing by child application, inner indexing by solver system
608+ std::vector<std::vector<std::unique_ptr<libMesh::NumericVector<Real>>>> _end_solutions;
608609
609610 // / The auxiliary solution from the end of the previous solve, this is cloned from the auxiliary solution during restore
610611 std::vector<std::unique_ptr<NumericVector<Real>>> _end_aux_solutions;
Original file line number Diff line number Diff line change @@ -791,12 +791,17 @@ MultiApp::restore(bool force)
791791
792792 for (unsigned int i = 0 ; i < _my_num_apps ; i ++ )
793793 {
794- _end_solutions [i ] = _apps [i ]
795- -> getExecutioner ()
796- -> feProblem ()
797- .getNonlinearSystemBase (/*nl_sys=*/ 0 )
798- .solution ()
799- .clone ();
794+ _end_solutions [i ].resize (_apps [i ]-> getExecutioner ()-> feProblem ().numSolverSystems ());
795+ for (unsigned int j = 0 ; j < _apps [i ]-> getExecutioner ()-> feProblem ().numSolverSystems ();
796+ j ++ )
797+ {
798+ _end_solutions [i ][j ] = _apps [i ]
799+ -> getExecutioner ()
800+ -> feProblem ()
801+ .getSolverSystem (/*solver_sys=*/ j )
802+ .solution ()
803+ .clone ();
804+ }
800805 auto & sub_multiapps =
801806 _apps [i ]-> getExecutioner ()-> feProblem ().getMultiAppWarehouse ().getObjects ();
802807
@@ -835,11 +840,15 @@ MultiApp::restore(bool force)
835840 {
836841 for (unsigned int i = 0 ; i < _my_num_apps ; i ++ )
837842 {
838- _apps [i ]-> getExecutioner ()-> feProblem ().getNonlinearSystemBase (/*nl_sys=*/ 0 ).solution () =
839- * _end_solutions [i ];
843+ for (unsigned int j = 0 ; j < _apps [i ]-> getExecutioner ()-> feProblem ().numSolverSystems ();
844+ j ++ )
845+ {
846+ _apps [i ]-> getExecutioner ()-> feProblem ().getSolverSystem (/*solver_sys=*/ j ).solution () =
847+ * _end_solutions [i ][j ];
840848
841- // We need to synchronize solution so that local_solution has the right values
842- _apps [i ]-> getExecutioner ()-> feProblem ().getNonlinearSystemBase (/*nl_sys=*/ 0 ).update ();
849+ // We need to synchronize solution so that local_solution has the right values
850+ _apps [i ]-> getExecutioner ()-> feProblem ().getSolverSystem (/*solver_sys=*/ j ).update ();
851+ }
843852 }
844853
845854 _end_solutions .clear ();
Original file line number Diff line number Diff line change 1+ STEP OFFSET 1
2+
3+ EXCLUDE TIMES 2
4+
5+ TIME STEPS relative 1.0 floor 0.0
6+
7+ ELEMENT VARIABLES relative 1.e-10 floor 0.0
8+ u
9+ v
Original file line number Diff line number Diff line change 1+ [Mesh]
2+ [ gmg ]
3+ type = GeneratedMeshGenerator
4+ dim = 1
5+ nx = 6
6+ []
7+ []
8+
9+ [Problem]
10+ nl_sys_names = 'v_sys'
11+ linear_sys_names = 'u_sys'
12+ []
13+
14+ [Variables]
15+ [ v ]
16+ type = MooseVariableFVReal
17+ initial_condition = 2 . 0
18+ solver_sys = v_sys
19+ []
20+ [ u ]
21+ type = MooseLinearVariableFVReal
22+ solver_sys = 'u_sys'
23+ initial_condition = 1 . 0
24+ []
25+ []
26+
27+ [FVKernels]
28+ [ diffusion ]
29+ type = FVDiffusion
30+ variable = v
31+ coeff = u
32+ []
33+ [ source ]
34+ type = FVBodyForce
35+ variable = v
36+ function = 3
37+ []
38+ []
39+
40+ [LinearFVKernels]
41+ [ diffusion ]
42+ type = LinearFVDiffusion
43+ variable = u
44+ diffusion_coeff = v
45+ []
46+ [ source ]
47+ type = LinearFVSource
48+ variable = u
49+ source_density = 1
50+ []
51+ []
52+
53+ [FVBCs]
54+ [ dir ]
55+ type = FVFunctorDirichletBC
56+ variable = v
57+ boundary = "left right"
58+ functor = 2
59+ []
60+ []
61+
62+ [LinearFVBCs]
63+ [ dir ]
64+ type = LinearFVAdvectionDiffusionFunctorDirichletBC
65+ variable = u
66+ boundary = "left right"
67+ functor = 1
68+ []
69+ []
70+
71+ [Convergence]
72+ [ linear ]
73+ type = IterationCountConvergence
74+ max_iterations = 6
75+ converge_at_max_iterations = true
76+ []
77+ []
78+
79+ [MultiApps]
80+ [ sub ]
81+ type = FullSolveMultiApp
82+ input_files = sub .i
83+ execute_on = TIMESTEP_END
84+ keep_solution_during_restore = true
85+ []
86+ []
87+
88+ [Executioner]
89+ type = Steady
90+ system_names = 'v_sys u_sys'
91+ l_abs_tol = 1e - 12
92+ l_tol = 1e - 10
93+ nl_abs_tol = 1e - 10
94+ multi_system_fixed_point=true
95+ multi_system_fixed_point_convergence=linear
96+ petsc_options_iname = '-pc_type -pc_hypre_type'
97+ petsc_options_value = 'hypre boomeramg'
98+ fixed_point_max_its = 2
99+ fixed_point_min_its = 2
100+ #disable_fixed_point_residual_norm_check = true
101+ accept_on_max_fixed_point_iteration = true
102+ []
Original file line number Diff line number Diff line change 1+ [Mesh]
2+ [gmg]
3+ type = GeneratedMeshGenerator
4+ dim = 1
5+ nx = 6
6+ []
7+ []
8+
9+ [Problem]
10+ nl_sys_names = ' v_sys'
11+ linear_sys_names = ' u_sys'
12+ []
13+
14+ [Variables]
15+ [v]
16+ type = MooseVariableFVReal
17+ initial_condition = 2.0
18+ solver_sys = v_sys
19+ []
20+ [u]
21+ type = MooseLinearVariableFVReal
22+ solver_sys = ' u_sys'
23+ initial_condition = 1.0
24+ []
25+ []
26+
27+ [FVKernels]
28+ [diffusion]
29+ type = FVDiffusion
30+ variable = v
31+ coeff = u
32+ []
33+ [source]
34+ type = FVBodyForce
35+ variable = v
36+ function = 3
37+ []
38+ []
39+
40+ [LinearFVKernels]
41+ [diffusion]
42+ type = LinearFVDiffusion
43+ variable = u
44+ diffusion_coeff = v
45+ []
46+ [source]
47+ type = LinearFVSource
48+ variable = u
49+ source_density = 1
50+ []
51+ []
52+
53+ [FVBCs]
54+ [dir]
55+ type = FVFunctorDirichletBC
56+ variable = v
57+ boundary = " left right"
58+ functor = 2
59+ []
60+ []
61+
62+ [LinearFVBCs]
63+ [dir]
64+ type = LinearFVAdvectionDiffusionFunctorDirichletBC
65+ variable = u
66+ boundary = " left right"
67+ functor = 1
68+ []
69+ []
70+
71+ [Convergence]
72+ [linear]
73+ type = IterationCountConvergence
74+ max_iterations = 6
75+ converge_at_max_iterations = true
76+ []
77+ []
78+
79+ [Executioner]
80+ type = Steady
81+ #type = Transient
82+ #steady_state_detection = true
83+ system_names = ' v_sys u_sys'
84+ l_abs_tol = 1e-12
85+ l_tol = 1e-10
86+ nl_abs_tol = 1e-10
87+ multi_system_fixed_point=true
88+ multi_system_fixed_point_convergence=linear
89+ petsc_options_iname = ' -pc_type -pc_hypre_type'
90+ petsc_options_value = ' hypre boomeramg'
91+ []
92+
93+ [Outputs]
94+ exodus = true
95+ #execute_on = timestep_end
96+ []
Original file line number Diff line number Diff line change 1+ [Tests]
2+ issues = '#31097'
3+ design = 'syntax/MultiApps/index.md'
4+ [nl_sol]
5+ type = Exodiff
6+ input = parent.i
7+ #gold is created by running parent.i with fixed_point_max/min_its set to 1
8+ exodiff = parent_out_sub0.e
9+ #Shifts the time index to compare the last step of gold to the first step of the test.
10+ custom_cmp = exodiff.cmp
11+ exodiff_opts = '-show_all_diffs'
12+ # Linear finite volume currently does not support threading, see libmesh issue #3808
13+ max_threads = 1
14+ requirement = 'The system shall be able to restore multiple solver systems when performing fixed point iterations with multiple applications.'
15+ []
16+ []
You can’t perform that action at this time.
0 commit comments