61 integer :: output_dim = 0
80 avg_direction, filename)
82 character(len=*),
intent(in) :: fields(:)
83 type(
coef_t),
target,
intent(inout) :: coef
84 character(len=*),
intent(in) :: avg_direction
85 character(len=*),
intent(in) :: filename
86 character(len=NEKO_FNAME_LEN) :: output_filename
90 output_filename = trim(filename)
92 call this%fields%init(
size(fields))
93 do i = 1,
size(fields)
94 call this%fields%assign(i,
neko_registry%get_field(trim(fields(i))))
97 select case (trim(avg_direction))
100 output_filename = trim(output_filename) //
'.fld'
101 call this%map_2d%init_char(coef, avg_direction, 1e-7_rp)
102 case (
'xy',
'xz',
'yz')
104 output_filename = trim(output_filename) //
'.csv'
105 call this%map_1d%init_char(coef, avg_direction, 1e-7_rp)
107 call neko_error(
'Unsupported avg_direction for spatial_average: ' // &
111 call this%init_base(output_filename)
118 call this%free_base()
119 call this%fields%free()
120 call this%map_1d%free()
121 call this%map_2d%free()
130 real(kind=
rp),
intent(in) :: t
134 type(
field_t),
pointer :: temp_field
135 integer,
allocatable :: temp_indices(:)
138 select case (this%output_dim)
141 call this%map_1d%average_planes(output_1d, this%fields)
142 call this%file_%write(output_1d, t)
143 call output_1d%free()
146 allocate(temp_indices(this%fields%size()))
147 call temp_fields%init(this%fields%size())
148 do i = 1, this%fields%size()
150 temp_indices(i), .false.)
151 call field_copy(temp_field, this%fields%items(i)%ptr)
152 call temp_fields%assign(i, temp_field)
155 call this%map_2d%average(output_2d, temp_fields)
156 call this%file_%write(output_2d, t)
157 call output_2d%free()
158 call temp_fields%free()
160 deallocate(temp_indices)
162 call neko_error(
'Invalid spatial_average output dimension')
Device abstraction, common interface for various accelerators.
integer, parameter, public device_to_host
subroutine, public field_copy(a, b, n)
Copy a vector .
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.
integer, parameter, public rp
Global precision used in computations.
Defines a registry for storing solution fields.
type(registry_t), target, public neko_registry
Global field registry.
Defines a registry for storing and requesting temporary objects This can be used when you have a func...
type(scratch_registry_t), target, public neko_scratch_registry
Global scratch registry.
Output for spatially averaged fields.
subroutine spatial_average_output_free(this)
Destructor.
subroutine spatial_average_output_init(this, fields, coef, avg_direction, filename)
Constructor.
subroutine spatial_average_output_sample(this, t)
Sample the current fields, spatially average, and write.
integer, parameter, public neko_fname_len
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
Map every GLL point in the mesh to a level in one physical direction. Can be used to average across t...
Abstract type defining an output type.
Output for spatially averaged fields.