88 f_x, f_y, f_z, c_Xh, gs_Xh, bc_prs_surface, bc_sym_surface, &
89 Ax, bd, dt, mu, rho, event)
90 type(field_t),
intent(inout) :: p, u, v, w
91 type(field_t),
intent(inout) :: p_res
92 type(field_t),
intent(in) :: f_x, f_y, f_z
93 type(coef_t),
intent(inout) :: c_Xh
94 type(gs_t),
intent(inout) :: gs_Xh
95 type(facet_normal_t),
intent(in) :: bc_prs_surface
96 type(facet_normal_t),
intent(in) :: bc_sym_surface
97 class(ax_t),
intent(inout) :: Ax
98 real(kind=rp),
intent(in) :: bd
99 real(kind=rp),
intent(in) :: dt
100 type(field_t),
intent(in) :: mu
101 type(field_t),
intent(in) :: rho
102 type(c_ptr),
intent(inout) :: event
103 real(kind=rp) :: rho_val, inv_rho
105 type(field_t),
pointer :: ta1, ta2, ta3, wa1, wa2, wa3
106 integer :: temp_indices(6)
108 call neko_scratch_registry%request_field(ta1, temp_indices(1), .false.)
109 call neko_scratch_registry%request_field(ta2, temp_indices(2), .false.)
110 call neko_scratch_registry%request_field(ta3, temp_indices(3), .false.)
111 call neko_scratch_registry%request_field(wa1, temp_indices(4), .false.)
112 call neko_scratch_registry%request_field(wa2, temp_indices(5), .false.)
113 call neko_scratch_registry%request_field(wa3, temp_indices(6), .false.)
118 rho_val = rho%x(1,1,1,1)
119 inv_rho = 1.0_rp / rho_val
122 call device_cfill(c_xh%h1_d, inv_rho, n)
123 call device_cfill(c_xh%h2_d, 0.0_rp, n)
125 call device_cmult2(ta1%x_d, f_x%x_d, inv_rho, n)
126 call device_cmult2(ta2%x_d, f_y%x_d, inv_rho, n)
127 call device_cmult2(ta3%x_d, f_z%x_d, inv_rho, n)
129 call device_col2(ta1%x_d, c_xh%B_d, n)
130 call device_col2(ta2%x_d, c_xh%B_d, n)
131 call device_col2(ta3%x_d, c_xh%B_d, n)
133 call gs_xh%op(ta1, gs_op_add, event)
134 call gs_xh%op(ta2, gs_op_add, event)
135 call gs_xh%op(ta3, gs_op_add, event)
136 call device_event_sync(event)
138 call device_col2(ta1%x_d, c_xh%Binv_d, n)
139 call device_col2(ta2%x_d, c_xh%Binv_d, n)
140 call device_col2(ta3%x_d, c_xh%Binv_d, n)
142 call cdtp(wa1%x, ta1%x, c_xh%drdx, c_xh%dsdx, c_xh%dtdx, c_xh)
143 call cdtp(wa2%x, ta2%x, c_xh%drdy, c_xh%dsdy, c_xh%dtdy, c_xh)
144 call cdtp(wa3%x, ta3%x, c_xh%drdz, c_xh%dsdz, c_xh%dtdz, c_xh)
146 call ax%compute(p_res%x, p%x, c_xh, p%msh, p%Xh)
148 call device_cmult(p_res%x_d, -1.0_rp, n)
149 call device_add2(p_res%x_d, wa1%x_d, n)
150 call device_add2(p_res%x_d, wa2%x_d, n)
151 call device_add2(p_res%x_d, wa3%x_d, n)
153 call neko_scratch_registry%relinquish_field(temp_indices)
177 v_res, w_res, p, f_x, f_y, f_z, c_Xh, msh, Xh, mu, rho, bd, dt, n)
subroutine adjoint_pnpn_prs_res_device_compute(p, p_res, u, v, w, f_x, f_y, f_z, c_xh, gs_xh, bc_prs_surface, bc_sym_surface, ax, bd, dt, mu, rho, event)
Compute adjoint pressure residual (device backend).