Index: trunk/LMDZ.GENERIC/README
===================================================================
--- trunk/LMDZ.GENERIC/README	(revision 1494)
+++ trunk/LMDZ.GENERIC/README	(revision 1498)
@@ -1106,2 +1106,5 @@
 == 05/11/2015 == MT
 - Minor Albedo correction of bugs in rcm1d.
+
+== 13/11/2015 == MT
+- Spectral Snow Albebdo implemented in the code.
Index: trunk/LMDZ.GENERIC/deftank/callphys.GJ581d
===================================================================
--- trunk/LMDZ.GENERIC/deftank/callphys.GJ581d	(revision 1494)
+++ trunk/LMDZ.GENERIC/deftank/callphys.GJ581d	(revision 1498)
@@ -126,6 +126,15 @@
 # Include hydrology ?
 hydrology     = .true.
+# Spectral Dependant Albedo ?
+albedo_spectral_mode=.false.
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+# If albedo_spectral_mode=.true., albedosnow becomes the 0.5 micron snow albedo.
+#
+# albedosnow = 0.95  (0.73 Sun-integrated) for fresh snow.
+#            = 0.50  (0.39 Sun-integrated) for dirty snow.
+#            = 0.645 (0.50 Sun-integrated) for 'realistic' snow.
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 # H2O snow (and ice) albedo ?
-albedosnow    = 0.5
+albedosnow    = 0.50
 # Maximum sea ice thickness ?
 maxicethick   = 0.05
@@ -135,4 +144,6 @@
 ## CO2 options 
 ## ~~~~~~~~~~~
+# Co2 ice albedo ?
+albedoco2ice   = 0.5
 # gas is non-ideal CO2 ?
 nonideal      = .false.
Index: trunk/LMDZ.GENERIC/deftank/callphys.earlymars
===================================================================
--- trunk/LMDZ.GENERIC/deftank/callphys.earlymars	(revision 1494)
+++ trunk/LMDZ.GENERIC/deftank/callphys.earlymars	(revision 1498)
@@ -133,6 +133,15 @@
 # Include hydrology ?
 hydrology     = .true.
+# Spectral Dependant Albedo ?
+albedo_spectral_mode=.false.
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+# If albedo_spectral_mode=.true., albedosnow becomes the 0.5 micron snow albedo.
+#
+# albedosnow = 0.95  (0.73 Sun-integrated) for fresh snow.
+#            = 0.50  (0.39 Sun-integrated) for dirty snow.
+#            = 0.645 (0.50 Sun-integrated) for 'realistic' snow.
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 # H2O snow (and ice) albedo ?
-albedosnow    = 0.5
+albedosnow    = 0.50
 # Maximum sea ice thickness ?
 maxicethick   = 0.05
@@ -146,4 +155,6 @@
 ## CO2 options 
 ## ~~~~~~~~~~~
+# Co2 ice albedo ?
+albedoco2ice   = 0.5
 # gas is non-ideal CO2 ?
 nonideal      = .false.
Index: trunk/LMDZ.GENERIC/deftank/callphys.earth
===================================================================
--- trunk/LMDZ.GENERIC/deftank/callphys.earth	(revision 1494)
+++ trunk/LMDZ.GENERIC/deftank/callphys.earth	(revision 1498)
@@ -132,6 +132,15 @@
 # WATER: hydrology ?
 hydrology     = .true.
+# Spectral Dependant Albedo ?
+albedo_spectral_mode=.false.
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+# If albedo_spectral_mode=.true., albedosnow becomes the 0.5 micron snow albedo.
+#
+# albedosnow = 0.95  (0.73 Sun-integrated) for fresh snow.
+#            = 0.50  (0.39 Sun-integrated) for dirty snow.
+#            = 0.78  (0.60 Sun-integrated) for 'realistic' snow.
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 # H2O snow (and ice) albedo ?
-albedosnow    = 0.6
+albedosnow    = 0.60
 # Maximum sea ice thickness ?
 maxicethick   = 10.
@@ -143,4 +152,6 @@
 ## CO2 options 
 ## ~~~~~~~~~~~
+# Co2 ice albedo ?
+albedoco2ice   = 0.5
 # gas is non-ideal CO2 ?
 nonideal      = .false.
Index: trunk/LMDZ.GENERIC/deftank/earth1d_Dry.callphys.def
===================================================================
--- trunk/LMDZ.GENERIC/deftank/earth1d_Dry.callphys.def	(revision 1494)
+++ trunk/LMDZ.GENERIC/deftank/earth1d_Dry.callphys.def	(revision 1498)
@@ -167,6 +167,15 @@
 # Include hydrology ?
 hydrology     = .false.
