147 type(
coef_t),
target,
optional :: coef
148 type(
field_t),
target,
intent(in) :: s, u, v, w, p
149 character(*),
intent(in),
optional :: set
150 character(*),
intent(in),
optional :: name
152 character(len=1024) :: unique_name
164 if (
present(set))
then
165 this%stat_set = trim(set)
166 if (this%stat_set .eq.
'basic')
then
170 this%stat_set =
'full'
174 if (
present(name))
then
175 unique_name = name //
"/"
177 unique_name =
"scalar_stats/"
183 call this%s_mean%init(this%s, trim(unique_name) //
"mean_s")
185 call this%us%init(this%s, trim(unique_name) //
'us')
186 call this%vs%init(this%s, trim(unique_name) //
'vs')
187 call this%ws%init(this%s, trim(unique_name) //
'ws')
189 call this%ss%init(this%s, trim(unique_name) //
'ss')
191 if (this%n_stats .eq. 42)
then
193 call this%sss%init(this%s, trim(unique_name) //
'sss')
194 call this%ssss%init(this%s, trim(unique_name) //
'ssss')
196 call this%uss%init(this%s, trim(unique_name) //
'uss')
197 call this%vss%init(this%s, trim(unique_name) //
'vss')
198 call this%wss%init(this%s, trim(unique_name) //
'wss')
199 call this%uus%init(this%s, trim(unique_name) //
'uus')
200 call this%vvs%init(this%s, trim(unique_name) //
'vvs')
201 call this%wws%init(this%s, trim(unique_name) //
'wws')
202 call this%uvs%init(this%s, trim(unique_name) //
'uvs')
203 call this%uws%init(this%s, trim(unique_name) //
'uws')
204 call this%vws%init(this%s, trim(unique_name) //
'vws')
206 call this%ps%init(this%s, trim(unique_name) //
'ps')
208 call this%pdsdx%init(this%s, trim(unique_name) //
'pdsdx')
209 call this%pdsdy%init(this%s, trim(unique_name) //
'pdsdy')
210 call this%pdsdz%init(this%s, trim(unique_name) //
'pdsdz')
212 call this%udsdx%init(this%s, trim(unique_name) //
'udsdx')
213 call this%udsdy%init(this%s, trim(unique_name) //
'udsdy')
214 call this%udsdz%init(this%s, trim(unique_name) //
'udsdz')
215 call this%vdsdx%init(this%s, trim(unique_name) //
'vdsdx')
216 call this%vdsdy%init(this%s, trim(unique_name) //
'vdsdy')
217 call this%vdsdz%init(this%s, trim(unique_name) //
'vdsdz')
218 call this%wdsdx%init(this%s, trim(unique_name) //
'wdsdx')
219 call this%wdsdy%init(this%s, trim(unique_name) //
'wdsdy')
220 call this%wdsdz%init(this%s, trim(unique_name) //
'wdsdz')
221 call this%sdudx%init(this%s, trim(unique_name) //
'sdudx')
222 call this%sdudy%init(this%s, trim(unique_name) //
'sdudy')
223 call this%sdudz%init(this%s, trim(unique_name) //
'sdudz')
224 call this%sdvdx%init(this%s, trim(unique_name) //
'sdvdx')
225 call this%sdvdy%init(this%s, trim(unique_name) //
'sdvdy')
226 call this%sdvdz%init(this%s, trim(unique_name) //
'sdvdz')
227 call this%sdwdx%init(this%s, trim(unique_name) //
'sdwdx')
228 call this%sdwdy%init(this%s, trim(unique_name) //
'sdwdy')
229 call this%sdwdz%init(this%s, trim(unique_name) //
'sdwdz')
231 call this%ess%init(this%s, trim(unique_name) //
'ess')
232 call this%eus%init(this%s, trim(unique_name) //
'eus')
233 call this%evs%init(this%s, trim(unique_name) //
'evs')
234 call this%ews%init(this%s, trim(unique_name) //
'ews')
237 call this%stat_fields%init(this%n_stats)
239 call this%stat_fields%assign_to_field(1, this%s_mean%mf)
241 call this%stat_fields%assign_to_field(2, this%us%mf)
242 call this%stat_fields%assign_to_field(3, this%vs%mf)
243 call this%stat_fields%assign_to_field(4, this%ws%mf)
245 call this%stat_fields%assign_to_field(5, this%ss%mf)
247 if (this%n_stats .eq. 42)
then
248 call this%stat_fields%assign_to_field(6, this%sss%mf)
249 call this%stat_fields%assign_to_field(7, this%ssss%mf)
251 call this%stat_fields%assign_to_field(8, this%uss%mf)
252 call this%stat_fields%assign_to_field(9, this%vss%mf)
253 call this%stat_fields%assign_to_field(10, this%wss%mf)
254 call this%stat_fields%assign_to_field(11, this%uus%mf)
255 call this%stat_fields%assign_to_field(12, this%vvs%mf)
256 call this%stat_fields%assign_to_field(13, this%wws%mf)
257 call this%stat_fields%assign_to_field(14, this%uvs%mf)
258 call this%stat_fields%assign_to_field(15, this%uws%mf)
259 call this%stat_fields%assign_to_field(16, this%vws%mf)
261 call this%stat_fields%assign_to_field(17, this%ps%mf)
263 call this%stat_fields%assign_to_field(18, this%pdsdx%mf)
264 call this%stat_fields%assign_to_field(19, this%pdsdy%mf)
265 call this%stat_fields%assign_to_field(20, this%pdsdz%mf)
267 call this%stat_fields%assign_to_field(21, this%udsdx%mf)
268 call this%stat_fields%assign_to_field(22, this%udsdy%mf)
269 call this%stat_fields%assign_to_field(23, this%udsdz%mf)
270 call this%stat_fields%assign_to_field(24, this%vdsdx%mf)
271 call this%stat_fields%assign_to_field(25, this%vdsdy%mf)
272 call this%stat_fields%assign_to_field(26, this%vdsdz%mf)
273 call this%stat_fields%assign_to_field(27, this%wdsdx%mf)
274 call this%stat_fields%assign_to_field(28, this%wdsdy%mf)
275 call this%stat_fields%assign_to_field(29, this%wdsdz%mf)
277 call this%stat_fields%assign_to_field(30, this%sdudx%mf)
278 call this%stat_fields%assign_to_field(31, this%sdudy%mf)
279 call this%stat_fields%assign_to_field(32, this%sdudz%mf)
280 call this%stat_fields%assign_to_field(33, this%sdvdx%mf)
281 call this%stat_fields%assign_to_field(34, this%sdvdy%mf)
282 call this%stat_fields%assign_to_field(35, this%sdvdz%mf)
283 call this%stat_fields%assign_to_field(36, this%sdwdx%mf)
284 call this%stat_fields%assign_to_field(37, this%sdwdy%mf)
285 call this%stat_fields%assign_to_field(38, this%sdwdz%mf)
287 call this%stat_fields%assign_to_field(39, this%ess%mf)
288 call this%stat_fields%assign_to_field(40, this%eus%mf)
289 call this%stat_fields%assign_to_field(41, this%evs%mf)
290 call this%stat_fields%assign_to_field(42, this%ews%mf)
299 real(kind=
rp),
intent(in) :: k
301 type(
field_t),
pointer :: dsdx, dsdy, dsdz
303 type(
field_t),
pointer :: dx, dy, dz
306 associate(s => this%s, u => this%u, v => this%v, w => this%w, &
309 call this%s_mean%update(k)
311 call this%us%update_col3(k, u, s)
312 call this%vs%update_col3(k, v, s)
313 call this%ws%update_col3(k, w, s)
315 call this%ss%update_col3(k, s, s)
317 if (this%n_stats .eq. 5)
return
323 call this%sss%update_col3(k, work, s)
324 call this%ssss%update_col3(k, work, work)
325 call this%uss%update_col3(k, u, work)
326 call this%vss%update_col3(k, v, work)
327 call this%wss%update_col3(k, w, work)
330 call this%uus%update_col3(k, work, s)
332 call this%vvs%update_col3(k, work, s)
334 call this%wws%update_col3(k, work, s)
336 call this%uvs%update_col3(k, work, s)
338 call this%uws%update_col3(k, work, s)
340 call this%vws%update_col3(k, work, s)
344 call this%ps%update_col3(k, p, s)
359 call opgrad(dsdx%x, dsdy%x, dsdz%x, s%x, this%coef)
361 call this%pdsdx%update_col3(k, dsdx, p)
362 call this%pdsdy%update_col3(k, dsdy, p)
363 call this%pdsdz%update_col3(k, dsdz, p)
365 call this%udsdx%update_col3(k, dsdx, u)
366 call this%udsdy%update_col3(k, dsdy, u)
367 call this%udsdz%update_col3(k, dsdz, u)
368 call this%vdsdx%update_col3(k, dsdx, v)
369 call this%vdsdy%update_col3(k, dsdy, v)
370 call this%vdsdz%update_col3(k, dsdz, v)
371 call this%wdsdx%update_col3(k, dsdx, w)
372 call this%wdsdy%update_col3(k, dsdy, w)
373 call this%wdsdz%update_col3(k, dsdz, w)
375 call this%ess%update_dot3(k, dsdx, dsdy, dsdz, dsdx, dsdy, dsdz)
379 call opgrad(dx%x, dy%x, dz%x, u%x, this%coef)
380 call this%sdudx%update_col3(k, dx, s)
381 call this%sdudy%update_col3(k, dy, s)
382 call this%sdudz%update_col3(k, dz, s)
383 call this%eus%update_dot3(k, dx, dy, dz, dsdx, dsdy, dsdz)
385 call opgrad(dx%x, dy%x, dz%x, v%x, this%coef)
386 call this%sdvdx%update_col3(k, dx, s)
387 call this%sdvdy%update_col3(k, dy, s)
388 call this%sdvdz%update_col3(k, dz, s)
389 call this%evs%update_dot3(k, dx, dy, dz, dsdx, dsdy, dsdz)
391 call opgrad(dx%x, dy%x, dz%x, w%x, this%coef)
392 call this%sdwdx%update_col3(k, dx, s)
393 call this%sdwdy%update_col3(k, dy, s)
394 call this%sdwdz%update_col3(k, dz, s)
395 call this%ews%update_dot3(k, dx, dy, dz, dsdx, dsdy, dsdz)
538 real(kind=rp) :: wrk, wrk_sqr
539 type(field_t),
pointer :: work
542 if (this%n_stats .eq. 5)
return
544 n =
size(this%coef%B)
546 if (neko_bcknd_device .eq. 1)
then
547 call neko_scratch_registry%request_field(work, idx, &
549 call device_cfill(work%x_d, 1.0_rp, n)
550 call device_invcol2(work%x_d, this%coef%B_d, n)
552 call device_col2(this%pdsdx%mf%x_d, work%x_d, n)
553 call device_col2(this%pdsdy%mf%x_d, work%x_d, n)
554 call device_col2(this%pdsdz%mf%x_d, work%x_d, n)
556 call device_col2(this%udsdx%mf%x_d, work%x_d, n)
557 call device_col2(this%udsdy%mf%x_d, work%x_d, n)
558 call device_col2(this%udsdz%mf%x_d, work%x_d, n)
559 call device_col2(this%vdsdx%mf%x_d, work%x_d, n)
560 call device_col2(this%vdsdy%mf%x_d, work%x_d, n)
561 call device_col2(this%vdsdz%mf%x_d, work%x_d, n)
562 call device_col2(this%wdsdx%mf%x_d, work%x_d, n)
563 call device_col2(this%wdsdy%mf%x_d, work%x_d, n)
564 call device_col2(this%wdsdz%mf%x_d, work%x_d, n)
566 call device_col2(this%sdudx%mf%x_d, work%x_d, n)
567 call device_col2(this%sdudy%mf%x_d, work%x_d, n)
568 call device_col2(this%sdudz%mf%x_d, work%x_d, n)
569 call device_col2(this%sdvdx%mf%x_d, work%x_d, n)
570 call device_col2(this%sdvdy%mf%x_d, work%x_d, n)
571 call device_col2(this%sdvdz%mf%x_d, work%x_d, n)
572 call device_col2(this%sdwdx%mf%x_d, work%x_d, n)
573 call device_col2(this%sdwdy%mf%x_d, work%x_d, n)
574 call device_col2(this%sdwdz%mf%x_d, work%x_d, n)
576 call device_col2(work%x_d, work%x_d, n)
578 call device_col2(this%ess%mf%x_d, work%x_d, n)
579 call device_col2(this%eus%mf%x_d, work%x_d, n)
580 call device_col2(this%evs%mf%x_d, work%x_d, n)
581 call device_col2(this%ews%mf%x_d, work%x_d, n)
582 call neko_scratch_registry%relinquish_field(idx)
587 wrk = 1.0_rp / this%coef%B(i,1,1,1)
588 this%pdsdx%mf%x(i,1,1,1) = this%pdsdx%mf%x(i,1,1,1) * wrk
589 this%pdsdy%mf%x(i,1,1,1) = this%pdsdy%mf%x(i,1,1,1) * wrk
590 this%pdsdz%mf%x(i,1,1,1) = this%pdsdz%mf%x(i,1,1,1) * wrk
592 this%udsdx%mf%x(i,1,1,1) = this%udsdx%mf%x(i,1,1,1) * wrk
593 this%udsdy%mf%x(i,1,1,1) = this%udsdy%mf%x(i,1,1,1) * wrk
594 this%udsdz%mf%x(i,1,1,1) = this%udsdz%mf%x(i,1,1,1) * wrk
596 this%vdsdx%mf%x(i,1,1,1) = this%vdsdx%mf%x(i,1,1,1) * wrk
597 this%vdsdy%mf%x(i,1,1,1) = this%vdsdy%mf%x(i,1,1,1) * wrk
598 this%vdsdz%mf%x(i,1,1,1) = this%vdsdz%mf%x(i,1,1,1) * wrk
600 this%wdsdx%mf%x(i,1,1,1) = this%wdsdx%mf%x(i,1,1,1) * wrk
601 this%wdsdy%mf%x(i,1,1,1) = this%wdsdy%mf%x(i,1,1,1) * wrk
602 this%wdsdz%mf%x(i,1,1,1) = this%wdsdz%mf%x(i,1,1,1) * wrk
604 this%sdudx%mf%x(i,1,1,1) = this%sdudx%mf%x(i,1,1,1) * wrk
605 this%sdudy%mf%x(i,1,1,1) = this%sdudy%mf%x(i,1,1,1) * wrk
606 this%sdudz%mf%x(i,1,1,1) = this%sdudz%mf%x(i,1,1,1) * wrk
608 this%sdvdx%mf%x(i,1,1,1) = this%sdvdx%mf%x(i,1,1,1) * wrk
609 this%sdvdy%mf%x(i,1,1,1) = this%sdvdy%mf%x(i,1,1,1) * wrk
610 this%sdvdz%mf%x(i,1,1,1) = this%sdvdz%mf%x(i,1,1,1) * wrk
612 this%sdwdx%mf%x(i,1,1,1) = this%sdwdx%mf%x(i,1,1,1) * wrk
613 this%sdwdy%mf%x(i,1,1,1) = this%sdwdy%mf%x(i,1,1,1) * wrk
614 this%sdwdz%mf%x(i,1,1,1) = this%sdwdz%mf%x(i,1,1,1) * wrk
618 this%ess%mf%x(i,1,1,1) = this%ess%mf%x(i,1,1,1) * wrk_sqr
619 this%eus%mf%x(i,1,1,1) = this%eus%mf%x(i,1,1,1) * wrk_sqr
620 this%evs%mf%x(i,1,1,1) = this%evs%mf%x(i,1,1,1) * wrk_sqr
621 this%ews%mf%x(i,1,1,1) = this%ews%mf%x(i,1,1,1) * wrk_sqr