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
166 real(kind=
sp),
intent(in) :: x
167 real(kind=
sp),
intent(in) :: y
168 real(kind=
sp),
intent(in),
optional :: eps
170 if (
present(eps))
then
171 srelcmp = abs(x - y) .le. eps*abs(y)
181 real(kind=
dp),
intent(in) :: x
182 real(kind=
dp),
intent(in) :: y
183 real(kind=
dp),
intent(in),
optional :: eps
185 if (
present(eps))
then
186 drelcmp = abs(x - y) .le. eps*abs(y)
196 real(kind=
qp),
intent(in) :: x
197 real(kind=
qp),
intent(in) :: y
198 real(kind=
qp),
intent(in),
optional :: eps
200 if (
present(eps))
then
201 qrelcmp = abs(x - y)/abs(y) .lt. eps
214 real(kind=
rp),
intent(in) :: x
215 integer,
intent(in) :: niter
220 if (x == 0.0_rp)
then
225 a = 1.0_rp / (1.0_rp + 0.5_rp * log(1.0_rp + x))
226 w = log(1.0_rp + a * x)
228 do k = 1,
max(niter, 0)
229 w = w / (1.0_rp + w) * (1.0_rp + log(x / w))
235 integer,
intent(in) :: n
236 real(kind=
rp),
dimension(n),
intent(inout) :: a
249 integer,
intent(in) :: n
250 integer,
dimension(n),
intent(inout) :: a
263 integer,
intent(in) :: m, n, e
264 real(kind=
rp),
intent(inout) :: a(m,n)
277 integer,
intent(in) :: n
278 real(kind=
rp),
dimension(n),
intent(inout) :: a
291 integer,
intent(in) :: n
292 real(kind=
rp),
dimension(n),
intent(in) :: b
293 real(kind=
rp),
dimension(n),
intent(inout) :: a
312 integer,
intent(in) :: n, n_mask
313 real(kind=
rp),
dimension(n),
intent(in) :: b
314 real(kind=
rp),
dimension(n),
intent(inout) :: a
315 integer,
dimension(0:n_mask) ::
mask
335 integer,
intent(in) :: n, n_mask
336 real(kind=
rp),
dimension(n),
intent(in) :: b
337 real(kind=
rp),
dimension(n),
intent(inout) :: a
338 integer,
dimension(n_mask) ::
mask
360 integer,
intent(in) :: n, n_mask
361 real(kind=
rp),
dimension(n),
intent(in) :: b
362 real(kind=
rp),
dimension(n_mask),
intent(inout) :: a
363 integer,
dimension(0:n_mask) ::
mask
385 integer,
intent(in) :: lx, ly, lz, n_mask
386 real(kind=
rp),
dimension(n_mask),
intent(inout) :: a
387 real(kind=
rp),
dimension(:, :, :, :),
intent(in) :: b
388 integer,
dimension(0:n_mask),
intent(in) ::
mask
389 integer,
dimension(0:n_mask),
intent(in) :: facet
397 select case (facet(l))
399 a(l) = b(idx(2), idx(3), facet(l), idx(4))
401 a(l) = b(idx(1), idx(3), facet(l), idx(4))
403 a(l) = b(idx(1), idx(2), facet(l), idx(4))
420 integer,
intent(in) :: n, n_mask
421 real(kind=
rp),
dimension(n),
intent(in) :: b
422 real(kind=
rp),
dimension(n_mask),
intent(inout) :: a
423 integer,
dimension(n_mask) ::
mask
445 integer,
intent(in) :: n, n_mask
446 real(kind=
rp),
dimension(n_mask),
intent(in) :: b
447 real(kind=
rp),
dimension(n),
intent(inout) :: a
448 integer,
dimension(0:n_mask) ::
mask
470 integer,
intent(in) :: n, n_mask
471 real(kind=
rp),
dimension(n_mask),
intent(in) :: b
472 real(kind=
rp),
dimension(n),
intent(inout) :: a
473 integer,
dimension(n_mask) ::
mask
488 integer,
intent(in) :: n, n_mask
489 real(kind=
rp),
dimension(n),
intent(inout) :: a
490 real(kind=
rp),
intent(in) :: c
491 integer,
dimension(n_mask),
intent(in) ::
mask
504 integer,
intent(in) :: n
505 real(kind=
rp),
dimension(n),
intent(inout) :: a
506 real(kind=
rp),
intent(in) :: c
519 integer,
intent(in) :: n
520 real(kind=
rp),
dimension(n),
intent(inout) :: a
521 real(kind=
rp),
dimension(n),
intent(in) :: b
522 real(kind=
rp),
intent(in) :: c
535 integer,
intent(in) :: n
536 real(kind=
rp),
dimension(n),
intent(inout) :: a
537 real(kind=
rp),
intent(in) :: c
550 integer,
intent(in) :: n
551 real(kind=
rp),
dimension(n),
intent(inout) :: a
552 real(kind=
rp),
dimension(n),
intent(in) :: b
553 real(kind=
rp),
intent(in) :: c
566 integer,
intent(in) :: n
567 real(kind=
rp),
dimension(n),
intent(inout) :: a
568 real(kind=
rp),
intent(in) :: s
581 integer,
intent(in) :: n
582 real(kind=
rp),
dimension(n),
intent(inout) :: a
583 real(kind=
rp),
dimension(n),
intent(in) :: b
584 real(kind=
rp),
intent(in) :: s
597 integer,
intent(in) :: n
598 real(kind=
rp),
dimension(n),
intent(inout) :: a
599 real(kind=
rp),
intent(in) :: c
611 subroutine cwrap(a, min_val, max_val, n)
612 integer,
intent(in) :: n
613 real(kind=
rp),
dimension(n),
intent(inout) :: a
614 real(kind=
rp),
intent(in) :: min_val, max_val
617 if (n .lt. 1 .or. max_val .le. min_val)
return
621 a(i) = modulo(a(i) - min_val, max_val - min_val) + min_val
629 integer,
intent(in) :: n
630 real(kind=
rp),
dimension(n) :: a
642 call mpi_allreduce(mpi_in_place, tmp, 1, &
650 integer,
intent(in) :: n
651 real(kind=
rp),
dimension(n) :: a
662 call mpi_allreduce(tmp,
glmax, 1, &
669 integer,
intent(in) :: n
670 integer,
dimension(n) :: a
681 call mpi_allreduce(tmp,
glimax, 1, &
688 integer,
intent(in) :: n
689 real(kind=
rp),
dimension(n) :: a
700 call mpi_allreduce(tmp,
glmin, 1, &
707 integer,
intent(in) :: n
708 integer,
dimension(n) :: a
719 call mpi_allreduce(tmp,
glimin, 1, &
726 integer,
intent(in) :: n
727 real(kind=
rp),
dimension(n),
intent(inout) :: a
741 real(kind=
rp),
intent(in) :: vec(n)
742 real(kind=
rp) :: tmax
747 tmax =
max(tmax, vec(i))
755 integer,
intent(in) :: n
756 real(kind=
rp),
intent(in) :: vec(n)
757 real(kind=
rp) :: tmin
763 tmin = min(tmin, vec(i))
771 integer,
intent(in) :: n
772 real(kind=
rp),
dimension(n),
intent(inout) :: a
777 a(i) = 1.0_xp /
real(a(i),
xp)
785 integer,
intent(in) :: n
786 real(kind=
rp),
dimension(n),
intent(inout) :: a
787 real(kind=
rp),
dimension(n),
intent(in) :: b, c
792 a(i) =
real(b(i),
xp) / c(i)
800 integer,
intent(in) :: n
801 real(kind=
rp),
dimension(n),
intent(inout) :: a
802 real(kind=
rp),
dimension(n),
intent(in) :: b
807 a(i) = 1.0_xp /
real(b(i),
xp)
815 subroutine vcross(u1, u2, u3, v1, v2, v3, w1, w2, w3, n)
816 integer,
intent(in) :: n
817 real(kind=
rp),
dimension(n),
intent(in) :: v1, v2, v3
818 real(kind=
rp),
dimension(n),
intent(in) :: w1, w2, w3
819 real(kind=
rp),
dimension(n),
intent(out) :: u1, u2, u3
824 u1(i) = v2(i)*w3(i) - v3(i)*w2(i)
825 u2(i) = v3(i)*w1(i) - v1(i)*w3(i)
826 u3(i) = v1(i)*w2(i) - v2(i)*w1(i)
834 subroutine vdot2(dot, u1, u2, v1, v2, n)
835 integer,
intent(in) :: n
836 real(kind=
rp),
dimension(n),
intent(in) :: u1, u2
837 real(kind=
rp),
dimension(n),
intent(in) :: v1, v2
838 real(kind=
rp),
dimension(n),
intent(out) :: dot
843 dot(i) = u1(i)*v1(i) + u2(i)*v2(i)
851 subroutine vdot3(dot, u1, u2, u3, v1, v2, v3, n)
852 integer,
intent(in) :: n
853 real(kind=
rp),
dimension(n),
intent(in) :: u1, u2, u3
854 real(kind=
rp),
dimension(n),
intent(in) :: v1, v2, v3
855 real(kind=
rp),
dimension(n),
intent(out) :: dot
860 dot(i) = u1(i)*v1(i) + u2(i)*v2(i) + u3(i)*v3(i)
867 function vlsc3(u, v, w, n)
result(s)
868 integer,
intent(in) :: n
869 real(kind=
rp),
dimension(n),
intent(in) :: u, v, w
876 s = s + u(i)*v(i)*w(i)
884 integer,
intent(in) :: n
885 real(kind=
rp),
dimension(n),
intent(in) :: u, v
900 integer,
intent(in) :: n
901 real(kind=
rp),
dimension(n),
intent(inout) :: a
902 real(kind=
rp),
dimension(n),
intent(in) :: b
915 integer,
intent(in) :: n
916 real(kind=
rp),
dimension(n),
intent(inout) :: a
917 real(kind=
rp),
dimension(n),
intent(in) :: b
918 real(kind=
rp),
dimension(n),
intent(in) :: c
931 integer,
intent(in) :: n
932 real(kind=
rp),
dimension(n),
intent(out) :: a
933 real(kind=
rp),
dimension(n),
intent(in) :: d
934 real(kind=
rp),
dimension(n),
intent(in) :: c
935 real(kind=
rp),
dimension(n),
intent(in) :: b
940 a(i) = b(i) + c(i) + d(i)
948 integer,
intent(in) :: n
949 real(kind=
rp),
dimension(n),
intent(inout) :: a
950 real(kind=
rp),
dimension(n),
intent(in) :: b
963 integer,
intent(in) :: n
964 real(kind=
rp),
dimension(n),
intent(inout) :: a
965 real(kind=
rp),
dimension(n),
intent(in) :: b
966 real(kind=
rp),
dimension(n),
intent(in) :: c
981 integer,
intent(in) :: n
982 real(kind=
rp),
dimension(n),
intent(inout) :: a
983 real(kind=
rp),
dimension(n),
intent(in) :: b
984 real(kind=
rp),
intent(in) :: c1
989 a(i) = c1 * a(i) + b(i)
998 integer,
intent(in) :: n
999 real(kind=
rp),
dimension(n),
intent(inout) :: a
1000 real(kind=
rp),
dimension(n),
intent(in) :: b
1001 real(kind=
rp),
intent(in) :: c1
1006 a(i) = a(i) + c1 * b(i)
1014 integer,
intent(in) :: n
1015 real(kind=
rp),
dimension(n),
intent(inout) :: a
1016 real(kind=
rp),
dimension(n),
intent(in) :: b
1017 real(kind=
rp),
intent(in) :: c1
1022 a(i) = a(i) + c1 * ( b(i) * b(i) )
1030 integer,
intent(in) :: n
1031 real(kind=
rp),
dimension(n),
intent(inout) :: a
1032 real(kind=
rp),
dimension(n),
intent(in) :: b
1037 a(i) =
real(a(i),
xp) / b(i)
1046 integer,
intent(in) :: n
1047 real(kind=
rp),
dimension(n),
intent(inout) :: a
1048 real(kind=
rp),
dimension(n),
intent(in) :: b
1061 integer,
intent(in) :: n
1062 real(kind=
rp),
dimension(n),
intent(inout) :: a
1063 real(kind=
rp),
dimension(n),
intent(in) :: b
1064 real(kind=
rp),
dimension(n),
intent(in) :: c
1077 integer,
intent(in) :: n
1078 real(kind=
rp),
dimension(n),
intent(inout) :: a
1079 real(kind=
rp),
dimension(n),
intent(in) :: b
1080 real(kind=
rp),
dimension(n),
intent(in) :: c
1085 a(i) = a(i) - b(i) * c(i)
1093 integer,
intent(in) :: n
1094 real(kind=
rp),
dimension(n),
intent(inout) :: a
1095 real(kind=
rp),
dimension(n),
intent(in) :: b
1096 real(kind=
rp),
dimension(n),
intent(in) :: c
1097 real(kind=
rp),
intent(in) :: c1, c2
1102 a(i) = c1 * b(i) + c2 * c(i)
1110 integer,
intent(in) :: n
1111 real(kind=
rp),
dimension(n),
intent(inout) :: a
1112 real(kind=
rp),
dimension(n),
intent(in) :: b
1113 real(kind=
rp),
dimension(n),
intent(in) :: c
1114 real(kind=
rp),
dimension(n),
intent(in) :: d
1115 real(kind=
rp),
intent(in) :: c1, c2, c3
1120 a(i) = c1 * b(i) + c2 * c(i) + c3 * d(i)
1127 subroutine add5s4(a, b, c, d, e, c1, c2, c3, c4, n)
1128 integer,
intent(in) :: n
1129 real(kind=
rp),
dimension(n),
intent(inout) :: a
1130 real(kind=
rp),
dimension(n),
intent(in) :: b
1131 real(kind=
rp),
dimension(n),
intent(in) :: c
1132 real(kind=
rp),
dimension(n),
intent(in) :: d
1133 real(kind=
rp),
dimension(n),
intent(in) :: e
1134 real(kind=
rp),
intent(in) :: c1, c2, c3, c4
1139 a(i) = a(i) + c1 * b(i) + c2 * c(i) + c3 * d(i) + c4 * e(i)
1147 integer,
intent(in) :: n
1148 real(kind=
rp),
dimension(n),
intent(inout) :: a
1149 real(kind=
rp),
dimension(n),
intent(in) :: b
1150 real(kind=
rp),
dimension(n),
intent(in) :: c
1151 real(kind=
rp),
dimension(n),
intent(in) :: d
1156 a(i) = a(i) - b(i) * c(i) * d(i)
1164 integer,
intent(in) :: n
1165 real(kind=
rp),
dimension(n),
intent(inout) :: a
1166 real(kind=
rp),
dimension(n),
intent(in) :: b
1167 real(kind=
rp),
dimension(n),
intent(in) :: c
1172 a(i) = a(i) + b(i) * c(i)
1180 integer,
intent(in) :: n
1181 real(kind=
rp),
dimension(n),
intent(inout) :: a
1182 real(kind=
rp),
dimension(n),
intent(in) :: b
1183 real(kind=
rp),
dimension(n),
intent(in) :: c
1184 real(kind=
rp),
dimension(n),
intent(in) :: d
1189 a(i) = a(i) + b(i) * c(i) * d(i)
1197 integer,
intent(in) :: n
1198 real(kind=
rp),
dimension(n),
intent(inout) :: a
1199 real(kind=
rp),
dimension(n),
intent(in) :: b
1200 real(kind=
rp),
dimension(n),
intent(in) :: c
1201 real(kind=
rp),
intent(in) :: s
1206 a(i) = a(i) + s * b(i) * c(i)
1214 integer,
intent(in) :: n
1215 real(kind=
rp),
dimension(n),
intent(inout) :: a
1216 real(kind=
rp),
dimension(n),
intent(in) :: b
1217 real(kind=
rp),
dimension(n),
intent(in) :: c
1218 real(kind=
rp),
dimension(n),
intent(in) :: d
1219 real(kind=
rp),
dimension(n),
intent(in) :: e
1224 a(i) = b(i)*c(i) - d(i)*e(i)
1232 integer,
intent(in) :: n
1233 real(kind=
rp),
dimension(n),
intent(inout) :: a
1234 real(kind=
rp),
dimension(n),
intent(in) :: b
1235 real(kind=
rp),
dimension(n),
intent(in) :: c
1236 real(kind=
rp),
intent(in) :: c1, c2
1241 a(i) = b(i) + c1*(a(i)-c2*c(i))
1249 integer,
intent(in) :: n
1250 real(kind=
rp),
dimension(n),
intent(inout) :: a
1251 real(kind=
rp),
dimension(n),
intent(in) :: b
1252 real(kind=
rp),
dimension(n),
intent(in) :: c
1253 real(kind=
rp),
intent(in) :: c1, c2
1258 a(i) = a(i) + c1*b(i)+c2*c(i)
1266 integer,
intent(in) :: n
1267 real(kind=
rp),
dimension(n),
intent(in) :: a
1268 real(kind=
rp),
dimension(n),
intent(in) :: b
1270 real(kind=
xp) :: tmp
1276 tmp = tmp + a(i) * b(i)
1280 call mpi_allreduce(mpi_in_place, tmp, 1, &
1287 integer,
intent(in) :: n
1288 real(kind=
rp),
dimension(n),
intent(in) :: a
1289 real(kind=
rp),
dimension(n),
intent(in) :: b
1290 real(kind=
rp),
dimension(n),
intent(in) :: c
1292 real(kind=
xp) :: tmp
1298 tmp = tmp + a(i) * b(i) * c(i)
1302 call mpi_allreduce(mpi_in_place, tmp, 1, &
1308 integer,
intent(in) :: n
1309 real(kind=
rp),
dimension(n),
intent(in) :: a
1310 real(kind=
rp),
dimension(n),
intent(in) :: b
1311 real(kind=
rp),
dimension(n),
intent(in) :: c
1312 real(kind=
rp),
dimension(n),
intent(in) :: d
1314 real(kind=
xp) :: tmp
1320 tmp = tmp + a(i) * b(i) * c(i) * d(i)
1324 call mpi_allreduce(mpi_in_place, tmp, 1, &
1333 integer,
intent(in) :: n
1334 real(kind=
rp),
dimension(n),
intent(in) :: a
1335 real(kind=
rp),
dimension(n),
intent(in) :: b
1337 real(kind=
xp) :: tmp
1343 tmp = tmp + (a(i) - b(i))**2
1347 call mpi_allreduce(mpi_in_place, tmp, 1, &
1359 integer,
intent(in) :: n
1360 real(kind=
rp),
intent(inout) :: a(n)
1361 integer,
intent(out) :: ind(n)
1363 integer :: j, ir, i, ii, l
1369 if (n .le. 1)
return
1393 do while (j .le. ir)
1395 if ( a(j) .lt. a(j+1) ) j = j + 1
1397 if (aa .lt. a(j))
then
1417 integer,
intent(in) :: n
1418 integer(i4),
intent(inout) :: a(n)
1419 integer,
intent(out) :: ind(n)
1421 integer :: j, ir, i, ii, l
1427 if (n .le. 1)
return
1450 do while (j .le. ir)
1452 if ( a(j) .lt. a(j + 1) ) j = j + 1
1454 if (aa .lt. a(j))
then
1473 integer,
intent(in) :: n
1474 real(kind=
rp),
intent(inout) :: b(n)
1475 integer,
intent(in) :: ind(n)
1476 real(kind=
rp) :: temp(n)
1500 integer,
intent(in) :: n
1501 integer(i4),
intent(inout) :: b(n)
1502 integer,
intent(in) :: ind(n)
1503 integer(i4) :: temp(n)
1527 integer,
intent(in) :: n
1528 real(kind=
rp),
intent(inout) :: b(n)
1529 integer,
intent(in) :: ind(n)
1530 real(kind=
rp) :: temp(n)
1554 integer,
intent(in) :: n
1555 integer(i4),
intent(inout) :: b(n)
1556 integer,
intent(in) :: ind(n)
1557 integer(i4) :: temp(n)
1581 integer,
intent(in) :: n
1582 real(kind=
rp),
intent(inout) :: b(n)
1583 integer,
intent(inout) :: ind(n)
1584 real(kind=
rp) :: temp(n)
1585 integer :: tempind(n)
1593 tempind(jj) = ind(i)
1611 integer,
intent(in) :: n
1612 integer(i4),
intent(inout) :: b(n)
1613 integer,
intent(inout) :: ind(n)
1614 integer(i4) :: temp(n)
1615 integer :: tempind(n)
1623 tempind(jj) = ind(i)
1640 integer,
intent(in) :: n
1641 real(kind=
rp),
dimension(n),
intent(inout) :: a
1657 integer,
intent(in) :: n
1658 real(kind=
rp),
dimension(n),
intent(inout) :: a
1659 real(kind=
rp),
dimension(n),
intent(in) :: b
1664 a(i) =
max(a(i), b(i))
1672 integer,
intent(in) :: n
1673 real(kind=
rp),
dimension(n),
intent(inout) :: a
1674 real(kind=
rp),
dimension(n),
intent(in) :: b, c
1679 a(i) =
max(b(i), c(i))
1687 integer,
intent(in) :: n
1688 real(kind=
rp),
dimension(n),
intent(inout) :: a
1689 real(kind=
rp),
intent(in) :: b
1702 integer,
intent(in) :: n
1703 real(kind=
rp),
dimension(n),
intent(inout) :: a
1704 real(kind=
rp),
dimension(n),
intent(in) :: b
1705 real(kind=
rp),
intent(in) :: c
1718 integer,
intent(in) :: n
1719 real(kind=
rp),
dimension(n),
intent(inout) :: a
1720 real(kind=
rp),
dimension(n),
intent(in) :: b
1725 a(i) = min(a(i), b(i))
1733 integer,
intent(in) :: n
1734 real(kind=
rp),
dimension(n),
intent(inout) :: a
1735 real(kind=
rp),
dimension(n),
intent(in) :: b, c
1740 a(i) = min(b(i), c(i))
1748 integer,
intent(in) :: n
1749 real(kind=
rp),
dimension(n),
intent(inout) :: a
1750 real(kind=
rp),
intent(in) :: b
1763 integer,
intent(in) :: n
1764 real(kind=
rp),
dimension(n),
intent(inout) :: a
1765 real(kind=
rp),
dimension(n),
intent(in) :: b
1766 real(kind=
rp),
intent(in) :: c
1780 function matinv39(a11, a12, a13, a21, a22, a23, a31, a32, a33) &
1782 real(kind=
rp),
intent(in) :: a11, a12, a13, a21, a22, a23, a31, a32, a33
1803 real(kind=
xp),
intent(in) :: a(3,3)
1804 real(kind=
xp) :: b(3,3)
1805 real(kind=
xp) :: detinv
1809 detinv = 1.0_xp /
real(a(1,1)*a(2,2)*a(3,3) - a(1,1)*a(2,3)*a(3,2) &
1810 - a(1,2)*a(2,1)*a(3,3) + a(1,2)*a(2,3)*a(3,1)&
1811 + a(1,3)*a(2,1)*a(3,2) - a(1,3)*a(2,2)*a(3,1),
xp)
1814 b(1,1) = +detinv * (a(2,2)*a(3,3) - a(2,3)*a(3,2))
1815 b(2,1) = -detinv * (a(2,1)*a(3,3) - a(2,3)*a(3,1))
1816 b(3,1) = +detinv * (a(2,1)*a(3,2) - a(2,2)*a(3,1))
1817 b(1,2) = -detinv * (a(1,2)*a(3,3) - a(1,3)*a(3,2))
1818 b(2,2) = +detinv * (a(1,1)*a(3,3) - a(1,3)*a(3,1))
1819 b(3,2) = -detinv * (a(1,1)*a(3,2) - a(1,2)*a(3,1))
1820 b(1,3) = +detinv * (a(1,2)*a(2,3) - a(1,3)*a(2,2))
1821 b(2,3) = -detinv * (a(1,1)*a(2,3) - a(1,3)*a(2,1))
1822 b(3,3) = +detinv * (a(1,1)*a(2,2) - a(1,2)*a(2,1))
1828 real(kind=
rp),
intent(in) :: x
1829 real(kind=
rp) :: val
1830 real(kind=
rp),
parameter :: xdmin = 0.0001_rp
1831 real(kind=
rp),
parameter :: xdmax = 0.9999_rp
1834 if (x <= xdmin)
then
1837 else if (x >= xdmax)
then
1842 g = (1.0_rp / (x - 1.0_rp)) + (1.0_rp / x)
1845 val = 1.0_rp / (1.0_rp + exp(g))
1851 real(kind=
rp),
intent(in) :: x
1852 real(kind=
rp) :: val
1853 real(kind=
rp),
parameter :: xdmin = 0.0001_rp
1854 real(kind=
rp),
parameter :: xdmax = 0.9999_rp
1855 real(kind=
rp) :: arg, g, dg, s_val
1857 if (x <= xdmin .or. x >= xdmax)
then
1864 g = (1.0_rp / (x - 1.0_rp)) + (1.0_rp / x)
1867 dg = -(1.0_rp / ((x - 1.0_rp)**2)) - (1.0_rp / (x**2))
1870 s_val = 1.0_rp / (1.0_rp + exp(g))
1872 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.