63 use mpi_f08,
only : mpi_min, mpi_max, mpi_sum, mpi_in_place, mpi_integer, &
70 real(kind=
rp),
public,
parameter ::
neko_eps = epsilon(1.0_rp)
76 real(kind=
rp),
public,
parameter ::
pi = 4._rp*atan(1._rp)
104 vcross,
vdot2,
vdot3,
vlsc3,
vlsc2,
add2,
add3,
add4,
sub2,
sub3, &
120 real(kind=
sp),
intent(in) :: x
121 real(kind=
sp),
intent(in) :: y
122 real(kind=
sp),
intent(in),
optional :: tol
125 if (
present(tol))
then
135 real(kind=
dp),
intent(in) :: x
136 real(kind=
dp),
intent(in) :: y
137 real(kind=
dp),
intent(in),
optional :: tol
140 if (
present(tol))
then
150 real(kind=
qp),
intent(in) :: x
151 real(kind=
qp),
intent(in) :: y
152 real(kind=
qp),
intent(in),
optional :: tol
155 if (
present(tol))
then
165 real(kind=
sp),
intent(in) :: x
166 real(kind=
sp),
intent(in) :: y
167 real(kind=
sp),
intent(in),
optional :: eps
169 if (
present(eps))
then
170 srelcmp = abs(x - y) .le. eps*abs(y)
179 real(kind=
dp),
intent(in) :: x
180 real(kind=
dp),
intent(in) :: y
181 real(kind=
dp),
intent(in),
optional :: eps
183 if (
present(eps))
then
184 drelcmp = abs(x - y) .le. eps*abs(y)
194 real(kind=
qp),
intent(in) :: x
195 real(kind=
qp),
intent(in) :: y
196 real(kind=
qp),
intent(in),
optional :: eps
198 if (
present(eps))
then
199 qrelcmp = abs(x - y)/abs(y) .lt. eps
212 real(kind=
rp),
intent(in) :: x
213 integer,
intent(in) :: niter
218 if (x == 0.0_rp)
then
223 a = 1.0_rp / (1.0_rp + 0.5_rp * log(1.0_rp + x))
224 w = log(1.0_rp + a * x)
226 do k = 1,
max(niter, 0)
227 w = w / (1.0_rp + w) * (1.0_rp + log(x / w))
233 integer,
intent(in) :: n
234 real(kind=
rp),
dimension(n),
intent(inout) :: a
247 integer,
intent(in) :: n
248 integer,
dimension(n),
intent(inout) :: a
261 integer,
intent(in) :: m, n, e
262 real(kind=
rp),
intent(inout) :: a(m,n)
275 integer,
intent(in) :: n
276 real(kind=
rp),
dimension(n),
intent(inout) :: a
289 integer,
intent(in) :: n
290 real(kind=
rp),
dimension(n),
intent(in) :: b
291 real(kind=
rp),
dimension(n),
intent(inout) :: a
310 integer,
intent(in) :: n, n_mask
311 real(kind=
rp),
dimension(n),
intent(in) :: b
312 real(kind=
rp),
dimension(n),
intent(inout) :: a
313 integer,
dimension(0:n_mask) ::
mask
333 integer,
intent(in) :: n, n_mask
334 real(kind=
rp),
dimension(n),
intent(in) :: b
335 real(kind=
rp),
dimension(n),
intent(inout) :: a
336 integer,
dimension(n_mask) ::
mask
358 integer,
intent(in) :: n, n_mask
359 real(kind=
rp),
dimension(n),
intent(in) :: b
360 real(kind=
rp),
dimension(n_mask),
intent(inout) :: a
361 integer,
dimension(0:n_mask) ::
mask
383 integer,
intent(in) :: lx, ly, lz, n_mask
384 real(kind=
rp),
dimension(n_mask),
intent(inout) :: a
385 real(kind=
rp),
dimension(:, :, :, :),
intent(in) :: b
386 integer,
dimension(0:n_mask),
intent(in) ::
mask
387 integer,
dimension(0:n_mask),
intent(in) :: facet
395 select case (facet(l))
397 a(l) = b(idx(2), idx(3), facet(l), idx(4))
399 a(l) = b(idx(1), idx(3), facet(l), idx(4))
401 a(l) = b(idx(1), idx(2), facet(l), idx(4))
418 integer,
intent(in) :: n, n_mask
419 real(kind=
rp),
dimension(n),
intent(in) :: b
420 real(kind=
rp),
dimension(n_mask),
intent(inout) :: a
421 integer,
dimension(n_mask) ::
mask
443 integer,
intent(in) :: n, n_mask
444 real(kind=
rp),
dimension(n_mask),
intent(in) :: b
445 real(kind=
rp),
dimension(n),
intent(inout) :: a
446 integer,
dimension(0:n_mask) ::
mask
468 integer,
intent(in) :: n, n_mask
469 real(kind=
rp),
dimension(n_mask),
intent(in) :: b
470 real(kind=
rp),
dimension(n),
intent(inout) :: a
471 integer,
dimension(n_mask) ::
mask
486 integer,
intent(in) :: n, n_mask
487 real(kind=
rp),
dimension(n),
intent(inout) :: a
488 real(kind=
rp),
intent(in) :: c
489 integer,
dimension(n_mask),
intent(in) ::
mask
502 integer,
intent(in) :: n
503 real(kind=
rp),
dimension(n),
intent(inout) :: a
504 real(kind=
rp),
intent(in) :: c
517 integer,
intent(in) :: n
518 real(kind=
rp),
dimension(n),
intent(inout) :: a
519 real(kind=
rp),
dimension(n),
intent(in) :: b
520 real(kind=
rp),
intent(in) :: c
533 integer,
intent(in) :: n
534 real(kind=
rp),
dimension(n),
intent(inout) :: a
535 real(kind=
rp),
intent(in) :: c
548 integer,
intent(in) :: n
549 real(kind=
rp),
dimension(n),
intent(inout) :: a
550 real(kind=
rp),
dimension(n),
intent(in) :: b
551 real(kind=
rp),
intent(in) :: c
564 integer,
intent(in) :: n
565 real(kind=
rp),
dimension(n),
intent(inout) :: a
566 real(kind=
rp),
intent(in) :: s
579 integer,
intent(in) :: n
580 real(kind=
rp),
dimension(n),
intent(inout) :: a
581 real(kind=
rp),
dimension(n),
intent(in) :: b
582 real(kind=
rp),
intent(in) :: s
595 integer,
intent(in) :: n
596 real(kind=
rp),
dimension(n),
intent(inout) :: a
597 real(kind=
rp),
intent(in) :: c
609 subroutine cwrap(a, min_val, max_val, n)
610 integer,
intent(in) :: n
611 real(kind=
rp),
dimension(n),
intent(inout) :: a
612 real(kind=
rp),
intent(in) :: min_val, max_val
615 if (n .lt. 1 .or. max_val .le. min_val)
return
619 a(i) = modulo(a(i) - min_val, max_val - min_val) + min_val
627 integer,
intent(in) :: n
628 real(kind=
rp),
dimension(n) :: a
640 call mpi_allreduce(mpi_in_place, tmp, 1, &
648 integer,
intent(in) :: n
649 real(kind=
rp),
dimension(n) :: a
660 call mpi_allreduce(tmp,
glmax, 1, &
667 integer,
intent(in) :: n
668 integer,
dimension(n) :: a
679 call mpi_allreduce(tmp,
glimax, 1, &
686 integer,
intent(in) :: n
687 real(kind=
rp),
dimension(n) :: a
698 call mpi_allreduce(tmp,
glmin, 1, &
705 integer,
intent(in) :: n
706 integer,
dimension(n) :: a
717 call mpi_allreduce(tmp,
glimin, 1, &
724 integer,
intent(in) :: n
725 real(kind=
rp),
dimension(n),
intent(inout) :: a
739 real(kind=
rp),
intent(in) :: vec(n)
740 real(kind=
rp) :: tmax
745 tmax =
max(tmax, vec(i))
753 integer,
intent(in) :: n
754 real(kind=
rp),
intent(in) :: vec(n)
755 real(kind=
rp) :: tmin
761 tmin = min(tmin, vec(i))
769 integer,
intent(in) :: n
770 real(kind=
rp),
dimension(n),
intent(inout) :: a
775 a(i) = 1.0_xp /
real(a(i),
xp)
783 integer,
intent(in) :: n
784 real(kind=
rp),
dimension(n),
intent(inout) :: a
785 real(kind=
rp),
dimension(n),
intent(in) :: b, c
790 a(i) =
real(b(i),
xp) / c(i)
798 integer,
intent(in) :: n
799 real(kind=
rp),
dimension(n),
intent(inout) :: a
800 real(kind=
rp),
dimension(n),
intent(in) :: b
805 a(i) = 1.0_xp /
real(b(i),
xp)
813 subroutine vcross(u1, u2, u3, v1, v2, v3, w1, w2, w3, n)
814 integer,
intent(in) :: n
815 real(kind=
rp),
dimension(n),
intent(in) :: v1, v2, v3
816 real(kind=
rp),
dimension(n),
intent(in) :: w1, w2, w3
817 real(kind=
rp),
dimension(n),
intent(out) :: u1, u2, u3
822 u1(i) = v2(i)*w3(i) - v3(i)*w2(i)
823 u2(i) = v3(i)*w1(i) - v1(i)*w3(i)
824 u3(i) = v1(i)*w2(i) - v2(i)*w1(i)
832 subroutine vdot2(dot, u1, u2, v1, v2, n)
833 integer,
intent(in) :: n
834 real(kind=
rp),
dimension(n),
intent(in) :: u1, u2
835 real(kind=
rp),
dimension(n),
intent(in) :: v1, v2
836 real(kind=
rp),
dimension(n),
intent(out) :: dot
841 dot(i) = u1(i)*v1(i) + u2(i)*v2(i)
849 subroutine vdot3(dot, u1, u2, u3, v1, v2, v3, n)
850 integer,
intent(in) :: n
851 real(kind=
rp),
dimension(n),
intent(in) :: u1, u2, u3
852 real(kind=
rp),
dimension(n),
intent(in) :: v1, v2, v3
853 real(kind=
rp),
dimension(n),
intent(out) :: dot
858 dot(i) = u1(i)*v1(i) + u2(i)*v2(i) + u3(i)*v3(i)
865 function vlsc3(u, v, w, n)
result(s)
866 integer,
intent(in) :: n
867 real(kind=
rp),
dimension(n),
intent(in) :: u, v, w
874 s = s + u(i)*v(i)*w(i)
882 integer,
intent(in) :: n
883 real(kind=
rp),
dimension(n),
intent(in) :: u, v
898 integer,
intent(in) :: n
899 real(kind=
rp),
dimension(n),
intent(inout) :: a
900 real(kind=
rp),
dimension(n),
intent(in) :: b
913 integer,
intent(in) :: n
914 real(kind=
rp),
dimension(n),
intent(inout) :: a
915 real(kind=
rp),
dimension(n),
intent(in) :: b
916 real(kind=
rp),
dimension(n),
intent(in) :: c
929 integer,
intent(in) :: n
930 real(kind=
rp),
dimension(n),
intent(out) :: a
931 real(kind=
rp),
dimension(n),
intent(in) :: d
932 real(kind=
rp),
dimension(n),
intent(in) :: c
933 real(kind=
rp),
dimension(n),
intent(in) :: b
938 a(i) = b(i) + c(i) + d(i)
946 integer,
intent(in) :: n
947 real(kind=
rp),
dimension(n),
intent(inout) :: a
948 real(kind=
rp),
dimension(n),
intent(in) :: b
961 integer,
intent(in) :: n
962 real(kind=
rp),
dimension(n),
intent(inout) :: a
963 real(kind=
rp),
dimension(n),
intent(in) :: b
964 real(kind=
rp),
dimension(n),
intent(in) :: c
979 integer,
intent(in) :: n
980 real(kind=
rp),
dimension(n),
intent(inout) :: a
981 real(kind=
rp),
dimension(n),
intent(in) :: b
982 real(kind=
rp),
intent(in) :: c1
987 a(i) = c1 * a(i) + b(i)
996 integer,
intent(in) :: n
997 real(kind=
rp),
dimension(n),
intent(inout) :: a
998 real(kind=
rp),
dimension(n),
intent(in) :: b
999 real(kind=
rp),
intent(in) :: c1
1004 a(i) = a(i) + c1 * b(i)
1012 integer,
intent(in) :: n
1013 real(kind=
rp),
dimension(n),
intent(inout) :: a
1014 real(kind=
rp),
dimension(n),
intent(in) :: b
1015 real(kind=
rp),
intent(in) :: c1
1020 a(i) = a(i) + c1 * ( b(i) * b(i) )
1028 integer,
intent(in) :: n
1029 real(kind=
rp),
dimension(n),
intent(inout) :: a
1030 real(kind=
rp),
dimension(n),
intent(in) :: b
1035 a(i) =
real(a(i),
xp) / b(i)
1044 integer,
intent(in) :: n
1045 real(kind=
rp),
dimension(n),
intent(inout) :: a
1046 real(kind=
rp),
dimension(n),
intent(in) :: b
1059 integer,
intent(in) :: n
1060 real(kind=
rp),
dimension(n),
intent(inout) :: a
1061 real(kind=
rp),
dimension(n),
intent(in) :: b
1062 real(kind=
rp),
dimension(n),
intent(in) :: c
1075 integer,
intent(in) :: n
1076 real(kind=
rp),
dimension(n),
intent(inout) :: a
1077 real(kind=
rp),
dimension(n),
intent(in) :: b
1078 real(kind=
rp),
dimension(n),
intent(in) :: c
1083 a(i) = a(i) - b(i) * c(i)
1091 integer,
intent(in) :: n
1092 real(kind=
rp),
dimension(n),
intent(inout) :: a
1093 real(kind=
rp),
dimension(n),
intent(in) :: b
1094 real(kind=
rp),
dimension(n),
intent(in) :: c
1095 real(kind=
rp),
intent(in) :: c1, c2
1100 a(i) = c1 * b(i) + c2 * c(i)
1108 integer,
intent(in) :: n
1109 real(kind=
rp),
dimension(n),
intent(inout) :: a
1110 real(kind=
rp),
dimension(n),
intent(in) :: b
1111 real(kind=
rp),
dimension(n),
intent(in) :: c
1112 real(kind=
rp),
dimension(n),
intent(in) :: d
1113 real(kind=
rp),
intent(in) :: c1, c2, c3
1118 a(i) = c1 * b(i) + c2 * c(i) + c3 * d(i)
1125 subroutine add5s4(a, b, c, d, e, c1, c2, c3, c4, n)
1126 integer,
intent(in) :: n
1127 real(kind=
rp),
dimension(n),
intent(inout) :: a
1128 real(kind=
rp),
dimension(n),
intent(in) :: b
1129 real(kind=
rp),
dimension(n),
intent(in) :: c
1130 real(kind=
rp),
dimension(n),
intent(in) :: d
1131 real(kind=
rp),
dimension(n),
intent(in) :: e
1132 real(kind=
rp),
intent(in) :: c1, c2, c3, c4
1137 a(i) = a(i) + c1 * b(i) + c2 * c(i) + c3 * d(i) + c4 * e(i)
1145 integer,
intent(in) :: n
1146 real(kind=
rp),
dimension(n),
intent(inout) :: a
1147 real(kind=
rp),
dimension(n),
intent(in) :: b
1148 real(kind=
rp),
dimension(n),
intent(in) :: c
1149 real(kind=
rp),
dimension(n),
intent(in) :: d
1154 a(i) = a(i) - b(i) * c(i) * d(i)
1162 integer,
intent(in) :: n
1163 real(kind=
rp),
dimension(n),
intent(inout) :: a
1164 real(kind=
rp),
dimension(n),
intent(in) :: b
1165 real(kind=
rp),
dimension(n),
intent(in) :: c
1170 a(i) = a(i) + b(i) * c(i)
1178 integer,
intent(in) :: n
1179 real(kind=
rp),
dimension(n),
intent(inout) :: a
1180 real(kind=
rp),
dimension(n),
intent(in) :: b
1181 real(kind=
rp),
dimension(n),
intent(in) :: c
1182 real(kind=
rp),
dimension(n),
intent(in) :: d
1187 a(i) = a(i) + b(i) * c(i) * d(i)
1195 integer,
intent(in) :: n
1196 real(kind=
rp),
dimension(n),
intent(inout) :: a
1197 real(kind=
rp),
dimension(n),
intent(in) :: b
1198 real(kind=
rp),
dimension(n),
intent(in) :: c
1199 real(kind=
rp),
intent(in) :: s
1204 a(i) = a(i) + s * b(i) * c(i)
1212 integer,
intent(in) :: n
1213 real(kind=
rp),
dimension(n),
intent(inout) :: a
1214 real(kind=
rp),
dimension(n),
intent(in) :: b
1215 real(kind=
rp),
dimension(n),
intent(in) :: c
1216 real(kind=
rp),
dimension(n),
intent(in) :: d
1217 real(kind=
rp),
dimension(n),
intent(in) :: e
1222 a(i) = b(i)*c(i) - d(i)*e(i)
1230 integer,
intent(in) :: n
1231 real(kind=
rp),
dimension(n),
intent(inout) :: a
1232 real(kind=
rp),
dimension(n),
intent(in) :: b
1233 real(kind=
rp),
dimension(n),
intent(in) :: c
1234 real(kind=
rp),
intent(in) :: c1, c2
1239 a(i) = b(i) + c1*(a(i)-c2*c(i))
1247 integer,
intent(in) :: n
1248 real(kind=
rp),
dimension(n),
intent(inout) :: a
1249 real(kind=
rp),
dimension(n),
intent(in) :: b
1250 real(kind=
rp),
dimension(n),
intent(in) :: c
1251 real(kind=
rp),
intent(in) :: c1, c2
1256 a(i) = a(i) + c1*b(i)+c2*c(i)
1264 integer,
intent(in) :: n
1265 real(kind=
rp),
dimension(n),
intent(in) :: a
1266 real(kind=
rp),
dimension(n),
intent(in) :: b
1268 real(kind=
xp) :: tmp
1274 tmp = tmp + a(i) * b(i)
1278 call mpi_allreduce(mpi_in_place, tmp, 1, &
1285 integer,
intent(in) :: n
1286 real(kind=
rp),
dimension(n),
intent(in) :: a
1287 real(kind=
rp),
dimension(n),
intent(in) :: b
1288 real(kind=
rp),
dimension(n),
intent(in) :: c
1290 real(kind=
xp) :: tmp
1296 tmp = tmp + a(i) * b(i) * c(i)
1300 call mpi_allreduce(mpi_in_place, tmp, 1, &
1306 integer,
intent(in) :: n
1307 real(kind=
rp),
dimension(n),
intent(in) :: a
1308 real(kind=
rp),
dimension(n),
intent(in) :: b
1309 real(kind=
rp),
dimension(n),
intent(in) :: c
1310 real(kind=
rp),
dimension(n),
intent(in) :: d
1312 real(kind=
xp) :: tmp
1318 tmp = tmp + a(i) * b(i) * c(i) * d(i)
1322 call mpi_allreduce(mpi_in_place, tmp, 1, &
1331 integer,
intent(in) :: n
1332 real(kind=
rp),
dimension(n),
intent(in) :: a
1333 real(kind=
rp),
dimension(n),
intent(in) :: b
1335 real(kind=
xp) :: tmp
1341 tmp = tmp + (a(i) - b(i))**2
1345 call mpi_allreduce(mpi_in_place, tmp, 1, &
1357 integer,
intent(in) :: n
1358 real(kind=
rp),
intent(inout) :: a(n)
1359 integer,
intent(out) :: ind(n)
1361 integer :: j, ir, i, ii, l
1367 if (n .le. 1)
return
1391 do while (j .le. ir)
1393 if ( a(j) .lt. a(j+1) ) j = j + 1
1395 if (aa .lt. a(j))
then
1415 integer,
intent(in) :: n
1416 integer(i4),
intent(inout) :: a(n)
1417 integer,
intent(out) :: ind(n)
1419 integer :: j, ir, i, ii, l
1425 if (n .le. 1)
return
1448 do while (j .le. ir)
1450 if ( a(j) .lt. a(j + 1) ) j = j + 1
1452 if (aa .lt. a(j))
then
1471 integer,
intent(in) :: n
1472 real(kind=
rp),
intent(inout) :: b(n)
1473 integer,
intent(in) :: ind(n)
1474 real(kind=
rp) :: temp(n)
1498 integer,
intent(in) :: n
1499 integer(i4),
intent(inout) :: b(n)
1500 integer,
intent(in) :: ind(n)
1501 integer(i4) :: temp(n)
1525 integer,
intent(in) :: n
1526 real(kind=
rp),
intent(inout) :: b(n)
1527 integer,
intent(in) :: ind(n)
1528 real(kind=
rp) :: temp(n)
1552 integer,
intent(in) :: n
1553 integer(i4),
intent(inout) :: b(n)
1554 integer,
intent(in) :: ind(n)
1555 integer(i4) :: temp(n)
1579 integer,
intent(in) :: n
1580 real(kind=
rp),
intent(inout) :: b(n)
1581 integer,
intent(inout) :: ind(n)
1582 real(kind=
rp) :: temp(n)
1583 integer :: tempind(n)
1591 tempind(jj) = ind(i)
1609 integer,
intent(in) :: n
1610 integer(i4),
intent(inout) :: b(n)
1611 integer,
intent(inout) :: ind(n)
1612 integer(i4) :: temp(n)
1613 integer :: tempind(n)
1621 tempind(jj) = ind(i)
1638 integer,
intent(in) :: n
1639 real(kind=
rp),
dimension(n),
intent(inout) :: a
1655 integer,
intent(in) :: n
1656 real(kind=
rp),
dimension(n),
intent(inout) :: a
1657 real(kind=
rp),
dimension(n),
intent(in) :: b
1662 a(i) =
max(a(i), b(i))
1670 integer,
intent(in) :: n
1671 real(kind=
rp),
dimension(n),
intent(inout) :: a
1672 real(kind=
rp),
dimension(n),
intent(in) :: b, c
1677 a(i) =
max(b(i), c(i))
1685 integer,
intent(in) :: n
1686 real(kind=
rp),
dimension(n),
intent(inout) :: a
1687 real(kind=
rp),
intent(in) :: b
1700 integer,
intent(in) :: n
1701 real(kind=
rp),
dimension(n),
intent(inout) :: a
1702 real(kind=
rp),
dimension(n),
intent(in) :: b
1703 real(kind=
rp),
intent(in) :: c
1716 integer,
intent(in) :: n
1717 real(kind=
rp),
dimension(n),
intent(inout) :: a
1718 real(kind=
rp),
dimension(n),
intent(in) :: b
1723 a(i) = min(a(i), b(i))
1731 integer,
intent(in) :: n
1732 real(kind=
rp),
dimension(n),
intent(inout) :: a
1733 real(kind=
rp),
dimension(n),
intent(in) :: b, c
1738 a(i) = min(b(i), c(i))
1746 integer,
intent(in) :: n
1747 real(kind=
rp),
dimension(n),
intent(inout) :: a
1748 real(kind=
rp),
intent(in) :: b
1761 integer,
intent(in) :: n
1762 real(kind=
rp),
dimension(n),
intent(inout) :: a
1763 real(kind=
rp),
dimension(n),
intent(in) :: b
1764 real(kind=
rp),
intent(in) :: c
1778 function matinv39(a11, a12, a13, a21, a22, a23, a31, a32, a33) &
1780 real(kind=
rp),
intent(in) :: a11, a12, a13, a21, a22, a23, a31, a32, a33
1801 real(kind=
xp),
intent(in) :: a(3,3)
1802 real(kind=
xp) :: b(3,3)
1803 real(kind=
xp) :: detinv
1807 detinv = 1.0_xp /
real(a(1,1)*a(2,2)*a(3,3) - a(1,1)*a(2,3)*a(3,2) &
1808 - a(1,2)*a(2,1)*a(3,3) + a(1,2)*a(2,3)*a(3,1)&
1809 + a(1,3)*a(2,1)*a(3,2) - a(1,3)*a(2,2)*a(3,1),
xp)
1812 b(1,1) = +detinv * (a(2,2)*a(3,3) - a(2,3)*a(3,2))
1813 b(2,1) = -detinv * (a(2,1)*a(3,3) - a(2,3)*a(3,1))
1814 b(3,1) = +detinv * (a(2,1)*a(3,2) - a(2,2)*a(3,1))
1815 b(1,2) = -detinv * (a(1,2)*a(3,3) - a(1,3)*a(3,2))
1816 b(2,2) = +detinv * (a(1,1)*a(3,3) - a(1,3)*a(3,1))
1817 b(3,2) = -detinv * (a(1,1)*a(3,2) - a(1,2)*a(3,1))
1818 b(1,3) = +detinv * (a(1,2)*a(2,3) - a(1,3)*a(2,2))
1819 b(2,3) = -detinv * (a(1,1)*a(2,3) - a(1,3)*a(2,1))
1820 b(3,3) = +detinv * (a(1,1)*a(2,2) - a(1,2)*a(2,1))
1826 real(kind=
rp),
intent(in) :: x
1827 real(kind=
rp) :: val
1828 real(kind=
rp),
parameter :: xdmin = 0.0001_rp
1829 real(kind=
rp),
parameter :: xdmax = 0.9999_rp
1832 if (x <= xdmin)
then
1835 else if (x >= xdmax)
then
1840 g = (1.0_rp / (x - 1.0_rp)) + (1.0_rp / x)
1843 val = 1.0_rp / (1.0_rp + exp(g))
1849 real(kind=
rp),
intent(in) :: x
1850 real(kind=
rp) :: val
1851 real(kind=
rp),
parameter :: xdmin = 0.0001_rp
1852 real(kind=
rp),
parameter :: xdmax = 0.9999_rp
1853 real(kind=
rp) :: arg, g, dg, s_val
1855 if (x <= xdmin .or. x >= xdmax)
then
1862 g = (1.0_rp / (x - 1.0_rp)) + (1.0_rp / x)
1865 dg = -(1.0_rp / ((x - 1.0_rp)**2)) - (1.0_rp / (x**2))
1868 s_val = 1.0_rp / (1.0_rp + exp(g))
1870 val = -s_val * (1.0_rp - s_val) * dg
__inline__ __device__ void nonlinear_index(const int idx, const int lx, int *index)
type(mpi_datatype), public mpi_real_precision
MPI type for working precision of REAL types.
type(mpi_comm), public neko_comm
MPI communicator.
type(mpi_datatype), public mpi_extra_precision
Object for handling masks in Neko.
subroutine, public cmult(a, c, n)
Multiplication by constant c .
subroutine, public cmult2(a, b, c, n)
Multiplication by constant c .
subroutine, public row_zero(a, m, n, e)
Sets row e to 0 in matrix a.
subroutine, public invcol2(a, b, n)
Vector division .
real(kind=rp) function, public vlsc2(u, v, n)
Compute multiplication sum .
pure logical function, public dabscmp(x, y, tol)
Return double precision absolute comparison .
real(kind=rp), parameter, public pi
pure logical function qabscmp(x, y, tol)
Return double precision absolute comparison .
real(kind=rp) function, public glsc3(a, b, c, n)
Weighted inner product .
subroutine, public ascol5(a, b, c, d, e, n)
Returns .
subroutine, public addcol3s2(a, b, c, s, n)
Returns .
subroutine, public masked_scatter_copy(a, b, mask, n, n_mask)
Scatter a contigous vector to masked positions in a target array .
subroutine, public invers2(a, b, n)
Compute inverted vector .
subroutine, public cadd2(a, b, s, n)
Add a scalar to vector .
subroutine, public face_masked_gather_copy_0(a, b, mask, facet, lx, ly, lz, n_mask)
Gather values from a face-local SEM field to a reduced contiguous vector.
real(rp) function, dimension(3, 3), public matinv39(a11, a12, a13, a21, a22, a23, a31, a32, a33)
subroutine, public cadd(a, s, n)
Add a scalar to vector .
subroutine, public masked_copy(a, b, mask, n, n_mask)
Copy a masked vector .
subroutine reorddp(b, ind, n)
reorder double precision array - inverse of swap
subroutine, public addsqr2s2(a, b, c1, n)
Returns .
subroutine, public cwrap(a, min_val, max_val, n)
Wrap value around a range [min, max)
real(kind=rp) function, public glsc4(a, b, c, d, n)
subroutine, public cdiv2(a, b, c, n)
Division of constant c by elements of a .
real(kind=rp) function, public math_stepf(x)
Smooth step function S(x) Returns 0 for x <= 0, 1 for x >= 1, and smooth transition in between.
subroutine swapdp(b, ind, n)
sort double precision array acording to ind vector
subroutine flipvi4(b, ind, n)
Flip single integer vector b and ind.
subroutine, public add2s1(a, b, c1, n)
Vector addition with scalar multiplication (multiplication on first argument)
subroutine, public cpwmin2(a, b, n)
Point-wise minimum of scalar and vector .
real(kind=rp) function, public glsc2(a, b, n)
Weighted inner product .
subroutine, public masked_scatter_copy_0(a, b, mask, n, n_mask)
Scatter a contigous vector to masked positions in a target array .
subroutine, public subcol3(a, b, c, n)
Returns .
subroutine, public rone(a, n)
Set all elements to one.
subroutine flipvdp(b, ind, n)
Flip double precision vector b and ind.
subroutine, public cpwmin3(a, b, c, n)
Point-wise minimum of scalar and vector .
subroutine, public pwmax3(a, b, c, n)
Point-wise maximum of two vectors .
subroutine, public masked_gather_copy(a, b, mask, n, n_mask)
Gather a masked vector to reduced contigous vector .
subroutine, public x_update(a, b, c, c1, c2, n)
Returns .
subroutine, public add3(a, b, c, n)
Vector addition .
subroutine swapi4(b, ind, n)
sort single integer array acording to ind vector
integer function, public glimin(a, n)
Min of an integer vector of length n.
real(kind=rp) function, public glsum(a, n)
Sum a vector of length n.
subroutine, public sub3(a, b, c, n)
Vector subtraction .
subroutine, public addcol4(a, b, c, d, n)
Returns .
subroutine, public add2(a, b, n)
Vector addition .
subroutine, public cfill(a, c, n)
Set all elements to a constant c .
subroutine, public absval(a, n)
Take the absolute value of an array.
subroutine, public invcol3(a, b, c, n)
Invert a vector .
subroutine, public add3s2(a, b, c, c1, c2, n)
Returns .
real(kind=xp) function, dimension(3, 3), public matinv3(a)
Performs a direct calculation of the inverse of a 3×3 matrix. M33INV and M44INV by David G....
subroutine, public pwmax2(a, b, n)
Point-wise maximum of two vectors .
subroutine, public pwmin2(a, b, n)
Point-wise minimum of two vectors .
subroutine, public masked_gather_copy_0(a, b, mask, n, n_mask)
Gather a masked vector to reduced contigous vector .
subroutine, public subcol4(a, b, c, d, n)
Returns .
subroutine sorti4(a, ind, n)
Heap Sort for single integer arrays.
subroutine, public addcol3(a, b, c, n)
Returns .
subroutine, public invcol1(a, n)
Invert a vector .
subroutine, public cdiv(a, c, n)
Division of constant c by elements of a .
real(kind=rp), parameter, public neko_m_ln2
subroutine, public chsign(a, n)
Change sign of vector .
subroutine, public cpwmax3(a, b, c, n)
Point-wise maximum of scalar and vector .
subroutine, public col2(a, b, n)
Vector multiplication .
subroutine, public izero(a, n)
Zero an integer vector.
real(kind=rp) function, public glmax(a, n)
Max of a vector of length n.
subroutine, public copy(a, b, n)
Copy a vector .
subroutine, public add4s3(a, b, c, d, c1, c2, c3, n)
Returns .
subroutine, public add4(a, b, c, d, n)
Vector addition .
subroutine, public col3(a, b, c, n)
Vector multiplication with 3 vectors .
subroutine, public add5s4(a, b, c, d, e, c1, c2, c3, c4, n)
Returns .
real(kind=rp) function, public math_dstepf(x)
Derivative of math_stepf with respect to x: d(stepf)/dx.
pure logical function drelcmp(x, y, eps)
Return double precision relative comparison .
real(kind=rp), parameter, public neko_eps
Machine epsilon .
subroutine, public vdot3(dot, u1, u2, u3, v1, v2, v3, n)
Compute a dot product (3-d version) assuming vector components etc.
pure logical function, public sabscmp(x, y, tol)
Return single precision absolute comparison .
pure logical function qrelcmp(x, y, eps)
Return quad precision relative comparison .
subroutine, public rzero(a, n)
Zero a real vector.
real(kind=rp) function, public glsubnorm(a, b, n)
Returns the norm of the difference of two vectors .
subroutine, public vdot2(dot, u1, u2, v1, v2, n)
Compute a dot product (2-d version) assuming vector components etc.
subroutine, public cpwmax2(a, b, n)
Point-wise maximum of scalar and vector .
real(kind=rp) function, public vlmin(vec, n)
minimun value of a vector of length n
subroutine, public cfill_mask(a, c, n, mask, n_mask)
Fill a constant to a masked vector. .
real(kind=rp) function, public vlmax(vec, n)
maximum value of a vector of length n
integer function, public glimax(a, n)
Max of an integer vector of length n.
subroutine sortrp(a, ind, n)
Heap Sort for double precision arrays.
subroutine, public sub2(a, b, n)
Vector substraction .
subroutine, public pwmin3(a, b, c, n)
Point-wise minimum of two vectors .
subroutine, public add2s2(a, b, c1, n)
Vector addition with scalar multiplication (multiplication on second argument)
real(kind=rp) function, public glmin(a, n)
Min of a vector of length n.
subroutine, public masked_copy_0(a, b, mask, n, n_mask)
Copy a masked vector .
subroutine, public vcross(u1, u2, u3, v1, v2, v3, w1, w2, w3, n)
Compute a cross product assuming vector components etc.
pure logical function srelcmp(x, y, eps)
Return single precision relative comparison .
pure real(kind=rp) function, public lambert_w0(x, niter)
Approximate the principal real branch of the Lambert W function for non-negative real x.
real(kind=rp) function, public vlsc3(u, v, w, n)
Compute multiplication sum .
subroutine reordi4(b, ind, n)
reorder single integer array - inverse of swap
subroutine, public p_update(a, b, c, c1, c2, n)
Returns .
integer, parameter, public qp
integer, parameter, public i4
integer, parameter, public xp
integer, parameter, public dp
integer, parameter, public sp
integer, parameter, public rp
Global precision used in computations.