Flow123d
JS_before_hm-2212-gb8d94e0c1
|
Go to the documentation of this file.
26 #include <boost/circular_buffer.hpp>
44 template<
class T>
class Iterator;
69 "See the key 'common_time_unit'.");
128 TimeStep(
double init_time, std::shared_ptr<TimeUnitConversion> time_unit_conversion = std::make_shared<TimeUnitConversion>());
167 inline bool gt(
double other_time)
const
173 inline bool ge(
double other_time)
const
179 inline bool lt(
double other_time)
const
185 inline bool le(
double other_time)
const
191 inline bool eq(
double other_time)
const
192 {
return this->
le(other_time) && this->
ge(other_time); }
195 {
return this->
ge(other_time) && this->
lt(other_time +
length_); }
326 <<
"Time step index: " << EI_Index::val
327 <<
", history index: " << EI_BackIndex::val
328 <<
" out of history of size: " << EI_HistorySize::val);
333 double upper_bound=std::numeric_limits<double>::max());
352 bool timestep_output =
true);
542 inline double t()
const
565 inline double dt()
const
615 void view(
const char *name=
"")
const;
double max_dt
max DT limit
double read_coef(Input::Iterator< Input::Record > unit_it) const
void add_time_marks_grid(double step, TimeMark::Type mark_type=TimeMark::none_type) const
bool safe_compare(double t1, double t0) const
DECLARE_INPUT_EXCEPTION(ExcTimeGovernorMessage,<< EI_Message::val)
double read_unit_coef_from_input(const Input::Record &input) const
Reads the Unit record and computes the coef.
TimeMarks::iterator next(const TimeGovernor &tg, const TimeMark::Type &mask) const
DECLARE_EXCEPTION(ExcMissingTimeStep,<< "Time step index: "<< EI_Index::val<< ", history index: "<< EI_BackIndex::val<< " out of history of size: "<< EI_HistorySize::val)
bool le(double other_time) const
DtLimitRow(double t, double min, double max)
std::ostream & operator<<(std::ostream &out, const TimeStep &t_step)
double last_printed_timestep_
Store last printed time to YAML output, try multiplicity output of one time.
static Input::Type::Default get_input_default()
void set_permanent_constraint()
Sets permanent constraints for actual time step.
double end_time() const
End time.
unsigned int dt_limits_pos_
Index to actual position of DT limits.
std::string upper_constraint_message_
Description of the upper constraint.
std::shared_ptr< TimeUnitConversion > get_unit_conversion() const
Getter for time unit conversion object.
double read_time(Input::Iterator< Input::Tuple > time_it, double default_time) const
double init_time_
Initial time.
TimeMarks::iterator last(const TimeStep &time_step, const TimeMark::Type &mask) const
double fixed_time_step_
Next fixed time step.
TimeGovernor(const Input::Record &input, TimeMark::Type fixed_time_mask=TimeMark::none_type, bool timestep_output=true)
Constructor for unsteady solvers.
TimeMark::Type equation_fixed_mark_type() const
int set_upper_constraint(double upper, std::string message)
Sets upper constraint for the next time step estimating.
double estimate_time() const
double end_of_fixed_dt_interval_
End of interval if fixed time step.
static const unsigned int size_of_recent_steps_
std::shared_ptr< TimeUnitConversion > get_unit_conversion() const
Getter for time unit conversion object.
Dedicated class for storing path to input and output files.
boost::circular_buffer< TimeStep > recent_steps_
Circular buffer of recent time steps. Implicit size is 3.
double upper_constraint_
Upper constraint for the choice of the next time step.
static TimeMarks time_marks_
bool gt(double other_time) const
double read_coef(Input::Iterator< Input::Record > unit_it) const
bool lt(double other_time) const
double min_time_step_
Permanent lower limit for the time step.
double read_time(Input::Iterator< Input::Tuple > time_it, double default_time=std::numeric_limits< double >::quiet_NaN()) const
bool steady_
True if the time governor is used for steady problem.
TimeMark::Type type_fixed_time()
Helper class storing unit conversion coefficient and functionality for conversion of units.
int set_lower_constraint(double lower, std::string message)
Sets lower constraint for the next time step estimating.
std::string unit_string_
String representation of global unit of all time values within the equation.
void set_dt_limits(double min_dt, double max_dt, Input::Array dt_limits_list)
Sets dt limits for time dependent DT limits in simulation.
double last_lower_constraint_
Lower constraint used for choice of current time.
void init_common(double init_time, double end_time, TimeMark::Type type)
Common part of the constructors. Set most important parameters, check they are valid and set default ...
bool is_end() const
Returns true if the actual time is greater than or equal to the end time.
std::string lower_constraint_message_
Description of the upper constraint.
double last_upper_constraint_
Upper constraint used for choice of current time.
bool operator==(const TimeStep &other)
bool timestep_output_
Special flag allows forbid output time steps during multiple initialization of TimeGovernor.
bool is_steady() const
Returns true if the time governor is used for steady problem.
bool limits_time_marks_
Allows add all times defined in dt_limits_table_ to list of TimeMarks.
static const double time_step_precision
std::shared_ptr< TimeUnitConversion > time_unit_conversion_
Conversion unit of all time values within the equation.
double upper_constraint() const
double end_time_
End time of the simulation.
double reduce_timestep(double factor)
Force timestep reduction in particular in the case of failure of the non-linear solver.
Representation of one time step..
Basic time management functionality for unsteady (and steady) solvers (class Equation).
const TimeStep & step(int index=-1) const
Structure that stores one record of DT limit.
double read_coef(Input::Iterator< Input::Record > unit_it) const
TimeMarks::iterator next(const TimeMark::Type &mask) const
double end_
End time point of the time step.
double coef_
Conversion coefficient of all time values within the equation.
double estimate_dt() const
Estimate choice of next time step according to actual setting of constraints.
static const Input::Type::Record & get_input_type()
void view(const char *name="") const
double end_of_fixed_dt() const
double lower_constraint_
Lower constraint for the choice of the next time step.
static const Type none_type
Mark Type with all bits unset.
TimeStep make_next(double new_length) const
bool eq(double other_time) const
unsigned int index_
Index of the step is index if the end time. Zero time step is artificial.
This class is a collection of time marks to manage various events occurring during simulation time.
double min_dt
min DT limit
std::vector< DtLimitRow > dt_limits_table_
Table of DT limits.
double read_time(Input::Iterator< Input::Tuple > time_it, double default_time=std::numeric_limits< double >::quiet_NaN()) const
static TimeMarks & marks()
std::ofstream timesteps_output_
Handle for file for output time steps to YAML format.
Global macros to enhance readability and debugging, general constants.
double time
time of DT limits record
std::shared_ptr< TimeUnitConversion > time_unit_conversion_
Conversion unit of all time values within the equation.
static const double inf_time
Infinity time used for steady case.
TimeMark::Type equation_mark_type() const
TimeMarks::iterator last(const TimeMark::Type &mask) const
double max_time_step_
Permanent upper limit for the time step.
static const double max_end_time
FilePath timesteps_output_file_
File path for timesteps_output_ stream.
TYPEDEF_ERR_INFO(EI_Index, int)
bool is_changed_dt() const
bool is_current(const TimeMark::Type &mask) const
static const Input::Type::Tuple & get_input_time_type(double lower_bound=-std::numeric_limits< double >::max(), double upper_bound=std::numeric_limits< double >::max())
bool contains(double other_time) const
unsigned int index() const
bool ge(double other_time) const
double lower_constraint() const
void next_time()
Proceed to the next time according to current estimated time step.
bool time_step_changed_
Flag is set if the time step has been changed (lasts only one time step).
double fix_dt_until_mark()
Fixing time step until fixed time mark.
Iterator over TimeMark objects in TimeMarks object (database of TimeMark objects).
TimeMark::Type eq_mark_type_
TimeMark type of the equation.
bool is_time_step_fixed_
Flag that is set when the fixed step is set (lasts only one time step).
std::string get_unit_string() const