!-------------------------------------- LICENCE BEGIN ------------------------------------
!Environment Canada - Atmospheric Science and Technology License/Disclaimer, 
!                     version 3; Last Modified: May 7, 2008.
!This is free but copyrighted software; you can use/redistribute/modify it under the terms 
!of the Environment Canada - Atmospheric Science and Technology License/Disclaimer 
!version 3 or (at your option) any later version that should be found at: 
!http://collaboration.cmc.ec.gc.ca/science/rpn.comm/license.html 
!
!This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
!without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
!See the above mentioned License/Disclaimer for more details.
!You should have received a copy of the License/Disclaimer along with this software; 
!if not, you can write to: EC-RPN COMM Group, 2121 TransCanada, suite 500, Dorval (Quebec), 
!CANADA, H9P 1J3; or send e-mail to service.rpn@ec.gc.ca
!-------------------------------------- LICENCE END --------------------------------------
***s/r nesajr_ad -- ADJ of nesajr 
*
#include "model_macros_f.h"
*

      subroutine nesajr_ad (F_fn, F_fd, DIST_DIM, Nk, F_is, F_js,  27,4
     $                                      F_ndavx, F_ndavy)

*
#include "impnone.cdk"
*
      integer DIST_DIM, NK, F_is, F_js, F_ndavx, F_ndavy
      real F_fn(DIST_SHAPE,Nk), F_fd(DIST_SHAPE,Nk)
*
*author
*     M.Tanguay
*
*revision
* v3_03 - Tanguay M.        - initial MPI version
*
*object
*     see id section
*
*ADJ of 
*arguments
*  Name        I/O                 Description
*----------------------------------------------------------------
*  F_fn         O           field to be blended
*  F_fd         I           blending field
*  F_is         I           staggering parameter along x
*  F_js         I           staggering parameter along y
*  F_ndavx      I           thichness of sponge layer along x
*  F_ndavy      I           thichness of sponge layer along y
*----------------------------------------------------------------
*
*implicit
#include "glb_ld.cdk"
*
**
*----------------------------------------------------------------------
      if ((F_ndavx.eq.0).and.(F_ndavy.eq.0)) return
      if (north+south+east+west.eq.1)
     $  call nes1s_ad (F_fn,F_fd,DIST_DIM,Nk,F_is,F_js,F_ndavx,F_ndavy)
      if (north+south+east+west.eq.2)
     $  call nes2s_ad (F_fn,F_fd,DIST_DIM,Nk,F_is,F_js,F_ndavx,F_ndavy)
      if (north+south+east+west.eq.3)
     $  call nes3s_ad (F_fn,F_fd,DIST_DIM,Nk,F_is,F_js,F_ndavx,F_ndavy)
      if (north+south+east+west.eq.4)
     $  call nes4s_ad (F_fn,F_fd,DIST_DIM,Nk,F_is,F_js,F_ndavx,F_ndavy)
*----------------------------------------------------------------------
      return
      end