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)
776 type(
coef_t),
intent(inout) :: c
777 integer :: e, i, lxy, lyz, ntot
779 lxy = c%Xh%lx*c%Xh%ly
780 lyz = c%Xh%ly*c%Xh%lz
783 associate(drdx => c%drdx, drdy => c%drdy, drdz => c%drdz, &
784 dsdx => c%dsdx, dsdy => c%dsdy, dsdz => c%dsdz, &
785 dtdx => c%dtdx, dtdy => c%dtdy, dtdz => c%dtdz, &
786 dxdr => c%dxdr, dydr => c%dydr, dzdr => c%dzdr, &
787 dxds => c%dxds, dyds => c%dyds, dzds => c%dzds, &
788 dxdt => c%dxdt, dydt => c%dydt, dzdt => c%dzdt, &
789 dx => c%Xh%dx, dy => c%Xh%dy, dz => c%Xh%dz, &
790 x => c%dof%x, y => c%dof%y, z => c%dof%z, &
791 lx => c%Xh%lx, ly => c%Xh%ly, lz => c%Xh%lz, &
792 dyt => c%Xh%dyt, dzt => c%Xh%dzt, &
793 jacinv => c%jacinv, jac => c%jac)
798 c%dsdx_d, c%dsdy_d, c%dsdz_d, c%dtdx_d, c%dtdy_d, c%dtdz_d, &
799 c%dxdr_d, c%dydr_d, c%dzdr_d, c%dxds_d, c%dyds_d, c%dzds_d, &
800 c%dxdt_d, c%dydt_d, c%dzdt_d, c%Xh%dx_d, c%Xh%dy_d, c%Xh%dz_d, &
801 c%dof%x_d, c%dof%y_d, c%dof%z_d, c%jacinv_d, c%jac_d, &
805 if (.not. c%coef_metrics_initialized)
then
851 call mxm(dx, lx, x(1,1,1,e), lx, dxdr(1,1,1,e), lyz)
852 call mxm(dx, lx, y(1,1,1,e), lx, dydr(1,1,1,e), lyz)
853 call mxm(dx, lx, z(1,1,1,e), lx, dzdr(1,1,1,e), lyz)
856 call mxm(x(1,1,i,e), lx, dyt, ly, dxds(1,1,i,e), ly)
857 call mxm(y(1,1,i,e), lx, dyt, ly, dyds(1,1,i,e), ly)
858 call mxm(z(1,1,i,e), lx, dyt, ly, dzds(1,1,i,e), ly)
862 if (c%msh%gdim .eq. 3)
then
863 call mxm(x(1,1,1,e), lxy, dzt, lz, dxdt(1,1,1,e), lz)
864 call mxm(y(1,1,1,e), lxy, dzt, lz, dydt(1,1,1,e), lz)
865 call mxm(z(1,1,1,e), lxy, dzt, lz, dzdt(1,1,1,e), lz)
867 call rzero(dxdt(1,1,1,e), lxy)
868 call rzero(dydt(1,1,1,e), lxy)
869 call rone(dzdt(1,1,1,e), lxy)
874 if (c%msh%gdim .eq. 2)
then
875 call rzero (jac, ntot)
876 call addcol3 (jac, dxdr, dyds, ntot)
877 call subcol3 (jac, dxds, dydr, ntot)
878 call copy (drdx, dyds, ntot)
879 call copy (drdy, dxds, ntot)
881 call copy (dsdx, dydr, ntot)
883 call copy (dsdy, dxdr, ntot)
884 call rzero (drdz, ntot)
885 call rzero (dsdz, ntot)
886 call rone (dtdz, ntot)
891 c%jac(i, 1, 1, 1) = 0.0_rp
896 c%jac(i, 1, 1, 1) = c%jac(i, 1, 1, 1) + ( c%dxdr(i, 1, 1, 1) &
897 * c%dyds(i, 1, 1, 1) * c%dzdt(i, 1, 1, 1) )
899 c%jac(i, 1, 1, 1) = c%jac(i, 1, 1, 1) + ( c%dxdt(i, 1, 1, 1) &
900 * c%dydr(i, 1, 1, 1) * c%dzds(i, 1, 1, 1) )
902 c%jac(i, 1, 1, 1) = c%jac(i, 1, 1, 1) + ( c%dxds(i, 1, 1, 1) &
903 * c%dydt(i, 1, 1, 1) * c%dzdr(i, 1, 1, 1) )
908 c%jac(i, 1, 1, 1) = c%jac(i, 1, 1, 1) - ( c%dxdr(i, 1, 1, 1) &
909 * c%dydt(i, 1, 1, 1) * c%dzds(i, 1, 1, 1) )
911 c%jac(i, 1, 1, 1) = c%jac(i, 1, 1, 1) - ( c%dxds(i, 1, 1, 1) &
912 * c%dydr(i, 1, 1, 1) * c%dzdt(i, 1, 1, 1) )
914 c%jac(i, 1, 1, 1) = c%jac(i, 1, 1, 1) - ( c%dxdt(i, 1, 1, 1) &
915 * c%dyds(i, 1, 1, 1) * c%dzdr(i, 1, 1, 1) )
920 c%drdx(i, 1, 1, 1) = c%dyds(i, 1, 1, 1) * c%dzdt(i, 1, 1, 1) &
921 - c%dydt(i, 1, 1, 1) * c%dzds(i, 1, 1, 1)
923 c%drdy(i, 1, 1, 1) = c%dxdt(i, 1, 1, 1) * c%dzds(i, 1, 1, 1) &
924 - c%dxds(i, 1, 1, 1) * c%dzdt(i, 1, 1, 1)
926 c%drdz(i, 1, 1, 1) = c%dxds(i, 1, 1, 1) * c%dydt(i, 1, 1, 1) &
927 - c%dxdt(i, 1, 1, 1) * c%dyds(i, 1, 1, 1)
932 c%dsdx(i, 1, 1, 1) = c%dydt(i, 1, 1, 1) * c%dzdr(i, 1, 1, 1) &
933 - c%dydr(i, 1, 1, 1) * c%dzdt(i, 1, 1, 1)
935 c%dsdy(i, 1, 1, 1) = c%dxdr(i, 1, 1, 1) * c%dzdt(i, 1, 1, 1) &
936 - c%dxdt(i, 1, 1, 1) * c%dzdr(i, 1, 1, 1)
938 c%dsdz(i, 1, 1, 1) = c%dxdt(i, 1, 1, 1) * c%dydr(i, 1, 1, 1) &
939 - c%dxdr(i, 1, 1, 1) * c%dydt(i, 1, 1, 1)
944 c%dtdx(i, 1, 1, 1) = c%dydr(i, 1, 1, 1) * c%dzds(i, 1, 1, 1) &
945 - c%dyds(i, 1, 1, 1) * c%dzdr(i, 1, 1, 1)
947 c%dtdy(i, 1, 1, 1) = c%dxds(i, 1, 1, 1) * c%dzdr(i, 1, 1, 1) &
948 - c%dxdr(i, 1, 1, 1) * c%dzds(i, 1, 1, 1)
950 c%dtdz(i, 1, 1, 1) = c%dxdr(i, 1, 1, 1) * c%dyds(i, 1, 1, 1) &
951 - c%dxds(i, 1, 1, 1) * c%dydr(i, 1, 1, 1)
956 call invers2(jacinv, jac, ntot)
965 type(
coef_t),
intent(inout) :: c
966 integer :: e, i, lxyz, ntot
968 lxyz = c%Xh%lx * c%Xh%ly * c%Xh%lz
971 if (neko_bcknd_device .eq. 1)
then
973 call device_coef_generate_geo(c%G11_d, c%G12_d, c%G13_d, &
974 c%G22_d, c%G23_d, c%G33_d, &
975 c%drdx_d, c%drdy_d, c%drdz_d, &
976 c%dsdx_d, c%dsdy_d, c%dsdz_d, &
977 c%dtdx_d, c%dtdy_d, c%dtdz_d, &
978 c%jacinv_d, c%Xh%w3_d, c%msh%nelv, &
982 if (.not. c%coef_metrics_initialized)
then
983 call device_memcpy(c%G11, c%G11_d, ntot, device_to_host, &
985 call device_memcpy(c%G22, c%G22_d, ntot, device_to_host, &
987 call device_memcpy(c%G33, c%G33_d, ntot, device_to_host, &
989 call device_memcpy(c%G12, c%G12_d, ntot, device_to_host, &
991 call device_memcpy(c%G13, c%G13_d, ntot, device_to_host, &
993 call device_memcpy(c%G23, c%G23_d, ntot, device_to_host, &
998 if (c%msh%gdim .eq. 2)
then
1001 c%G11(i, 1, 1, 1) = c%drdx(i, 1, 1, 1) * c%drdx(i, 1, 1, 1) &
1002 + c%drdy(i, 1, 1, 1) * c%drdy(i, 1, 1, 1)
1004 c%G22(i, 1, 1, 1) = c%dsdx(i, 1, 1, 1) * c%dsdx(i, 1, 1, 1) &
1005 + c%dsdy(i, 1, 1, 1) * c%dsdy(i, 1, 1, 1)
1007 c%G12(i, 1, 1, 1) = c%drdx(i, 1, 1, 1) * c%dsdx(i, 1, 1, 1) &
1008 + c%drdy(i, 1, 1, 1) * c%dsdy(i, 1, 1, 1)
1012 c%G11(i, 1, 1, 1) = c%G11(i, 1, 1, 1) * c%jacinv(i, 1, 1, 1)
1013 c%G22(i, 1, 1, 1) = c%G22(i, 1, 1, 1) * c%jacinv(i, 1, 1, 1)
1014 c%G12(i, 1, 1, 1) = c%G12(i, 1, 1, 1) * c%jacinv(i, 1, 1, 1)
1015 c%G33(i, 1, 1, 1) = 0.0_rp
1016 c%G13(i, 1, 1, 1) = 0.0_rp
1017 c%G23(i, 1, 1, 1) = 0.0_rp
1020 do concurrent(e = 1:c%msh%nelv)
1021 do concurrent(i = 1:lxyz)
1022 c%G11(i,1,1,e) = c%G11(i,1,1,e) * c%Xh%w3(i,1,1)
1023 c%G22(i,1,1,e) = c%G22(i,1,1,e) * c%Xh%w3(i,1,1)
1024 c%G12(i,1,1,e) = c%G12(i,1,1,e) * c%Xh%w3(i,1,1)
1032 c%G11(i, 1, 1, 1) = c%drdx(i, 1, 1, 1) * c%drdx(i, 1, 1, 1) &
1033 + c%drdy(i, 1, 1, 1) * c%drdy(i, 1, 1, 1) &
1034 + c%drdz(i, 1, 1, 1) * c%drdz(i, 1, 1, 1)
1036 c%G22(i, 1, 1, 1) = c%dsdx(i, 1, 1, 1) * c%dsdx(i, 1, 1, 1) &
1037 + c%dsdy(i, 1, 1, 1) * c%dsdy(i, 1, 1, 1) &
1038 + c%dsdz(i, 1, 1, 1) * c%dsdz(i, 1, 1, 1)
1040 c%G33(i, 1, 1, 1) = c%dtdx(i, 1, 1, 1) * c%dtdx(i, 1, 1, 1) &
1041 + c%dtdy(i, 1, 1, 1) * c%dtdy(i, 1, 1, 1) &
1042 + c%dtdz(i, 1, 1, 1) * c%dtdz(i, 1, 1, 1)
1047 c%G11(i, 1, 1, 1) = c%G11(i, 1, 1, 1) * c%jacinv(i, 1, 1, 1)
1048 c%G22(i, 1, 1, 1) = c%G22(i, 1, 1, 1) * c%jacinv(i, 1, 1, 1)
1049 c%G33(i, 1, 1, 1) = c%G33(i, 1, 1, 1) * c%jacinv(i, 1, 1, 1)
1054 c%G12(i, 1, 1, 1) = c%drdx(i, 1, 1, 1) * c%dsdx(i, 1, 1, 1) &
1055 + c%drdy(i, 1, 1, 1) * c%dsdy(i, 1, 1, 1) &
1056 + c%drdz(i, 1, 1, 1) * c%dsdz(i, 1, 1, 1)
1058 c%G13(i, 1, 1, 1) = c%drdx(i, 1, 1, 1) * c%dtdx(i, 1, 1, 1) &
1059 + c%drdy(i, 1, 1, 1) * c%dtdy(i, 1, 1, 1) &
1060 + c%drdz(i, 1, 1, 1) * c%dtdz(i, 1, 1, 1)
1062 c%G23(i, 1, 1, 1) = c%dsdx(i, 1, 1, 1) * c%dtdx(i, 1, 1, 1) &
1063 + c%dsdy(i, 1, 1, 1) * c%dtdy(i, 1, 1, 1) &
1064 + c%dsdz(i, 1, 1, 1) * c%dtdz(i, 1, 1, 1)
1069 c%G12(i, 1, 1, 1) = c%G12(i, 1, 1, 1) * c%jacinv(i, 1, 1, 1)
1070 c%G13(i, 1, 1, 1) = c%G13(i, 1, 1, 1) * c%jacinv(i, 1, 1, 1)
1071 c%G23(i, 1, 1, 1) = c%G23(i, 1, 1, 1) * c%jacinv(i, 1, 1, 1)
1075 do e = 1, c%msh%nelv
1076 do concurrent(i = 1:lxyz)
1077 c%G11(i,1,1,e) = c%G11(i,1,1,e) * c%Xh%w3(i,1,1)
1078 c%G22(i,1,1,e) = c%G22(i,1,1,e) * c%Xh%w3(i,1,1)
1079 c%G12(i,1,1,e) = c%G12(i,1,1,e) * c%Xh%w3(i,1,1)
1081 c%G33(i,1,1,e) = c%G33(i,1,1,e) * c%Xh%w3(i,1,1)
1082 c%G13(i,1,1,e) = c%G13(i,1,1,e) * c%Xh%w3(i,1,1)
1083 c%G23(i,1,1,e) = c%G23(i,1,1,e) * c%Xh%w3(i,1,1)
1180 type(
coef_t),
intent(inout) :: coef
1181 real(kind=rp),
allocatable :: a(:,:,:,:)
1182 real(kind=rp),
allocatable :: b(:,:,:,:)
1183 real(kind=rp),
allocatable :: c(:,:,:,:)
1184 real(kind=rp),
allocatable :: dot(:,:,:,:)
1185 integer :: n, m, e, i, j, k, lx
1186 real(kind=rp) :: weight, len
1190 if (neko_bcknd_device .eq. 1)
then
1192 call device_coef_generate_area_and_normal( &
1193 coef%area_d, coef%nx_d, coef%ny_d, coef%nz_d, &
1194 coef%dxdr_d, coef%dydr_d, coef%dzdr_d, &
1195 coef%dxds_d, coef%dyds_d, coef%dzds_d, &
1196 coef%dxdt_d, coef%dydt_d, coef%dzdt_d, &
1197 coef%Xh%wx_d, coef%Xh%wy_d, coef%Xh%wz_d, &
1198 lx, coef%msh%nelv, neko_eps)
1202 call device_memcpy(coef%area, coef%area_d, m, &
1203 device_to_host, sync = .false.)
1204 call device_memcpy(coef%nx, coef%nx_d, m, &
1205 device_to_host, sync = .false.)
1206 call device_memcpy(coef%ny, coef%ny_d, m, &
1207 device_to_host, sync = .false.)
1208 call device_memcpy(coef%nz, coef%nz_d, &
1209 m, device_to_host, sync = .true.)
1213 allocate(a(coef%Xh%lx, coef%Xh%lx, coef%Xh%lx, coef%msh%nelv))
1214 allocate(b(coef%Xh%lx, coef%Xh%lx, coef%Xh%lx, coef%msh%nelv))
1215 allocate(c(coef%Xh%lx, coef%Xh%lx, coef%Xh%lx, coef%msh%nelv))
1216 allocate(dot(coef%Xh%lx, coef%Xh%lx, coef%Xh%lx, coef%msh%nelv))
1223 a(i, 1, 1, 1) = coef%dyds(i, 1, 1, 1) * coef%dzdt(i, 1, 1, 1) &
1224 - coef%dzds(i, 1, 1, 1) * coef%dydt(i, 1, 1, 1)
1226 b(i, 1, 1, 1) = coef%dzds(i, 1, 1, 1) * coef%dxdt(i, 1, 1, 1) &
1227 - coef%dxds(i, 1, 1, 1) * coef%dzdt(i, 1, 1, 1)
1229 c(i, 1, 1, 1) = coef%dxds(i, 1, 1, 1) * coef%dydt(i, 1, 1, 1) &
1230 - coef%dyds(i, 1, 1, 1) * coef%dxdt(i, 1, 1, 1)
1235 dot(i, 1, 1, 1) = a(i, 1, 1, 1) * a(i, 1, 1, 1) &
1236 + b(i, 1, 1, 1) * b(i, 1, 1, 1) &
1237 + c(i, 1, 1, 1) * c(i, 1, 1, 1)
1241 do e = 1, coef%msh%nelv
1242 do concurrent(k = 1:coef%Xh%lx)
1243 do concurrent(j = 1:coef%Xh%lx)
1244 weight = coef%Xh%wy(j) * coef%Xh%wz(k)
1245 coef%area(j, k, 2, e) = sqrt(dot(lx, j, k, e)) * weight
1246 coef%area(j, k, 1, e) = sqrt(dot(1, j, k, e)) * weight
1247 coef%nx(j,k, 1, e) = -a(1, j, k, e)
1248 coef%nx(j,k, 2, e) = a(lx, j, k, e)
1249 coef%ny(j,k, 1, e) = -b(1, j, k, e)
1250 coef%ny(j,k, 2, e) = b(lx, j, k, e)
1251 coef%nz(j,k, 1, e) = -c(1, j, k, e)
1252 coef%nz(j,k, 2, e) = c(lx, j, k, e)
1261 a(i, 1, 1, 1) = coef%dydr(i, 1, 1, 1) * coef%dzdt(i, 1, 1, 1) &
1262 - coef%dzdr(i, 1, 1, 1) * coef%dydt(i, 1, 1, 1)
1264 b(i, 1, 1, 1) = coef%dzdr(i, 1, 1, 1) * coef%dxdt(i, 1, 1, 1) &
1265 - coef%dxdr(i, 1, 1, 1) * coef%dzdt(i, 1, 1, 1)
1267 c(i, 1, 1, 1) = coef%dxdr(i, 1, 1, 1) * coef%dydt(i, 1, 1, 1) &
1268 - coef%dydr(i, 1, 1, 1) * coef%dxdt(i, 1, 1, 1)
1273 dot(i, 1, 1, 1) = a(i, 1, 1, 1) * a(i, 1, 1, 1) &
1274 + b(i, 1, 1, 1) * b(i, 1, 1, 1) &
1275 + c(i, 1, 1, 1) * c(i, 1, 1, 1)
1279 do e = 1, coef%msh%nelv
1280 do concurrent(k = 1:coef%Xh%lx)
1281 do concurrent(j = 1:coef%Xh%lx)
1282 weight = coef%Xh%wx(j) * coef%Xh%wz(k)
1283 coef%area(j, k, 3, e) = sqrt(dot(j, 1, k, e)) * weight
1284 coef%area(j, k, 4, e) = sqrt(dot(j, lx, k, e)) * weight
1285 coef%nx(j,k, 3, e) = a(j, 1, k, e)
1286 coef%nx(j,k, 4, e) = -a(j, lx, k, e)
1287 coef%ny(j,k, 3, e) = b(j, 1, k, e)
1288 coef%ny(j,k, 4, e) = -b(j, lx, k, e)
1289 coef%nz(j,k, 3, e) = c(j, 1, k, e)
1290 coef%nz(j,k, 4, e) = -c(j, lx, k, e)
1298 a(i, 1, 1, 1) = coef%dydr(i, 1, 1, 1) * coef%dzds(i, 1, 1, 1) &
1299 - coef%dzdr(i, 1, 1, 1) * coef%dyds(i, 1, 1, 1)
1301 b(i, 1, 1, 1) = coef%dzdr(i, 1, 1, 1) * coef%dxds(i, 1, 1, 1) &
1302 - coef%dxdr(i, 1, 1, 1) * coef%dzds(i, 1, 1, 1)
1304 c(i, 1, 1, 1) = coef%dxdr(i, 1, 1, 1) * coef%dyds(i, 1, 1, 1) &
1305 - coef%dydr(i, 1, 1, 1) * coef%dxds(i, 1, 1, 1)
1310 dot(i, 1, 1, 1) = a(i, 1, 1, 1) * a(i, 1, 1, 1) &
1311 + b(i, 1, 1, 1) * b(i, 1, 1, 1) &
1312 + c(i, 1, 1, 1) * c(i, 1, 1, 1)
1316 do e = 1, coef%msh%nelv
1317 do concurrent(k = 1:coef%Xh%lx)
1318 do concurrent(j = 1:coef%Xh%lx)
1319 weight = coef%Xh%wx(j) * coef%Xh%wy(k)
1320 coef%area(j, k, 5, e) = sqrt(dot(j, k, 1, e)) * weight
1321 coef%area(j, k, 6, e) = sqrt(dot(j, k, lx, e)) * weight
1322 coef%nx(j,k, 5, e) = -a(j, k, 1, e)
1323 coef%nx(j,k, 6, e) = a(j, k, lx, e)
1324 coef%ny(j,k, 5, e) = -b(j, k, 1, e)
1325 coef%ny(j,k, 6, e) = b(j, k, lx, e)
1326 coef%nz(j,k, 5, e) = -c(j, k, 1, e)
1327 coef%nz(j,k, 6, e) = c(j, k, lx, e)
1334 do j = 1,
size(coef%nz)
1335 len = sqrt(coef%nx(j,1,1,1)**2 + &
1336 coef%ny(j,1,1,1)**2 + coef%nz(j,1,1,1)**2)
1337 if (len .gt. neko_eps)
then
1338 coef%nx(j,1,1,1) = coef%nx(j,1,1,1) / len
1339 coef%ny(j,1,1,1) = coef%ny(j,1,1,1) / len
1340 coef%nz(j,1,1,1) = coef%nz(j,1,1,1) / len