










      subroutine init_arrays (tile)      


      use Agrif_Util
      interface
        subroutine Sub_Loop_init_arrays(tile,Mmmpi,Lmmpi)
          implicit none
      integer(4), parameter :: LLm0 = 41
      integer(4), parameter :: MMm0 = 42
      integer(4), parameter :: N = 32
      integer(4), parameter :: N_sl = 0
      integer(4), parameter :: NP_XI = 1
      integer(4), parameter :: NP_ETA = 4
      integer(4), parameter :: NNODES = NP_XI*NP_ETA
      integer(4), parameter :: NPP = 1
      integer(4), parameter :: NSUB_X = 1
      integer(4), parameter :: NSUB_E = 1
      integer(4), parameter :: NWEIGHT = 1000
      integer(4), parameter :: Ntides = 8
      integer(4), parameter :: stdout = 6
      integer(4), parameter :: Np = N+1
      integer(4), parameter :: NpHz = (N+1+N_sl)
      integer(4), parameter :: NSA = 28
      real, parameter :: Vtransform = 2
      integer(4), parameter :: itemp = 1
      integer(4), parameter :: ntrc_temp = 1
      integer(4), parameter :: ntrc_salt = 1
      integer(4), parameter :: ntrc_pas = 0
      integer(4), parameter :: ntrc_bio = 0
      integer(4), parameter :: ntrc_subs = 0
      integer(4), parameter :: ntrc_substot = 0
      integer(4), parameter :: ntrc_sed = 0
      integer(4), parameter :: NTA = itemp+ntrc_salt
      integer(4), parameter :: NT = itemp+ntrc_salt+ntrc_pas+ntrc_bio+nt
     &rc_sed
      integer(4), parameter :: NTot = NT
      integer(4), parameter :: isalt = itemp+1
      integer(4), parameter :: ntrc_diabio = 0
      integer(4), parameter :: ntrc_diats = 0
      integer(4), parameter :: ntrc_diauv = 0
      integer(4), parameter :: ntrc_diavrt = 0
      integer(4), parameter :: ntrc_diaek = 0
      integer(4), parameter :: ntrc_diapv = 0
      integer(4), parameter :: ntrc_diaeddy = 0
      integer(4), parameter :: ntrc_surf = 0
      integer(4) :: Mmmpi
      integer(4) :: Lmmpi
      integer(4) :: tile
        end subroutine Sub_Loop_init_arrays

      end interface
      integer(4) :: tile
      

        call Sub_Loop_init_arrays(tile, Agrif_tabvars_i(8)%iarray0, Agri
     &f_tabvars_i(7)%iarray0)

      end


      subroutine Sub_Loop_init_arrays(tile,Mmmpi,Lmmpi)

      use Agrif_Types, only : Agrif_tabvars

      implicit none

      integer(4), parameter :: LLm0 = 41
      integer(4), parameter :: MMm0 = 42
      integer(4), parameter :: N = 32
      integer(4), parameter :: N_sl = 0
      integer(4), parameter :: NP_XI = 1
      integer(4), parameter :: NP_ETA = 4
      integer(4), parameter :: NNODES = NP_XI*NP_ETA
      integer(4), parameter :: NPP = 1
      integer(4), parameter :: NSUB_X = 1
      integer(4), parameter :: NSUB_E = 1
      integer(4), parameter :: NWEIGHT = 1000
      integer(4), parameter :: Ntides = 8
      integer(4), parameter :: stdout = 6
      integer(4), parameter :: Np = N+1
      integer(4), parameter :: NpHz = (N+1+N_sl)
      integer(4), parameter :: NSA = 28
      real, parameter :: Vtransform = 2
      integer(4), parameter :: itemp = 1
      integer(4), parameter :: ntrc_temp = 1
      integer(4), parameter :: ntrc_salt = 1
      integer(4), parameter :: ntrc_pas = 0
      integer(4), parameter :: ntrc_bio = 0
      integer(4), parameter :: ntrc_subs = 0
      integer(4), parameter :: ntrc_substot = 0
      integer(4), parameter :: ntrc_sed = 0
      integer(4), parameter :: NTA = itemp+ntrc_salt
      integer(4), parameter :: NT = itemp+ntrc_salt+ntrc_pas+ntrc_bio+nt
     &rc_sed
      integer(4), parameter :: NTot = NT
      integer(4), parameter :: isalt = itemp+1
      integer(4), parameter :: ntrc_diabio = 0
      integer(4), parameter :: ntrc_diats = 0
      integer(4), parameter :: ntrc_diauv = 0
      integer(4), parameter :: ntrc_diavrt = 0
      integer(4), parameter :: ntrc_diaek = 0
      integer(4), parameter :: ntrc_diapv = 0
      integer(4), parameter :: ntrc_diaeddy = 0
      integer(4), parameter :: ntrc_surf = 0
      integer(4) :: Mmmpi
      integer(4) :: Lmmpi
      integer(4) :: tile

                   

                                            
                             
                                            

                                                             
                     
                        

                                                            
                                           
                                                               
                                    
                                      
                                                          

                       

                                    

                        
                              

                       
                          

                                                
                                             
                          

                        

                                 

                                                
                        

                                                              
                      
                              

                                       
                                                                     
                                          
                         

                             

                             

                            

                            

                                             

                            

                                     

                                                               

                         

                                                      
                                                      
                                                                  
                               

                               

                              

                              

                               

                              

                              

                                

                             

                          
      integer(4) :: trd
