diff --git a/ProcessLib/CreateTimeLoop.cpp b/ProcessLib/CreateTimeLoop.cpp index 9037fc2efe2d9879371d8ff329e798a9799716cd..2cbba1bf0b7ecc1c14884cf5188e27b535d600a8 100644 --- a/ProcessLib/CreateTimeLoop.cpp +++ b/ProcessLib/CreateTimeLoop.cpp @@ -75,18 +75,20 @@ std::unique_ptr<TimeLoop> createTimeLoop( } } - const auto minmax_iter = std::minmax_element( - per_process_data.begin(), - per_process_data.end(), - [](std::unique_ptr<ProcessData> const& a, - std::unique_ptr<ProcessData> const& b) - { return (a->timestepper->end() < b->timestepper->end()); }); + const auto minmax_iter = + std::minmax_element(per_process_data.begin(), + per_process_data.end(), + [](std::unique_ptr<ProcessData> const& a, + std::unique_ptr<ProcessData> const& b) { + return (a->timestep_algorithm->end() < + b->timestep_algorithm->end()); + }); const double start_time = per_process_data[minmax_iter.first - per_process_data.begin()] - ->timestepper->begin(); + ->timestep_algorithm->begin(); const double end_time = per_process_data[minmax_iter.second - per_process_data.begin()] - ->timestepper->end(); + ->timestep_algorithm->end(); return std::make_unique<TimeLoop>( std::move(output), std::move(per_process_data), max_coupling_iterations, diff --git a/ProcessLib/ProcessData.h b/ProcessLib/ProcessData.h index cbdb25985b983a8a1403dfa7de431d52df3431d1..dfb37af83838c69cbe33401e38ee0e1ed8ffd083 100644 --- a/ProcessLib/ProcessData.h +++ b/ProcessLib/ProcessData.h @@ -22,14 +22,15 @@ namespace ProcessLib { struct ProcessData { - ProcessData(std::unique_ptr<NumLib::TimeStepAlgorithm>&& timestepper_, - NumLib::NonlinearSolverTag const nonlinear_solver_tag_, - NumLib::NonlinearSolverBase& nonlinear_solver_, - std::unique_ptr<NumLib::ConvergenceCriterion>&& conv_crit_, - std::unique_ptr<NumLib::TimeDiscretization>&& time_disc_, - int const process_id_, - Process& process_) - : timestepper(std::move(timestepper_)), + ProcessData( + std::unique_ptr<NumLib::TimeStepAlgorithm>&& timestep_algorithm_, + NumLib::NonlinearSolverTag const nonlinear_solver_tag_, + NumLib::NonlinearSolverBase& nonlinear_solver_, + std::unique_ptr<NumLib::ConvergenceCriterion>&& conv_crit_, + std::unique_ptr<NumLib::TimeDiscretization>&& time_disc_, + int const process_id_, + Process& process_) + : timestep_algorithm(std::move(timestep_algorithm_)), nonlinear_solver_tag(nonlinear_solver_tag_), nonlinear_solver(nonlinear_solver_), nonlinear_solver_status{true, 0}, @@ -41,7 +42,7 @@ struct ProcessData } ProcessData(ProcessData&& pd) - : timestepper(std::move(pd.timestepper)), + : timestep_algorithm(std::move(pd.timestep_algorithm)), nonlinear_solver_tag(pd.nonlinear_solver_tag), nonlinear_solver(pd.nonlinear_solver), nonlinear_solver_status(pd.nonlinear_solver_status), @@ -53,7 +54,7 @@ struct ProcessData { } - std::unique_ptr<NumLib::TimeStepAlgorithm> timestepper; + std::unique_ptr<NumLib::TimeStepAlgorithm> timestep_algorithm; //! Tag containing the missing type information necessary to cast the //! other members of this struct to their concrety types. diff --git a/ProcessLib/TimeLoop.cpp b/ProcessLib/TimeLoop.cpp index 6a78fff27d771496b8c8f4f1d4e89141098c4321..9c4edeb270daac518605d3648de6588d470a644b 100644 --- a/ProcessLib/TimeLoop.cpp +++ b/ProcessLib/TimeLoop.cpp @@ -314,13 +314,14 @@ double TimeLoop::computeTimeStepping(const double prev_dt, double& t, bool const is_initial_step = std::any_of( _per_process_data.begin(), _per_process_data.end(), - [](auto const& ppd) -> bool - { return ppd->timestepper->getTimeStep().timeStepNumber() == 0; }); + [](auto const& ppd) -> bool { + return ppd->timestep_algorithm->getTimeStep().timeStepNumber() == 0; + }); for (std::size_t i = 0; i < _per_process_data.size(); i++) { auto& ppd = *_per_process_data[i]; - const auto& timestepper = ppd.timestepper; + const auto& timestep_algorithm = ppd.timestep_algorithm; auto& time_disc = ppd.time_disc; auto const& x = *_process_solutions[i]; @@ -332,22 +333,25 @@ double TimeLoop::computeTimeStepping(const double prev_dt, double& t, : MathLib::VecNormType::NORM2; const double solution_error = - (timestepper->isSolutionErrorComputationNeeded()) - ? ((t == timestepper->begin()) + (timestep_algorithm->isSolutionErrorComputationNeeded()) + ? ((t == timestep_algorithm->begin()) ? 0. // Always accepts the zeroth step : time_disc->computeRelativeChangeFromPreviousTimestep( x, x_prev, norm_type)) : 0.; - timestepper->setAccepted(ppd.nonlinear_solver_status.error_norms_met); + timestep_algorithm->setAccepted( + ppd.nonlinear_solver_status.error_norms_met); - auto [step_accepted, timestepper_dt] = timestepper->next( + auto [step_accepted, timestepper_dt] = timestep_algorithm->next( solution_error, ppd.nonlinear_solver_status.number_iterations); if (!step_accepted && - // In case of FixedTimeStepping, which makes timestepper->next(...) - // return false when the ending time is reached. - t + std::numeric_limits<double>::epsilon() < timestepper->end()) + // In case of FixedTimeStepping, which makes + // timestep_algorithm->next(...) return false when the ending time + // is reached. + t + std::numeric_limits<double>::epsilon() < + timestep_algorithm->end()) { // Not all processes have accepted steps. all_process_steps_accepted = false; @@ -362,7 +366,7 @@ double TimeLoop::computeTimeStepping(const double prev_dt, double& t, } if (timestepper_dt > std::numeric_limits<double>::epsilon() || - std::abs(t - timestepper->end()) < + std::abs(t - timestep_algorithm->end()) < std::numeric_limits<double>::epsilon()) { dt = std::min(timestepper_dt, dt); @@ -429,13 +433,13 @@ double TimeLoop::computeTimeStepping(const double prev_dt, double& t, for (std::size_t i = 0; i < _per_process_data.size(); i++) { const auto& ppd = *_per_process_data[i]; - auto& timestepper = ppd.timestepper; + auto& timestep_algorithm = ppd.timestep_algorithm; if (all_process_steps_accepted) { - timestepper->resetCurrentTimeStep(dt); + timestep_algorithm->resetCurrentTimeStep(dt); } - if (t == timestepper->begin()) + if (t == timestep_algorithm->begin()) { continue; } @@ -669,7 +673,7 @@ NumLib::NonlinearSolverStatus TimeLoop::solveUncoupledEquationSystems( "for process #{:d}.", timestep_id, t, process_id); - if (!process_data->timestepper->canReduceTimestepSize()) + if (!process_data->timestep_algorithm->canReduceTimestepSize()) { // save unsuccessful solution _output->doOutputAlways(