123 type(space_t),
intent(inout) :: Xh
124 type(coef_t),
intent(inout) :: coef
125 type(field_t),
intent(inout) :: vx, vy, vz
126 type(field_t),
intent(inout) :: vxb, vyb, vzb
127 integer,
intent(in) :: n
128 type(field_t),
intent(inout) :: fx, fy, fz
129 type(c_ptr) :: fx_d, fy_d, fz_d
130 type(c_ptr) :: vx_d, vy_d, vz_d
133 real(kind=rp),
dimension(Xh%lxyz) :: duxb, dvxb, dwxb
134 real(kind=rp),
dimension(Xh%lxyz) :: duyb, dvyb, dwyb
135 real(kind=rp),
dimension(Xh%lxyz) :: duzb, dvzb, dwzb
137 integer :: e, i, idx, idxx
140 type(field_t),
pointer :: tduxb, tdvxb, tdwxb, tduyb, tdvyb, tdwyb, tduzb, &
142 integer :: temp_indices(9)
145 if (neko_bcknd_device .eq. 1)
then
146 call neko_scratch_registry%request_field(tduxb, temp_indices(1))
147 call neko_scratch_registry%request_field(tdvxb, temp_indices(2))
148 call neko_scratch_registry%request_field(tdwxb, temp_indices(3))
149 call neko_scratch_registry%request_field(tduyb, temp_indices(4))
150 call neko_scratch_registry%request_field(tdvyb, temp_indices(5))
151 call neko_scratch_registry%request_field(tdwyb, temp_indices(6))
152 call neko_scratch_registry%request_field(tduzb, temp_indices(7))
153 call neko_scratch_registry%request_field(tdvzb, temp_indices(8))
154 call neko_scratch_registry%request_field(tdwzb, temp_indices(9))
165 call opgrad(tduxb%x, tduyb%x, tduzb%x, vxb%x, coef)
166 call opgrad(tdvxb%x, tdvyb%x, tdvzb%x, vyb%x, coef)
167 call opgrad(tdwxb%x, tdwyb%x, tdwzb%x, vzb%x, coef)
171 call device_vdot3(this%temp_d, vx_d, vy_d, vz_d, &
172 tduxb%x_d, tdvxb%x_d, tdwxb%x_d, n)
173 call device_sub2(fx_d, this%temp_d, n)
175 call device_vdot3(this%temp_d, vx_d, vy_d, vz_d, &
176 tduyb%x_d, tdvyb%x_d, tdwyb%x_d, n)
177 call device_sub2(fy_d, this%temp_d, n)
179 call device_vdot3(this%temp_d, vx_d, vy_d, vz_d, &
180 tduzb%x_d, tdvzb%x_d, tdwzb%x_d, n)
181 call device_sub2(fz_d, this%temp_d, n)
186 vxb%x, vyb%x, vzb%x, &
188 tduxb, tdvxb, tdwxb, &
192 vxb%x, vyb%x, vzb%x, &
194 tduxb, tdvxb, tdwxb, &
198 vxb%x, vyb%x, vzb%x, &
200 tduxb, tdvxb, tdwxb, &
203 call neko_scratch_registry%relinquish_field(temp_indices)
205 do e = 1, coef%msh%nelv
208 call opgrad(duxb, duyb, duzb, vxb%x, coef, e, e)
209 call opgrad(dvxb, dvyb, dvzb, vyb%x, coef, e, e)
210 call opgrad(dwxb, dwyb, dwzb, vzb%x, coef, e, e)
213 idx = (e - 1)*xh%lxyz + 1
216 fx%x(idxx, 1, 1, 1) = fx%x(idxx, 1, 1, 1) - ( &
217 & vx%x(i,1,1,e)*duxb(i) + &
218 & vy%x(i,1,1,e)*dvxb(i) + &
219 & vz%x(i,1,1,e)*dwxb(i) )
221 fy%x(idxx, 1, 1, 1) = fy%x(idxx, 1, 1, 1) - ( &
222 & vx%x(i,1,1,e)*duyb(i) + &
223 & vy%x(i,1,1,e)*dvyb(i) + &
224 & vz%x(i,1,1,e)*dwyb(i))
226 fz%x(idxx, 1, 1, 1) = fz%x(idxx, 1, 1, 1) - ( &
227 & vx%x(i,1,1,e)*duzb(i) + &
228 & vy%x(i,1,1,e)*dvzb(i) + &
229 & vz%x(i,1,1,e)*dwzb(i))
235 & fx%x(:,:,:,e), vx%x(1,1,1,e), &
236 & vxb%x(1,1,1,e), vyb%x(1,1,1,e), vzb%x(1,1,1,e), &
237 & e, coef, xh, xh%lxyz, &
238 & duxb, dvxb, dwxb, duyb, dvyb, dwyb)
241 & fy%x(:,:,:,e), vy%x(1,1,1,e), &
242 & vxb%x(1,1,1,e), vyb%x(1,1,1,e), vzb%x(1,1,1,e), &
243 & e, coef, xh, xh%lxyz, &
244 & duxb, dvxb, dwxb, duyb, dvyb, dwyb)
247 & fz%x(:,:,:,e), vz%x(1,1,1,e), &
248 & vxb%x(1,1,1,e), vyb%x(1,1,1,e), vzb%x(1,1,1,e), &
249 & e, coef, xh, xh%lxyz, &
250 & duxb, dvxb, dwxb, duyb, dvyb, dwyb)
270 n, work1, work2, work3, w1, w2, w3)
271 integer,
intent(in) :: n
272 type(c_ptr),
intent(inout) :: f_d
273 type(c_ptr),
intent(in) :: u_i_d
274 real(kind=rp),
intent(inout),
dimension(n) :: ub, vb, wb
275 type(field_t),
intent(inout) :: w1, w2, w3
276 type(field_t),
intent(inout) :: work1, work2, work3
277 type(space_t),
intent(inout) :: Xh
278 type(coef_t),
intent(inout) :: coef
279 type(c_ptr) :: ub_d, vb_d, wb_d
280 type(c_ptr) :: work1_d, work2_d, work3_d, w1_d, w2_d, w3_d
288 ub_d = device_get_ptr(ub)
289 vb_d = device_get_ptr(vb)
290 wb_d = device_get_ptr(wb)
293 call device_col3(work1_d, u_i_d, ub_d, n)
294 call device_col3(work2_d, u_i_d, vb_d, n)
295 call device_col3(work3_d, u_i_d, wb_d, n)
297 call cdtp(w1%x, work1%x, coef%drdx, coef%dsdx, coef%dtdx, coef)
298 call cdtp(w2%x, work2%x, coef%drdy, coef%dsdy, coef%dtdy, coef)
299 call cdtp(w3%x, work3%x, coef%drdz, coef%dsdz, coef%dtdz, coef)
301 call device_add4(work1_d, w1_d, w2_d, w3_d , n)
302 call device_sub2(f_d, work1_d, n)
369 type(space_t),
intent(inout) :: Xh
370 type(coef_t),
intent(inout) :: coef
371 type(field_t),
intent(inout) :: vx, vy, vz
372 type(field_t),
intent(inout) :: vxb, vyb, vzb
373 integer,
intent(in) :: n
374 type(field_t),
intent(inout) :: fx, fy, fz
375 type(c_ptr) :: fx_d, fy_d, fz_d
377 if (neko_bcknd_device .eq. 1)
then
383 call conv1(this%temp, vx%x, vxb%x, vyb%x, vzb%x, xh, coef)
384 call device_subcol3 (fx_d, coef%B_d, this%temp_d, n)
385 call conv1(this%temp, vxb%x, vx%x, vy%x, vz%x, xh, coef)
386 call device_subcol3 (fx_d, coef%B_d, this%temp_d, n)
389 call conv1(this%temp, vy%x, vxb%x, vyb%x, vzb%x, xh, coef)
390 call device_subcol3 (fy_d, coef%B_d, this%temp_d, n)
391 call conv1(this%temp, vyb%x, vx%x, vy%x, vz%x, xh, coef)
392 call device_subcol3 (fy_d, coef%B_d, this%temp_d, n)
395 if (coef%Xh%lz .eq. 1)
then
396 call device_rzero (this%temp_d, n)
398 call conv1(this%temp, vz%x, vxb%x, vyb%x, vzb%x, xh, coef)
399 call device_subcol3(fz_d, coef%B_d, this%temp_d, n)
400 call conv1(this%temp, vzb%x, vx%x, vy%x, vz%x, xh, coef)
401 call device_subcol3(fz_d, coef%B_d, this%temp_d, n)
405 call conv1(this%temp, vx%x, vxb%x, vyb%x, vzb%x, xh, coef)
406 call subcol3 (fx%x, coef%B, this%temp, n)
407 call conv1(this%temp, vxb%x, vx%x, vy%x, vz%x, xh, coef)
408 call subcol3 (fx%x, coef%B, this%temp, n)
411 call conv1(this%temp, vy%x, vxb%x, vyb%x, vzb%x, xh, coef)
412 call subcol3 (fy%x, coef%B, this%temp, n)
413 call conv1(this%temp, vyb%x, vx%x, vy%x, vz%x, xh, coef)
414 call subcol3 (fy%x, coef%B, this%temp, n)
417 if (coef%Xh%lz .eq. 1)
then
418 call rzero (this%temp, n)
420 call conv1(this%temp, vz%x, vxb%x, vyb%x, vzb%x, xh, coef)
421 call subcol3(fz%x, coef%B, this%temp, n)
422 call conv1(this%temp, vzb%x, vx%x, vy%x, vz%x, xh, coef)
423 call subcol3(fz%x, coef%B, this%temp, n)