C$    integer*4 omp_get_thread_num
                                                            
      integer(4) :: chunk_size_X
      integer(4) :: margin_X
      integer(4) :: chunk_size_E
      integer(4) :: margin_E
                                             
      integer(4) :: Istr
      integer(4) :: Iend
      integer(4) :: Jstr
      integer(4) :: Jend
      integer(4) :: i_X
      integer(4) :: j_E
      chunk_size_X=(Lmmpi+NSUB_X-1)/NSUB_X
      margin_X=(NSUB_X*chunk_size_X-Lmmpi)/2
      chunk_size_E=(Mmmpi+NSUB_E-1)/NSUB_E
      margin_E=(NSUB_E*chunk_size_E-Mmmpi)/2
      j_E=tile/NSUB_X
      i_X=tile-j_E*NSUB_X
      Istr=1+i_X*chunk_size_X-margin_X
      Iend=Istr+chunk_size_X-1
      Istr=max(Istr,1)
      Iend=min(Iend,Lmmpi)
      Jstr=1+j_E*chunk_size_E-margin_E
      Jend=Jstr+chunk_size_E-1
      Jstr=max(Jstr,1)
      Jend=min(Jend,Mmmpi)
      call init_arrays_tile (Istr,Iend,Jstr,Jend)
      return
       
      

      end subroutine Sub_Loop_init_arrays

      subroutine init_arrays_tile (Istr,Iend,Jstr,Jend)      


      use Agrif_Util
      interface
        subroutine Sub_Loop_init_arrays_tile(Istr,Iend,Jstr,Jend,padd_E,
     &Mm,padd_X,Lm,hbbl_avg,hbbl,hbl_avg,kbl,hbls,ghats,Akt,bvf,Akv,dRde
     &,dRdx,diff3d_v,diff3d_u,diff4_sponge,tnu4,diff4,diff2_sponge,tnu2,
     &diff2,visc2_sponge_p,visc2_sponge_r,visc2_p,visc2,visc2_r,UV_Tmino
     &r,UV_Tmajor,UV_Tphase,UV_Tangle,SSH_Tphase,SSH_Tamp,Tperiod,tbry_n
     &orth,vbry_north,ubry_north,vbarbry_north,ubarbry_north,zetabry_nor
     &th,tbry_south,vbry_south,ubry_south,vbarbry_south,ubarbry_south,ze
     &tabry_south,tbry_east,vbry_east,ubry_east,vbarbry_east,ubarbry_eas
     &t,zetabry_east,tbry_west,vbry_west,ubry_west,vbarbry_west,ubarbry_
     &west,zetabry_west,srflxg,srflx_avg,srflx,sssg,sss,sstg,dqdtg,sst,d
     &qdt,btflx,stflxg,stflx_avg,stflx,bvstrg,bustrg,svstr_avg,sustr_avg
     &,wstr_avg,bostr_avg,bvstr,bustr,svstrg,sustrg,svstr,sustr,t_avg,t,
     &got_tini,bvf_avg,omega_avg,We,w_avg,v_avg,u_avg,rho_avg,rho,v,u,DV
     &_avg2,DU_avg2,DV_avg1,DU_avg1,Zt_avg1,rvfrc_bak,rufrc_bak,rufrc,vb
     &ar_avg,ubar_avg,zeta_avg,vbar,ubar,zeta,NORTH_INTER,Mmmpi,SOUTH_IN
     &TER,EAST_INTER,Lmmpi,WEST_INTER)
          implicit none
      integer(4), parameter :: LLm0 = 41
      integer(4), parameter :: MMm0 = 42
      integer(4), parameter :: N = 32
      integer(4), parameter :: N_sl = 0
      integer(4), parameter :: NP_XI = 1
      integer(4), parameter :: NP_ETA = 4
      integer(4), parameter :: NNODES = NP_XI*NP_ETA
      integer(4), parameter :: NPP = 1
      integer(4), parameter :: NSUB_X = 1
      integer(4), parameter :: NSUB_E = 1
      integer(4), parameter :: NWEIGHT = 1000
      integer(4), parameter :: Ntides = 8
      integer(4), parameter :: stdout = 6
      integer(4), parameter :: Np = N+1
      integer(4), parameter :: NpHz = (N+1+N_sl)
      integer(4), parameter :: NSA = 28
      real, parameter :: Vtransform = 2
      integer(4), parameter :: itemp = 1
      integer(4), parameter :: ntrc_temp = 1
      integer(4), parameter :: ntrc_salt = 1
      integer(4), parameter :: ntrc_pas = 0
      integer(4), parameter :: ntrc_bio = 0
      integer(4), parameter :: ntrc_subs = 0
      integer(4), parameter :: ntrc_substot = 0
      integer(4), parameter :: ntrc_sed = 0
      integer(4), parameter :: NTA = itemp+ntrc_salt
      integer(4), parameter :: NT = itemp+ntrc_salt+ntrc_pas+ntrc_bio+nt
     &rc_sed
      integer(4), parameter :: NTot = NT
      integer(4), parameter :: isalt = itemp+1
      integer(4), parameter :: ntrc_diabio = 0
      integer(4), parameter :: ntrc_diats = 0
      integer(4), parameter :: ntrc_diauv = 0
      integer(4), parameter :: ntrc_diavrt = 0
      integer(4), parameter :: ntrc_diaek = 0
      integer(4), parameter :: ntrc_diapv = 0
      integer(4), parameter :: ntrc_diaeddy = 0
      integer(4), parameter :: ntrc_surf = 0
      integer(4), parameter :: filetype_his = 1
      integer(4), parameter :: filetype_avg = 2
      integer(4), parameter :: filetype_dia = 3
      integer(4), parameter :: filetype_dia_avg = 4
      integer(4), parameter :: filetype_diaM = 5
      integer(4), parameter :: filetype_diaM_avg = 6
      integer(4), parameter :: filetype_diags_vrt = 7
      integer(4), parameter :: filetype_diags_vrt_avg = 8
      integer(4), parameter :: filetype_diags_ek = 9
      integer(4), parameter :: filetype_diags_ek_avg = 10
      integer(4), parameter :: filetype_diags_pv = 11
      integer(4), parameter :: filetype_diags_pv_avg = 12
      integer(4), parameter :: filetype_diags_eddy_avg = 17
      integer(4), parameter :: filetype_surf = 13
      integer(4), parameter :: filetype_surf_avg = 14
      integer(4), parameter :: filetype_diabio = 15
      integer(4), parameter :: filetype_diabio_avg = 16
      integer(4), parameter :: filetype_abl = 18
      integer(4), parameter :: filetype_abl_avg = 19
      integer(4), parameter :: indxTime = 1
      integer(4), parameter :: indxZ = 2
      integer(4), parameter :: indxUb = 3
      integer(4), parameter :: indxVb = 4
      integer(4), parameter :: indxU = 6
      integer(4), parameter :: indxV = 7
      integer(4), parameter :: indxT = indxV+1
      integer(4), parameter :: indxS = indxV+ntrc_temp+1
      integer(4), parameter :: indxBSD = indxV+ntrc_temp+ntrc_salt+ntrc_
     &pas+ntrc_bio+1
      integer(4), parameter :: indxBSS = 101
      integer(4), parameter :: indxO = indxV+ntrc_temp+ntrc_salt+ntrc_pa
     &s+ntrc_bio+ntrc_sed+ntrc_substot+ntrc_diats+ntrc_diauv+ntrc_diavrt
     &+ntrc_diaek+ntrc_diapv+ntrc_diaeddy+ntrc_surf+ntrc_diabio+1
      integer(4), parameter :: indxW = indxO+1
      integer(4), parameter :: indxR = indxO+2
      integer(4), parameter :: indxVisc = indxO+3
      integer(4), parameter :: indxDiff = indxO+4
      integer(4), parameter :: indxAkv = indxO+5
      integer(4), parameter :: indxAkt = indxO+6
      integer(4), parameter :: indxAks = indxAkv+ntrc_temp+4
      integer(4), parameter :: indxHbl = indxAkv+ntrc_temp+5
      integer(4), parameter :: indxHbbl = indxAkv+ntrc_temp+6
      integer(4), parameter :: indxSSH = indxAkv+ntrc_temp+12
      integer(4), parameter :: indxbvf = indxSSH+1
      integer(4), parameter :: indxSUSTR = indxSSH+2
      integer(4), parameter :: indxSVSTR = indxSSH+3
      integer(4), parameter :: indxTime2 = indxSSH+4
      integer(4), parameter :: indxShflx = indxSUSTR+5
      integer(4), parameter :: indxSwflx = indxShflx+1
      integer(4), parameter :: indxShflx_rsw = indxShflx+2
      integer(4), parameter :: indxSST = indxShflx_rsw+1
      integer(4), parameter :: indxdQdSST = indxShflx_rsw+2
      integer(4), parameter :: indxSSS = indxSST+2
      integer(4), parameter :: indxWstr = indxSUSTR+23
      integer(4), parameter :: indxUWstr = indxSUSTR+24
      integer(4), parameter :: indxVWstr = indxSUSTR+25
      integer(4), parameter :: indxBostr = indxSUSTR+26
      integer(4), parameter :: indxBustr = indxSUSTR+27
      integer(4), parameter :: indxBvstr = indxBustr+1
      integer(4), parameter :: indxWWA = indxSUSTR+42
      integer(4), parameter :: indxWWD = indxWWA+1
      integer(4), parameter :: indxWWP = indxWWA+2
      integer(4), parameter :: r2dvar = 0
      integer(4), parameter :: u2dvar = 1
      integer(4), parameter :: v2dvar = 2
      integer(4), parameter :: p2dvar = 3
      integer(4), parameter :: r3dvar = 4
      integer(4), parameter :: u3dvar = 5
      integer(4), parameter :: v3dvar = 6
      integer(4), parameter :: p3dvar = 7
      integer(4), parameter :: w3dvar = 8
      integer(4), parameter :: pw3dvar = 11
      integer(4), parameter :: b3dvar = 12
      real, parameter :: qp2 = 0.0000172D0
      real, parameter :: Gslope_max = 1.D0
      real, parameter :: Rslope_max = 0.05D0
      real, parameter :: pi = 3.14159265358979323846D0
      real, parameter :: deg2rad = pi/180.D0
      real, parameter :: rad2deg = 180.D0/pi
      real, parameter :: Eradius = 6371315.0D0
      real, parameter :: Erotation = 7.292115090D-5
      real, parameter :: day2sec = 86400.D0
      real, parameter :: sec2day = 1.D0/86400.D0
      real, parameter :: year2day = 365.25D0
      real, parameter :: day2year = 1.D0/365.25D0
      real, parameter :: jul_off = 2440000.D0
      real, parameter :: g = 9.81D0
      real, parameter :: Cp = 3985.0D0
      real, parameter :: vonKar = 0.41D0
      real, parameter :: spval = -999.0D0
      logical, parameter :: mask_val = .true.
      real, parameter :: init = 0.D0
      integer(4) :: padd_E
      integer(4) :: Mm
      integer(4) :: padd_X
      integer(4) :: Lm
      real :: visc2
      logical :: NORTH_INTER
      integer(4) :: Mmmpi
      logical :: SOUTH_INTER
      logical :: EAST_INTER
      integer(4) :: Lmmpi
      logical :: WEST_INTER
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E) :: hbbl_avg
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E) :: hbbl
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E) :: hbl_avg
      integer(4), dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E) :: kbl
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:2) :: hbls
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,0:N) :: ghats
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,0:N,1:2) :: Akt
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,0:N) :: bvf
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,0:N) :: Akv
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:N) :: dRde
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:N) :: dRdx
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:N) :: diff3d_v
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:N) :: diff3d_u
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E) :: diff4_sponge
      real, dimension(1:NT) :: tnu4
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:NT) :: diff4
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E) :: diff2_sponge
      real, dimension(1:NT) :: tnu2
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:NT) :: diff2
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E) :: visc2_sponge_p
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E) :: visc2_sponge_r
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E) :: visc2_p
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E) :: visc2_r
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:Ntides) :: UV_Tmin
     &or
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:Ntides) :: UV_Tmaj
     &or
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:Ntides) :: UV_Tpha
     &se
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:Ntides) :: UV_Tang
     &le
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:Ntides) :: SSH_Tph
     &ase
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:Ntides) :: SSH_Tam
     &p
      real, dimension(1:Ntides) :: Tperiod
      real, dimension(-1:Lm+2+padd_X,1:N,1:NT) :: tbry_north
      real, dimension(-1:Lm+2+padd_X,1:N) :: vbry_north
      real, dimension(-1:Lm+2+padd_X,1:N) :: ubry_north
      real, dimension(-1:Lm+2+padd_X) :: vbarbry_north
      real, dimension(-1:Lm+2+padd_X) :: ubarbry_north
      real, dimension(-1:Lm+2+padd_X) :: zetabry_north
      real, dimension(-1:Lm+2+padd_X,1:N,1:NT) :: tbry_south
      real, dimension(-1:Lm+2+padd_X,1:N) :: vbry_south
      real, dimension(-1:Lm+2+padd_X,1:N) :: ubry_south
      real, dimension(-1:Lm+2+padd_X) :: vbarbry_south
      real, dimension(-1:Lm+2+padd_X) :: ubarbry_south
      real, dimension(-1:Lm+2+padd_X) :: zetabry_south
      real, dimension(-1:Mm+2+padd_E,1:N,1:NT) :: tbry_east
      real, dimension(-1:Mm+2+padd_E,1:N) :: vbry_east
      real, dimension(-1:Mm+2+padd_E,1:N) :: ubry_east
      real, dimension(-1:Mm+2+padd_E) :: vbarbry_east
      real, dimension(-1:Mm+2+padd_E) :: ubarbry_east
      real, dimension(-1:Mm+2+padd_E) :: zetabry_east
      real, dimension(-1:Mm+2+padd_E,1:N,1:NT) :: tbry_west
      real, dimension(-1:Mm+2+padd_E,1:N) :: vbry_west
      real, dimension(-1:Mm+2+padd_E,1:N) :: ubry_west
      real, dimension(-1:Mm+2+padd_E) :: vbarbry_west
      real, dimension(-1:Mm+2+padd_E) :: ubarbry_west
      real, dimension(-1:Mm+2+padd_E) :: zetabry_west
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:2) :: srflxg
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E) :: srflx_avg
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E) :: srflx
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:2) :: sssg
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E) :: sss
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:2) :: sstg
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:2) :: dqdtg
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E) :: sst
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E) :: dqdt
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:NT) :: btflx
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:2,1:NT) :: stflxg
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:NT) :: stflx_avg
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:NT) :: stflx
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:2) :: bvstrg
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:2) :: bustrg
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E) :: svstr_avg
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E) :: sustr_avg
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E) :: wstr_avg
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E) :: bostr_avg
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E) :: bvstr
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E) :: bustr
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:2) :: svstrg
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:2) :: sustrg
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E) :: svstr
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E) :: sustr
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:N,1:NT) :: t_avg
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:N,1:3,1:NT) :: t
      logical, dimension(1:NT) :: got_tini
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,0:N) :: bvf_avg
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,0:N) :: omega_avg
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,0:N) :: We
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:N) :: w_avg
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:N) :: v_avg
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:N) :: u_avg
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:N) :: rho_avg
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:N) :: rho
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:N,1:3) :: v
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:N,1:3) :: u
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E) :: DV_avg2
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E) :: DU_avg2
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:5) :: DV_avg1
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:5) :: DU_avg1
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E) :: Zt_avg1
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:2) :: rvfrc_bak
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:2) :: rufrc_bak
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E) :: rufrc
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E) :: vbar_avg
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E) :: ubar_avg
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E) :: zeta_avg
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:4) :: vbar
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:4) :: ubar
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:4) :: zeta
      integer(4) :: Istr
      integer(4) :: Iend
      integer(4) :: Jstr
      integer(4) :: Jend
        end subroutine Sub_Loop_init_arrays_tile

      end interface
      integer(4) :: Istr
      integer(4) :: Iend
      integer(4) :: Jstr
      integer(4) :: Jend
      

        call Sub_Loop_init_arrays_tile(Istr,Iend,Jstr,Jend, Agrif_tabvar
     &s_i(14)%iarray0, Agrif_tabvars_i(4)%iarray0, Agrif_tabvars_i(13)%i
     &array0, Agrif_tabvars_i(2)%iarray0, Agrif_tabvars(279)%array2, Agr
     &if_tabvars(134)%array2, Agrif_tabvars(280)%array2, Agrif_tabvars_i
     &(249)%iarray2, Agrif_tabvars(133)%array3, Agrif_tabvars(132)%array
     &3, Agrif_tabvars(137)%array4, Agrif_tabvars(136)%array3, Agrif_tab
     &vars(138)%array3, Agrif_tabvars(140)%array3, Agrif_tabvars(141)%ar
     &ray3, Agrif_tabvars(142)%array3, Agrif_tabvars(143)%array3, Agrif_
     &tabvars(145)%array2, Agrif_tabvars(6)%array1, Agrif_tabvars(144)%a
     &rray3, Agrif_tabvars(147)%array2, Agrif_tabvars(5)%array1, Agrif_t
     &abvars(146)%array3, Agrif_tabvars(148)%array2, Agrif_tabvars(149)%
     &array2, Agrif_tabvars(150)%array2, Agrif_tabvars_r(20)%array0, Agr
     &if_tabvars(151)%array2, Agrif_tabvars(229)%array3, Agrif_tabvars(2
     &30)%array3, Agrif_tabvars(228)%array3, Agrif_tabvars(231)%array3, 
     &Agrif_tabvars(232)%array3, Agrif_tabvars(233)%array3, Agrif_tabvar
     &s(234)%array1, Agrif_tabvars(177)%array3, Agrif_tabvars(179)%array
     &2, Agrif_tabvars(181)%array2, Agrif_tabvars(183)%array1, Agrif_tab
     &vars(185)%array1, Agrif_tabvars(187)%array1, Agrif_tabvars(189)%ar
     &ray3, Agrif_tabvars(191)%array2, Agrif_tabvars(193)%array2, Agrif_
     &tabvars(195)%array1, Agrif_tabvars(197)%array1, Agrif_tabvars(199)
     &%array1, Agrif_tabvars(201)%array3, Agrif_tabvars(203)%array2, Agr
     &if_tabvars(205)%array2, Agrif_tabvars(207)%array1, Agrif_tabvars(2
     &09)%array1, Agrif_tabvars(211)%array1, Agrif_tabvars(213)%array3, 
     &Agrif_tabvars(215)%array2, Agrif_tabvars(217)%array2, Agrif_tabvar
     &s(219)%array1, Agrif_tabvars(221)%array1, Agrif_tabvars(223)%array
     &1, Agrif_tabvars(238)%array3, Agrif_tabvars(290)%array2, Agrif_tab
     &vars(242)%array2, Agrif_tabvars(245)%array3, Agrif_tabvars(246)%ar
     &ray2, Agrif_tabvars(250)%array3, Agrif_tabvars(251)%array3, Agrif_
     &tabvars(252)%array2, Agrif_tabvars(253)%array2, Agrif_tabvars(254)
     &%array3, Agrif_tabvars(259)%array4, Agrif_tabvars(282)%array3, Agr
     &if_tabvars(260)%array3, Agrif_tabvars(265)%array3, Agrif_tabvars(2
     &66)%array3, Agrif_tabvars(291)%array2, Agrif_tabvars(292)%array2, 
     &Agrif_tabvars(293)%array2, Agrif_tabvars(296)%array2, Agrif_tabvar
     &s(267)%array2, Agrif_tabvars(268)%array2, Agrif_tabvars(272)%array
     &3, Agrif_tabvars(273)%array3, Agrif_tabvars(274)%array2, Agrif_tab
     &vars(275)%array2, Agrif_tabvars(287)%array4, Agrif_tabvars(162)%ar
     &ray5, Agrif_tabvars_l(5)%larray1, Agrif_tabvars(284)%array3, Agrif
     &_tabvars(285)%array3, Agrif_tabvars(155)%array3, Agrif_tabvars(283
     &)%array3, Agrif_tabvars(288)%array3, Agrif_tabvars(289)%array3, Ag
     &rif_tabvars(286)%array3, Agrif_tabvars(153)%array3, Agrif_tabvars(
     &163)%array4, Agrif_tabvars(164)%array4, Agrif_tabvars(165)%array2,
     & Agrif_tabvars(166)%array2, Agrif_tabvars(167)%array3, Agrif_tabva
     &rs(168)%array3, Agrif_tabvars(169)%array2, Agrif_tabvars(170)%arra
     &y3, Agrif_tabvars(171)%array3, Agrif_tabvars(173)%array2, Agrif_ta
     &bvars(297)%array2, Agrif_tabvars(298)%array2, Agrif_tabvars(299)%a
     &rray2, Agrif_tabvars(86)%array3, Agrif_tabvars(87)%array3, Agrif_t
     &abvars(88)%array3, Agrif_tabvars_l(13)%larray0, Agrif_tabvars_i(8)
     &%iarray0, Agrif_tabvars_l(14)%larray0, Agrif_tabvars_l(11)%larray0
     &, Agrif_tabvars_i(7)%iarray0, Agrif_tabvars_l(12)%larray0)

      end


      subroutine Sub_Loop_init_arrays_tile(Istr,Iend,Jstr,Jend,padd_E,Mm
     &,padd_X,Lm,hbbl_avg,hbbl,hbl_avg,kbl,hbls,ghats,Akt,bvf,Akv,dRde,d
     &Rdx,diff3d_v,diff3d_u,diff4_sponge,tnu4,diff4,diff2_sponge,tnu2,di
     &ff2,visc2_sponge_p,visc2_sponge_r,visc2_p,visc2,visc2_r,UV_Tminor,
     &UV_Tmajor,UV_Tphase,UV_Tangle,SSH_Tphase,SSH_Tamp,Tperiod,tbry_nor
     &th,vbry_north,ubry_north,vbarbry_north,ubarbry_north,zetabry_north
     &,tbry_south,vbry_south,ubry_south,vbarbry_south,ubarbry_south,zeta
     &bry_south,tbry_east,vbry_east,ubry_east,vbarbry_east,ubarbry_east,
     &zetabry_east,tbry_west,vbry_west,ubry_west,vbarbry_west,ubarbry_we
     &st,zetabry_west,srflxg,srflx_avg,srflx,sssg,sss,sstg,dqdtg,sst,dqd
     &t,btflx,stflxg,stflx_avg,stflx,bvstrg,bustrg,svstr_avg,sustr_avg,w
     &str_avg,bostr_avg,bvstr,bustr,svstrg,sustrg,svstr,sustr,t_avg,t,go
     &t_tini,bvf_avg,omega_avg,We,w_avg,v_avg,u_avg,rho_avg,rho,v,u,DV_a
     &vg2,DU_avg2,DV_avg1,DU_avg1,Zt_avg1,rvfrc_bak,rufrc_bak,rufrc,vbar
     &_avg,ubar_avg,zeta_avg,vbar,ubar,zeta,NORTH_INTER,Mmmpi,SOUTH_INTE
     &R,EAST_INTER,Lmmpi,WEST_INTER)

      use Agrif_Types, only : Agrif_tabvars


      include 'mpif.h'
      integer(4), parameter :: LLm0 = 41
      integer(4), parameter :: MMm0 = 42
      integer(4), parameter :: N = 32
      integer(4), parameter :: N_sl = 0
      integer(4), parameter :: NP_XI = 1
      integer(4), parameter :: NP_ETA = 4
      integer(4), parameter :: NNODES = NP_XI*NP_ETA
      integer(4), parameter :: NPP = 1
      integer(4), parameter :: NSUB_X = 1
      integer(4), parameter :: NSUB_E = 1
      integer(4), parameter :: NWEIGHT = 1000
      integer(4), parameter :: Ntides = 8
      integer(4), parameter :: stdout = 6
      integer(4), parameter :: Np = N+1
      integer(4), parameter :: NpHz = (N+1+N_sl)
      integer(4), parameter :: NSA = 28
      real, parameter :: Vtransform = 2
      integer(4), parameter :: itemp = 1
      integer(4), parameter :: ntrc_temp = 1
      integer(4), parameter :: ntrc_salt = 1
      integer(4), parameter :: ntrc_pas = 0
      integer(4), parameter :: ntrc_bio = 0
      integer(4), parameter :: ntrc_subs = 0
      integer(4), parameter :: ntrc_substot = 0
      integer(4), parameter :: ntrc_sed = 0
      integer(4), parameter :: NTA = itemp+ntrc_salt
      integer(4), parameter :: NT = itemp+ntrc_salt+ntrc_pas+ntrc_bio+nt
     &rc_sed
      integer(4), parameter :: NTot = NT
      integer(4), parameter :: isalt = itemp+1
      integer(4), parameter :: ntrc_diabio = 0
      integer(4), parameter :: ntrc_diats = 0
      integer(4), parameter :: ntrc_diauv = 0
      integer(4), parameter :: ntrc_diavrt = 0
      integer(4), parameter :: ntrc_diaek = 0
      integer(4), parameter :: ntrc_diapv = 0
      integer(4), parameter :: ntrc_diaeddy = 0
      integer(4), parameter :: ntrc_surf = 0
      integer(4), parameter :: filetype_his = 1
      integer(4), parameter :: filetype_avg = 2
      integer(4), parameter :: filetype_dia = 3
      integer(4), parameter :: filetype_dia_avg = 4
      integer(4), parameter :: filetype_diaM = 5
      integer(4), parameter :: filetype_diaM_avg = 6
      integer(4), parameter :: filetype_diags_vrt = 7
      integer(4), parameter :: filetype_diags_vrt_avg = 8
      integer(4), parameter :: filetype_diags_ek = 9
      integer(4), parameter :: filetype_diags_ek_avg = 10
      integer(4), parameter :: filetype_diags_pv = 11
      integer(4), parameter :: filetype_diags_pv_avg = 12
      integer(4), parameter :: filetype_diags_eddy_avg = 17
      integer(4), parameter :: filetype_surf = 13
      integer(4), parameter :: filetype_surf_avg = 14
      integer(4), parameter :: filetype_diabio = 15
      integer(4), parameter :: filetype_diabio_avg = 16
      integer(4), parameter :: filetype_abl = 18
      integer(4), parameter :: filetype_abl_avg = 19
      integer(4), parameter :: indxTime = 1
      integer(4), parameter :: indxZ = 2
      integer(4), parameter :: indxUb = 3
      integer(4), parameter :: indxVb = 4
      integer(4), parameter :: indxU = 6
      integer(4), parameter :: indxV = 7
      integer(4), parameter :: indxT = indxV+1
      integer(4), parameter :: indxS = indxV+ntrc_temp+1
      integer(4), parameter :: indxBSD = indxV+ntrc_temp+ntrc_salt+ntrc_
     &pas+ntrc_bio+1
      integer(4), parameter :: indxBSS = 101
      integer(4), parameter :: indxO = indxV+ntrc_temp+ntrc_salt+ntrc_pa
     &s+ntrc_bio+ntrc_sed+ntrc_substot+ntrc_diats+ntrc_diauv+ntrc_diavrt
     &+ntrc_diaek+ntrc_diapv+ntrc_diaeddy+ntrc_surf+ntrc_diabio+1
      integer(4), parameter :: indxW = indxO+1
      integer(4), parameter :: indxR = indxO+2
      integer(4), parameter :: indxVisc = indxO+3
      integer(4), parameter :: indxDiff = indxO+4
      integer(4), parameter :: indxAkv = indxO+5
      integer(4), parameter :: indxAkt = indxO+6
      integer(4), parameter :: indxAks = indxAkv+ntrc_temp+4
      integer(4), parameter :: indxHbl = indxAkv+ntrc_temp+5
      integer(4), parameter :: indxHbbl = indxAkv+ntrc_temp+6
      integer(4), parameter :: indxSSH = indxAkv+ntrc_temp+12
      integer(4), parameter :: indxbvf = indxSSH+1
      integer(4), parameter :: indxSUSTR = indxSSH+2
      integer(4), parameter :: indxSVSTR = indxSSH+3
      integer(4), parameter :: indxTime2 = indxSSH+4
      integer(4), parameter :: indxShflx = indxSUSTR+5
      integer(4), parameter :: indxSwflx = indxShflx+1
      integer(4), parameter :: indxShflx_rsw = indxShflx+2
      integer(4), parameter :: indxSST = indxShflx_rsw+1
      integer(4), parameter :: indxdQdSST = indxShflx_rsw+2
      integer(4), parameter :: indxSSS = indxSST+2
      integer(4), parameter :: indxWstr = indxSUSTR+23
      integer(4), parameter :: indxUWstr = indxSUSTR+24
      integer(4), parameter :: indxVWstr = indxSUSTR+25
      integer(4), parameter :: indxBostr = indxSUSTR+26
      integer(4), parameter :: indxBustr = indxSUSTR+27
      integer(4), parameter :: indxBvstr = indxBustr+1
      integer(4), parameter :: indxWWA = indxSUSTR+42
      integer(4), parameter :: indxWWD = indxWWA+1
      integer(4), parameter :: indxWWP = indxWWA+2
      integer(4), parameter :: r2dvar = 0
      integer(4), parameter :: u2dvar = 1
      integer(4), parameter :: v2dvar = 2
      integer(4), parameter :: p2dvar = 3
      integer(4), parameter :: r3dvar = 4
      integer(4), parameter :: u3dvar = 5
      integer(4), parameter :: v3dvar = 6
      integer(4), parameter :: p3dvar = 7
      integer(4), parameter :: w3dvar = 8
      integer(4), parameter :: pw3dvar = 11
      integer(4), parameter :: b3dvar = 12
      real, parameter :: qp2 = 0.0000172D0
      real, parameter :: Gslope_max = 1.D0
      real, parameter :: Rslope_max = 0.05D0
      real, parameter :: pi = 3.14159265358979323846D0
      real, parameter :: deg2rad = pi/180.D0
      real, parameter :: rad2deg = 180.D0/pi
      real, parameter :: Eradius = 6371315.0D0
      real, parameter :: Erotation = 7.292115090D-5
      real, parameter :: day2sec = 86400.D0
      real, parameter :: sec2day = 1.D0/86400.D0
      real, parameter :: year2day = 365.25D0
      real, parameter :: day2year = 1.D0/365.25D0
      real, parameter :: jul_off = 2440000.D0
      real, parameter :: g = 9.81D0
      real, parameter :: Cp = 3985.0D0
      real, parameter :: vonKar = 0.41D0
      real, parameter :: spval = -999.0D0
      logical, parameter :: mask_val = .true.
      real, parameter :: init = 0.D0
      integer(4) :: padd_E
      integer(4) :: Mm
      integer(4) :: padd_X
      integer(4) :: Lm
      real :: visc2
      logical :: NORTH_INTER
      integer(4) :: Mmmpi
      logical :: SOUTH_INTER
      logical :: EAST_INTER
      integer(4) :: Lmmpi
      logical :: WEST_INTER
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E) :: hbbl_avg
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E) :: hbbl
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E) :: hbl_avg
      integer(4), dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E) :: kbl
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:2) :: hbls
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,0:N) :: ghats
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,0:N,1:2) :: Akt
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,0:N) :: bvf
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,0:N) :: Akv
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:N) :: dRde
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:N) :: dRdx
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:N) :: diff3d_v
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:N) :: diff3d_u
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E) :: diff4_sponge
      real, dimension(1:NT) :: tnu4
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:NT) :: diff4
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E) :: diff2_sponge
      real, dimension(1:NT) :: tnu2
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:NT) :: diff2
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E) :: visc2_sponge_p
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E) :: visc2_sponge_r
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E) :: visc2_p
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E) :: visc2_r
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:Ntides) :: UV_Tmin
     &or
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:Ntides) :: UV_Tmaj
     &or
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:Ntides) :: UV_Tpha
     &se
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:Ntides) :: UV_Tang
     &le
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:Ntides) :: SSH_Tph
     &ase
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:Ntides) :: SSH_Tam
     &p
      real, dimension(1:Ntides) :: Tperiod
      real, dimension(-1:Lm+2+padd_X,1:N,1:NT) :: tbry_north
      real, dimension(-1:Lm+2+padd_X,1:N) :: vbry_north
      real, dimension(-1:Lm+2+padd_X,1:N) :: ubry_north
      real, dimension(-1:Lm+2+padd_X) :: vbarbry_north
      real, dimension(-1:Lm+2+padd_X) :: ubarbry_north
      real, dimension(-1:Lm+2+padd_X) :: zetabry_north
      real, dimension(-1:Lm+2+padd_X,1:N,1:NT) :: tbry_south
      real, dimension(-1:Lm+2+padd_X,1:N) :: vbry_south
      real, dimension(-1:Lm+2+padd_X,1:N) :: ubry_south
      real, dimension(-1:Lm+2+padd_X) :: vbarbry_south
      real, dimension(-1:Lm+2+padd_X) :: ubarbry_south
      real, dimension(-1:Lm+2+padd_X) :: zetabry_south
      real, dimension(-1:Mm+2+padd_E,1:N,1:NT) :: tbry_east
      real, dimension(-1:Mm+2+padd_E,1:N) :: vbry_east
      real, dimension(-1:Mm+2+padd_E,1:N) :: ubry_east
      real, dimension(-1:Mm+2+padd_E) :: vbarbry_east
      real, dimension(-1:Mm+2+padd_E) :: ubarbry_east
      real, dimension(-1:Mm+2+padd_E) :: zetabry_east
      real, dimension(-1:Mm+2+padd_E,1:N,1:NT) :: tbry_west
      real, dimension(-1:Mm+2+padd_E,1:N) :: vbry_west
      real, dimension(-1:Mm+2+padd_E,1:N) :: ubry_west
      real, dimension(-1:Mm+2+padd_E) :: vbarbry_west
      real, dimension(-1:Mm+2+padd_E) :: ubarbry_west
      real, dimension(-1:Mm+2+padd_E) :: zetabry_west
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:2) :: srflxg
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E) :: srflx_avg
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E) :: srflx
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:2) :: sssg
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E) :: sss
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:2) :: sstg
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:2) :: dqdtg
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E) :: sst
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E) :: dqdt
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:NT) :: btflx
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:2,1:NT) :: stflxg
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:NT) :: stflx_avg
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:NT) :: stflx
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:2) :: bvstrg
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:2) :: bustrg
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E) :: svstr_avg
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E) :: sustr_avg
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E) :: wstr_avg
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E) :: bostr_avg
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E) :: bvstr
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E) :: bustr
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:2) :: svstrg
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:2) :: sustrg
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E) :: svstr
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E) :: sustr
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:N,1:NT) :: t_avg
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:N,1:3,1:NT) :: t
      logical, dimension(1:NT) :: got_tini
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,0:N) :: bvf_avg
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,0:N) :: omega_avg
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,0:N) :: We
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:N) :: w_avg
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:N) :: v_avg
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:N) :: u_avg
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:N) :: rho_avg
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:N) :: rho
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:N,1:3) :: v
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:N,1:3) :: u
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E) :: DV_avg2
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E) :: DU_avg2
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:5) :: DV_avg1
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:5) :: DU_avg1
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E) :: Zt_avg1
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:2) :: rvfrc_bak
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:2) :: rufrc_bak
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E) :: rufrc
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E) :: vbar_avg
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E) :: ubar_avg
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E) :: zeta_avg
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:4) :: vbar
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:4) :: ubar
      real, dimension(-1:Lm+2+padd_X,-1:Mm+2+padd_E,1:4) :: zeta
      integer(4) :: Istr
      integer(4) :: Iend
      integer(4) :: Jstr
      integer(4) :: Jend

                                            
                             
                                            

                                                             
                     
                        

                                                            
                                           
                                                               
                                    
                                      
                                                          

                       

                                    

                        
                              

                       
                          

                                                
                                             
                          

                        

                                 

                                                
                        

                                                              
                      
                              

                                       
                                                                     
                                          
                         

                             

                             

                            

                            

                                             

                            

                                     

                                                               

                         

                                                      
                                                      
                                                                  
                               

                               

                              

                              

                               

                              

                              

                                

                             

                                                                       
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                      
                                                                       
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                         

                                 
      integer(4) :: iloop
      integer(4) :: indextemp
                                                
                                                         

                             
                                  

                      
                               

                      
                                         

                                 
                                                                       
                                                                 
                              

                                                                       
                                                                 
                                                                 
    
                                                                       
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                 

                        
                                             

                        
                                             

                         
                                              

                        
                                              

                        
                                   

                                     
                                                          

                          
                                     

                                         
                                       

                          
                                                                  

                                    
                                                                     

                        
                                   

                         
                                       

                          
                                        

                          
                                        

                          
                                        

                                     
                                                                

                                                                
      integer(4) :: indxWEB
      integer(4) :: indxWED
      integer(4) :: indxWER
                                                                       
                                                                 
                                                          

                                                                       
                                                                 
                                                                 
            
                                                                       
                                                                 
                                                                 
       

                                           
                                                       
                                                                       
                                                                 
                                                                 
                              
                                                                       
                                                                 
    
                                                                       
                                                                 
                                                                 
                    
                         
                       
                        
                                                                       
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                   
                         
                                                                       
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                      
                         
                                                            
                                                                       
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                       
                                   
                                                                 
                                                                       
                                                                 
                                                                 
                                                                 
                               
                                                                  
                                                                       
                                                                 
                                                                 
                                                                 
                                                                 
     
                                    
                                                                       
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
               
                                            
                                               
                                            
                                               
                                                                 
                                                 
                                 
                                               
                                               
                                               
                                               
                                               
                                               
                                             
                                             
                                             
                                             
                                             
                                               
                                               
                                               
                                               
                                               
                                               
                                               
                                               
                                               
                                               
                                               
                                               
                                              
                                                  
                                                  
                                                  
                                                  
                                                 
                                                 
                                               
                                               
                                                      
                                                 
                                                 
                                                 
                                                 
                                                 
                                                 
                                                 
                                                           
                                                           
                                                           
                                    
                                                
                                                
                                                
                                                
                                                 
                           
                           
                           
                           
                             
                                              
                          
                                                 
                                                 
                                                 
                              
                              
                              
                                                
                                                
                                                   
                                              
                                               
                                                   
                                                
                                                  
                                                 
                                                 
                                                              
                             
                                                 
                                                  
                                                 
                                                
                                             
                                                
                            
               
                                 

                                               
                                               
                                                       
                                                
                                                
                                                      
                                                      
                               
                               
                                       
                                       
                                                  
                                                    
                                                    
                                                  
                                                  
                                    
                                   
                                   
                                   
                                   
                                                   
                                                   
                                                   
                                                                       
                                                                 
                         
                                                    
                                  
                                                    
                                  
                                                    
                                  
                                                   
                                
                                                    
                                  
                                                    
                                  
                                                    
                                  
                                                  
                                                  
                                                     
                                                    
                                                      
                                                        
                                                  
                                                                       
                                                                 
                                                                 
                       
                                                       
                                  
                                                       
                                  
                                                  
                              
                                                   
                                
                                                       
                                    
                                                      
                                                        
                                               
                                                
                                                
                                                     
                                                   
                                                   
                                                         
                                                
                                   
                                                    
                                              
                                     
                                                
                                              
                                            
                                                           
                                                     
                           
                                  
                                                
                                                
                                                     
                                                   
                                                   
                                                         
                                                           
                                                         
                                                              
                                                           
                                                                
                                                                   
                                                                    
                                                                   
                                                   
                                 
                                                      
                                   
                                        
                                        
                                                       
                                                     
                                             
                                                               
                                              
                                                           
                                        
                                                   
                                 
                                               
                               
                                              
                             
                                                  
                                                 
                                                   
                                             
                                 
                                                              
                                                  
                                             
                                                                    
                                          
                                                                   
                                                   
                                              
                             
                                                 
                               
                                 
                     
                                                              
                                     
                                             
                                                                       
                                                                 
 
                                                                   
                                           
                                                
                                 
                                                  
                                                  
                                                  
                                                   
                                                   
                                   
                                 
                                
                                           
                                         
                                             
                                                              
                                              
                                                                       
                                                  
                                                  
                                                         
                                                         
                                                             
                                                   
                                                   
                                                       
                                                   
                                               
                                 
                                                       
                                                   
                                               
                                 
                                                     
                                                     
                                       
                                       
                                                 
                                                 
                                                   
                               
                               
                               
                                 
                                                    

                        
                   
                                      
                                      
                                                  
                                                    
                                             
                                                  
                              
                                                
                                  
                                                   
                                                    
                                               
                               
                                 
                                 
                                                 
                                
                                                    
                                  
                                              
                             
                                                                  
                                                                       
                                                                 
                                 
                                
                                                                       
                                                                 
                                                                 
                                                                 
                                                        
                                                                       
                                                                 
                                                                 
            
                                              
                                                   
                     
                              
                               
                                 
                                                  
                                                                       
                                                                 
                                                                 
                        
                      
                           
                                                                       
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                                 
                                                    
                           
                                      
                             
                                                 
                                                                       
                                                                 
                     
                                                      
                                                                       
                                                                 
              
                                          
                                                                       
                                                                 
       
                                                           
      real(8) :: Cu_Nbq_X
      real(8) :: Cu_Nbq_Y
      real(8) :: Cu_Nbq_Z
                                             
                                                                       
                                                                 
              
                                                  
                                                                       
                                                                 
              
                                  
                                           
                                                  
                                                                   
                                                               
                                                      
                                                                       
                                                                 
                      
                                                                       
                                                                 
                                                                 
                                                                 
                                                                 
                                                        
                                
                                                                       
                                                                 
                                                        

                                                                       
                                                                 
                  
                                                                       
                                                                 
                                                                 
                                                                 
                  

                          

              
                             

                  
                               

                 
                                

                       
                                   

                           
                                     
                                                          
                                       
                                                            
                                           
                                                           
                                         
                                                           
                                         
                                                           
                                         
                                                           
                                         
                                                          
                                       
                                                            
                                           
                                                
                                 
                           
                                    
                       
                                             
                                                                       
                                                                 
         
                     
                                          
                                                                       
                                                                       
                                                                 
                                                      
                                
                                            
                                                 
                                                             
                                           
                                                    
                                 
                                      
                                
                                            
                                                 
                                                             
                                           
                                                    
                                 
                                      
                                 
                                              
                                                   
                                                                
                                             
                                                       
                                  
                                        
                                 
                                              
                                                   
                                                                
                                             
                                                       
                                  
                                        
                                                                       
                                                                 
              
                                                           
                                                                       
                                                                 
                                                                 
                                  
                                                                       
                                                                 
                                                
                                                                       
                                                                 
                                                                 
                              
                                                                       
                                                                 
                              
                                                                       
                                                                 
                   
                                                  
                                                                       
                                                                 
              
                                                           
                                                                       
                                                                 
                                                                 
                                  
                                                                       
                                                                 
                                                
                                                                       
                                                                 
                                                                 
                              
                                                                       
                                                                 
                              
                                                                       
                                                                 
                  
                                                  
                                                                       
                                                                 
                
                                                              
                                                                       
                                                                 
                                                                 
                                      
                                                                       
                                                                 
                                                      
                                                                       
                                                                 
                                                                 
                                  
                                                                       
                                                                 
                                    
                                                                       
                                                                 
                    
                                                     
                                                                       
                                                                 
                
                                                              
                                                                       
                                                                 
                                                                 
                                      
                                                                       
                                                                 
                                                      
                                                                       
                                                                 
                                                                 
                                  
                                                                       
                                                                 
                                    
                                                                       
                                                                 
                    
                                                     
                                                                       
                                                                 
           
      integer(4) :: i
      integer(4) :: j
      integer(4) :: k
      integer(4) :: itrc
      integer(4) :: itide
                
                           

                       
                     
      integer(4) :: ierr
                                        
      integer(4) :: IstrR
      integer(4) :: IendR
      integer(4) :: JstrR
      integer(4) :: JendR
      if (Istr.eq.1) then
        if (WEST_INTER) then
          IstrR=Istr-2
        else
          IstrR=Istr-1
        endif
      else
        IstrR=Istr
      endif
      if (Iend.eq.Lmmpi) then
        if (EAST_INTER) then
          IendR=Iend+2
        else
          IendR=Iend+1
        endif
      else
        IendR=Iend
      endif
      if (Jstr.eq.1) then
        if (SOUTH_INTER) then
          JstrR=Jstr-2
        else
          JstrR=Jstr-1
        endif
      else
        JstrR=Jstr
      endif
      if (Jend.eq.Mmmpi) then
        if (NORTH_INTER) then
          JendR=Jend+2
        else
          JendR=Jend+1
        endif
      else
        JendR=Jend
      endif
      do j=JstrR,JendR
        do i=IstrR,IendR
          zeta(i,j,1)=0.D0
          zeta(i,j,2)=init
          zeta(i,j,3)=init
          zeta(i,j,4)=init
          ubar(i,j,1)=init
          ubar(i,j,2)=init
          ubar(i,j,3)=init
          ubar(i,j,4)=init
          vbar(i,j,1)=init
          vbar(i,j,2)=init
          vbar(i,j,3)=init
          vbar(i,j,4)=init
          zeta_avg(i,j)=init
          ubar_avg(i,j)=init
          vbar_avg(i,j)=init
          rufrc(i,j)=init
          rufrc(i,j)=init
          rufrc_bak(i,j,1)=init
          rvfrc_bak(i,j,1)=init
          rufrc_bak(i,j,2)=init
          rvfrc_bak(i,j,2)=init
          Zt_avg1(i,j)=0.D0
          DU_avg1(i,j,1)=0.D0
          DV_avg1(i,j,1)=0.D0
          DU_avg1(i,j,2)=0.D0
          DV_avg1(i,j,2)=0.D0
          DU_avg2(i,j)=0.D0
          DV_avg2(i,j)=0.D0
        enddo
      enddo
      do k=1,N
        do j=JstrR,JendR
          do i=IstrR,IendR
            u(i,j,k,1)=init
            u(i,j,k,2)=init
            v(i,j,k,1)=init
            v(i,j,k,2)=init
            rho(i,j,k) =init
            rho_avg(i,j,k)=init
            u_avg(i,j,k)=init
            v_avg(i,j,k)=init
            w_avg(i,j,k)=init
          enddo
        enddo
      enddo
      do k=0,N
        do j=JstrR,JendR
          do i=IstrR,IendR
             We(i,j,k)=init
            omega_avg(i,j,k)=init
            bvf_avg(i,j,k)=init
          enddo
        enddo
      enddo
      do itrc=1,NT
        got_tini(itrc)=.false.
        do k=1,N
          do j=JstrR,JendR
            do i=IstrR,IendR
              t(i,j,k,1,itrc)=init
              t(i,j,k,2,itrc)=init
              t_avg(i,j,k,itrc)=init
            enddo
          enddo
        enddo
      enddo
      do j=JstrR,JendR
        do i=IstrR,IendR
          sustr(i,j)=init
          svstr(i,j)=init
          sustrg(i,j,1)=init
          svstrg(i,j,1)=init
          sustrg(i,j,2)=init
          svstrg(i,j,2)=init
          bustr(i,j)=init
          bvstr(i,j)=init
          bostr_avg(i,j)=init
          wstr_avg(i,j)=init
          sustr_avg(i,j)=init
          svstr_avg(i,j)=init
          bustrg(i,j,1)=init
          bvstrg(i,j,1)=init
          bustrg(i,j,2)=init
          bvstrg(i,j,2)=init
        enddo
      enddo
      do itrc=1,NT
        do j=JstrR,JendR
          do i=IstrR,IendR
            stflx(i,j,itrc)=init
            stflx_avg(i,j,itrc)=init
            stflxg(i,j,1,itrc)=init
            stflxg(i,j,2,itrc)=init
            btflx(i,j,itrc)=init
          enddo
        enddo
      enddo
      do j=JstrR,JendR
        do i=IstrR,IendR
          dqdt(i,j)=init
          sst (i,j)=init
          dqdtg(i,j,1)=init
          sstg (i,j,1)=init
          dqdtg(i,j,2)=init
          sstg (i,j,2)=init
          sss (i,j)=init
          sssg (i,j,1)=init
          sssg (i,j,2)=init
          srflx(i,j)=init
          srflx_avg(i,j)=init
          srflxg(i,j,1)=init
          srflxg(i,j,2)=init
        enddo
      enddo
      if ((istr.eq.1 .and. .not.WEST_INTER)) then
        do j=JstrR,JendR
          zetabry_west(j)=init
        enddo
        do j=JstrR,JendR
          ubarbry_west(j)=init
          vbarbry_west(j)=init
        enddo
        do k=1,N
          do j=JstrR,JendR
            ubry_west(j,k)=init
            vbry_west(j,k)=init
            do itrc=1,NT
              tbry_west(j,k,itrc)=init
            enddo
          enddo
        enddo
      endif
      if ((iend.eq.Lmmpi .and. .not.EAST_INTER)) then
        do j=JstrR,JendR
          zetabry_east(j)=init
        enddo
        do j=JstrR,JendR
          ubarbry_east(j)=init
          vbarbry_east(j)=init
        enddo
        do k=1,N
          do j=JstrR,JendR
            ubry_east(j,k)=init
            vbry_east(j,k)=init
            do itrc=1,NT
              tbry_east(j,k,itrc)=init
            enddo
          enddo
        enddo
      endif
      if ((jstr.eq.1.and. .not.SOUTH_INTER)) then
        do i=IstrR,IendR
          zetabry_south(i)=init
        enddo
        do i=IstrR,IendR
          ubarbry_south(i)=init
          vbarbry_south(i)=init
        enddo
        do k=1,N
          do i=IstrR,IendR
            ubry_south(i,k)=init
            vbry_south(i,k)=init
            do itrc=1,NT
              tbry_south(i,k,itrc)=init
            enddo
          enddo
        enddo
      endif
      if ((jend.eq.Mmmpi .and. .not.NORTH_INTER)) then
        do i=IstrR,IendR
          zetabry_north(i)=init
        enddo
        do i=IstrR,IendR
          ubarbry_north(i)=init
          vbarbry_north(i)=init
        enddo
        do k=1,N
          do i=IstrR,IendR
            ubry_north(i,k)=init
            vbry_north(i,k)=init
            do itrc=1,NT
              tbry_north(i,k,itrc)=init
            enddo
          enddo
        enddo
      endif
      do itide=1,Ntides
        Tperiod(itide)=init
        do j=JstrR,JendR
          do i=IstrR,IendR
            SSH_Tamp(i,j,itide)=init
            SSH_Tphase(i,j,itide)=init
            UV_Tangle(i,j,itide)=init
            UV_Tphase(i,j,itide)=init
            UV_Tmajor(i,j,itide)=init
            UV_Tminor(i,j,itide)=init
          enddo
        enddo
      enddo
        do j=JstrR,JendR
          do i=IstrR,IendR
            visc2_r(i,j)=visc2
            visc2_p(i,j)=visc2
            visc2_sponge_r(i,j)=init
            visc2_sponge_p(i,j)=init
          enddo
        enddo
        do itrc=1,NT
          do j=JstrR,JendR
            do i=IstrR,IendR
              diff2(i,j,itrc)=tnu2(itrc)
            enddo
          enddo
        enddo
          do j=JstrR,JendR
            do i=IstrR,IendR
              diff2_sponge(i,j)=init
            enddo
          enddo
        do itrc=1,NT
          do j=JstrR,JendR
            do i=IstrR,IendR
              diff4(i,j,itrc)=tnu4(itrc)
            enddo
          enddo
        enddo
          do j=JstrR,JendR
            do i=IstrR,IendR
              diff4_sponge(i,j)=init
            enddo
          enddo
        do k=1,N
          do j=JstrR,JendR
            do i=IstrR,IendR
              diff3d_u(i,j,k)=init
              diff3d_v(i,j,k)=init
            enddo
          enddo
        enddo
        do k=1,N-1
          do j=JstrR,JendR
            do i=IstrR,IendR
              dRdx(i,j,k)=0.D0
              dRde(i,j,k)=0.D0
            enddo
          enddo
        enddo
      do k=0,N
        do j=JstrR,JendR
          do i=IstrR,IendR
            Akv(i,j,k)=init
            bvf(i,j,k)=init
          enddo
        enddo
        do j=JstrR,JendR
          do i=IstrR,IendR
              Akt(i,j,k,itemp)=init
              Akt(i,j,k,isalt)=init
          enddo
        enddo
      enddo
      do k=1,N
        do j=JstrR,JendR
          do i=IstrR,IendR
            ghats(i,j,k)=init
          enddo
        enddo
      enddo
      do j=JstrR,JendR
        do i=IstrR,IendR
          hbls(i,j,1)=init
          hbls(i,j,2)=init
          kbl(i,j)=init
          hbl_avg(i,j)=init
        enddo
      enddo
      do j=JstrR,JendR
        do i=IstrR,IendR
          hbbl(i,j)=init
          hbbl_avg(i,j)=init
        enddo
      enddo
      return
       
      

      end subroutine Sub_Loop_init_arrays_tile

      module tides_Ptide


        implicit none
        public :: Alloc_agrif_tides_Ptide
      contains
      subroutine Alloc_agrif_tides_Ptide(Agrif_Gr)
        use Agrif_Util
        type(Agrif_grid), pointer :: Agrif_Gr
        integer :: i
      !! ALLOCATION OF VARIABLE : Ptide
          if (.not. allocated(Agrif_Gr % tabvars(225)% array2)) then
          allocate(Agrif_Gr % tabvars(225)% array2(-1 :  Agrif_tabvars_i
     &(2)%iarray0+2+ Agrif_tabvars_i(13)%iarray0,-1 :  Agrif_tabvars_i(4
     &)%iarray0+2+ Agrif_tabvars_i(14)%iarray0))
          Agrif_Gr % tabvars(225)% array2 = 0
      endif
      end subroutine Alloc_agrif_tides_Ptide
      end module tides_Ptide
      module tides_POT_Tphase


        implicit none
        public :: Alloc_agrif_tides_POT_Tphase
      contains
      subroutine Alloc_agrif_tides_POT_Tphase(Agrif_Gr)
        use Agrif_Util
        type(Agrif_grid), pointer :: Agrif_Gr
        integer :: i
      integer(4), parameter :: Ntides = 8
      !! ALLOCATION OF VARIABLE : POT_Tphase
          if (.not. allocated(Agrif_Gr % tabvars(226)% array3)) then
          allocate(Agrif_Gr % tabvars(226)% array3(-1 :  Agrif_tabvars_i
     &(2)%iarray0+2+ Agrif_tabvars_i(13)%iarray0,-1 :  Agrif_tabvars_i(4
     &)%iarray0+2+ Agrif_tabvars_i(14)%iarray0,1 : Ntides))
          Agrif_Gr % tabvars(226)% array3 = 0
      endif
      end subroutine Alloc_agrif_tides_POT_Tphase
      end module tides_POT_Tphase
      module tides_POT_Tamp


        implicit none
        public :: Alloc_agrif_tides_POT_Tamp
      contains
      subroutine Alloc_agrif_tides_POT_Tamp(Agrif_Gr)
        use Agrif_Util
        type(Agrif_grid), pointer :: Agrif_Gr
        integer :: i
      integer(4), parameter :: Ntides = 8
      !! ALLOCATION OF VARIABLE : POT_Tamp
          if (.not. allocated(Agrif_Gr % tabvars(227)% array3)) then
          allocate(Agrif_Gr % tabvars(227)% array3(-1 :  Agrif_tabvars_i
     &(2)%iarray0+2+ Agrif_tabvars_i(13)%iarray0,-1 :  Agrif_tabvars_i(4
     &)%iarray0+2+ Agrif_tabvars_i(14)%iarray0,1 : Ntides))
          Agrif_Gr % tabvars(227)% array3 = 0
      endif
      end subroutine Alloc_agrif_tides_POT_Tamp
      end module tides_POT_Tamp
      module tides_UV_Tphase


        implicit none
        public :: Alloc_agrif_tides_UV_Tphase
      contains
      subroutine Alloc_agrif_tides_UV_Tphase(Agrif_Gr)
        use Agrif_Util
        type(Agrif_grid), pointer :: Agrif_Gr
        integer :: i
      integer(4), parameter :: Ntides = 8
      !! ALLOCATION OF VARIABLE : UV_Tphase
          if (.not. allocated(Agrif_Gr % tabvars(228)% array3)) then
          allocate(Agrif_Gr % tabvars(228)% array3(-1 :  Agrif_tabvars_i
     &(2)%iarray0+2+ Agrif_tabvars_i(13)%iarray0,-1 :  Agrif_tabvars_i(4
     &)%iarray0+2+ Agrif_tabvars_i(14)%iarray0,1 : Ntides))
          Agrif_Gr % tabvars(228)% array3 = 0
      endif
      end subroutine Alloc_agrif_tides_UV_Tphase
      end module tides_UV_Tphase
      module tides_UV_Tminor


        implicit none
        public :: Alloc_agrif_tides_UV_Tminor
      contains
      subroutine Alloc_agrif_tides_UV_Tminor(Agrif_Gr)
        use Agrif_Util
        type(Agrif_grid), pointer :: Agrif_Gr
        integer :: i
      integer(4), parameter :: Ntides = 8
      !! ALLOCATION OF VARIABLE : UV_Tminor
          if (.not. allocated(Agrif_Gr % tabvars(229)% array3)) then
          allocate(Agrif_Gr % tabvars(229)% array3(-1 :  Agrif_tabvars_i
     &(2)%iarray0+2+ Agrif_tabvars_i(13)%iarray0,-1 :  Agrif_tabvars_i(4
     &)%iarray0+2+ Agrif_tabvars_i(14)%iarray0,1 : Ntides))
          Agrif_Gr % tabvars(229)% array3 = 0
      endif
      end subroutine Alloc_agrif_tides_UV_Tminor
      end module tides_UV_Tminor
      module tides_UV_Tmajor


        implicit none
        public :: Alloc_agrif_tides_UV_Tmajor
      contains
      subroutine Alloc_agrif_tides_UV_Tmajor(Agrif_Gr)
        use Agrif_Util
        type(Agrif_grid), pointer :: Agrif_Gr
        integer :: i
      integer(4), parameter :: Ntides = 8
      !! ALLOCATION OF VARIABLE : UV_Tmajor
          if (.not. allocated(Agrif_Gr % tabvars(230)% array3)) then
          allocate(Agrif_Gr % tabvars(230)% array3(-1 :  Agrif_tabvars_i
     &(2)%iarray0+2+ Agrif_tabvars_i(13)%iarray0,-1 :  Agrif_tabvars_i(4
     &)%iarray0+2+ Agrif_tabvars_i(14)%iarray0,1 : Ntides))
          Agrif_Gr % tabvars(230)% array3 = 0
      endif
      end subroutine Alloc_agrif_tides_UV_Tmajor
      end module tides_UV_Tmajor
      module tides_UV_Tangle


        implicit none
        public :: Alloc_agrif_tides_UV_Tangle
      contains
      subroutine Alloc_agrif_tides_UV_Tangle(Agrif_Gr)
        use Agrif_Util
        type(Agrif_grid), pointer :: Agrif_Gr
        integer :: i
      integer(4), parameter :: Ntides = 8
      !! ALLOCATION OF VARIABLE : UV_Tangle
          if (.not. allocated(Agrif_Gr % tabvars(231)% array3)) then
          allocate(Agrif_Gr % tabvars(231)% array3(-1 :  Agrif_tabvars_i
     &(2)%iarray0+2+ Agrif_tabvars_i(13)%iarray0,-1 :  Agrif_tabvars_i(4
     &)%iarray0+2+ Agrif_tabvars_i(14)%iarray0,1 : Ntides))
          Agrif_Gr % tabvars(231)% array3 = 0
      endif
      end subroutine Alloc_agrif_tides_UV_Tangle
      end module tides_UV_Tangle
      module tides_SSH_Tphase


        implicit none
        public :: Alloc_agrif_tides_SSH_Tphase
      contains
      subroutine Alloc_agrif_tides_SSH_Tphase(Agrif_Gr)
        use Agrif_Util
        type(Agrif_grid), pointer :: Agrif_Gr
        integer :: i
      integer(4), parameter :: Ntides = 8
      !! ALLOCATION OF VARIABLE : SSH_Tphase
          if (.not. allocated(Agrif_Gr % tabvars(232)% array3)) then
          allocate(Agrif_Gr % tabvars(232)% array3(-1 :  Agrif_tabvars_i
     &(2)%iarray0+2+ Agrif_tabvars_i(13)%iarray0,-1 :  Agrif_tabvars_i(4
     &)%iarray0+2+ Agrif_tabvars_i(14)%iarray0,1 : Ntides))
          Agrif_Gr % tabvars(232)% array3 = 0
      endif
      end subroutine Alloc_agrif_tides_SSH_Tphase
      end module tides_SSH_Tphase
      module tides_SSH_Tamp


        implicit none
        public :: Alloc_agrif_tides_SSH_Tamp
      contains
      subroutine Alloc_agrif_tides_SSH_Tamp(Agrif_Gr)
        use Agrif_Util
        type(Agrif_grid), pointer :: Agrif_Gr
        integer :: i
      integer(4), parameter :: Ntides = 8
      !! ALLOCATION OF VARIABLE : SSH_Tamp
          if (.not. allocated(Agrif_Gr % tabvars(233)% array3)) then
          allocate(Agrif_Gr % tabvars(233)% array3(-1 :  Agrif_tabvars_i
     &(2)%iarray0+2+ Agrif_tabvars_i(13)%iarray0,-1 :  Agrif_tabvars_i(4
     &)%iarray0+2+ Agrif_tabvars_i(14)%iarray0,1 : Ntides))
          Agrif_Gr % tabvars(233)% array3 = 0
      endif
      end subroutine Alloc_agrif_tides_SSH_Tamp
      end module tides_SSH_Tamp
      module tides_Tperiod


        implicit none
        public :: Alloc_agrif_tides_Tperiod
      contains
      subroutine Alloc_agrif_tides_Tperiod(Agrif_Gr)
        use Agrif_Util
        type(Agrif_grid), pointer :: Agrif_Gr
        integer :: i
      integer(4), parameter :: Ntides = 8
      !! ALLOCATION OF VARIABLE : Tperiod
          if (.not. allocated(Agrif_Gr % tabvars(234)% array1)) then
          allocate(Agrif_Gr % tabvars(234)% array1(1 : Ntides))
          Agrif_Gr % tabvars(234)% array1 = 0
      endif
      end subroutine Alloc_agrif_tides_Tperiod
      end module tides_Tperiod
      module climat_ssh


        implicit none
        public :: Alloc_agrif_climat_ssh
      contains
      subroutine Alloc_agrif_climat_ssh(Agrif_Gr)
        use Agrif_Util
        type(Agrif_grid), pointer :: Agrif_Gr
        integer :: i
      !! ALLOCATION OF VARIABLE : ssh
          if (.not. allocated(Agrif_Gr % tabvars(235)% array2)) then
          allocate(Agrif_Gr % tabvars(235)% array2(-1 :  Agrif_tabvars_i
     &(2)%iarray0+2+ Agrif_tabvars_i(13)%iarray0,-1 :  Agrif_tabvars_i(4
     &)%iarray0+2+ Agrif_tabvars_i(14)%iarray0))
          Agrif_Gr % tabvars(235)% array2 = 0
      endif
      end subroutine Alloc_agrif_climat_ssh
      end module climat_ssh
      module srfdat1


        implicit none
        public :: Alloc_agrif_srfdat1
      contains
      subroutine Alloc_agrif_srfdat1(Agrif_Gr)
        use Agrif_Util
        type(Agrif_grid), pointer :: Agrif_Gr
        integer :: i
      !! ALLOCATION OF VARIABLE : srf_time
          if (.not. allocated(Agrif_Gr % tabvars(236)% array1)) then
          allocate(Agrif_Gr % tabvars(236)% array1(1 : 2))
          Agrif_Gr % tabvars(236)% array1 = 0
      endif
      !! ALLOCATION OF VARIABLE : srflxp
          if (.not. allocated(Agrif_Gr % tabvars(237)% array1)) then
          allocate(Agrif_Gr % tabvars(237)% array1(1 : 2))
          Agrif_Gr % tabvars(237)% array1 = 0
      endif
      end subroutine Alloc_agrif_srfdat1
      end module srfdat1
      module srfdat_srflxg


        implicit none
        public :: Alloc_agrif_srfdat_srflxg
      contains
      subroutine Alloc_agrif_srfdat_srflxg(Agrif_Gr)
        use Agrif_Util
        type(Agrif_grid), pointer :: Agrif_Gr
        integer :: i
      !! ALLOCATION OF VARIABLE : srflxg
          if (.not. allocated(Agrif_Gr % tabvars(238)% array3)) then
          allocate(Agrif_Gr % tabvars(238)% array3(-1 :  Agrif_tabvars_i
     &(2)%iarray0+2+ Agrif_tabvars_i(13)%iarray0,-1 :  Agrif_tabvars_i(4
     &)%iarray0+2+ Agrif_tabvars_i(14)%iarray0,1 : 2))
          Agrif_Gr % tabvars(238)% array3 = 0
      endif
      end subroutine Alloc_agrif_srfdat_srflxg
      end module srfdat_srflxg
      module diu_srflx


        implicit none
        public :: Alloc_agrif_diu_srflx
      contains
      subroutine Alloc_agrif_diu_srflx(Agrif_Gr)
        use Agrif_Util
        type(Agrif_grid), pointer :: Agrif_Gr
        integer :: i
      !! ALLOCATION OF VARIABLE : tan_phi
          if (.not. allocated(Agrif_Gr % tabvars(239)% array2)) then
          allocate(Agrif_Gr % tabvars(239)% array2(-1 :  Agrif_tabvars_i
     &(2)%iarray0+2+ Agrif_tabvars_i(13)%iarray0,-1 :  Agrif_tabvars_i(4
     &)%iarray0+2+ Agrif_tabvars_i(14)%iarray0))
          Agrif_Gr % tabvars(239)% array2 = 0
      endif
      !! ALLOCATION OF VARIABLE : cos_phi
          if (.not. allocated(Agrif_Gr % tabvars(240)% array2)) then
          allocate(Agrif_Gr % tabvars(240)% array2(-1 :  Agrif_tabvars_i
     &(2)%iarray0+2+ Agrif_tabvars_i(13)%iarray0,-1 :  Agrif_tabvars_i(4
     &)%iarray0+2+ Agrif_tabvars_i(14)%iarray0))
          Agrif_Gr % tabvars(240)% array2 = 0
      endif
      !! ALLOCATION OF VARIABLE : sin_phi
          if (.not. allocated(Agrif_Gr % tabvars(241)% array2)) then
          allocate(Agrif_Gr % tabvars(241)% array2(-1 :  Agrif_tabvars_i
     &(2)%iarray0+2+ Agrif_tabvars_i(13)%iarray0,-1 :  Agrif_tabvars_i(4
     &)%iarray0+2+ Agrif_tabvars_i(14)%iarray0))
          Agrif_Gr % tabvars(241)% array2 = 0
      endif
      end subroutine Alloc_agrif_diu_srflx
      end module diu_srflx
      module forces_srflx


        implicit none
        public :: Alloc_agrif_forces_srflx
      contains
      subroutine Alloc_agrif_forces_srflx(Agrif_Gr)
        use Agrif_Util
        type(Agrif_grid), pointer :: Agrif_Gr
        integer :: i
      !! ALLOCATION OF VARIABLE : srflx
          if (.not. allocated(Agrif_Gr % tabvars(242)% array2)) then
          allocate(Agrif_Gr % tabvars(242)% array2(-1 :  Agrif_tabvars_i
     &(2)%iarray0+2+ Agrif_tabvars_i(13)%iarray0,-1 :  Agrif_tabvars_i(4
     &)%iarray0+2+ Agrif_tabvars_i(14)%iarray0))
          Agrif_Gr % tabvars(242)% array2 = 0
      endif
      end subroutine Alloc_agrif_forces_srflx
      end module forces_srflx
      module sssdat1


        implicit none
        public :: Alloc_agrif_sssdat1
      contains
      subroutine Alloc_agrif_sssdat1(Agrif_Gr)
        use Agrif_Util
        type(Agrif_grid), pointer :: Agrif_Gr
        integer :: i
      !! ALLOCATION OF VARIABLE : sss_time
          if (.not. allocated(Agrif_Gr % tabvars(243)% array1)) then
          allocate(Agrif_Gr % tabvars(243)% array1(1 : 2))
          Agrif_Gr % tabvars(243)% array1 = 0
      endif
      !! ALLOCATION OF VARIABLE : sssp
          if (.not. allocated(Agrif_Gr % tabvars(244)% array1)) then
          allocate(Agrif_Gr % tabvars(244)% array1(1 : 2))
          Agrif_Gr % tabvars(244)% array1 = 0
      endif
      end subroutine Alloc_agrif_sssdat1
      end module sssdat1
      module sssdat_sssg


        implicit none
        public :: Alloc_agrif_sssdat_sssg
      contains
      subroutine Alloc_agrif_sssdat_sssg(Agrif_Gr)
        use Agrif_Util
        type(Agrif_grid), pointer :: Agrif_Gr
        integer :: i
      !! ALLOCATION OF VARIABLE : sssg
          if (.not. allocated(Agrif_Gr % tabvars(245)% array3)) then
          allocate(Agrif_Gr % tabvars(245)% array3(-1 :  Agrif_tabvars_i
     &(2)%iarray0+2+ Agrif_tabvars_i(13)%iarray0,-1 :  Agrif_tabvars_i(4
     &)%iarray0+2+ Agrif_tabvars_i(14)%iarray0,1 : 2))
          Agrif_Gr % tabvars(245)% array3 = 0
      endif
      end subroutine Alloc_agrif_sssdat_sssg
      end module sssdat_sssg
      module forces_sss


        implicit none
        public :: Alloc_agrif_forces_sss
      contains
      subroutine Alloc_agrif_forces_sss(Agrif_Gr)
        use Agrif_Util
        type(Agrif_grid), pointer :: Agrif_Gr
        integer :: i
      !! ALLOCATION OF VARIABLE : sss
          if (.not. allocated(Agrif_Gr % tabvars(246)% array2)) then
          allocate(Agrif_Gr % tabvars(246)% array2(-1 :  Agrif_tabvars_i
     &(2)%iarray0+2+ Agrif_tabvars_i(13)%iarray0,-1 :  Agrif_tabvars_i(4
     &)%iarray0+2+ Agrif_tabvars_i(14)%iarray0))
          Agrif_Gr % tabvars(246)% array2 = 0
      endif
      end subroutine Alloc_agrif_forces_sss
      end module forces_sss
      module sstdat1


        implicit none
        public :: Alloc_agrif_sstdat1
      contains
      subroutine Alloc_agrif_sstdat1(Agrif_Gr)
        use Agrif_Util
        type(Agrif_grid), pointer :: Agrif_Gr
        integer :: i
      !! ALLOCATION OF VARIABLE : sst_time
          if (.not. allocated(Agrif_Gr % tabvars(247)% array1)) then
          allocate(Agrif_Gr % tabvars(247)% array1(1 : 2))
          Agrif_Gr % tabvars(247)% array1 = 0
      endif
      !! ALLOCATION OF VARIABLE : dqdtp
          if (.not. allocated(Agrif_Gr % tabvars(248)% array1)) then
          allocate(Agrif_Gr % tabvars(248)% array1(1 : 2))
          Agrif_Gr % tabvars(248)% array1 = 0
      endif
      !! ALLOCATION OF VARIABLE : sstp
          if (.not. allocated(Agrif_Gr % tabvars(249)% array1)) then
          allocate(Agrif_Gr % tabvars(249)% array1(1 : 2))
          Agrif_Gr % tabvars(249)% array1 = 0
      endif
      end subroutine Alloc_agrif_sstdat1
      end module sstdat1
      module sstdat_sstg


        implicit none
        public :: Alloc_agrif_sstdat_sstg
      contains
      subroutine Alloc_agrif_sstdat_sstg(Agrif_Gr)
        use Agrif_Util
        type(Agrif_grid), pointer :: Agrif_Gr
        integer :: i
      !! ALLOCATION OF VARIABLE : sstg
          if (.not. allocated(Agrif_Gr % tabvars(250)% array3)) then
          allocate(Agrif_Gr % tabvars(250)% array3(-1 :  Agrif_tabvars_i
     &(2)%iarray0+2+ Agrif_tabvars_i(13)%iarray0,-1 :  Agrif_tabvars_i(4
     &)%iarray0+2+ Agrif_tabvars_i(14)%iarray0,1 : 2))
          Agrif_Gr % tabvars(250)% array3 = 0
      endif
      end subroutine Alloc_agrif_sstdat_sstg
      end module sstdat_sstg
      module sstdat_dqdtg


        implicit none
        public :: Alloc_agrif_sstdat_dqdtg
      contains
      subroutine Alloc_agrif_sstdat_dqdtg(Agrif_Gr)
        use Agrif_Util
        type(Agrif_grid), pointer :: Agrif_Gr
        integer :: i
      !! ALLOCATION OF VARIABLE : dqdtg
          if (.not. allocated(Agrif_Gr % tabvars(251)% array3)) then
          allocate(Agrif_Gr % tabvars(251)% array3(-1 :  Agrif_tabvars_i
     &(2)%iarray0+2+ Agrif_tabvars_i(13)%iarray0,-1 :  Agrif_tabvars_i(4
     &)%iarray0+2+ Agrif_tabvars_i(14)%iarray0,1 : 2))
          Agrif_Gr % tabvars(251)% array3 = 0
      endif
      end subroutine Alloc_agrif_sstdat_dqdtg
      end module sstdat_dqdtg
      module forces_sst


        implicit none
        public :: Alloc_agrif_forces_sst
      contains
      subroutine Alloc_agrif_forces_sst(Agrif_Gr)
        use Agrif_Util
        type(Agrif_grid), pointer :: Agrif_Gr
        integer :: i
      !! ALLOCATION OF VARIABLE : sst
          if (.not. allocated(Agrif_Gr % tabvars(252)% array2)) then
          allocate(Agrif_Gr % tabvars(252)% array2(-1 :  Agrif_tabvars_i
     &(2)%iarray0+2+ Agrif_tabvars_i(13)%iarray0,-1 :  Agrif_tabvars_i(4
     &)%iarray0+2+ Agrif_tabvars_i(14)%iarray0))
          Agrif_Gr % tabvars(252)% array2 = 0
      endif
      end subroutine Alloc_agrif_forces_sst
      end module forces_sst
      module forces_dqdt


        implicit none
        public :: Alloc_agrif_forces_dqdt
      contains
      subroutine Alloc_agrif_forces_dqdt(Agrif_Gr)
        use Agrif_Util
        type(Agrif_grid), pointer :: Agrif_Gr
        integer :: i
      !! ALLOCATION OF VARIABLE : dqdt
          if (.not. allocated(Agrif_Gr % tabvars(253)% array2)) then
          allocate(Agrif_Gr % tabvars(253)% array2(-1 :  Agrif_tabvars_i
     &(2)%iarray0+2+ Agrif_tabvars_i(13)%iarray0,-1 :  Agrif_tabvars_i(4
     &)%iarray0+2+ Agrif_tabvars_i(14)%iarray0))
          Agrif_Gr % tabvars(253)% array2 = 0
      endif
      end subroutine Alloc_agrif_forces_dqdt
      end module forces_dqdt
      module forces_btflx


        implicit none
        public :: Alloc_agrif_forces_btflx
      contains
      subroutine Alloc_agrif_forces_btflx(Agrif_Gr)
        use Agrif_Util
        type(Agrif_grid), pointer :: Agrif_Gr
        integer :: i
      integer(4), parameter :: ntrc_sed = 0
      integer(4), parameter :: ntrc_bio = 0
      integer(4), parameter :: ntrc_pas = 0
      integer(4), parameter :: ntrc_salt = 1
      integer(4), parameter :: itemp = 1
      integer(4), parameter :: NT = itemp+ntrc_salt+ntrc_pas+ntrc_bio+nt
     &rc_sed
      !! ALLOCATION OF VARIABLE : btflx
          if (.not. allocated(Agrif_Gr % tabvars(254)% array3)) then
          allocate(Agrif_Gr % tabvars(254)% array3(-1 :  Agrif_tabvars_i
     &(2)%iarray0+2+ Agrif_tabvars_i(13)%iarray0,-1 :  Agrif_tabvars_i(4
     &)%iarray0+2+ Agrif_tabvars_i(14)%iarray0,1 : NT))
          Agrif_Gr % tabvars(254)% array3 = 0
      endif
      end subroutine Alloc_agrif_forces_btflx
      end module forces_btflx
      module stfdat4


        implicit none
        public :: Alloc_agrif_stfdat4
      contains
      subroutine Alloc_agrif_stfdat4(Agrif_Gr)
        use Agrif_Util
        type(Agrif_grid), pointer :: Agrif_Gr
        integer :: i
      integer(4), parameter :: ntrc_sed = 0
      integer(4), parameter :: ntrc_bio = 0
      integer(4), parameter :: ntrc_pas = 0
      integer(4), parameter :: ntrc_salt = 1
      integer(4), parameter :: itemp = 1
      integer(4), parameter :: NT = itemp+ntrc_salt+ntrc_pas+ntrc_bio+nt
     &rc_sed
      !! ALLOCATION OF VARIABLE : stf_id
          if (.not. allocated(Agrif_Gr % tabvars_i(302)% iarray1)) then
          allocate(Agrif_Gr % tabvars_i(302)% iarray1(1 : NT))
          Agrif_Gr % tabvars_i(302)% iarray1 = 0
      endif
      !! ALLOCATION OF VARIABLE : stf_tid
          if (.not. allocated(Agrif_Gr % tabvars_i(303)% iarray1)) then
          allocate(Agrif_Gr % tabvars_i(303)% iarray1(1 : NT))
          Agrif_Gr % tabvars_i(303)% iarray1 = 0
      endif
      end subroutine Alloc_agrif_stfdat4
      end module stfdat4
      module stfdat3


        implicit none
        public :: Alloc_agrif_stfdat3
      contains
      subroutine Alloc_agrif_stfdat3(Agrif_Gr)
        use Agrif_Util
        type(Agrif_grid), pointer :: Agrif_Gr
        integer :: i
      integer(4), parameter :: ntrc_sed = 0
      integer(4), parameter :: ntrc_bio = 0
      integer(4), parameter :: ntrc_pas = 0
      integer(4), parameter :: ntrc_salt = 1
      integer(4), parameter :: itemp = 1
      integer(4), parameter :: NT = itemp+ntrc_salt+ntrc_pas+ntrc_bio+nt
     &rc_sed
      !! ALLOCATION OF VARIABLE : lstfgrd
      do i = 304,307
          if (.not. allocated(Agrif_Gr % tabvars_i(i)% iarray1)) then
          allocate(Agrif_Gr % tabvars_i(i)% iarray1(1 : NT))
          Agrif_Gr % tabvars_i(i)% iarray1 = 0
      endif
      enddo
      end subroutine Alloc_agrif_stfdat3
      end module stfdat3
      module stfdat1


        implicit none
        public :: Alloc_agrif_stfdat1
      contains
      subroutine Alloc_agrif_stfdat1(Agrif_Gr)
        use Agrif_Util
        type(Agrif_grid), pointer :: Agrif_Gr
        integer :: i
      integer(4), parameter :: ntrc_sed = 0
      integer(4), parameter :: ntrc_bio = 0
      integer(4), parameter :: ntrc_pas = 0
      integer(4), parameter :: ntrc_salt = 1
      integer(4), parameter :: itemp = 1
      integer(4), parameter :: NT = itemp+ntrc_salt+ntrc_pas+ntrc_bio+nt
     &rc_sed
      !! ALLOCATION OF VARIABLE : stf_scale
          if (.not. allocated(Agrif_Gr % tabvars(255)% array1)) then
          allocate(Agrif_Gr % tabvars(255)% array1(1 : NT))
          Agrif_Gr % tabvars(255)% array1 = 0
      endif
      !! ALLOCATION OF VARIABLE : stf_cycle
          if (.not. allocated(Agrif_Gr % tabvars(256)% array1)) then
          allocate(Agrif_Gr % tabvars(256)% array1(1 : NT))
          Agrif_Gr % tabvars(256)% array1 = 0
      endif
      !! ALLOCATION OF VARIABLE : stf_time
          if (.not. allocated(Agrif_Gr % tabvars(257)% array2)) then
          allocate(Agrif_Gr % tabvars(257)% array2(1 : 2,1 : NT))
          Agrif_Gr % tabvars(257)% array2 = 0
      endif
      !! ALLOCATION OF VARIABLE : stflxp
          if (.not. allocated(Agrif_Gr % tabvars(258)% array2)) then
          allocate(Agrif_Gr % tabvars(258)% array2(1 : 2,1 : NT))
          Agrif_Gr % tabvars(258)% array2 = 0
      endif
      end subroutine Alloc_agrif_stfdat1
      end module stfdat1
      module stfdat_stflxg


        implicit none
        public :: Alloc_agrif_stfdat_stflxg
      contains
      subroutine Alloc_agrif_stfdat_stflxg(Agrif_Gr)
        use Agrif_Util
        type(Agrif_grid), pointer :: Agrif_Gr
        integer :: i
      integer(4), parameter :: ntrc_sed = 0
      integer(4), parameter :: ntrc_bio = 0
      integer(4), parameter :: ntrc_pas = 0
      integer(4), parameter :: ntrc_salt = 1
      integer(4), parameter :: itemp = 1
      integer(4), parameter :: NT = itemp+ntrc_salt+ntrc_pas+ntrc_bio+nt
     &rc_sed
      !! ALLOCATION OF VARIABLE : stflxg
          if (.not. allocated(Agrif_Gr % tabvars(259)% array4)) then
          allocate(Agrif_Gr % tabvars(259)% array4(-1 :  Agrif_tabvars_i
     &(2)%iarray0+2+ Agrif_tabvars_i(13)%iarray0,-1 :  Agrif_tabvars_i(4
     &)%iarray0+2+ Agrif_tabvars_i(14)%iarray0,1 : 2,1 : NT))
          Agrif_Gr % tabvars(259)% array4 = 0
      endif
      end subroutine Alloc_agrif_stfdat_stflxg
      end module stfdat_stflxg
      module forces_stflx


        implicit none
        public :: Alloc_agrif_forces_stflx
      contains
      subroutine Alloc_agrif_forces_stflx(Agrif_Gr)
        use Agrif_Util
        type(Agrif_grid), pointer :: Agrif_Gr
        integer :: i
      integer(4), parameter :: ntrc_sed = 0
      integer(4), parameter :: ntrc_bio = 0
      integer(4), parameter :: ntrc_pas = 0
      integer(4), parameter :: ntrc_salt = 1
      integer(4), parameter :: itemp = 1
      integer(4), parameter :: NT = itemp+ntrc_salt+ntrc_pas+ntrc_bio+nt
     &rc_sed
      !! ALLOCATION OF VARIABLE : stflx
          if (.not. allocated(Agrif_Gr % tabvars(260)% array3)) then
          allocate(Agrif_Gr % tabvars(260)% array3(-1 :  Agrif_tabvars_i
     &(2)%iarray0+2+ Agrif_tabvars_i(13)%iarray0,-1 :  Agrif_tabvars_i(4
     &)%iarray0+2+ Agrif_tabvars_i(14)%iarray0,1 : NT))
          Agrif_Gr % tabvars(260)% array3 = 0
      endif
      end subroutine Alloc_agrif_forces_stflx
      end module forces_stflx
      module bmsdat1


        implicit none
        public :: Alloc_agrif_bmsdat1
      contains
      subroutine Alloc_agrif_bmsdat1(Agrif_Gr)
        use Agrif_Util
        type(Agrif_grid), pointer :: Agrif_Gr
        integer :: i
      !! ALLOCATION OF VARIABLE : tbms
      do i = 261,264
          if (.not. allocated(Agrif_Gr % tabvars(i)% array1)) then
          allocate(Agrif_Gr % tabvars(i)% array1(1 : 2))
          Agrif_Gr % tabvars(i)% array1 = 0
      endif
      enddo
      end subroutine Alloc_agrif_bmsdat1
      end module bmsdat1
      module bmsdat_bvstrg


        implicit none
        public :: Alloc_agrif_bmsdat_bvstrg
      contains
      subroutine Alloc_agrif_bmsdat_bvstrg(Agrif_Gr)
        use Agrif_Util
        type(Agrif_grid), pointer :: Agrif_Gr
        integer :: i
      !! ALLOCATION OF VARIABLE : bvstrg
          if (.not. allocated(Agrif_Gr % tabvars(265)% array3)) then
          allocate(Agrif_Gr % tabvars(265)% array3(-1 :  Agrif_tabvars_i
     &(2)%iarray0+2+ Agrif_tabvars_i(13)%iarray0,-1 :  Agrif_tabvars_i(4
     &)%iarray0+2+ Agrif_tabvars_i(14)%iarray0,1 : 2))
          Agrif_Gr % tabvars(265)% array3 = 0
      endif
      end subroutine Alloc_agrif_bmsdat_bvstrg
      end module bmsdat_bvstrg
      module bmsdat_bustrg


        implicit none
        public :: Alloc_agrif_bmsdat_bustrg
      contains
      subroutine Alloc_agrif_bmsdat_bustrg(Agrif_Gr)
        use Agrif_Util
        type(Agrif_grid), pointer :: Agrif_Gr
        integer :: i
      !! ALLOCATION OF VARIABLE : bustrg
          if (.not. allocated(Agrif_Gr % tabvars(266)% array3)) then
          allocate(Agrif_Gr % tabvars(266)% array3(-1 :  Agrif_tabvars_i
     &(2)%iarray0+2+ Agrif_tabvars_i(13)%iarray0,-1 :  Agrif_tabvars_i(4
     &)%iarray0+2+ Agrif_tabvars_i(14)%iarray0,1 : 2))
          Agrif_Gr % tabvars(266)% array3 = 0
      endif
      end subroutine Alloc_agrif_bmsdat_bustrg
      end module bmsdat_bustrg
      module forces_bvstr


        implicit none
        public :: Alloc_agrif_forces_bvstr
      contains
      subroutine Alloc_agrif_forces_bvstr(Agrif_Gr)
        use Agrif_Util
        type(Agrif_grid), pointer :: Agrif_Gr
        integer :: i
      !! ALLOCATION OF VARIABLE : bvstr
          if (.not. allocated(Agrif_Gr % tabvars(267)% array2)) then
          allocate(Agrif_Gr % tabvars(267)% array2(-1 :  Agrif_tabvars_i
     &(2)%iarray0+2+ Agrif_tabvars_i(13)%iarray0,-1 :  Agrif_tabvars_i(4
     &)%iarray0+2+ Agrif_tabvars_i(14)%iarray0))
          Agrif_Gr % tabvars(267)% array2 = 0
      endif
      end subroutine Alloc_agrif_forces_bvstr
      end module forces_bvstr
      module forces_bustr


        implicit none
        public :: Alloc_agrif_forces_bustr
      contains
      subroutine Alloc_agrif_forces_bustr(Agrif_Gr)
        use Agrif_Util
        type(Agrif_grid), pointer :: Agrif_Gr
        integer :: i
      !! ALLOCATION OF VARIABLE : bustr
          if (.not. allocated(Agrif_Gr % tabvars(268)% array2)) then
          allocate(Agrif_Gr % tabvars(268)% array2(-1 :  Agrif_tabvars_i
     &(2)%iarray0+2+ Agrif_tabvars_i(13)%iarray0,-1 :  Agrif_tabvars_i(4
     &)%iarray0+2+ Agrif_tabvars_i(14)%iarray0))
          Agrif_Gr % tabvars(268)% array2 = 0
      endif
      end subroutine Alloc_agrif_forces_bustr
      end module forces_bustr
      module smsdat1


        implicit none
        public :: Alloc_agrif_smsdat1
      contains
      subroutine Alloc_agrif_smsdat1(Agrif_Gr)
        use Agrif_Util
        type(Agrif_grid), pointer :: Agrif_Gr
        integer :: i
      !! ALLOCATION OF VARIABLE : sms_time
          if (.not. allocated(Agrif_Gr % tabvars(269)% array1)) then
          allocate(Agrif_Gr % tabvars(269)% array1(1 : 2))
          Agrif_Gr % tabvars(269)% array1 = 0
      endif
      !! ALLOCATION OF VARIABLE : svstrp
          if (.not. allocated(Agrif_Gr % tabvars(270)% array1)) then
          allocate(Agrif_Gr % tabvars(270)% array1(1 : 2))
          Agrif_Gr % tabvars(270)% array1 = 0
      endif
      !! ALLOCATION OF VARIABLE : sustrp
          if (.not. allocated(Agrif_Gr % tabvars(271)% array1)) then
          allocate(Agrif_Gr % tabvars(271)% array1(1 : 2))
          Agrif_Gr % tabvars(271)% array1 = 0
      endif
      end subroutine Alloc_agrif_smsdat1
      end module smsdat1
      module smsdat_svstrg


        implicit none
        public :: Alloc_agrif_smsdat_svstrg
      contains
      subroutine Alloc_agrif_smsdat_svstrg(Agrif_Gr)
        use Agrif_Util
        type(Agrif_grid), pointer :: Agrif_Gr
        integer :: i
      !! ALLOCATION OF VARIABLE : svstrg
          if (.not. allocated(Agrif_Gr % tabvars(272)% array3)) then
          allocate(Agrif_Gr % tabvars(272)% array3(-1 :  Agrif_tabvars_i
     &(2)%iarray0+2+ Agrif_tabvars_i(13)%iarray0,-1 :  Agrif_tabvars_i(4
     &)%iarray0+2+ Agrif_tabvars_i(14)%iarray0,1 : 2))
          Agrif_Gr % tabvars(272)% array3 = 0
      endif
      end subroutine Alloc_agrif_smsdat_svstrg
      end module smsdat_svstrg
      module smsdat_sustrg


        implicit none
        public :: Alloc_agrif_smsdat_sustrg
      contains
      subroutine Alloc_agrif_smsdat_sustrg(Agrif_Gr)
        use Agrif_Util
        type(Agrif_grid), pointer :: Agrif_Gr
        integer :: i
      !! ALLOCATION OF VARIABLE : sustrg
          if (.not. allocated(Agrif_Gr % tabvars(273)% array3)) then
          allocate(Agrif_Gr % tabvars(273)% array3(-1 :  Agrif_tabvars_i
     &(2)%iarray0+2+ Agrif_tabvars_i(13)%iarray0,-1 :  Agrif_tabvars_i(4
     &)%iarray0+2+ Agrif_tabvars_i(14)%iarray0,1 : 2))
          Agrif_Gr % tabvars(273)% array3 = 0
      endif
      end subroutine Alloc_agrif_smsdat_sustrg
      end module smsdat_sustrg
      module forces_svstr


        implicit none
        public :: Alloc_agrif_forces_svstr
      contains
      subroutine Alloc_agrif_forces_svstr(Agrif_Gr)
        use Agrif_Util
        type(Agrif_grid), pointer :: Agrif_Gr
        integer :: i
      !! ALLOCATION OF VARIABLE : svstr
          if (.not. allocated(Agrif_Gr % tabvars(274)% array2)) then
          allocate(Agrif_Gr % tabvars(274)% array2(-1 :  Agrif_tabvars_i
     &(2)%iarray0+2+ Agrif_tabvars_i(13)%iarray0,-1 :  Agrif_tabvars_i(4
     &)%iarray0+2+ Agrif_tabvars_i(14)%iarray0))
          Agrif_Gr % tabvars(274)% array2 = 0
      endif
      end subroutine Alloc_agrif_forces_svstr
      end module forces_svstr
      module forces_sustr


        implicit none
        public :: Alloc_agrif_forces_sustr
      contains
      subroutine Alloc_agrif_forces_sustr(Agrif_Gr)
        use Agrif_Util
        type(Agrif_grid), pointer :: Agrif_Gr
        integer :: i
      !! ALLOCATION OF VARIABLE : sustr
          if (.not. allocated(Agrif_Gr % tabvars(275)% array2)) then
          allocate(Agrif_Gr % tabvars(275)% array2(-1 :  Agrif_tabvars_i
     &(2)%iarray0+2+ Agrif_tabvars_i(13)%iarray0,-1 :  Agrif_tabvars_i(4
     &)%iarray0+2+ Agrif_tabvars_i(14)%iarray0))
          Agrif_Gr % tabvars(275)% array2 = 0
      endif
      end subroutine Alloc_agrif_forces_sustr
      end module forces_sustr
      module avg_Akt


        implicit none
        public :: Alloc_agrif_avg_Akt
      contains
      subroutine Alloc_agrif_avg_Akt(Agrif_Gr)
        use Agrif_Util
        type(Agrif_grid), pointer :: Agrif_Gr
        integer :: i
      integer(4), parameter :: N = 32
      !! ALLOCATION OF VARIABLE : Akt_avg
          if (.not. allocated(Agrif_Gr % tabvars(276)% array4)) then
          allocate(Agrif_Gr % tabvars(276)% array4(-1 :  Agrif_tabvars_i
     &(2)%iarray0+2+ Agrif_tabvars_i(13)%iarray0,-1 :  Agrif_tabvars_i(4
     &)%iarray0+2+ Agrif_tabvars_i(14)%iarray0,0 : N,1 : 2))
          Agrif_Gr % tabvars(276)% array4 = 0
      endif
      end subroutine Alloc_agrif_avg_Akt
      end module avg_Akt
      module avg_Akv


        implicit none
        public :: Alloc_agrif_avg_Akv
      contains
      subroutine Alloc_agrif_avg_Akv(Agrif_Gr)
        use Agrif_Util
        type(Agrif_grid), pointer :: Agrif_Gr
        integer :: i
      integer(4), parameter :: N = 32
      !! ALLOCATION OF VARIABLE : Akv_avg
          if (.not. allocated(Agrif_Gr % tabvars(277)% array3)) then
          allocate(Agrif_Gr % tabvars(277)% array3(-1 :  Agrif_tabvars_i
     &(2)%iarray0+2+ Agrif_tabvars_i(13)%iarray0,-1 :  Agrif_tabvars_i(4
     &)%iarray0+2+ Agrif_tabvars_i(14)%iarray0,0 : N))
          Agrif_Gr % tabvars(277)% array3 = 0
      endif
      end subroutine Alloc_agrif_avg_Akv
      end module avg_Akv
      module avg_diff3d


        implicit none
        public :: Alloc_agrif_avg_diff3d
      contains
      subroutine Alloc_agrif_avg_diff3d(Agrif_Gr)
        use Agrif_Util
        type(Agrif_grid), pointer :: Agrif_Gr
        integer :: i
      integer(4), parameter :: N = 32
      !! ALLOCATION OF VARIABLE : diff3d_avg
          if (.not. allocated(Agrif_Gr % tabvars(278)% array3)) then
          allocate(Agrif_Gr % tabvars(278)% array3(-1 :  Agrif_tabvars_i
     &(2)%iarray0+2+ Agrif_tabvars_i(13)%iarray0,-1 :  Agrif_tabvars_i(4
     &)%iarray0+2+ Agrif_tabvars_i(14)%iarray0,1 : N))
          Agrif_Gr % tabvars(278)% array3 = 0
      endif
      end subroutine Alloc_agrif_avg_diff3d
      end module avg_diff3d
      module avg_hbbl


        implicit none
        public :: Alloc_agrif_avg_hbbl
      contains
      subroutine Alloc_agrif_avg_hbbl(Agrif_Gr)
        use Agrif_Util
        type(Agrif_grid), pointer :: Agrif_Gr
        integer :: i
      !! ALLOCATION OF VARIABLE : hbbl_avg
          if (.not. allocated(Agrif_Gr % tabvars(279)% array2)) then
          allocate(Agrif_Gr % tabvars(279)% array2(-1 :  Agrif_tabvars_i
     &(2)%iarray0+2+ Agrif_tabvars_i(13)%iarray0,-1 :  Agrif_tabvars_i(4
     &)%iarray0+2+ Agrif_tabvars_i(14)%iarray0))
          Agrif_Gr % tabvars(279)% array2 = 0
      endif
      end subroutine Alloc_agrif_avg_hbbl
      end module avg_hbbl
      module avg_hbl


        implicit none
        public :: Alloc_agrif_avg_hbl
      contains
      subroutine Alloc_agrif_avg_hbl(Agrif_Gr)
        use Agrif_Util
        type(Agrif_grid), pointer :: Agrif_Gr
        integer :: i
      !! ALLOCATION OF VARIABLE : hbl_avg
          if (.not. allocated(Agrif_Gr % tabvars(280)% array2)) then
          allocate(Agrif_Gr % tabvars(280)% array2(-1 :  Agrif_tabvars_i
     &(2)%iarray0+2+ Agrif_tabvars_i(13)%iarray0,-1 :  Agrif_tabvars_i(4
     &)%iarray0+2+ Agrif_tabvars_i(14)%iarray0))
          Agrif_Gr % tabvars(280)% array2 = 0
      endif
      end subroutine Alloc_agrif_avg_hbl
      end module avg_hbl
      module avg_btflx


        implicit none
        public :: Alloc_agrif_avg_btflx
      contains
      subroutine Alloc_agrif_avg_btflx(Agrif_Gr)
        use Agrif_Util
        type(Agrif_grid), pointer :: Agrif_Gr
        integer :: i
      integer(4), parameter :: ntrc_sed = 0
      integer(4), parameter :: ntrc_bio = 0
      integer(4), parameter :: ntrc_pas = 0
      integer(4), parameter :: ntrc_salt = 1
      integer(4), parameter :: itemp = 1
      integer(4), parameter :: NT = itemp+ntrc_salt+ntrc_pas+ntrc_bio+nt
     &rc_sed
      !! ALLOCATION OF VARIABLE : btflx_avg
          if (.not. allocated(Agrif_Gr % tabvars(281)% array3)) then
          allocate(Agrif_Gr % tabvars(281)% array3(-1 :  Agrif_tabvars_i
     &(2)%iarray0+2+ Agrif_tabvars_i(13)%iarray0,-1 :  Agrif_tabvars_i(4
     &)%iarray0+2+ Agrif_tabvars_i(14)%iarray0,1 : NT))
          Agrif_Gr % tabvars(281)% array3 = 0
      endif
      end subroutine Alloc_agrif_avg_btflx
      end module avg_btflx
      module avg_stflx


        implicit none
        public :: Alloc_agrif_avg_stflx
      contains
      subroutine Alloc_agrif_avg_stflx(Agrif_Gr)
        use Agrif_Util
        type(Agrif_grid), pointer :: Agrif_Gr
        integer :: i
      integer(4), parameter :: ntrc_sed = 0
      integer(4), parameter :: ntrc_bio = 0
      integer(4), parameter :: ntrc_pas = 0
      integer(4), parameter :: ntrc_salt = 1
      integer(4), parameter :: itemp = 1
      integer(4), parameter :: NT = itemp+ntrc_salt+ntrc_pas+ntrc_bio+nt
     &rc_sed
      !! ALLOCATION OF VARIABLE : stflx_avg
          if (.not. allocated(Agrif_Gr % tabvars(282)% array3)) then
          allocate(Agrif_Gr % tabvars(282)% array3(-1 :  Agrif_tabvars_i
     &(2)%iarray0+2+ Agrif_tabvars_i(13)%iarray0,-1 :  Agrif_tabvars_i(4
     &)%iarray0+2+ Agrif_tabvars_i(14)%iarray0,1 : NT))
          Agrif_Gr % tabvars(282)% array3 = 0
      endif
      end subroutine Alloc_agrif_avg_stflx
      end module avg_stflx
      module avg_w


        implicit none
        public :: Alloc_agrif_avg_w
      contains
      subroutine Alloc_agrif_avg_w(Agrif_Gr)
        use Agrif_Util
        type(Agrif_grid), pointer :: Agrif_Gr
        integer :: i
      integer(4), parameter :: N = 32
      !! ALLOCATION OF VARIABLE : w_avg
          if (.not. allocated(Agrif_Gr % tabvars(283)% array3)) then
          allocate(Agrif_Gr % tabvars(283)% array3(-1 :  Agrif_tabvars_i
     &(2)%iarray0+2+ Agrif_tabvars_i(13)%iarray0,-1 :  Agrif_tabvars_i(4
     &)%iarray0+2+ Agrif_tabvars_i(14)%iarray0,1 : N))
          Agrif_Gr % tabvars(283)% array3 = 0
      endif
      end subroutine Alloc_agrif_avg_w
      end module avg_w
      module avg_bvf


        implicit none
        public :: Alloc_agrif_avg_bvf
      contains
      subroutine Alloc_agrif_avg_bvf(Agrif_Gr)
        use Agrif_Util
        type(Agrif_grid), pointer :: Agrif_Gr
        integer :: i
      integer(4), parameter :: N = 32
      !! ALLOCATION OF VARIABLE : bvf_avg
          if (.not. allocated(Agrif_Gr % tabvars(284)% array3)) then
          allocate(Agrif_Gr % tabvars(284)% array3(-1 :  Agrif_tabvars_i
     &(2)%iarray0+2+ Agrif_tabvars_i(13)%iarray0,-1 :  Agrif_tabvars_i(4
     &)%iarray0+2+ Agrif_tabvars_i(14)%iarray0,0 : N))
          Agrif_Gr % tabvars(284)% array3 = 0
      endif
      end subroutine Alloc_agrif_avg_bvf
      end module avg_bvf
      module avg_omega


        implicit none
        public :: Alloc_agrif_avg_omega
      contains
      subroutine Alloc_agrif_avg_omega(Agrif_Gr)
        use Agrif_Util
        type(Agrif_grid), pointer :: Agrif_Gr
        integer :: i
      integer(4), parameter :: N = 32
      !! ALLOCATION OF VARIABLE : omega_avg
          if (.not. allocated(Agrif_Gr % tabvars(285)% array3)) then
          allocate(Agrif_Gr % tabvars(285)% array3(-1 :  Agrif_tabvars_i
     &(2)%iarray0+2+ Agrif_tabvars_i(13)%iarray0,-1 :  Agrif_tabvars_i(4
     &)%iarray0+2+ Agrif_tabvars_i(14)%iarray0,0 : N))
          Agrif_Gr % tabvars(285)% array3 = 0
      endif
      end subroutine Alloc_agrif_avg_omega
      end module avg_omega
      module avg_rho


        implicit none
        public :: Alloc_agrif_avg_rho
      contains
      subroutine Alloc_agrif_avg_rho(Agrif_Gr)
        use Agrif_Util
        type(Agrif_grid), pointer :: Agrif_Gr
        integer :: i
      integer(4), parameter :: N = 32
      !! ALLOCATION OF VARIABLE : rho_avg
          if (.not. allocated(Agrif_Gr % tabvars(286)% array3)) then
          allocate(Agrif_Gr % tabvars(286)% array3(-1 :  Agrif_tabvars_i
     &(2)%iarray0+2+ Agrif_tabvars_i(13)%iarray0,-1 :  Agrif_tabvars_i(4
     &)%iarray0+2+ Agrif_tabvars_i(14)%iarray0,1 : N))
          Agrif_Gr % tabvars(286)% array3 = 0
      endif
      end subroutine Alloc_agrif_avg_rho
      end module avg_rho
      module avg_t


        implicit none
        public :: Alloc_agrif_avg_t
      contains
      subroutine Alloc_agrif_avg_t(Agrif_Gr)
        use Agrif_Util
        type(Agrif_grid), pointer :: Agrif_Gr
        integer :: i
      integer(4), parameter :: ntrc_sed = 0
      integer(4), parameter :: ntrc_bio = 0
      integer(4), parameter :: ntrc_pas = 0
      integer(4), parameter :: ntrc_salt = 1
      integer(4), parameter :: itemp = 1
      integer(4), parameter :: NT = itemp+ntrc_salt+ntrc_pas+ntrc_bio+nt
     &rc_sed
      integer(4), parameter :: N = 32
      !! ALLOCATION OF VARIABLE : t_avg
          if (.not. allocated(Agrif_Gr % tabvars(287)% array4)) then
          allocate(Agrif_Gr % tabvars(287)% array4(-1 :  Agrif_tabvars_i
     &(2)%iarray0+2+ Agrif_tabvars_i(13)%iarray0,-1 :  Agrif_tabvars_i(4
     &)%iarray0+2+ Agrif_tabvars_i(14)%iarray0,1 : N,1 : NT))
          Agrif_Gr % tabvars(287)% array4 = 0
      endif
      end subroutine Alloc_agrif_avg_t
      end module avg_t
      module avg_v


        implicit none
        public :: Alloc_agrif_avg_v
      contains
      subroutine Alloc_agrif_avg_v(Agrif_Gr)
        use Agrif_Util
        type(Agrif_grid), pointer :: Agrif_Gr
        integer :: i
      integer(4), parameter :: N = 32
      !! ALLOCATION OF VARIABLE : v_avg
          if (.not. allocated(Agrif_Gr % tabvars(288)% array3)) then
          allocate(Agrif_Gr % tabvars(288)% array3(-1 :  Agrif_tabvars_i
     &(2)%iarray0+2+ Agrif_tabvars_i(13)%iarray0,-1 :  Agrif_tabvars_i(4
     &)%iarray0+2+ Agrif_tabvars_i(14)%iarray0,1 : N))
          Agrif_Gr % tabvars(288)% array3 = 0
      endif
      end subroutine Alloc_agrif_avg_v
      end module avg_v
      module avg_u


        implicit none
        public :: Alloc_agrif_avg_u
      contains
      subroutine Alloc_agrif_avg_u(Agrif_Gr)
        use Agrif_Util
        type(Agrif_grid), pointer :: Agrif_Gr
        integer :: i
      integer(4), parameter :: N = 32
      !! ALLOCATION OF VARIABLE : u_avg
          if (.not. allocated(Agrif_Gr % tabvars(289)% array3)) then
          allocate(Agrif_Gr % tabvars(289)% array3(-1 :  Agrif_tabvars_i
     &(2)%iarray0+2+ Agrif_tabvars_i(13)%iarray0,-1 :  Agrif_tabvars_i(4
     &)%iarray0+2+ Agrif_tabvars_i(14)%iarray0,1 : N))
          Agrif_Gr % tabvars(289)% array3 = 0
      endif
      end subroutine Alloc_agrif_avg_u
      end module avg_u
      module avg_srflx


        implicit none
        public :: Alloc_agrif_avg_srflx
      contains
      subroutine Alloc_agrif_avg_srflx(Agrif_Gr)
        use Agrif_Util
        type(Agrif_grid), pointer :: Agrif_Gr
        integer :: i
      !! ALLOCATION OF VARIABLE : srflx_avg
          if (.not. allocated(Agrif_Gr % tabvars(290)% array2)) then
          allocate(Agrif_Gr % tabvars(290)% array2(-1 :  Agrif_tabvars_i
     &(2)%iarray0+2+ Agrif_tabvars_i(13)%iarray0,-1 :  Agrif_tabvars_i(4
     &)%iarray0+2+ Agrif_tabvars_i(14)%iarray0))
          Agrif_Gr % tabvars(290)% array2 = 0
      endif
      end subroutine Alloc_agrif_avg_srflx
      end module avg_srflx
      module avg_svstr


        implicit none
        public :: Alloc_agrif_avg_svstr
      contains
      subroutine Alloc_agrif_avg_svstr(Agrif_Gr)
        use Agrif_Util
        type(Agrif_grid), pointer :: Agrif_Gr
        integer :: i
      !! ALLOCATION OF VARIABLE : svstr_avg
          if (.not. allocated(Agrif_Gr % tabvars(291)% array2)) then
          allocate(Agrif_Gr % tabvars(291)% array2(-1 :  Agrif_tabvars_i
     &(2)%iarray0+2+ Agrif_tabvars_i(13)%iarray0,-1 :  Agrif_tabvars_i(4
     &)%iarray0+2+ Agrif_tabvars_i(14)%iarray0))
          Agrif_Gr % tabvars(291)% array2 = 0
      endif
      end subroutine Alloc_agrif_avg_svstr
      end module avg_svstr
      module avg_sustr


        implicit none
        public :: Alloc_agrif_avg_sustr
      contains
      subroutine Alloc_agrif_avg_sustr(Agrif_Gr)
        use Agrif_Util
        type(Agrif_grid), pointer :: Agrif_Gr
        integer :: i
      !! ALLOCATION OF VARIABLE : sustr_avg
          if (.not. allocated(Agrif_Gr % tabvars(292)% array2)) then
          allocate(Agrif_Gr % tabvars(292)% array2(-1 :  Agrif_tabvars_i
     &(2)%iarray0+2+ Agrif_tabvars_i(13)%iarray0,-1 :  Agrif_tabvars_i(4
     &)%iarray0+2+ Agrif_tabvars_i(14)%iarray0))
          Agrif_Gr % tabvars(292)% array2 = 0
      endif
      end subroutine Alloc_agrif_avg_sustr
      end module avg_sustr
      module avg_wstr


        implicit none
        public :: Alloc_agrif_avg_wstr
      contains
      subroutine Alloc_agrif_avg_wstr(Agrif_Gr)
        use Agrif_Util
        type(Agrif_grid), pointer :: Agrif_Gr
        integer :: i
      !! ALLOCATION OF VARIABLE : wstr_avg
          if (.not. allocated(Agrif_Gr % tabvars(293)% array2)) then
          allocate(Agrif_Gr % tabvars(293)% array2(-1 :  Agrif_tabvars_i
     &(2)%iarray0+2+ Agrif_tabvars_i(13)%iarray0,-1 :  Agrif_tabvars_i(4
     &)%iarray0+2+ Agrif_tabvars_i(14)%iarray0))
          Agrif_Gr % tabvars(293)% array2 = 0
      endif
      end subroutine Alloc_agrif_avg_wstr
      end module avg_wstr
      module avg_bvstr


        implicit none
        public :: Alloc_agrif_avg_bvstr
      contains
      subroutine Alloc_agrif_avg_bvstr(Agrif_Gr)
        use Agrif_Util
        type(Agrif_grid), pointer :: Agrif_Gr
        integer :: i
      !! ALLOCATION OF VARIABLE : bvstr_avg
          if (.not. allocated(Agrif_Gr % tabvars(294)% array2)) then
          allocate(Agrif_Gr % tabvars(294)% array2(-1 :  Agrif_tabvars_i
     &(2)%iarray0+2+ Agrif_tabvars_i(13)%iarray0,-1 :  Agrif_tabvars_i(4
     &)%iarray0+2+ Agrif_tabvars_i(14)%iarray0))
          Agrif_Gr % tabvars(294)% array2 = 0
      endif
      end subroutine Alloc_agrif_avg_bvstr
      end module avg_bvstr
      module avg_bustr


        implicit none
        public :: Alloc_agrif_avg_bustr
      contains
      subroutine Alloc_agrif_avg_bustr(Agrif_Gr)
        use Agrif_Util
        type(Agrif_grid), pointer :: Agrif_Gr
        integer :: i
      !! ALLOCATION OF VARIABLE : bustr_avg
          if (.not. allocated(Agrif_Gr % tabvars(295)% array2)) then
          allocate(Agrif_Gr % tabvars(295)% array2(-1 :  Agrif_tabvars_i
     &(2)%iarray0+2+ Agrif_tabvars_i(13)%iarray0,-1 :  Agrif_tabvars_i(4
     &)%iarray0+2+ Agrif_tabvars_i(14)%iarray0))
          Agrif_Gr % tabvars(295)% array2 = 0
      endif
      end subroutine Alloc_agrif_avg_bustr
      end module avg_bustr
      module avg_bostr


        implicit none
        public :: Alloc_agrif_avg_bostr
      contains
      subroutine Alloc_agrif_avg_bostr(Agrif_Gr)
        use Agrif_Util
        type(Agrif_grid), pointer :: Agrif_Gr
        integer :: i
      !! ALLOCATION OF VARIABLE : bostr_avg
          if (.not. allocated(Agrif_Gr % tabvars(296)% array2)) then
          allocate(Agrif_Gr % tabvars(296)% array2(-1 :  Agrif_tabvars_i
     &(2)%iarray0+2+ Agrif_tabvars_i(13)%iarray0,-1 :  Agrif_tabvars_i(4
     &)%iarray0+2+ Agrif_tabvars_i(14)%iarray0))
          Agrif_Gr % tabvars(296)% array2 = 0
      endif
      end subroutine Alloc_agrif_avg_bostr
      end module avg_bostr
      module avg_vbar


        implicit none
        public :: Alloc_agrif_avg_vbar
      contains
      subroutine Alloc_agrif_avg_vbar(Agrif_Gr)
        use Agrif_Util
        type(Agrif_grid), pointer :: Agrif_Gr
        integer :: i
      !! ALLOCATION OF VARIABLE : vbar_avg
          if (.not. allocated(Agrif_Gr % tabvars(297)% array2)) then
          allocate(Agrif_Gr % tabvars(297)% array2(-1 :  Agrif_tabvars_i
     &(2)%iarray0+2+ Agrif_tabvars_i(13)%iarray0,-1 :  Agrif_tabvars_i(4
     &)%iarray0+2+ Agrif_tabvars_i(14)%iarray0))
          Agrif_Gr % tabvars(297)% array2 = 0
      endif
      end subroutine Alloc_agrif_avg_vbar
      end module avg_vbar
      module avg_ubar


        implicit none
        public :: Alloc_agrif_avg_ubar
      contains
      subroutine Alloc_agrif_avg_ubar(Agrif_Gr)
        use Agrif_Util
        type(Agrif_grid), pointer :: Agrif_Gr
        integer :: i
      !! ALLOCATION OF VARIABLE : ubar_avg
          if (.not. allocated(Agrif_Gr % tabvars(298)% array2)) then
          allocate(Agrif_Gr % tabvars(298)% array2(-1 :  Agrif_tabvars_i
     &(2)%iarray0+2+ Agrif_tabvars_i(13)%iarray0,-1 :  Agrif_tabvars_i(4
     &)%iarray0+2+ Agrif_tabvars_i(14)%iarray0))
          Agrif_Gr % tabvars(298)% array2 = 0
      endif
      end subroutine Alloc_agrif_avg_ubar
      end module avg_ubar
      module avg_zeta


        implicit none
        public :: Alloc_agrif_avg_zeta
      contains
      subroutine Alloc_agrif_avg_zeta(Agrif_Gr)
        use Agrif_Util
        type(Agrif_grid), pointer :: Agrif_Gr
        integer :: i
      !! ALLOCATION OF VARIABLE : zeta_avg
          if (.not. allocated(Agrif_Gr % tabvars(299)% array2)) then
          allocate(Agrif_Gr % tabvars(299)% array2(-1 :  Agrif_tabvars_i
     &(2)%iarray0+2+ Agrif_tabvars_i(13)%iarray0,-1 :  Agrif_tabvars_i(4
     &)%iarray0+2+ Agrif_tabvars_i(14)%iarray0))
          Agrif_Gr % tabvars(299)% array2 = 0
      endif
      end subroutine Alloc_agrif_avg_zeta
      end module avg_zeta
