57 real(kind=
dp) :: start_time = 0.0_dp
59 integer :: n_fields = 0
65 integer :: output_dim = 0
74 procedure, pass(this) :: configure_file => &
90 coef, avg_dir, name, path)
92 integer,
intent(in) :: n_fields
93 type(
mean_field_t),
intent(inout),
target :: mean_fields(n_fields)
94 type(
coef_t),
intent(inout) :: coef
95 character(len=*),
intent(in) :: avg_dir
96 character(len=*),
intent(in),
optional :: name
97 character(len=*),
intent(in),
optional :: path
98 real(kind=
dp),
intent(in) :: start_time
99 character(len=1024) :: fname
102 this%start_time = start_time
104 if (trim(avg_dir) .eq.
'none' .or. &
105 trim(avg_dir) .eq.
'x' .or.&
106 trim(avg_dir) .eq.
'y' .or.&
107 trim(avg_dir) .eq.
'z'&
109 if (
present(name) .and.
present(path))
then
110 fname = trim(path) // trim(name) //
'.fld'
111 else if (
present(name))
then
112 fname = trim(name) //
'.fld'
113 else if (
present(path))
then
114 fname = trim(path) //
'user_stats.fld'
116 fname =
'user_stats.fld'
121 if (trim(avg_dir) .eq.
'x' .or.&
122 trim(avg_dir) .eq.
'y' .or.&
123 trim(avg_dir) .eq.
'z' )
then
124 call this%map_2d%init_char(coef, avg_dir, 1e-7_rp)
128 if (
present(name) .and.
present(path))
then
129 fname = trim(path) // trim(name) //
'.csv'
130 else if (
present(name))
then
131 fname = trim(name) //
'.csv'
132 else if (
present(path))
then
133 fname = trim(path) //
'user_stats.csv'
135 fname =
'user_stats.csv'
137 call this%map_1d%init_char(coef, avg_dir, 1e-7_rp)
141 call this%init_base(fname)
142 call this%fields%init(n_fields)
143 this%n_fields = n_fields
144 this%mean_fields => mean_fields
146 this%fields%items(i)%ptr => this%mean_fields(i)%mf
155 call this%free_base()
157 nullify(this%mean_fields)
158 call this%map_1d%free()
159 call this%map_2d%free()
160 call this%fields%free()
167 real(kind=
dp),
intent(in) :: t
172 associate(out_fields => this%fields%items)
173 if (t .ge. this%start_time)
then
175 do i = 1,
size(out_fields)
176 call device_memcpy(out_fields(i)%ptr%x, out_fields(i)%ptr%x_d,&
178 sync = (i .eq.
size(out_fields)))
181 if (this%output_dim .eq. 1)
then
182 call this%map_1d%average_planes(avg_output_1d, &
184 call this%file_%write(avg_output_1d, t)
185 call avg_output_1d%free()
186 else if (this%output_dim .eq. 2)
then
187 call this%map_2d%average(output_2d, this%fields)
188 call this%file_%write(output_2d, t)
189 call output_2d%free()
191 call this%file_%write(this%fields, t)
193 do i = 1, this%n_fields
194 call this%mean_fields(i)%reset()
206 select type (ft => this%file_%file_type)
208 ft%skip_pressure = .false.
209 ft%skip_velocity = .false.
210 ft%skip_temperature = .false.
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_configure_file(this)
Puts the leading fields in the UVW, P and T slots rather than the scalar block.
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 dp
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.
Map every GLL point in the mesh to a level in one physical direction. Can be used to average across t...
Computes the temporal mean of a field.
Output for a list of mean fields.
Abstract type defining an output type.