46 using namespace Input::Type;
53 "Setting of the simulation time. (can be specific to one equation)")
56 "Start time of the simulation.")
58 "End time of the simulation.")
60 "Initial guess for the time step.\n"
61 "Only useful for equations that use adaptive time stepping."
62 "If set to 0.0, the time step is determined in fully autonomous"
63 " way if the equation supports it.")
66 "Soft lower limit for the time step. Equation using adaptive time stepping can not"
67 "suggest smaller time step, but actual time step could be smaller in order to match "
68 "prescribed input or output times.")
71 "Hard upper limit for the time step. Actual length of the time step is also limited"
72 "by input and output times.");
95 length_(other.length_),
142 double init_dt=input.
val<
double>(
"init_dt");
155 }
catch(ExcTimeGovernorMessage &exc) {
167 THROW(ExcTimeGovernorMessage() << EI_Message(
"Fixed time step smaller then machine precision. \n") );
197 if (init_time < 0.0) {
198 THROW(ExcTimeGovernorMessage()
199 << EI_Message(
"Start time has to be greater or equal to 0.0\n")
208 if (end_time < init_time) {
209 THROW(ExcTimeGovernorMessage() << EI_Message(
"End time must be greater than start time.\n") );
260 THROW(ExcTimeGovernorMessage() << EI_Message(
"'min_dt' smaller then machine precision.\n") );
262 if (max_dt < min_dt) {
263 THROW(ExcTimeGovernorMessage() << EI_Message(
"'max_dt' smaller then 'min_dt'.\n") );
344 THROW(ExcTimeGovernorMessage()
345 << EI_Message(
"Missing end time for making output grid required by key 'time_step' of the output stream.\n")
365 double full_step = fix_time_it->
time() -
t();
370 if (step_estimate ==
inf_time)
return step_estimate;
377 step_estimate = full_step / n_steps;
387 xprintf(
Warn,
"Time step estimate is below the lower constraint of time step. The difference is: %.16f.\n",
390 return step_estimate;
443 unsigned int back_idx;
445 back_idx =
static_cast<unsigned int>(-index-1);
447 back_idx =
static_cast<unsigned int>(
recent_steps_[0].index() - index);
450 THROW(ExcMissingTimeStep() << EI_Index(index) << EI_BackIndex(back_idx) << EI_HistorySize(
recent_steps_.size()));
460 xprintf(
Msg,
"\nTG[%s]:%06d t:%10.4f dt:%10.6f dt_int<%10.6f,%10.6f>",
462 #ifdef DEBUG_MESSAGES
474 static char buffer[1024];
475 sprintf(buffer,
"\n%06d t:%10.4f dt:%10.6f dt_int<%10.6f,%10.6f>\n",
477 return (out << buffer);
void add_time_marks(double time, double dt, double end_time, TimeMark::Type type)
double init_time_
Initial time.
TimeMarks::iterator next(const TimeGovernor &tg, const TimeMark::Type &mask) const
double lower_constraint_
Lower constraint for the choice of the next time step.
Iterator over TimeMark objects in TimeMarks object (database of TimeMark objects).
double end_time() const
End time.
bool is_time_step_fixed_
Flag that is set when the fixed step is set (lasts only one time step).
boost::circular_buffer< TimeStep > recent_steps_
Circular buffer of recent time steps. Implicit size is 2.
static TimeMarks time_marks_
double upper_constraint() const
TimeGovernor(const Input::Record &input, TimeMark::Type fixed_time_mask=TimeMark::none_type)
Constructor for unsteady solvers.
double end_time_
End time of the simulation.
double fix_dt_until_mark()
Fixing time step until fixed time mark.
void set_permanent_constraint(double min_dt, double max_dt)
Sets permanent constraints for time step.
bool is_end() const
Returns true if the actual time is greater than or equal to the end time.
void next_time()
Proceed to the next time according to current estimated time step.
const TimeStep & step(int index=-1) const
Basic time management functionality for unsteady (and steady) solvers (class Equation).
static const Type none_type
Mark Type with all bits unset.
static TimeMarks & marks()
Basic time management class.
double estimate_dt() const
Estimate choice of next time step according to actual setting of constraints.
void view(const char *name="") const
bool time_step_changed_
Flag is set if the time step has been changed (lasts only one time step).
void add(const TimeMark &mark)
double upper_constraint_
Upper constraint for the choice of the next time step.
TimeMark::Type eq_mark_type_
TimeMark type of the equation.
void add_time_marks_grid(double step, TimeMark::Type mark_type=TimeMark::none_type) const
static const double time_step_precision
TimeMark::Type equation_fixed_mark_type() const
int set_lower_constraint(double lower)
Sets lower constraint for the next time step estimating.
TimeMark::Type new_mark_type()
double lower_constraint() const
static Input::Type::Record input_type
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 end_of_fixed_dt_interval_
End of interval if fixed time step.
bool steady_
True if the time governor is used for steady problem.
STREAM & operator<<(STREAM &s, UpdateFlags u)
TimeStep make_next(double new_length) const
double max_time_step_
Permanent upper limit for the time step.
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 safe_compare(double t1, double t0) const
int set_upper_constraint(double upper)
Sets upper constraint for the next time step estimating.
double time() const
Getter for the time of the TimeMark.
Class used for marking specified times at which some events occur.
double fixed_time_step_
Next fixed time step.
static const double inf_time
Infinity time used for steady case.
#define THROW(whole_exception_expr)
Wrapper for throw. Saves the throwing point.
Representation of one time step.
double end_
End time point of the time step.
double min_time_step_
Permanent lower limit for the time step.