Neko 0.9.99
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 do i = 1, n
82 a1(i) = -a1(i)
83 a2(i) = -a2(i)
84 a3(i) = -a3(i)
85 end do
86 else
87 do i = 1, n
88 a1(i) = -a1(i)
89 a2(i) = -a2(i)
90 end do
91 end if
92
93 end subroutine opchsign
94
96 subroutine opcolv(a1, a2, a3, c, gdim, n)
97 integer, intent(in) :: n, gdim
98 real(kind=rp), dimension(n), intent(inout) :: a1, a2, a3
99 real(kind=rp), dimension(n), intent(in) :: c
100 integer :: i
101
102 if (gdim .eq. 3) then
103 do i = 1, n
104 a1(i) = a1(i)*c(i)
105 a2(i) = a2(i)*c(i)
106 a3(i) = a3(i)*c(i)
107 end do
108 else
109 do i = 1, n
110 a1(i) = a1(i)*c(i)
111 a2(i) = a2(i)*c(i)
112 end do
113 end if
114
115 end subroutine opcolv
116
118 subroutine opcolv3c(a1, a2, a3, b1, b2, b3, c, d, n, gdim)
119 integer, intent(in) :: n, gdim
120 real(kind=rp), dimension(n), intent(inout) :: a1, a2, a3
121 real(kind=rp), dimension(n), intent(in) :: b1, b2, b3
122 real(kind=rp), intent(in) :: c(n), d
123 integer :: i
124
125 if (gdim .eq. 3) then
126 do i = 1, n
127 a1(i) = b1(i)*c(i)*d
128 a2(i) = b2(i)*c(i)*d
129 a3(i) = b3(i)*c(i)*d
130 end do
131 else
132 do i = 1, n
133 a1(i) = b1(i)*c(i)*d
134 a2(i) = b2(i)*c(i)*d
135 end do
136 end if
137
138 end subroutine opcolv3c
139
141 subroutine opadd2cm(a1, a2, a3, b1, b2, b3, c, n, gdim)
142 integer, intent(in) :: n, gdim
143 real(kind=rp), dimension(n), intent(inout) :: a1, a2, a3
144 real(kind=rp), dimension(n), intent(in) :: b1, b2, b3
145 real(kind=rp), intent(in) :: c
146 integer :: i
147
148 if (gdim .eq. 3) then
149 do i = 1, n
150 a1(i) = a1(i) + b1(i)*c
151 a2(i) = a2(i) + b2(i)*c
152 a3(i) = a3(i) + b3(i)*c
153 end do
154 else
155 do i = 1, n
156 a1(i) = a1(i) + b1(i)*c
157 a2(i) = a2(i) + b2(i)*c
158 end do
159 end if
160
161 end subroutine opadd2cm
162
164 subroutine opadd2col(a1, a2, a3, b1, b2, b3, c, n, gdim)
165 integer, intent(in) :: n, gdim
166 real(kind=rp), dimension(n), intent(inout) :: a1, a2, a3
167 real(kind=rp), dimension(n), intent(in) :: b1, b2, b3
168 real(kind=rp), intent(in) :: c(n)
169 integer :: i
170
171 if (gdim .eq. 3) then
172 do i = 1, n
173 a1(i) = a1(i) + b1(i)*c(i)
174 a2(i) = a2(i) + b2(i)*c(i)
175 a3(i) = a3(i) + b3(i)*c(i)
176 end do
177 else
178 do i = 1, n
179 a1(i) = a1(i) + b1(i)*c(i)
180 a2(i) = a2(i) + b2(i)*c(i)
181 end do
182 end if
183
184 end subroutine opadd2col
185
186end 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:97
subroutine, public opadd2col(a1, a2, a3, b1, b2, b3, c, n, gdim)
Definition mathops.f90:165
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:142
subroutine, public opcolv3c(a1, a2, a3, b1, b2, b3, c, d, n, gdim)
Definition mathops.f90:119
integer, parameter, public rp
Global precision used in computations.
Definition num_types.f90:12