3 #include "sll_memory.h"
4 #include "sll_working_precision.h"
31 sll_real64,
dimension(:, :),
intent(out):: deriv
32 sll_real64,
dimension(:),
intent(in) :: f_tn
33 sll_real64,
intent(in) :: step
34 sll_int32,
intent(in) :: p
35 sll_int32 :: num_cells, i, j, r, s, n_points
36 sll_int32 :: n1, n2, n3, n4, n5, n6, nc1
37 sll_real64 :: dh1, dh2, dh3, dh4, dh5, dh6
38 sll_int32 :: h1, h2, h1t, h2t, p2
39 sll_int32 :: index_boundary
40 sll_int32 :: index_boundary1
41 sll_int32 :: index_boundary2
42 sll_int32 :: index_boundary3
43 sll_int32 :: index_boundary4
44 sll_int32 :: index_boundary5
45 sll_int32 :: index_boundary6
58 sll_real64,
dimension(:),
allocatable :: w
59 sll_real64,
dimension(:, :),
allocatable :: f
62 num_cells = mesh%num_cells
79 allocate (w(r:s), f(1:6, r:s))
88 maxrs = max(abs(r), s)
94 h1 = mesh%hex_coord(1, i)
95 h2 = mesh%hex_coord(2, i)
100 if (h1 <= num_cells - maxrs .and. h2 <= num_cells - maxrs &
101 .and. h1 >= -num_cells + maxrs .and. h2 >= -num_cells + maxrs)
then
102 if (h1 <= 0 .and. h2 >= 0 .and. h2 - h1 <= num_cells - maxrs &
103 .or. h2 <= 0 .and. h1 >= 0 .and. h1 - h2 <= num_cells - maxrs &
116 n1 = mesh%hex_to_global(h1t, h2)
119 n2 = mesh%hex_to_global(h1, h2t)
122 n3 = mesh%hex_to_global(h1t, h2t)
130 n4 = mesh%hex_to_global(h1t, h2)
133 n5 = mesh%hex_to_global(h1, h2t)
136 n6 = mesh%hex_to_global(h1t, h2t)
147 if (h1 == num_cells .and. h2 >= 0 .and. h2 <= num_cells &
148 .or. h1 == -num_cells .and. h2 <= 0 .and. h2 >= -num_cells &
149 .or. h2 == num_cells .and. h1 >= 0 .and. h1 <= num_cells &
150 .or. h2 == -num_cells .and. h1 <= 0 .and. h1 >= -num_cells &
151 .or. h1 <= 0 .and. h2 >= 0 .and. h2 - h1 == num_cells &
152 .or. h2 <= 0 .and. h1 >= 0 .and. h1 - h2 == num_cells &
173 if (h2*h1t < 0) opsign1 = .true.
174 if (h2t*h1 < 0) opsign2 = .true.
175 if (h2t*h1t < 0) opsign3 = .true.
179 if (abs(h1t) > num_cells .or. opsign1 .and. (abs(h1t) + abs(h2) > num_cells))
then
180 f(1, j) = f_tn(index_boundary)
182 n1 = mesh%hex_to_global(h1t, h2)
186 if (abs(h2t) > num_cells .or. opsign2 .and. (abs(h1) + abs(h2t) > num_cells))
then
187 f(2, j) = f_tn(index_boundary)
189 n2 = mesh%hex_to_global(h1, h2t)
193 if (abs(h1t) > num_cells .or. abs(h2t) > num_cells .or. opsign3 .and. (abs(h1t) + abs(h2t) > num_cells))
then
194 f(3, j) = f_tn(index_boundary)
196 n3 = mesh%hex_to_global(h1t, h2t)
209 if (h2*h1t < 0) opsign1 = .true.
210 if (h2t*h1 < 0) opsign2 = .true.
211 if (h2t*h1t < 0) opsign3 = .true.
215 if (abs(h1t) > num_cells .or. &
216 opsign1 .and. (abs(h1t) + abs(h2) > num_cells))
then
217 f(4, j) = f_tn(index_boundary)
219 n4 = mesh%hex_to_global(h1t, h2)
223 if (abs(h2t) > num_cells .or. &
224 opsign2 .and. (abs(h1) + abs(h2t) > num_cells))
then
225 f(5, j) = f_tn(index_boundary)
227 n5 = mesh%hex_to_global(h1, h2t)
231 if (abs(h1t) > num_cells .or. abs(h2t) > num_cells .or. &
232 opsign3 .and. (abs(h1t) + abs(h2t) > num_cells))
then
233 f(6, j) = f_tn(index_boundary)
235 n6 = mesh%hex_to_global(h1t, h2t)
260 if (boundary1 .eqv. .false.)
then
261 if (h1t == num_cells .and. h2 >= 0 .and. h2 <= num_cells .or. &
262 h2 <= 0 .and. h1t >= 0 .and. h1t - h2 == num_cells)
then
264 index_boundary1 = mesh%hex_to_global(h1t, h2)
268 if (boundary2 .eqv. .false.)
then
269 if (h2t == num_cells .and. h1 >= 0 .and. h1 <= num_cells .or. &
270 h1 <= 0 .and. h2t >= 0 .and. h2t - h1 == num_cells)
then
272 index_boundary2 = mesh%hex_to_global(h1, h2t)
276 if (boundary3 .eqv. .false.)
then
277 if (h1t == num_cells .and. h2t >= 0 .and. h2t <= num_cells .or. &
278 h2t == num_cells .and. h1t >= 0 .and. h1t <= num_cells)
then
280 index_boundary3 = mesh%hex_to_global(h1t, h2t)
285 f(1, j) = f_tn(index_boundary1)
287 n1 = mesh%hex_to_global(h1t, h2)
292 f(2, j) = f_tn(index_boundary2)
294 n2 = mesh%hex_to_global(h1, h2t)
299 f(3, j) = f_tn(index_boundary3)
301 n3 = mesh%hex_to_global(h1t, h2t)
308 if (boundary4 .eqv. .false.)
then
309 if (h1t == -num_cells .and. h2 <= 0 .and. h2 >= -num_cells .or. &
310 h1t <= 0 .and. h2 >= 0 .and. h2 - h1t == num_cells)
then
312 index_boundary4 = mesh%hex_to_global(h1t, h2)
316 if (boundary5 .eqv. .false.)
then
317 if (h2t == -num_cells .and. h1 <= 0 .and. h1 >= -num_cells .or. &
318 h2t <= 0 .and. h1 >= 0 .and. h1 - h2t == num_cells)
then
320 index_boundary5 = mesh%hex_to_global(h1, h2t)
324 if (boundary6 .eqv. .false.)
then
325 if (h1t == -num_cells .and. h2t <= 0 .and. h2t >= -num_cells .or. &
326 h2t == -num_cells .and. h1t <= 0 .and. h1t >= -num_cells)
then
328 index_boundary6 = mesh%hex_to_global(h1t, h2t)
333 f(4, j) = f_tn(index_boundary4)
335 n4 = mesh%hex_to_global(h1t, h2)
340 f(5, j) = f_tn(index_boundary5)
342 n5 = mesh%hex_to_global(h1, h2t)
347 f(6, j) = f_tn(index_boundary6)
349 n6 = mesh%hex_to_global(h1t, h2t)
367 if (boundary1 .eqv. .false.)
then
368 if (h1t == -num_cells .and. h2 <= 0 .and. h2 >= -num_cells .or. &
369 h1t <= 0 .and. h2 >= 0 .and. h2 - h1t == num_cells)
then
371 index_boundary1 = mesh%hex_to_global(h1t, h2)
375 if (boundary2 .eqv. .false.)
then
376 if (h2t == -num_cells .and. h1 <= 0 .and. h1 >= -num_cells .or. &
377 h2t <= 0 .and. h1 >= 0 .and. h1 - h2t == num_cells)
then
379 index_boundary2 = mesh%hex_to_global(h1, h2t)
383 if (boundary3 .eqv. .false.)
then
384 if (h1t == -num_cells .and. h2t <= 0 .and. h2t >= -num_cells .or. &
385 h2t == -num_cells .and. h1t <= 0 .and. h1t >= -num_cells)
then
387 index_boundary3 = mesh%hex_to_global(h1t, h2t)
392 f(1, j) = f_tn(index_boundary1)
394 n1 = mesh%hex_to_global(h1t, h2)
399 f(2, j) = f_tn(index_boundary2)
401 n2 = mesh%hex_to_global(h1, h2t)
406 f(3, j) = f_tn(index_boundary3)
408 n3 = mesh%hex_to_global(h1t, h2t)
415 if (boundary4 .eqv. .false.)
then
416 if (h1t == num_cells .and. h2 >= 0 .and. h2 <= num_cells .or. &
417 h2 <= 0 .and. h1t >= 0 .and. h1t - h2 == num_cells)
then
419 index_boundary4 = mesh%hex_to_global(h1t, h2)
423 if (boundary5 .eqv. .false.)
then
424 if (h2t == num_cells .and. h1 >= 0 .and. h1 <= num_cells .or. &
425 h1 <= 0 .and. h2t >= 0 .and. h2t - h1 == num_cells)
then
427 index_boundary5 = mesh%hex_to_global(h1, h2t)
431 if (boundary6 .eqv. .false.)
then
432 if (h1t == num_cells .and. h2t >= 0 .and. h2t <= num_cells .or. &
433 h2t == num_cells .and. h1t >= 0 .and. h1t <= num_cells)
then
435 index_boundary6 = mesh%hex_to_global(h1t, h2t)
440 f(4, j) = f_tn(index_boundary4)
442 n4 = mesh%hex_to_global(h1t, h2)
447 f(5, j) = f_tn(index_boundary5)
449 n5 = mesh%hex_to_global(h1, h2t)
454 f(6, j) = f_tn(index_boundary6)
456 n6 = mesh%hex_to_global(h1t, h2t)
474 dh1 = dh1 + w(j)*f(1, j)
475 dh2 = dh2 + w(j)*f(2, j)
476 dh3 = dh3 + w(j)*f(3, j)
477 dh4 = dh4 + w(j)*f(4, j)
478 dh5 = dh5 + w(j)*f(5, j)
479 dh6 = dh6 + w(j)*f(6, j)
482 deriv(1, i) = dh1/step
483 deriv(2, i) = dh2/step
484 deriv(3, i) = dh3/step
485 deriv(4, i) = dh4/step
486 deriv(5, i) = dh5/step
487 deriv(6, i) = dh6/step
495 subroutine sll_s_hermite_interpolation(num, x, y, f_tn, center_value, edge_value, output_tn1, mesh, deriv, aire, num_method)
498 sll_real64,
dimension(:),
intent(in) :: f_tn
499 sll_real64,
dimension(:),
intent(in) :: edge_value
500 sll_real64,
dimension(:),
intent(in) :: center_value
501 sll_real64,
dimension(:, :),
intent(in) :: deriv
502 sll_real64,
dimension(:),
intent(out) :: output_tn1
503 sll_real64,
intent(in) :: x, y, aire
504 sll_int32,
intent(in) :: num, num_method
505 sll_real64 :: x1, x2, x3, y1, y2, y3, f, step
506 sll_real64 :: l1, l2, l3
507 sll_real64,
dimension(:),
allocatable :: freedom, base
509 sll_real64 :: x1x, x2x, x3x, y1y, y2y, y3y
510 sll_int32 :: i, i1, i2, i3, k11, k12, center_index
511 sll_int32 :: num_degree
512 sll_int32 :: edge_index1, edge_index2, edge_index3
515 if (num_method == 9)
then
516 allocate (freedom(9), base(9))
518 elseif (num_method == 10)
then
519 allocate (freedom(10), base(10))
521 elseif (num_method == 11)
then
522 allocate (freedom(9), base(9))
524 elseif (num_method == 12)
then
525 allocate (freedom(12), base(12))
527 elseif (num_method == 15)
then
528 allocate (freedom(15), base(15))
541 x1 = mesh%cartesian_coord(1, i1)
542 x2 = mesh%cartesian_coord(1, i2)
543 x3 = mesh%cartesian_coord(1, i3)
544 y1 = mesh%cartesian_coord(2, i1)
545 y2 = mesh%cartesian_coord(2, i2)
546 y3 = mesh%cartesian_coord(2, i3)
548 k11 = mesh%hex_coord(1, i1)
549 k12 = mesh%hex_coord(2, i1)
555 freedom(1) = f_tn(i1)
556 freedom(2) = f_tn(i2)
557 freedom(3) = f_tn(i3)
561 freedom(5) = deriv(3, i1)
562 freedom(8) = deriv(6, i3)
568 freedom(4) = deriv(2, i1)
569 freedom(6) = deriv(5, i2)
570 freedom(7) = deriv(1, i2)
571 freedom(9) = deriv(4, i3)
573 if (num_degree == 12)
then
575 elseif (num_degree == 15)
then
581 else if (x2 > x1)
then
582 freedom(4) = deriv(1, i1)
583 freedom(6) = deriv(4, i2)
584 freedom(7) = deriv(2, i2)
585 freedom(9) = deriv(5, i3)
587 if (num_degree == 12)
then
589 elseif (num_degree == 15)
then
597 if (test .eqv. .false.) print *,
"anomaly in sll_s_hermite_interpolation l289"
607 l1 = a2*abs(x2x*y3y - x3x*y2y)
608 l2 = a2*abs(x1x*y3y - x3x*y1y)
609 l3 = 1._f64 - l1 - l2
611 if (num_method == 9)
then
616 else if (num_method == 10)
then
619 freedom(10) = center_value(center_index)
626 else if (num_method == 11)
then
631 (base, x1, x3, y1, y2, y3, x, y, l1, l2, l3, mesh)
633 else if (num_method == 12)
then
638 (base, x1, x3, y1, y2, y3, x, y, l1, l2, l3, mesh)
640 else if (num_method == 15)
then
645 freedom(12) = edge_value(edge_index1)
646 freedom(11) = edge_value(edge_index2)
647 freedom(10) = edge_value(edge_index3)
658 f = f + freedom(i)*base(i)
663 deallocate (freedom, base)
668 sll_real64,
dimension(:),
intent(out) :: base
669 sll_real64,
intent(in) :: l1, l2, l3
670 sll_real64,
intent(in) :: step
671 sll_real64 :: phi, p05
672 sll_real64 :: l12, l22, l32, ksi1, ksi2, ksi3
673 sll_real64 :: ksi12, ksi13, ksi21, ksi23, ksi31, ksi32
695 base(1) = 3._f64*l12 - 2._f64*ksi1
696 base(2) = 3._f64*l22 - 2._f64*ksi2
697 base(3) = 3._f64*l32 - 2._f64*ksi3
708 sll_real64,
dimension(:),
intent(out) :: base
709 sll_real64,
intent(in) :: l1, l2, l3
710 sll_real64,
intent(in) :: step
711 sll_real64 :: phi, p05, p9, p15
712 sll_real64 :: l12, l22, l32, ksi1, ksi2, ksi3
713 sll_real64 :: ksi12, ksi13, ksi21, ksi23, ksi31, ksi32
737 base(1) = 3._f64*l12 - 2._f64*ksi1 - p9
738 base(2) = 3._f64*l22 - 2._f64*ksi2 - p9
739 base(3) = 3._f64*l32 - 2._f64*ksi3 - p9
740 base(4) = step*(ksi12 - p15)
741 base(5) = step*(ksi13 - p15)
742 base(6) = step*(ksi21 - p15)
743 base(7) = step*(ksi23 - p15)
744 base(8) = step*(ksi31 - p15)
745 base(9) = step*(ksi32 - p15)
746 base(10) = 27._f64*phi
753 sll_real64,
intent(in) :: x1, y1
754 sll_real64,
intent(in) :: y2
755 sll_real64,
intent(in) :: x3, y3
756 sll_real64,
intent(in) :: x, y
757 sll_int32,
intent(out) :: num_sub_triangle
760 slope = abs(mesh%r1_x1/mesh%r1_x2)
769 if (y >= (x - x3)*slope + y3)
then
775 if (y >= -(x - x1)*slope + y1)
then
787 if (y >= -(x - x3)*slope + y3)
then
793 if (y >= (x - x1)*slope + y1)
then
809 sll_real64,
dimension(:),
intent(out) :: xi
810 sll_real64,
intent(in) :: li, lj, lk
812 sll_real64 :: li2j, li2k, lj2i
813 sll_real64 :: lj2k, lk2i, lk2j
814 sll_real64 :: li3, lj3, lk3
828 xi(1) = 4.5_f64*(li2k + li2j)
829 xi(2) = 0.5_f64*li3 + lj3 - 1.5_f64*li2k + 3.0_f64*(lj2i + lj2k + lijk)
830 xi(3) = 0.5_f64*li3 + lk3 - 1.5_f64*li2j + 3.0_f64*(lk2j + lk2i + lijk)
831 xi(4) = -0.25_f64*li3 + 1.25_f64*li2k + 0.5_f64*li2j
832 xi(5) = -0.25_f64*li3 + 0.5_f64*li2k + 1.25_f64*li2j
833 xi(6) = 0.25_f64*li3 - 0.5_f64*li2k - 0.25_f64*li2j + lj2i + lijk
834 xi(7) = -0.25_f64*li2k + 0.25_f64*li2j + lj2k + 0.5_f64*lijk
835 xi(8) = 0.25_f64*li2k - 0.25_f64*li2j + lk2j + 0.5_f64*lijk
836 xi(9) = 0.25_f64*li3 - 0.25_f64*li2k - 0.5_f64*li2j + lk2i + lijk
841 sll_real64,
dimension(:),
intent(out) :: base
842 sll_real64,
dimension(:),
intent(in) :: xi
843 sll_real64,
intent(in) :: step
844 sll_int32,
intent(in) :: num_sub_triangle
846 if (num_sub_triangle == 1)
then
856 elseif (num_sub_triangle == 2)
then
866 elseif (num_sub_triangle == 3)
then
880 subroutine base_hsieh_clough_tocher_reduced(base, x1, x3, y1, y2, y3, x, y, l1, l2, l3, mesh)
882 sll_real64,
dimension(:),
intent(out) :: base
883 sll_real64,
intent(in) :: x1, x3, y1, y2, y3
884 sll_real64,
intent(in) :: x, y, l1, l2, l3
885 sll_real64,
dimension(:),
allocatable :: xi
886 sll_real64 :: li, lj, lk, step
887 sll_int32 :: num_sub_triangle
898 if (num_sub_triangle == 1)
then
902 else if (num_sub_triangle == 2)
then
906 else if (num_sub_triangle == 3)
then
911 print *,
"problem with finding the sub triangle"
926 sll_real64,
dimension(:),
intent(out) :: xi
927 sll_real64,
intent(in) :: li, lj, lk
929 sll_real64 :: li2j, li2k, lj2i, lj2k, lk2i, lk2j
930 sll_real64 :: li3, lj3, lk3
944 xi(1) = 4.5_f64*(li2k + li2j)
945 xi(2) = 0.5_f64*li3 + lj3 - 1.5_f64*li2k + 3.0_f64*(lj2i + lj2k + lijk)
946 xi(3) = 0.5_f64*li3 + lk3 - 1.5_f64*li2j + 3.0_f64*(lk2j + lk2i + lijk)
947 xi(4) = -1._f64/12._f64*li3 + 1.75_f64*li2k - 0.5_f64*li2j
948 xi(5) = -1._f64/12._f64*li3 - 0.5_f64*li2k + 1.75_f64*li2j
949 xi(6) = -7._f64/12._f64*li3 + 0.5_f64*li2k + 1.25_f64*li2j + lj2i - lijk
950 xi(7) = 2._f64/3._f64*li3 - 0.75_f64*li2k - 1.25_f64*li2j + lj2k + 1.5_f64*lijk
951 xi(8) = 2._f64/3._f64*li3 - 1.25_f64*li2k - 0.75_f64*li2j + lk2j + 1.5_f64*lijk
952 xi(9) = -7._f64/12._f64*li3 + 1.25_f64*li2k + 0.5_f64*li2j + lk2i - lijk
953 xi(10) = 4._f64/3._f64*li3 - 2._f64*li2k - 2._f64*li2j + 4._f64*lijk
954 xi(11) = -2._f64/3._f64*li3 + 2._f64*li2k
955 xi(12) = -2._f64/3._f64*li3 + 2._f64*li2j
961 sll_real64,
dimension(:),
intent(out) :: base
962 sll_real64,
dimension(:),
intent(in) :: xi
963 sll_int32,
intent(in) :: num_sub_triangle
964 sll_real64 :: step_sq, step
967 step_sq = abs(mesh%r1_x1)
969 if (num_sub_triangle == 1)
then
979 base(10) = xi(10)*step_sq
980 base(11) = xi(11)*step_sq
981 base(12) = xi(12)*step_sq
982 elseif (num_sub_triangle == 2)
then
992 base(10) = xi(12)*step_sq
993 base(11) = xi(10)*step_sq
994 base(12) = xi(11)*step_sq
995 elseif (num_sub_triangle == 3)
then
1000 base(5) = xi(6)*step
1001 base(6) = xi(8)*step
1002 base(7) = xi(9)*step
1003 base(8) = xi(5)*step
1004 base(9) = xi(4)*step
1005 base(10) = xi(11)*step_sq
1006 base(11) = xi(12)*step_sq
1007 base(12) = xi(10)*step_sq
1012 subroutine base_hsieh_clough_tocher_complete(base, x1, x3, y1, y2, y3, x, y, l1, l2, l3, mesh)
1014 sll_real64,
dimension(:),
intent(out) :: base
1015 sll_real64,
intent(in) :: x1, x3, y1, y2, y3
1016 sll_real64,
intent(in) :: x, y, l1, l2, l3
1017 sll_real64,
dimension(:),
allocatable :: xi
1018 sll_real64 :: li, lj, lk
1019 sll_int32 :: num_sub_triangle
1028 if (num_sub_triangle == 1)
then
1032 else if (num_sub_triangle == 2)
then
1036 else if (num_sub_triangle == 3)
then
1041 print *,
"problem with finding the sub triangle"
1057 sll_real64,
dimension(:, :),
intent(in) :: deriv
1058 sll_real64,
dimension(3),
intent(out) :: freedom
1059 sll_real64 :: x1, x2
1060 sll_int32,
intent(in) :: i1, i2
1061 sll_real64 :: fi_1, fi, fi1, fi2, fi_2, fi3
1062 sll_int32 :: ni_1, ni, ni1, ni2, ni_2, ni3
1063 sll_int32 :: h1, h2, num_cells, h16
1064 sll_int32 :: h11, h12, h13, h21, h22, h23, h14, h24
1065 sll_int32 :: h26, h2_4, h2_5, h25, h1_5, h1_4, h15
1066 sll_int32 :: h1_1, h1_3, h2_1, h2_3, h1_2, h2_2
1067 sll_real64,
dimension(2) :: n1_l, n2_l, n3_l, n1_r, n2_r, n3_r
1068 sll_real64 :: det, v1, v2, v3, v4
1070 det = mesh%r1_x1*mesh%r2_x2 - mesh%r1_x2*mesh%r2_x1
1072 v1 = (+mesh%r1_x2*mesh%r2_x2 + mesh%r1_x1*mesh%r2_x1)/det
1073 v2 = (-mesh%r1_x2*mesh%r1_x2 - mesh%r1_x1*mesh%r1_x1)/det
1074 v3 = (+mesh%r2_x2*mesh%r2_x2 + mesh%r2_x1*mesh%r2_x1)/det
1075 v4 = (-mesh%r2_x2*mesh%r1_x2 - mesh%r2_x1*mesh%r1_x1)/det
1078 n2_l = (/-(v1 + v3), -(v2 + v4)/)
1089 num_cells = mesh%num_cells
1091 x1 = mesh%cartesian_coord(1, i1)
1092 x2 = mesh%cartesian_coord(1, i2)
1094 h1 = mesh%hex_coord(1, i1)
1095 h2 = mesh%hex_coord(2, i1)
1127 if (
test_in(h13, h26, num_cells))
then
1130 ni_2 = mesh%hex_to_global(h13, h26)
1131 fi_2 = deriv(1, ni_2)*n1_l(1) + deriv(2, ni_2)*n1_l(2)
1134 if (
test_in(h12, h24, num_cells))
then
1137 ni_1 = mesh%hex_to_global(h12, h24)
1138 fi_1 = deriv(1, ni_1)*n1_l(1) + deriv(2, ni_1)*n1_l(2)
1141 if (
test_in(h11, h22, num_cells))
then
1144 ni = mesh%hex_to_global(h11, h22)
1145 fi = deriv(1, ni)*n1_l(1) + deriv(2, ni)*n1_l(2)
1148 if (
test_in(h1, h2, num_cells))
then
1151 ni1 = mesh%hex_to_global(h1, h2)
1152 fi1 = deriv(1, ni1)*n1_l(1) + deriv(2, ni1)*n1_l(2)
1155 if (
test_in(h1_1, h2_2, num_cells))
then
1158 ni2 = mesh%hex_to_global(h1_1, h2_2)
1159 fi2 = deriv(1, ni2)*n1_l(1) + deriv(2, ni2)*n1_l(2)
1162 if (
test_in(h1_2, h2_4, num_cells))
then
1165 ni3 = mesh%hex_to_global(h1_2, h2_4)
1166 fi3 = deriv(1, ni3)*n1_l(1) + deriv(2, ni3)*n1_l(2)
1170 freedom(1) = (3._f64*(fi_2 + fi3) - 25._f64*(fi_1 + fi2) + &
1171 150._f64*(fi + fi1))/256._f64
1175 if (
test_in(h13, h2_2, num_cells))
then
1178 ni_2 = mesh%hex_to_global(h13, h2_2)
1179 fi_2 = deriv(1, ni_2)*n2_l(1) + deriv(2, ni_2)*n2_l(2)
1182 if (
test_in(h12, h2_1, num_cells))
then
1185 ni_1 = mesh%hex_to_global(h12, h2_1)
1186 fi_1 = deriv(1, ni_1)*n2_l(1) + deriv(2, ni_1)*n2_l(2)
1189 if (
test_in(h11, h2, num_cells))
then
1192 ni = mesh%hex_to_global(h11, h2)
1193 fi = deriv(1, ni)*n2_l(1) + deriv(2, ni)*n2_l(2)
1196 if (
test_in(h1, h2, num_cells))
then
1199 ni1 = mesh%hex_to_global(h1, h21)
1200 fi1 = deriv(1, ni1)*n2_l(1) + deriv(2, ni1)*n2_l(2)
1203 if (
test_in(h1_1, h22, num_cells))
then
1206 ni2 = mesh%hex_to_global(h1_1, h22)
1207 fi2 = deriv(1, ni2)*n2_l(1) + deriv(2, ni2)*n2_l(2)
1210 if (
test_in(h1_2, h23, num_cells))
then
1213 ni3 = mesh%hex_to_global(h1_2, h23)
1214 fi3 = deriv(1, ni3)*n2_l(1) + deriv(2, ni3)*n2_l(2)
1218 freedom(2) = (3._f64*(fi_2 + fi3) - 25._f64*(fi_1 + fi2) + &
1219 150._f64*(fi + fi1))/256._f64
1223 if (
test_in(h1_5, h2_2, num_cells))
then
1226 ni_2 = mesh%hex_to_global(h1_5, h2_2)
1227 fi_2 = deriv(1, ni_2)*n3_l(1) + deriv(2, ni_2)*n3_l(2)
1230 if (
test_in(h1_3, h2_1, num_cells))
then
1233 ni_1 = mesh%hex_to_global(h1_3, h2_1)
1234 fi_1 = deriv(1, ni_1)*n3_l(1) + deriv(2, ni_1)*n3_l(2)
1237 if (
test_in(h1_1, h2, num_cells))
then
1240 ni = mesh%hex_to_global(h1_1, h2)
1241 fi = deriv(1, ni)*n3_l(1) + deriv(2, ni)*n3_l(2)
1244 if (
test_in(h11, h21, num_cells))
then
1247 ni1 = mesh%hex_to_global(h11, h21)
1248 fi1 = deriv(1, ni1)*n3_l(1) + deriv(2, ni1)*n3_l(2)
1251 if (
test_in(h13, h22, num_cells))
then
1254 ni2 = mesh%hex_to_global(h13, h22)
1255 fi2 = deriv(1, ni2)*n3_l(1) + deriv(2, ni2)*n3_l(2)
1258 if (
test_in(h15, h23, num_cells))
then
1261 ni3 = mesh%hex_to_global(h15, h23)
1262 fi3 = deriv(1, ni3)*n3_l(1) + deriv(2, ni3)*n3_l(2)
1266 freedom(3) = (3._f64*(fi_2 + fi3) - 25._f64*(fi_1 + fi2) + &
1267 150._f64*(fi + fi1))/256._f64
1273 if (
test_in(h16, h23, num_cells))
then
1276 ni_2 = mesh%hex_to_global(h16, h23)
1277 fi_2 = deriv(1, ni_2)*n1_r(1) + deriv(2, ni_2)*n1_r(2)
1280 if (
test_in(h14, h22, num_cells))
then
1283 ni_1 = mesh%hex_to_global(h14, h22)
1284 fi_1 = deriv(1, ni_1)*n1_r(1) + deriv(2, ni_1)*n1_r(2)
1287 if (
test_in(h12, h21, num_cells))
then
1290 ni = mesh%hex_to_global(h12, h21)
1291 fi = deriv(1, ni)*n1_r(1) + deriv(2, ni)*n1_r(2)
1294 if (
test_in(h1, h2, num_cells))
then
1297 ni1 = mesh%hex_to_global(h1, h2)
1298 fi1 = deriv(1, ni1)*n1_r(1) + deriv(2, ni1)*n1_r(2)
1301 if (
test_in(h1_2, h2_1, num_cells))
then
1304 ni2 = mesh%hex_to_global(h1_2, h2_1)
1305 fi2 = deriv(1, ni2)*n1_r(1) + deriv(2, ni2)*n1_r(2)
1308 if (
test_in(h1_4, h2_2, num_cells))
then
1311 ni3 = mesh%hex_to_global(h1_4, h2_2)
1312 fi3 = deriv(1, ni3)*n1_r(1) + deriv(2, ni3)*n1_r(2)
1316 freedom(1) = (3._f64*(fi_2 + fi3) - 25._f64*(fi_1 + fi2) + &
1317 150._f64*(fi + fi1))/256._f64
1321 if (
test_in(h1_2, h23, num_cells))
then
1324 ni_2 = mesh%hex_to_global(h1_2, h23)
1325 fi_2 = deriv(1, ni_2)*n2_r(1) + deriv(2, ni_2)*n2_r(2)
1328 if (
test_in(h1_1, h22, num_cells))
then
1331 ni_1 = mesh%hex_to_global(h1_1, h22)
1332 fi_1 = deriv(1, ni_1)*n2_r(1) + deriv(2, ni_1)*n2_r(2)
1335 if (
test_in(h1, h21, num_cells))
then
1338 ni = mesh%hex_to_global(h1, h21)
1339 fi = deriv(1, ni)*n2_r(1) + deriv(2, ni)*n2_r(2)
1342 if (
test_in(h11, h2, num_cells))
then
1345 ni1 = mesh%hex_to_global(h11, h2)
1346 fi1 = deriv(1, ni1)*n2_r(1) + deriv(2, ni1)*n2_r(2)
1349 if (
test_in(h12, h2_1, num_cells))
then
1352 ni2 = mesh%hex_to_global(h12, h2_1)
1353 fi2 = deriv(1, ni2)*n2_r(1) + deriv(2, ni2)*n2_r(2)
1356 if (
test_in(h13, h2_2, num_cells))
then
1359 ni3 = mesh%hex_to_global(h13, h2_2)
1360 fi3 = deriv(1, ni3)*n2_r(1) + deriv(2, ni3)*n2_r(2)
1364 freedom(2) = (3._f64*(fi_2 + fi3) - 25._f64*(fi_1 + fi2) + &
1365 150._f64*(fi + fi1))/256._f64
1369 if (
test_in(h1_2, h2_5, num_cells))
then
1372 ni_2 = mesh%hex_to_global(h1_2, h2_5)
1373 fi_2 = deriv(1, ni_2)*n3_r(1) + deriv(2, ni_2)*n3_r(2)
1376 if (
test_in(h1_1, h2_3, num_cells))
then
1379 ni_1 = mesh%hex_to_global(h1_1, h2_3)
1380 fi_1 = deriv(1, ni_1)*n3_r(1) + deriv(2, ni_1)*n3_r(2)
1383 if (
test_in(h1, h2_1, num_cells))
then
1386 ni = mesh%hex_to_global(h1, h2_1)
1387 fi = deriv(1, ni)*n3_r(1) + deriv(2, ni)*n3_r(2)
1390 if (
test_in(h11, h21, num_cells))
then
1393 ni1 = mesh%hex_to_global(h11, h21)
1394 fi1 = deriv(1, ni1)*n3_r(1) + deriv(2, ni1)*n3_r(2)
1397 if (
test_in(h12, h23, num_cells))
then
1400 ni2 = mesh%hex_to_global(h12, h23)
1401 fi2 = deriv(1, ni2)*n3_r(1) + deriv(2, ni2)*n3_r(2)
1404 if (
test_in(h13, h25, num_cells))
then
1407 ni3 = mesh%hex_to_global(h13, h25)
1408 fi3 = deriv(1, ni3)*n3_r(1) + deriv(2, ni3)*n3_r(2)
1412 freedom(3) = (3._f64*(fi_2 + fi3) - 25._f64*(fi_1 + fi2) + &
1413 150._f64*(fi + fi1))/256._f64
1420 sll_int32 :: h1, h2, num_cells
1423 bool = abs(h1) > num_cells .or. abs(h2) > num_cells .or. &
1424 (h1)*(h2) < 0 .and. (abs(h1) + abs(h2) > num_cells)
1429 sll_real64,
dimension(:),
intent(out) :: xi
1430 sll_real64,
intent(in) :: li, lj, lk
1432 sll_real64 :: li2, lj2, lk2
1433 sll_real64 :: li3, lj3, lk3
1434 sll_real64 :: li4, lj4, lk4
1435 sll_real64 :: li3j, li3k, lj3i, lj3k, lk3i, lk3j
1436 sll_real64 :: li2j2, li2k2, lj2k2
1437 sll_real64 :: li2jk, lij2k, lijk2
1463 xi(1) = li4 + 4._f64*(li3k + li3j) - 5._f64*(li2k2 + li2j2) - 4._f64*li2jk
1464 xi(2) = lj4 + 4._f64*(lj3i + lj3k) - 5._f64*(lj2k2 + li2j2) - 4._f64*lij2k
1465 xi(3) = lk4 + 4._f64*(lk3j + lk3i) - 5._f64*(lj2k2 + li2k2) - 4._f64*lijk2
1466 xi(4) = li3k - li2k2 + 0.5_f64*(-li2jk - lij2k + lijk2)
1467 xi(5) = li3j - li2j2 + 0.5_f64*(-li2jk + lij2k - lijk2)
1468 xi(6) = lj3i - li2j2 + 0.5_f64*(+li2jk - lij2k - lijk2)
1469 xi(7) = lj3k - lj2k2 + 0.5_f64*(-li2jk - lij2k + lijk2)
1470 xi(8) = lk3j - lj2k2 + 0.5_f64*(-li2jk + lij2k - lijk2)
1471 xi(9) = lk3i - li2k2 + 0.5_f64*(+li2jk - lij2k - lijk2)
1472 xi(10) = 16._f64*(lj2k2 - li2jk + lij2k + lijk2)
1473 xi(11) = 16._f64*(li2k2 + li2jk - lij2k + lijk2)
1474 xi(12) = 16._f64*(li2j2 + li2jk + lij2k - lijk2)
1475 xi(13) = 4._f64*(-li2jk + lij2k + lijk2)
1476 xi(14) = 4._f64*(li2jk - lij2k + lijk2)
1477 xi(15) = 4._f64*(li2jk + lij2k - lijk2)
1483 sll_real64,
dimension(:),
intent(out) :: base
1484 sll_real64,
intent(in) :: l1, l2, l3
1485 sll_real64,
dimension(:),
allocatable :: xi
1486 sll_real64 :: step, step_sq
1489 step_sq = abs(mesh%r1_x1)
1498 base(4) = xi(5)*step
1499 base(5) = xi(4)*step
1500 base(6) = xi(6)*step
1501 base(7) = xi(7)*step
1502 base(8) = xi(9)*step
1503 base(9) = xi(8)*step
1507 base(13) = xi(13)*step_sq
1508 base(14) = xi(14)*step_sq
1509 base(15) = xi(15)*step_sq
1517 sll_real64,
dimension(:),
intent(in) :: f_tn
1518 sll_int32,
intent(in):: center_index
1519 sll_real64,
intent(out):: center_value
1520 sll_real64 :: center_value1, center_value2
1521 sll_real64 :: center_value3
1522 sll_int32 :: i1, i2, i3, k11, k12
1523 sll_int32 :: ni_3, ni_2, ni_1, ni, ni1, ni2, ni3, ni4
1524 sll_real64 :: x, y, x1
1526 sll_real64 :: r1, r2, r3, r4, r5, r6, r7, r8
1527 sll_real64 :: fi_3, fi_2, fi_1, fi, fi1, fi2, fi3, fi4
1529 x = mesh%center_cartesian_coord(1, center_index)
1530 y = mesh%center_cartesian_coord(2, center_index)
1534 x1 = mesh%cartesian_coord(1, i1)
1536 k11 = mesh%hex_coord(1, i1)
1537 k12 = mesh%hex_coord(2, i1)
1539 if (
test_in(k11 - 3, k12 + 4, mesh%num_cells))
then
1542 ni_3 = mesh%hex_to_global(k11 - 3, k12 + 4)
1546 if (
test_in(k11 - 2, k12 + 3, mesh%num_cells))
then
1549 ni_2 = mesh%hex_to_global(k11 - 2, k12 + 3)
1553 if (
test_in(k11 - 1, k12 + 2, mesh%num_cells))
then
1556 ni_1 = mesh%hex_to_global(k11 - 1, k12 + 2)
1560 if (
test_in(k11, k12 + 1, mesh%num_cells))
then
1563 ni = mesh%hex_to_global(k11, k12 + 1)
1567 if (
test_in(k11 + 1, k12, mesh%num_cells))
then
1570 ni1 = mesh%hex_to_global(k11 + 1, k12)
1574 if (
test_in(k11 + 2, k12 - 1, mesh%num_cells))
then
1577 ni2 = mesh%hex_to_global(k11 + 2, k12 - 1)
1581 if (
test_in(k11 + 3, k12 - 2, mesh%num_cells))
then
1584 ni3 = mesh%hex_to_global(k11 + 3, k12 - 2)
1588 if (
test_in(k11 + 4, k12 - 3, mesh%num_cells))
then
1591 ni4 = mesh%hex_to_global(k11 + 4, k12 - 3)
1618 r8 = -1.9704302961946860e-3_f64
1619 r7 = 1.987816445866990e-2_f64
1620 r6 = -0.10671435656759629e0_f64
1621 r5 = 0.8448219894934715e0_f64
1622 r4 = 0.3072079961794441e0_f64
1623 r3 = -7.7983568260935790e-2_f64
1624 r2 = 1.6484331502311610e-2_f64
1625 r1 = -1.7241265091703488e-3_f64
1648 center_value1 = r8*fi_3 + r7*fi_2 + r6*fi_1 + r5*fi + r4*fi1 + r3*fi2 &
1651 center_value1 = r1*fi_3 + r2*fi_2 + r3*fi_1 + r4*fi + r5*fi1 + r6*fi2 &
1657 if (
test_in(k11 + 4, k12 + 8, mesh%num_cells))
then
1660 ni_3 = mesh%hex_to_global(k11 + 4, k12 + 8)
1664 if (
test_in(k11 + 3, k12 + 6, mesh%num_cells))
then
1667 ni_2 = mesh%hex_to_global(k11 + 3, k12 + 6)
1671 if (
test_in(k11 + 2, k12 + 4, mesh%num_cells))
then
1674 ni_1 = mesh%hex_to_global(k11 + 2, k12 + 4)
1678 if (
test_in(k11 + 1, k12 + 2, mesh%num_cells))
then
1681 ni = mesh%hex_to_global(k11 + 1, k12 + 2)
1685 if (
test_in(k11, k12, mesh%num_cells))
then
1688 ni1 = mesh%hex_to_global(k11, k12)
1692 if (
test_in(k11 - 1, k12 - 2, mesh%num_cells))
then
1695 ni2 = mesh%hex_to_global(k11 - 1, k12 - 2)
1699 if (
test_in(k11 - 2, k12 - 4, mesh%num_cells))
then
1702 ni3 = mesh%hex_to_global(k11 - 2, k12 - 4)
1706 if (
test_in(k11 - 3, k12 - 3, mesh%num_cells))
then
1709 ni4 = mesh%hex_to_global(k11 - 3, k12 - 3)
1713 center_value2 = r1*fi_3 + r2*fi_2 + r3*fi_1 + r4*fi + r5*fi1 + r6*fi2 &
1716 if (
test_in(k11 - 7, k12 - 3, mesh%num_cells))
then
1719 ni_3 = mesh%hex_to_global(k11 - 7, k12 - 3)
1723 if (
test_in(k11 - 5, k12 - 2, mesh%num_cells))
then
1726 ni_2 = mesh%hex_to_global(k11 - 5, k12 - 2)
1730 if (
test_in(k11 - 3, k12 - 1, mesh%num_cells))
then
1733 ni_1 = mesh%hex_to_global(k11 - 3, k12 - 1)
1737 if (
test_in(k11 - 1, k12, mesh%num_cells))
then
1740 ni = mesh%hex_to_global(k11 - 1, k12)
1744 if (
test_in(k11 + 1, k12 + 1, mesh%num_cells))
then
1747 ni1 = mesh%hex_to_global(k11 + 1, k12 + 1)
1751 if (
test_in(k11 + 3, k12 + 2, mesh%num_cells))
then
1754 ni2 = mesh%hex_to_global(k11 + 3, k12 + 2)
1758 if (
test_in(k11 + 5, k12 + 3, mesh%num_cells))
then
1761 ni3 = mesh%hex_to_global(k11 + 5, k12 + 3)
1765 if (
test_in(k11 + 7, k12 + 4, mesh%num_cells))
then
1768 ni4 = mesh%hex_to_global(k11 + 7, k12 + 4)
1772 center_value3 = r1*fi_3 + r2*fi_2 + r3*fi_1 + r4*fi + r5*fi1 + r6*fi2 &
1777 if (
test_in(k11 + 4, k12 + 7, mesh%num_cells))
then
1780 ni_3 = mesh%hex_to_global(k11 + 4, k12 + 7)
1784 if (
test_in(k11 + 3, k12 + 5, mesh%num_cells))
then
1787 ni_2 = mesh%hex_to_global(k11 + 3, k12 + 5)
1791 if (
test_in(k11 + 2, k12 + 3, mesh%num_cells))
then
1794 ni_1 = mesh%hex_to_global(k11 + 2, k12 + 3)
1798 if (
test_in(k11 + 1, k12 + 1, mesh%num_cells))
then
1801 ni = mesh%hex_to_global(k11 + 1, k12 + 1)
1805 if (
test_in(k11, k12 - 1, mesh%num_cells))
then
1808 ni1 = mesh%hex_to_global(k11, k12 - 1)
1812 if (
test_in(k11 - 1, k12 - 3, mesh%num_cells))
then
1815 ni2 = mesh%hex_to_global(k11 - 1, k12 - 3)
1819 if (
test_in(k11 - 3, k12 - 5, mesh%num_cells))
then
1822 ni3 = mesh%hex_to_global(k11 - 3, k12 - 5)
1826 if (
test_in(k11 - 4, k12 - 7, mesh%num_cells))
then
1829 ni4 = mesh%hex_to_global(k11 - 4, k12 - 7)
1833 center_value2 = r8*fi_3 + r7*fi_2 + r6*fi_1 + r5*fi + r4*fi1 + r3*fi2 &
1836 if (
test_in(k11 - 6, k12 - 3, mesh%num_cells))
then
1839 ni_3 = mesh%hex_to_global(k11 - 6, k12 - 3)
1843 if (
test_in(k11 - 4, k12 - 2, mesh%num_cells))
then
1846 ni_2 = mesh%hex_to_global(k11 - 4, k12 - 2)
1850 if (
test_in(k11 - 2, k12 - 1, mesh%num_cells))
then
1853 ni_1 = mesh%hex_to_global(k11 - 2, k12 - 1)
1857 if (
test_in(k11, k12, mesh%num_cells))
then
1860 ni = mesh%hex_to_global(k11, k12)
1864 if (
test_in(k11 + 2, k12 + 1, mesh%num_cells))
then
1867 ni1 = mesh%hex_to_global(k11 + 2, k12 + 1)
1871 if (
test_in(k11 + 4, k12 + 2, mesh%num_cells))
then
1874 ni2 = mesh%hex_to_global(k11 + 4, k12 + 2)
1878 if (
test_in(k11 + 6, k12 + 3, mesh%num_cells))
then
1881 ni3 = mesh%hex_to_global(k11 + 6, k12 + 3)
1885 if (
test_in(k11 + 8, k12 + 4, mesh%num_cells))
then
1888 ni4 = mesh%hex_to_global(k11 + 8, k12 + 4)
1892 center_value3 = r8*fi_3 + r7*fi_2 + r6*fi_1 + r5*fi + r4*fi1 + r3*fi2 &
1896 center_value = (center_value1 + center_value2 + center_value3)/3._f64
1902 sll_int32,
intent(in) :: num_method
1904 if (num_method == 9)
then
1906 print *,
"*********************************"
1907 print *,
" Zienkiewicz_9_degree_of_freedom "
1908 print *,
"*********************************"
1910 else if (num_method == 10)
then
1912 print *,
"*********************************"
1913 print *,
" Zienkiewicz_10_degree_of_freedom"
1914 print *,
"*********************************"
1916 else if (num_method == 11)
then
1918 print *,
"*********************************"
1919 print *,
" Hsieh_Clough_Tocher_reduced "
1920 print *,
"*********************************"
1922 else if (num_method == 12)
then
1924 print *,
"*********************************"
1925 print *,
" Hsieh_Clough_Tocher_complete "
1926 print *,
"*********************************"
1928 else if (num_method == 15)
then
1930 print *,
"*********************************"
1931 print *,
" quartic element of Ganev_Dimitrov "
1932 print *,
"*********************************"
1935 print *,
"specify another number correspoonding to a existing implemented method 9, 10, 11, 12 or 15"
subroutine, public sll_s_compute_w_hermite(w, r, s)
subroutine, public sll_s_get_triangle_index(k1, k2, mesh, x, triangle_index)
Given a mesh point and the first cartesian coordinate of a point (that is not on the mesh) we return ...
subroutine, public sll_s_get_cell_vertices_index(x, y, mesh, s1, s2, s3)
Returns indices of the edges of a given cell.
subroutine, public sll_s_get_edge_index(k1, k2, mesh, x, edge_index1, edge_index2, edge_index3)
<BRIEF_DESCRIPTION>
subroutine get_normal_der(deriv, i1, i2, mesh, freedom)
subroutine base_from_local_base_xi_htc_c(base, xi, num_sub_triangle, mesh)
subroutine get_sub_triangle_hex(mesh, x1, x3, y1, y2, y3, x, y, num_sub_triangle)
subroutine, public sll_s_print_method(num_method)
subroutine product_with_sigma_hct_c(li, lj, lk, xi)
subroutine product_with_sigma_ganev_dimitrov(li, lj, lk, xi)
subroutine base_zienkiewicz_10_degree_of_freedom(base, step, l1, l2, l3)
subroutine reconstruction_center_values(mesh, f_tn, center_index, center_value)
subroutine base_from_local_base_xi_htc_r(base, xi, num_sub_triangle, step)
subroutine, public sll_s_hermite_interpolation(num, x, y, f_tn, center_value, edge_value, output_tn1, mesh, deriv, aire, num_method)
subroutine base_ganev_dimitrov(base, l1, l2, l3, mesh)
subroutine product_with_sigma_hct_r(li, lj, lk, xi)
subroutine, public sll_s_der_finite_difference(f_tn, p, step, mesh, deriv)
subroutine base_hsieh_clough_tocher_complete(base, x1, x3, y1, y2, y3, x, y, l1, l2, l3, mesh)
logical function test_in(h1, h2, num_cells)
subroutine base_zienkiewicz_9_degree_of_freedom(base, step, l1, l2, l3)
subroutine base_hsieh_clough_tocher_reduced(base, x1, x3, y1, y2, y3, x, y, l1, l2, l3, mesh)