Ignore:
Timestamp:
Feb 28, 2017, 10:05:52 PM (8 years ago)
Author:
oboucher
Message:

Correcting bug on current day in the year in RSUN forcing

File:
1 edited

Legend:

Unmodified
Added
Removed
  • LMDZ5/trunk/libf/phylmd/rrtm/read_rsun_rrtm.F90

    r2742 r2803  
    1010  USE netcdf, ONLY: nf90_get_var, nf90_noerr, nf90_nowrite
    1111
    12   USE phys_cal_mod, ONLY : day_cur, year_len
     12  USE phys_cal_mod, ONLY : days_elapsed, year_len
    1313
    1414  USE mod_phys_lmdz_mpi_data, ONLY: is_mpi_root
     
    2323
    2424  ! Input arguments
    25   LOGICAL, INTENT(IN)          :: debut
     25  LOGICAL, INTENT(IN) :: debut
    2626
    2727! Local variables
    28   INTEGER               :: ncid, dimid, varid, ncerr, nbday
     28  INTEGER :: ncid, dimid, varid, ncerr, nbday
    2929  REAL, POINTER :: wlen(:), time(:)
    30   REAL, ALLOCATABLE, SAVE, DIMENSION(:,:)   :: SSI_FRAC
     30  REAL, ALLOCATABLE, SAVE, DIMENSION(:,:) :: SSI_FRAC
    3131!$OMP THREADPRIVATE(SSI_FRAC)
    3232  REAL, ALLOCATABLE, SAVE, DIMENSION(:) :: TSI(:)
     
    9090    ENDIF
    9191
    92 !--only read at beginning of month
    93     IF (debut.OR.day_cur.NE.day_pre) THEN
     92!--only read at beginning of day
     93!--day in year is provided as days_elapsed since the beginning of the year +1
     94    IF (debut.OR.days_elapsed+1.NE.day_pre) THEN
    9495
    95 !--keep memory of previous month
    96       day_pre=day_cur
     96!--keep memory of previous day
     97      day_pre=days_elapsed+1
    9798
    9899!--copy
    99       RSUN(1:NSW)=SSI_FRAC(:,day_cur)
    100       solaire=TSI(day_cur)
     100      RSUN(1:NSW)=SSI_FRAC(:,days_elapsed+1)
     101      solaire=TSI(days_elapsed+1)
    101102
    102       print *,'READ_RSUN_RRTM day=', day_cur,' solaire=', solaire, ' RSUN=', RSUN(1:NSW)
     103      print *,'READ_RSUN_RRTM day=', days_elapsed+1,' solaire=', solaire, ' RSUN=', RSUN(1:NSW)
    103104
    104105    ENDIF !--fin allocation
Note: See TracChangeset for help on using the changeset viewer.