16 use size_m
, only : nid
17 use size_m
, only : lx1, ly1, lz1, lelt
18 use size_m
, only : lx2, ly2, lz2, lelv
19 use size_m
, only : nx1, ny1, nz1, nelv
21 use ctimer, only : np4misc, tp4misc
22 use geom, only : binvm1, bm1, volvm1
24 use soln, only : vx, vy, vz, v1mask, v2mask, v3mask
25 use soln, only : vtrans, pmask, vmult, pr
26 use tstep, only : imesh, nmxh, tolhv
27 use input, only : param
30 integer,
parameter :: ktot = lx1*ly1*lz1*lelt
31 integer :: laxt, v_proj_size
33 type(
approx_space),
save :: p_apx, vx_apx, vy_apx, vz_apx
35 real(DP),
allocatable :: RES1(:,:,:,:)
36 real(DP),
allocatable :: RES2(:,:,:,:)
37 real(DP),
allocatable :: RES3(:,:,:,:)
38 real(DP),
allocatable :: DV1 (:,:,:,:)
39 real(DP),
allocatable :: DV2 (:,:,:,:)
40 real(DP),
allocatable :: DV3 (:,:,:,:)
41 real(DP),
allocatable :: RESPR (:,:,:,:)
43 real(DP),
allocatable :: h1(:,:,:,:), h2(:,:,:,:)
44 real(DP),
allocatable :: VEXT(:,:)
45 REAL(DP),
allocatable :: DPR(:,:,:,:)
47 REAL(DP),
allocatable :: DVC (:,:,:,:), DFC(:,:,:,:)
48 REAL(DP) :: DIV1, DIV2, DIF1, DIF2, QTL1, QTL2
51 real(DP),
external :: glsum
53 integer :: intype, ntot1
57 v_proj_size = int(param(92))
60 if (.not.
allocated(p_apx%projectors))
then
63 if (.not.
allocated(vx_apx%projectors))
then
66 if (.not.
allocated(vy_apx%projectors))
then
69 if (.not.
allocated(vz_apx%projectors))
then
74 ntot1 = nx1*ny1*nz1*nelv
79 allocate(vext(lx1*ly1*lz1*lelv,3))
98 CALL
bcdirvc(vx,vy,vz,v1mask,v2mask,v3mask)
102 if (icalld == 0) tpres=0.0
108 allocate(respr(lx2,ly2,lz2,lelv))
114 allocate(h1(lx1,ly1,lz1,lelv), h2(lx1,ly1,lz1,lelv))
115 h1 = 1._dp / vtrans(:,:,:,:,1)
119 allocate(dpr(lx2,ly2,lz2,lelv))
121 call
hsolve(
'PRES', dpr, respr, h1, h2, pmask, vmult &
122 ,imesh,tolspl,nmxh,1 &
134 allocate(res1(lx1,ly1,lz1,lelv), &
135 res2(lx1,ly1,lz1,lelv), &
136 res3(lx1,ly1,lz1,lelv) )
139 call
cresvsp(res1,res2,res3,h1,h2)
142 allocate(dv1(lx1,ly1,lz1,lelv), &
143 dv2(lx1,ly1,lz1,lelv), &
144 dv3(lx1,ly1,lz1,lelv) )
148 call
hsolve(
'VELX', dv1, res1, h1, h2, v1mask, vmult, imesh, tolhv, nmxh, 1, &
150 call
hsolve(
'VELY', dv2, res2, h1, h2, v2mask, vmult, imesh, tolhv, nmxh, 2, &
152 call
hsolve(
'VELZ', dv3, res3, h1, h2, v3mask, vmult, imesh, tolhv, nmxh, 3, &
155 deallocate(res1, res2, res3, h1, h2)
157 vx = vx + dv1; vy = vy + dv2; vz = vz + dv3
164 allocate(dvc(lx1,ly1,lz1,lelv), dfc(lx1,ly1,lz1,lelv))
165 CALL
opdiv(dvc,vx,vy,vz)
170 div1 = glsum(dv1,ntot1)/volvm1
172 dv2 = dvc * dvc * bm1
173 div2 = glsum(dv2,ntot1)/volvm1
178 dif1 = glsum(dv1,ntot1)/volvm1
180 dv2 = dfc * dfc * bm1
181 dif2 = glsum(dv2,ntot1)/volvm1
185 qtl1 = glsum(dv1,ntot1)/volvm1
188 qtl2 = glsum(dv2,ntot1)/volvm1
192 WRITE(6,
'(15X,A,1p2e13.4)') &
193 'L1/L2 DIV(V) :',div1,div2
194 WRITE(6,
'(15X,A,1p2e13.4)') &
195 'L1/L2 QTL :',qtl1,qtl2
196 WRITE(6,
'(15X,A,1p2e13.4)') &
197 'L1/L2 DIV(V)-QTL:',dif1,dif2
198 IF (dif2 > 0.1)
WRITE(6,
'(15X,A)') &
199 'WARNING: DIV(V)-QTL too large!'
201 tp4misc = tp4misc + (
dnekclock() - etime)
221 use size_m
, only : lx1, ly1, lz1, lx2, ly2, lz2, lelv
222 use size_m
, only : nx1, ny1, nz1, nelv, ndim, nx2, ny2, nz2
223 use geom, only : rxm2, sxm2, txm2, rym2, sym2, tym2, rzm2, szm2, tzm2
224 use geom, only : unx, uny, unz, area
225 use input, only : ifaxis, if3d, cbc
226 use geom, only : bm1, binvm1, jacmi
227 use soln, only : bfx, bfy, bfz, pr
228 use soln, only : vx, vy, vz
229 use soln, only : vtrans, vdiff, vmult
230 use soln, only : v1mask, v2mask, v3mask
231 use tstep, only : imesh, bd, dt, ifield
232 use mesh, only : if_ortho
233 use dxyz, only : dxtm12, dym12, dzm12
238 REAL(DP),
intent(out) :: RESPR (lx2,ly2,lz2,lelv)
239 real(DP),
intent(in) :: VEXT (lx1*ly1*lz1*lelv,3)
241 real(DP),
allocatable,
dimension(:,:,:,:) :: TA1, TA2, TA3
242 real(DP),
allocatable,
dimension(:,:,:,:) :: WA1, WA2, WA3
243 real(DP),
allocatable,
dimension(:,:,:,:) :: W1, W2
247 integer :: nxyz1, ntot1, nfaces
248 integer :: n, ifc, iel, e, iz
249 integer :: nyz2, nxy1
250 real(DP) :: scale, dtbd
252 real(DP),
allocatable :: tmp1(:,:,:), tmp2(:,:,:), tmp3(:,:,:)
255 ncrespsp = ncrespsp + 1
258 allocate(ta1(lx1,ly1,lz1,lelv) &
259 , ta2(lx1,ly1,lz1,lelv) &
260 , ta3(lx1,ly1,lz1,lelv) )
261 allocate(w1(lx1,ly1,lz1,lelv) &
262 , w2(lx1,ly1,lz1,lelv) )
270 call
op_curl(ta1,ta2,ta3,vext(1,1),vext(1,2),vext(1,3), &
277 allocate( wa1(lx1,ly1,lz1,lelv) &
278 , wa2(lx1,ly1,lz1,lelv) &
279 , wa3(lx1,ly1,lz1,lelv) )
280 call
op_curl(wa1,wa2,wa3,ta1,ta2,ta3, .true. ,w1,w2)
283 allocate(tmp1(lx1, ly1, lz1), tmp2(lx1,ly1,lz1), tmp3(lx1,ly1,lz1))
300 ta1 = 1._dp / vtrans(:,:,:,:,1)
303 CALL
axhelm(respr,pr,ta1,ta2,imesh,1)
310 tmp1 = bm1(:,:,:,iel) * vdiff(:,:,:,iel,1) *ta1(:,:,:,iel)
311 ta3(:,:,:,iel) = binvm1(:,:,:,iel) * (bfz(:,:,:,iel)*ta1(:,:,:,iel)-tmp1*wa3(:,:,:,iel))
312 ta2(:,:,:,iel) = binvm1(:,:,:,iel) * (bfy(:,:,:,iel)*ta1(:,:,:,iel)-tmp1*wa2(:,:,:,iel))
313 ta1(:,:,:,iel) = binvm1(:,:,:,iel) * (bfx(:,:,:,iel)*ta1(:,:,:,iel)-tmp1*wa1(:,:,:,iel))
326 tmp1 = jacmi(:,:,:,e) * bm1(:,:,:,e)
328 tmp2 = ta1(:,:,:,e) * rxm2(:,:,:,e) * tmp1
329 call
mxm(dxtm12,nx1,tmp2,nx2,tmp3,nyz2)
330 respr(:,:,:,e) = - respr(:,:,:,e) + tmp3
332 tmp2 = ta2(:,:,:,e) * sym2(:,:,:,e) * tmp1
334 call
mxm(tmp2(:,:,iz),nx1,dym12,ny2,tmp3(:,:,iz),ny1)
336 respr(:,:,:,e) = respr(:,:,:,e) + tmp3
338 tmp2 = ta3(:,:,:,e) * tzm2(:,:,:,e) * tmp1
339 call
mxm(tmp2,nxy1,dzm12,nz2,tmp3,nz1)
340 respr(:,:,:,e) = respr(:,:,:,e) + tmp3
344 call
cdtp(wa1,ta1,rxm2,sxm2,txm2,1)
345 call
cdtp(wa2,ta2,rym2,sym2,tym2,1)
346 call
cdtp(wa3,ta3,rzm2,szm2,tzm2,1)
347 respr = -respr + wa1 + wa2 + wa3
351 call
cdtp(wa1,ta1,rxm2,sxm2,txm2,1)
352 call
cdtp(wa2,ta2,rym2,sym2,tym2,1)
353 respr = -respr + wa1 + wa2
355 deallocate(wa1,wa2,wa3)
364 cb = cbc(ifc,iel,ifield)
366 IF (cb(1:1) ==
'V' .OR. cb(1:1) ==
'v')
THEN
368 tmp1 = 0._dp; tmp2 = 0._dp
369 IF (ndim == 3) tmp3 = 0._dp
371 (tmp1,vx(1,1,1,iel),unx(1,1,ifc,iel),ifc)
373 (tmp2,vy(1,1,1,iel),uny(1,1,ifc,iel),ifc)
376 (tmp3,vz(1,1,1,iel),unz(1,1,ifc,iel),ifc)
377 else if (cb(1:3) ==
'SYM')
then
379 tmp1 = 0._dp; tmp2 = 0._dp
380 IF (ndim == 3) tmp3 = 0._dp
382 CALL
faccl3(tmp1,ta1(:,:,:,iel),unx(1,1,ifc,iel),ifc)
383 CALL
faccl3(tmp2,ta2(:,:,:,iel),uny(1,1,ifc,iel),ifc)
385 CALL
faccl3(tmp3,ta3(:,:,:,iel),unz(1,1,ifc,iel),ifc)
391 tmp1 = tmp1 + tmp2 + tmp3
395 CALL
faccl2(tmp1,area(1,1,ifc,iel),ifc)
398 if (cb(1:1) ==
'V' .OR. cb(1:1) ==
'v')
then
399 respr(:,:,:,iel) = respr(:,:,:,iel) - dtbd*tmp1
400 else if (cb(1:3) ==
'SYM')
then
401 respr(:,:,:,iel) = respr(:,:,:,iel) - tmp1
406 deallocate(ta1, ta2, ta3)
411 tcrespsp = tcrespsp + (
dnekclock() - etime)
420 use size_m
, only : nx1, ny1, nz1, nelv
421 use size_m
, only : lx1, ly1, lz1, lelv
422 use input, only : ifaxis
423 use soln, only : vx, vy, vz, pr, bfx, bfy, bfz
427 real(DP),
intent(out) :: resv1(lx1,ly1,lz1,lelv)
428 real(DP),
intent(out) :: resv2(lx1,ly1,lz1,lelv)
429 real(DP),
intent(out) :: resv3(lx1,ly1,lz1,lelv)
430 real(DP),
intent(out) :: h1 (lx1,ly1,lz1,lelv)
431 real(DP),
intent(out) :: h2 (lx1,ly1,lz1,lelv)
433 real(DP),
allocatable,
dimension(:,:,:,:) :: TA1, TA2, TA3, TA4
435 integer :: ntot, intype
440 ncresvsp = ncresvsp + 1
442 ntot = nx1*ny1*nz1*nelv
449 CALL
ophx(resv1,resv2,resv3,vx,vy,vz,h1,h2)
453 allocate(ta1(lx1,ly1,lz1,lelv) &
454 , ta2(lx1,ly1,lz1,lelv) &
455 , ta3(lx1,ly1,lz1,lelv) &
456 , ta4(lx1,ly1,lz1,lelv) )
459 call
opgrad(ta1,ta2,ta3,ta4)
467 resv1 = -resv1 + bfx - ta1
468 resv2 = -resv2 + bfy - ta2
469 resv3 = -resv3 + bfz - ta3
471 tcresvsp = tcresvsp + (
dnekclock() - etime)
480 subroutine op_curl(w1,w2,w3,u1,u2,u3,ifavg,work1,work2)
482 use size_m
, only : lx1, ly1, lz1, lelv, nx1, ny1, nz1, nelv
483 use geom, only : rxm1, rym1, rzm1, sxm1, sym1, szm1, txm1, tym1, tzm1
484 use dxyz, only : dztm1, dytm1, dxm1
485 use geom, only : jacm1, bm1, binvm1, jacmi
486 use input, only : if3d, ifaxis, ifcyclic
487 use tstep, only : ifield
488 use mesh, only : if_ortho
491 real(DP),
intent(out) :: w1(lx1,ly1,lz1,lelv) !>
492 real(DP),
intent(out) :: w2(lx1,ly1,lz1,lelv) !>
493 real(DP),
intent(out) :: w3(lx1,ly1,lz1,lelv) !>
494 real(DP),
intent(in) :: u1(lx1,ly1,lz1,lelv) !>
495 real(DP),
intent(in) :: u2(lx1,ly1,lz1,lelv) !>
496 real(DP),
intent(in) :: u3(lx1,ly1,lz1,lelv) !>
497 real(DP),
intent(out) :: work1(lx1,ly1,lz1,lelv) !>
498 real(DP),
intent(out) :: work2(lx1,ly1,lz1,lelv) !>
499 logical,
intent(in) :: ifavg !>
501 integer :: ntot, nxyz, ifielt, nxy1, nyz1, iel, iz
502 real(DP),
allocatable :: tmp1(:,:,:), tmp2(:,:,:)
504 allocate(tmp1(nx1,ny1,nz1), tmp2(nx1,ny1,nz1))
506 ntot = nx1*ny1*nz1*nelv
516 CALL
mxm(u3(1,1,iz,iel),nx1,dytm1,ny1,tmp1(1,1,iz),ny1)
518 CALL
mxm(u2(1,1,1,iel),nxy1,dztm1,nz1,tmp2,nz1)
519 w1(:,:,:,iel) = (tmp1*sym1(:,:,:,iel) - tmp2*tzm1(:,:,:,iel)) * jacmi(:,:,:,iel)
522 call
dudxyz(work1,u3,rym1,sym1,tym1,jacm1,1,2)
523 call
dudxyz(work2,u2,rzm1,szm1,tzm1,jacm1,1,3)
524 w1 = work1(:,:,:,1:nelv) - work2(:,:,:,1:nelv)
527 call
dudxyz(work1,u3,rym1,sym1,tym1,jacm1,1,2)
528 call
copy(w1,work1,ntot)
531 write(*,*)
"Oops: ifaxis"
533 call
copy(ta,u3,ntot)
536 call rzero(ta(1,1,1,iel),nx1)
537 call
mxm(ta(1,1,1,iel),nx1,datm1,ny1,duax,1)
538 call
copy(ta(1,1,1,iel),duax,nx1)
540 call col2(ta(1,1,1,iel),yinvm1(1,1,1,iel),nxyz)
542 call add2(w1,ta,ntot)
551 CALL
mxm(u1(1,1,1,iel),nxy1,dztm1,nz1,tmp1,nz1)
552 CALL
mxm(dxm1,nx1,u3(1,1,1,iel),nx1,tmp2,nyz1)
553 w2(:,:,:,iel) = (tmp1*tzm1(:,:,:,iel) - tmp2*rxm1(:,:,:,iel)) * jacmi(:,:,:,iel)
556 call
dudxyz(work1,u1,rzm1,szm1,tzm1,jacm1,1,3)
557 call
dudxyz(work2,u3,rxm1,sxm1,txm1,jacm1,1,1)
558 w2 = work1(:,:,:,1:nelv) - work2(:,:,:,1:nelv)
561 work1(:,:,:,1:nelv) = 0._dp
562 call
dudxyz(work2,u3,rxm1,sxm1,txm1,jacm1,1,1)
563 w2 = work1(:,:,:,1:nelv) - work2(:,:,:,1:nelv)
569 CALL
mxm(dxm1,nx1,u2(1,1,1,iel),nx1,tmp1,nyz1)
571 CALL
mxm(u1(1,1,iz,iel),nx1,dytm1,ny1,tmp2(1,1,iz),ny1)
573 w3(:,:,:,iel) = (tmp1*rxm1(:,:,:,iel) - tmp2*sym1(:,:,:,iel)) * jacmi(:,:,:,iel)
576 call
dudxyz(work1,u2,rxm1,sxm1,txm1,jacm1,1,1)
577 call
dudxyz(work2,u1,rym1,sym1,tym1,jacm1,1,2)
578 w3 = work1(:,:,:,1:nelv) - work2(:,:,:,1:nelv)
583 if (ifavg .AND. .NOT. ifcyclic)
then
588 w1 = w1 * bm1; w2 = w2 * bm1; w3 = w3 * bm1
590 w1 = w1 * binvm1; w2 = w2 * binvm1; w3 = w3 * binvm1
606 use size_m
, only : lx1, ly1, lz1, lelv
607 use input, only : if3d
608 use soln, only : vx, vy, vz, vxlag, vylag, vzlag
609 use tstep, only : ab, nab
613 real(DP),
intent(out) :: vext(lx1,ly1,lz1,lelv,3)
614 real(DP) :: AB0, AB1, AB2
621 vext(:,:,:,:,1) = ab0*vx + ab1*vxlag(:,:,:,:,1) + ab2*vxlag(:,:,:,:,2)
622 vext(:,:,:,:,2) = ab0*vy + ab1*vylag(:,:,:,:,1) + ab2*vylag(:,:,:,:,2)
623 if(if3d) vext(:,:,:,:,3) = ab0*vz + ab1*vzlag(:,:,:,:,1) + ab2*vzlag(:,:,:,:,2)
625 vext(:,:,:,:,1) = ab0*vx + ab1*vxlag(:,:,:,:,1)
626 vext(:,:,:,:,2) = ab0*vy + ab1*vylag(:,:,:,:,1)
627 if(if3d) vext(:,:,:,:,3) = ab0*vz + ab1*vzlag(:,:,:,:,1)
subroutine ophx(out1, out2, out3, inp1, inp2, inp3, h1, h2)
OUT = (H1*A+H2*B) * INP.
subroutine plan4()
Splitting scheme .
subroutine dssum(u)
Direct stiffness sum.
subroutine ctolspl(tolspl, respr)
Compute the pressure tolerance.
subroutine op_curl(w1, w2, w3, u1, u2, u3, ifavg, work1, work2)
Compute curl of U.
subroutine faccl3(a, b, c, iface1)
Type to hold the approximation space. Should not be modified outside this module, so more of a handle...
subroutine mxm(a, n1, b, n2, c, n3)
Compute matrix-matrix product C = A*B.
subroutine makef
Compute and add: (1) user specified forcing function (FX,FY,FZ) (2) driving force due to natural conv...
subroutine sethlm(h1, h2, intloc)
Set the variable property arrays H1 and H2 in the Helmholtz equation. (associated with variable IFIEL...
subroutine axhelm(au, u, helm1, helm2, imesh, isd)
Compute the (Helmholtz) matrix-vector product, AU = helm1*[A]u + helm2*[B]u, for NEL elements...
subroutine, public hsolve(name, u, r, h1, h2, vmk, vml, imsh, tol, maxit, isd, apx, bi)
Either std. Helmholtz solve, or a projection + Helmholtz solve.
subroutine bcdirvc(V1, V2, V3, mask1, mask2, mask3)
Apply Dirichlet boundary conditions to surface of vector (V1,V2,V3). Use IFIELD as a guide to which b...
subroutine crespsp(respr, vext)
Compute start residual/right-hand-side in the pressure.
subroutine ortho(respr)
Orthogonalize the residual in the pressure solver with respect to (1,1,...,1)T (only if all Dirichlet...
subroutine cresvsp(resv1, resv2, resv3, h1, h2)
Compute the residual for the velocity.
real(dp) function dnekclock()
subroutine faccl2(a, b, iface1)
Collocate B with A on the surface IFACE1 of element IE. A is a (NX,NY,NZ) data structure B is a (NX...
subroutine opgrad(out1, out2, out3, inp)
Compute OUTi = Di*INP, i=1,2,3. the gradient of the scalar field INP. Note: OUTi is defined on the pr...
subroutine, public init_approx_space(apx, n_max, ntot)
Initialize approximation space object.
subroutine v_extrap(vext)
Extrapolate the velocity forward in time with AB(k)
subroutine dudxyz(du, u, rm1, sm1, tm1, jm1, imsh, isd)
Compute some derviatives? DU - dU/dx or dU/dy or dU/dz U - a field variable defined on mesh 1 RM1 - d...
subroutine opdssum(a, b, c)
subroutine cdtp(dtx, x, rm2, sm2, tm2, isd)
Compute DT*X (entire field)
subroutine opdiv(outfld, inpx, inpy, inpz)
Compute OUTFLD = SUMi Di*INPi. the divergence of the vector field (INPX,INPY,INPZ) ...
subroutine lagvel
Keep old velocity field(s)