Skip to content
Snippets Groups Projects
Unverified Commit c7db17f0 authored by Dmitri Naumov's avatar Dmitri Naumov Committed by GitHub
Browse files

Merge pull request #2587 from endJunction/IterationBasedTimeStepperFix

[NL] Store current dt in prev dt for next iteration.
parents 8800c644 471deed1
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
......@@ -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;
......
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment