5 use size_m
, only : lelv, lx2, ly2, lz2
6 use size_m
, only : nx1, ny1, nz1, nelv, nid
7 use geom, only : binvm1, volvm1
8 use tstep, only : dt, tolpdf, tolps, prelax
9 use soln, only : pmask, vmult
13 REAL(DP) :: RESPR (lx2,ly2,lz2,lelv)
15 real(DP),
allocatable :: WORK(:,:,:,:)
17 real(DP) :: rinit, tolmin, tolold
18 real(DP),
external :: glsc23
20 allocate(work(lx2,ly2,lz2,lelv))
21 ntot1 = nx1*ny1*nz1*nelv
25 rinit = glsc23(work, binvm1, vmult, ntot1)
26 rinit = sqrt(rinit/volvm1)
34 IF (tolspl < tolmin)
THEN
38 WRITE (6,*)
'Relax the pressure tolerance ',tolspl,tolold
48 use kinds, only : dp, i8, i4
49 use size_m
, only : lx2, ly2, lz2, lelv, nx2, ny2, nz2, nelv
50 use geom, only : ifvcor, ifbcor
51 use input, only : ifldmhd
53 use tstep, only : ifield
56 real(DP) :: respr (lx2,ly2,lz2,lelv)
57 integer(i8) :: ntotg,nxyz2
60 real(DP),
external :: glsum
63 ntot = int(nxyz2*nelv, kind=i4)
68 rlam = glsum(respr,ntot)/ntotg
71 elseif (ifield == ifldmhd)
then
73 rlam = glsum(respr,ntot)/ntotg
77 call
exitti(
'ortho: unaccounted ifield = $',ifield)
88 subroutine opgrad (out1,out2,out3,inp)
90 use size_m
, only : nx2, ny2, nz2, ndim, nelv
91 use size_m
, only : lx1, ly1, lz1, lx2, ly2, lz2, nx1, ny1, nz1
92 use geom, only : rxm2, rym2, rzm2, sxm2, sym2, szm2, txm2, tym2, tzm2
93 use geom, only : bm1, jacmi
94 use input, only : ifsplit, ifaxis
95 use mesh, only : if_ortho
96 use dxyz, only : dxm12, dytm12, dztm12
97 use ixyz, only : ixm12, iytm12, iztm12
100 REAL(DP) :: OUT1 (lx2,ly2,lz2,nelv)
101 REAL(DP) :: OUT2 (lx2,ly2,lz2,nelv)
102 REAL(DP) :: OUT3 (lx2,ly2,lz2,nelv)
103 REAL(DP) :: INP (lx1,ly1,lz1,nelv)
105 real(DP) :: ta1 (lx1*ly1*lz1) &
106 , ta2 (lx1*ly1*lz1) &
109 integer :: iflg, ntot2, i1, i2, e, iz, n1, n2, nxy2, nyz1
112 if (ifsplit .AND. .NOT. ifaxis)
then
113 call
wgradm1(out1,out2,out3,inp,nelv)
117 ntot2 = nx2*ny2*nz2*nelv
125 call
mxm(dxm12,nx2,inp(:,:,:,e),nx1,ta1,nyz1)
129 call
mxm(ta1(i1),nx2,iytm12,ny1,ta2(i2),ny2)
133 call
mxm(ta2,nxy2,iztm12,nz1,out1(:,:,:,e),nz2)
135 call
mxm(ixm12,nx2,inp(:,:,:,e),nx1,ta3,nyz1)
139 call
mxm(ta3(i1),nx2,dytm12,ny1,ta2(i2),ny2)
143 call
mxm(ta2,nxy2,iztm12,nz1,out2(:,:,:,e),nz2)
149 call
mxm(ta3(i1),nx2,iytm12,ny1,ta2(i2),ny2)
153 call
mxm(ta2,nxy2,dztm12,nz1,out3(:,:,:,e),nz2)
156 out1 = out1 * rxm2 * bm1 * jacmi
157 out2 = out2 * sym2 * bm1 * jacmi
158 out3 = out3 * tzm2 * bm1 * jacmi
161 CALL
multd(out1,inp,rxm2,sxm2,txm2,1,iflg)
162 CALL
multd(out2,inp,rym2,sym2,tym2,2,iflg)
164 CALL
multd(out3,inp,rzm2,szm2,tzm2,3,iflg)
173 subroutine cdtp (dtx,x,rm2,sm2,tm2,isd)
175 use size_m
, only : lx1, ly1, lz1, lx2, ly2, lz2, lelv
176 use size_m
, only : nx1, ny1, nz1, nx2, ny2, nz2, nelv, ndim
178 use dxyz, only : dym12, dam12, dcm12, dxtm12, dzm12
179 use geom, only : ifrzer, jacm2, ym2, jacm1
180 use input, only : ifaxis, ifsplit
181 use ixyz, only : iym12, iam12, icm12
182 use geom, only : bm1, bm2
183 use wz_m, only : w3m2, w2am2, w2cm2
187 real(DP) :: dtx (lx1,ly1,lz1,lelv)
188 real(DP) :: x (lx2,ly2,lz2,lelv)
189 real(DP) :: rm2 (lx2,ly2,lz2,lelv)
190 real(DP) :: sm2 (lx2,ly2,lz2,lelv)
191 real(DP) :: tm2 (lx2,ly2,lz2,lelv)
193 real(DP) :: wx (lx1,ly1,lz1) &
194 , ta1 (lx1,ly1,lz1) &
198 integer :: nxyz1, nxyz2, nxy1, nyz2, n1, n2, ny12, i1, i2, iz
201 if (icalld == 0) tcdtp=0.0
222 call
copy(iym12,iam12,ny12)
223 call
copy(dym12,dam12,ny12)
224 call
copy(w3m2,w2am2,nxyz2)
226 call
copy(iym12,icm12,ny12)
227 call
copy(dym12,dcm12,ny12)
228 call
copy(w3m2,w2cm2,nxyz2)
235 wx = bm1(:,:,:,e) * x(:,:,:,e) / jacm1(:,:,:,e)
239 wx = x(:,:,:,e) * bm2(:,:,:,e) / jacm2(:,:,:,e)
241 wx = w3m2 * x(:,:,:,e) * ym2(:,:,:,e)
244 wx = w3m2 * x(:,:,:,e)
249 write(*,*)
"Whoops! cdtp"
251 if ( .NOT. ifdfrm(e) .AND. ifalgn(e))
then
253 if ( ifrsxy(e) .AND. isd == 1 .OR. &
254 .NOT. ifrsxy(e) .AND. isd == 2)
then
256 call col3(ta1,wx,rm2(1,e),nxyz2)
257 call
mxm(dxtm12,nx1,ta1,nx2,ta2,nyz2)
258 call
mxm(ta2,nx1,iym12,ny2,dtx(1,e),ny1)
260 call col3(ta1,wx,sm2(1,e),nxyz2)
261 call
mxm(ixtm12,nx1,ta1,nx2,ta2,nyz2)
262 call
mxm(ta2,nx1,dym12,ny2,dtx(1,e),ny1)
265 call col3(ta1,wx,rm2(1,e),nxyz2)
266 call
mxm(dxtm12,nx1,ta1,nx2,ta2,nyz2)
267 call
mxm(ta2,nx1,iym12,ny2,dtx(1,e),ny1)
269 call col3(ta1,wx,sm2(1,e),nxyz2)
270 call
mxm(ixtm12,nx1,ta1,nx2,ta2,nyz2)
271 call
mxm(ta2,nx1,dym12,ny2,ta1,ny1)
273 call add2(dtx(1,e),ta1,nxyz1)
278 ta1 = wx * rm2(:,:,:,e)
279 call
mxm(dxtm12,nx1,ta1,nx2,dtx(:,:,:,e),nyz2)
280 ta1 = wx * sm2(:,:,:,e)
284 call
mxm(ta1(:,:,iz),nx1,dym12,ny2,ta2(:,:,iz),ny1)
288 dtx(:,:,:,e) = dtx(:,:,:,e) + ta2
289 ta1 = wx * tm2(:,:,:,e)
290 call
mxm(ta1,nxy1,dzm12,nz2,ta2,nz1)
291 dtx(:,:,:,e) = dtx(:,:,:,e) + ta2
293 write(*,*)
"Whoops! cdtp"
295 call col3(ta1,wx,rm2(1,e),nxyz2)
296 call
mxm(dxtm12,nx1,ta1,nx2,ta2,nyz2)
300 call
mxm(ta2(i2),nx1,iym12,ny2,ta1(i1),ny1)
304 call
mxm(ta1,nxy1,izm12,nz2,dtx(1,e),nz1)
306 call col3(ta1,wx,sm2(1,e),nxyz2)
307 call
mxm(ixtm12,nx1,ta1,nx2,ta2,nyz2)
311 call
mxm(ta2(i2),nx1,dym12,ny2,ta1(i1),ny1)
315 call
mxm(ta1,nxy1,izm12,nz2,ta2,nz1)
316 call add2(dtx(1,e),ta2,nxyz1)
318 call col3(ta1,wx,tm2(1,e),nxyz2)
319 call
mxm(ixtm12,nx1,ta1,nx2,ta2,nyz2)
323 call
mxm(ta2(i2),nx1,iym12,ny2,ta1(i1),ny1)
327 call
mxm(ta1,nxy1,dzm12,nz2,ta2,nz1)
328 call add2(dtx(1,e),ta2,nxyz1)
337 if (ifaxis)
write(*,*)
"Oops: ifaxis"
341 if (ifaxis .AND. (isd == 4))
then
342 call
copy(ta1,x(1,e),nxyz1)
345 call
mxm(x(1,e),nx1,datm1,ny1,duax,1)
346 call
copy(ta1,duax,nx1)
348 call col2(ta1,baxm1(1,1,1,e),nxyz1)
349 call add2(dtx(1,e),ta1,nxyz1)
354 if (ifaxis .AND. (isd == 2))
then
355 call col3(ta1,x(1,e),bm2(1,1,1,e),nxyz2)
356 ta = ta / ym2(:,:,:,e)
357 call
mxm(ixtm12,nx1,ta1,nx2,ta2,ny2)
358 call
mxm(ta2,nx1,iym12,ny2,ta1,ny1)
359 call add2(dtx(1,e),ta1,nxyz1)
382 subroutine multd (dx,x,rm2,sm2,tm2,isd,iflg)
384 use size_m
, only : lx2, ly2, lz2, lx1, ly1, lz1, lelv
385 use size_m
, only : nx1, ny1, nz1, nx2, ny2, nz2, nelv, ndim
387 use dxyz, only : dytm12, datm12, dctm12, dxm12, dztm12
388 use geom, only : ifrzer, jacm1
389 use input, only : ifaxis, ifsplit
390 use ixyz, only : iytm12, iatm12, ictm12, iztm12, ixm12
392 use wz_m, only : w3m2, w2am2, w2cm2
396 real(DP) :: dx (lx2,ly2,lz2,lelv)
397 real(DP) :: x (lx1,ly1,lz1,lelv)
398 real(DP) :: rm2 (lx2,ly2,lz2,lelv)
399 real(DP) :: sm2 (lx2,ly2,lz2,lelv)
400 real(DP) :: tm2 (lx2,ly2,lz2,lelv)
402 real(DP) :: ta1 (lx1*ly1*lz1) &
403 , ta2 (lx1*ly1*lz1) &
407 integer :: nxyz1, nxy2, nxyz2, n1, n2, ny12, i1, i2, iz, nyz1
410 if (icalld == 0) tmltd=0.0
431 call
copy(iytm12,iatm12,ny12)
432 call
copy(dytm12,datm12,ny12)
433 call
copy(w3m2,w2am2,nxyz2)
435 call
copy(iytm12,ictm12,ny12)
436 call
copy(dytm12,dctm12,ny12)
437 call
copy(w3m2,w2cm2,nxyz2)
442 write(*,*)
"Whoops! multd"
444 if ( .NOT. ifdfrm(e) .AND. ifalgn(e))
then
446 if ( ifrsxy(e) .AND. isd == 1 .OR. &
447 .NOT. ifrsxy(e) .AND. isd == 2)
then
448 call
mxm(dxm12,nx2,x(1,e),nx1,ta1,nyz1)
449 call
mxm(ta1,nx2,iytm12,ny1,dx(1,e),ny2)
450 call col2(dx(1,e),rm2(1,e),nxyz2)
452 call
mxm(ixm12,nx2,x(1,e),nx1,ta1,nyz1)
453 call
mxm(ta1,nx2,dytm12,ny1,dx(1,e),ny2)
454 call col2(dx(1,e),sm2(1,e),nxyz2)
457 call
mxm(dxm12,nx2,x(1,e),nx1,ta1,nyz1)
458 call
mxm(ta1,nx2,iytm12,ny1,dx(1,e),ny2)
459 call col2(dx(1,e),rm2(1,e),nxyz2)
460 call
mxm(ixm12,nx2,x(1,e),nx1,ta1,nyz1)
461 call
mxm(ta1,nx2,dytm12,ny1,ta3,ny2)
462 call addcol3(dx(1,e),ta3,sm2(1,e),nxyz2)
484 call
mxm(dxm12,nx2,x(:,:,:,e),nx1,ta1,nyz1)
488 call
mxm(ta1(i1),nx2,iytm12,ny1,ta2(i2),ny2)
492 call
mxm(ta2,nxy2,iztm12,nz1,dx(:,:,:,e),nz2)
493 dx(:,:,:,e) = dx(:,:,:,e) * rm2(:,:,:,e)
495 call
mxm(ixm12,nx2,x(:,:,:,e),nx1,ta3,nyz1)
499 call
mxm(ta3(i1),nx2,dytm12,ny1,ta2(i2),ny2)
503 call
mxm(ta2,nxy2,iztm12,nz1,ta1,nz2)
504 dx(:,:,:,e) = dx(:,:,:,e) + reshape(ta1,(/lx2,ly2,lz2/)) * sm2(:,:,:,e)
510 call
mxm(ta3(i1),nx2,iytm12,ny1,ta2(i2),ny2)
514 call
mxm(ta2,nxy2,dztm12,nz1,ta3,nz2)
515 dx(:,:,:,e) = dx(:,:,:,e) + reshape(ta3,(/lx2,ly2,lz2/)) * tm2(:,:,:,e)
523 dx(:,:,:,e) = dx(:,:,:,e) * bm1(:,:,:,e)
524 dx(:,:,:,e) = dx(:,:,:,e) / jacm1(:,:,:,e)
526 write(*,*)
"Whoops! multd"
528 if ( .NOT. ifaxis) call col2(dx(1,e),w3m2,nxyz2)
531 call col2(dx(1,e),bm2(1,1,1,e),nxyz2)
532 dx(:,e) = dx(:,e) / reshape(jacm2(:,:,:,e), (/nxyz2/))
534 call col2(dx(1,e),w3m2,nxyz2)
535 call col2(dx(1,e),ym2(1,1,1,e),nxyz2)
547 if (ifaxis .AND. (isd == 2) .AND. iflg == 1)
then
548 write(*,*)
"Whoops! multd"
550 call
copy(ta3,x(1,e),nxyz1)
553 call
mxm(x(1,e),nx1,datm1,ny1,duax,1)
554 call
copy(ta3,duax,nx1)
556 call col2(ta3,baxm1(1,1,1,e),nxyz1)
557 call add2(dx(1,e),ta3,nxyz2)
562 write(*,*)
"Whoops! multd"
564 if (ifaxis .AND. (isd == 2))
then
565 call
mxm(ixm12,nx2,x(1,e),nx1,ta1,ny1)
566 call
mxm(ta1,nx2,iytm12,ny1,ta2,ny2)
567 call col3(ta3,bm2(1,1,1,e),ta2,nxyz2)
568 call invcol2(ta3,ym2(1,1,1,e),nxyz2)
569 call add2(dx(1,e),ta3,nxyz2)
585 subroutine ophx (out1,out2,out3,inp1,inp2,inp3,h1,h2)
587 use size_m
, only : lx1, ly1, lz1, ndim
588 use input, only : ifstrs
591 REAL(DP) :: OUT1 (lx1,ly1,lz1,1)
592 REAL(DP) :: OUT2 (lx1,ly1,lz1,1)
593 REAL(DP) :: OUT3 (lx1,ly1,lz1,1)
594 REAL(DP) :: INP1 (lx1,ly1,lz1,1)
595 REAL(DP) :: INP2 (lx1,ly1,lz1,1)
596 REAL(DP) :: INP3 (lx1,ly1,lz1,1)
597 REAL(DP) :: H1 (lx1,ly1,lz1,1)
598 REAL(DP) :: H2 (lx1,ly1,lz1,1)
606 CALL axhmsf(out1,out2,out3,inp1,inp2,inp3,h1,h2,matmod)
609 CALL
axhelm(out1,inp1,h1,h2,imesh,1)
610 CALL
axhelm(out2,inp2,h1,h2,imesh,2)
612 CALL
axhelm(out3,inp3,h1,h2,imesh,3)
628 subroutine dudxyz (du,u,rm1,sm1,tm1,jm1,imsh,isd)
630 use size_m
, only : lx1, ly1, lz1
631 use size_m
, only : nx1, ny1, nz1, nelv, nelt, ndim
632 use dxyz, only : dxm1, dytm1, dztm1
633 use geom, only : jacmi
637 REAL(DP) :: DU (lx1,ly1,lz1,*)
638 REAL(DP) :: U (lx1,ly1,lz1,*)
639 REAL(DP) :: RM1 (lx1,ly1,lz1,*)
640 REAL(DP) :: SM1 (lx1,ly1,lz1,*)
641 REAL(DP) :: TM1 (lx1,ly1,lz1,*)
642 REAL(DP) :: JM1 (lx1,ly1,lz1,*)
644 REAL(DP) :: DRST(lx1,ly1,lz1)
645 integer :: nel, nxy1, nyz1, nxyz1, ntot, iel, iz
648 IF (imsh == 1) nel = nelv
649 IF (imsh == 2) nel = nelt
661 CALL
mxm(dxm1,nx1,u(1,1,1,iel),nx1,du(1,1,1,iel),nyz1)
662 du(:,:,:,iel) = du(:,:,:,iel) * rm1(:,:,:,iel)
663 CALL
mxm(u(1,1,1,iel),nx1,dytm1,ny1,drst,ny1)
664 du(:,:,:,iel) = du(:,:,:,iel) + drst * sm1(:,:,:,iel)
666 CALL
mxm(dxm1,nx1,u(1,1,1,iel),nx1,du(1,1,1,iel),nyz1)
667 du(:,:,:,iel) = du(:,:,:,iel) * rm1(:,:,:,iel)
669 CALL
mxm(u(1,1,iz,iel),nx1,dytm1,ny1,drst(1,1,iz),ny1)
671 du(:,:,:,iel) = du(:,:,:,iel) + drst * sm1(:,:,:,iel)
672 CALL
mxm(u(1,1,1,iel),nxy1,dztm1,nz1,drst,nz1)
673 du(:,:,:,iel) = du(:,:,:,iel) + drst * tm1(:,:,:,iel)
679 du(:,:,:,1:nel) = du(:,:,:,1:nel) * jacmi
693 use input, only : ifnav, ifchar, iftran
704 if (ifnav .AND. ( .NOT. ifchar)) call
advab
710 if ((iftran .AND. .NOT. ifchar) .OR. &
711 (iftran .AND. .NOT. ifnav .AND. ifchar)) call
makebdf
714 if (ifmodel) call twallsh
724 use size_m
, only : nelv
726 use soln, only : bfx, bfy, bfz
727 use tstep, only : time, dt
732 CALL
nekuf(bfx,bfy,bfz)
734 bfx(:,:,:,i) = bfx(:,:,:,i) * bm1(:,:,:,i)
735 bfy(:,:,:,i) = bfy(:,:,:,i) * bm1(:,:,:,i)
736 bfz(:,:,:,i) = bfz(:,:,:,i) * bm1(:,:,:,i)
745 use size_m
, only : lx1, ly1, lz1, lelv, nx1, ny1, nz1, nelv
746 use nekuse, only : ffx, ffy, ffz
750 REAL(DP) :: F1 (lx1,ly1,lz1,lelv)
751 REAL(DP) :: F2 (lx1,ly1,lz1,lelv)
752 REAL(DP) :: F3 (lx1,ly1,lz1,lelv)
754 integer :: i, j, k, ielg, iel
755 f1 = 0._dp; f2 = 0._dp; f3=0._dp
762 CALL userf(i,j,k,ielg)
780 use size_m
, only : nx1, ny1, nz1, nelv, ndim
782 use soln, only : vx, vy, vz, bfx, bfy, bfz
785 real(DP),
allocatable:: TA (:,:,:,:)
789 allocate(ta(nx1,ny1,nz1,nelv))
790 ntot1 = nx1*ny1*nz1*nelv
807 use size_m
, only : nx1, ny1, nz1, nelv
808 use geom, only : ifgeom
809 use geom, only : bm1, bm1lag
810 use soln, only : vx, vy, vz, vxlag, vylag, vzlag, bfx, bfy, bfz
811 use soln, only : vtrans
812 use tstep, only : dt, ifield, bd, nbd
815 real(DP),
allocatable :: H2 (:,:,:)
819 allocate(h2(nx1,ny1,nz1))
822 h2 = (1./dt) * vtrans(:,:,:,i,ifield)
825 bfx(:,:,:,i) = bfx(:,:,:,i) + h2 * (vxlag(:,:,:,i,ilag-1) * bm1lag(:,:,:,i,ilag-1) * bd(ilag+1))
826 bfy(:,:,:,i) = bfy(:,:,:,i) + h2 * (vylag(:,:,:,i,ilag-1) * bm1lag(:,:,:,i,ilag-1) * bd(ilag+1))
827 bfz(:,:,:,i) = bfz(:,:,:,i) + h2 * (vzlag(:,:,:,i,ilag-1) * bm1lag(:,:,:,i,ilag-1) * bd(ilag+1))
829 bfx(:,:,:,i) = bfx(:,:,:,i) + h2 * (vxlag(:,:,:,i,ilag-1) * bm1(:,:,:,i) * bd(ilag+1))
830 bfy(:,:,:,i) = bfy(:,:,:,i) + h2 * (vylag(:,:,:,i,ilag-1) * bm1(:,:,:,i) * bd(ilag+1))
831 bfz(:,:,:,i) = bfz(:,:,:,i) + h2 * (vzlag(:,:,:,i,ilag-1) * bm1(:,:,:,i) * bd(ilag+1))
834 bfx(:,:,:,i) = bfx(:,:,:,i) + h2*vx(:,:,:,i)*bm1(:,:,:,i)*bd(2)
835 bfy(:,:,:,i) = bfy(:,:,:,i) + h2*vy(:,:,:,i)*bm1(:,:,:,i)*bd(2)
836 bfz(:,:,:,i) = bfz(:,:,:,i) + h2*vz(:,:,:,i)*bm1(:,:,:,i)*bd(2)
849 use size_m
, only : nx1, ny1, nz1, nelv, ndim
850 use soln, only : abx1, aby1, abz1, abx2, aby2, abz2, bfx, bfy, bfz, vtrans
854 real(DP),
allocatable :: TA (:,:,:,:)
856 integer :: ntot1, iel
857 real(DP) :: ab0, ab1, ab2
859 allocate(ta(nx1,ny1,nz1,nelv))
861 ntot1 = nx1*ny1*nz1*nelv
870 ta = ab1 * abx1 + ab2 * abx2
871 CALL
copy(abx2,abx1,ntot1)
872 CALL
copy(abx1,bfx,ntot1)
873 bfx = (ab0 * bfx + ta) * vtrans(:,:,:,:,1)
875 ta = ab1 * aby1 + ab2 * aby2
876 CALL
copy(aby2,aby1,ntot1)
877 CALL
copy(aby1,bfy,ntot1)
878 bfy = (ab0 * bfy + ta) * vtrans(:,:,:,:,1)
881 ta = ab1 * abz1 + ab2 * abz2
882 CALL
copy(abz2,abz1,ntot1)
883 CALL
copy(abz1,bfz,ntot1)
884 bfz = (ab0 * bfz + ta) * vtrans(:,:,:,:,1)
890 ta(:,:,:,1) = ab1 * abx1(:,:,:,iel) + ab2 * abx2(:,:,:,iel)
891 abx2(:,:,:,iel) = abx1(:,:,:,iel)
892 abx1(:,:,:,iel) = bfx(:,:,:,iel)
893 bfx(:,:,:,iel) = (ab0*bfx(:,:,:,iel) + ta(:,:,:,1)) * vtrans(:,:,:,iel,1)
897 ta(:,:,:,1) = ab1 * aby1(:,:,:,iel) + ab2 * aby2(:,:,:,iel)
898 aby2(:,:,:,iel) = aby1(:,:,:,iel)
899 aby1(:,:,:,iel) = bfy(:,:,:,iel)
900 bfy(:,:,:,iel) = (ab0*bfy(:,:,:,iel) + ta(:,:,:,1)) * vtrans(:,:,:,iel,1)
904 ta(:,:,:,1) = ab1 * abz1(:,:,:,iel) + ab2 * abz2(:,:,:,iel)
905 abz2(:,:,:,iel) = abz1(:,:,:,iel)
906 abz1(:,:,:,iel) = bfz(:,:,:,iel)
907 bfz(:,:,:,iel) = (ab0*bfz(:,:,:,iel) + ta(:,:,:,1)) * vtrans(:,:,:,iel,1)
926 REAL(DP),
intent(out) :: AB(nab) !>
927 real(DP),
intent(in) :: DTLAG(nbd) !>
928 integer,
intent(in) :: nab !>
929 integer,
intent(in) :: nbd !>
931 real(DP) :: dt0, dt1, dt2, dta, dts, dtb, dtc, dtd, dte
937 ELSEIF ( nab == 2 )
THEN
948 ELSEIF ( nbd == 2 )
THEN
955 ELSEIF ( nab == 3 )
THEN
969 ab(3) = dte*( 0.5*dtb + dtc/3. )
970 ab(2) = -0.5*dta - ab(3)*dtd
971 ab(1) = 1.0 - ab(2) - ab(3)
973 ELSEIF ( nbd == 2 )
THEN
975 ab(3) = 2./3.*dtc*(1./dtd + dte)
976 ab(2) = -dta - ab(3)*dtd
977 ab(1) = 1.0 - ab(2) - ab(3)
979 ELSEIF ( nbd == 3 )
THEN
981 ab(3) = dte*(dtb + dtc)
982 ab(2) = -dta*(1.0 + dtb + dtc)
983 ab(1) = 1.0 - ab(2) - ab(3)
999 REAL(dp),
intent(out) :: BD(*) !>
1000 real(dp),
intent(in) :: DTBD(*) !>
1001 integer ,
intent(in) :: nbd !>
1003 integer,
PARAMETER :: NDIM = 10
1004 REAL(DP) :: BDMAT(ndim,ndim),BDRHS(ndim), BDF
1005 INTEGER :: IR(ndim),IC(ndim)
1006 integer :: nsys, i, ibd
1008 bd(1:ndim) = 0._dp; bdf = -1
1014 ELSEIF (nbd >= 2)
THEN
1016 CALL
bdsys(bdmat,bdrhs,dtbd,nbd,ndim)
1017 CALL
lu(bdmat,nsys,ndim,ir,ic)
1018 CALL
solve(bdrhs,bdmat,1,nsys,ndim,ir,ic)
1031 bd(ibd) = bd(ibd)/bdf
1037 end subroutine setbd
1041 use kinds, only : dp
1044 integer :: nbd, ndim
1045 REAL(DP) :: A(ndim,9),B(9),DT(9)
1047 integer :: n, j, k, i
1071 a(i,j) = sumdt**(i-1)
1077 end subroutine bdsys
1083 use kinds, only : dp
1084 use tstep, only : nbd, dtlag
1092 DO 10 i=nbd,ilag+1,-1
1102 use size_m
, only : nx1, ny1, nz1, nelv, ndim
1103 use soln, only : vxlag, vylag, vzlag, vx, vy, vz
1106 integer :: ntot1, ilag
1107 ntot1 = nx1*ny1*nz1*nelv
1110 DO 100 ilag=3-1,2,-1
1111 CALL
copy(vxlag(1,1,1,1,ilag),vxlag(1,1,1,1,ilag-1),ntot1)
1112 CALL
copy(vylag(1,1,1,1,ilag),vylag(1,1,1,1,ilag-1),ntot1)
1114 CALL
copy(vzlag(1,1,1,1,ilag),vzlag(1,1,1,1,ilag-1),ntot1)
1117 CALL
opcopy(vxlag,vylag,vzlag,vx,vy,vz)
1126 use tstep, only : nbdinp, nbd, istep
1130 IF ( nbdinp < 1)
THEN
1133 IF ((istep == 0) .OR. (istep == 1)) nbd = 1
1134 IF ((istep > 1) .AND. (istep <= nbdinp)) nbd = istep
1135 IF (istep > nbdinp) nbd = nbdinp
1151 use kinds, only : dp
1152 use size_m
, only : lx1, ly1, lz1, lelt
1153 use size_m
, only : nx1, ny1, nz1, nelv, nelt, ndim
1154 use geom, only : bm1, voltm1, volvm1
1158 real(DP) :: h1, semi, l2, linf
1159 real(DP),
intent(in) :: X (lx1,ly1,lz1,*)
1162 real(DP),
allocatable,
dimension(:,:,:,:) :: y, ta1, ta2
1163 REAL(DP) :: LENGTH, vol
1164 integer :: nel, nxyz1, ntot1
1165 real(DP),
external :: glamax, glsum
1171 allocate(y(lx1,ly1,lz1,lelt), ta1(lx1,ly1,lz1,lelt), ta2(lx1,ly1,lz1,lelt))
1173 IF (imesh == 1)
THEN
1176 ELSEIF (imesh == 2)
THEN
1182 write(*,*)
"IMESH \notin {1,2}"
1185 length = vol**(1./(ndim))
1194 linf = glamax(x,ntot1)
1196 ta1 = x(:,:,:,1:nel)*x(:,:,:,1:nel) * bm1
1197 l2 = glsum(ta1,ntot1)
1198 IF (l2 < 0.0) l2 = 0.
1200 ta1 = 1._dp; ta2 = 0._dp
1202 CALL
axhelm(y,x,ta1,ta2,imesh,1)
1204 ta1 = y * x(:,:,:,1:nel)
1205 semi = glsum(ta1,ntot1)
1206 IF (semi < 0.0) semi = 0.
1208 h1 = sqrt((semi*length**2+l2)/vol)
1209 semi = sqrt(semi/vol)
1211 IF (h1 < 0.) h1 = 0.
1224 use kinds, only : dp
1225 use size_m
, only : nx1, ny1, nz1, nelv, ndim
1226 use size_m
, only : lx1, ly1, lz1, lelt
1227 use geom, only : volvm1, bm1
1231 REAL(DP) :: H1,SEMI,L2,LINF
1232 REAL(DP) :: X1 (lx1,ly1,lz1,lelt)
1233 REAL(DP) :: X2 (lx1,ly1,lz1,lelt)
1234 REAL(DP) :: X3 (lx1,ly1,lz1,lelt)
1236 real(DP),
allocatable,
dimension(:,:,:,:) :: Y1, Y2, Y3, TA1, TA2
1238 integer :: imesh, nel, nxyz1, ntot1
1240 real(DP),
external :: glamax, glsum
1249 length = vol**(1./(ndim))
1258 allocate(y1(lx1,ly1,lz1,lelt) &
1259 ,y2(lx1,ly1,lz1,lelt) &
1260 ,y3(lx1,ly1,lz1,lelt) &
1261 ,ta1(lx1,ly1,lz1,lelt) &
1262 ,ta2(lx1,ly1,lz1,lelt) )
1266 ta1 = x1*x1 + x2*x2 + x3*x3
1270 linf = glamax(ta1,ntot1)
1274 l2 = glsum(ta1,ntot1)
1275 IF (l2 < 0.0) l2 = 0.
1277 ta1 = 1._dp; ta2 = 0._dp
1279 CALL
ophx(y1,y2,y3,x1,x2,x3,ta1,ta2)
1282 ta1 = y1*x1 + y2*x2 + y3*x3
1287 semi = glsum(ta1,ntot1)
1288 IF (semi < 0.0) semi = 0.
1290 h1 = sqrt((semi*length**2+l2)/vol)
1291 semi = sqrt(semi/vol)
1293 IF (h1 < 0.) h1 = 0.
1301 use kinds, only : dp
1302 use size_m
, only : nx1, ny1, nz1, nelv, ndim
1303 use opctr, only : isclld, nrout, myrout, rname, dct, ncall, dcount
1305 REAL(DP) :: A1(1),A2(1),A3(1),C(1)
1306 integer :: ntot1, i, isbcnt
1308 ntot1=nx1*ny1*nz1*nelv
1311 if (isclld == 0)
then
1315 rname(myrout) =
'opcolv'
1319 dct(myrout) = dct(myrout) + (isbcnt)
1320 ncall(myrout) = ncall(myrout) + 1
1321 dcount = dcount + (isbcnt)
1340 use kinds, only : dp
1343 REAL(DP) :: A1(1),A2(1),A3(1),B1(1),B2(1),B3(1)
1345 ntot1=nx1*ny1*nz1*nelv
1346 CALL
copy(a1,b1,ntot1)
1347 CALL
copy(a2,b2,ntot1)
1348 IF(ndim == 3)CALL
copy(a3,b3,ntot1)
1353 subroutine opdssum (a,b,c)! NOTE: opdssum works on FLUID/MHD arrays only!
1354 use kinds, only : dp
1355 use input, only : ifcyclic
1358 real(DP) :: a(1),b(1),c(1)
1361 write(*,*)
"Oops: ifcyclic"
1363 call rotate_cyc(a,b,c,1)
1365 call rotate_cyc(a,b,c,0)
1375 subroutine opdsop (a,b,c,op)! opdsop works on FLUID/MHD arrays only!
1376 use kinds, only : dp
1377 use input, only : ifcyclic
1380 real(DP) :: a(1),b(1),c(1)
1384 if (op ==
'* ' .OR. op ==
'mul' .OR. op ==
'MUL')
then
1387 write(*,*)
"Oops: op"
1389 call rotate_cyc(a,b,c,1)
1390 call
vec_dsop(a,b,c,nx1,ny1,nz1,op)
1391 call rotate_cyc(a,b,c,0)
1403 use kinds, only : dp
1406 real(DP) :: a(lda,*),b(ldb,*)
1423 use kinds, only : dp
1425 use size_m
, only : lx1, ly1, lz1
1426 use size_m
, only : nx1, ny1, nz1, nelv
1427 use dealias, only : vxd, vyd, vzd
1428 use input, only : param, ifpert
1429 use geom, only : bm1
1430 use soln, only : vx, vy, vz
1431 use tstep, only : nelfld, ifield
1435 REAL(DP) :: CONV (lx1,ly1,lz1,*)
1436 REAL(DP) :: FI (lx1,ly1,lz1,*)
1438 integer :: nxyz1, ntot1, ntotz
1446 ntot1 = nx1*ny1*nz1*nelv
1447 ntotz = nx1*ny1*nz1*nelfld(ifield)
1449 conv(:,:,:,1:nelfld(ifield)) = 0._dp
1451 if (param(86) /= 0.0)
then
1460 if (param(99) == 2 .OR. param(99) == 3)
then
1462 elseif (param(99) == 4)
then
1465 call
convect_new(conv,fi, .false. ,vx,vy,vz, .false. )
1469 call
convect_new(conv,fi, .false. ,vxd,vyd,vzd, .true. )
1472 conv(:,:,:,1:nelv) = conv(:,:,:,1:nelv) / bm1
1473 elseif (param(99) == 5)
then
1475 conv(:,:,:,1:nelv) = conv(:,:,:,1:nelv) / bm1
1494 use kinds, only : dp
1495 use size_m
, only : lx1, ly1, lz1, lx2, ly2, lz2, lelv
1496 use size_m
, only : nx2, ny2, nz2, nelv, ndim, nx1, ny1, nz1
1497 use geom, only : rxm2, rym2, rzm2, sxm2, sym2, szm2, txm2, tym2, tzm2
1498 use mesh, only : if_ortho
1499 use geom, only : bm1, jacmi
1500 use dxyz, only : dxm12, dytm12, dztm12
1501 use ixyz, only : ixm12, iytm12, iztm12
1505 real(DP) :: outfld (lx2,ly2,lz2,nelv)
1506 real(DP) :: inpx (lx1,ly1,lz1,nelv)
1507 real(DP) :: inpy (lx1,ly1,lz1,nelv)
1508 real(DP) :: inpz (lx1,ly1,lz1,nelv)
1510 real(DP),
allocatable :: work (:,:,:,:)
1512 real(DP) :: ta1 (lx1*ly1*lz1) &
1513 , ta2 (lx1*ly1*lz1) &
1515 integer :: iflg, ntot2, i1, i2, e, iz, n1, n2, nxy2, nyz1
1517 allocate(work(lx2,ly2,lz2,lelv))
1521 ntot2 = nx2*ny2*nz2*nelv
1528 call
mxm(dxm12,nx2,inpx(:,:,:,e),nx1,ta1,nyz1)
1532 call
mxm(ta1(i1),nx2,iytm12,ny1,ta2(i2),ny2)
1536 call
mxm(ta2,nxy2,iztm12,nz1,outfld(:,:,:,e),nz2)
1537 outfld(:,:,:,e) = outfld(:,:,:,e) * rxm2(:,:,:,e)
1539 call
mxm(ixm12,nx2,inpy(:,:,:,e),nx1,ta3,nyz1)
1543 call
mxm(ta3(i1),nx2,dytm12,ny1,ta2(i2),ny2)
1547 call
mxm(ta2,nxy2,iztm12,nz1,ta1,nz2)
1548 outfld(:,:,:,e) = outfld(:,:,:,e) + reshape(ta1,(/lx2,ly2,lz2/)) * sym2(:,:,:,e)
1550 call
mxm(ixm12,nx2,inpz(:,:,:,e),nx1,ta1,nyz1)
1554 call
mxm(ta3(i1),nx2,iytm12,ny1,ta2(i2),ny2)
1558 call
mxm(ta2,nxy2,dztm12,nz1,ta3,nz2)
1559 outfld(:,:,:,e) = outfld(:,:,:,e) + reshape(ta3,(/lx2,ly2,lz2/)) * tzm2(:,:,:,e)
1561 outfld = outfld * bm1 * jacmi
1564 call
multd(work,inpx,rxm2,sxm2,txm2,1,iflg)
1565 call
copy(outfld,work,ntot2)
1566 call
multd(work,inpy,rym2,sym2,tym2,2,iflg)
1567 outfld = outfld + work
1569 call
multd(work,inpz,rzm2,szm2,tzm2,3,iflg)
1570 outfld = outfld + work
1575 end subroutine opdiv
1579 subroutine wgradm1(ux,uy,uz,u,nel) ! weak form of grad
1580 use kinds, only : dp
1581 use size_m
, only : lx1, ly1, lz1, nx1
1582 use dxyz, only : dxm1, dxtm1
1583 use geom, only : rxm1, sxm1, txm1, rym1, sym1, tym1, rzm1, szm1, tzm1
1584 use input, only : if3d
1585 use wz_m, only : w3m1
1586 use mesh, only : if_ortho
1589 integer,
parameter :: lxyz=lx1*ly1*lz1
1590 real(DP) :: ux(lx1,ly1,lz1,*),uy(lx1,ly1,lz1,*),uz(lx1,ly1,lz1,*),u(lxyz,*)
1592 real(DP) :: ur(lx1,ly1,lz1),us(lx1,ly1,lz1),ut(lx1,ly1,lz1)
1594 integer :: e, n, nel
1601 ux(:,:,:,e) = w3m1*(ur*rxm1(:,:,:,e))
1602 uy(:,:,:,e) = w3m1*(us*sym1(:,:,:,e))
1603 uz(:,:,:,e) = w3m1*(ut*tzm1(:,:,:,e))
1605 ux(:,:,:,e) = w3m1*(ur*rxm1(:,:,:,e) + us*sxm1(:,:,:,e) + ut*txm1(:,:,:,e))
1606 uy(:,:,:,e) = w3m1*(ur*rym1(:,:,:,e) + us*sym1(:,:,:,e) + ut*tym1(:,:,:,e))
1607 uz(:,:,:,e) = w3m1*(ur*rzm1(:,:,:,e) + us*szm1(:,:,:,e) + ut*tzm1(:,:,:,e))
1612 call setaxdy(ifrzer(e))
1613 call setaxw1(ifrzer(e))
1616 call local_grad2(ur,us,u,n,e,dxm1,dytm1)
1619 ux(
i,e) =w3m1(
i,1,1)*(ur(
i)*rxm1(
i,1,1,e) &
1620 + us(
i)*sxm1(
i,1,1,e) )
1621 uy(
i,e) =w3m1(
i,1,1)*(ur(
i)*rym1(
i,1,1,e) &
1622 + us(
i)*sym1(
i,1,1,e) )
1635 use kinds, only : dp
1636 use size_m
, only : lx1, ly1, lz1, lelt, nx1, ny1, nz1
1637 use input, only : iftmsh
1638 use tstep, only : ifield, nelfld, imesh
1641 real(DP) :: out(lx1,ly1,lz1,*),a(*),diff(*)
1642 real(DP),
allocatable :: wrk(:,:,:,:)
1643 real(DP),
allocatable :: h2(:,:,:,:)
1646 integer :: ntot, ifield_
1648 ntot = nx1*ny1*nz1*nelfld(ifld)
1649 if ( .NOT. iftmsh(ifld)) imesh = 1
1650 if ( iftmsh(ifld)) imesh = 2
1653 allocate(wrk(nx1,ny1,nz1,nelfld(ifld)), h2(lx1,ly1,lz1,lelt))
1660 call
axhelm(wrk,a,diff,h2,imesh,1)
1661 out(:,:,:,1:nelfld(ifld)) = out(:,:,:,1:nelfld(ifld)) - wrk
subroutine ophx(out1, out2, out3, inp1, inp2, inp3, h1, h2)
OUT = (H1*A+H2*B) * INP.
subroutine dssum(u)
Direct stiffness sum.
subroutine ctolspl(tolspl, respr)
Compute the pressure tolerance.
subroutine lu(A, N, NDIM, IR, IC)
the first subroutine to compute the matrix inverse
subroutine transpose(a, lda, b, ldb)
subroutine wgradm1(ux, uy, uz, u, nel)
Compute gradient of T – mesh 1 to mesh 1 (vel. to vel.)
subroutine bcneusc(S, ITYPE)
Apply Neumann boundary conditions to surface of scalar, S. Use IFIELD as a guide to which boundary co...
subroutine nekuf(f1, f2, f3)
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 makeabf
Sum up contributions to kth order extrapolation scheme. NOTE: rho^{n+1} should multiply all the Sum_q...
subroutine opcopy(a1, a2, a3, b1, b2, b3)
subroutine vec_dsop(u, v, w, op)
Direct stiffness summation of the face data, for field U. Boundary condition data corresponds to comp...
subroutine advab()
Eulerian scheme, add convection term to forcing function at current time step.
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 opdsop(a, b, c, op)
subroutine local_grad3(ur, us, ut, u, N, e, D, Dt)
Output: ur,us,ut Input:u,N,e,D,Dt.
subroutine ortho(respr)
Orthogonalize the residual in the pressure solver with respect to (1,1,...,1)T (only if all Dirichlet...
subroutine normsc(h1, semi, l2, linf, x, imesh)
Compute error norms of a (scalar) field variable X defined on mesh 1 or mesh 2. The error norms are n...
subroutine wlaplacian(out, a, diff, ifld)
compute weak form of the laplacian operator including the boundary contribution
subroutine tauinit(tau, ilag)
Set initial time for subintegration.
subroutine makeuf
Compute and add: (1) user specified forcing function (FX,FY,FZ)
subroutine opcolv(a1, a2, a3, c)
real(dp) function dnekclock()
integer function lglel(iel)
subroutine setabbd(ab, dtlag, nab, nbd)
Compute Adams-Bashforth coefficients (order NAB, less or equal to 3). NBD .EQ. 1 Standard Adams-Bashf...
subroutine convect_new(bdu, u, ifuf, cx, cy, cz, ifcf)
Compute dealiased form: J^T Bf *JC .grad Ju w/ correct Jacobians.
subroutine multd(dx, x, rm2, sm2, tm2, isd, iflg)
Compute D*X . X : input variable, defined on M1 DX : output variable, defined on M2 (note: D is recta...
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 solve(F, A, K, N, NDIM, IR, IC)
second part of the matrix inverse
subroutine setbd(bd, dtbd, nbd)
Compute backwards-difference (BDF) coefficients, order NBD.
subroutine setordbd
Set up parameters for backward differentiation scheme.
subroutine nekasgn(IX, IY, IZ, IEL)
Assign NEKTON variables for definition (by user) of boundary conditions at collocation point (IX...
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 vec_dssum(u, v, w)
Direct stiffness summation of the face data, for field U.
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 convop(conv, fi)
Compute the convective term CONV for a passive scalar field FI.
subroutine normvc(h1, semi, l2, linf, x1, x2, x3)
Compute error norms of a (vector) field variable (X1,X2,X3)
subroutine makebdf()
Add contributions to F from lagged BD terms.
subroutine exitti(stringi, idata)
subroutine bdsys(a, b, dt, nbd, ndim)
Setup the linear system that defines BDF coefficients.
subroutine lagvel
Keep old velocity field(s)