+# Spectral Dependant Albedo ?
+albedo_spectral_mode=.false.
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+# If albedo_spectral_mode=.true., albedosnow becomes the 0.5 micron snow albedo.
+#
+# albedosnow = 0.95  (0.73 Sun-integrated) for fresh snow.
+#            = 0.50  (0.39 Sun-integrated) for dirty snow.
+#            = 0.645 (0.50 Sun-integrated) for 'realistic' snow.
+# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 # H2O snow (and ice) albedo ?
-albedosnow    = 0.5
+albedosnow    = 0.50
 # Maximum sea ice thickness ?
 maxicethick   = 0.5
@@ -178,4 +187,6 @@
 ## CO2 options 
 ## ~~~~~~~~~~~
+# Co2 ice albedo ?
+albedoco2ice   = 0.5
 # call CO2 condensation ?
 co2cond       = .false.
Index: trunk/LMDZ.GENERIC/libf/phystd/albedo_calcv.F90
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/albedo_calcv.F90	(revision 1498)
+++ trunk/LMDZ.GENERIC/libf/phystd/albedo_calcv.F90	(revision 1498)
@@ -0,0 +1,47 @@
+      SUBROUTINE spectral_albedo_calc(albedo_snow_SPECTV)
+
+
+      use callkeys_mod, only : albedosnow
+      use radinc_h, only : L_NSPECTV
+      use radcommon_h, only: BWNV
+
+      IMPLICIT NONE
+      
+      
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!
+!!!!!!!!!
+!
+!   Spectral Albedo Loading ...
+!
+!!!!!!!!!
+!
+! - Snow Albedo. Added by MT (10/2015)
+!
+! What has to be added next : Spectral albedo of CO2 ice, of oceans, ...
+!    
+!
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+
+      REAL albedo_snow_SPECTV(L_NSPECTV) ! Snow spectral albedo.
+      REAL lambda_temp(L_NSPECTV)        ! Visible band wavelengths.
+      INTEGER nw
+
+
+      DO nw=1,L_NSPECTV
+      
+         ! Corresponding Middle-Band Wavelength Number Calculation.
+         lambda_temp(nw)=0.5*(10000.0/BWNV(nw)+10000.0/BWNV(nw+1))
+	 
+         ! Spectral Snow Albedo Calculation.
+	 call albedo_snow_calc(lambda_temp(nw),        &
+	                      albedo_snow_SPECTV(nw),  & 
+	                      albedosnow)
+         
+      ENDDO
+
+      RETURN
+      END
Index: trunk/LMDZ.GENERIC/libf/phystd/albedo_snow_calc.F90
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/albedo_snow_calc.F90	(revision 1498)
+++ trunk/LMDZ.GENERIC/libf/phystd/albedo_snow_calc.F90	(revision 1498)
@@ -0,0 +1,49 @@
+      subroutine albedo_snow_calc(lambda,albedo,A_sw)
+
+      real lambda_sw
+      real lambda_lw
+      real A_sw
+      real A_lw
+      real albedo
+      real lambda
+      
+      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+      !!!!! Routine written by Martin TURBET (July 2015)
+      !!!!!
+      !!!!! Albedo expression derived from Yoshi et al. and Warren et al. articles.
+      !!!!!
+      !!
+      !! Short Wave Snow Albedo 'A_sw' (at 0.5 microns) must be chosen in callphys.def file.
+      !! 
+      !!!!!
+      !!!!!
+      !! Some Calibration Informations :
+      !!!!!
+      !!!!!
+      !!
+      !! 1. For Pure Snow, A_sw (at 0.5 microns) should be equal to ~0.95
+      !!    -> This gives an equivalent integrated snow albedo of ~0.73 for the Sun.
+      !!
+      !! 2. For Dusty Snow, A_sw (at 0.5 microns) should be equal to ~0.50.
+      !!    -> This gives an equivalent integrated snow albedo of ~0.39 for the Sun.
+      !!
+      !! 3. For 'Realistic' Snow, A_sw (at 0.5 microns) should be equal to ~0.645.
+      !!    -> This gives an equivalent integrated snow albedo of ~0.50 for the Sun.
+      !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+      A_lw=5.0D-2
+      lambda_sw=9.0D-1
+      lambda_lw=1.4
+      
+      if (lambda .le. lambda_sw) then
+         albedo=A_sw
+      else if (lambda .ge. lambda_lw) then
+         albedo=A_lw
+      else if ( (lambda .gt. lambda_sw) .and. &
+             (lambda .lt. lambda_lw) ) then
+         albedo=A_sw-(lambda-lambda_sw)*(A_sw-A_lw) &
+           /(lambda_lw-lambda_sw)  
+      end if
+
+      return
+      end
Index: trunk/LMDZ.GENERIC/libf/phystd/callcorrk.F90
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/callcorrk.F90	(revision 1494)
+++ trunk/LMDZ.GENERIC/libf/phystd/callcorrk.F90	(revision 1498)
@@ -231,5 +231,5 @@
          call sugas_corrk       ! Set up gaseous absorption properties.
          call suaer_corrk       ! Set up aerosol optical properties.
