38 use json_module,
only : json_file
73 generic :: init_from_components => &
74 init_from_controllers, init_from_controllers_properties
76 procedure, pass(this) :: init_from_controllers => &
80 procedure, pass(this) :: init_from_controllers_properties => &
95 type(json_file),
intent(inout) :: json
96 class(
case_t),
intent(inout),
target :: case
97 character(len=NEKO_VARNAME_LEN) :: fields(1)
98 character(len=NEKO_VARNAME_LEN),
allocatable :: field_names(:)
99 character(len=:),
allocatable :: computed_field
100 character(len=:),
allocatable :: name
105 call json_get(json,
"fields", field_names)
107 if (
size(field_names) .ne. 3)
then
108 call neko_error(
"The divergence simcomp requires exactly 3 entries in " &
112 fields(1) = trim(computed_field)
115 call json%add(
"fields", fields)
117 call this%init_base(json,
case)
118 call this%writer%init(json,
case)
129 character(len=*),
intent(in) :: name
130 character(len=*),
intent(in) :: field_names(3)
131 character(len=*),
intent(in) :: computed_field
138 this%divergence =>
neko_registry%get_field_by_name(computed_field)
155 preprocess_controller, compute_controller, output_controller, &
156 field_names, computed_field, filename, precision)
158 character(len=*),
intent(in) :: name
159 class(
case_t),
intent(inout),
target :: case
164 character(len=*),
intent(in) :: field_names(3)
165 character(len=*),
intent(in) :: computed_field
166 character(len=*),
intent(in),
optional :: filename
167 integer,
intent(in),
optional :: precision
169 character(len=NEKO_VARNAME_LEN) :: fields(1)
171 fields(1) = trim(computed_field)
173 call this%init_base_from_components(
case, order, preprocess_controller, &
175 call this%writer%init_from_components(
"field_writer",
case, order, &
178 call this%init_common(name, field_names, computed_field)
200 case, order, preprocess_control, preprocess_value, compute_control, &
201 compute_value, output_control, output_value, field_names, &
202 computed_field, filename, precision)
204 character(len=*),
intent(in) :: name
205 class(
case_t),
intent(inout),
target :: case
207 character(len=*),
intent(in) :: preprocess_control
208 real(kind=
rp),
intent(in) :: preprocess_value
209 character(len=*),
intent(in) :: compute_control
210 real(kind=
rp),
intent(in) :: compute_value
211 character(len=*),
intent(in) :: output_control
212 real(kind=
rp),
intent(in) :: output_value
213 character(len=*) :: field_names(3)
214 character(len=*) :: computed_field
215 character(len=*),
intent(in),
optional :: filename
216 integer,
intent(in),
optional :: precision
218 character(len=NEKO_VARNAME_LEN) :: fields(1)
220 fields(1) = trim(computed_field) //
"_x"
222 call this%init_base_from_components(
case, order, preprocess_control, &
223 preprocess_value, compute_control, compute_value, output_control, &
225 call this%writer%init_from_components(
"field_writer",
case, order, &
226 preprocess_control, preprocess_value, compute_control, compute_value, &
227 output_control, output_value, fields, filename, precision)
228 call this%init_common(name, field_names, computed_field)
235 call this%free_base()
236 call this%writer%free()
241 nullify(this%divergence)
249 call div(this%divergence%x, this%u%x, this%v%x, this%w%x, &
250 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 the divergence of a vector field.
Defines a simulation case.
Implements the divergence_t type.
subroutine divergence_init_from_controllers(this, name, case, order, preprocess_controller, compute_controller, output_controller, field_names, computed_field, filename, precision)
Constructor from components, passing controllers.
subroutine divergence_init_from_json(this, json, case)
Constructor from json.
subroutine divergence_init_common(this, name, field_names, computed_field)
Actual constructor.
subroutine divergence_init_from_controllers_properties(this, name, case, order, preprocess_control, preprocess_value, compute_control, compute_value, output_control, output_value, field_names, computed_field, filename, precision)
Constructor from components, passing properties to the time_based_controller` components in the base ...
subroutine divergence_free(this)
Destructor.
subroutine divergence_compute(this, time)
Compute the divergence field.
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 the divergence of a vector field. Added to the field registry as...
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.