38 use mpi_f08,
only : mpi_barrier, mpi_wtime
53 real(kind=
rp) :: t_begin
54 real(kind=
rp) :: t_diff
55 integer :: samp_interval
66 subroutine stats_init(this, T_begin, samp_interval, size)
67 class(
stats_t),
intent(inout) :: this
68 real(kind=
rp),
intent(in) :: t_begin
69 integer,
intent(in) :: samp_interval
70 integer,
intent(inout),
optional ::size
75 if (
present(size))
then
81 allocate(this%quant_list(n))
84 this%quant_list(i)%quantp => null()
89 this%T_begin = t_begin
90 this%samp_interval = samp_interval
97 class(
stats_t),
intent(inout) :: this
99 if (
allocated(this%quant_list))
then
100 deallocate(this%quant_list)
109 class(
stats_t),
intent(inout) :: this
111 type(
quantp_t),
allocatable :: tmp(:)
113 if (this%n .ge. this%size)
then
114 allocate(tmp(this%size * 2))
115 tmp(1:this%size) = this%quant_list
116 call move_alloc(tmp, this%quant_list)
117 this%size = this%size * 2
121 this%quant_list(this%n)%quantp => quant
126 class(
stats_t),
intent(inout) :: this
127 real(kind=
rp),
intent(in) :: t
128 real(kind=
rp),
intent(in) :: dt
129 integer,
intent(in) :: tstep
131 character(len=LOG_SIZE) :: log_buf
132 real(kind=
rp) :: sample_start_time, sample_end_time
133 real(kind=
dp) :: sample_time
135 if (t .ge. this%T_begin .and. this%n .gt. 0)
then
136 this%t_diff = this%t_diff + dt
140 if (mod(tstep,this%samp_interval) .eq. 0)
then
143 sample_start_time = mpi_wtime()
145 call this%quant_list(i)%quantp%update(this%t_diff)
149 sample_end_time = mpi_wtime()
150 sample_time = sample_end_time - sample_start_time
151 write(log_buf,
'(A17,1x,F10.6,A,F9.6)')
'Sampling at time:', t, &
152 ' Sampling time (s): ', sample_time
type(mpi_comm), public neko_comm
MPI communicator.
type(log_t), public neko_log
Global log stream.
integer, parameter, public log_size
integer, parameter, public dp
integer, parameter, public rp
Global precision used in computations.
Defines a statistical quantity.
Defines a container for all statistics.
subroutine stats_eval(this, t, dt, tstep)
Evaluated all statistical quantities.
subroutine stats_free(this)
Deallocate.
subroutine stats_init(this, t_begin, samp_interval, size)
Initialize statistics, computed after T_begin.
subroutine stats_add(this, quant)
Add a statistic quantitiy quant to the backend.
Pointer to an arbitrary quantitiy.
Abstract type defining a statistical quantity.