c =====================================================================
c
c     SUBROUTINE set_dye_vbc
c
c     PURPOSE: calculate the vertical boundary conditions, i.e.
c            the surface and bottom fluxes.
c
c     VARIABLES:
c 
c     IN:      through modules
c
c     OUT:     through modules
c              most importantly stf and btf
c
c     AUTHOR:  Nicolas Gruber (gruber@splash.princeton.edu)  
c
c     VERSION: MOM3, ocn19
c
c     REVISIONS:
c
c     date     author   remarks
c     
c     29.06.99  ng      started coding
c     17.11.99  ng      added restoring bc
c     08.01.00  ng      added time_dependent
c      
c =====================================================================
c
      subroutine set_dye_vbc(joff, js, je, is, ie)  !{
c
c-----------------------------------------------------------------------
c     arguments
c-----------------------------------------------------------------------
c
c      implicit none
c
      integer  joff, js, je, is, ie
c
c
c
c-----------------------------------------------------------------------
c     local variables
c-----------------------------------------------------------------------
c
      integer  :: i, j, m
c
c
c =====================================================================
c     begin of executable code
c =====================================================================
c
c---------------------------------------------------------------------
c     calculate surface fluxes for Dye tracers
c       Fluxes have units of mol/cm2/s
c---------------------------------------------------------------------
c
c      write(stdout,*) '--SET_DYE_VBC: calculating stf for DYEs'
c      write(stdout,*) '     ind_f_dye, ind_l_dye : ',
c     $     ind_f_dye,ind_l_dye
c
      do m = ind_f_dye, ind_l_dye
         do j = js,je
            do i=is,ie
               stf(i,j,m) = 
     $              (dye_restval(i,jrow(j),m-ind_f_dye+1) 
     $              - t(i,1,j,m,taum1)*tmask(i,1,j))
     $              *dzt(1)/c2dtts
               stf(i,j,m) = dyeflux(i,jrow(j),m-ind_f_dye+1)    
# ifdef npg_time_dependent
     $              * pert_atmco2
# endif      
            enddo                  !i
         enddo                     !j
      enddo                        !m
c
c---------------------------------------------------------------------
c     set bottom fluxes to zero 
c---------------------------------------------------------------------
c
      do m=ind_f_dye,ind_l_dye  !{
         do j=js,je  !{
            do i=is,ie !{
               btf(i,j,m) = c0
            enddo  !} i
         enddo  !} j
      enddo  !} m

c---------------------------------------------------------------------
c     return to calling program
c---------------------------------------------------------------------
c
      return
c
c =====================================================================
c     end of set_dye_vbc
c =====================================================================
c
      end subroutine  set_dye_vbc  !}
