46 use num_types,
only: rp
47 use field_list,
only: field_list_t
48 use json_module,
only: json_file
49 use source_term,
only: source_term_t
50 use coefs,
only: coef_t
51 use field,
only: field_t
52 use time_state,
only: time_state_t
55 use field_math,
only: field_addcol3, field_copy, field_cmult
56 use scratch_registry,
only: neko_scratch_registry
58 use point_zone,
only: point_zone_t
59 use utils,
only: neko_error
60 use field_registry,
only: neko_field_registry
69 type(field_t),
pointer :: u => null()
71 type(field_t),
pointer :: v => null()
73 type(field_t),
pointer :: w => null()
75 type(field_t),
pointer :: chi => null()
79 class(point_zone_t),
pointer :: mask => null()
85 procedure, pass(this) :: init => adjoint_lube_source_term_init_from_json
87 procedure, pass(this) :: init_from_components => &
88 adjoint_lube_source_term_init_from_components
90 procedure, pass(this) :: free => adjoint_lube_source_term_free
92 procedure, pass(this) :: compute_ => adjoint_lube_source_term_compute
102 subroutine adjoint_lube_source_term_init_from_json(this, json, fields, coef, &
105 type(json_file),
intent(inout) :: json
106 type(field_list_t),
intent(in),
target :: fields
107 type(coef_t),
intent(in),
target :: coef
108 character(len=*),
intent(in) :: variable_name
117 end subroutine adjoint_lube_source_term_init_from_json
128 subroutine adjoint_lube_source_term_init_from_components(this, &
129 f_x, f_y, f_z, design, K, &
134 type(field_t),
pointer,
intent(in) :: f_x, f_y, f_z
135 class(
design_t),
intent(in),
target :: design
136 class(point_zone_t),
intent(in),
target :: mask
137 type(coef_t),
intent(in) :: coef
138 real(kind=rp) :: start_time
139 real(kind=rp) :: end_time
140 type(field_list_t) :: fields
143 type(field_t),
intent(in),
target :: u, v, w
148 end_time = 100000000.0_rp
155 call fields%assign(1, f_x)
156 call fields%assign(2, f_y)
157 call fields%assign(3, f_z)
159 call this%init_base(fields, coef, start_time, end_time)
170 this%chi => neko_field_registry%get_field(
"brinkman_amplitude")
172 call neko_error(
'Unknown design type')
176 this%if_mask = if_mask
177 if (this%if_mask)
then
181 end subroutine adjoint_lube_source_term_init_from_components
184 subroutine adjoint_lube_source_term_free(this)
187 call this%free_base()
188 end subroutine adjoint_lube_source_term_free
193 subroutine adjoint_lube_source_term_compute(this, time)
195 type(time_state_t),
intent(in) :: time
196 type(field_t),
pointer :: fu, fv, fw
197 type(field_t),
pointer :: work
198 integer :: temp_indices(1)
200 fu => this%fields%get_by_index(1)
201 fv => this%fields%get_by_index(2)
202 fw => this%fields%get_by_index(3)
208 call neko_scratch_registry%request_field(work, temp_indices(1))
209 call field_copy(work, this%chi)
212 call field_cmult(work, this%K)
215 if (this%if_mask)
then
220 call field_addcol3(fu, this%u, work)
221 call field_addcol3(fv, this%v, work)
222 call field_addcol3(fw, this%w, work)
223 call neko_scratch_registry%relinquish_field(temp_indices)
225 end subroutine adjoint_lube_source_term_compute
Implements the adjoint_lube_source_term_t type.
Some common Masking operations we may need.
A adjoint source term corresponding to an objective of.
A topology optimization design variable.