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
54 use field_math,
only: field_addcol3, field_copy, field_cmult
55 use scratch_registry,
only: neko_scratch_registry
57 use point_zone,
only: point_zone_t
58 use utils,
only: neko_error
59 use field_registry,
only: neko_field_registry
68 type(field_t),
pointer :: u,v,w
70 type(field_t),
pointer :: chi
74 class(point_zone_t),
pointer :: mask
82 procedure, pass(this) :: init_from_components => &
97 type(json_file),
intent(inout) :: json
98 type(field_list_t),
intent(in),
target :: fields
99 type(coef_t),
intent(in),
target :: coef
117 f_x, f_y, f_z, design, K, &
122 type(field_t),
pointer,
intent(in) :: f_x, f_y, f_z
123 class(
design_t),
intent(in),
target :: design
124 class(point_zone_t),
intent(in),
target :: mask
125 type(coef_t),
intent(in) :: coef
126 real(kind=rp) :: start_time
127 real(kind=rp) :: end_time
128 type(field_list_t) :: fields
131 type(field_t),
intent(in),
target :: u, v, w
136 end_time = 100000000.0_rp
143 call fields%assign(1, f_x)
144 call fields%assign(2, f_y)
145 call fields%assign(3, f_z)
147 call this%init_base(fields, coef, start_time, end_time)
158 this%chi => neko_field_registry%get_field(
"brinkman_amplitude")
160 call neko_error(
'Unknown design type')
164 this%if_mask = if_mask
165 if (this%if_mask)
then
175 call this%free_base()
183 real(kind=rp),
intent(in) :: t
184 integer,
intent(in) :: tstep
185 type(field_t),
pointer :: fu, fv, fw
186 type(field_t),
pointer :: work
187 integer :: temp_indices(1)
189 fu => this%fields%get_by_index(1)
190 fv => this%fields%get_by_index(2)
191 fw => this%fields%get_by_index(3)
197 call neko_scratch_registry%request_field(work, temp_indices(1))
198 call field_copy(work, this%chi)
201 call field_cmult(work, this%K)
204 if (this%if_mask)
then
209 call field_addcol3(fu, this%u, work)
210 call field_addcol3(fv, this%v, work)
211 call field_addcol3(fw, this%w, work)
212 call neko_scratch_registry%relinquish_field(temp_indices)
Implements the adjoint_lube_source_term_t type.
subroutine adjoint_lube_source_term_free(this)
Destructor.
subroutine adjoint_lube_source_term_init_from_json(this, json, fields, coef)
The common constructor using a JSON object.
subroutine adjoint_lube_source_term_init_from_components(this, f_x, f_y, f_z, design, k, u, v, w, mask, if_mask, coef)
The constructor from type components.
subroutine adjoint_lube_source_term_compute(this, t, tstep)
Computes the source term and adds the result to fields.
Some common Masking operations we may need.
A adjoint source term corresponding to an objective of.
A topology optimization design variable.