37 use json_module,
only : json_file
51 use,
intrinsic :: iso_c_binding
58 character(len=NEKO_VARNAME_LEN),
allocatable :: field_names(:)
61 real(kind=
rp) :: start_time
67 logical :: checked = .false.
73 procedure, pass(this) :: init_from_components => &
93 integer :: i, num_elements
96 if (
size(this%field_names) .eq. 0)
call neko_error(
"Empty list of fields")
99 num_elements = f%msh%nelv
103 do i = 2,
size(this%field_names)
106 if (f%msh%nelv .ne. num_elements .or. f%size() .ne. dof_size)
then
107 call neko_error(
"Invalid field :" // trim(f%name) // &
108 "! All streamed fields must have the same size.")
115 call neko_error(
'Neko has not been configured with ADIOS2 support! ' // &
116 'Use --with-adios2=your/adios2/installation')
119 this%checked = .true.
126 type(json_file),
intent(inout) :: json
127 class(
case_t),
intent(inout),
target :: case
128 character(len=NEKO_VARNAME_LEN),
allocatable :: which_fields(:)
129 character(len=:),
allocatable :: name
130 real(kind=
rp) :: start_time
131 logical :: stream_mesh
134 call json_get(json,
'fields', which_fields)
141 call this%init_base(json,
case)
142 call this%init_from_components(name, which_fields, start_time, stream_mesh)
151 which_fields, start_time, stream_mesh)
153 character(len=*),
intent(in) :: name
154 character(len=*),
intent(in) :: which_fields(:)
155 real(kind=
rp),
intent(in) :: start_time
156 logical,
intent(in) :: stream_mesh
160 this%field_names = which_fields
161 this%start_time = start_time
168 call this%dstream%init(f%msh, f%xh)
170 if (stream_mesh)
then
171 call neko_log%message(
"Using field " // trim(f%name) // &
173 call neko_log%message(
"Streaming mesh: x-coordinates", &
175 call this%dstream%stream(f%dof%x)
176 call neko_log%message(
"Streaming mesh: y-coordinates", &
178 call this%dstream%stream(f%dof%y)
179 call neko_log%message(
"Streaming mesh: z-coordinates", &
181 call this%dstream%stream(f%dof%z)
191 call this%free_base()
193 if (
allocated(this%field_names))
deallocate(this%field_names)
194 this%start_time = -1.0_rp
195 call this%dstream%free()
208 if (.not. this%checked)
call neko_error(
"Simcomp not checked!")
210 if (time%t .ge. this%start_time)
then
211 do i = 1,
size(this%field_names)
217 call neko_log%message(
"Streaming field: " // this%field_names(i))
220 call this%dstream%stream(f%x)
Retrieves a parameter by name or assigns a provided default value. In the latter case also adds the m...
Retrieves a parameter by name or throws an error.
Defines a simulation case.
integer, public pe_rank
MPI rank.
A simulation component that streams data using ADIOS2.
subroutine data_streamer_simcomp_check(this)
Checks the validity of the simcomp. Currently, makes sure that:
subroutine data_streamer_simcomp_free(this)
Destructor.
subroutine data_streamer_simcomp_init_from_json(this, json, case)
Constructor from json.
subroutine data_streamer_simcomp_compute(this, time)
Compute the data_streamer_simcomp field.
subroutine data_streamer_simcomp_init_from_components(this, name, which_fields, start_time, stream_mesh)
Common part of constructors.
Implements type data_streamer_t.
Device abstraction, common interface for various accelerators.
integer, parameter, public device_to_host
Utilities for retrieving parameters from the case files.
integer, parameter, public neko_log_debug
Debug log level.
type(log_t), public neko_log
Global log stream.
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.
Simulation components are objects that encapsulate functionality that can be fit to a particular comp...
subroutine compute_(this, time)
Dummy compute function.
Contains the time_based_controller_t type.
Module with things related to the simulation time.
integer, parameter, public neko_varname_len
Provides access to data streaming by interfacing with c++ ADIOS2 subroutines.
Base abstract class for simulation components.
A utility type for determining whether an action should be executed based on the current time value....
A struct that contains all info about the time, expand as needed.