37 use json_module,
only : json_file
68 real(kind=
rp) :: start_time
74 procedure, pass(this) :: init_from_attributes => &
93 type(json_file),
intent(inout) :: json
94 class(
case_t),
intent(inout),
target :: case
95 character(len=:),
allocatable :: filename
96 character(len=:),
allocatable :: precision
97 character(len=20),
allocatable :: fields(:)
98 character(len=:),
allocatable :: hom_dir
99 character(len=:),
allocatable :: stat_set
100 real(kind=
rp) :: start_time
101 type(
field_t),
pointer :: u, v, w, p
102 type(
coef_t),
pointer :: coef
104 call this%init_base(json,
case)
116 coef =>
case%fluid%c_Xh
118 start_time, hom_dir, stat_set)
131 start_time, hom_dir, stat_set)
133 character(len=*),
intent(in) :: hom_dir
134 character(len=*),
intent(in) :: stat_set
135 real(kind=
rp),
intent(in) :: start_time
136 type(
field_t),
intent(inout) :: u, v, w, p
137 type(
coef_t),
intent(in) :: coef
138 character(len=LOG_SIZE) :: log_buf
139 character(len=NEKO_FNAME_LEN) :: fname
140 character(len=5) :: prefix
142 call neko_log%section(
'Fluid stats')
143 write(log_buf,
'(A,E15.7)')
'Start time: ', start_time
145 write(log_buf,
'(A,A)')
'Set of statistics: ', trim(stat_set)
147 write(log_buf,
'(A,A)')
'Averaging in direction: ', trim(hom_dir)
151 call this%stats%init(coef, u, v, w, p, stat_set)
153 this%start_time = start_time
154 this%time = start_time
155 fname =
"fluid_stats0"
156 call this%stats_output%init(this%stats, this%start_time, &
157 hom_dir = hom_dir,name = fname,path = this%case%output_directory)
159 call this%case%output_controller%add(this%stats_output, &
160 this%output_controller%control_value, &
161 this%output_controller%control_mode)
170 call this%free_base()
171 call this%stats%free()
176 real(kind=
rp),
intent(in) :: t
177 character(len=NEKO_FNAME_LEN) :: fname
178 character(len=5) :: prefix,suffix
179 integer :: last_slash_pos
180 if (t .gt. this%time) this%time = t
182 write (prefix,
'(I5)') this%stats_output%file_%get_counter()
185 if (last_slash_pos .ne. 0)
then
186 fname = trim(this%stats_output%file_%file_type%fname(1:last_slash_pos))// &
187 "fluid_stats"//trim(adjustl(prefix))//
"."//suffix
189 fname =
"fluid_stats"// &
190 trim(adjustl(prefix))//
"."//suffix
192 call this%stats_output%init_base(fname)
200 real(kind=
rp),
intent(in) :: t
201 integer,
intent(in) :: tstep
202 real(kind=
rp) :: delta_t
203 real(kind=
rp) :: sample_start_time, sample_time
204 character(len=LOG_SIZE) :: log_buf
207 if (t .ge. this%start_time)
then
208 delta_t = t - this%time
212 sample_start_time = mpi_wtime()
214 call this%stats%update(delta_t)
218 sample_time = mpi_wtime() - sample_start_time
220 call neko_log%section(
'Fluid stats')
221 write(log_buf,
'(A,E15.7)')
'Sampling at time:', t
223 write(log_buf,
'(A33,E15.7)')
'Simulationtime since last sample:', &
226 write(log_buf,
'(A,E15.7)')
'Sampling time (s):', sample_time
Retrieves a parameter by name or assigns a provided default value. In the latter case also adds the m...
Retrieves a parameter by name or throws an error.
Defines a simulation case.
type(mpi_comm) neko_comm
MPI communicator.
Defines a registry for storing solution fields.
type(field_registry_t), target, public neko_field_registry
Global field registry.
Implements fluid_stats_ouput_t.
Implements the fluid_stats_simcomp_t type.
subroutine fluid_stats_simcomp_compute(this, t, tstep)
fluid_stats, called depending on compute_control and compute_value
subroutine fluid_stats_simcomp_free(this)
Destructor.
subroutine fluid_stats_simcomp_init_from_json(this, json, case)
Constructor from json.
subroutine fluid_stats_simcomp_init_from_attributes(this, u, v, w, p, coef, start_time, hom_dir, stat_set)
Actual constructor.
subroutine fluid_stats_simcomp_restart(this, t)
Computes various statistics for the fluid fields. We use the Reynolds decomposition for a field u = ...
Utilities for retrieving parameters from the case files.
type(log_t), public neko_log
Global log stream.
integer, parameter, public log_size
integer, parameter, public dp
integer, parameter, public sp
integer, parameter, public rp
Global precision used in computations.
Simulation components are objects that encapsulate functionality that can be fit to a particular comp...
subroutine compute_(this, t, tstep)
Dummy compute function.
subroutine restart_(this, t)
Dummy restart function.
Defines a container for all statistics.
integer, parameter, public neko_fname_len
subroutine, public filename_suffix(fname, suffix)
Extract a filename's suffix.
pure integer function, public filename_tslash_pos(fname)
Find position (in the string) of a filename's trailing slash.
Coefficients defined on a given (mesh, ) tuple. Arrays use indices (i,j,k,e): element e,...
Defines an output for the fluid statistics computed using the fluid_stats_t object.
A simulation component that computes the velocity and pressure statistics up to 4th order....
Base abstract class for simulation components.