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=20) :: fields(1)
98 character(len=20),
allocatable :: field_names(:)
99 character(len=:),
allocatable :: computed_field
103 call json_get(json,
"fields", field_names)
105 if (
size(field_names) .ne. 3)
then
106 call neko_error(
"The divergence simcomp requires exactly 3 entries in " // &
110 fields(1) = trim(computed_field)
113 call json%add(
"fields", fields)
115 call this%init_base(json,
case)
116 call this%writer%init(json,
case)
126 character(len=*) :: field_names(3)
127 character(len=*) :: computed_field
149 preprocess_controller, compute_controller, output_controller, &
150 field_names, computed_field, filename, precision)
152 class(
case_t),
intent(inout),
target :: case
157 character(len=*) :: field_names(3)
158 character(len=*) :: computed_field
159 character(len=*),
intent(in),
optional :: filename
160 integer,
intent(in),
optional :: precision
162 character(len=20) :: fields(1)
164 fields(1) = trim(computed_field)
166 call this%init_base_from_components(
case, order, preprocess_controller, &
168 call this%writer%init_from_components(
case, order, preprocess_controller, &
170 call this%init_common(field_names, computed_field)
191 case, order, preprocess_control, preprocess_value, compute_control, &
192 compute_value, output_control, output_value, field_names, &
193 computed_field, filename, precision)
195 class(
case_t),
intent(inout),
target :: case
197 character(len=*),
intent(in) :: preprocess_control
198 real(kind=
rp),
intent(in) :: preprocess_value
199 character(len=*),
intent(in) :: compute_control
200 real(kind=
rp),
intent(in) :: compute_value
201 character(len=*),
intent(in) :: output_control
202 real(kind=
rp),
intent(in) :: output_value
203 character(len=*) :: field_names(3)
204 character(len=*) :: computed_field
205 character(len=*),
intent(in),
optional :: filename
206 integer,
intent(in),
optional :: precision
208 character(len=20) :: fields(1)
210 fields(1) = trim(computed_field) //
"_x"
212 call this%init_base_from_components(
case, order, preprocess_control, &
213 preprocess_value, compute_control, compute_value, output_control, &
215 call this%writer%init_from_components(
case, order, preprocess_control, &
216 preprocess_value, compute_control, compute_value, output_control, &
217 output_value, fields, filename, precision)
218 call this%init_common(field_names, computed_field)
225 call this%free_base()
226 call this%writer%free()
231 nullify(this%divergence)
239 call div(this%divergence%x, this%u%x, this%v%x, this%w%x, 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.
Defines a simulation case.
Implements the divergence_t type.
subroutine divergence_init_from_json(this, json, case)
Constructor from json.
subroutine divergence_init_from_controllers_properties(this, 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_init_from_controllers(this, case, order, preprocess_controller, compute_controller, output_controller, field_names, computed_field, filename, precision)
Constructor from components, passing controllers.
subroutine divergence_free(this)
Destructor.
subroutine divergence_init_common(this, field_names, computed_field)
Actual constructor.
subroutine divergence_compute(this, time)
Compute the divergence field.
Defines a registry for storing solution fields.
type(field_registry_t), target, public neko_field_registry
Global field registry.
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.
subroutine, public div(res, ux, uy, uz, coef)
Compute the divergence of a vector field.
Implements output_controller_t
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.
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.