Neko 1.99.3
A portable framework for high-order spectral element flow simulations
Loading...
Searching...
No Matches
mathops.f90
Go to the documentation of this file.
1! Copyright (c) 2008-2020, UCHICAGO ARGONNE, LLC.
2!
3! The UChicago Argonne, LLC as Operator of Argonne National
4! Laboratory holds copyright in the Software. The copyright holder
5! reserves all rights except those expressly granted to licensees,
6! and U.S. Government license rights.
7!
8! Redistribution and use in source and binary forms, with or without
9! modification, are permitted provided that the following conditions
10! are met:
11!
12! 1. Redistributions of source code must retain the above copyright
13! notice, this list of conditions and the disclaimer below.
14!
15! 2. Redistributions in binary form must reproduce the above copyright
16! notice, this list of conditions and the disclaimer (as noted below)
17! in the documentation and/or other materials provided with the
18! distribution.
19!
20! 3. Neither the name of ANL nor the names of its contributors
21! may be used to endorse or promote products derived from this software
22! without specific prior written permission.
23!
24! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25! "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26! LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
27! FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
28! UCHICAGO ARGONNE, LLC, THE U.S. DEPARTMENT OF
29! ENERGY OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
30! SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
31! TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
32! DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
33! THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
34! (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
35! OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
36!
37! Additional BSD Notice
38! ---------------------
39! 1. This notice is required to be provided under our contract with
40! the U.S. Department of Energy (DOE). This work was produced at
41! Argonne National Laboratory under Contract
42! No. DE-AC02-06CH11357 with the DOE.
43!
44! 2. Neither the United States Government nor UCHICAGO ARGONNE,
45! LLC nor any of their employees, makes any warranty,
46! express or implied, or assumes any liability or responsibility for the
47! accuracy, completeness, or usefulness of any information, apparatus,
48! product, or process disclosed, or represents that its use would not
49! infringe privately-owned rights.
50!
51! 3. Also, reference herein to any specific commercial products, process,
52! or services by trade name, trademark, manufacturer or otherwise does
53! not necessarily constitute or imply its endorsement, recommendation,
54! or favoring by the United States Government or UCHICAGO ARGONNE LLC.
55! The views and opinions of authors expressed
56! herein do not necessarily state or reflect those of the United States
57! Government or UCHICAGO ARGONNE, LLC, and shall
58! not be used for advertising or product endorsement purposes.
59!
60
64
65module mathops
66 use num_types, only : rp
67 implicit none
68 private
69
71
72contains
73
75 subroutine opchsign(a1, a2, a3, gdim, n)
76 integer, intent(in) :: n, gdim
77 real(kind=rp), dimension(n), intent(inout) :: a1, a2, a3
78 integer :: i
79
80 if (gdim .eq. 3) then
81 !$omp parallel do
82 do i = 1, n
83 a1(i) = -a1(i)
84 a2(i) = -a2(i)
85 a3(i) = -a3(i)
86 end do
87 !$omp end parallel do
88 else
89 !$omp parallel do
90 do i = 1, n
91 a1(i) = -a1(i)
92 a2(i) = -a2(i)
93 end do
94 !$omp end parallel do
95 end if
96
97 end subroutine opchsign
98
100 subroutine opcolv(a1, a2, a3, c, gdim, n)
101 integer, intent(in) :: n, gdim
102 real(kind=rp), dimension(n), intent(inout) :: a1, a2, a3
103 real(kind=rp), dimension(n), intent(in) :: c
104 integer :: i
105
106 if (gdim .eq. 3) then
107 !$omp parallel do
108 do i = 1, n
109 a1(i) = a1(i)*c(i)
110 a2(i) = a2(i)*c(i)
111 a3(i) = a3(i)*c(i)
112 end do
113 !$omp end parallel do
114 else
115 !$omp parallel do
116 do i = 1,n
117 a1(i) = a1(i)*c(i)
118 a2(i) = a2(i)*c(i)
119 end do
120 !$omp end parallel do
121 end if
122
123 end subroutine opcolv
124
126 subroutine opcolv3c(a1, a2, a3, b1, b2, b3, c, d, n, gdim)
127 integer, intent(in) :: n, gdim
128 real(kind=rp), dimension(n), intent(inout) :: a1, a2, a3
129 real(kind=rp), dimension(n), intent(in) :: b1, b2, b3
130 real(kind=rp), intent(in) :: c(n), d
131 integer :: i
132
133 if (gdim .eq. 3) then
134 !$omp parallel do
135 do i = 1, n
136 a1(i) = b1(i)*c(i)*d
137 a2(i) = b2(i)*c(i)*d
138 a3(i) = b3(i)*c(i)*d
139 end do
140 !$omp end parallel do
141 else
142 !$omp parallel do
143 do i = 1, n
144 a1(i) = b1(i)*c(i)*d
145 a2(i) = b2(i)*c(i)*d
146 end do
147 !$omp end parallel do
148 end if
149
150 end subroutine opcolv3c
151
153 subroutine opadd2cm(a1, a2, a3, b1, b2, b3, c, n, gdim)
154 integer, intent(in) :: n, gdim
155 real(kind=rp), dimension(n), intent(inout) :: a1, a2, a3
156 real(kind=rp), dimension(n), intent(in) :: b1, b2, b3
157 real(kind=rp), intent(in) :: c
158 integer :: i
159
160 if (gdim .eq. 3) then
161 !$omp parallel do
162 do i = 1, n
163 a1(i) = a1(i) + b1(i)*c
164 a2(i) = a2(i) + b2(i)*c
165 a3(i) = a3(i) + b3(i)*c
166 end do
167 !$omp end parallel do
168 else
169 !$omp parallel do
170 do i = 1, n
171 a1(i) = a1(i) + b1(i)*c
172 a2(i) = a2(i) + b2(i)*c
173 end do
174 !$omp end parallel do
175 end if
176
177 end subroutine opadd2cm
178
180 subroutine opadd2col(a1, a2, a3, b1, b2, b3, c, n, gdim)
181 integer, intent(in) :: n, gdim
182 real(kind=rp), dimension(n), intent(inout) :: a1, a2, a3
183 real(kind=rp), dimension(n), intent(in) :: b1, b2, b3
184 real(kind=rp), intent(in) :: c(n)
185 integer :: i
186
187 if (gdim .eq. 3) then
188 !$omp parallel do
189 do i = 1, n
190 a1(i) = a1(i) + b1(i)*c(i)
191 a2(i) = a2(i) + b2(i)*c(i)
192 a3(i) = a3(i) + b3(i)*c(i)
193 end do
194 !$omp end parallel do
195 else
196 !$omp parallel do
197 do i = 1, n
198 a1(i) = a1(i) + b1(i)*c(i)
199 a2(i) = a2(i) + b2(i)*c(i)
200 end do
201 !$omp end parallel do
202 end if
203
204 end subroutine opadd2col
205
206end module mathops
Collection of vector field operations operating on and . Note that in general the indices and ....
Definition mathops.f90:65
subroutine, public opcolv(a1, a2, a3, c, gdim, n)
Definition mathops.f90:101
subroutine, public opadd2col(a1, a2, a3, b1, b2, b3, c, n, gdim)
Definition mathops.f90:181
subroutine, public opchsign(a1, a2, a3, gdim, n)
for and .
Definition mathops.f90:76
subroutine, public opadd2cm(a1, a2, a3, b1, b2, b3, c, n, gdim)
Definition mathops.f90:154
subroutine, public opcolv3c(a1, a2, a3, b1, b2, b3, c, d, n, gdim)
Definition mathops.f90:127
integer, parameter, public rp
Global precision used in computations.
Definition num_types.f90:12