50 real(kind=
rp) :: frequency = 0
52 real(kind=
rp) :: time_interval = 0
56 real(kind=
rp) :: end_time = 0
58 integer :: nexecutions = 0
60 logical :: never = .false.
63 character(len=:),
allocatable :: control_mode
65 real(kind=
rp) :: control_value
73 procedure, pass(this) :: register_execution => &
76 procedure, pass(this) :: set_counter => &
81 interface assignment(=)
81 interface assignment(=)
…
83 end interface assignment(=)
94 real(kind=
rp),
intent(in) :: end_time
95 character(len=*),
intent(in) :: control_mode
96 real(kind=
rp),
intent(in) :: control_value
98 this%end_time = end_time
99 this%control_mode = control_mode
100 this%control_value = control_value
102 if (trim(control_mode) .eq.
'simulationtime')
then
103 this%time_interval = control_value
104 this%frequency = 1/this%time_interval
106 else if (trim(control_mode) .eq.
'nsamples')
then
107 if (control_value .le. 0)
then
111 this%frequency = control_value / end_time
112 this%time_interval = 1.0_rp / this%frequency
114 else if (trim(control_mode) .eq.
'tsteps')
then
115 this%nsteps = control_value
118 this%time_interval = 0
119 else if (trim(control_mode) .eq.
'never')
then
122 call neko_error(
"The control parameter must be simulationtime, nsamples&
123 & tsteps, or never, but received "//trim(control_mode))
139 logical,
intent(in),
optional :: force
151 if (
present(force))
then
160 else if (this%never)
then
162 else if ( (this%nsteps .eq. 0) .and. &
163 (t .ge. this%nexecutions * this%time_interval - 0.1 * dt) )
then
165 else if (this%nsteps .gt. 0)
then
166 if (mod(tstep, this%nsteps) .eq. 0)
then
179 ctrl1%end_time = ctrl2%end_time
180 ctrl1%frequency = ctrl2%frequency
181 ctrl1%nsteps = ctrl2%nsteps
182 ctrl1%time_interval = ctrl2%time_interval
183 ctrl1%nexecutions = ctrl2%nexecutions
191 this%nexecutions = this%nexecutions + 1
201 if (this%nsteps .eq. 0)
then
202 this%nexecutions = int((time%t+0.1_rp*time%dt) / this%time_interval) + 1
integer, parameter, public rp
Global precision used in computations.
Contains the time_based_controller_t type.
subroutine time_based_controller_set_counter(this, time)
Set the counter based on a time (for restarts)
subroutine time_based_controller_init(this, end_time, control_mode, control_value)
Constructor.
subroutine time_based_controller_assignment(ctrl1, ctrl2)
Assignment operator. Simply copies attribute values.
logical function time_based_controller_check(this, time, force)
Check if the execution should be performed.
subroutine time_based_controller_register_execution(this)
Increment nexectutions.
Module with things related to the simulation time.
A utility type for determining whether an action should be executed based on the current time value....
A struct that contains all info about the time, expand as needed.