38 use json_module,
only : json_file
60 real(kind=
rp),
pointer,
contiguous :: dr(:,:,:,:)
62 real(kind=
rp),
pointer,
contiguous :: ds(:,:,:,:)
64 real(kind=
rp),
pointer,
contiguous :: dt(:,:,:,:)
72 generic :: init_from_components => &
73 init_from_controllers, init_from_controllers_properties
75 procedure, pass(this) :: init_from_controllers => &
79 procedure, pass(this) :: init_from_controllers_properties => &
94 type(json_file),
intent(inout) :: json
95 class(
case_t),
intent(inout),
target :: case
96 character(len=:),
allocatable :: field_name
97 character(len=:),
allocatable :: direction
98 character(len=:),
allocatable :: computed_field
99 character(len=:),
allocatable :: name
100 character(len=NEKO_VARNAME_LEN) :: fields(1)
105 call json_get(json,
"field", field_name)
106 call json_get(json,
"direction", direction)
109 "d" // trim(field_name) //
"_d" // direction)
111 fields(1) = trim(computed_field)
112 call json%add(
"fields", fields)
114 call this%init_base(json,
case)
115 call this%writer%init(json,
case)
117 call this%init_common(name, field_name, computed_field, direction)
128 character(len=*) :: name
129 character(len=*) :: field_name
130 character(len=*) :: computed_field
131 character(len=*) :: direction
136 this%du =>
neko_registry%get_field_by_name(trim(computed_field))
138 if (direction .eq.
"x")
then
139 this%dr => this%case%fluid%c_Xh%drdx
140 this%ds => this%case%fluid%c_Xh%dsdx
141 this%dt => this%case%fluid%c_Xh%dtdx
142 else if (direction .eq.
"y")
then
143 this%dr => this%case%fluid%c_Xh%drdy
144 this%ds => this%case%fluid%c_Xh%dsdy
145 this%dt => this%case%fluid%c_Xh%dtdy
146 else if (direction .eq.
"z")
then
147 this%dr => this%case%fluid%c_Xh%drdz
148 this%ds => this%case%fluid%c_Xh%dsdz
149 this%dt => this%case%fluid%c_Xh%dtdz
151 call neko_error(
"The direction of the derivative must be x, y or z")
169 preprocess_controller, compute_controller, output_controller, &
170 field_name, computed_field, direction, filename, precision)
172 character(len=*),
intent(in) :: name
173 class(
case_t),
intent(inout),
target :: case
178 character(len=*) :: field_name
179 character(len=*) :: computed_field
180 character(len=*) :: direction
181 character(len=*),
intent(in),
optional :: filename
182 integer,
intent(in),
optional :: precision
184 character(len=NEKO_VARNAME_LEN) :: fields(1)
186 fields(1) = trim(computed_field)
188 call this%init_base_from_components(
case, order, preprocess_controller, &
190 call this%writer%init_from_components(
"field_writer",
case, order, &
193 call this%init_common(name, field_name, computed_field, direction)
216 case, order, preprocess_control, preprocess_value, compute_control, &
217 compute_value, output_control, output_value, field_name, &
218 computed_field, direction, filename, precision)
220 character(len=*),
intent(in) :: name
221 class(
case_t),
intent(inout),
target :: case
223 character(len=*),
intent(in) :: preprocess_control
224 real(kind=
rp),
intent(in) :: preprocess_value
225 character(len=*),
intent(in) :: compute_control
226 real(kind=
rp),
intent(in) :: compute_value
227 character(len=*),
intent(in) :: output_control
228 real(kind=
rp),
intent(in) :: output_value
229 character(len=*) :: field_name
230 character(len=*) :: computed_field
231 character(len=*) :: direction
232 character(len=*),
intent(in),
optional :: filename
233 integer,
intent(in),
optional :: precision
235 character(len=NEKO_VARNAME_LEN) :: fields(1)
237 fields(1) = trim(computed_field)
239 call this%init_base_from_components(
case, order, preprocess_control, &
240 preprocess_value, compute_control, compute_value, output_control, &
242 call this%writer%init_from_components(
"field_writer",
case, order, &
243 preprocess_control, preprocess_value, compute_control, compute_value, &
244 output_control, output_value, fields, filename, precision)
245 call this%init_common(name, field_name, computed_field, direction)
253 call this%free_base()
254 call this%writer%free()
268 call dudxyz(this%du%x, this%u%x, this%dr, this%ds, this%dt,&
269 this%case%fluid%c_Xh)
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.
Compute derivative of a scalar field along a single direction.
Defines a simulation case.
Implements the derivative_t type.
subroutine derivative_free(this)
Destructor.
subroutine derivative_init_common(this, name, field_name, computed_field, direction)
Common part of constructors from components.
subroutine derivative_compute(this, time)
Compute the derivative field.
subroutine derivative_init_from_json(this, json, case)
Constructor from json.
subroutine derivative_init_from_controllers(this, name, case, order, preprocess_controller, compute_controller, output_controller, field_name, computed_field, direction, filename, precision)
Constructor from components, passing controllers.
subroutine derivative_init_from_controllers_properties(this, name, case, order, preprocess_control, preprocess_value, compute_control, compute_value, output_control, output_value, field_name, computed_field, direction, filename, precision)
Constructor from components, passing properties to the time_based_controller` components in the base ...
Implements the field_writer_t type.
Utilities for retrieving parameters from the case files.
integer, parameter, public dp
integer, parameter, public sp
integer, parameter, public rp
Global precision used in computations.
Implements output_controller_t
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
A simulation component that computes a derivative of a field. Wraps the duxyz operator.
A simulation component that writes a 3d field to a file.
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.