Robin boundary condition on velocity
Hi Neks I'm trying to implement a slip-length (Robin) as boundary condition for a plane channel flow, namely: (u+du/dy)_{wall}=0 where x and y are the streamwise and wall normal directions respectively. Following the latter post: http://lists.mcs.anl.gov/pipermail/nek5000-users/2011-April/001313.html here there's what I came up with: c----------------------------------------------------------------------- subroutine userchk include 'SIZE' include 'TOTAL' common /my_DEBUG/ rmodulate common /my_ROBIN/ ROBIN_mask(lx1,ly1,lz1,lelt) $ , work1(lx1,ly1,lz1,lelt) $ , work2(lx1,ly1,lz1,lelt) $ , graduy(lx1,ly1,lz1,lelt) n = nx1*ny1*nz1*nelv !!!Build Up MASKS! if (istep.eq.0) then do i=1,n x=xm1(i,1,1,1) y=ym1(i,1,1,1) if(x.gt.3.and.x.lt.4)then ROBIN_mask(i,1,1,1)=1.0 else ROBIN_mask(i,1,1,1)=0.0 endif enddo endif !Compute velocity gradient call rzero(graduy,n) call gradm1(work1,graduy,work2,vx) call dsavg(graduy) ! call outpost(work1,graduy,work2,pr,t,'GRD') !Da aggiungere l'eventualità del 3D... rmodulate = 0.5*(tanh(0.25*time-10)+1) if (nid.eq.0) write(6,*)"MODULATE", rmodulate,time return end c----------------------------------------------------------------------- c----------------------------------------------------------------------- subroutine userbc (ix,iy,iz,iside,eg) c NOTE ::: This subroutine MAY NOT be called by every process include 'SIZE' include 'TOTAL' include 'NEKUSE' integer e, eg !Imposing Fancy Boundary Conditions... ![Nek5000-users] Robin boundary conditions for the velocity common /my_ROBIN/ ROBIN_mask(lx1,ly1,lz1,lelt) $ , work1(lx1,ly1,lz1,lelt) $ , work2(lx1,ly1,lz1,lelt) $ , graduy(lx1,ly1,lz1,lelt) common /my_DEBUG/ rmodulate e=gllel(eg) ! global element number to processor-local el. # ux=1*graduy(ix,iy,iz,e)*rmodulate uy=0.0 uz=0.0 return end c----------------------------------------------------------------------- subroutine useric (ix,iy,iz,ieg) include 'SIZE' include 'TOTAL' include 'NEKUSE' ux=1.0*y**2 uy=0.0 uz=0.0 temp=0 return end c----------------------------------------------------------------------- The code becomes unstable in the gradient computation due to some point-to-point oscillations. As you can see I've also tried to use a ramp function in order to make the onset of Robin condition more gentle, but at a given "slip-length amplitude" oscillations deteriorates the solution. I use ROBIN_mask in order to chose where to have such BC, but it seems that I'm still missing something in computing the velocity gradient GRD. By the way, this is my box.BOX file: base.rea 2 spatial dimension ( < 0 --> generate .rea/.re2 pair) 1 number of fields #======================================================================= # # Example of .box file for channel flow # # If nelx (y or z) < 0, then genbox automatically generates the # grid spacing in the x (y or z) direction # with a geometric ratio given by "ratio". # ( ratio=1 implies uniform spacing ) # # Note that the character bcs _must_ have 3 spaces. # #======================================================================= # Box -32 -16 nelx,nely,nelz for Box 0 6.2832 1. x0,x1,gain -1 1 1. y0,y1,gain P ,P ,v ,v , , bc's (3 chars each!) I was wondering if you might be able to give me some advice. Best regards, Francesco
Hi Francesco, Robin boundary condition is implemented already for the passive scalar, in the form of Newton cooling boundary condition. You can see how this is implemented in subroutine BCNEUSC. In your case ITYPE=-1 and CB=‘c ' in the subroutine, and you need to only set ‘HC’ accordingly. We tested this and even our turbulent simulations are stable with Robin BC. Best regards, Sudhakar.
On 21 Apr 2017, at 20:35, [email protected] wrote:
Hi Neks I'm trying to implement a slip-length (Robin) as boundary condition for a plane channel flow, namely: (u+du/dy)_{wall}=0 where x and y are the streamwise and wall normal directions respectively.
Following the latter post: http://lists.mcs.anl.gov/pipermail/nek5000-users/2011-April/001313.html <http://lists.mcs.anl.gov/pipermail/nek5000-users/2011-April/001313.html>
here there's what I came up with:
c----------------------------------------------------------------------- subroutine userchk include 'SIZE' include 'TOTAL' common /my_DEBUG/ rmodulate common /my_ROBIN/ ROBIN_mask(lx1,ly1,lz1,lelt) $ , work1(lx1,ly1,lz1,lelt) $ , work2(lx1,ly1,lz1,lelt) $ , graduy(lx1,ly1,lz1,lelt) n = nx1*ny1*nz1*nelv !!!Build Up MASKS! if (istep.eq.0) then do i=1,n x=xm1(i,1,1,1) y=ym1(i,1,1,1) if(x.gt.3.and.x.lt.4)then ROBIN_mask(i,1,1,1)=1.0 else ROBIN_mask(i,1,1,1)=0.0 endif enddo endif !Compute velocity gradient call rzero(graduy,n) call gradm1(work1,graduy,work2,vx) call dsavg(graduy) ! call outpost(work1,graduy,work2,pr,t,'GRD') !Da aggiungere l'eventualità del 3D... rmodulate = 0.5*(tanh(0.25*time-10)+1) if (nid.eq.0) write(6,*)"MODULATE", rmodulate,time return end c----------------------------------------------------------------------- c----------------------------------------------------------------------- subroutine userbc (ix,iy,iz,iside,eg) c NOTE ::: This subroutine MAY NOT be called by every process include 'SIZE' include 'TOTAL' include 'NEKUSE' integer e, eg !Imposing Fancy Boundary Conditions... ![Nek5000-users] Robin boundary conditions for the velocity common /my_ROBIN/ ROBIN_mask(lx1,ly1,lz1,lelt) $ , work1(lx1,ly1,lz1,lelt) $ , work2(lx1,ly1,lz1,lelt) $ , graduy(lx1,ly1,lz1,lelt) common /my_DEBUG/ rmodulate e=gllel(eg) ! global element number to processor-local el. # ux=1*graduy(ix,iy,iz,e)*rmodulate uy=0.0 uz=0.0 return end c----------------------------------------------------------------------- subroutine useric (ix,iy,iz,ieg) include 'SIZE' include 'TOTAL' include 'NEKUSE' ux=1.0*y**2 uy=0.0 uz=0.0 temp=0 return end c-----------------------------------------------------------------------
The code becomes unstable in the gradient computation due to some point-to-point oscillations. As you can see I've also tried to use a ramp function in order to make the onset of Robin condition more gentle, but at a given "slip-length amplitude" oscillations deteriorates the solution. I use ROBIN_mask in order to chose where to have such BC, but it seems that I'm still missing something in computing the velocity gradient GRD.
By the way, this is my box.BOX file:
base.rea 2 spatial dimension ( < 0 --> generate .rea/.re2 pair) 1 number of fields #======================================================================= # # Example of .box file for channel flow # # If nelx (y or z) < 0, then genbox automatically generates the # grid spacing in the x (y or z) direction # with a geometric ratio given by "ratio". # ( ratio=1 implies uniform spacing ) # # Note that the character bcs _must_ have 3 spaces. # #======================================================================= # Box -32 -16 nelx,nely,nelz for Box 0 6.2832 1. x0,x1,gain -1 1 1. y0,y1,gain P ,P ,v ,v , , bc's (3 chars each!)
I was wondering if you might be able to give me some advice.
Best regards,
Francesco _______________________________________________ Nek5000-users mailing list [email protected] https://lists.mcs.anl.gov/mailman/listinfo/nek5000-users
participants (1)
-
nek5000-users@lists.mcs.anl.gov