60 real(kind=
rp),
allocatable :: g11(:,:,:,:)
62 real(kind=
rp),
allocatable :: g22(:,:,:,:)
64 real(kind=
rp),
allocatable :: g33(:,:,:,:)
66 real(kind=
rp),
allocatable :: g12(:,:,:,:)
68 real(kind=
rp),
allocatable :: g13(:,:,:,:)
70 real(kind=
rp),
allocatable :: g23(:,:,:,:)
72 real(kind=
rp),
allocatable :: mult(:,:,:,:)
77 real(kind=
rp),
allocatable :: dxdr(:,:,:,:), dydr(:,:,:,:), dzdr(:,:,:,:)
78 real(kind=
rp),
allocatable :: dxds(:,:,:,:), dyds(:,:,:,:), dzds(:,:,:,:)
79 real(kind=
rp),
allocatable :: dxdt(:,:,:,:), dydt(:,:,:,:), dzdt(:,:,:,:)
83 real(kind=
rp),
allocatable :: drdx(:,:,:,:), drdy(:,:,:,:), drdz(:,:,:,:)
84 real(kind=
rp),
allocatable :: dsdx(:,:,:,:), dsdy(:,:,:,:), dsdz(:,:,:,:)
85 real(kind=
rp),
allocatable :: dtdx(:,:,:,:), dtdy(:,:,:,:), dtdz(:,:,:,:)
87 real(kind=
rp),
allocatable :: h1(:,:,:,:)
88 real(kind=
rp),
allocatable :: h2(:,:,:,:)
91 real(kind=
rp),
allocatable :: jac(:,:,:,:)
92 real(kind=
rp),
allocatable :: jacinv(:,:,:,:)
93 real(kind=
rp),
allocatable :: b(:,:,:,:)
94 real(kind=
rp),
allocatable :: binv(:,:,:,:)
96 real(kind=
rp),
allocatable :: area(:,:,:,:)
97 real(kind=
rp),
allocatable :: nx(:,:,:,:)
98 real(kind=
rp),
allocatable :: ny(:,:,:,:)
99 real(kind=
rp),
allocatable :: nz(:,:,:,:)
100 logical :: cyclic = .false.
101 integer,
allocatable :: cyc_msk(:)
102 real(kind=
rp),
allocatable :: r11(:)
103 real(kind=
rp),
allocatable :: r12(:)
106 real(kind=
rp) :: volume
111 type(
gs_t),
pointer :: gs_h=> null()
117 type(c_ptr) :: g11_d = c_null_ptr
118 type(c_ptr) :: g22_d = c_null_ptr
119 type(c_ptr) :: g33_d = c_null_ptr
120 type(c_ptr) :: g12_d = c_null_ptr
121 type(c_ptr) :: g13_d = c_null_ptr
122 type(c_ptr) :: g23_d = c_null_ptr
123 type(c_ptr) :: dxdr_d = c_null_ptr
124 type(c_ptr) :: dydr_d = c_null_ptr
125 type(c_ptr) :: dzdr_d = c_null_ptr
126 type(c_ptr) :: dxds_d = c_null_ptr
127 type(c_ptr) :: dyds_d = c_null_ptr
128 type(c_ptr) :: dzds_d = c_null_ptr
129 type(c_ptr) :: dxdt_d = c_null_ptr
130 type(c_ptr) :: dydt_d = c_null_ptr
131 type(c_ptr) :: dzdt_d = c_null_ptr
132 type(c_ptr) :: drdx_d = c_null_ptr
133 type(c_ptr) :: drdy_d = c_null_ptr
134 type(c_ptr) :: drdz_d = c_null_ptr
135 type(c_ptr) :: dsdx_d = c_null_ptr
136 type(c_ptr) :: dsdy_d = c_null_ptr
137 type(c_ptr) :: dsdz_d = c_null_ptr
138 type(c_ptr) :: dtdx_d = c_null_ptr
139 type(c_ptr) :: dtdy_d = c_null_ptr
140 type(c_ptr) :: dtdz_d = c_null_ptr
141 type(c_ptr) :: mult_d = c_null_ptr
142 type(c_ptr) :: h1_d = c_null_ptr
143 type(c_ptr) :: h2_d = c_null_ptr
144 type(c_ptr) :: jac_d = c_null_ptr
145 type(c_ptr) :: jacinv_d = c_null_ptr
146 type(c_ptr) :: b_d = c_null_ptr
147 type(c_ptr) :: binv_d = c_null_ptr
148 type(c_ptr) :: area_d = c_null_ptr
149 type(c_ptr) :: nx_d = c_null_ptr
150 type(c_ptr) :: ny_d = c_null_ptr
151 type(c_ptr) :: nz_d = c_null_ptr
152 type(c_ptr) :: cyc_msk_d = c_null_ptr
153 type(c_ptr) :: r11_d = c_null_ptr
154 type(c_ptr) :: r12_d = c_null_ptr
165 generic :: init => init_empty, init_all
218 class(
coef_t),
intent(inout) :: this
219 type(
gs_t),
intent(inout),
target :: gs_h
220 integer :: n, m, ncyc
223 this%msh => gs_h%dofmap%msh
224 this%Xh => gs_h%dofmap%Xh
225 this%dof => gs_h%dofmap
232 allocate(this%G11(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
233 allocate(this%G22(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
234 allocate(this%G33(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
235 allocate(this%G12(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
236 allocate(this%G13(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
237 allocate(this%G23(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
239 allocate(this%dxdr(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
240 allocate(this%dxds(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
241 allocate(this%dxdt(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
243 allocate(this%dydr(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
244 allocate(this%dyds(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
245 allocate(this%dydt(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
247 allocate(this%dzdr(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
248 allocate(this%dzds(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
249 allocate(this%dzdt(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
251 allocate(this%drdx(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
252 allocate(this%dsdx(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
253 allocate(this%dtdx(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
255 allocate(this%drdy(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
256 allocate(this%dsdy(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
257 allocate(this%dtdy(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
259 allocate(this%drdz(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
260 allocate(this%dsdz(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
261 allocate(this%dtdz(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
263 allocate(this%jac(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
264 allocate(this%jacinv(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
266 allocate(this%area(this%Xh%lx, this%Xh%ly, 6, this%msh%nelv))
267 allocate(this%nx(this%Xh%lx, this%Xh%ly, 6, this%msh%nelv))
268 allocate(this%ny(this%Xh%lx, this%Xh%ly, 6, this%msh%nelv))
269 allocate(this%nz(this%Xh%lx, this%Xh%ly, 6, this%msh%nelv))
271 allocate(this%B(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
272 allocate(this%Binv(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
274 allocate(this%h1(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
275 allocate(this%h2(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
277 allocate(this%mult(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
284 n = this%Xh%lx * this%Xh%ly * this%Xh%lz * this%msh%nelv
322 call device_map(this%jacinv, this%jacinv_d, n)
326 m = this%Xh%lx * this%Xh%ly * 6 * this%msh%nelv
366 call rone(this%mult, n)
379 ncyc = this%msh%periodic%size * this%Xh%lx * this%Xh%lx
380 allocate(this%cyc_msk(0:ncyc))
381 this%cyc_msk(0) = ncyc + 1
382 if (ncyc .gt. 0)
then
383 allocate(this%R11(ncyc))
384 allocate(this%R12(ncyc))
387 call rone(this%R11, ncyc)
388 call rzero(this%R12, ncyc)
391 call device_map(this%cyc_msk, this%cyc_msk_d, ncyc+1)
725 type(
coef_t),
intent(inout) :: c
726 integer :: e,i,lxy,lyz,ntot
732 associate(drdx => c%drdx, drdy => c%drdy, drdz => c%drdz, &
733 dsdx => c%dsdx, dsdy => c%dsdy, dsdz => c%dsdz, &
734 dtdx => c%dtdx, dtdy => c%dtdy, dtdz => c%dtdz, &
735 dxdr => c%dxdr, dydr => c%dydr, dzdr => c%dzdr, &
736 dxds => c%dxds, dyds => c%dyds, dzds => c%dzds, &
737 dxdt => c%dxdt, dydt => c%dydt, dzdt => c%dzdt, &
738 dx => c%Xh%dx, dy => c%Xh%dy, dz => c%Xh%dz, &
739 x => c%dof%x, y => c%dof%y, z => c%dof%z, &
740 lx => c%Xh%lx, ly => c%Xh%ly, lz => c%Xh%lz, &
741 dyt => c%Xh%dyt, dzt => c%Xh%dzt, &
742 jacinv => c%jacinv, jac => c%jac)
747 c%dsdx_d, c%dsdy_d, c%dsdz_d, c%dtdx_d, c%dtdy_d, c%dtdz_d, &
748 c%dxdr_d, c%dydr_d, c%dzdr_d, c%dxds_d, c%dyds_d, c%dzds_d, &
749 c%dxdt_d, c%dydt_d, c%dzdt_d, c%Xh%dx_d, c%Xh%dy_d, c%Xh%dz_d, &
750 c%dof%x_d, c%dof%y_d, c%dof%z_d, c%jacinv_d, c%jac_d, &
777 call mxm(dx, lx, x(1,1,1,e), lx, dxdr(1,1,1,e), lyz)
778 call mxm(dx, lx, y(1,1,1,e), lx, dydr(1,1,1,e), lyz)
779 call mxm(dx, lx, z(1,1,1,e), lx, dzdr(1,1,1,e), lyz)
782 call mxm(x(1,1,i,e), lx, dyt, ly, dxds(1,1,i,e), ly)
783 call mxm(y(1,1,i,e), lx, dyt, ly, dyds(1,1,i,e), ly)
784 call mxm(z(1,1,i,e), lx, dyt, ly, dzds(1,1,i,e), ly)
788 if(c%msh%gdim .eq. 3)
then
789 call mxm(x(1,1,1,e), lxy, dzt, lz, dxdt(1,1,1,e), lz)
790 call mxm(y(1,1,1,e), lxy, dzt, lz, dydt(1,1,1,e), lz)
791 call mxm(z(1,1,1,e), lxy, dzt, lz, dzdt(1,1,1,e), lz)
793 call rzero(dxdt(1,1,1,e), lxy)
794 call rzero(dydt(1,1,1,e), lxy)
795 call rone(dzdt(1,1,1,e), lxy)
799 if (c%msh%gdim .eq. 2)
then
800 call rzero (jac, ntot)
801 call addcol3 (jac, dxdr, dyds, ntot)
802 call subcol3 (jac, dxds, dydr, ntot)
803 call copy (drdx, dyds, ntot)
804 call copy (drdy, dxds, ntot)
806 call copy (dsdx, dydr, ntot)
808 call copy (dsdy, dxdr, ntot)
809 call rzero (drdz, ntot)
810 call rzero (dsdz, ntot)
811 call rone (dtdz, ntot)
815 c%jac(i, 1, 1, 1) = 0.0_rp
819 c%jac(i, 1, 1, 1) = c%jac(i, 1, 1, 1) + ( c%dxdr(i, 1, 1, 1) &
820 * c%dyds(i, 1, 1, 1) * c%dzdt(i, 1, 1, 1) )
822 c%jac(i, 1, 1, 1) = c%jac(i, 1, 1, 1) + ( c%dxdt(i, 1, 1, 1) &
823 * c%dydr(i, 1, 1, 1) * c%dzds(i, 1, 1, 1) )
825 c%jac(i, 1, 1, 1) = c%jac(i, 1, 1, 1) + ( c%dxds(i, 1, 1, 1) &
826 * c%dydt(i, 1, 1, 1) * c%dzdr(i, 1, 1, 1) )
830 c%jac(i, 1, 1, 1) = c%jac(i, 1, 1, 1) - ( c%dxdr(i, 1, 1, 1) &
831 * c%dydt(i, 1, 1, 1) * c%dzds(i, 1, 1, 1) )
833 c%jac(i, 1, 1, 1) = c%jac(i, 1, 1, 1) - ( c%dxds(i, 1, 1, 1) &
834 * c%dydr(i, 1, 1, 1) * c%dzdt(i, 1, 1, 1) )
836 c%jac(i, 1, 1, 1) = c%jac(i, 1, 1, 1) - ( c%dxdt(i, 1, 1, 1) &
837 * c%dyds(i, 1, 1, 1) * c%dzdr(i, 1, 1, 1) )
841 c%drdx(i, 1, 1, 1) = c%dyds(i, 1, 1, 1) * c%dzdt(i, 1, 1, 1) &
842 - c%dydt(i, 1, 1, 1) * c%dzds(i, 1, 1, 1)
844 c%drdy(i, 1, 1, 1) = c%dxdt(i, 1, 1, 1) * c%dzds(i, 1, 1, 1) &
845 - c%dxds(i, 1, 1, 1) * c%dzdt(i, 1, 1, 1)
847 c%drdz(i, 1, 1, 1) = c%dxds(i, 1, 1, 1) * c%dydt(i, 1, 1, 1) &
848 - c%dxdt(i, 1, 1, 1) * c%dyds(i, 1, 1, 1)
852 c%dsdx(i, 1, 1, 1) = c%dydt(i, 1, 1, 1) * c%dzdr(i, 1, 1, 1) &
853 - c%dydr(i, 1, 1, 1) * c%dzdt(i, 1, 1, 1)
855 c%dsdy(i, 1, 1, 1) = c%dxdr(i, 1, 1, 1) * c%dzdt(i, 1, 1, 1) &
856 - c%dxdt(i, 1, 1, 1) * c%dzdr(i, 1, 1, 1)
858 c%dsdz(i, 1, 1, 1) = c%dxdt(i, 1, 1, 1) * c%dydr(i, 1, 1, 1) &
859 - c%dxdr(i, 1, 1, 1) * c%dydt(i, 1, 1, 1)
863 c%dtdx(i, 1, 1, 1) = c%dydr(i, 1, 1, 1) * c%dzds(i, 1, 1, 1) &
864 - c%dyds(i, 1, 1, 1) * c%dzdr(i, 1, 1, 1)
866 c%dtdy(i, 1, 1, 1) = c%dxds(i, 1, 1, 1) * c%dzdr(i, 1, 1, 1) &
867 - c%dxdr(i, 1, 1, 1) * c%dzds(i, 1, 1, 1)
869 c%dtdz(i, 1, 1, 1) = c%dxdr(i, 1, 1, 1) * c%dyds(i, 1, 1, 1) &
870 - c%dxds(i, 1, 1, 1) * c%dydr(i, 1, 1, 1)
874 call invers2(jacinv, jac, ntot)
883 type(
coef_t),
intent(inout) :: c
884 integer :: e, i, lxyz, ntot
886 lxyz = c%Xh%lx * c%Xh%ly * c%Xh%lz
889 if (neko_bcknd_device .eq. 1)
then
891 call device_coef_generate_geo(c%G11_d, c%G12_d, c%G13_d, &
892 c%G22_d, c%G23_d, c%G33_d, &
893 c%drdx_d, c%drdy_d, c%drdz_d, &
894 c%dsdx_d, c%dsdy_d, c%dsdz_d, &
895 c%dtdx_d, c%dtdy_d, c%dtdz_d, &
896 c%jacinv_d, c%Xh%w3_d, c%msh%nelv, &
899 call device_memcpy(c%G11, c%G11_d, ntot, device_to_host, sync=.false.)
900 call device_memcpy(c%G22, c%G22_d, ntot, device_to_host, sync=.false.)
901 call device_memcpy(c%G33, c%G33_d, ntot, device_to_host, sync=.false.)
902 call device_memcpy(c%G12, c%G12_d, ntot, device_to_host, sync=.false.)
903 call device_memcpy(c%G13, c%G13_d, ntot, device_to_host, sync=.false.)
904 call device_memcpy(c%G23, c%G23_d, ntot, device_to_host, sync=.true.)
907 if(c%msh%gdim .eq. 2)
then
910 c%G11(i, 1, 1, 1) = c%drdx(i, 1, 1, 1) * c%drdx(i, 1, 1, 1) &
911 + c%drdy(i, 1, 1, 1) * c%drdy(i, 1, 1, 1)
913 c%G22(i, 1, 1, 1) = c%dsdx(i, 1, 1, 1) * c%dsdx(i, 1, 1, 1) &
914 + c%dsdy(i, 1, 1, 1) * c%dsdy(i, 1, 1, 1)
916 c%G12(i, 1, 1, 1) = c%drdx(i, 1, 1, 1) * c%dsdx(i, 1, 1, 1) &
917 + c%drdy(i, 1, 1, 1) * c%dsdy(i, 1, 1, 1)
921 c%G11(i, 1, 1, 1) = c%G11(i, 1, 1, 1) * c%jacinv(i, 1, 1, 1)
922 c%G22(i, 1, 1, 1) = c%G22(i, 1, 1, 1) * c%jacinv(i, 1, 1, 1)
923 c%G12(i, 1, 1, 1) = c%G12(i, 1, 1, 1) * c%jacinv(i, 1, 1, 1)
924 c%G33(i, 1, 1, 1) = 0.0_rp
925 c%G13(i, 1, 1, 1) = 0.0_rp
926 c%G23(i, 1, 1, 1) = 0.0_rp
929 do concurrent(e = 1:c%msh%nelv)
930 do concurrent(i = 1:lxyz)
931 c%G11(i,1,1,e) = c%G11(i,1,1,e) * c%Xh%w3(i,1,1)
932 c%G22(i,1,1,e) = c%G22(i,1,1,e) * c%Xh%w3(i,1,1)
933 c%G12(i,1,1,e) = c%G12(i,1,1,e) * c%Xh%w3(i,1,1)
940 c%G11(i, 1, 1, 1) = c%drdx(i, 1, 1, 1) * c%drdx(i, 1, 1, 1) &
941 + c%drdy(i, 1, 1, 1) * c%drdy(i, 1, 1, 1) &
942 + c%drdz(i, 1, 1, 1) * c%drdz(i, 1, 1, 1)
944 c%G22(i, 1, 1, 1) = c%dsdx(i, 1, 1, 1) * c%dsdx(i, 1, 1, 1) &
945 + c%dsdy(i, 1, 1, 1) * c%dsdy(i, 1, 1, 1) &
946 + c%dsdz(i, 1, 1, 1) * c%dsdz(i, 1, 1, 1)
948 c%G33(i, 1, 1, 1) = c%dtdx(i, 1, 1, 1) * c%dtdx(i, 1, 1, 1) &
949 + c%dtdy(i, 1, 1, 1) * c%dtdy(i, 1, 1, 1) &
950 + c%dtdz(i, 1, 1, 1) * c%dtdz(i, 1, 1, 1)
954 c%G11(i, 1, 1, 1) = c%G11(i, 1, 1, 1) * c%jacinv(i, 1, 1, 1)
955 c%G22(i, 1, 1, 1) = c%G22(i, 1, 1, 1) * c%jacinv(i, 1, 1, 1)
956 c%G33(i, 1, 1, 1) = c%G33(i, 1, 1, 1) * c%jacinv(i, 1, 1, 1)
960 c%G12(i, 1, 1, 1) = c%drdx(i, 1, 1, 1) * c%dsdx(i, 1, 1, 1) &
961 + c%drdy(i, 1, 1, 1) * c%dsdy(i, 1, 1, 1) &
962 + c%drdz(i, 1, 1, 1) * c%dsdz(i, 1, 1, 1)
964 c%G13(i, 1, 1, 1) = c%drdx(i, 1, 1, 1) * c%dtdx(i, 1, 1, 1) &
965 + c%drdy(i, 1, 1, 1) * c%dtdy(i, 1, 1, 1) &
966 + c%drdz(i, 1, 1, 1) * c%dtdz(i, 1, 1, 1)
968 c%G23(i, 1, 1, 1) = c%dsdx(i, 1, 1, 1) * c%dtdx(i, 1, 1, 1) &
969 + c%dsdy(i, 1, 1, 1) * c%dtdy(i, 1, 1, 1) &
970 + c%dsdz(i, 1, 1, 1) * c%dtdz(i, 1, 1, 1)
974 c%G12(i, 1, 1, 1) = c%G12(i, 1, 1, 1) * c%jacinv(i, 1, 1, 1)
975 c%G13(i, 1, 1, 1) = c%G13(i, 1, 1, 1) * c%jacinv(i, 1, 1, 1)
976 c%G23(i, 1, 1, 1) = c%G23(i, 1, 1, 1) * c%jacinv(i, 1, 1, 1)
979 do concurrent(e = 1:c%msh%nelv)
980 do concurrent(i = 1:lxyz)
981 c%G11(i,1,1,e) = c%G11(i,1,1,e) * c%Xh%w3(i,1,1)
982 c%G22(i,1,1,e) = c%G22(i,1,1,e) * c%Xh%w3(i,1,1)
983 c%G12(i,1,1,e) = c%G12(i,1,1,e) * c%Xh%w3(i,1,1)
985 c%G33(i,1,1,e) = c%G33(i,1,1,e) * c%Xh%w3(i,1,1)
986 c%G13(i,1,1,e) = c%G13(i,1,1,e) * c%Xh%w3(i,1,1)
987 c%G23(i,1,1,e) = c%G23(i,1,1,e) * c%Xh%w3(i,1,1)
1076 type(
coef_t),
intent(inout) :: coef
1077 real(kind=rp),
allocatable :: a(:,:,:,:)
1078 real(kind=rp),
allocatable :: b(:,:,:,:)
1079 real(kind=rp),
allocatable :: c(:,:,:,:)
1080 real(kind=rp),
allocatable :: dot(:,:,:,:)
1081 integer :: n, e, i, j, k, lx
1082 real(kind=rp) :: weight, len
1086 allocate(a(coef%Xh%lx, coef%Xh%lx, coef%Xh%lx, coef%msh%nelv))
1087 allocate(b(coef%Xh%lx, coef%Xh%lx, coef%Xh%lx, coef%msh%nelv))
1088 allocate(c(coef%Xh%lx, coef%Xh%lx, coef%Xh%lx, coef%msh%nelv))
1089 allocate(dot(coef%Xh%lx, coef%Xh%lx, coef%Xh%lx, coef%msh%nelv))
1093 a(i, 1, 1, 1) = coef%dyds(i, 1, 1, 1) * coef%dzdt(i, 1, 1, 1) &
1094 - coef%dzds(i, 1, 1, 1) * coef%dydt(i, 1, 1, 1)
1096 b(i, 1, 1, 1) = coef%dzds(i, 1, 1, 1) * coef%dxdt(i, 1, 1, 1) &
1097 - coef%dxds(i, 1, 1, 1) * coef%dzdt(i, 1, 1, 1)
1099 c(i, 1, 1, 1) = coef%dxds(i, 1, 1, 1) * coef%dydt(i, 1, 1, 1) &
1100 - coef%dyds(i, 1, 1, 1) * coef%dxdt(i, 1, 1, 1)
1104 dot(i, 1, 1, 1) = a(i, 1, 1, 1) * a(i, 1, 1, 1) &
1105 + b(i, 1, 1, 1) * b(i, 1, 1, 1) &
1106 + c(i, 1, 1, 1) * c(i, 1, 1, 1)
1109 do concurrent(e = 1:coef%msh%nelv)
1110 do concurrent(k = 1:coef%Xh%lx)
1111 do concurrent(j = 1:coef%Xh%lx)
1112 weight = coef%Xh%wy(j) * coef%Xh%wz(k)
1113 coef%area(j, k, 2, e) = sqrt(dot(lx, j, k, e)) * weight
1114 coef%area(j, k, 1, e) = sqrt(dot(1, j, k, e)) * weight
1115 coef%nx(j,k, 1, e) = -a(1, j, k, e)
1116 coef%nx(j,k, 2, e) = a(lx, j, k, e)
1117 coef%ny(j,k, 1, e) = -b(1, j, k, e)
1118 coef%ny(j,k, 2, e) = b(lx, j, k, e)
1119 coef%nz(j,k, 1, e) = -c(1, j, k, e)
1120 coef%nz(j,k, 2, e) = c(lx, j, k, e)
1127 a(i, 1, 1, 1) = coef%dydr(i, 1, 1, 1) * coef%dzdt(i, 1, 1, 1) &
1128 - coef%dzdr(i, 1, 1, 1) * coef%dydt(i, 1, 1, 1)
1130 b(i, 1, 1, 1) = coef%dzdr(i, 1, 1, 1) * coef%dxdt(i, 1, 1, 1) &
1131 - coef%dxdr(i, 1, 1, 1) * coef%dzdt(i, 1, 1, 1)
1133 c(i, 1, 1, 1) = coef%dxdr(i, 1, 1, 1) * coef%dydt(i, 1, 1, 1) &
1134 - coef%dydr(i, 1, 1, 1) * coef%dxdt(i, 1, 1, 1)
1138 dot(i, 1, 1, 1) = a(i, 1, 1, 1) * a(i, 1, 1, 1) &
1139 + b(i, 1, 1, 1) * b(i, 1, 1, 1) &
1140 + c(i, 1, 1, 1) * c(i, 1, 1, 1)
1143 do concurrent(e = 1:coef%msh%nelv)
1144 do concurrent(k = 1:coef%Xh%lx)
1145 do concurrent(j = 1:coef%Xh%lx)
1146 weight = coef%Xh%wx(j) * coef%Xh%wz(k)
1147 coef%area(j, k, 3, e) = sqrt(dot(j, 1, k, e)) * weight
1148 coef%area(j, k, 4, e) = sqrt(dot(j, lx, k, e)) * weight
1149 coef%nx(j,k, 3, e) = a(j, 1, k, e)
1150 coef%nx(j,k, 4, e) = -a(j, lx, k, e)
1151 coef%ny(j,k, 3, e) = b(j, 1, k, e)
1152 coef%ny(j,k, 4, e) = -b(j, lx, k, e)
1153 coef%nz(j,k, 3, e) = c(j, 1, k, e)
1154 coef%nz(j,k, 4, e) = -c(j, lx, k, e)
1161 a(i, 1, 1, 1) = coef%dydr(i, 1, 1, 1) * coef%dzds(i, 1, 1, 1) &
1162 - coef%dzdr(i, 1, 1, 1) * coef%dyds(i, 1, 1, 1)
1164 b(i, 1, 1, 1) = coef%dzdr(i, 1, 1, 1) * coef%dxds(i, 1, 1, 1) &
1165 - coef%dxdr(i, 1, 1, 1) * coef%dzds(i, 1, 1, 1)
1167 c(i, 1, 1, 1) = coef%dxdr(i, 1, 1, 1) * coef%dyds(i, 1, 1, 1) &
1168 - coef%dydr(i, 1, 1, 1) * coef%dxds(i, 1, 1, 1)
1172 dot(i, 1, 1, 1) = a(i, 1, 1, 1) * a(i, 1, 1, 1) &
1173 + b(i, 1, 1, 1) * b(i, 1, 1, 1) &
1174 + c(i, 1, 1, 1) * c(i, 1, 1, 1)
1177 do concurrent(e = 1:coef%msh%nelv)
1178 do concurrent(k = 1:coef%Xh%lx)
1179 do concurrent(j = 1:coef%Xh%lx)
1180 weight = coef%Xh%wx(j) * coef%Xh%wy(k)
1181 coef%area(j, k, 5, e) = sqrt(dot(j, k, 1, e)) * weight
1182 coef%area(j, k, 6, e) = sqrt(dot(j, k, lx, e)) * weight
1183 coef%nx(j,k, 5, e) = -a(j, k, 1, e)
1184 coef%nx(j,k, 6, e) = a(j, k, lx, e)
1185 coef%ny(j,k, 5, e) = -b(j, k, 1, e)
1186 coef%ny(j,k, 6, e) = b(j, k, lx, e)
1187 coef%nz(j,k, 5, e) = -c(j, k, 1, e)
1188 coef%nz(j,k, 6, e) = c(j, k, lx, e)
1194 do j = 1,
size(coef%nz)
1195 len = sqrt(coef%nx(j,1,1,1)**2 + &
1196 coef%ny(j,1,1,1)**2 + coef%nz(j,1,1,1)**2)
1197 if (len .gt. neko_eps)
then
1198 coef%nx(j,1,1,1) = coef%nx(j,1,1,1) / len
1199 coef%ny(j,1,1,1) = coef%ny(j,1,1,1) / len
1200 coef%nz(j,1,1,1) = coef%nz(j,1,1,1) / len
1209 if (neko_bcknd_device .eq. 1)
then
1211 call device_memcpy(coef%area, coef%area_d, n, &
1212 host_to_device, sync=.false.)
1213 call device_memcpy(coef%nx, coef%nx_d, n, &
1214 host_to_device, sync=.false.)
1215 call device_memcpy(coef%ny, coef%ny_d, n, &
1216 host_to_device, sync=.false.)
1217 call device_memcpy(coef%nz, coef%nz_d, n, &
1218 host_to_device, sync=.false.)
1278 class(
coef_t),
intent(inout) :: this
1290 integer :: np, n, lx, pf, pe, i, j, k, nc, ipass, ntot, ncyc
1291 real(kind=rp) :: un(3)
1292 real(kind=rp),
allocatable :: normx(:,:,:,:)
1293 real(kind=rp),
allocatable :: normy(:,:,:,:)
1294 real(kind=rp),
allocatable :: normz(:,:,:,:)
1295 type(c_ptr) :: normx_d = c_null_ptr
1296 type(c_ptr) :: normy_d = c_null_ptr
1297 type(c_ptr) :: normz_d = c_null_ptr
1299 logical :: norm_dss = .false.
1301 np = this%msh%periodic%size
1303 ntot = this%dof%size()
1306 if (.not. this%cyclic)
return
1309 call neko_error(
"There are no periodic boundaries. " // &
1310 "Switch cyclic off in the case file.")
1313 allocate(normx(lx, lx, lx, this%msh%nelv))
1314 allocate(normy(lx, lx, lx, this%msh%nelv))
1315 allocate(normz(lx, lx, lx, this%msh%nelv))
1317 if (neko_bcknd_device .eq. 1)
then
1318 call device_map(normx, normx_d, ntot)
1319 call device_map(normy, normy_d, ntot)
1320 call device_map(normz, normz_d, ntot)
1325 call rzero(normx, ntot)
1326 call rzero(normy, ntot)
1327 call rzero(normz, ntot)
1329 if (ipass .eq. 2)
then
1335 pf = this%msh%periodic%facet_el(n)%x(1)
1336 pe = this%msh%periodic%facet_el(n)%x(2)
1340 if (index_is_on_facet(i, j, k, lx, lx, lx, pf))
then
1341 un = this%get_normal(i, j, k, pe, pf)
1342 normx(i,j,k,pe) = un(1) * this%R11(nc) &
1343 + un(2) * this%R12(nc)
1345 normy(i,j,k,pe) =-un(1) * this%R12(nc) &
1346 + un(2) * this%R11(nc)
1348 normz(i,j,k,pe) = un(3)
1357 if (neko_bcknd_device .eq. 1)
then
1358 call device_memcpy(normx, normx_d, ntot, host_to_device, sync=.false.)
1359 call device_memcpy(normy, normy_d, ntot, host_to_device, sync=.false.)
1360 call device_memcpy(normz, normz_d, ntot, host_to_device, sync=.false.)
1363 call this%gs_h%op(normx, ntot, gs_op_add)
1364 call this%gs_h%op(normy, ntot, gs_op_add)
1365 call this%gs_h%op(normz, ntot, gs_op_add)
1367 if (neko_bcknd_device .eq. 1)
then
1368 call device_absval(normx_d, ntot)
1369 call device_absval(normy_d, ntot)
1370 call device_absval(normz_d, ntot)
1371 norm_dss = device_glsum(normx_d, ntot)/ntot .lt. 100.0*neko_eps .and. &
1372 device_glsum(normy_d, ntot)/ntot .lt. 100.0*neko_eps .and. &
1373 device_glsum(normz_d, ntot)/ntot .lt. 100.0*neko_eps
1375 call absval(normx, ntot)
1376 call absval(normy, ntot)
1377 call absval(normz, ntot)
1378 norm_dss = glsum(normx, ntot)/ntot .lt. 100*neko_eps .and. &
1379 glsum(normy, ntot)/ntot .lt. 100*neko_eps .and. &
1380 glsum(normz, ntot)/ntot .lt. 100*neko_eps
1383 if (ipass .eq. 1 .and. norm_dss)
then
1384 call neko_error(
"Cyclic rotation is not required. " // &
1385 "Switch it off in case file.")
1388 else if (ipass .eq. 2 .and. .not. norm_dss)
then
1389 call neko_error(
"Cylic rotation is required, but " // &
1390 "rotation logic must be modified.")
1399 if (neko_bcknd_device .eq. 1)
then
1400 call device_free(normx_d)
1401 call device_free(normy_d)
1402 call device_free(normz_d)