38 use json_module,
only : json_file
46 real(kind=
rp),
dimension(10) :: tlag = 0.0_rp
47 real(kind=
rp),
dimension(10) :: dtlag = 0.0_rp
48 real(kind=
rp) :: t = 0.0_rp
49 real(kind=
rp) :: dt = 0.0_rp
50 real(kind=
rp) :: start_time = 0.0_rp
51 real(kind=
rp) :: end_time = 0.0_rp
55 generic :: init => init_from_components, init_from_json
56 procedure, pass(this) :: init_from_components => &
70 type(json_file),
intent(inout) :: params
72 real(kind=
rp) :: time_step
73 real(kind=
rp) :: start_time
74 real(kind=
rp) :: end_time
75 logical :: is_variable
80 if (.not. is_variable)
then
87 call this%init_from_components(start_time, end_time, time_step)
94 real(kind=
rp),
intent(in) :: start_time
95 real(kind=
rp),
intent(in) :: end_time
96 real(kind=
rp),
intent(in) :: dt
98 if (dt .gt. 0.0_rp .and. start_time .gt. end_time .or. &
99 dt .lt. 0.0_rp .and. start_time .lt. end_time)
then
100 call neko_log%error(
'Time step size must match direction of time.')
103 this%start_time = start_time
104 this%end_time = end_time
109 this%tlag = start_time
118 this%t = this%start_time
120 this%tlag = this%start_time
128 type(
chkp_t),
intent(in) :: chkp
131 this%dtlag = chkp%dtlag
132 this%tlag = chkp%tlag
138 character(len=LOG_SIZE) :: log_buf
139 character(len=38) :: log_fmt
140 real(kind=
rp) :: t_prog
142 t_prog = 100.0_rp * (this%t - this%start_time) / &
143 (this%end_time - this%start_time)
145 write(log_fmt,
'(A,I2,A)') &
146 '(A7,1X,I10,1X,A4,E15.7,',
log_size - 50,
'X,A2,F6.2,A3)'
147 write(log_buf, log_fmt)
'Step = ', this%tstep,
't = ', this%t, &
161 is_done = this%t - this%start_time .ge. this%end_time - this%start_time &
162 .and. this%tstep .gt. 0
Retrieves a parameter by name or assigns a provided default value. In the latter case also adds the m...
Utilities for retrieving parameters from the case files.
integer, parameter, public neko_log_quiet
Always logged.
type(log_t), public neko_log
Global log stream.
integer, parameter, public log_size
integer, parameter, public rp
Global precision used in computations.
Module with things related to the simulation time.
subroutine time_state_restart(this, chkp)
Restart time state.
subroutine time_state_status(this)
Write status banner.
subroutine time_state_init_from_json(this, params)
Initialize time state from JSON.
pure logical function time_state_is_done(this)
Check if the simulation is done.
subroutine time_state_init_from_components(this, start_time, end_time, dt)
Initialize time state.
subroutine time_state_reset(this)
Reset time state.
A struct that contains all info about the time, expand as needed.