-
+        
 
          if((igcm_h2o_vap.eq.0) .and. varactive)then
Index: trunk/LMDZ.GENERIC/libf/phystd/callkeys_mod.F90
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/callkeys_mod.F90	(revision 1494)
+++ trunk/LMDZ.GENERIC/libf/phystd/callkeys_mod.F90	(revision 1498)
@@ -39,4 +39,5 @@
       logical ok_slab_sic
       logical ok_slab_heat_transp
+      logical albedo_spectral_mode
 
       integer iddist
Index: trunk/LMDZ.GENERIC/libf/phystd/inifis.F
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/inifis.F	(revision 1494)
+++ trunk/LMDZ.GENERIC/libf/phystd/inifis.F	(revision 1498)
@@ -614,6 +614,13 @@
          call getin_p("icetstep",icetstep)
          write(*,*) " icetstep = ",icetstep
+         
+         write(*,*) "Spectral Dependant albedo ?"
+         albedo_spectral_mode=.false. ! default value
+         call getin_p("albedo_spectral_mode",albedo_spectral_mode)
+         write(*,*) " albedo_spectral_mode = ",albedo_spectral_mode
 
          write(*,*) "Snow albedo ?"
+         write(*,*) "If albedo_spectral_mode=.true., then this "
+         write(*,*) "corresponds to the 0.5 microns snow albedo."
          albedosnow=0.5         ! default value
          call getin_p("albedosnow",albedosnow)
Index: trunk/LMDZ.GENERIC/libf/phystd/physiq.F90
===================================================================
--- trunk/LMDZ.GENERIC/libf/phystd/physiq.F90	(revision 1494)
+++ trunk/LMDZ.GENERIC/libf/phystd/physiq.F90	(revision 1498)
@@ -539,5 +539,4 @@
          call surfini(ngrid,nq,qsurf,albedo,albedo_bareground,albedo_snow_SPECTV,albedo_co2_ice_SPECTV) 
          
-         
 !        Initialize orbital calculation. 
 !        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -928,4 +927,9 @@
                ! Net atmospheric radiative heating rate (K.s-1)
                dtrad(1:ngrid,1:nlayer)=zdtsw(1:ngrid,1:nlayer)+zdtlw(1:ngrid,1:nlayer)
+               
+               ! Late initialization of the Ice Spectral Albedo. We needed the visible bands to do that ! 
+               if (firstcall .and. albedo_spectral_mode) then
+                  call spectral_albedo_calc(albedo_snow_SPECTV)
+               endif
 
             elseif(newtonian)then
@@ -951,15 +955,8 @@
                print*,'------------WARNING---WARNING------------' ! by MT2015.
                print*,'You are in corrk=false mode, '
-               print*,'and the surface albedo is taken equal to its value at 0.5 micrometers ...'
-               if ( (10000./BWNV(1) .le. 0.5) .or. (10000./BWNV(L_NSPECTV) .ge. 0.5) ) then
-                  print*,'0.5 microns band doesnt match your visible bands ! Abort !'
-                  call abort
-               endif
-               DO nw=1, L_NSPECTV-1
-                  if ( (10000./BWNV(nw) .ge. 0.5) .and. (10000./BWNV(nw+1) .lt. 0.5) ) then
-                     fluxsurfabs_sw(1:ngrid) = fluxtop_dn(1:ngrid)*(1.-albedo(1:ngrid,nw))
-                     fluxrad_sky(1:ngrid)    = fluxsurfabs_sw(1:ngrid)
-                  endif
-               ENDDO
+               print*,'and the surface albedo is taken equal to the first visible spectral value'               
+               
+               fluxsurfabs_sw(1:ngrid) = fluxtop_dn(1:ngrid)*(1.-albedo(1:ngrid,1))
+               fluxrad_sky(1:ngrid)    = fluxsurfabs_sw(1:ngrid)
                fluxtop_lw(1:ngrid)  = emis(1:ngrid)*sigma*tsurf(1:ngrid)**4
 
