Index: LMDZ5/trunk/libf/phylmd/clesphys.h
===================================================================
--- LMDZ5/trunk/libf/phylmd/clesphys.h	(revision 2523)
+++ LMDZ5/trunk/libf/phylmd/clesphys.h	(revision 2524)
@@ -15,4 +15,5 @@
        INTEGER nbapp_rad, iflag_con,iflag_ener_conserv
        REAL co2_ppm, co2_ppm0, solaire
+       LOGICAL ok_suntime_rrtm
        REAL(kind=8) RCO2, RCH4, RN2O, RCFC11, RCFC12  
        REAL(kind=8) RCO2_act, RCH4_act, RN2O_act, RCFC11_act, RCFC12_act  
@@ -110,7 +111,8 @@
      &     , top_height                                                 &
      &     , cycle_diurne, soil_model, new_oliq                         &
-     &     ,ok_orodr, ok_orolf, ok_limitvrai, nbapp_rad, iflag_con      &
+     &     , ok_orodr, ok_orolf, ok_limitvrai, nbapp_rad, iflag_con     &
      &     , iflag_ener_conserv                                         &
      &     , ok_4xCO2atm                                                & 
+     &     , ok_suntime_rrtm                                            & 
      &     , overlap                                                    &
      &     , ok_kzmin                                                   &
@@ -129,3 +131,2 @@
        save /clesphys/
 !$OMP THREADPRIVATE(/clesphys/)
- 
Index: LMDZ5/trunk/libf/phylmd/conf_phys_m.F90
===================================================================
--- LMDZ5/trunk/libf/phylmd/conf_phys_m.F90	(revision 2523)
+++ LMDZ5/trunk/libf/phylmd/conf_phys_m.F90	(revision 2524)
@@ -148,4 +148,5 @@
 
     REAL,SAVE :: R_ecc_omp,R_peri_omp,R_incl_omp,solaire_omp
+    LOGICAL,SAVE :: ok_suntime_rrtm_omp
     REAL,SAVE :: co2_ppm_omp, RCO2_omp, co2_ppm_per_omp, RCO2_per_omp
     REAL,SAVE :: CH4_ppb_omp, RCH4_omp, CH4_ppb_per_omp, RCH4_per_omp
@@ -515,4 +516,14 @@
     call getin('solaire', solaire_omp)
     !
+    !Config Key  = ok_sun_time
+    !Config Desc = oui ou non variabilite solaire
+    !Config Def  = .false.
+    !Config Help =
+    !
+    !
+    !valeur AMIP II
+    ok_suntime_rrtm_omp = .false.
+    call getin('ok_suntime_rrtm',ok_suntime_rrtm_omp)
+    !
     !Config Key  = co2_ppm
     !Config Desc = concentration du gaz carbonique en ppmv
@@ -1967,4 +1978,5 @@
     R_incl = R_incl_omp
     solaire = solaire_omp
+    ok_suntime_rrtm = ok_suntime_rrtm_omp
     co2_ppm = co2_ppm_omp
     RCO2 = RCO2_omp
@@ -2281,4 +2293,5 @@
     write(lunout,*)' Inclinaison =',R_incl
     write(lunout,*)' Constante solaire =',solaire
+    write(lunout,*)' ok_suntime_rrtm =',ok_suntime_rrtm
     write(lunout,*)' co2_ppm =',co2_ppm
     write(lunout,*)' RCO2_act = ',RCO2_act
Index: LMDZ5/trunk/libf/phylmd/physiq_mod.F90
===================================================================
--- LMDZ5/trunk/libf/phylmd/physiq_mod.F90	(revision 2523)
+++ LMDZ5/trunk/libf/phylmd/physiq_mod.F90	(revision 2524)
@@ -69,4 +69,5 @@
 #ifdef CPP_RRTM
     USE YOERAD, ONLY : NRADLP
+    USE YOESW, ONLY : RSUN
 #endif
     USE ioipsl_getin_p_mod, ONLY : getin_p
@@ -432,8 +433,4 @@
     REAL d_t_adjwk(klon,klev)                !jyg
     REAL d_q_adjwk(klon,klev)                !jyg
-
-    REAL,SAVE :: oliqmax=999.    ! Seuil en kg/kg pour le contenu max
-    !$OMP THREADPRIVATE(oliqmax) ! en eau liquide dans l'atmosphère.
-
     LOGICAL,SAVE :: ok_adjwk=.FALSE.
     !$OMP THREADPRIVATE(ok_adjwk) 
@@ -1054,5 +1051,4 @@
        CALL getin_p('random_notrig_max',random_notrig_max)
        CALL getin_p('ok_adjwk',ok_adjwk)
-       CALL getin_p('oliqmax',oliqmax)
     ENDIF
 
@@ -2884,19 +2880,5 @@
     CALL add_phys_tend(du0,dv0,d_t_lsc,d_q_lsc,d_ql_lsc,d_qi_lsc,paprs, &
          'lsc',abortphy)
-
-   !---------------------------------------------------------------------------
-   ! Elimination d'eau liquide > oliqmax
-   !---------------------------------------------------------------------------
-    rain_num(:)=0.
-    DO k = 1, klev  
-       DO i = 1, klon
-          IF (ql_seri(i,k)>oliqmax) THEN
-             rain_num(i)=rain_num(i)+(ql_seri(i,k)-oliqmax)*zmasse(i,k)/pdtphys
-             ql_seri(i,k)=oliqmax
-          ENDIF
-       ENDDO
-    ENDDO
-    rain_lsc(:)=rain_lsc(:)+rain_num(:)
-
+    !---------------------------------------------------------------------------
     DO k = 1, klev
        DO i = 1, klon
