diff --git a/NumLib/TimeStepping/Algorithms/CreateIterationNumberBasedTimeStepping.cpp b/NumLib/TimeStepping/Algorithms/CreateIterationNumberBasedTimeStepping.cpp index 031dab1d21e2be719dbf90597034ad32f15058a7..2b1cad634f74511a1e54a55840121fd71e929d28 100644 --- a/NumLib/TimeStepping/Algorithms/CreateIterationNumberBasedTimeStepping.cpp +++ b/NumLib/TimeStepping/Algorithms/CreateIterationNumberBasedTimeStepping.cpp @@ -47,4 +47,4 @@ std::unique_ptr<TimeStepAlgorithm> createIterationNumberBasedTimeStepping( t_initial, t_end, minimum_dt, maximum_dt, initial_dt, std::move(number_iterations), std::move(multiplier)); } -} // end of namespace NumLib +} // namespace NumLib diff --git a/NumLib/TimeStepping/Algorithms/CreateIterationNumberBasedTimeStepping.h b/NumLib/TimeStepping/Algorithms/CreateIterationNumberBasedTimeStepping.h index 72d88f264e72662f7c40bc624c163fb6bba39559..b34ecc609702777a12a8892afb5b2769d1e691d3 100644 --- a/NumLib/TimeStepping/Algorithms/CreateIterationNumberBasedTimeStepping.h +++ b/NumLib/TimeStepping/Algorithms/CreateIterationNumberBasedTimeStepping.h @@ -27,4 +27,4 @@ namespace NumLib /// configuration. std::unique_ptr<TimeStepAlgorithm> createIterationNumberBasedTimeStepping( BaseLib::ConfigTree const& config); -} // end of namespace NumLib +} // namespace NumLib diff --git a/NumLib/TimeStepping/Algorithms/EvolutionaryPIDcontroller.cpp b/NumLib/TimeStepping/Algorithms/EvolutionaryPIDcontroller.cpp index 85efd57217a0ad0c50d0754fabaf0f66c4be9a95..ca5103224da9055d1f73d1145f625fd4d403f43c 100644 --- a/NumLib/TimeStepping/Algorithms/EvolutionaryPIDcontroller.cpp +++ b/NumLib/TimeStepping/Algorithms/EvolutionaryPIDcontroller.cpp @@ -28,7 +28,7 @@ bool EvolutionaryPIDcontroller::next(double const solution_error, const double e_n = solution_error; const double zero_threshlod = std::numeric_limits<double>::epsilon(); // step rejected. - if (e_n > _tol) // e_n < TOL + if (e_n > _tol) { _is_accepted = false; @@ -167,4 +167,4 @@ void EvolutionaryPIDcontroller::addFixedOutputTimes( // Remove possible duplicated elements and sort in descending order. BaseLib::makeVectorUnique(_fixed_output_times, std::greater<double>()); } -} // end of namespace NumLib +} // namespace NumLib diff --git a/NumLib/TimeStepping/Algorithms/EvolutionaryPIDcontroller.h b/NumLib/TimeStepping/Algorithms/EvolutionaryPIDcontroller.h index 2f5b0fc692cde8bcced88e18b46bfbb9cd52fd4b..76a9a1c89d7972e975a31ccd98de50a243802ea0 100644 --- a/NumLib/TimeStepping/Algorithms/EvolutionaryPIDcontroller.h +++ b/NumLib/TimeStepping/Algorithms/EvolutionaryPIDcontroller.h @@ -71,28 +71,17 @@ public: { } - /** - * move to the next time step - * @param solution_error \f$e_n\f$, solution error between two successive - time steps. - * @return true if the next step exists - */ bool next(double solution_error, int number_iterations) override; - /// return if current time step is accepted bool accepted() const override { return _is_accepted; } - /// Set the status of the step - /// \param accepted A flag for whether the step is accepted or not + void setAcceptedOrNot(const bool accepted) override { _is_accepted = accepted; } - /// Get a flag to indicate that this algorithm need to compute - /// solution error. bool isSolutionErrorComputationNeeded() override { return true; } - /// \copydoc NumLib::TimeStepAlgorithm::addFixedOutputTimes void addFixedOutputTimes( std::vector<double> const& extra_fixed_output_times) override; diff --git a/NumLib/TimeStepping/Algorithms/FixedTimeStepping.h b/NumLib/TimeStepping/Algorithms/FixedTimeStepping.h index 302fe049e5c04027b18b9d41a4b76e2527614330..9c555b8af2ac750c82c514c2e044180717db2d9c 100644 --- a/NumLib/TimeStepping/Algorithms/FixedTimeStepping.h +++ b/NumLib/TimeStepping/Algorithms/FixedTimeStepping.h @@ -1,4 +1,5 @@ /** + * \file * \author Norihiro Watanabe * \date 2012-08-03 * @@ -57,11 +58,10 @@ public: FixedTimeStepping(double t_initial, double t_end, const std::vector<double>& vec_all_dt); - /// move to the next time step bool next(double solution_error, int number_iterations) override; - /// return if current time step is accepted bool accepted() const override { return true; } + private: /// determine true end time static double computeEnd(double t_initial, double t_end, diff --git a/NumLib/TimeStepping/Algorithms/IterationNumberBasedTimeStepping.h b/NumLib/TimeStepping/Algorithms/IterationNumberBasedTimeStepping.h index 7c5c6d7cf14a22e7649ee2583f1d8aa8090a0271..d2f8ae3e59503d022b5275eff59b25f8db743aef 100644 --- a/NumLib/TimeStepping/Algorithms/IterationNumberBasedTimeStepping.h +++ b/NumLib/TimeStepping/Algorithms/IterationNumberBasedTimeStepping.h @@ -19,7 +19,7 @@ namespace NumLib { /** - * \brief Iteration number based adaptive time stepping + * \brief Iteration number based adaptive time stepping. * * This algorithm estimates a time step size depending on the number of * iterations (e.g. of iterative linear solvers, nonlinear methods, partitioned @@ -67,8 +67,6 @@ class IterationNumberBasedTimeStepping final : public TimeStepAlgorithm { public: /** - * Constructor - * * @param t_initial start time * @param t_end end time * @param min_dt the minimum allowed time step size @@ -94,37 +92,35 @@ public: ~IterationNumberBasedTimeStepping() override = default; - /// move to the next time step bool next(double solution_error, int number_iterations) override; - /// return if the current step is accepted bool accepted() const override; bool isSolutionErrorComputationNeeded() override { return true; } - /// return the number of repeated steps + /// Return the number of repeated steps. int getNumberOfRepeatedSteps() const { return _n_rejected_steps; } private: - /// calculate the next time step size + /// Calculate the next time step size. double getNextTimeStepSize() const; - /// this vector stores the number of iterations to which the respective - /// multiplier coefficient will be applied + /// This vector stores the number of iterations to which the respective + /// multiplier coefficient will be applied. const std::vector<int> _iter_times_vector; - /// this vector stores the multiplier coefficients + /// This vector stores the multiplier coefficients. const std::vector<double> _multiplier_vector; - /// the minimum allowed time step size + /// The minimum allowed time step size. const double _min_dt; - /// the maximum allowed time step size + /// The maximum allowed time step size. const double _max_dt; - /// initial time step size + /// Initial time step size. const double _initial_dt; - /// the maximum allowed iteration number to accept current time step + /// The maximum allowed iteration number to accept current time step. const int _max_iter; - /// the number of nonlinear iterations + /// The number of nonlinear iterations. int _iter_times = 0; - /// the number of rejected steps + /// The number of rejected steps. int _n_rejected_steps = 0; }; diff --git a/NumLib/TimeStepping/Algorithms/TimeStepAlgorithm.h b/NumLib/TimeStepping/Algorithms/TimeStepAlgorithm.h index 28f12e865713b182f69d34c93e9097841c3d965b..e84a16f9a7593db0c8c5511c87d827fb8c7ebc42 100644 --- a/NumLib/TimeStepping/Algorithms/TimeStepAlgorithm.h +++ b/NumLib/TimeStepping/Algorithms/TimeStepAlgorithm.h @@ -1,4 +1,5 @@ /** + * \file * \author Norihiro Watanabe * \date 2012-08-03 * @@ -88,8 +89,9 @@ public: _ts_current += dt; } - /// move to the next time step - /// \param solution_error Solution error between two successive time steps. + /// Move to the next time step + /// \param solution_error Solution error \f$e_n\f$ between two successive + /// time steps. /// \param number_iterations Number of non-linear iterations used. /// \return true if the next step exists virtual bool next(const double solution_error, int number_iterations) = 0; @@ -97,9 +99,10 @@ public: /// return if current time step is accepted or not virtual bool accepted() const = 0; - /// Set the status of the step. A boolean parameter is needed to indicated - /// whether the step is accepted or not. - virtual void setAcceptedOrNot(const bool /*accepted*/){}; + /// Set the status of the step. + /// \param accepted A boolean parameter is needed to indicated whether the + /// step is accepted or not. + virtual void setAcceptedOrNot(const bool accepted) { (void)accepted; }; /// return a history of time step sizes const std::vector<double>& getTimeStepSizeHistory() const @@ -111,13 +114,11 @@ public: /// solution error. The default return value is false. virtual bool isSolutionErrorComputationNeeded() { return false; } - /** - * Add specified times to the existing vector of the specified times. - * If there are specified times, they will be used as constraints in the - * computing of time step size such that the time step can exactly reach at - * the specified times. The function is mainly used to accept the specified - * times from the configuration of output. - */ + /// Add specified times to the existing vector of the specified times. + /// If there are specified times, they will be used as constraints in the + /// computing of time step size such that the time step can exactly reach at + /// the specified times. The function is mainly used to accept the specified + /// times from the configuration of output. virtual void addFixedOutputTimes( std::vector<double> const& /*fixed_output_times*/) { @@ -138,4 +139,4 @@ protected: std::vector<double> _dt_vector; }; -} // NumLib +} // namespace NumLib