86 subroutine import_fields(fname, mesh_fname, u, v, w, p, t, s_target_list, &
87 s_index_list, interpolate, tolerance)
88 character(len=*),
intent(in) :: fname
89 character(len=*),
intent(in),
optional :: mesh_fname
90 type(
field_t),
pointer,
intent(inout),
optional :: u,v,w,p,t
91 type(
field_list_t),
intent(inout),
optional :: s_target_list
92 integer,
intent(in),
optional :: s_index_list(:)
93 logical,
intent(in),
optional :: interpolate
94 real(kind=
rp),
intent(in),
optional :: tolerance
96 character(len=LOG_SIZE) :: log_buf
97 integer :: sample_idx, sample_mesh_idx, i
98 character(len=NEKO_FNAME_LEN) :: fname_, mesh_fname_
100 logical :: interpolate_
106 interpolate_ = .false.
107 if (
present(interpolate)) interpolate_ = interpolate
109 if (
present(mesh_fname)) mesh_fname_ = trim(mesh_fname)
112 call neko_log%section(
"Import fields")
113 call neko_log%message(
"File name : " // trim(fname))
114 write (log_buf,
'(A,L1)')
"Interpolation : ", interpolate_
124 if (sample_idx .eq. -1) &
125 call neko_error(
"Invalid file name for the initial condition. The&
126 & file format must be e.g. 'mean0.f00001'")
132 call f%init(trim(fname_))
135 if (interpolate_)
then
137 if (
present(tolerance))
then
138 write (log_buf,
'(A,ES12.6)')
"Tolerance : ", tolerance
143 if (mesh_fname_ .eq.
"none")
then
144 mesh_fname_ = trim(fname_)
145 sample_mesh_idx = sample_idx
147 mesh_fname_ = trim(mesh_fname)
152 if (sample_mesh_idx .eq. -1)
then
153 call neko_error(
"Invalid file name for the initial condition." // &
154 "The file format must be e.g. 'mean0.f00001'")
157 write (log_buf,
'(A,A)')
"Mesh file : ", &
164 if (sample_mesh_idx .ne. sample_idx)
then
165 call f%set_counter(sample_mesh_idx)
166 call f%read(fld_data)
172 call f%set_counter(sample_idx)
173 call f%read(fld_data)
183 if (
present(s_target_list))
then
185 if (
present(s_index_list))
then
186 if (
size(s_index_list) .ne. s_target_list%size())
then
187 call neko_error(
"Scalar lists must have same size!")
190 do i = 1,
size(s_index_list)
192 if (s_index_list(i) .eq. 0)
then
196 if (s_index_list(i) < 1 .or. &
197 s_index_list(i) > fld_data%n_scalars)
then
198 call neko_error(
"s_index_list entry out of bounds")
205 do i = 1, s_target_list%size()
213 if (interpolate_)
then
221 call fld_data%import_fields(u, v, w, p, t, s_target_list, s_index_list, &
222 interpolate_, tolerance = tolerance)
Device abstraction, common interface for various accelerators.
integer, parameter, public host_to_device
Module for file I/O operations.
Simple module to handle fld file series. Provides an interface to the different fields sotred in a fl...
Importation of fields from fld files.
subroutine, public import_fields(fname, mesh_fname, u, v, w, p, t, s_target_list, s_index_list, interpolate, tolerance)
Imports fields from an fld file, potentially with interpolation.
type(log_t), public neko_log
Global log stream.
integer, parameter, public log_size
integer, parameter, public rp
Global precision used in computations.
integer function, public extract_fld_file_index(fld_filename, default_index)
Extracts the index of a field file. For example, "myfield.f00045" will return 45. If the suffix of th...
integer, parameter, public neko_fname_len
subroutine, public filename_chsuffix(fname, new_fname, new_suffix)
Change a filename's suffix.
field_list_t, To be able to group fields together
A wrapper around a polymorphic generic_file_t that handles its init. This is essentially a factory fo...