Neko 1.99.5
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
66
67module mathops
68 use num_types, only : rp
69 implicit none
70 private
71
73
74contains
75
77 subroutine opchsign(a1, a2, a3, gdim, n)
78 integer, intent(in) :: n, gdim
79 real(kind=rp), dimension(n), intent(inout) :: a1, a2, a3
80 integer :: i
81
82 if (gdim .eq. 3) then
83 !$omp parallel do
84 do i = 1, n
85 a1(i) = -a1(i)
86 a2(i) = -a2(i)
87 a3(i) = -a3(i)
88 end do
89 !$omp end parallel do
90 else
91 !$omp parallel do
92 do i = 1, n
93 a1(i) = -a1(i)
94 a2(i) = -a2(i)
95 end do
96 !$omp end parallel do
97 end if
98
99 end subroutine opchsign
100
102 subroutine opcolv(a1, a2, a3, c, gdim, n)
103 integer, intent(in) :: n, gdim
104 real(kind=rp), dimension(n), intent(inout) :: a1, a2, a3
105 real(kind=rp), dimension(n), intent(in) :: c
106 integer :: i
107
108 if (gdim .eq. 3) then
109 !$omp parallel do
110 do i = 1, n
111 a1(i) = a1(i)*c(i)
112 a2(i) = a2(i)*c(i)
113 a3(i) = a3(i)*c(i)
114 end do
115 !$omp end parallel do
116 else
117 !$omp parallel do
118 do i = 1,n
119 a1(i) = a1(i)*c(i)
120 a2(i) = a2(i)*c(i)
121 end do
122 !$omp end parallel do
123 end if
124
125 end subroutine opcolv
126
128 subroutine opcolv3c(a1, a2, a3, b1, b2, b3, c, d, n, gdim)
129 integer, intent(in) :: n, gdim
130 real(kind=rp), dimension(n), intent(inout) :: a1, a2, a3
131 real(kind=rp), dimension(n), intent(in) :: b1, b2, b3
132 real(kind=rp), intent(in) :: c(n), d
133 integer :: i
134
135 if (gdim .eq. 3) then
136 !$omp parallel do
137 do i = 1, n
138 a1(i) = b1(i)*c(i)*d
139 a2(i) = b2(i)*c(i)*d
140 a3(i) = b3(i)*c(i)*d
141 end do
142 !$omp end parallel do
143 else
144 !$omp parallel do
145 do i = 1, n
146 a1(i) = b1(i)*c(i)*d
147 a2(i) = b2(i)*c(i)*d
148 end do
149 !$omp end parallel do
150 end if
151
152 end subroutine opcolv3c
153
155 subroutine opadd2cm(a1, a2, a3, b1, b2, b3, c, n, gdim)
156 integer, intent(in) :: n, gdim
157 real(kind=rp), dimension(n), intent(inout) :: a1, a2, a3
158 real(kind=rp), dimension(n), intent(in) :: b1, b2, b3
159 real(kind=rp), intent(in) :: c
160 integer :: i
161
162 if (gdim .eq. 3) then
163 !$omp parallel do
164 do i = 1, n
165 a1(i) = a1(i) + b1(i)*c
166 a2(i) = a2(i) + b2(i)*c
167 a3(i) = a3(i) + b3(i)*c
168 end do
169 !$omp end parallel do
170 else
171 !$omp parallel do
172 do i = 1, n
173 a1(i) = a1(i) + b1(i)*c
174 a2(i) = a2(i) + b2(i)*c
175 end do
176 !$omp end parallel do
177 end if
178
179 end subroutine opadd2cm
180
182 subroutine opadd2col(a1, a2, a3, b1, b2, b3, c, n, gdim)
183 integer, intent(in) :: n, gdim
184 real(kind=rp), dimension(n), intent(inout) :: a1, a2, a3
185 real(kind=rp), dimension(n), intent(in) :: b1, b2, b3
186 real(kind=rp), intent(in) :: c(n)
187 integer :: i
188
189 if (gdim .eq. 3) then
190 !$omp parallel do
191 do i = 1, n
192 a1(i) = a1(i) + b1(i)*c(i)
193 a2(i) = a2(i) + b2(i)*c(i)
194 a3(i) = a3(i) + b3(i)*c(i)
195 end do
196 !$omp end parallel do
197 else
198 !$omp parallel do
199 do i = 1, n
200 a1(i) = a1(i) + b1(i)*c(i)
201 a2(i) = a2(i) + b2(i)*c(i)
202 end do
203 !$omp end parallel do
204 end if
205
206 end subroutine opadd2col
207
208end module mathops
Collection of vector field operations operating on and . Note that in general the indices and ....
Definition mathops.f90:67
subroutine, public opcolv(a1, a2, a3, c, gdim, n)
Definition mathops.f90:103
subroutine, public opadd2col(a1, a2, a3, b1, b2, b3, c, n, gdim)
Definition mathops.f90:183
subroutine, public opchsign(a1, a2, a3, gdim, n)
for and .
Definition mathops.f90:78
subroutine, public opadd2cm(a1, a2, a3, b1, b2, b3, c, n, gdim)
Definition mathops.f90:156
subroutine, public opcolv3c(a1, a2, a3, b1, b2, b3, c, d, n, gdim)
Definition mathops.f90:129
integer, parameter, public rp
Global precision used in computations.
Definition num_types.f90:12