  SUBROUTINE cas_evap

!&E---------------------------------------------------------------------
!&E                 ***  ROUTINE cas_evap  ***
!&E
!&E ** Purpose : test case to evaluate the water loss/gain through evaporation/precipitation
!&E
!&E ** Description : no modification of temperature et and salinity as l_sflx_solarcst=.true.
!&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 ** Reference :
!&E
!&E ** History :
!&E       !  2005-10-13  Original code
!&E       !  2008-12  (V. Garnier) shift of sigma values : -1 < sig < 0
!&E
!&E---------------------------------------------------------------------





























































!! * Modules used
   USE parameters,ONLY : rsh,rlg,riosh,riolg,kmax,limin,limax,ljmin,ljmax
   USE comvars2d, ONLY : fisac,gwac,fu,fv,dtmin,dtmax,dt,halfdt,suffix,l_saverestart_bydate, &
                         qmax,vish_xe,vish_phi,l_smagor,surf
   USE comvars3d, ONLY : kzinit,nzinit,qmaxz,saliref_lin,tetaref_lin
   USE output, ONLY : pasor,l_out_precdate
   USE comfluxdo, ONLY : rain,evap,phieau

   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

   IMPLICIT NONE

!! * Arguments

!! * Local declarations
   CHARACTER(LEN=19) :: date_start,date_end,date_start3d,date_startagrif
   INTEGER           :: i,j,k
   INTEGER           :: ni_wall_e,ni_wall_w,nj_wall_n,nj_wall_s
   REAL(KIND=rsh)    :: dxval,dyval
   REAL(KIND=rsh)    :: z0bottom,z0surface,depthcst,limit,nzinit0

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


  
! general parametrization (each parameter can be reassigned)
! -----------------------

! dynamics
   CALL cas_init_param

! over-assignement

! tracers : among others, saliref=saliref_lin=35.5_rsh,
! tetaref=tetaref_lin=10.0_rsh
   CALL cas_init_tspar

! over-assignement
   qmax=8.0_rsh
   qmaxz=10.0_rsh
   saliref_lin=0.0_rsh
   tetaref_lin=0.0_rsh


! Bathymetry
! ----------

! assignement : input variables for cas_init_bathy routine
   depthcst = 20.0_rsh
   ni_wall_e = 5  ! land over ni_wall_e cells at the eastern part of the domain
   ni_wall_w = 4  ! land over ni_wall_w cells (from imin column) at the western part of the domain
   nj_wall_s = 4  ! land over nj_wall_s cells (from jmin row) at the southern part of the domain
   nj_wall_n = 5  ! land over nj_wall_n cells at the northern part of the domain



! flat bottom, plus walls
   CALL cas_init_bathy(depthcst,ni_wall_e=ni_wall_e,ni_wall_w=ni_wall_w, &
                                nj_wall_n=nj_wall_n,nj_wall_s=nj_wall_s)

! over-assignement


! grid parametrization
! --------------------

! assignement : input variables for cas_init_grid routine
 
! parametres de forme
!---------------------
   dxval = 1000.0_rsh
   dyval = 1000.0_rsh
   fisac=0.0_riolg
   gwac=0.0_riolg



   CALL cas_init_grid(dxval,dyval)

! over-assignement
   fu(:,:)=0.0_rsh
   fv(:,:)=0.0_rsh


! IO parametrization
! ------------------

! assignement : input variables for cas_init_io routine
   date_start=   '01/01/1900 00:00:00'
   date_end=   '02/01/1900 00:00:00'
   date_end=   '07/01/1900 15:30:00'
   date_start3d=  '01/01/1900 00:00:00'
   date_startagrif='01/01/1900 00:00:00'
   dtmin=200.0_rlg
   dtmax=200.0_rlg
   dt=200.0_rlg
   halfdt=dt*0.5_rlg

   suffix='rain'

   CALL cas_init_io(date_start,date_end,date_start3d,date_startagrif,suffix)

! over-assignement
   pasor(1)=3600.0_rlg
   l_saverestart_bydate=.TRUE.
   l_out_precdate(1)=.TRUE.
!test l_out_atmsflx(1)=.true. ; l_out_ssh(1)=.FALSE. ; l_out_ubt(1)=.FALSE. ; l_out_u3d(1)=.FALSE. ; l_out_sal(1)=.FALSE. ; l_out_temp(1)=.FALSE.


! open boundaries
! ---------------

! no open boundary
   CALL cas_init_obc


! viscosity
!-----------

! none
   CALL cas_init_visc

! over-assignement
   vish_xe(:,:,:) = 0.3_rsh*0.01_rsh*dyval**1.15_rsh
   vish_phi(:,:,:)= 0.3_rsh*0.01_rsh*dyval**1.15_rsh
   vish_xe(:,:,:) = 0.01_rsh
   vish_phi(:,:,:)= 0.01_rsh
   l_smagor=.TRUE.


! turbulence
! ----------

   z0bottom   =1.0e-13
   z0surface  =0.0_rsh
   nzinit0=1.0e-6
   kzinit=0.0_rsh

! Gaspard parametrization
   CALL cas_init_turb(kzinit,nzinit0,z0surface,z0bottom)

! over-assignement


! meteorology
! -----------

! no forcing
   CALL cas_init_meteo

! over-assignement
!test nbatm = 1


! River and outflows
! -------------------

! no river
   CALL cas_init_river


! initialization of the pronostic variables
! -----------------------------------------

! set to 0,tetaref,saliref
   CALL cas_init_progvar

! over-assignement


! Miscellaneous
! -------------

! Domain of calculation
! Percent of wet surface on each cell
   CALL cas_init_misc


! initialization of the forcing variables
! ---------------------------------------

   phieau(:,:,:)=0.0_rsh
   rain(:,:)=0.00001_rsh
   evap(:,:)=0.0_rsh
   rain(:,:)=0.0_rsh
   evap(:,:)=0.00001_rsh
   phieau(kmax,:,:)=0.001_rsh*(rain(:,:)-evap(:,:))*surf(limin:limax,ljmin:ljmax)


  END SUBROUTINE cas_evap
