37 use json_module,
only : json_file
45 real(kind=
rp),
dimension(10) :: tlag = 0.0_rp
46 real(kind=
rp),
dimension(10) :: dtlag = 0.0_rp
47 real(kind=
rp) :: t = 0.0_rp
48 real(kind=
rp) :: dt = 0.0_rp
49 real(kind=
rp) :: start_time = 0.0_rp
50 real(kind=
rp) :: end_time = 0.0_rp
54 generic :: init => init_from_components, init_from_json
55 procedure, pass(this) :: init_from_components => &
68 type(json_file),
intent(inout) :: params
70 real(kind=
rp) :: time_step
71 real(kind=
rp) :: start_time
72 real(kind=
rp) :: end_time
73 logical :: is_variable
78 if (.not. is_variable)
then
85 call this%init_from_components(start_time, end_time, time_step)
92 real(kind=
rp),
intent(in) :: start_time
93 real(kind=
rp),
intent(in) :: end_time
94 real(kind=
rp),
intent(in) :: dt
96 if (dt .gt. 0.0_rp .and. start_time .gt. end_time .or. &
97 dt .lt. 0.0_rp .and. start_time .lt. end_time)
then
98 call neko_log%error(
'Time step size must match direction of time.')
101 this%start_time = start_time
102 this%end_time = end_time
107 this%tlag = start_time
116 this%t = this%start_time
118 this%tlag = this%start_time
126 character(len=LOG_SIZE) :: log_buf
127 character(len=64) :: log_fmt
128 real(kind=
rp) :: t_prog
129 integer :: time_digits, time_width, pad_width
131 t_prog = 100.0_rp * (this%t - this%start_time) / &
132 (this%end_time - this%start_time)
134 time_digits = precision(this%t)
135 time_width = time_digits + 8
136 pad_width =
max(1,
log_size - (34 + time_width) - 1)
138 write(log_fmt,
'(A,I0,A,I0,A,I0,A,I0,A)') &
139 '(A7,1X,I10,1X,A4,ES', time_width,
'.', time_digits,
',', &
140 pad_width,
'X,A2,F6.2,A3)'
141 write(log_buf, log_fmt)
'Step = ', this%tstep,
't = ', this%t, &
155 is_done = this%t - this%start_time .ge. this%end_time - this%start_time &
156 .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_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.