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{
59{
60public:
81 double const t_initial,
82 double const t_end,
83 double const min_dt,
84 double const max_dt,
85 double const initial_dt,
86 MultiplyerInterpolationType const multiplier_interpolation_type,
87 std::vector<int>&& iter_times_vector,
88 std::vector<double>&& multiplier_vector,
89 std::vector<double> const& fixed_times_for_output);
90
92
93 double next(double solution_error, int number_iterations,
94 NumLib::TimeStep& ts_previous,
95 NumLib::TimeStep& ts_current) override;
96
97 bool isSolutionErrorComputationNeeded() const override { return true; }
98
100 NumLib::TimeStep const& timestep_previous,
101 NumLib::TimeStep const& timestep_current) const override;
102
103private:
105 double getNextTimeStepSize(NumLib::TimeStep const& ts_previous,
106 NumLib::TimeStep const& ts_current) const;
107
110 const std::vector<int> _iter_times_vector;
112 const std::vector<double> _multiplier_vector;
114 const double _min_dt;
116 const double _max_dt;
118 const double _initial_dt;
122 const int _max_iter;
124 int _iter_times = 0;
125
126 std::vector<double> const _fixed_times_for_output;
127};
128
130double findMultiplier(
131 int const number_iterations, bool const current_time_step_is_accepted,
132 std::vector<int> const& nonlinear_iteration_numbers,
133 std::vector<double> const& multipliers,
134 MultiplyerInterpolationType const multiplier_interpolation_type);
135
136} // 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.