Neko 1.99.2
A portable framework for high-order spectral element flow simulations
Loading...
Searching...
No Matches
centrifugal_source_term_device.f90
Go to the documentation of this file.
1! Copyright (c) 2025, The Neko Authors
2! All rights reserved.
3!
4! Redistribution and use in source and binary forms, with or without
5! modification, are permitted provided that the following conditions
6! are met:
7!
8! * Redistributions of source code must retain the above copyright
9! notice, this list of conditions and the following disclaimer.
10!
11! * Redistributions in binary form must reproduce the above
12! copyright notice, this list of conditions and the following
13! disclaimer in the documentation and/or other materials provided
14! with the distribution.
15!
16! * Neither the name of the authors nor the names of its
17! contributors may be used to endorse or promote products derived
18! from this software without specific prior written permission.
19!
20! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21! "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22! LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23! FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24! COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25! INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26! BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27! LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28! CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29! LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
30! ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31! POSSIBILITY OF SUCH DAMAGE.
32!
34
36 use num_types, only : rp
37 use field_list, only : field_list_t
38 use field, only : field_t
39 use dofmap, only : dofmap_t
42 implicit none
43 private
44
46
47contains
48
53 subroutine centrifugal_source_term_compute_device(omega, ref_point, fields)
54 real(kind=rp), intent(in) :: omega(3)
55 real(kind=rp), intent(in) :: ref_point(3)
56 type(field_list_t), intent(inout) :: fields
57 type(dofmap_t), pointer :: dof
58 integer :: n
59 type(field_t), pointer :: fu, fv, fw
60 integer :: tmp_index(6)
61 type(field_t), pointer :: tmp_rx, tmp_ry, tmp_rz
62 type(field_t), pointer :: tmp_cx, tmp_cy, tmp_cz
63
64 dof => fields%dof(1)
65 n = fields%item_size(1)
66
67 fu => fields%get_by_index(1)
68 fv => fields%get_by_index(2)
69 fw => fields%get_by_index(3)
70
71 call neko_scratch_registry%request_field(tmp_rx, tmp_index(1), .false.)
72 call neko_scratch_registry%request_field(tmp_ry, tmp_index(2), .false.)
73 call neko_scratch_registry%request_field(tmp_rz, tmp_index(3), .false.)
74 call neko_scratch_registry%request_field(tmp_cx, tmp_index(4), .false.)
75 call neko_scratch_registry%request_field(tmp_cy, tmp_index(5), .false.)
76 call neko_scratch_registry%request_field(tmp_cz, tmp_index(6), .false.)
77
78 ! displacement with respect to reference point
79 call device_cadd2(tmp_rx%x_d, dof%x_d, -ref_point(1), n)
80 call device_cadd2(tmp_ry%x_d, dof%y_d, -ref_point(2), n)
81 call device_cadd2(tmp_rz%x_d, dof%z_d, -ref_point(3), n)
82
83 ! Omega x r
84 call device_add3s2(tmp_cx%x_d, tmp_rz%x_d, tmp_ry%x_d, omega(2), &
85 -omega(3), n)
86 call device_add3s2(tmp_cy%x_d, tmp_rx%x_d, tmp_rz%x_d, omega(3), &
87 -omega(1), n)
88 call device_add3s2(tmp_cz%x_d, tmp_ry%x_d, tmp_rx%x_d, omega(1), &
89 -omega(2), n)
90
91 ! - Omega x (Omega x r)
92 call device_add3s2(tmp_rx%x_d, tmp_cz%x_d, tmp_cy%x_d, -omega(2), &
93 omega(3), n)
94 call device_add3s2(tmp_ry%x_d, tmp_cx%x_d, tmp_cz%x_d, -omega(3), &
95 omega(1), n)
96 call device_add3s2(tmp_rz%x_d, tmp_cy%x_d, tmp_cx%x_d, -omega(1), &
97 omega(2), n)
98
99 ! Add the centrifugal term to the RHS
100 call device_add2(fu%x_d, tmp_rx%x_d, n)
101 call device_add2(fv%x_d, tmp_ry%x_d, n)
102 call device_add2(fw%x_d, tmp_rz%x_d, n)
103
104 call neko_scratch_registry%relinquish_field(tmp_index)
105
107
Implements the device kernel for the centrifugal_source_term_t type.
subroutine, public centrifugal_source_term_compute_device(omega, ref_point, fields)
Computes the centrifugal source term on the device.
subroutine, public device_add2(a_d, b_d, n, strm)
Vector addition .
subroutine, public device_add3s2(a_d, b_d, c_d, c1, c2, n, strm)
Returns .
subroutine, public device_cadd2(a_d, b_d, c, n, strm)
Add a scalar to vector .
Defines a mapping of the degrees of freedom.
Definition dofmap.f90:35
Defines a field.
Definition field.f90:34
integer, parameter, public rp
Global precision used in computations.
Definition num_types.f90:12
Defines a registry for storing and requesting temporary objects This can be used when you have a func...
type(scratch_registry_t), target, public neko_scratch_registry
Global scratch registry.
field_list_t, To be able to group fields together