!
! $Id: surface_data.f90 5662 2025-05-20 14:24:41Z fairhead $
!
MODULE surface_data

  IMPLICIT NONE

  REAL, PARAMETER        :: calice=1.0/(5.1444e+06*0.15)
  REAL, PARAMETER        :: calsno=1./(2.3867e+06*.15)
  
  LOGICAL, SAVE          :: ok_veget      ! true for use of vegetation model ORCHIDEE
  !$OMP THREADPRIVATE(ok_veget)

  CHARACTER(len=10), SAVE :: type_veget   ! orchidee/y/bucket/n/betaclim
  !$OMP THREADPRIVATE(type_veget)

  CHARACTER(len=6), SAVE :: type_ocean    ! force/slab/couple
  !$OMP THREADPRIVATE(type_ocean)

  !GG
  INTEGER, SAVE          :: iflag_seaice
  !$OMP THREADPRIVATE(iflag_seaice)
  INTEGER, SAVE          :: iflag_seaice_alb
  !$OMP THREADPRIVATE(iflag_seaice_alb)
  INTEGER, SAVE          :: iflag_leads
  !$OMP THREADPRIVATE(iflag_leads)

  !For sea-ice
  REAL,SAVE             :: sice_cond
  !$OMP THREADPRIVATE(sice_cond)
  REAL,SAVE             :: sisno_cond
  !$OMP THREADPRIVATE(sisno_cond)
  REAL,SAVE             :: sisno_den
  !$OMP THREADPRIVATE(sisno_den)
  REAL,SAVE             :: sisno_min
  !$OMP THREADPRIVATE(sisno_min)
  REAL,SAVE             :: sithick_min
  !$OMP THREADPRIVATE(sithick_min)
  REAL,SAVE             :: sisno_wfact
  !$OMP THREADPRIVATE(sisno_wfact)
  REAL,SAVE             :: amax_n
  !$OMP THREADPRIVATE(amax_n)
  REAL,SAVE             :: amax_s
  !$OMP THREADPRIVATE(amax_s)
  REAL,SAVE             :: rn_alb_sdry
  !$OMP THREADPRIVATE(rn_alb_sdry)
  REAL,SAVE             :: rn_alb_smlt
  !$OMP THREADPRIVATE(rn_alb_smlt)
  REAL,SAVE             :: rn_alb_idry
  !$OMP THREADPRIVATE(rn_alb_idry)
  REAL,SAVE             :: rn_alb_imlt
  !$OMP THREADPRIVATE(rn_alb_imlt)
  REAL,SAVE             :: si_pen_frac
  !$OMP THREADPRIVATE(si_pen_frac)
  REAL,SAVE             :: si_pen_ext
  !$OMP THREADPRIVATE(si_pen_ext)
  REAL,SAVE             :: fseaN
  !$OMP THREADPRIVATE(fseaN)
  REAL,SAVE             :: fseaS
  !$OMP THREADPRIVATE(fseaS)
  !GG

  ! if type_ocean=couple : version_ocean=opa8 ou nemo
  ! if type_ocean=slab   : version_ocean=sicOBS or sicINT or sicNO
  CHARACTER(len=6), SAVE :: version_ocean 
  !$OMP THREADPRIVATE(version_ocean)

  ! Pas de temps couplage atm/oce (en secondes)
  REAL, SAVE             :: t_coupl
  !$OMP THREADPRIVATE(t_coupl)

  ! FOR INLANDSIS:
  !===============
 
   ! 1 for coupling with INLANDSIS
   INTEGER, SAVE          :: landice_opt   ! 1 for coupling with INLANDSIS
  !$OMP THREADPRIVATE(landice_opt)

  ! temperature calculation options within the soil and at the surface
   INTEGER, SAVE          :: iflag_tsurf_inlandsis,iflag_temp_inlandsis 
   !$OMP THREADPRIVATE(iflag_tsurf_inlandsis,iflag_temp_inlandsis)

  ! flags for albedo and roughness calc.
   INTEGER, SAVE          :: iflag_albcalc,iflag_z0m_snow
  !$OMP THREADPRIVATE(iflag_albcalc,iflag_z0m_snow)  

  ! with or without snow module/ blowing snow, ascii outfile
   LOGICAL, SAVE          :: SnoMod,BloMod,ok_outfor 
  !$OMP THREADPRIVATE(SnoMod,BloMod,ok_outfor)    

  ! activate slush, korlyakov snow density, RN z0h calc.
   LOGICAL, SAVE          :: is_ok_slush,is_ok_density_kotlyakov,is_ok_z0h_rn
  !$OMP THREADPRIVATE(is_ok_slush,is_ok_density_kotlyakov,is_ok_z0h_rn) 

  ! activate detection snow/ice layers and option XF discrtet/option runoff AC
   LOGICAL, SAVE          :: ok_zsn_ii,discret_xf,opt_runoff_ac
  !$OMP THREADPRIVATE(ok_zsn_ii,discret_xf, opt_runoff_ac)

  ! value of z0m snow when prescribed and albedo correction term
   REAL, SAVE             :: prescribed_z0m_snow,correc_alb
  !$OMP THREADPRIVATE(prescribed_z0m_snow, correc_alb)

  ! value of sphericity [0-99] and snow grain size [e-4m] for polar buffer snow
  ! layer
   REAL, SAVE             :: buf_sph_pol,buf_siz_pol
  !$OMP THREADPRIVATE(buf_sph_pol,buf_siz_pol)



END MODULE surface_data
