  SUBROUTINE cas_acc

!&E---------------------------------------------------------------------
!&E                 ***  ROUTINE cas_acc  ***
!&E
!&E ** Purpose : definition of a test case to play with mixed layer instabilities
!&E
!&E ** Description :
!&E
!&E ** Called by : cas_init
!&E
!&E ** External calls :
!&E
!&E ** Used ij-arrays :
!&E
!&E ** Modified variables : hx, hy, h0, sal, temp, dy, dhx, dhy, dsigu, dsigw
!&E                         surf, fisac, gwac, dgac, dfiac, fu, fv, sig, sigw
!&E                         tfiusr, tfivsr, goulet, govlet, ig, id, jb, jh
!&E                         ssh,u,v,uz,vz
!&E
!&E
!&E
!&E Rq valerie : Revue du calcul de fu et fv non pas coherent avec la fiche COMODO
!&E Rq valerie : Pb d ecriture pour le fichier nudging quand on utilise 160 proc
!&E
!&E
!&E
!&E
!&E
!&E
!&E ** Reference :
!&E                Boccaletti et al, JPO 2007
!&E
!&E ** History :
!&E       !  2013     (X. Couvelard) Original code
!&E
!&E---------------------------------------------------------------------





























































!! * Modules used
   USE parameters, ONLY : rsh,rlg,riolg,kmax,jmin,ljmin,ljminm2,jmax,ljmax,ljmaxp2, &
                          imin,limin,liminm2,imax,limax,limaxp2,obc_width,grav,pi,  &
                          liminm1,ljminm1,valmanq,liminp2,limaxm1,ljminp2,ljmaxm1,  &
                          liminp1,ljminp1,limaxp1,ljmaxp1,ishift_obc_east,ishift_obc_west, &
                          jshift_obc_north,jshift_obc_south
   USE comvars2d, ONLY : fisac,gwac,fu,fv,dtmin,dtmax,dtmaxi,dt,suffix,qmax,l_modele2d, &
                         h0,h0fond,l_obc_cycl_x,frot_lin,hx,hy,dhx,dhy,tdeb,tsauv, &
                         halfdt,l_corio_cst,surf,ig,id,jb,jh,dx_u,dy_v,hex,hey, &
                         vish_xe,vish_phi,l_initfromfile,l_saverestart_bydate,saverestart_step
   USE comvarp2d, ONLY : sal,temp,ssh,u,v

   USE comvarp3d, ONLY : uz,vz,boz
   USE comvars3d, ONLY : l_stateeq_lin,kzinit,nzinit,rhoref,dsigu, &
                         turb_nbeq,turb_2eq_option
   USE output,    ONLY : pasor,l_out_zaxis_w,l_out_turb,l_out_sal,stepi,l_out_zaxis_w, &
                         nbave,l_out_timeave,tdebsor,fileresu,l_filebydate
   USE obccombine,ONLY : l_obc_west,l_obc_east,l_obc_cycl
   USE comcolig2d,ONLY : igdu,igdv

   USE toolgeom,  ONLY : f_zw,f_zu
   USE pressure,  ONLY : pres_gradt
   USE obcapplyu, ONLY : obc_apply_u
   USE obcapplyuz, ONLY : obc_apply_uz
   USE obcapplyv, ONLY : obc_apply_v
   USE obcapplyvz, ONLY : obc_apply_vz
   USE traobc3dapply, ONLY : ts_obc3d_apply
   USE comcolig3d,ONLY : yz_exp
   USE casinit,   ONLY : cas_init_param,cas_init_grid,cas_init_bathy, &
                         cas_init_io,cas_init_obc,cas_init_meteo,     &
                         cas_init_visc,cas_init_turb,cas_init_tspar,  &
                         cas_init_progvar,cas_init_misc,cas_init_river
   USE toolmpi,ONLY : ex_i_rsh,ex_j_rsh,ex_peri_x_rsh,ADD_ALL_MPI_RSH,add_tag
   USE output, ONLY : iextmin,iextmax,igextmin,igextmax



   IMPLICIT NONE

!! * Arguments

!! * Local declarations
   LOGICAL           :: l_nc4par
   CHARACTER(LEN=19) :: date_start,date_end,date_start3d,date_startagrif
   INTEGER           :: i,j,k,nj_wall_s,nj_wall_n,nb,nb_file
   INTEGER           :: istr,jstr,N,MMm,LLm,jet_perturb
   INTEGER           :: ixl,iyl
   REAL(KIND=rsh)    :: dxval,dyval,z0bottom,z0surface,depthcst
   REAL(KIND=rsh)    :: Ljet,rhomaxs,bgdrhos,zs1,dzs,drhos
   REAL(KIND=rsh)    :: rhomaxn,bgdrhon,zn1,dzn
   REAL(KIND=rsh)    :: drhosfs,drhosfn,z0,drhosf,z0p
   REAL(KIND=rsh)    :: cff_perturb
   REAL(KIND=rsh)    :: zk,dzs_a,dzn_a,drhon
   REAL(KIND=rsh)    :: x,y,Fyz,y0
   REAL(KIND=rsh)    :: mssh,area,cff1 
   REAL(KIND=rsh), DIMENSION(0:kmax,2)    :: rhoprof

   REAL(KIND=rsh), DIMENSION(1:kmax,liminm1:limaxp2,ljminm1:ljmaxp2) :: rho
   REAL(kind=rsh),ALLOCATABLE,DIMENSION(:,:,:) :: P,ipx,ipy
   REAL(KIND=rsh), DIMENSION(1:kmax)    :: hzex0,hzey0
   REAL(KIND=rsh)    :: f0
   REAL(KIND=rlg)    :: beta,el
   REAL(KIND=rlg)    :: rhox,rhoy
   REAL(KIND=rsh)    :: asymth
   REAL(KIND=rlg)    :: tool_datosec



!!----------------------------------------------------------------------
!! * Executable part

!------------------------------------------------
!------------------------------------------------
!!     courant constant zonal et barotrope     !!
!!     surface libre lineaire                  !!
!!     densite constant                        !!
!------------------------------------------------
!------------------------------------------------



  END SUBROUTINE cas_acc

!!======================================================================

  FUNCTION asymth(zz,zasym,dzasym)

!&E---------------------------------------------------------------------
!&E                 ***  FUNCTION asymth  ***
!&E
!&E ** Purpose :
!&E
!&E ** Description :
!&E
!&E ** Called by : casacc
!&E
!&E ** External calls :
!&E
!&E ** Used ij-arrays :
!&E
!&E ** Modified variables :
!&E
!&E ** Reference :
!&E
!&E ** History :
!&E       !  2013-10  (V. Garnier)  Extracted from ROMS
!&E
!&E---------------------------------------------------------------------
!! * Modules used
   USE parameters, ONLY : rsh

!! * Arguments
   REAL(KIND=rsh), INTENT( in ) :: zz,zasym,dzasym

!! * Local declarations
   REAL(KIND=rsh) :: asymth

!!----------------------------------------------------------------------
!! * Executable part

   asymth = (zz-zasym) &
     &       *sqrt(1.0_rsh+0.5_rsh*((zz-zasym)+abs(zz-zasym))**2/dzasym**2) &
     &       +zasym

  END FUNCTION asymth

!!======================================================================