@@ -3429,4 +3411,19 @@
        !enddo
        !albedo SB <<<
+
+!--if ok_suntime_rrtm we use ancillay data for RSUN 
+!--previous values are therefore overwritten
+!--this is needed for CMIP6 runs
+!--and only possible for new radiation scheme
+       IF (iflag_rrtm.EQ.1.AND.ok_suntime_rrtm) THEN 
+         CALL read_rsun_rrtm(debut)
+       ENDIF
+
+       if (mydebug) then
+          call writefield_phy('u_seri',u_seri,nbp_lev)
+          call writefield_phy('v_seri',v_seri,nbp_lev)
+          call writefield_phy('t_seri',t_seri,nbp_lev)
+          call writefield_phy('q_seri',q_seri,nbp_lev)
+       endif
 
        !
Index: LMDZ5/trunk/libf/phylmd/rrtm/read_rsun_rrtm.F90
===================================================================
--- LMDZ5/trunk/libf/phylmd/rrtm/read_rsun_rrtm.F90	(revision 2524)
+++ LMDZ5/trunk/libf/phylmd/rrtm/read_rsun_rrtm.F90	(revision 2524)
@@ -0,0 +1,100 @@
+SUBROUTINE read_rsun_rrtm(debut)
+
+!****************************************************************************************
+! This routine will read the solar constant fraction per band
+!
+! Olivier Boucher with inputs from Marion Marchand 
+!****************************************************************************************
+
+  USE netcdf95, ONLY: nf95_close, nf95_inq_varid, nf95_open, nf95_gw_var
+  USE netcdf, ONLY: nf90_get_var, nf90_noerr, nf90_nowrite
+
+  USE phys_cal_mod, ONLY : day_cur, year_len
+
+  USE mod_phys_lmdz_mpi_data, ONLY: is_mpi_root
+  USE mod_phys_lmdz_omp_data, ONLY: is_omp_root
+  USE mod_phys_lmdz_para
+
+  USE YOESW    , ONLY : RSUN
+
+  IMPLICIT NONE
+
+  INCLUDE "clesphys.h"
+
+  ! Input arguments
+  LOGICAL, INTENT(IN)          :: debut
+
+! Local variables
+  INTEGER               :: ncid, dimid, varid, ncerr, nbday
+  REAL, POINTER :: wlen(:), time(:)
+  REAL, ALLOCATABLE, SAVE, DIMENSION(:,:)   :: SSI_FRAC
+!$OMP THREADPRIVATE(SSI_FRAC)
+  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: TSI(:)
+!$OMP THREADPRIVATE(TSI)
+
+  INTEGER, SAVE :: day_pre
+
+!--only one processor reads
+    IF (debut) THEN 
+
+    ALLOCATE(SSI_FRAC(NSW,year_len))
+    ALLOCATE(TSI(year_len))
+
+    IF (is_mpi_root.AND.is_omp_root) THEN
+
+       CALL nf95_open('solarforcing.nc', NF90_NOWRITE, ncid)
+
+       CALL nf95_inq_varid(ncid, 'wlen', varid)
+       CALL nf95_gw_var(ncid, varid, wlen)
+
+       CALL nf95_inq_varid(ncid, 'time', varid)
+       CALL nf95_gw_var(ncid, varid, time)
+
+       IF (NSW.NE.size(wlen)) THEN 
+         PRINT *,'read_rsun_rrtm NSW <> wlen = ',NSW, size(wlen)
+         CALL abort_physic('read_rsun_rrtm','size of SSI is different from NSW',1)
+       ENDIF
+
+       IF (size(time).NE.year_len) THEN 
+         PRINT *,'read_rsun_rrtm time <> year_len = ', size(time), year_len
+         CALL abort_physic('read_rsun_rrtm','time dim should be the number of days in year',1)
+       ENDIF
+
+       CALL nf95_inq_varid(ncid, 'ssi_frac', varid)
+       ncerr = nf90_get_var(ncid, varid, SSI_FRAC)
+
+       CALL nf95_inq_varid(ncid, 'tsi', varid)
+       ncerr = nf90_get_var(ncid, varid, TSI)
+
+       CALL nf95_close(ncid)
+
+       DO nbday=1, year_len
+         IF (ABS(SUM(SSI_FRAC(:,nbday))-1.).GT.1.e-6) THEN 
+           PRINT *,'somme SSI_FRAC=', SUM(SSI_FRAC(:,nbday))
+           CALL abort_physic('read_rsun_rrtm','somme SSI_FRAC <> 1',1)
+         ENDIF
+       ENDDO
+     
+    ENDIF ! is_mpi_root .AND. is_omp_root
+
+!$OMP BARRIER
+    CALL bcast(SSI_FRAC)
+    CALL bcast(TSI)
+
+    ENDIF
+
+!--only read at beginning of month
+    IF (debut.OR.day_cur.NE.day_pre) THEN
+
+!--keep memory of previous month
+      day_pre=day_cur
+
+!--copy 
+      RSUN(:)=SSI_FRAC(:,day_cur)
+      solaire=TSI(day_cur)
+
+      print *,'READ_RSUN_RRTM day=', day_cur,' solaire=', solaire, ' RSUN=', RSUN(1:NSW)
+
+    ENDIF !--fin allocation
+
+END SUBROUTINE read_rsun_rrtm
