37 use json_module,
only : json_file
69 generic :: init_from_components => &
70 init_from_controllers, init_from_controllers_properties
72 procedure, pass(this) :: init_from_controllers => &
76 procedure, pass(this) :: init_from_controllers_properties => &
90 class(
gradient_t),
intent(inout),
target :: this
91 type(json_file),
intent(inout) :: json
92 class(
case_t),
intent(inout),
target :: case
93 character(len=:),
allocatable :: field_name
94 character(len=:),
allocatable :: name
95 character(len=NEKO_VARNAME_LEN) :: fields(3)
96 character(len=:),
allocatable :: computed_field
99 call json_get(json,
"field", field_name)
104 "gradient" // trim(field_name))
106 fields(1) = computed_field //
"_x"
107 fields(2) = computed_field //
"_y"
108 fields(3) = computed_field //
"_z"
109 write(*,*) fields(1), fields(2), fields(3)
111 call json%add(
"fields", fields)
113 call this%init_base(json,
case)
114 call this%writer%init(json,
case)
116 call this%init_common(name, field_name, computed_field)
123 character(len=*) :: name
124 character(len=*) :: field_name
125 character(len=*) :: computed_field
131 computed_field //
"_x")
133 computed_field //
"_y")
135 computed_field //
"_z")
153 preprocess_controller, compute_controller, output_controller, &
154 field_name, computed_field, filename, precision)
156 character(len=*),
intent(in) :: name
157 class(
case_t),
intent(inout),
target :: case
162 character(len=*) :: field_name
163 character(len=*) :: computed_field
164 character(len=*),
intent(in),
optional :: filename
165 integer,
intent(in),
optional :: precision
167 character(len=NEKO_VARNAME_LEN) :: fields(3)
169 fields(1) = trim(computed_field) //
"_x"
170 fields(2) = trim(computed_field) //
"_y"
171 fields(3) = trim(computed_field) //
"_z"
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_name, computed_field)
200 case, order, preprocess_control, preprocess_value, compute_control, &
201 compute_value, output_control, output_value, field_name, &
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_name
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(3)
220 fields(1) = trim(computed_field) //
"_x"
221 fields(2) = trim(computed_field) //
"_y"
222 fields(3) = trim(computed_field) //
"_z"
224 call this%init_base_from_components(
case, order, preprocess_control, &
225 preprocess_value, compute_control, compute_value, output_control, &
227 call this%writer%init_from_components(
"field_writer",
case, order, &
228 preprocess_control, preprocess_value, compute_control, compute_value, &
229 output_control, output_value, fields, filename, precision)
230 call this%init_common(name, field_name, computed_field)
237 call this%free_base()
238 call this%writer%free()
239 nullify(this%gradient_x)
240 nullify(this%gradient_y)
241 nullify(this%gradient_z)
251 call grad(this%gradient_x%x, this%gradient_y%x, this%gradient_z%x, &
252 this%u%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 field_writer_t type.
Implements the gradient_t type.
subroutine gradient_compute(this, time)
Compute the gradient field.
subroutine gradient_init_from_controllers_properties(this, name, case, order, preprocess_control, preprocess_value, compute_control, compute_value, output_control, output_value, field_name, computed_field, filename, precision)
Constructor from components, passing properties to the time_based_controller` components in the base ...
subroutine gradient_init_from_controllers(this, name, case, order, preprocess_controller, compute_controller, output_controller, field_name, computed_field, filename, precision)
Constructor from components, passing controllers.
subroutine gradient_init_from_json(this, json, case)
Constructor from json.
subroutine gradient_free(this)
Destructor.
subroutine gradient_init_common(this, name, field_name, computed_field)
Common part of the constructors.
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 grad(ux, uy, uz, u, coef)
Compute the gradient of a scalar field.
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 writes a 3d field to a file.
A simulation component that computes the gradient of a field. Wraps the gradient operator.
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.