179 subroutine coord_conv( x, y, z, xX, xY, xZ, yX, yY, yZ, zX, zY, zZ, &
184 real(rp),
intent(out) :: x(elem%np), y(elem%np), z(elem%np)
185 real(rp),
intent(out) :: xx(elem%np), xy(elem%np), xz(elem%np)
186 real(rp),
intent(out) :: yx(elem%np), yy(elem%np), yz(elem%np)
187 real(rp),
intent(out) :: zx(elem%np), zy(elem%np), zz(elem%np)
188 real(rp),
intent(in) :: vx(elem%nv), vy(elem%nv), vz(elem%nv)
189 end subroutine coord_conv
190 subroutine calc_normal( normal_fn, &
191 Escale_f, fid_h, fid_v, elem )
195 real(rp),
intent(out) :: normal_fn(elem%nfptot,3)
196 integer,
intent(in) :: fid_h(elem%nfp_h,elem%nfaces_h)
197 integer,
intent(in) :: fid_v(elem%nfp_v,elem%nfaces_v)
198 real(rp),
intent(in) :: escale_f(elem%nfptot,3,3)
199 end subroutine calc_normal
207 integer :: fmask(lcmesh%refelem%nfptot)
208 integer :: fid_h(lcmesh%refelem3d%nfp_h,lcmesh%refelem3d%nfaces_h)
209 integer :: fid_v(lcmesh%refelem3d%nfp_v,lcmesh%refelem3d%nfaces_v)
210 real(rp) :: escale_f(lcmesh%refelem%nfptot,3,3)
212 integer :: node_ids(lcmesh%refelem%nv)
213 real(rp) :: vx(lcmesh%refelem%nv), vy(lcmesh%refelem%nv), vz(lcmesh%refelem%nv)
214 real(rp) :: xx(lcmesh%refelem%np), xy(lcmesh%refelem%np), xz(lcmesh%refelem%np)
215 real(rp) :: yx(lcmesh%refelem%np), yy(lcmesh%refelem%np), yz(lcmesh%refelem%np)
216 real(rp) :: zx(lcmesh%refelem%np), zy(lcmesh%refelem%np), zz(lcmesh%refelem%np)
219 refelem => lcmesh%refElem3D
221 allocate( lcmesh%pos_en(refelem%Np,lcmesh%Ne,3) )
224 allocate( lcmesh%normal_fn(refelem%NfpTot,lcmesh%Ne,3) )
225 allocate( lcmesh%sJ(refelem%NfpTot,lcmesh%Ne) )
226 allocate( lcmesh%J(refelem%Np,lcmesh%Ne) )
227 allocate( lcmesh%Fscale(refelem%NfpTot,lcmesh%Ne) )
228 allocate( lcmesh%Escale(refelem%Np,lcmesh%Ne,3,3) )
229 allocate( lcmesh%zS(refelem%Np,lcmesh%Ne) )
230 allocate( lcmesh%Sz(refelem%Np,lcmesh%Ne) )
231 allocate( lcmesh%Gsqrt(refelem%Np,lcmesh%NeA) )
232 allocate( lcmesh%GsqrtH(refelem%Nfp_v,lcmesh%Ne2D) )
233 allocate( lcmesh%G_ij(refelem%Nfp_v,lcmesh%Ne2D,2,2) )
234 allocate( lcmesh%GIJ (refelem%Nfp_v,lcmesh%Ne2D,2,2) )
235 allocate( lcmesh%GI3 (refelem%Np,lcmesh%NeA,2) )
236 allocate( lcmesh%zlev(refelem%Np,lcmesh%Ne) )
237 allocate( lcmesh%gam(refelem%Np,lcmesh%NeA) )
239 allocate( lcmesh%lon2D(refelem%Nfp_v,lcmesh%Ne2D) )
240 allocate( lcmesh%lat2D(refelem%Nfp_v,lcmesh%Ne2D) )
242 do f=1, refelem%Nfaces_h
243 do i=1, refelem%Nfp_h
244 fid_h(i,f) = i + (f-1)*refelem%Nfp_h
245 fmask(fid_h(i,f)) = refelem%Fmask_h(i,f)
248 do f=1, refelem%Nfaces_v
249 do i=1, refelem%Nfp_v
250 fid_v(i,f) = i + refelem%Nfaces_h*refelem%Nfp_h + (f-1)*refelem%Nfp_v
251 fmask(fid_v(i,f)) = refelem%Fmask_v(i,f)
261 node_ids(:) = lcmesh%EToV(ke,:)
262 vx(:) = lcmesh%pos_ev(node_ids(:),1)
263 vy(:) = lcmesh%pos_ev(node_ids(:),2)
264 vz(:) = lcmesh%pos_ev(node_ids(:),3)
266 lcmesh%pos_en(:,ke,1), lcmesh%pos_en(:,ke,2), lcmesh%pos_en(:,ke,3), &
267 xx, xy, xz, yx, yy, yz, zx, zy, zz, &
268 vx, vy, vz, refelem )
270 lcmesh%J(:,ke) = xx(:)*(yy(:)*zz(:) - zy(:)*yz) &
271 - yx(:)*(xy(:)*zz(:) - zy(:)*xz) &
272 + zx(:)*(xy(:)*yz(:) - yy(:)*xz)
274 lcmesh%Escale(:,ke,1,1) = (yy(:)*zz(:) - zy(:)*yz(:))/lcmesh%J(:,ke)
275 lcmesh%Escale(:,ke,1,2) = - (xy(:)*zz(:) - zy(:)*xz(:))/lcmesh%J(:,ke)
276 lcmesh%Escale(:,ke,1,3) = (xy(:)*yz(:) - yy(:)*xz(:))/lcmesh%J(:,ke)
278 lcmesh%Escale(:,ke,2,1) = - (yx(:)*zz(:) - zx(:)*yz(:))/lcmesh%J(:,ke)
279 lcmesh%Escale(:,ke,2,2) = (xx(:)*zz(:) - zx(:)*xz(:))/lcmesh%J(:,ke)
280 lcmesh%Escale(:,ke,2,3) = - (xx(:)*yz(:) - yx(:)*xz(:))/lcmesh%J(:,ke)
282 lcmesh%Escale(:,ke,3,1) = (yx(:)*zy(:) - zx(:)*yy(:))/lcmesh%J(:,ke)
283 lcmesh%Escale(:,ke,3,2) = - (xx(:)*zy(:) - zx(:)*xy(:))/lcmesh%J(:,ke)
284 lcmesh%Escale(:,ke,3,3) = (xx(:)*yy(:) - yx(:)*xy(:))/lcmesh%J(:,ke)
295 escale_f(:,i,j) = lcmesh%Escale(fmask(:),ke,i,j)
298 call calc_normal( lcmesh%normal_fn(:,ke,:), &
299 escale_f, fid_h, fid_v, refelem )
301 lcmesh%sJ(:,ke) = sqrt( &
302 lcmesh%normal_fn(:,ke,1)**2 + lcmesh%normal_fn(:,ke,2)**2 + lcmesh%normal_fn(:,ke,3)**2 )
304 lcmesh%normal_fn(:,ke,d) = lcmesh%normal_fn(:,ke,d)/lcmesh%sJ(:,ke)
306 lcmesh%sJ(:,ke) = lcmesh%sJ(:,ke)*lcmesh%J(fmask(:),ke)
308 lcmesh%Fscale(:,ke) = lcmesh%sJ(:,ke)/lcmesh%J(fmask(:),ke)
309 lcmesh%zlev(:,ke) = lcmesh%pos_en(:,ke,3)
314 lcmesh%Gsqrt (:,:) = 1.0_rp
315 lcmesh%GsqrtH(:,:) = 1.0_rp
316 lcmesh%GIJ (:,:,1,1) = 1.0_rp
317 lcmesh%GIJ (:,:,2,1) = 0.0_rp
318 lcmesh%GIJ (:,:,1,2) = 0.0_rp
319 lcmesh%GIJ (:,:,2,2) = 1.0_rp
320 lcmesh%G_ij (:,:,1,1) = 1.0_rp
321 lcmesh%G_ij (:,:,2,1) = 0.0_rp
322 lcmesh%G_ij (:,:,1,2) = 0.0_rp
323 lcmesh%G_ij (:,:,2,2) = 1.0_rp
324 lcmesh%GI3 (:,:,1) = 0.0_rp
325 lcmesh%GI3 (:,:,2) = 0.0_rp
326 lcmesh%gam (:,:) = 1.0_rp