Nek5000
SEM for Incompressible NS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
plan4.F90
Go to the documentation of this file.
1 
7 
8 !-----------------------------------------------------------------------
14 subroutine plan4()
15  use kinds, only : dp
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
20  use ctimer, only : icalld, tpres, npres, etime1, dnekclock
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
28  implicit none
29 
30  integer, parameter :: ktot = lx1*ly1*lz1*lelt
31  integer :: laxt, v_proj_size
32 
33  type(approx_space), save :: p_apx, vx_apx, vy_apx, vz_apx
34 
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 (:,:,:,:)
42 
43  real(DP), allocatable :: h1(:,:,:,:), h2(:,:,:,:)
44  real(DP), allocatable :: VEXT(:,:)
45  REAL(DP), allocatable :: DPR(:,:,:,:)
46 
47  REAL(DP), allocatable :: DVC (:,:,:,:), DFC(:,:,:,:)
48  REAL(DP) :: DIV1, DIV2, DIF1, DIF2, QTL1, QTL2
49  real(DP) :: tolspl
50  real(DP) :: etime
51  real(DP), external :: glsum
52 
53  integer :: intype, ntot1
54 
55  etime = dnekclock()
56  np4misc = np4misc + 1
57  v_proj_size = int(param(92))
58  laxt = int(param(93))
59 
60  if (.not. allocated(p_apx%projectors)) then
61  call init_approx_space(p_apx, laxt, ktot)
62  endif
63  if (.not. allocated(vx_apx%projectors)) then
64  call init_approx_space(vx_apx, v_proj_size, ktot)
65  endif
66  if (.not. allocated(vy_apx%projectors)) then
67  call init_approx_space(vy_apx, v_proj_size, ktot)
68  endif
69  if (.not. allocated(vz_apx%projectors)) then
70  call init_approx_space(vz_apx, v_proj_size, ktot)
71  endif
72 
73  intype = -1
74  ntot1 = nx1*ny1*nz1*nelv
75 
76  ! add user defined divergence to qtl
77 !max call add2 (qtl,usrdiv,ntot1)
78 
79  allocate(vext(lx1*ly1*lz1*lelv,3))
80 
81  ! Time-advance velocity with AB(k)
82  CALL v_extrap(vext)
83 
84  ! compute explicit contributions (bf{x,y,z}) with BDF(k)
85  etime = etime - dnekclock()
86  CALL makef()
87  etime = etime + dnekclock()
88 
89  ! store the velocity field for later
90  CALL lagvel()
91 
92 ! split viscosity into explicit/implicit part
93 ! if (ifexplvis) call split_vis
94 
95 ! extrapolate velocity
96 
97  ! mask Dirichlet boundaries
98  CALL bcdirvc(vx,vy,vz,v1mask,v2mask,v3mask)
99 
100 ! first, compute pressure
101 #ifndef NOTIMER
102  if (icalld == 0) tpres=0.0
103  icalld=icalld+1
104  npres=icalld
105  etime1=dnekclock()
106 #endif
107 
108  allocate(respr(lx2,ly2,lz2,lelv))
109  etime = etime - dnekclock()
110  call crespsp(respr, vext)
111  etime = etime + dnekclock()
112  deallocate(vext)
113 
114  allocate(h1(lx1,ly1,lz1,lelv), h2(lx1,ly1,lz1,lelv))
115  h1 = 1._dp / vtrans(:,:,:,:,1)
116  h2 = 0._dp
117  call ctolspl(tolspl,respr)
118 
119  allocate(dpr(lx2,ly2,lz2,lelv))
120  etime = etime - dnekclock()
121  call hsolve('PRES', dpr, respr, h1, h2, pmask, vmult &
122  ,imesh,tolspl,nmxh,1 &
123  ,p_apx,binvm1)
124  etime = etime + dnekclock()
125  deallocate(respr)
126  pr = pr + dpr
127  deallocate(dpr)
128  call ortho(pr)
129 #ifndef NOTIMER
130  tpres=tpres+(dnekclock()-etime1)
131 #endif
132 
133 ! Compute velocity
134  allocate(res1(lx1,ly1,lz1,lelv), &
135  res2(lx1,ly1,lz1,lelv), &
136  res3(lx1,ly1,lz1,lelv) )
137 
138  etime = etime - dnekclock()
139  call cresvsp(res1,res2,res3,h1,h2)
140  etime = etime + dnekclock()
141 
142  allocate(dv1(lx1,ly1,lz1,lelv), &
143  dv2(lx1,ly1,lz1,lelv), &
144  dv3(lx1,ly1,lz1,lelv) )
145 
147  etime = etime - dnekclock()
148  call hsolve('VELX', dv1, res1, h1, h2, v1mask, vmult, imesh, tolhv, nmxh, 1, &
149  vx_apx, binvm1)
150  call hsolve('VELY', dv2, res2, h1, h2, v2mask, vmult, imesh, tolhv, nmxh, 2, &
151  vy_apx, binvm1)
152  call hsolve('VELZ', dv3, res3, h1, h2, v3mask, vmult, imesh, tolhv, nmxh, 3, &
153  vz_apx, binvm1)
154  etime = etime + dnekclock()
155  deallocate(res1, res2, res3, h1, h2)
156 
157  vx = vx + dv1; vy = vy + dv2; vz = vz + dv3
158 
159 ! if (ifexplvis) call redo_split_vis
160 
161 ! Below is just for diagnostics...
162 
163 ! Calculate Divergence norms of new VX,VY,VZ
164  allocate(dvc(lx1,ly1,lz1,lelv), dfc(lx1,ly1,lz1,lelv))
165  CALL opdiv(dvc,vx,vy,vz)
166  CALL dssum(dvc)
167  dvc = dvc * binvm1
168 
169  dv1 = dvc * bm1
170  div1 = glsum(dv1,ntot1)/volvm1
171 
172  dv2 = dvc * dvc * bm1
173  div2 = glsum(dv2,ntot1)/volvm1
174  div2 = sqrt(div2)
175 ! Calculate Divergence difference norms
176  dfc = dvc! - qtl
177  dv1 = dfc * bm1
178  dif1 = glsum(dv1,ntot1)/volvm1
179 
180  dv2 = dfc * dfc * bm1
181  dif2 = glsum(dv2,ntot1)/volvm1
182  dif2 = sqrt(dif2)
183 
184  dv1 = 0._dp !qtl * bm1
185  qtl1 = glsum(dv1,ntot1)/volvm1
186 
187  dv2 = 0._dp !qtl * qtl * bm1
188  qtl2 = glsum(dv2,ntot1)/volvm1
189  qtl2 = sqrt(qtl2)
190 
191  IF (nid == 0) THEN
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!'
200  ENDIF
201  tp4misc = tp4misc + (dnekclock() - etime)
202 
203  return
204 end subroutine plan4
205 
206 !-----------------------------------------------------------------------
219 subroutine crespsp (respr, vext)
220  use kinds, only : dp
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!, qtl
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
234  use ctimer, only : ncrespsp, tcrespsp, dnekclock
235  use parallel, only : nid
236  implicit none
237 
238  REAL(DP), intent(out) :: RESPR (lx2,ly2,lz2,lelv)
239  real(DP), intent(in) :: VEXT (lx1*ly1*lz1*lelv,3)
240 
241  real(DP), allocatable, dimension(:,:,:,:) :: TA1, TA2, TA3
242  real(DP), allocatable, dimension(:,:,:,:) :: WA1, WA2, WA3
243  real(DP), allocatable, dimension(:,:,:,:) :: W1, W2
244 
245  CHARACTER(3) :: CB
246 
247  integer :: nxyz1, ntot1, nfaces
248  integer :: n, ifc, iel, e, iz
249  integer :: nyz2, nxy1
250  real(DP) :: scale, dtbd
251  real(DP) :: etime
252  real(DP), allocatable :: tmp1(:,:,:), tmp2(:,:,:), tmp3(:,:,:)
253  logical :: any_face
254 
255  ncrespsp = ncrespsp + 1
256  etime = dnekclock()
257 
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) )
263 
264 
265  nxyz1 = nx1*ny1*nz1
266  ntot1 = nxyz1*nelv
267  nfaces = 2*ndim
268 
269 ! -mu*curl(curl(v))
270  call op_curl(ta1,ta2,ta3,vext(1,1),vext(1,2),vext(1,3), &
271  .true. ,w1,w2)
272  if(ifaxis) then
273 !max CALL COL2 (TA2, OMASK,NTOT1)
274 !max CALL COL2 (TA3, OMASK,NTOT1)
275  endif
276 
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)
281  deallocate(w1, w2)
282 
283  allocate(tmp1(lx1, ly1, lz1), tmp2(lx1,ly1,lz1), tmp3(lx1,ly1,lz1))
284 
285  if(ifaxis) then
286 !max CALL COL2 (WA2, OMASK,NTOT1)
287 !max CALL COL2 (WA3, OMASK,NTOT1)
288  endif
289  !wa1 = wa1 * bm1; wa2 = wa2 * bm1; wa3 = wa3 * bm1
290 
291  !call opgrad (ta1,ta2,ta3,QTL)
292  !ta1 = 0._dp; ta2 = 0._dp; ta3 = 0._dp
293  if(ifaxis) then
294 !max CALL COL2 (ta2, OMASK,ntot1)
295 !max CALL COL2 (ta3, OMASK,ntot1)
296  endif
297 
298 ! add old pressure term because we solve for delta p
299  ta2 = 0._dp
300  ta1 = 1._dp / vtrans(:,:,:,:,1)
301 
302  etime = etime - dnekclock()
303  CALL axhelm(respr,pr,ta1,ta2,imesh,1)
304  etime = etime + dnekclock()
305 
306  ! add explicit (NONLINEAR) terms
307  n = nx1*ny1*nz1*nelv
308  do iel = 1, nelv
309  !tmp1 = vdiff(:,:,:,iel,1) *ta1(:,:,:,iel)
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))
314  enddo
315 
316  call opdssum(ta1,ta2,ta3)
317 
318  if (if3d) then
319 
320  if (if_ortho) then
321  !deallocate(wa1,wa2,wa3)
322  nyz2 = ny2*nz2
323  nxy1 = nx1*ny1
324 
325  do e = 1, nelv
326  tmp1 = jacmi(:,:,:,e) * bm1(:,:,:,e)
327  ! X
328  tmp2 = ta1(:,:,:,e) * rxm2(:,:,:,e) * tmp1
329  call mxm(dxtm12,nx1,tmp2,nx2,tmp3,nyz2)
330  respr(:,:,:,e) = - respr(:,:,:,e) + tmp3
331  ! Y
332  tmp2 = ta2(:,:,:,e) * sym2(:,:,:,e) * tmp1
333  do iz=1,nz2
334  call mxm(tmp2(:,:,iz),nx1,dym12,ny2,tmp3(:,:,iz),ny1)
335  enddo
336  respr(:,:,:,e) = respr(:,:,:,e) + tmp3
337  ! Z
338  tmp2 = ta3(:,:,:,e) * tzm2(:,:,:,e) * tmp1
339  call mxm(tmp2,nxy1,dzm12,nz2,tmp3,nz1)
340  respr(:,:,:,e) = respr(:,:,:,e) + tmp3
341  enddo
342 
343  else
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
348  !deallocate(wa1,wa2,wa3)
349  endif
350  else
351  call cdtp(wa1,ta1,rxm2,sxm2,txm2,1)
352  call cdtp(wa2,ta2,rym2,sym2,tym2,1)
353  respr = -respr + wa1 + wa2
354  endif
355  deallocate(wa1,wa2,wa3)
356 
357 ! add thermal divergence
358  dtbd = bd(1)/dt
359  respr = respr !+ qtl * bm1 * dtbd
360 
361 ! surface terms
362  DO iel=1,nelv
363  DO ifc=1,nfaces
364  cb = cbc(ifc,iel,ifield)
365  any_face = .false.
366  IF (cb(1:1) == 'V' .OR. cb(1:1) == 'v') THEN
367  any_face = .true.
368  tmp1 = 0._dp; tmp2 = 0._dp
369  IF (ndim == 3) tmp3 = 0._dp
370  CALL faccl3 &
371  (tmp1,vx(1,1,1,iel),unx(1,1,ifc,iel),ifc)
372  CALL faccl3 &
373  (tmp2,vy(1,1,1,iel),uny(1,1,ifc,iel),ifc)
374  IF (ndim == 3) &
375  CALL faccl3 &
376  (tmp3,vz(1,1,1,iel),unz(1,1,ifc,iel),ifc)
377  else if (cb(1:3) == 'SYM') then
378  any_face = .true.
379  tmp1 = 0._dp; tmp2 = 0._dp
380  IF (ndim == 3) tmp3 = 0._dp
381 
382  CALL faccl3(tmp1,ta1(:,:,:,iel),unx(1,1,ifc,iel),ifc)
383  CALL faccl3(tmp2,ta2(:,:,:,iel),uny(1,1,ifc,iel),ifc)
384  IF (ndim == 3) then
385  CALL faccl3(tmp3,ta3(:,:,:,iel),unz(1,1,ifc,iel),ifc)
386  endif
387  endif
388 
389  if (any_face) then
390  IF (ndim == 3) then
391  tmp1 = tmp1 + tmp2 + tmp3
392  else
393  tmp1 = tmp1 + tmp2
394  endif
395  CALL faccl2(tmp1,area(1,1,ifc,iel),ifc)
396  endif
397 
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
402  endif
403  END DO
404  !call dssum(ta1) ! maybe this should be here for SYM? (maxhutch)
405  END DO
406  deallocate(ta1, ta2, ta3)
407 
408 ! Assure that the residual is orthogonal to (1,1,...,1)T
409 ! (only if all Dirichlet b.c.)
410  CALL ortho(respr)
411  tcrespsp = tcrespsp + (dnekclock() - etime)
412 
413  return
414 end subroutine crespsp
415 
416 !----------------------------------------------------------------------
418 subroutine cresvsp (resv1,resv2,resv3,h1,h2)
419  use kinds, only : dp
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 !, qtl
424  use ctimer, only : ncresvsp, tcresvsp, dnekclock
425  implicit none
426 
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)
432 
433  real(DP), allocatable, dimension(:,:,:,:) :: TA1, TA2, TA3, TA4
434 
435  integer :: ntot, intype
436  real(DP) :: scale
437  real(DP) :: etime
438 
439  etime = dnekclock()
440  ncresvsp = ncresvsp + 1
441 
442  ntot = nx1*ny1*nz1*nelv
443  intype = -1
444 
445  CALL sethlm(h1,h2,intype)
446 
447  etime = etime - dnekclock()
448  ! just three axhelm calls
449  CALL ophx(resv1,resv2,resv3,vx,vy,vz,h1,h2)
450  etime = etime + dnekclock()
451 
452  scale = -1./3.
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) )
457  ta4 = pr !+ scale*(vdiff(:,:,:,:,1) * qtl)
458 
459  call opgrad(ta1,ta2,ta3,ta4)
460  deallocate(ta4)
461 
462  if(ifaxis) then
463 !max CALL COL2 (TA2, OMASK,NTOT)
464 !max CALL COL2 (TA3, OMASK,NTOT)
465  endif
466 
467  resv1 = -resv1 + bfx - ta1
468  resv2 = -resv2 + bfy - ta2
469  resv3 = -resv3 + bfz - ta3
470 
471  tcresvsp = tcresvsp + (dnekclock() - etime)
472 
473  return
474 end subroutine cresvsp
475 
476 !-----------------------------------------------------------------------
480 subroutine op_curl(w1,w2,w3,u1,u2,u3,ifavg,work1,work2)
481  use kinds, only : dp
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
489  implicit none
490 
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 !>
500 
501  integer :: ntot, nxyz, ifielt, nxy1, nyz1, iel, iz
502  real(DP), allocatable :: tmp1(:,:,:), tmp2(:,:,:)
503 
504  allocate(tmp1(nx1,ny1,nz1), tmp2(nx1,ny1,nz1))
505 
506  ntot = nx1*ny1*nz1*nelv
507  nxyz = nx1*ny1*nz1
508  nxy1 = nx1*ny1
509  nyz1 = ny1*nz1
510 
511 ! work1=dw/dy ; work2=dv/dz
512  if (if3d) then
513  if (if_ortho) then
514  do iel = 1, nelv
515  do iz = 1, nz1
516  CALL mxm(u3(1,1,iz,iel),nx1,dytm1,ny1,tmp1(1,1,iz),ny1)
517  enddo
518  CALL mxm(u2(1,1,1,iel),nxy1,dztm1,nz1,tmp2,nz1)
519  w1(:,:,:,iel) = (tmp1*sym1(:,:,:,iel) - tmp2*tzm1(:,:,:,iel)) * jacmi(:,:,:,iel)
520  enddo
521  else
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)
525  endif
526  else
527  call dudxyz(work1,u3,rym1,sym1,tym1,jacm1,1,2)
528  call copy(w1,work1,ntot)
529 
530  if(ifaxis) then
531  write(*,*) "Oops: ifaxis"
532 #if 0
533  call copy(ta,u3,ntot)
534  do iel = 1,nelv
535  if(ifrzer(iel)) then
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)
539  endif
540  call col2(ta(1,1,1,iel),yinvm1(1,1,1,iel),nxyz)
541  enddo
542  call add2(w1,ta,ntot)
543 #endif
544  endif
545  endif
546 
547 ! work1=du/dz ; work2=dw/dx
548  if (if3d) then
549  if (if_ortho) then
550  do iel = 1, nelv
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)
554  enddo
555  else
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)
559  endif
560  else
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)
564  endif
565 
566 ! work1=dv/dx ; work2=du/dy
567  if (if_ortho) then
568  do iel = 1, nelv
569  CALL mxm(dxm1,nx1,u2(1,1,1,iel),nx1,tmp1,nyz1)
570  do iz = 1, nz1
571  CALL mxm(u1(1,1,iz,iel),nx1,dytm1,ny1,tmp2(1,1,iz),ny1)
572  enddo
573  w3(:,:,:,iel) = (tmp1*rxm1(:,:,:,iel) - tmp2*sym1(:,:,:,iel)) * jacmi(:,:,:,iel)
574  enddo
575  else
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)
579  endif
580 ! Avg at bndry
581 
582 ! if (ifavg) then
583  if (ifavg .AND. .NOT. ifcyclic) then
584 
585  ifielt = ifield
586  ifield = 1
587 
588  w1 = w1 * bm1; w2 = w2 * bm1; w3 = w3 * bm1
589  call opdssum(w1,w2,w3)
590  w1 = w1 * binvm1; w2 = w2 * binvm1; w3 = w3 * binvm1
591 
592  ifield = ifielt
593 
594  endif
595 
596  return
597 end subroutine op_curl
598 
599 !-----------------------------------------------------------------------
604 subroutine v_extrap(vext)
605  use kinds, only : dp
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
610  implicit none
611 
613  real(DP), intent(out) :: vext(lx1,ly1,lz1,lelv,3)
614  real(DP) :: AB0, AB1, AB2
615 
616  ab0 = ab(1)
617  ab1 = ab(2)
618  ab2 = ab(3)
619 
620  if(nab == 3) then
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)
624  else
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)
628  endif
629 
630  return
631 end subroutine v_extrap
632 
633 !-----------------------------------------------------------------------
subroutine plan4()
Splitting scheme .
Definition: plan4.F90:14
subroutine dssum(u)
Direct stiffness sum.
Definition: dssum.F90:54
cleaned
Definition: tstep_mod.F90:2
Input parameters from preprocessors.
Definition: input_mod.F90:11
subroutine op_curl(w1, w2, w3, u1, u2, u3, ifavg, work1, work2)
Compute curl of U.
Definition: plan4.F90:480
subroutine faccl3(a, b, c, iface1)
Definition: subs1.F90:641
Definition: soln_mod.F90:1
Type to hold the approximation space. Should not be modified outside this module, so more of a handle...
Definition: navier4.F90:25
subroutine mxm(a, n1, b, n2, c, n3)
Compute matrix-matrix product C = A*B.
Definition: mxm_wrapper.F90:7
subroutine sethlm(h1, h2, intloc)
Set the variable property arrays H1 and H2 in the Helmholtz equation. (associated with variable IFIEL...
Definition: subs1.F90:694
Definition: dxyz_mod.F90:3
subroutine axhelm(au, u, helm1, helm2, imesh, isd)
Compute the (Helmholtz) matrix-vector product, AU = helm1*[A]u + helm2*[B]u, for NEL elements...
Definition: hmholtz.F90:79
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.
Definition: navier4.F90:396
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...
Definition: bdry.F90:588
subroutine crespsp(respr, vext)
Compute start residual/right-hand-side in the pressure.
Definition: plan4.F90:219
subroutine cresvsp(resv1, resv2, resv3, h1, h2)
Compute the residual for the velocity.
Definition: plan4.F90:418
cleaned
Definition: mesh_mod.F90:2
real(dp) function dnekclock()
Definition: ctimer_mod.F90:103
subroutine copy(a, b, n)
Definition: math.F90:52
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...
Definition: subs1.F90:604
cleaned
Definition: parallel_mod.F90:2
subroutine, public init_approx_space(apx, n_max, ntot)
Initialize approximation space object.
Definition: navier4.F90:41
subroutine v_extrap(vext)
Extrapolate the velocity forward in time with AB(k)
Definition: plan4.F90:604
Geometry arrays.
Definition: geom_mod.F90:2