Contains the time_based_controller_t type.
|
| type | time_based_controller_t |
| | A utility type for determining whether an action should be executed based on the current time value. Used to e.g. control whether we should write a file or execute a simcomp. More...
|
| |
|
| subroutine | time_based_controller_init (this, start_time, end_time, control_mode, control_value, write_at_start, anchor_time, direction) |
| | Constructor.
|
| |
| subroutine | time_based_controller_free (this) |
| | Destructor.
|
| |
| logical function | time_based_controller_check (this, time, force) |
| | Check if the execution should be performed.
|
| |
| pure integer function | next_index_after (this, time) |
| | The number of scheduled times at or before the given time, counted from first_index. Assigning it to next_index after an execution makes the next scheduled time the first one after the given time.
|
| |
| subroutine | time_based_controller_register_execution (this, time) |
| | Increment nexecutions and advance next_index past the current time.
|
| |
| subroutine | time_based_controller_set_counter (this, time) |
| | Set next_index to the first scheduled time not yet reached, and nexecutions to the number of executions performed up to the current time. Called when restarting a simulation.
|
| |
| pure real(kind=dp) function | time_based_controller_tolerance (this, dt) |
| | The tolerance used when comparing the simulation time to a scheduled execution time.
|
| |
| pure real(kind=dp) function | time_based_controller_next_time (this) |
| | The time of the next scheduled execution.
|
| |
|
| real(kind=dp), parameter, public | time_tol = 0.1_dp |
| | Tolerance for comparing the simulation time to a scheduled time, as a fraction of the time step. A scheduled time t_k is considered reached at the first step with t >= t_k - TIME_TOL * dt, so that round-off in the accumulation of t does not postpone the execution by a full step. The tolerance is limited to the same fraction of the output interval, so that a time step longer than the interval (in particular the dt = 1 placeholder a variable time step run starts from) cannot make a scheduled time count as reached before the previous one has passed.
|
| |
| real(kind=dp), parameter, public | span_tol = 1.0e-9_dp |
| | Relative tolerance for round-off in k * time_interval when comparing a scheduled time to start_time and end_time.
|
| |
◆ next_index_after()
- Note
- Scheduled times passed within a single step are all counted, so a time step larger than the output interval gives one execution per step and not one per passed scheduled time.
Definition at line 373 of file time_based_controller.f90.
◆ time_based_controller_check()
- Parameters
-
| time | The current time state. |
| force | Whether to execute irrespective of the schedule. Optional, defaults to .false.. |
The result is .true. at the first time step at which the next scheduled time has been reached, within a tolerance of TIME_TOL * dt. A forced execution is performed unless the time is before start_time, or an execution has already been registered for the current time step. The latter keeps the forced execution at the end of a simulation from repeating a scheduled one at the same step. Forcing does override a never control, which is how output_at_end writes an output that is otherwise never written.
Definition at line 314 of file time_based_controller.f90.
◆ time_based_controller_free()
◆ time_based_controller_init()
| subroutine time_based_controller::time_based_controller_init |
( |
class(time_based_controller_t), intent(inout) |
this, |
|
|
real(kind=dp), intent(in) |
start_time, |
|
|
real(kind=dp), intent(in) |
end_time, |
|
|
character(len=*), intent(in) |
control_mode, |
|
|
real(kind=dp), intent(in) |
control_value, |
|
|
logical, intent(in), optional |
write_at_start, |
|
|
real(kind=dp), intent(in), optional |
anchor_time, |
|
|
real(kind=dp), intent(in), optional |
direction |
|
) |
| |
- Parameters
-
| start_time | The first time at which an execution can be performed. |
| end_time | The final simulation time. |
| control_mode | The way to interpret the control_value parameter. |
| control_value | The value defining the execution frequency. |
| write_at_start | Whether an execution is performed at start_time, whether or not it is one of the scheduled times. Optional, defaults to .true.. |
| anchor_time | The time the scheduled times are counted from. Optional, defaults to zero for simulationtime and to start_time for nsamples. |
| direction | Sign of the time step of the simulation, +1 or -1. Optional, defaults to the sign of end_time - start_time. That default is wrong for an output whose start_time lies beyond the end of the simulation, so pass the direction for an output with its own start time. |
Definition at line 172 of file time_based_controller.f90.
◆ time_based_controller_next_time()
- Note
- Meaningless for the
tsteps and never control modes, for which the end time of the simulation is returned.
Definition at line 493 of file time_based_controller.f90.
◆ time_based_controller_register_execution()
◆ time_based_controller_set_counter()
- Parameters
-
The comparison is the same as in check, so that exactly the executions performed by the run that wrote the checkpoint are counted as done, and none is repeated or skipped.
Definition at line 419 of file time_based_controller.f90.
◆ time_based_controller_tolerance()
◆ span_tol
◆ time_tol