Local variables to be added
The following local variables need to be defined for the examples in this section:
integer          ifac, iel, ii, ivar, irangv, iun, ilelt, nlelt
double precision xkent, xeent, xphi, xfb
integer          ibc, ix, ny, ios
double precision uent, vent, went, xustar2, xdh, d2s3, rhomoy
double precision acc(2), fmprsc, fmul, uref2, vnrm
integer, allocatable, dimension(:) :: lstelt, mrkcel
double precision, dimension(:), pointer :: brom
Initialization and finalization
Initialization and finalization is similar to that of the base examples
Body
Here, we define an inlet boundary condition for a very long channel or duct with a section matching the boundary faces of group 'INLET'.
We fix a mean inlet velocity, and use a feedback loop assuming a fixed-point type behavior will allow us to reach a state matching that of a very long inlet channel.
- Warning
- We assume other boundary conditions are defined before this one (ideally, using the GUI).
- 
We also assume that the mesh is orthogonal at the inlet, and we are using a RANS (not LES) computation. to the current inlet.
For EBRSM of V2f models, to avoid laminarization at the inlet, the initial velocity (at the first time step) is divided by 10 on inlet faces adjacent to the boundary, so as to ensure a velocity gradient and turbulent production. Otherwise, the initialization may fail.
fmprsc = 1.d0 
  
  
  
  
  
  
      mrkcel(iel) = 0
    enddo
        mrkcel(iel) = 1
      endif
    enddo
  endif
  do ilelt = 1, nlelt
    ifac = lstelt(ilelt)
      if (mrkcel(iel) .eq. 1) then
        rcodcl(ifac,
iu,1) = fmprsc/10.d0
      endif
    endif
    uref2 = rcodcl(ifac,
iu,1)**2  &
    uref2 = max(uref2,1.d-12)
    
    
    
    
    
    
    
    
    
    
    
    
    
    xdh     = 1.d0
    
    
    
    
    rhomoy  = brom(ifac)
    xustar2 = 0.d0
    
    xustar2, xkent, xeent )
    
      rcodcl(ifac,
ik,1)  = xkent
      rcodcl(ifac,
iep,1) = xeent
      rcodcl(ifac,
ir11,1) = d2s3*xkent
      rcodcl(ifac,
ir22,1) = d2s3*xkent
      rcodcl(ifac,
ir33,1) = d2s3*xkent
      rcodcl(ifac,
ir12,1) = 0.d0
      rcodcl(ifac,
ir13,1) = 0.d0
      rcodcl(ifac,
ir23,1) = 0.d0
      rcodcl(ifac,
iep,1)  = xeent
        rcodcl(ifac,
ial,1)  = 1.d0
      endif
      rcodcl(ifac,
ik,1)   = xkent
      rcodcl(ifac,
iep,1)  = xeent
      rcodcl(ifac,
iphi,1) = d2s3
        rcodcl(ifac,
ifb,1)  = 0.d0
      elseif (
iturb.eq.51) 
then 
        rcodcl(ifac,
ial,1)  = 0.d0
      endif
    elseif (
iturb.eq.60) 
then 
      rcodcl(ifac,
ik,1)   = xkent
      rcodcl(ifac,
iomg,1) = xeent/
cmu/xkent
    elseif (
iturb.eq.70) 
then 
      rcodcl(ifac,
inusa,1) = 
cmu*xkent**2/xeent
    endif
    
        rcodcl(ifac,
isca(ii),1) = 1.d0
      enddo
    endif
  enddo
    deallocate(mrkcel)
  endif
else
  acc(1) = 0.d0
  acc(2) = 0.d0
  
  do ilelt = 1, nlelt
    ifac = lstelt(ilelt)
    vnrm = sqrt(rtp(iel,
iu)**2 + rtp(iel,
iv)**2 + rtp(iel,
iw)**2)
    acc(1) = acc(1) + vnrm*
surfbn(ifac)
    acc(2) = acc(2) + 
surfbn(ifac)
  enddo
  endif
  fmul = fmprsc/(acc(1)/acc(2)) 
  
  do ilelt = 1, nlelt
    ifac = lstelt(ilelt)
    vnrm = sqrt(rtp(iel,
iu)**2 + rtp(iel,
iv)**2 + rtp(iel,
iw)**2)
      rcodcl(ifac,
ik,1)  = rtp(iel,
ik)
      rcodcl(ifac,
iep,1) = rtp(iel,
iep)
      rcodcl(ifac,
iep,1)  = rtp(iel,
iep)
        rcodcl(ifac,
ial,1)  = rtp(iel,
ial)
      endif
      rcodcl(ifac,
ik,1)  = rtp(iel,
ik)
      rcodcl(ifac,
iep,1) = rtp(iel,
iep)
        rcodcl(ifac,
ifb,1)  = rtp(iel,
ifb)
      elseif (
iturb.eq.51) 
then 
        rcodcl(ifac,
ial,1)  = rtp(iel,
ial)
      endif
    elseif (
iturb.eq.60) 
then 
      rcodcl(ifac,
ik,1)  = rtp(iel,
ik)
    elseif (
iturb.eq.70) 
then 
    endif
    
    
        rcodcl(ifac,
isca(ii),1) = rtp(iel,
isca(ii))
      enddo
    endif
  enddo
endif