65 real(kind=
rp),
allocatable :: g11(:,:,:,:)
67 real(kind=
rp),
allocatable :: g22(:,:,:,:)
69 real(kind=
rp),
allocatable :: g33(:,:,:,:)
71 real(kind=
rp),
allocatable :: g12(:,:,:,:)
73 real(kind=
rp),
allocatable :: g13(:,:,:,:)
75 real(kind=
rp),
allocatable :: g23(:,:,:,:)
77 real(kind=
rp),
allocatable :: mult(:,:,:,:)
82 real(kind=
rp),
allocatable :: dxdr(:,:,:,:), dydr(:,:,:,:), dzdr(:,:,:,:)
83 real(kind=
rp),
allocatable :: dxds(:,:,:,:), dyds(:,:,:,:), dzds(:,:,:,:)
84 real(kind=
rp),
allocatable :: dxdt(:,:,:,:), dydt(:,:,:,:), dzdt(:,:,:,:)
88 real(kind=
rp),
allocatable :: drdx(:,:,:,:), drdy(:,:,:,:), drdz(:,:,:,:)
89 real(kind=
rp),
allocatable :: dsdx(:,:,:,:), dsdy(:,:,:,:), dsdz(:,:,:,:)
90 real(kind=
rp),
allocatable :: dtdx(:,:,:,:), dtdy(:,:,:,:), dtdz(:,:,:,:)
92 real(kind=
rp),
allocatable :: h1(:,:,:,:)
93 real(kind=
rp),
allocatable :: h2(:,:,:,:)
96 real(kind=
rp),
allocatable :: jac(:,:,:,:)
97 real(kind=
rp),
allocatable :: jacinv(:,:,:,:)
98 real(kind=
rp),
allocatable :: b(:,:,:,:)
99 real(kind=
rp),
allocatable :: binv(:,:,:,:)
100 real(kind=
rp),
pointer :: blag(:,:,:,:) => null()
101 real(kind=
rp),
pointer :: blaglag(:,:,:,:) => null()
102 real(kind=
rp),
allocatable :: area(:,:,:,:)
103 real(kind=
rp),
allocatable :: nx(:,:,:,:)
104 real(kind=
rp),
allocatable :: ny(:,:,:,:)
105 real(kind=
rp),
allocatable :: nz(:,:,:,:)
106 logical :: cyclic = .false.
107 integer,
allocatable :: cyc_msk(:)
108 real(kind=
rp),
allocatable :: r11(:)
109 real(kind=
rp),
allocatable :: r12(:)
112 logical,
private :: coef_metrics_initialized = .false.
116 real(kind=
rp) :: volume
121 type(
gs_t),
pointer :: gs_h=> null()
127 type(c_ptr) :: g11_d = c_null_ptr
128 type(c_ptr) :: g22_d = c_null_ptr
129 type(c_ptr) :: g33_d = c_null_ptr
130 type(c_ptr) :: g12_d = c_null_ptr
131 type(c_ptr) :: g13_d = c_null_ptr
132 type(c_ptr) :: g23_d = c_null_ptr
133 type(c_ptr) :: dxdr_d = c_null_ptr
134 type(c_ptr) :: dydr_d = c_null_ptr
135 type(c_ptr) :: dzdr_d = c_null_ptr
136 type(c_ptr) :: dxds_d = c_null_ptr
137 type(c_ptr) :: dyds_d = c_null_ptr
138 type(c_ptr) :: dzds_d = c_null_ptr
139 type(c_ptr) :: dxdt_d = c_null_ptr
140 type(c_ptr) :: dydt_d = c_null_ptr
141 type(c_ptr) :: dzdt_d = c_null_ptr
142 type(c_ptr) :: drdx_d = c_null_ptr
143 type(c_ptr) :: drdy_d = c_null_ptr
144 type(c_ptr) :: drdz_d = c_null_ptr
145 type(c_ptr) :: dsdx_d = c_null_ptr
146 type(c_ptr) :: dsdy_d = c_null_ptr
147 type(c_ptr) :: dsdz_d = c_null_ptr
148 type(c_ptr) :: dtdx_d = c_null_ptr
149 type(c_ptr) :: dtdy_d = c_null_ptr
150 type(c_ptr) :: dtdz_d = c_null_ptr
151 type(c_ptr) :: mult_d = c_null_ptr
152 type(c_ptr) :: h1_d = c_null_ptr
153 type(c_ptr) :: h2_d = c_null_ptr
154 type(c_ptr) :: jac_d = c_null_ptr
155 type(c_ptr) :: jacinv_d = c_null_ptr
156 type(c_ptr) :: b_d = c_null_ptr
157 type(c_ptr) :: blag_d = c_null_ptr
158 type(c_ptr) :: blaglag_d = c_null_ptr
159 type(c_ptr) :: binv_d = c_null_ptr
160 type(c_ptr) :: area_d = c_null_ptr
161 type(c_ptr) :: nx_d = c_null_ptr
162 type(c_ptr) :: ny_d = c_null_ptr
163 type(c_ptr) :: nz_d = c_null_ptr
164 type(c_ptr) :: cyc_msk_d = c_null_ptr
165 type(c_ptr) :: r11_d = c_null_ptr
166 type(c_ptr) :: r12_d = c_null_ptr
180 generic :: init => init_empty, init_all
233 class(
coef_t),
intent(inout),
target :: this
234 type(
gs_t),
intent(inout),
target :: gs_h
235 integer :: n, m, ncyc
238 this%msh => gs_h%dofmap%msh
239 this%Xh => gs_h%dofmap%Xh
240 this%dof => gs_h%dofmap
247 allocate(this%G11(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
248 allocate(this%G22(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
249 allocate(this%G33(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
250 allocate(this%G12(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
251 allocate(this%G13(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
252 allocate(this%G23(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
254 allocate(this%dxdr(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
255 allocate(this%dxds(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
256 allocate(this%dxdt(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
258 allocate(this%dydr(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
259 allocate(this%dyds(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
260 allocate(this%dydt(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
262 allocate(this%dzdr(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
263 allocate(this%dzds(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
264 allocate(this%dzdt(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
266 allocate(this%drdx(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
267 allocate(this%dsdx(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
268 allocate(this%dtdx(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
270 allocate(this%drdy(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
271 allocate(this%dsdy(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
272 allocate(this%dtdy(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
274 allocate(this%drdz(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
275 allocate(this%dsdz(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
276 allocate(this%dtdz(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
278 allocate(this%jac(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
279 allocate(this%jacinv(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
281 allocate(this%area(this%Xh%lx, this%Xh%ly, 6, this%msh%nelv))
282 allocate(this%nx(this%Xh%lx, this%Xh%ly, 6, this%msh%nelv))
283 allocate(this%ny(this%Xh%lx, this%Xh%ly, 6, this%msh%nelv))
284 allocate(this%nz(this%Xh%lx, this%Xh%ly, 6, this%msh%nelv))
286 allocate(this%B(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
287 allocate(this%Binv(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
291 this%Blaglag => this%B
293 allocate(this%h1(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
294 allocate(this%h2(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
296 allocate(this%mult(this%Xh%lx, this%Xh%ly, this%Xh%lz, this%msh%nelv))
303 n = this%Xh%lx * this%Xh%ly * this%Xh%lz * this%msh%nelv
341 call device_map(this%jacinv, this%jacinv_d, n)
345 this%Blag_d = this%B_d
346 this%Blaglag_d = this%B_d
348 m = this%Xh%lx * this%Xh%ly * 6 * this%msh%nelv
365 this%coef_metrics_initialized = .true.
390 call rone(this%mult, n)
403 ncyc = this%msh%periodic%size * this%Xh%lx * this%Xh%lx
404 allocate(this%cyc_msk(0:ncyc))
405 this%cyc_msk(0) = ncyc + 1
406 if (ncyc .gt. 0)
then
407 allocate(this%R11(ncyc))
408 allocate(this%R12(ncyc))
411 call rone(this%R11, ncyc)
412 call rzero(this%R12, ncyc)
415 call device_map(this%cyc_msk, this%cyc_msk_d, ncyc+1)
669 type(
coef_t),
intent(inout) :: c
670 integer :: e, i, lxy, lyz, ntot
672 lxy = c%Xh%lx*c%Xh%ly
673 lyz = c%Xh%ly*c%Xh%lz
676 associate(drdx => c%drdx, drdy => c%drdy, drdz => c%drdz, &
677 dsdx => c%dsdx, dsdy => c%dsdy, dsdz => c%dsdz, &
678 dtdx => c%dtdx, dtdy => c%dtdy, dtdz => c%dtdz, &
679 dxdr => c%dxdr, dydr => c%dydr, dzdr => c%dzdr, &
680 dxds => c%dxds, dyds => c%dyds, dzds => c%dzds, &
681 dxdt => c%dxdt, dydt => c%dydt, dzdt => c%dzdt, &
682 dx => c%Xh%dx, dy => c%Xh%dy, dz => c%Xh%dz, &
683 x => c%dof%x, y => c%dof%y, z => c%dof%z, &
684 lx => c%Xh%lx, ly => c%Xh%ly, lz => c%Xh%lz, &
685 dyt => c%Xh%dyt, dzt => c%Xh%dzt, &
686 jacinv => c%jacinv, jac => c%jac)
691 c%dsdx_d, c%dsdy_d, c%dsdz_d, c%dtdx_d, c%dtdy_d, c%dtdz_d, &
692 c%dxdr_d, c%dydr_d, c%dzdr_d, c%dxds_d, c%dyds_d, c%dzds_d, &
693 c%dxdt_d, c%dydt_d, c%dzdt_d, c%Xh%dx_d, c%Xh%dy_d, c%Xh%dz_d, &
694 c%dof%x_d, c%dof%y_d, c%dof%z_d, c%jacinv_d, c%jac_d, &
698 if (.not. c%coef_metrics_initialized)
then
744 call mxm(dx, lx, x(1,1,1,e), lx, dxdr(1,1,1,e), lyz)
745 call mxm(dx, lx, y(1,1,1,e), lx, dydr(1,1,1,e), lyz)
746 call mxm(dx, lx, z(1,1,1,e), lx, dzdr(1,1,1,e), lyz)
749 call mxm(x(1,1,i,e), lx, dyt, ly, dxds(1,1,i,e), ly)
750 call mxm(y(1,1,i,e), lx, dyt, ly, dyds(1,1,i,e), ly)
751 call mxm(z(1,1,i,e), lx, dyt, ly, dzds(1,1,i,e), ly)
755 if (c%msh%gdim .eq. 3)
then
756 call mxm(x(1,1,1,e), lxy, dzt, lz, dxdt(1,1,1,e), lz)
757 call mxm(y(1,1,1,e), lxy, dzt, lz, dydt(1,1,1,e), lz)
758 call mxm(z(1,1,1,e), lxy, dzt, lz, dzdt(1,1,1,e), lz)
760 call rzero(dxdt(1,1,1,e), lxy)
761 call rzero(dydt(1,1,1,e), lxy)
762 call rone(dzdt(1,1,1,e), lxy)
767 if (c%msh%gdim .eq. 2)
then
768 call rzero (jac, ntot)
769 call addcol3 (jac, dxdr, dyds, ntot)
770 call subcol3 (jac, dxds, dydr, ntot)
771 call copy (drdx, dyds, ntot)
772 call copy (drdy, dxds, ntot)
774 call copy (dsdx, dydr, ntot)
776 call copy (dsdy, dxdr, ntot)
777 call rzero (drdz, ntot)
778 call rzero (dsdz, ntot)
779 call rone (dtdz, ntot)
784 c%jac(i, 1, 1, 1) = 0.0_rp
789 c%jac(i, 1, 1, 1) = c%jac(i, 1, 1, 1) + ( c%dxdr(i, 1, 1, 1) &
790 * c%dyds(i, 1, 1, 1) * c%dzdt(i, 1, 1, 1) )
792 c%jac(i, 1, 1, 1) = c%jac(i, 1, 1, 1) + ( c%dxdt(i, 1, 1, 1) &
793 * c%dydr(i, 1, 1, 1) * c%dzds(i, 1, 1, 1) )
795 c%jac(i, 1, 1, 1) = c%jac(i, 1, 1, 1) + ( c%dxds(i, 1, 1, 1) &
796 * c%dydt(i, 1, 1, 1) * c%dzdr(i, 1, 1, 1) )
801 c%jac(i, 1, 1, 1) = c%jac(i, 1, 1, 1) - ( c%dxdr(i, 1, 1, 1) &
802 * c%dydt(i, 1, 1, 1) * c%dzds(i, 1, 1, 1) )
804 c%jac(i, 1, 1, 1) = c%jac(i, 1, 1, 1) - ( c%dxds(i, 1, 1, 1) &
805 * c%dydr(i, 1, 1, 1) * c%dzdt(i, 1, 1, 1) )
807 c%jac(i, 1, 1, 1) = c%jac(i, 1, 1, 1) - ( c%dxdt(i, 1, 1, 1) &
808 * c%dyds(i, 1, 1, 1) * c%dzdr(i, 1, 1, 1) )
813 c%drdx(i, 1, 1, 1) = c%dyds(i, 1, 1, 1) * c%dzdt(i, 1, 1, 1) &
814 - c%dydt(i, 1, 1, 1) * c%dzds(i, 1, 1, 1)
816 c%drdy(i, 1, 1, 1) = c%dxdt(i, 1, 1, 1) * c%dzds(i, 1, 1, 1) &
817 - c%dxds(i, 1, 1, 1) * c%dzdt(i, 1, 1, 1)
819 c%drdz(i, 1, 1, 1) = c%dxds(i, 1, 1, 1) * c%dydt(i, 1, 1, 1) &
820 - c%dxdt(i, 1, 1, 1) * c%dyds(i, 1, 1, 1)
825 c%dsdx(i, 1, 1, 1) = c%dydt(i, 1, 1, 1) * c%dzdr(i, 1, 1, 1) &
826 - c%dydr(i, 1, 1, 1) * c%dzdt(i, 1, 1, 1)
828 c%dsdy(i, 1, 1, 1) = c%dxdr(i, 1, 1, 1) * c%dzdt(i, 1, 1, 1) &
829 - c%dxdt(i, 1, 1, 1) * c%dzdr(i, 1, 1, 1)
831 c%dsdz(i, 1, 1, 1) = c%dxdt(i, 1, 1, 1) * c%dydr(i, 1, 1, 1) &
832 - c%dxdr(i, 1, 1, 1) * c%dydt(i, 1, 1, 1)
837 c%dtdx(i, 1, 1, 1) = c%dydr(i, 1, 1, 1) * c%dzds(i, 1, 1, 1) &
838 - c%dyds(i, 1, 1, 1) * c%dzdr(i, 1, 1, 1)
840 c%dtdy(i, 1, 1, 1) = c%dxds(i, 1, 1, 1) * c%dzdr(i, 1, 1, 1) &
841 - c%dxdr(i, 1, 1, 1) * c%dzds(i, 1, 1, 1)
843 c%dtdz(i, 1, 1, 1) = c%dxdr(i, 1, 1, 1) * c%dyds(i, 1, 1, 1) &
844 - c%dxds(i, 1, 1, 1) * c%dydr(i, 1, 1, 1)
849 call invers2(jacinv, jac, ntot)
858 type(
coef_t),
intent(inout) :: c
859 integer :: e, i, lxyz, ntot
861 lxyz = c%Xh%lx * c%Xh%ly * c%Xh%lz
864 if (neko_bcknd_device .eq. 1)
then
866 call device_coef_generate_geo(c%G11_d, c%G12_d, c%G13_d, &
867 c%G22_d, c%G23_d, c%G33_d, &
868 c%drdx_d, c%drdy_d, c%drdz_d, &
869 c%dsdx_d, c%dsdy_d, c%dsdz_d, &
870 c%dtdx_d, c%dtdy_d, c%dtdz_d, &
871 c%jacinv_d, c%Xh%w3_d, c%msh%nelv, &
875 if (.not. c%coef_metrics_initialized)
then
876 call device_memcpy(c%G11, c%G11_d, ntot, device_to_host, &
878 call device_memcpy(c%G22, c%G22_d, ntot, device_to_host, &
880 call device_memcpy(c%G33, c%G33_d, ntot, device_to_host, &
882 call device_memcpy(c%G12, c%G12_d, ntot, device_to_host, &
884 call device_memcpy(c%G13, c%G13_d, ntot, device_to_host, &
886 call device_memcpy(c%G23, c%G23_d, ntot, device_to_host, &
891 if (c%msh%gdim .eq. 2)
then
894 c%G11(i, 1, 1, 1) = c%drdx(i, 1, 1, 1) * c%drdx(i, 1, 1, 1) &
895 + c%drdy(i, 1, 1, 1) * c%drdy(i, 1, 1, 1)
897 c%G22(i, 1, 1, 1) = c%dsdx(i, 1, 1, 1) * c%dsdx(i, 1, 1, 1) &
898 + c%dsdy(i, 1, 1, 1) * c%dsdy(i, 1, 1, 1)
900 c%G12(i, 1, 1, 1) = c%drdx(i, 1, 1, 1) * c%dsdx(i, 1, 1, 1) &
901 + c%drdy(i, 1, 1, 1) * c%dsdy(i, 1, 1, 1)
905 c%G11(i, 1, 1, 1) = c%G11(i, 1, 1, 1) * c%jacinv(i, 1, 1, 1)
906 c%G22(i, 1, 1, 1) = c%G22(i, 1, 1, 1) * c%jacinv(i, 1, 1, 1)
907 c%G12(i, 1, 1, 1) = c%G12(i, 1, 1, 1) * c%jacinv(i, 1, 1, 1)
908 c%G33(i, 1, 1, 1) = 0.0_rp
909 c%G13(i, 1, 1, 1) = 0.0_rp
910 c%G23(i, 1, 1, 1) = 0.0_rp
913 do concurrent(e = 1:c%msh%nelv)
914 do concurrent(i = 1:lxyz)
915 c%G11(i,1,1,e) = c%G11(i,1,1,e) * c%Xh%w3(i,1,1)
916 c%G22(i,1,1,e) = c%G22(i,1,1,e) * c%Xh%w3(i,1,1)
917 c%G12(i,1,1,e) = c%G12(i,1,1,e) * c%Xh%w3(i,1,1)
925 c%G11(i, 1, 1, 1) = c%drdx(i, 1, 1, 1) * c%drdx(i, 1, 1, 1) &
926 + c%drdy(i, 1, 1, 1) * c%drdy(i, 1, 1, 1) &
927 + c%drdz(i, 1, 1, 1) * c%drdz(i, 1, 1, 1)
929 c%G22(i, 1, 1, 1) = c%dsdx(i, 1, 1, 1) * c%dsdx(i, 1, 1, 1) &
930 + c%dsdy(i, 1, 1, 1) * c%dsdy(i, 1, 1, 1) &
931 + c%dsdz(i, 1, 1, 1) * c%dsdz(i, 1, 1, 1)
933 c%G33(i, 1, 1, 1) = c%dtdx(i, 1, 1, 1) * c%dtdx(i, 1, 1, 1) &
934 + c%dtdy(i, 1, 1, 1) * c%dtdy(i, 1, 1, 1) &
935 + c%dtdz(i, 1, 1, 1) * c%dtdz(i, 1, 1, 1)
940 c%G11(i, 1, 1, 1) = c%G11(i, 1, 1, 1) * c%jacinv(i, 1, 1, 1)
941 c%G22(i, 1, 1, 1) = c%G22(i, 1, 1, 1) * c%jacinv(i, 1, 1, 1)
942 c%G33(i, 1, 1, 1) = c%G33(i, 1, 1, 1) * c%jacinv(i, 1, 1, 1)
947 c%G12(i, 1, 1, 1) = c%drdx(i, 1, 1, 1) * c%dsdx(i, 1, 1, 1) &
948 + c%drdy(i, 1, 1, 1) * c%dsdy(i, 1, 1, 1) &
949 + c%drdz(i, 1, 1, 1) * c%dsdz(i, 1, 1, 1)
951 c%G13(i, 1, 1, 1) = c%drdx(i, 1, 1, 1) * c%dtdx(i, 1, 1, 1) &
952 + c%drdy(i, 1, 1, 1) * c%dtdy(i, 1, 1, 1) &
953 + c%drdz(i, 1, 1, 1) * c%dtdz(i, 1, 1, 1)
955 c%G23(i, 1, 1, 1) = c%dsdx(i, 1, 1, 1) * c%dtdx(i, 1, 1, 1) &
956 + c%dsdy(i, 1, 1, 1) * c%dtdy(i, 1, 1, 1) &
957 + c%dsdz(i, 1, 1, 1) * c%dtdz(i, 1, 1, 1)
962 c%G12(i, 1, 1, 1) = c%G12(i, 1, 1, 1) * c%jacinv(i, 1, 1, 1)
963 c%G13(i, 1, 1, 1) = c%G13(i, 1, 1, 1) * c%jacinv(i, 1, 1, 1)
964 c%G23(i, 1, 1, 1) = c%G23(i, 1, 1, 1) * c%jacinv(i, 1, 1, 1)
969 do concurrent(i = 1:lxyz)
970 c%G11(i,1,1,e) = c%G11(i,1,1,e) * c%Xh%w3(i,1,1)
971 c%G22(i,1,1,e) = c%G22(i,1,1,e) * c%Xh%w3(i,1,1)
972 c%G12(i,1,1,e) = c%G12(i,1,1,e) * c%Xh%w3(i,1,1)
974 c%G33(i,1,1,e) = c%G33(i,1,1,e) * c%Xh%w3(i,1,1)
975 c%G13(i,1,1,e) = c%G13(i,1,1,e) * c%Xh%w3(i,1,1)
976 c%G23(i,1,1,e) = c%G23(i,1,1,e) * c%Xh%w3(i,1,1)
1073 type(
coef_t),
intent(inout) :: coef
1074 real(kind=rp),
allocatable :: a(:,:,:,:)
1075 real(kind=rp),
allocatable :: b(:,:,:,:)
1076 real(kind=rp),
allocatable :: c(:,:,:,:)
1077 real(kind=rp),
allocatable :: dot(:,:,:,:)
1078 integer :: n, m, e, i, j, k, lx
1079 real(kind=rp) :: weight, len
1083 if (neko_bcknd_device .eq. 1)
then
1085 call device_coef_generate_area_and_normal( &
1086 coef%area_d, coef%nx_d, coef%ny_d, coef%nz_d, &
1087 coef%dxdr_d, coef%dydr_d, coef%dzdr_d, &
1088 coef%dxds_d, coef%dyds_d, coef%dzds_d, &
1089 coef%dxdt_d, coef%dydt_d, coef%dzdt_d, &
1090 coef%Xh%wx_d, coef%Xh%wy_d, coef%Xh%wz_d, &
1091 lx, coef%msh%nelv, neko_eps)
1095 call device_memcpy(coef%area, coef%area_d, m, &
1096 device_to_host, sync = .false.)
1097 call device_memcpy(coef%nx, coef%nx_d, m, &
1098 device_to_host, sync = .false.)
1099 call device_memcpy(coef%ny, coef%ny_d, m, &
1100 device_to_host, sync = .false.)
1101 call device_memcpy(coef%nz, coef%nz_d, &
1102 m, device_to_host, sync = .true.)
1106 allocate(a(coef%Xh%lx, coef%Xh%lx, coef%Xh%lx, coef%msh%nelv))
1107 allocate(b(coef%Xh%lx, coef%Xh%lx, coef%Xh%lx, coef%msh%nelv))
1108 allocate(c(coef%Xh%lx, coef%Xh%lx, coef%Xh%lx, coef%msh%nelv))
1109 allocate(dot(coef%Xh%lx, coef%Xh%lx, coef%Xh%lx, coef%msh%nelv))
1116 a(i, 1, 1, 1) = coef%dyds(i, 1, 1, 1) * coef%dzdt(i, 1, 1, 1) &
1117 - coef%dzds(i, 1, 1, 1) * coef%dydt(i, 1, 1, 1)
1119 b(i, 1, 1, 1) = coef%dzds(i, 1, 1, 1) * coef%dxdt(i, 1, 1, 1) &
1120 - coef%dxds(i, 1, 1, 1) * coef%dzdt(i, 1, 1, 1)
1122 c(i, 1, 1, 1) = coef%dxds(i, 1, 1, 1) * coef%dydt(i, 1, 1, 1) &
1123 - coef%dyds(i, 1, 1, 1) * coef%dxdt(i, 1, 1, 1)
1128 dot(i, 1, 1, 1) = a(i, 1, 1, 1) * a(i, 1, 1, 1) &
1129 + b(i, 1, 1, 1) * b(i, 1, 1, 1) &
1130 + c(i, 1, 1, 1) * c(i, 1, 1, 1)
1134 do e = 1, coef%msh%nelv
1135 do concurrent(k = 1:coef%Xh%lx)
1136 do concurrent(j = 1:coef%Xh%lx)
1137 weight = coef%Xh%wy(j) * coef%Xh%wz(k)
1138 coef%area(j, k, 2, e) = sqrt(dot(lx, j, k, e)) * weight
1139 coef%area(j, k, 1, e) = sqrt(dot(1, j, k, e)) * weight
1140 coef%nx(j,k, 1, e) = -a(1, j, k, e)
1141 coef%nx(j,k, 2, e) = a(lx, j, k, e)
1142 coef%ny(j,k, 1, e) = -b(1, j, k, e)
1143 coef%ny(j,k, 2, e) = b(lx, j, k, e)
1144 coef%nz(j,k, 1, e) = -c(1, j, k, e)
1145 coef%nz(j,k, 2, e) = c(lx, j, k, e)
1154 a(i, 1, 1, 1) = coef%dydr(i, 1, 1, 1) * coef%dzdt(i, 1, 1, 1) &
1155 - coef%dzdr(i, 1, 1, 1) * coef%dydt(i, 1, 1, 1)
1157 b(i, 1, 1, 1) = coef%dzdr(i, 1, 1, 1) * coef%dxdt(i, 1, 1, 1) &
1158 - coef%dxdr(i, 1, 1, 1) * coef%dzdt(i, 1, 1, 1)
1160 c(i, 1, 1, 1) = coef%dxdr(i, 1, 1, 1) * coef%dydt(i, 1, 1, 1) &
1161 - coef%dydr(i, 1, 1, 1) * coef%dxdt(i, 1, 1, 1)
1166 dot(i, 1, 1, 1) = a(i, 1, 1, 1) * a(i, 1, 1, 1) &
1167 + b(i, 1, 1, 1) * b(i, 1, 1, 1) &
1168 + c(i, 1, 1, 1) * c(i, 1, 1, 1)
1172 do e = 1, coef%msh%nelv
1173 do concurrent(k = 1:coef%Xh%lx)
1174 do concurrent(j = 1:coef%Xh%lx)
1175 weight = coef%Xh%wx(j) * coef%Xh%wz(k)
1176 coef%area(j, k, 3, e) = sqrt(dot(j, 1, k, e)) * weight
1177 coef%area(j, k, 4, e) = sqrt(dot(j, lx, k, e)) * weight
1178 coef%nx(j,k, 3, e) = a(j, 1, k, e)
1179 coef%nx(j,k, 4, e) = -a(j, lx, k, e)
1180 coef%ny(j,k, 3, e) = b(j, 1, k, e)
1181 coef%ny(j,k, 4, e) = -b(j, lx, k, e)
1182 coef%nz(j,k, 3, e) = c(j, 1, k, e)
1183 coef%nz(j,k, 4, e) = -c(j, lx, k, e)
1191 a(i, 1, 1, 1) = coef%dydr(i, 1, 1, 1) * coef%dzds(i, 1, 1, 1) &
1192 - coef%dzdr(i, 1, 1, 1) * coef%dyds(i, 1, 1, 1)
1194 b(i, 1, 1, 1) = coef%dzdr(i, 1, 1, 1) * coef%dxds(i, 1, 1, 1) &
1195 - coef%dxdr(i, 1, 1, 1) * coef%dzds(i, 1, 1, 1)
1197 c(i, 1, 1, 1) = coef%dxdr(i, 1, 1, 1) * coef%dyds(i, 1, 1, 1) &
1198 - coef%dydr(i, 1, 1, 1) * coef%dxds(i, 1, 1, 1)
1203 dot(i, 1, 1, 1) = a(i, 1, 1, 1) * a(i, 1, 1, 1) &
1204 + b(i, 1, 1, 1) * b(i, 1, 1, 1) &
1205 + c(i, 1, 1, 1) * c(i, 1, 1, 1)
1209 do e = 1, coef%msh%nelv
1210 do concurrent(k = 1:coef%Xh%lx)
1211 do concurrent(j = 1:coef%Xh%lx)
1212 weight = coef%Xh%wx(j) * coef%Xh%wy(k)
1213 coef%area(j, k, 5, e) = sqrt(dot(j, k, 1, e)) * weight
1214 coef%area(j, k, 6, e) = sqrt(dot(j, k, lx, e)) * weight
1215 coef%nx(j,k, 5, e) = -a(j, k, 1, e)
1216 coef%nx(j,k, 6, e) = a(j, k, lx, e)
1217 coef%ny(j,k, 5, e) = -b(j, k, 1, e)
1218 coef%ny(j,k, 6, e) = b(j, k, lx, e)
1219 coef%nz(j,k, 5, e) = -c(j, k, 1, e)
1220 coef%nz(j,k, 6, e) = c(j, k, lx, e)
1227 do j = 1,
size(coef%nz)
1228 len = sqrt(coef%nx(j,1,1,1)**2 + &
1229 coef%ny(j,1,1,1)**2 + coef%nz(j,1,1,1)**2)
1230 if (len .gt. neko_eps)
then
1231 coef%nx(j,1,1,1) = coef%nx(j,1,1,1) / len
1232 coef%ny(j,1,1,1) = coef%ny(j,1,1,1) / len
1233 coef%nz(j,1,1,1) = coef%nz(j,1,1,1) / len