c----------------------------------------------------------------------- C C USER SPECIFIED ROUTINES: C C - boundary conditions C - initial conditions C - variable properties C - local acceleration for fluid (a) C - forcing function for passive scalar (q) C - general purpose routine for checking errors etc. C c----------------------------------------------------------------------- subroutine uservp (ix,iy,iz,eg) include 'SIZE' include 'TOTAL' include 'NEKUSE' integer e,f,eg c e = gllel(eg) udiff =0. utrans=0. return end c----------------------------------------------------------------------- subroutine userf (ix,iy,iz,eg) include 'SIZE' include 'TOTAL' include 'NEKUSE' integer e,f,eg c e = gllel(eg) c Note: this is an acceleration term, NOT a force! c Thus, ffx will subsequently be multiplied by rho(x,t). ffx = 0.0 ffy = 0.0 ffz = 0.0 return end c----------------------------------------------------------------------- subroutine userq (ix,iy,iz,eg) include 'SIZE' include 'TOTAL' include 'NEKUSE' integer e,f,eg c e = gllel(eg) qvol = 0.0 source = 0.0 return end c----------------------------------------------------------------------- subroutine userchk include 'SIZE' include 'TOTAL' include 'AVG' ifxyo = .true. if (iostep.gt.0.and.istep.gt.iostep) ifxyo = .false. c call avg_all() call fill_div(usrdiv) ! for outflow conditions return end c----------------------------------------------------------------------- subroutine userbc (ix,iy,iz,iside,ieg) include 'SIZE' include 'TOTAL' include 'NEKUSE' common /profux/ ua,xx(36),uu(36) integer m m = 36 c do i=1,m if(y .ge. xx(i) .and. y .lt. xx(i+1)) then ua = ((y - xx(i))/(xx(i+1) - xx(i)))*(uu(i+1)-uu(i)) ux = ua + uu(i) endif enddo uy = 0.0 uz = 0.0 c return end c----------------------------------------------------------------------- subroutine useric (ix,iy,iz,ieg) include 'SIZE' include 'TOTAL' include 'NEKUSE' common /profux/ ua,xx(36),uu(36) integer m if (y > 0) then ux = -6*((y/4.0)**2 - (y/4.0)) else ux = 0.0 endif uy = 0.0 uz = 0.0 c m = 36 c open(unit=98,file='Adams-u-inflow.txt') c do i=1,m read(98,*) uu(i),xx(i) enddo close(98) c return end c----------------------------------------------------------------------- subroutine usrdat include 'SIZE' include 'TOTAL' c return end c----------------------------------------------------------------------- subroutine usrdat3 include 'SIZE' include 'TOTAL' c return end c----------------------------------------------------------------------- subroutine usrdat2 ! Modify geometry include 'SIZE' include 'TOTAL' param(66) = 4 param(67) = 4 return end c----------------------------------------------------------------------- subroutine fill_div(div) c c Fill the domain with a nontrivial divergence, where desired. c c include 'SIZE' include 'TOTAL' c integer icalld save icalld data icalld /0/ c common /cvflow_d/ dist(lx2,ly2,lz2,lelt),dmax common /cvflow_l/ ifdivf logical ifdivf c real div(lx2,ly2,lz2,lelv) c ntot2 = nx2*ny2*nz2*nelv call rzero(div,ntot2) if (ifdivf) return c if (icalld.eq.0) then icalld = 1 call set_outflow_dist endif dmax2 = dmax*dmax c call get_div_const(cdiv) c nd = 0 if (ifsplit) then do i=1,ntot2 dd = dist(i,1,1,1)*dist(i,1,1,1) dd = min(dmax2,dd) if (dist(i,1,1,1).ge.0) div(i,1,1,1) = cdiv*(1.-dd/dmax2) if (dist(i,1,1,1).ge.0) nd = nd+1 enddo else do i=1,ntot2 dd = dist(i,1,1,1)*dist(i,1,1,1) dd = min(dmax2,dd) if (dist(i,1,1,1).ne.0) div(i,1,1,1) = cdiv*(1.-dd/dmax2) if (dist(i,1,1,1).ne.0) nd = nd+1 enddo endif dsmin = glmin(dist,ntot2) dsmax = glmax(dist,ntot2) dvmin = glmin(div,ntot2) dvmax = glmax(div,ntot2) xd = nd xd = glsum(xd,1) nd = xd if(nid.eq.0)write(6,1) istep,nd,dvmin,dvmax,dsmin,dsmax,cdiv,dmax2 1 format(2i9,1p6e11.3,'divmnmx') 2 format(2i9,1p2e11.3,'divdstm') c return end c----------------------------------------------------------------------- subroutine set_outflow_dist c c Compute projected normal distance from outflow c include 'SIZE' include 'TOTAL' c common /cvflow_d/ dist(lx2,ly2,lz2,lelt),dmax c integer e,f c c nxyz2 = nx2*ny2*nz2 ntot2 = nx2*ny2*nz2*nelv ntot1 = nx1*ny1*nz1*nelv c call rzero(dist,ntot2) davg = 0. wavg = 0. c xmax = glmax(xm1,ntot1) if (ifsplit) call copy(xm2,xm1,ntot1) c do e=1,nelv if (cbc(2,e,1).eq.'O ') then ! Outflow do k=1,nxyz2 dist(k,1,1,e) = xmax-xm2(k,1,1,e) davg = davg+dist(k,1,1,e) wavg = wavg+1.0 enddo endif enddo dmax = glmax(dist,ntot2) davg = glsum(davg,1) wavg = glsum(wavg,1) if (wavg.gt.0) davg = davg/wavg if (nid.eq.0) write(6,1) dmax,davg,wavg 1 format('div: davg:',1p3e12.4) dmax = 0.5*(dmax+davg) c return end c----------------------------------------------------------------------- subroutine get_div_const(cdiv) c c Get constant multiplier for divergence c include 'SIZE' include 'TOTAL' c common /cvflow_d/ dist(lx2,ly2,lz2,lelt),dmax real flx(0:2) c integer e,f vnmo_desired = 0.015 cdivt = 1.5*vnmo_desired/dmax cdiv = max(0.,cdivt) ! No contraction! if (nid.eq.0) write(6,1) istep,time,vnmo,dmax,cdiv,cdivt 1 format(i9,1p5e13.5,' cdiv') return end c----------------------------------------------------------------------- c c automatically added by makenek subroutine usrsetvert(glo_num,nel,nx,ny,nz) ! to modify glo_num integer*8 glo_num(1) return end