56 real(kind=
rp) :: start_time = 0.0_rp
58 integer :: n_fields = 0
64 integer :: output_dim = 0
84 coef, avg_dir, name, path)
86 integer,
intent(in) :: n_fields
87 type(
mean_field_t),
intent(inout),
target :: mean_fields(n_fields)
88 type(
coef_t),
intent(inout) :: coef
89 character(len=*),
intent(in) :: avg_dir
90 character(len=*),
intent(in),
optional :: name
91 character(len=*),
intent(in),
optional :: path
92 real(kind=
rp),
intent(in) :: start_time
93 character(len=1024) :: fname
96 this%start_time = start_time
98 if (trim(avg_dir) .eq.
'none' .or. &
99 trim(avg_dir) .eq.
'x' .or.&
100 trim(avg_dir) .eq.
'y' .or.&
101 trim(avg_dir) .eq.
'z'&
103 if (
present(name) .and.
present(path))
then
104 fname = trim(path) // trim(name) //
'.fld'
105 else if (
present(name))
then
106 fname = trim(name) //
'.fld'
107 else if (
present(path))
then
108 fname = trim(path) //
'user_stats.fld'
110 fname =
'user_stats.fld'
115 if (trim(avg_dir) .eq.
'x' .or.&
116 trim(avg_dir) .eq.
'y' .or.&
117 trim(avg_dir) .eq.
'z' )
then
118 call this%map_2d%init_char(coef, avg_dir, 1e-7_rp)
122 if (
present(name) .and.
present(path))
then
123 fname = trim(path) // trim(name) //
'.csv'
124 else if (
present(name))
then
125 fname = trim(name) //
'.csv'
126 else if (
present(path))
then
127 fname = trim(path) //
'user_stats.csv'
129 fname =
'user_stats.csv'
131 call this%map_1d%init_char(coef, avg_dir, 1e-7_rp)
135 call this%init_base(fname)
137 call this%fields%init(n_fields)
138 this%n_fields = n_fields
139 this%mean_fields => mean_fields
141 this%fields%items(i)%ptr => this%mean_fields(i)%mf
149 real(kind=
rp),
intent(in) :: t
153 real(kind=
rp) :: u, v, w, p
155 associate(out_fields => this%fields%items)
156 if (t .ge. this%start_time)
then
158 do i = 1,
size(out_fields)
159 call device_memcpy(out_fields(i)%ptr%x, out_fields(i)%ptr%x_d,&
161 sync = (i .eq.
size(out_fields)))
164 if (this%output_dim .eq. 1)
then
165 call this%map_1d%average_planes(avg_output_1d, &
167 call this%file_%write(avg_output_1d, t)
168 else if (this%output_dim .eq. 2)
then
169 call this%map_2d%average(output_2d, this%fields)
170 call this%file_%write(output_2d, t)
172 call this%file_%write(this%fields, t)
174 do i = 1, this%n_fields
175 call this%mean_fields(i)%reset()
Copy data between host and device (or device and device)
Device abstraction, common interface for various accelerators.
integer, parameter, public device_to_host
Simple module to handle fld file series. Provides an interface to the different fields sotred in a fl...
Creates a 1d GLL point map along a specified direction based on the connectivity in the mesh.
Maps a 3D dofmap to a 2D spectral element grid.
Defines an output for a list of mean fields.
subroutine mean_field_output_init(this, mean_fields, n_fields, start_time, coef, avg_dir, name, path)
Constructor.
subroutine mean_field_output_sample(this, t)
Sample the mean solution at time t and reset.
integer, parameter neko_bcknd_device
integer, parameter, public rp
Global precision used in computations.
Coefficients defined on a given (mesh, ) tuple. Arrays use indices (i,j,k,e): element e,...
field_list_t, To be able to group fields together
Type that encapsulates a mapping from each gll point in the mesh to its corresponding (global) GLL po...
Computes the temporal mean of a field.
Output for a list of mean fields.
Abstract type defining an output type.