OGS
IterationNumberBasedTimeStepping.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2// SPDX-License-Identifier: BSD-3-Clause
3
4#pragma once
5
6#include <vector>
7
9#include "TimeStepAlgorithm.h"
10
11namespace NumLib
12{
64{
65public:
86 double const t_initial,
87 double const t_end,
88 double const min_dt,
89 double const max_dt,
90 double const initial_dt,
91 MultiplyerInterpolationType const multiplier_interpolation_type,
92 std::vector<int>&& iter_times_vector,
93 std::vector<double>&& multiplier_vector,
94 std::vector<double> const& fixed_times_for_output);
95
97
98 double next(double solution_error, int number_iterations,
99 NumLib::TimeStep& ts_previous,
100 NumLib::TimeStep& ts_current) override;
101
102 bool isSolutionErrorComputationNeeded() const override { return true; }
103
105 NumLib::TimeStep const& timestep_previous,
106 NumLib::TimeStep const& timestep_current) const override;
107
108private:
110 double getNextTimeStepSize(NumLib::TimeStep const& ts_previous,
111 NumLib::TimeStep const& ts_current) const;
112
115 const std::vector<int> _iter_times_vector;
117 const std::vector<double> _multiplier_vector;
119 const double _min_dt;
121 const double _max_dt;
123 const double _initial_dt;
127 const int _max_iter;
129 int _iter_times = 0;
130
131 std::vector<double> const _fixed_times_for_output;
132};
133
135double findMultiplier(
136 int const number_iterations, bool const current_time_step_is_accepted,
137 std::vector<int> const& nonlinear_iteration_numbers,
138 std::vector<double> const& multipliers,
139 MultiplyerInterpolationType const multiplier_interpolation_type);
140
141} // namespace NumLib
IterationNumberBasedTimeStepping(double const t_initial, double const t_end, double const min_dt, double const max_dt, double const initial_dt, MultiplyerInterpolationType const multiplier_interpolation_type, std::vector< int > &&iter_times_vector, std::vector< double > &&multiplier_vector, std::vector< double > const &fixed_times_for_output)
double next(double solution_error, int number_iterations, NumLib::TimeStep &ts_previous, NumLib::TimeStep &ts_current) override
const MultiplyerInterpolationType _multiplier_interpolation_type
Interpolation type for the multiplier.
~IterationNumberBasedTimeStepping() override=default
double getNextTimeStepSize(NumLib::TimeStep const &ts_previous, NumLib::TimeStep const &ts_current) const
Calculate the next time step size.
const double _max_dt
The maximum allowed time step size.
const std::vector< double > _multiplier_vector
This vector stores the multiplier coefficients.
bool canReduceTimestepSize(NumLib::TimeStep const &timestep_previous, NumLib::TimeStep const &timestep_current) const override
Query the timestepper if further time step size reduction is possible.
int _iter_times
The number of nonlinear iterations.
const double _min_dt
The minimum allowed time step size.
const int _max_iter
The maximum allowed iteration number to accept current time step.
TimeStepAlgorithm(const double t0, const double t_end)
Time step object.
Definition TimeStep.h:24
double findMultiplier(int const number_iterations, bool const current_time_step_is_accepted, std::vector< int > const &nonlinear_iteration_numbers, std::vector< double > const &multipliers, MultiplyerInterpolationType const multiplier_interpolation_type)
Find a multiplier for the given number of iterations.