64 real(kind=
rp),
allocatable :: g11(:,:,:,:)
66 real(kind=
rp),
allocatable :: g22(:,:,:,:)
68 real(kind=
rp),
allocatable :: g33(:,:,:,:)
70 real(kind=
rp),
allocatable :: g12(:,:,:,:)
72 real(kind=
rp),
allocatable :: g13(:,:,:,:)
74 real(kind=
rp),
allocatable :: g23(:,:,:,:)
76 real(kind=
rp),
allocatable :: mult(:,:,:,:)
81 real(kind=
rp),
allocatable :: dxdr(:,:,:,:), dydr(:,:,:,:), dzdr(:,:,:,:)
82 real(kind=
rp),
allocatable :: dxds(:,:,:,:), dyds(:,:,:,:), dzds(:,:,:,:)
83 real(kind=
rp),
allocatable :: dxdt(:,:,:,:), dydt(:,:,:,:), dzdt(:,:,:,:)
87 real(kind=
rp),
allocatable :: drdx(:,:,:,:), drdy(:,:,:,:), drdz(:,:,:,:)
88 real(kind=
rp),
allocatable :: dsdx(:,:,:,:), dsdy(:,:,:,:), dsdz(:,:,:,:)
89 real(kind=
rp),
allocatable :: dtdx(:,:,:,:), dtdy(:,:,:,:), dtdz(:,:,:,:)
91 real(kind=
rp),
allocatable :: h1(:,:,:,:)
92 real(kind=
rp),
allocatable :: h2(:,:,:,:)
95 real(kind=
rp),
allocatable :: jac(:,:,:,:)
96 real(kind=
rp),
allocatable :: jacinv(:,:,:,:)
97 real(kind=
rp),
allocatable :: b(:,:,:,:)
98 real(kind=
rp),
allocatable :: binv(:,:,:,:)
99 real(kind=
rp),
pointer :: blag(:,:,:,:) => null()
100 real(kind=
rp),
pointer :: blaglag(:,:,:,:) => null()
101 real(kind=
rp),
allocatable :: area(:,:,:,:)
102 real(kind=
rp),
allocatable :: nx(:,:,:,:)
103 real(kind=
rp),
allocatable :: ny(:,:,:,:)
104 real(kind=
rp),
allocatable :: nz(:,:,:,:)
105 logical :: cyclic = .false.
106 integer,
allocatable :: cyc_msk(:)
107 real(kind=
rp),
allocatable :: r11(:)
108 real(kind=
rp),
allocatable :: r12(:)
111 real(kind=
rp) :: volume
116 type(
gs_t),
pointer :: gs_h=> null()
122 type(c_ptr) :: g11_d = c_null_ptr
123 type(c_ptr) :: g22_d = c_null_ptr
124 type(c_ptr) :: g33_d = c_null_ptr
125 type(c_ptr) :: g12_d = c_null_ptr
126 type(c_ptr) :: g13_d = c_null_ptr
127 type(c_ptr) :: g23_d = c_null_ptr
128 type(c_ptr) :: dxdr_d = c_null_ptr
129 type(c_ptr) :: dydr_d = c_null_ptr
130 type(c_ptr) :: dzdr_d = c_null_ptr
131 type(c_ptr) :: dxds_d = c_null_ptr
132 type(c_ptr) :: dyds_d = c_null_ptr
133 type(c_ptr) :: dzds_d = c_null_ptr
134 type(c_ptr) :: dxdt_d = c_null_ptr
135 type(c_ptr) :: dydt_d = c_null_ptr
136 type(c_ptr) :: dzdt_d = c_null_ptr
137 type(c_ptr) :: drdx_d = c_null_ptr
138 type(c_ptr) :: drdy_d = c_null_ptr
139 type(c_ptr) :: drdz_d = c_null_ptr
140 type(c_ptr) :: dsdx_d = c_null_ptr
141 type(c_ptr) :: dsdy_d = c_null_ptr
142 type(c_ptr) :: dsdz_d = c_null_ptr
143 type(c_ptr) :: dtdx_d = c_null_ptr
144 type(c_ptr) :: dtdy_d = c_null_ptr
145 type(c_ptr) :: dtdz_d = c_null_ptr
146 type(c_ptr) :: mult_d = c_null_ptr
147 type(c_ptr) :: h1_d = c_null_ptr
148 type(c_ptr) :: h2_d = c_null_ptr
149 type(c_ptr) :: jac_d = c_null_ptr
150 type(c_ptr) :: jacinv_d = c_null_ptr
151 type(c_ptr) :: b_d = c_null_ptr
152 type(c_ptr) :: blag_d = c_null_ptr
153 type(c_ptr) :: blaglag_d = c_null_ptr
154 type(c_ptr) :: binv_d = c_null_ptr
155 type(c_ptr) :: area_d = c_null_ptr
156 type(c_ptr) :: nx_d = c_null_ptr
157 type(c_ptr) :: ny_d = c_null_ptr
158 type(c_ptr) :: nz_d = c_null_ptr
159 type(c_ptr) :: cyc_msk_d = c_null_ptr
160 type(c_ptr) :: r11_d = c_null_ptr
161 type(c_ptr) :: r12_d = c_null_ptr
175 generic :: init => init_empty, init_all
228 class(
coef_t),
intent(inout),
target :: this
229 type(
gs_t),
intent(inout),
target :: gs_h
230 integer :: n, m, ncyc
233 this%msh => gs_h%dofmap%msh
234 this%Xh => gs_h%dofmap%Xh
235 this%dof => gs_h%dofmap
242 allocate(this%G11(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
243 allocate(this%G22(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
244 allocate(this%G33(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
245 allocate(this%G12(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
246 allocate(this%G13(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
247 allocate(this%G23(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
249 allocate(this%dxdr(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
250 allocate(this%dxds(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
251 allocate(this%dxdt(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
253 allocate(this%dydr(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
254 allocate(this%dyds(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
255 allocate(this%dydt(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
257 allocate(this%dzdr(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
258 allocate(this%dzds(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
259 allocate(this%dzdt(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
261 allocate(this%drdx(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
262 allocate(this%dsdx(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
263 allocate(this%dtdx(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
265 allocate(this%drdy(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
266 allocate(this%dsdy(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
267 allocate(this%dtdy(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
269 allocate(this%drdz(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
270 allocate(this%dsdz(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
271 allocate(this%dtdz(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
273 allocate(this%jac(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
274 allocate(this%jacinv(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
276 allocate(this%area(this%Xh%lx, this%Xh%ly, 6, this%msh%nelv))
277 allocate(this%nx(this%Xh%lx, this%Xh%ly, 6, this%msh%nelv))
278 allocate(this%ny(this%Xh%lx, this%Xh%ly, 6, this%msh%nelv))
279 allocate(this%nz(this%Xh%lx, this%Xh%ly, 6, this%msh%nelv))
281 allocate(this%B(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
282 allocate(this%Binv(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
286 this%Blaglag => this%B
288 allocate(this%h1(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
289 allocate(this%h2(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
291 allocate(this%mult(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
298 n = this%Xh%lx * this%Xh%ly * this%Xh%lz * this%msh%nelv
336 call device_map(this%jacinv, this%jacinv_d, n)
340 this%Blag_d = this%B_d
341 this%Blaglag_d = this%B_d
343 m = this%Xh%lx * this%Xh%ly * 6 * this%msh%nelv
383 call rone(this%mult, n)
396 ncyc = this%msh%periodic%size * this%Xh%lx * this%Xh%lx
397 allocate(this%cyc_msk(0:ncyc))
398 this%cyc_msk(0) = ncyc + 1
399 if (ncyc .gt. 0)
then
400 allocate(this%R11(ncyc))
401 allocate(this%R12(ncyc))
404 call rone(this%R11, ncyc)
405 call rzero(this%R12, ncyc)
408 call device_map(this%cyc_msk, this%cyc_msk_d, ncyc+1)
769 type(
coef_t),
intent(inout) :: c
770 integer :: e, i, lxy, lyz, ntot
772 lxy = c%Xh%lx*c%Xh%ly
773 lyz = c%Xh%ly*c%Xh%lz
776 associate(drdx => c%drdx, drdy => c%drdy, drdz => c%drdz, &
777 dsdx => c%dsdx, dsdy => c%dsdy, dsdz => c%dsdz, &
778 dtdx => c%dtdx, dtdy => c%dtdy, dtdz => c%dtdz, &
779 dxdr => c%dxdr, dydr => c%dydr, dzdr => c%dzdr, &
780 dxds => c%dxds, dyds => c%dyds, dzds => c%dzds, &
781 dxdt => c%dxdt, dydt => c%dydt, dzdt => c%dzdt, &
782 dx => c%Xh%dx, dy => c%Xh%dy, dz => c%Xh%dz, &
783 x => c%dof%x, y => c%dof%y, z => c%dof%z, &
784 lx => c%Xh%lx, ly => c%Xh%ly, lz => c%Xh%lz, &
785 dyt => c%Xh%dyt, dzt => c%Xh%dzt, &
786 jacinv => c%jacinv, jac => c%jac)
791 c%dsdx_d, c%dsdy_d, c%dsdz_d, c%dtdx_d, c%dtdy_d, c%dtdz_d, &
792 c%dxdr_d, c%dydr_d, c%dzdr_d, c%dxds_d, c%dyds_d, c%dzds_d, &
793 c%dxdt_d, c%dydt_d, c%dzdt_d, c%Xh%dx_d, c%Xh%dy_d, c%Xh%dz_d, &
794 c%dof%x_d, c%dof%y_d, c%dof%z_d, c%jacinv_d, c%jac_d, &
841 call mxm(dx, lx, x(1,1,1,e), lx, dxdr(1,1,1,e), lyz)
842 call mxm(dx, lx, y(1,1,1,e), lx, dydr(1,1,1,e), lyz)
843 call mxm(dx, lx, z(1,1,1,e), lx, dzdr(1,1,1,e), lyz)
846 call mxm(x(1,1,i,e), lx, dyt, ly, dxds(1,1,i,e), ly)
847 call mxm(y(1,1,i,e), lx, dyt, ly, dyds(1,1,i,e), ly)
848 call mxm(z(1,1,i,e), lx, dyt, ly, dzds(1,1,i,e), ly)
852 if (c%msh%gdim .eq. 3)
then
853 call mxm(x(1,1,1,e), lxy, dzt, lz, dxdt(1,1,1,e), lz)
854 call mxm(y(1,1,1,e), lxy, dzt, lz, dydt(1,1,1,e), lz)
855 call mxm(z(1,1,1,e), lxy, dzt, lz, dzdt(1,1,1,e), lz)
857 call rzero(dxdt(1,1,1,e), lxy)
858 call rzero(dydt(1,1,1,e), lxy)
859 call rone(dzdt(1,1,1,e), lxy)
864 if (c%msh%gdim .eq. 2)
then
865 call rzero (jac, ntot)
866 call addcol3 (jac, dxdr, dyds, ntot)
867 call subcol3 (jac, dxds, dydr, ntot)
868 call copy (drdx, dyds, ntot)
869 call copy (drdy, dxds, ntot)
871 call copy (dsdx, dydr, ntot)
873 call copy (dsdy, dxdr, ntot)
874 call rzero (drdz, ntot)
875 call rzero (dsdz, ntot)
876 call rone (dtdz, ntot)
881 c%jac(i, 1, 1, 1) = 0.0_rp
886 c%jac(i, 1, 1, 1) = c%jac(i, 1, 1, 1) + ( c%dxdr(i, 1, 1, 1) &
887 * c%dyds(i, 1, 1, 1) * c%dzdt(i, 1, 1, 1) )
889 c%jac(i, 1, 1, 1) = c%jac(i, 1, 1, 1) + ( c%dxdt(i, 1, 1, 1) &
890 * c%dydr(i, 1, 1, 1) * c%dzds(i, 1, 1, 1) )
892 c%jac(i, 1, 1, 1) = c%jac(i, 1, 1, 1) + ( c%dxds(i, 1, 1, 1) &
893 * c%dydt(i, 1, 1, 1) * c%dzdr(i, 1, 1, 1) )
898 c%jac(i, 1, 1, 1) = c%jac(i, 1, 1, 1) - ( c%dxdr(i, 1, 1, 1) &
899 * c%dydt(i, 1, 1, 1) * c%dzds(i, 1, 1, 1) )
901 c%jac(i, 1, 1, 1) = c%jac(i, 1, 1, 1) - ( c%dxds(i, 1, 1, 1) &
902 * c%dydr(i, 1, 1, 1) * c%dzdt(i, 1, 1, 1) )
904 c%jac(i, 1, 1, 1) = c%jac(i, 1, 1, 1) - ( c%dxdt(i, 1, 1, 1) &
905 * c%dyds(i, 1, 1, 1) * c%dzdr(i, 1, 1, 1) )
910 c%drdx(i, 1, 1, 1) = c%dyds(i, 1, 1, 1) * c%dzdt(i, 1, 1, 1) &
911 - c%dydt(i, 1, 1, 1) * c%dzds(i, 1, 1, 1)
913 c%drdy(i, 1, 1, 1) = c%dxdt(i, 1, 1, 1) * c%dzds(i, 1, 1, 1) &
914 - c%dxds(i, 1, 1, 1) * c%dzdt(i, 1, 1, 1)
916 c%drdz(i, 1, 1, 1) = c%dxds(i, 1, 1, 1) * c%dydt(i, 1, 1, 1) &
917 - c%dxdt(i, 1, 1, 1) * c%dyds(i, 1, 1, 1)
922 c%dsdx(i, 1, 1, 1) = c%dydt(i, 1, 1, 1) * c%dzdr(i, 1, 1, 1) &
923 - c%dydr(i, 1, 1, 1) * c%dzdt(i, 1, 1, 1)
925 c%dsdy(i, 1, 1, 1) = c%dxdr(i, 1, 1, 1) * c%dzdt(i, 1, 1, 1) &
926 - c%dxdt(i, 1, 1, 1) * c%dzdr(i, 1, 1, 1)
928 c%dsdz(i, 1, 1, 1) = c%dxdt(i, 1, 1, 1) * c%dydr(i, 1, 1, 1) &
929 - c%dxdr(i, 1, 1, 1) * c%dydt(i, 1, 1, 1)
934 c%dtdx(i, 1, 1, 1) = c%dydr(i, 1, 1, 1) * c%dzds(i, 1, 1, 1) &
935 - c%dyds(i, 1, 1, 1) * c%dzdr(i, 1, 1, 1)
937 c%dtdy(i, 1, 1, 1) = c%dxds(i, 1, 1, 1) * c%dzdr(i, 1, 1, 1) &
938 - c%dxdr(i, 1, 1, 1) * c%dzds(i, 1, 1, 1)
940 c%dtdz(i, 1, 1, 1) = c%dxdr(i, 1, 1, 1) * c%dyds(i, 1, 1, 1) &
941 - c%dxds(i, 1, 1, 1) * c%dydr(i, 1, 1, 1)
946 call invers2(jacinv, jac, ntot)
955 type(
coef_t),
intent(inout) :: c
956 integer :: e, i, lxyz, ntot
958 lxyz = c%Xh%lx * c%Xh%ly * c%Xh%lz
961 if (neko_bcknd_device .eq. 1)
then
963 call device_coef_generate_geo(c%G11_d, c%G12_d, c%G13_d, &
964 c%G22_d, c%G23_d, c%G33_d, &
965 c%drdx_d, c%drdy_d, c%drdz_d, &
966 c%dsdx_d, c%dsdy_d, c%dsdz_d, &
967 c%dtdx_d, c%dtdy_d, c%dtdz_d, &
968 c%jacinv_d, c%Xh%w3_d, c%msh%nelv, &
971 call device_memcpy(c%G11, c%G11_d, ntot, device_to_host, sync = .false.)
972 call device_memcpy(c%G22, c%G22_d, ntot, device_to_host, sync = .false.)
973 call device_memcpy(c%G33, c%G33_d, ntot, device_to_host, sync = .false.)
974 call device_memcpy(c%G12, c%G12_d, ntot, device_to_host, sync = .false.)
975 call device_memcpy(c%G13, c%G13_d, ntot, device_to_host, sync = .false.)
976 call device_memcpy(c%G23, c%G23_d, ntot, device_to_host, sync = .true.)
979 if (c%msh%gdim .eq. 2)
then
982 c%G11(i, 1, 1, 1) = c%drdx(i, 1, 1, 1) * c%drdx(i, 1, 1, 1) &
983 + c%drdy(i, 1, 1, 1) * c%drdy(i, 1, 1, 1)
985 c%G22(i, 1, 1, 1) = c%dsdx(i, 1, 1, 1) * c%dsdx(i, 1, 1, 1) &
986 + c%dsdy(i, 1, 1, 1) * c%dsdy(i, 1, 1, 1)
988 c%G12(i, 1, 1, 1) = c%drdx(i, 1, 1, 1) * c%dsdx(i, 1, 1, 1) &
989 + c%drdy(i, 1, 1, 1) * c%dsdy(i, 1, 1, 1)
993 c%G11(i, 1, 1, 1) = c%G11(i, 1, 1, 1) * c%jacinv(i, 1, 1, 1)
994 c%G22(i, 1, 1, 1) = c%G22(i, 1, 1, 1) * c%jacinv(i, 1, 1, 1)
995 c%G12(i, 1, 1, 1) = c%G12(i, 1, 1, 1) * c%jacinv(i, 1, 1, 1)
996 c%G33(i, 1, 1, 1) = 0.0_rp
997 c%G13(i, 1, 1, 1) = 0.0_rp
998 c%G23(i, 1, 1, 1) = 0.0_rp
1001 do concurrent(e = 1:c%msh%nelv)
1002 do concurrent(i = 1:lxyz)
1003 c%G11(i,1,1,e) = c%G11(i,1,1,e) * c%Xh%w3(i,1,1)
1004 c%G22(i,1,1,e) = c%G22(i,1,1,e) * c%Xh%w3(i,1,1)
1005 c%G12(i,1,1,e) = c%G12(i,1,1,e) * c%Xh%w3(i,1,1)
1013 c%G11(i, 1, 1, 1) = c%drdx(i, 1, 1, 1) * c%drdx(i, 1, 1, 1) &
1014 + c%drdy(i, 1, 1, 1) * c%drdy(i, 1, 1, 1) &
1015 + c%drdz(i, 1, 1, 1) * c%drdz(i, 1, 1, 1)
1017 c%G22(i, 1, 1, 1) = c%dsdx(i, 1, 1, 1) * c%dsdx(i, 1, 1, 1) &
1018 + c%dsdy(i, 1, 1, 1) * c%dsdy(i, 1, 1, 1) &
1019 + c%dsdz(i, 1, 1, 1) * c%dsdz(i, 1, 1, 1)
1021 c%G33(i, 1, 1, 1) = c%dtdx(i, 1, 1, 1) * c%dtdx(i, 1, 1, 1) &
1022 + c%dtdy(i, 1, 1, 1) * c%dtdy(i, 1, 1, 1) &
1023 + c%dtdz(i, 1, 1, 1) * c%dtdz(i, 1, 1, 1)
1028 c%G11(i, 1, 1, 1) = c%G11(i, 1, 1, 1) * c%jacinv(i, 1, 1, 1)
1029 c%G22(i, 1, 1, 1) = c%G22(i, 1, 1, 1) * c%jacinv(i, 1, 1, 1)
1030 c%G33(i, 1, 1, 1) = c%G33(i, 1, 1, 1) * c%jacinv(i, 1, 1, 1)
1035 c%G12(i, 1, 1, 1) = c%drdx(i, 1, 1, 1) * c%dsdx(i, 1, 1, 1) &
1036 + c%drdy(i, 1, 1, 1) * c%dsdy(i, 1, 1, 1) &
1037 + c%drdz(i, 1, 1, 1) * c%dsdz(i, 1, 1, 1)
1039 c%G13(i, 1, 1, 1) = c%drdx(i, 1, 1, 1) * c%dtdx(i, 1, 1, 1) &
1040 + c%drdy(i, 1, 1, 1) * c%dtdy(i, 1, 1, 1) &
1041 + c%drdz(i, 1, 1, 1) * c%dtdz(i, 1, 1, 1)
1043 c%G23(i, 1, 1, 1) = c%dsdx(i, 1, 1, 1) * c%dtdx(i, 1, 1, 1) &
1044 + c%dsdy(i, 1, 1, 1) * c%dtdy(i, 1, 1, 1) &
1045 + c%dsdz(i, 1, 1, 1) * c%dtdz(i, 1, 1, 1)
1050 c%G12(i, 1, 1, 1) = c%G12(i, 1, 1, 1) * c%jacinv(i, 1, 1, 1)
1051 c%G13(i, 1, 1, 1) = c%G13(i, 1, 1, 1) * c%jacinv(i, 1, 1, 1)
1052 c%G23(i, 1, 1, 1) = c%G23(i, 1, 1, 1) * c%jacinv(i, 1, 1, 1)
1056 do e = 1, c%msh%nelv
1057 do concurrent(i = 1:lxyz)
1058 c%G11(i,1,1,e) = c%G11(i,1,1,e) * c%Xh%w3(i,1,1)
1059 c%G22(i,1,1,e) = c%G22(i,1,1,e) * c%Xh%w3(i,1,1)
1060 c%G12(i,1,1,e) = c%G12(i,1,1,e) * c%Xh%w3(i,1,1)
1062 c%G33(i,1,1,e) = c%G33(i,1,1,e) * c%Xh%w3(i,1,1)
1063 c%G13(i,1,1,e) = c%G13(i,1,1,e) * c%Xh%w3(i,1,1)
1064 c%G23(i,1,1,e) = c%G23(i,1,1,e) * c%Xh%w3(i,1,1)
1157 type(
coef_t),
intent(inout) :: coef
1158 real(kind=rp),
allocatable :: a(:,:,:,:)
1159 real(kind=rp),
allocatable :: b(:,:,:,:)
1160 real(kind=rp),
allocatable :: c(:,:,:,:)
1161 real(kind=rp),
allocatable :: dot(:,:,:,:)
1162 integer :: n, e, i, j, k, lx
1163 real(kind=rp) :: weight, len
1167 allocate(a(coef%Xh%lx, coef%Xh%lx, coef%Xh%lx, coef%msh%nelv))
1168 allocate(b(coef%Xh%lx, coef%Xh%lx, coef%Xh%lx, coef%msh%nelv))
1169 allocate(c(coef%Xh%lx, coef%Xh%lx, coef%Xh%lx, coef%msh%nelv))
1170 allocate(dot(coef%Xh%lx, coef%Xh%lx, coef%Xh%lx, coef%msh%nelv))
1177 a(i, 1, 1, 1) = coef%dyds(i, 1, 1, 1) * coef%dzdt(i, 1, 1, 1) &
1178 - coef%dzds(i, 1, 1, 1) * coef%dydt(i, 1, 1, 1)
1180 b(i, 1, 1, 1) = coef%dzds(i, 1, 1, 1) * coef%dxdt(i, 1, 1, 1) &
1181 - coef%dxds(i, 1, 1, 1) * coef%dzdt(i, 1, 1, 1)
1183 c(i, 1, 1, 1) = coef%dxds(i, 1, 1, 1) * coef%dydt(i, 1, 1, 1) &
1184 - coef%dyds(i, 1, 1, 1) * coef%dxdt(i, 1, 1, 1)
1189 dot(i, 1, 1, 1) = a(i, 1, 1, 1) * a(i, 1, 1, 1) &
1190 + b(i, 1, 1, 1) * b(i, 1, 1, 1) &
1191 + c(i, 1, 1, 1) * c(i, 1, 1, 1)
1195 do e = 1, coef%msh%nelv
1196 do concurrent(k = 1:coef%Xh%lx)
1197 do concurrent(j = 1:coef%Xh%lx)
1198 weight = coef%Xh%wy(j) * coef%Xh%wz(k)
1199 coef%area(j, k, 2, e) = sqrt(dot(lx, j, k, e)) * weight
1200 coef%area(j, k, 1, e) = sqrt(dot(1, j, k, e)) * weight
1201 coef%nx(j,k, 1, e) = -a(1, j, k, e)
1202 coef%nx(j,k, 2, e) = a(lx, j, k, e)
1203 coef%ny(j,k, 1, e) = -b(1, j, k, e)
1204 coef%ny(j,k, 2, e) = b(lx, j, k, e)
1205 coef%nz(j,k, 1, e) = -c(1, j, k, e)
1206 coef%nz(j,k, 2, e) = c(lx, j, k, e)
1215 a(i, 1, 1, 1) = coef%dydr(i, 1, 1, 1) * coef%dzdt(i, 1, 1, 1) &
1216 - coef%dzdr(i, 1, 1, 1) * coef%dydt(i, 1, 1, 1)
1218 b(i, 1, 1, 1) = coef%dzdr(i, 1, 1, 1) * coef%dxdt(i, 1, 1, 1) &
1219 - coef%dxdr(i, 1, 1, 1) * coef%dzdt(i, 1, 1, 1)
1221 c(i, 1, 1, 1) = coef%dxdr(i, 1, 1, 1) * coef%dydt(i, 1, 1, 1) &
1222 - coef%dydr(i, 1, 1, 1) * coef%dxdt(i, 1, 1, 1)
1227 dot(i, 1, 1, 1) = a(i, 1, 1, 1) * a(i, 1, 1, 1) &
1228 + b(i, 1, 1, 1) * b(i, 1, 1, 1) &
1229 + c(i, 1, 1, 1) * c(i, 1, 1, 1)
1233 do e = 1, coef%msh%nelv
1234 do concurrent(k = 1:coef%Xh%lx)
1235 do concurrent(j = 1:coef%Xh%lx)
1236 weight = coef%Xh%wx(j) * coef%Xh%wz(k)
1237 coef%area(j, k, 3, e) = sqrt(dot(j, 1, k, e)) * weight
1238 coef%area(j, k, 4, e) = sqrt(dot(j, lx, k, e)) * weight
1239 coef%nx(j,k, 3, e) = a(j, 1, k, e)
1240 coef%nx(j,k, 4, e) = -a(j, lx, k, e)
1241 coef%ny(j,k, 3, e) = b(j, 1, k, e)
1242 coef%ny(j,k, 4, e) = -b(j, lx, k, e)
1243 coef%nz(j,k, 3, e) = c(j, 1, k, e)
1244 coef%nz(j,k, 4, e) = -c(j, lx, k, e)
1252 a(i, 1, 1, 1) = coef%dydr(i, 1, 1, 1) * coef%dzds(i, 1, 1, 1) &
1253 - coef%dzdr(i, 1, 1, 1) * coef%dyds(i, 1, 1, 1)
1255 b(i, 1, 1, 1) = coef%dzdr(i, 1, 1, 1) * coef%dxds(i, 1, 1, 1) &
1256 - coef%dxdr(i, 1, 1, 1) * coef%dzds(i, 1, 1, 1)
1258 c(i, 1, 1, 1) = coef%dxdr(i, 1, 1, 1) * coef%dyds(i, 1, 1, 1) &
1259 - coef%dydr(i, 1, 1, 1) * coef%dxds(i, 1, 1, 1)
1264 dot(i, 1, 1, 1) = a(i, 1, 1, 1) * a(i, 1, 1, 1) &
1265 + b(i, 1, 1, 1) * b(i, 1, 1, 1) &
1266 + c(i, 1, 1, 1) * c(i, 1, 1, 1)
1270 do e = 1, coef%msh%nelv
1271 do concurrent(k = 1:coef%Xh%lx)
1272 do concurrent(j = 1:coef%Xh%lx)
1273 weight = coef%Xh%wx(j) * coef%Xh%wy(k)
1274 coef%area(j, k, 5, e) = sqrt(dot(j, k, 1, e)) * weight
1275 coef%area(j, k, 6, e) = sqrt(dot(j, k, lx, e)) * weight
1276 coef%nx(j,k, 5, e) = -a(j, k, 1, e)
1277 coef%nx(j,k, 6, e) = a(j, k, lx, e)
1278 coef%ny(j,k, 5, e) = -b(j, k, 1, e)
1279 coef%ny(j,k, 6, e) = b(j, k, lx, e)
1280 coef%nz(j,k, 5, e) = -c(j, k, 1, e)
1281 coef%nz(j,k, 6, e) = c(j, k, lx, e)
1288 do j = 1,
size(coef%nz)
1289 len = sqrt(coef%nx(j,1,1,1)**2 + &
1290 coef%ny(j,1,1,1)**2 + coef%nz(j,1,1,1)**2)
1291 if (len .gt. neko_eps)
then
1292 coef%nx(j,1,1,1) = coef%nx(j,1,1,1) / len
1293 coef%ny(j,1,1,1) = coef%ny(j,1,1,1) / len
1294 coef%nz(j,1,1,1) = coef%nz(j,1,1,1) / len
1305 if (neko_bcknd_device .eq. 1)
then
1307 call device_memcpy(coef%area, coef%area_d, n, &
1308 host_to_device, sync = .false.)
1309 call device_memcpy(coef%nx, coef%nx_d, n, &
1310 host_to_device, sync = .false.)
1311 call device_memcpy(coef%ny, coef%ny_d, n, &
1312 host_to_device, sync = .false.)
1313 call device_memcpy(coef%nz, coef%nz_d, n, &
1314 host_to_device, sync = .false.)
1320 class(
coef_t),
intent(inout) :: this
1321 real(kind=rp) :: un(3), len, d
1322 integer :: lx, ly, lz, np, np_glb, ierr
1323 integer :: i, j, k, pf, pe, n, nc, ncyc
1325 if (.not. this%cyclic)
return
1327 np = this%msh%periodic%size
1328 call mpi_allreduce(np, np_glb, 1, &
1329 mpi_integer, mpi_sum, neko_comm, ierr)
1331 if (np_glb .eq. 0)
then
1332 call neko_error(
"There are no periodic boundaries. " // &
1333 "Switch cyclic off in the case file.")
1336 if (np .eq. 0)
return
1341 ncyc = this%cyc_msk(0) - 1
1344 pf = this%msh%periodic%facet_el(n)%x(1)
1345 pe = this%msh%periodic%facet_el(n)%x(2)
1349 if (index_is_on_facet(i, j, k, lx, ly, lz, pf))
then
1350 un = this%get_normal(i, j, k, pe, pf)
1351 len = sqrt(un(1) * un(1) + un(2) * un(2))
1352 if (len .gt. neko_eps)
then
1353 d = this%dof%y(i, j, k, pe) * un(1) &
1354 - this%dof%x(i, j, k, pe) * un(2)
1356 this%cyc_msk(nc) = linear_index(i, j, k, pe, lx, ly, lz)
1357 this%R11(nc) = un(1) / len * sign(1.0_rp, d)
1358 this%R12(nc) = un(2) / len * sign(1.0_rp, d)
1361 call neko_error(
"x and y components of surface " // &
1362 "normals are zero. Cyclic rotations must be " // &
1371 if (nc - 1 /= ncyc)
then
1372 call neko_error(
"The number of cyclic GLL points were " // &
1373 "not estimated correctly.")
1376 if (neko_bcknd_device .eq. 1)
then
1377 call device_memcpy(this%cyc_msk, this%cyc_msk_d, ncyc+1, &
1378 host_to_device, sync = .false.)
1379 call device_memcpy(this%R11, this%R11_d, ncyc, &
1380 host_to_device, sync = .false.)
1381 call device_memcpy(this%R12, this%R12_d, ncyc, &
1382 host_to_device, sync = .false.)