38 use json_module,
only : json_file
80 generic :: init_from_components => &
81 init_from_controllers, init_from_controllers_properties
83 procedure, pass(this) :: init_from_controllers => &
87 procedure, pass(this) :: init_from_controllers_properties => &
101 class(
curl_t),
intent(inout),
target :: this
102 type(json_file),
intent(inout) :: json
103 class(
case_t),
intent(inout),
target :: case
104 character(len=20) :: fields(3)
105 character(len=20),
allocatable :: field_names(:)
106 character(len=:),
allocatable :: computed_field
112 call json_get(json,
"fields", field_names)
114 if (
size(field_names) .ne. 3)
then
115 call neko_error(
"The curl simcomp requires exactly 3 entries in " // &
119 fields(1) = trim(computed_field) //
"_x"
120 fields(2) = trim(computed_field) //
"_y"
121 fields(3) = trim(computed_field) //
"_z"
124 call json%add(
"fields", fields)
126 call this%init_base(json,
case)
127 call this%writer%init(json,
case)
137 class(
curl_t),
intent(inout) :: this
138 character(len=*),
intent(in) :: name
139 character(len=*),
intent(in) :: field_names(3)
140 character(len=*),
intent(in) :: computed_field
146 this%curl_x =>
neko_registry%get_field_by_name(computed_field //
"_x")
147 this%curl_y =>
neko_registry%get_field_by_name(computed_field //
"_y")
148 this%curl_z =>
neko_registry%get_field_by_name(computed_field //
"_z")
166 preprocess_controller, compute_controller, output_controller, &
167 field_names, computed_field, filename, precision)
168 class(
curl_t),
intent(inout) :: this
169 character(len=*),
intent(in) :: name
170 class(
case_t),
intent(inout),
target :: case
175 character(len=*),
intent(in) :: field_names(3)
176 character(len=*),
intent(in) :: computed_field
177 character(len=*),
intent(in),
optional :: filename
178 integer,
intent(in),
optional :: precision
180 character(len=20) :: fields(3)
184 fields(1) = trim(this%name) //
"_x"
185 fields(2) = trim(this%name) //
"_y"
186 fields(3) = trim(this%name) //
"_z"
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(this%name, field_names, computed_field)
216 preprocess_control, preprocess_value, compute_control, compute_value, &
217 output_control, output_value, field_names, computed_field, filename, &
219 class(
curl_t),
intent(inout) :: this
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=*),
intent(in) :: field_names(3)
230 character(len=*),
intent(in) :: computed_field
231 character(len=*),
intent(in),
optional :: filename
232 integer,
intent(in),
optional :: precision
234 character(len=20) :: fields(3)
238 fields(1) = trim(computed_field) //
"_x"
239 fields(2) = trim(computed_field) //
"_y"
240 fields(3) = trim(computed_field) //
"_z"
242 call this%init_base_from_components(
case, order, preprocess_control, &
243 preprocess_value, compute_control, compute_value, output_control, &
245 call this%writer%init_from_components(
"field_writer",
case, order, &
246 preprocess_control, preprocess_value, compute_control, compute_value, &
247 output_control, output_value, fields, filename, precision)
248 call this%init_common(this%name, field_names, computed_field)
254 class(
curl_t),
intent(inout) :: this
255 call this%free_base()
256 call this%writer%free()
268 class(
curl_t),
intent(inout) :: this
270 type(
field_t),
pointer :: temp1, temp2
271 integer :: tmp_idx(2)
276 call curl(this%curl_x, this%curl_y, this%curl_z, this%u, this%v, &
277 this%w, temp1, temp2, 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 curl_t type.
subroutine curl_init_common(this, name, field_names, computed_field)
Common part of the constructors.
subroutine curl_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 curl_free(this)
Destructor.
subroutine curl_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 curl_init_from_json(this, json, case)
Constructor from json.
subroutine curl_compute(this, time)
Compute the curl field.
Device abstraction, common interface for various accelerators.
type(c_ptr), bind(C), public glb_cmd_event
Event for the global command queue.
Implements the field_writer_t type.
Implements fld_file_output_t.
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 curl(w1, w2, w3, u1, u2, u3, work1, work2, coef, event)
Implements output_controller_t
Defines a registry for storing solution fields.
type(registry_t), target, public neko_registry
Global field registry.
Defines a registry for storing and requesting temporary objects This can be used when you have a func...
type(scratch_registry_t), target, public neko_scratch_registry
Global scratch 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.
A simulation component that computes the curl of a vector field. Added to the field registry as curl_...
A simulation component that writes a 3d field to a file.
A simple output saving a list of fields to a .fld 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.