47 use json_module,
only : json_file
92 u, v, w, p, t, s_target_list, s_index_list, interpolate)
93 character(len=*),
intent(in) :: fname
94 type(json_file),
intent(inout) :: global_interp_subdict
95 character(len=*),
intent(in),
optional :: mesh_fname
96 type(
field_t),
pointer,
intent(inout),
optional :: u,v,w,p,t
97 type(
field_list_t),
intent(inout),
optional :: s_target_list
98 integer,
intent(in),
optional :: s_index_list(:)
99 logical,
intent(in),
optional :: interpolate
101 real(kind=
dp) :: tolerance, padding
109 u, v, w, p, t, s_target_list, s_index_list, &
110 interpolate, tolerance = tolerance, padding = padding)
148 s_target_list, s_index_list, interpolate, tolerance, padding)
149 character(len=*),
intent(in) :: fname
150 character(len=*),
intent(in),
optional :: mesh_fname
151 type(
field_t),
pointer,
intent(inout),
optional :: u,v,w,p,t
152 type(
field_list_t),
intent(inout),
optional :: s_target_list
153 integer,
intent(in),
optional :: s_index_list(:)
154 logical,
intent(in),
optional :: interpolate
155 real(kind=
dp),
intent(in),
optional :: tolerance
156 real(kind=
dp),
intent(in),
optional :: padding
158 character(len=LOG_SIZE) :: log_buf
159 integer :: sample_idx, sample_mesh_idx, i
160 character(len=NEKO_FNAME_LEN) :: fname_, mesh_fname_
162 logical :: interpolate_
168 interpolate_ = .false.
169 if (
present(interpolate)) interpolate_ = interpolate
171 if (
present(mesh_fname)) mesh_fname_ = trim(mesh_fname)
174 call neko_log%section(
"Import fields")
175 call neko_log%message(
"File name : " // trim(fname))
176 write (log_buf,
'(A,L1)')
"Interpolation : ", interpolate_
186 if (sample_idx .eq. -1) &
187 call neko_error(
"Invalid file name for the initial condition. The&
188 & file format must be e.g. 'mean0.f00001'")
194 call f%init(trim(fname_))
197 if (interpolate_)
then
200 if (mesh_fname_ .eq.
"none")
then
201 mesh_fname_ = trim(fname_)
202 sample_mesh_idx = sample_idx
204 mesh_fname_ = trim(mesh_fname)
209 if (sample_mesh_idx .eq. -1)
then
210 call neko_error(
"Invalid file name for the initial condition." // &
211 "The file format must be e.g. 'mean0.f00001'")
214 write (log_buf,
'(A,A)')
"Mesh file : ", &
221 if (sample_mesh_idx .ne. sample_idx)
then
222 call f%set_counter(sample_mesh_idx)
223 call f%read(fld_data)
229 call f%set_counter(sample_idx)
230 call f%read(fld_data)
240 if (
present(s_target_list))
then
242 if (
present(s_index_list))
then
243 if (
size(s_index_list) .ne. s_target_list%size())
then
244 call neko_error(
"Scalar lists must have same size!")
247 do i = 1,
size(s_index_list)
249 if (s_index_list(i) .eq. 0)
then
253 if (s_index_list(i) < 1 .or. &
254 s_index_list(i) > fld_data%n_scalars)
then
255 call neko_error(
"s_index_list entry out of bounds")
262 do i = 1, s_target_list%size()
270 if (interpolate_)
then
278 call fld_data%import_fields(u, v, w, p, t, s_target_list, s_index_list, &
279 interpolate_, tolerance = tolerance, padding = padding)
Retrieves a parameter by name or assigns a provided default value. In the latter case also adds the m...
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...
Implements global_interpolation given a dofmap.
real(kind=dp), parameter, public glob_interp_tol
real(kind=dp), parameter, public glob_interp_pad
Importation of fields from fld files.
subroutine import_fields_from_json(fname, global_interp_subdict, mesh_fname, u, v, w, p, t, s_target_list, s_index_list, interpolate)
Imports fields from an fld file, potentially with interpolation, with parameters provided in a JSON s...
subroutine import_fields_from_params(fname, mesh_fname, u, v, w, p, t, s_target_list, s_index_list, interpolate, tolerance, padding)
Imports fields from an fld file, potentially with interpolation.
Utilities for retrieving parameters from the case files.
type(log_t), public neko_log
Global log stream.
integer, parameter, public log_size
integer, parameter, public dp
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...