22 const double t,
const double dt,
const std::size_t timestep_id,
23 std::vector<GlobalVector*>& process_solutions,
24 std::vector<GlobalVector*>
const& process_solutions_prev,
25 std::vector<std::unique_ptr<ProcessData>>
const& per_process_data,
26 std::vector<Output>
const& outputs,
29 auto const [nonlinear_solver_status, coupling_iteration_converged] =
31 timestep_id, process_solutions, process_solutions_prev,
32 per_process_data, outputs,
33 solve_one_time_step_one_process);
35 if (!coupling_iteration_converged)
38 "The coupling iterations reaches its maximum number in time step "
39 "#{:d} at t = {:g} s",
43 return nonlinear_solver_status;
48 int const global_coupling_iteration,
49 CouplingNode const& regular_coupling_node,
const double t,
const double dt,
50 const std::size_t timestep_id,
51 std::vector<GlobalVector*>& process_solutions,
52 std::vector<GlobalVector*>
const& process_solutions_prev,
53 std::vector<std::unique_ptr<ProcessData>>
const& per_process_data,
54 std::vector<Output>
const& outputs,
58 time_timestep_process.
start();
60 auto const process_id = regular_coupling_node.
process_id;
61 auto const& process_name = regular_coupling_node.
process_name;
62 INFO(
"Solve process #{:d} (named as {:s})", process_id, process_name);
64 auto& process_data = *(per_process_data[process_id]);
66 process_data.nonlinear_solver_status = solve_one_time_step_one_process(
67 process_solutions, process_solutions_prev, timestep_id, t, dt,
68 process_data, outputs);
71 "[time] Solving process #{:d} (named as {:s}) took {:g} s in "
72 "time step #{} coupling iteration #{}.",
73 process_id, process_name, time_timestep_process.
elapsed(), timestep_id,
74 global_coupling_iteration);
76 return process_data.nonlinear_solver_status;
82 std::vector<CouplingNodeVariant>& coupling_nodes,
const int max_iterations,
83 const double t,
const double dt,
const std::size_t timestep_id,
84 std::vector<GlobalVector*>& process_solutions,
85 std::vector<GlobalVector*>
const& process_solutions_prev,
86 std::vector<std::unique_ptr<ProcessData>>
const& per_process_data,
87 std::vector<Output>
const& outputs,
94 bool coupling_iteration_converged =
true;
95 for (
int global_coupling_iteration = 0;
96 global_coupling_iteration < max_iterations;
97 global_coupling_iteration++,
100 coupling_iteration_converged =
true;
101 for (
auto& coupling_node : coupling_nodes)
104 if (std::holds_alternative<RootCouplingNode>(coupling_node))
106 auto const [local_nonlinear_solver_status,
107 local_coupling_iteration_converged] =
109 coupling_node, t, dt, timestep_id, process_solutions,
110 process_solutions_prev, per_process_data, outputs,
111 solve_one_time_step_one_process);
113 if (!local_nonlinear_solver_status.error_norms_met)
115 coupling_iteration_converged =
false;
116 return {local_nonlinear_solver_status,
117 coupling_iteration_converged};
120 coupling_iteration_converged =
121 coupling_iteration_converged &&
122 local_coupling_iteration_converged;
127 std::get<CouplingNode>(coupling_node);
130 global_coupling_iteration, regular_coupling_node, t, dt,
131 timestep_id, process_solutions, process_solutions_prev,
132 per_process_data, outputs, solve_one_time_step_one_process);
134 if (!nonlinear_solver_status.error_norms_met)
137 "The nonlinear solver failed in time step #{:d} at t = "
138 "{:g} s for process {:s}.",
140 coupling_iteration_converged =
false;
141 return {nonlinear_solver_status, coupling_iteration_converged};
145 *process_solutions[regular_coupling_node.
process_id];
149 if (global_coupling_iteration > 0)
152 coupling_iteration_converged, regular_coupling_node, x);
161 if (coupling_iteration_converged && global_coupling_iteration > 0)
167 return {nonlinear_solver_status, coupling_iteration_converged};
174 const std::size_t timestep_id,
175 std::vector<GlobalVector*>& process_solutions,
176 std::vector<GlobalVector*>
const& process_solutions_prev,
177 std::vector<std::unique_ptr<ProcessData>>
const& per_process_data,
178 std::vector<Output>
const& outputs,
181 INFO(
"--- Execute sub-coupling:");
183 std::get<RootCouplingNode>(coupling_node);
184 const int local_max_iterations =
188 auto const [sub_nonlinear_solver_status, sub_coupling_iteration_converged] =
191 timestep_id, process_solutions, process_solutions_prev,
192 per_process_data, outputs, solve_one_time_step_one_process);
194 INFO(
"--- End sub-coupling.");
195 return {sub_nonlinear_solver_status, sub_coupling_iteration_converged};
NumLib::NonlinearSolverStatus executeSingleIteration(int const global_coupling_iteration, CouplingNode const ®ular_coupling_node, const double t, const double dt, const std::size_t timestep_id, std::vector< GlobalVector * > &process_solutions, std::vector< GlobalVector * > const &process_solutions_prev, std::vector< std::unique_ptr< ProcessData > > const &per_process_data, std::vector< Output > const &outputs, ProcessSolver< ProcessData, Output > const &solve_one_time_step_one_process)
std::tuple< NumLib::NonlinearSolverStatus, bool > executeConcrete(std::vector< CouplingNodeVariant > &coupling_nodes, const int max_iterations, const double t, const double dt, const std::size_t timestep_id, std::vector< GlobalVector * > &process_solutions, std::vector< GlobalVector * > const &process_solutions_prev, std::vector< std::unique_ptr< ProcessData > > const &per_process_data, std::vector< Output > const &outputs, ProcessSolver< ProcessData, Output > const &solve_one_time_step_one_process)
NumLib::NonlinearSolverStatus execute(const double t, const double dt, const std::size_t timestep_id, std::vector< GlobalVector * > &process_solutions, std::vector< GlobalVector * > const &process_solutions_prev, std::vector< std::unique_ptr< ProcessData > > const &per_process_data, std::vector< Output > const &outputs, ProcessSolver< ProcessData, Output > const &solve_one_time_step_one_process)
std::tuple< NumLib::NonlinearSolverStatus, bool > executeSubCoupling(CouplingNodeVariant &coupling_node, const double t, const double dt, const std::size_t timestep_id, std::vector< GlobalVector * > &process_solutions, std::vector< GlobalVector * > const &process_solutions_prev, std::vector< std::unique_ptr< ProcessData > > const &per_process_data, std::vector< Output > const &outputs, ProcessSolver< ProcessData, Output > const &solve_one_time_step_one_process)