diff --git a/NumLib/TimeStepping/Algorithms/IterationNumberBasedTimeStepping.cpp b/NumLib/TimeStepping/Algorithms/IterationNumberBasedTimeStepping.cpp index 252476d12254e46335ce5c40a79cea11f34a7b62..5ed17cd2fce2860b4feb4b258e715fdc0c90ce39 100644 --- a/NumLib/TimeStepping/Algorithms/IterationNumberBasedTimeStepping.cpp +++ b/NumLib/TimeStepping/Algorithms/IterationNumberBasedTimeStepping.cpp @@ -55,13 +55,6 @@ bool IterationNumberBasedTimeStepping::next(double const /*solution_error*/, { _iter_times = number_iterations; - // check current time step - if (std::abs(_ts_current.current() - end()) < - std::numeric_limits<double>::epsilon()) - { - return false; - } - // confirm current time and move to the next if accepted if (accepted()) { @@ -71,6 +64,10 @@ bool IterationNumberBasedTimeStepping::next(double const /*solution_error*/, else { ++_n_rejected_steps; + // time step was rejected, keep dt for the next dt computation. + _ts_prev = // essentially equal to _ts_prev.dt = _ts_current.dt. + TimeStep{_ts_prev.previous(), + _ts_prev.previous() + _ts_current.dt(), _ts_prev.steps()}; } // prepare the next time step info diff --git a/ProcessLib/ProcessData.h b/ProcessLib/ProcessData.h index 2041b9aba238367b1b3f41deea2d78ee4f8dbc5c..35b395103d9e5bfbb96044743b126220ff8f3c66 100644 --- a/ProcessLib/ProcessData.h +++ b/ProcessLib/ProcessData.h @@ -53,11 +53,6 @@ struct ProcessData std::unique_ptr<NumLib::TimeStepAlgorithm> timestepper; - //! Flag of skiping time stepping. It is used in the modelling of - //! coupled processes. If the stepping of any process reaches a steady state - //! or the ending time, the flag is set to true. - bool skip_time_stepping = false; - //! Tag containing the missing type information necessary to cast the //! other members of this struct to their concrety types. NumLib::NonlinearSolverTag const nonlinear_solver_tag; diff --git a/ProcessLib/TimeLoop.cpp b/ProcessLib/TimeLoop.cpp index b8c3e4756e52dabb486775355f17653cfd5bb45f..2d18c1ab79e6270e2d66e78894219cbadaa1eca2 100644 --- a/ProcessLib/TimeLoop.cpp +++ b/ProcessLib/TimeLoop.cpp @@ -313,15 +313,6 @@ double TimeLoop::computeTimeStepping(const double prev_dt, double& t, dt = timestepper->getTimeStep().dt(); } } - else - { - // dt being close to 0 only happens when - // t_n + dt > t_s, and dt is forced to be zero. Where t_n the time - // of previous time step, and t_s is the specified time taken from - // input or the end time. Under this condition, the time stepping - // is skipped. - ppd.skip_time_stepping = true; - } } if (all_process_steps_accepted) @@ -342,11 +333,6 @@ double TimeLoop::computeTimeStepping(const double prev_dt, double& t, auto& timestepper = ppd.timestepper; timestepper->resetCurrentTimeStep(dt); - if (ppd.skip_time_stepping) - { - continue; - } - if (t == timestepper->begin()) { is_initial_step = true; @@ -550,13 +536,6 @@ NumLib::NonlinearSolverStatus TimeLoop::solveUncoupledEquationSystems( unsigned process_id = 0; for (auto& process_data : _per_process_data) { - if (process_data->skip_time_stepping) - { - INFO("Process %u is skipped in the time stepping.", process_id); - ++process_id; - continue; - } - BaseLib::RunTime time_timestep_process; time_timestep_process.start(); @@ -638,13 +617,6 @@ TimeLoop::solveCoupledEquationSystemsByStaggeredScheme( int const last_process_id = _per_process_data.size() - 1; for (auto& process_data : _per_process_data) { - if (process_data->skip_time_stepping) - { - INFO("Process %u is skipped in the time stepping.", process_id); - ++process_id; - continue; - } - BaseLib::RunTime time_timestep_process; time_timestep_process.start(); @@ -737,11 +709,6 @@ TimeLoop::solveCoupledEquationSystemsByStaggeredScheme( int process_id = 0; for (auto& process_data : _per_process_data) { - if (process_data->skip_time_stepping) - { - ++process_id; - continue; - } CoupledSolutionsForStaggeredScheme coupled_solutions( _solutions_of_coupled_processes, dt, process_id); @@ -772,8 +739,7 @@ void TimeLoop::outputSolutions(bool const output_initial_condition, auto& pcs = process_data->process; // If nonlinear solver diverged, the solution has already been // saved. - if ((!process_data->nonlinear_solver_status.error_norms_met) || - process_data->skip_time_stepping) + if (!process_data->nonlinear_solver_status.error_norms_met) { ++process_id; continue;