57 real(kind=
rp) :: start_time = 0.0_rp
59 integer :: n_fields = 0
65 integer :: output_dim = 0
87 coef, avg_dir, name, path)
89 integer,
intent(in) :: n_fields
90 type(
mean_field_t),
intent(inout),
target :: mean_fields(n_fields)
91 type(
coef_t),
intent(inout) :: coef
92 character(len=*),
intent(in) :: avg_dir
93 character(len=*),
intent(in),
optional :: name
94 character(len=*),
intent(in),
optional :: path
95 real(kind=
rp),
intent(in) :: start_time
96 character(len=1024) :: fname
99 this%start_time = start_time
101 if (trim(avg_dir) .eq.
'none' .or. &
102 trim(avg_dir) .eq.
'x' .or.&
103 trim(avg_dir) .eq.
'y' .or.&
104 trim(avg_dir) .eq.
'z'&
106 if (
present(name) .and.
present(path))
then
107 fname = trim(path) // trim(name) //
'.fld'
108 else if (
present(name))
then
109 fname = trim(name) //
'.fld'
110 else if (
present(path))
then
111 fname = trim(path) //
'user_stats.fld'
113 fname =
'user_stats.fld'
118 if (trim(avg_dir) .eq.
'x' .or.&
119 trim(avg_dir) .eq.
'y' .or.&
120 trim(avg_dir) .eq.
'z' )
then
121 call this%map_2d%init_char(coef, avg_dir, 1e-7_rp)
125 if (
present(name) .and.
present(path))
then
126 fname = trim(path) // trim(name) //
'.csv'
127 else if (
present(name))
then
128 fname = trim(name) //
'.csv'
129 else if (
present(path))
then
130 fname = trim(path) //
'user_stats.csv'
132 fname =
'user_stats.csv'
134 call this%map_1d%init_char(coef, avg_dir, 1e-7_rp)
138 call this%init_base(fname)
139 select type (ft => this%file_%file_type)
141 ft%skip_pressure = .false.
142 ft%skip_velocity = .false.
143 ft%skip_temperature = .false.
146 call this%fields%init(n_fields)
147 this%n_fields = n_fields
148 this%mean_fields => mean_fields
150 this%fields%items(i)%ptr => this%mean_fields(i)%mf
159 call this%free_base()
161 nullify(this%mean_fields)
162 call this%map_1d%free()
163 call this%map_2d%free()
164 call this%fields%free()
171 real(kind=
rp),
intent(in) :: t
176 associate(out_fields => this%fields%items)
177 if (t .ge. this%start_time)
then
179 do i = 1,
size(out_fields)
180 call device_memcpy(out_fields(i)%ptr%x, out_fields(i)%ptr%x_d,&
182 sync = (i .eq.
size(out_fields)))
185 if (this%output_dim .eq. 1)
then
186 call this%map_1d%average_planes(avg_output_1d, &
188 call this%file_%write(avg_output_1d, t)
189 else if (this%output_dim .eq. 2)
then
190 call this%map_2d%average(output_2d, this%fields)
191 call this%file_%write(output_2d, t)
193 call this%file_%write(this%fields, t)
195 do i = 1, this%n_fields
196 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_free(this)
Destructor.
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
Interface for NEKTON fld files.
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.