Changeset 1270 for LMDZ4/branches


Ignore:
Timestamp:
Nov 25, 2009, 3:02:45 PM (15 years ago)
Author:
Laurent Fairhead
Message:

Les nouvelles routines de lecture des aerosols posent probleme en multiproc. On revient aux routines
precedentes en incluant le traitement du calendrier realiste.

Location:
LMDZ4/branches/LMDZ4-dev/libf/phylmd
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • LMDZ4/branches/LMDZ4-dev/libf/phylmd/readaerosol.F90

    r1265 r1270  
    77CONTAINS
    88
    9 SUBROUTINE readaerosol(name_aero, type, iyr_in, klev_src, pt_ap, pt_b, pt_out, pt_psurf, pt_load, nbr_tsteps)
     9SUBROUTINE readaerosol(name_aero, type, iyr_in, klev_src, pt_ap, pt_b, pt_out, psurf, load)
    1010
    1111!****************************************************************************************
     
    3434  REAL, POINTER, DIMENSION(:)     :: pt_ap        ! Pointer for describing the vertical levels     
    3535  REAL, POINTER, DIMENSION(:)     :: pt_b         ! Pointer for describing the vertical levels     
    36   REAL, POINTER, DIMENSION(:,:,:) :: pt_out       ! The massvar distributions, DIMENSION(klon,klev_src, nbr_tsteps)
    37   REAL, POINTER, DIMENSION(:,:)   :: pt_psurf     ! The massvar distributions, DIMENSION(klon, nbr_tsteps)
    38   REAL, POINTER, DIMENSION(:,:)   :: pt_load      ! The massvar distributions, DIMENSION(klon, nbr_tsteps)
    39   INTEGER                         :: nbr_tsteps   ! number of timesteps in read file (12 or 14)
     36  REAL, POINTER, DIMENSION(:,:,:) :: pt_out       ! The massvar distributions, DIMENSION(klon, klev_src, 12)
     37  REAL, DIMENSION(klon,12), INTENT(OUT) :: psurf  ! Surface pression for 12 months
     38  REAL, DIMENSION(klon,12), INTENT(OUT) :: load   ! Aerosol mass load in each column for 12 months
    4039
    4140  ! Local variables
    42   CHARACTER(len=4)                  :: cyear
    43   REAL, POINTER, DIMENSION(:,:,:)   :: pt_2
    44   REAL, POINTER, DIMENSION(:,:)     :: psurf2, load2
    45   REAL                              :: p0           ! Reference pressure
    46   INTEGER                           :: iyr1, iyr2, klev_src2
    47   INTEGER                           :: it, k, i
    48   LOGICAL, PARAMETER                :: lonlyone=.FALSE.
     41  CHARACTER(len=4)                :: cyear
     42  REAL, POINTER, DIMENSION(:,:,:) :: pt_2
     43  REAL, DIMENSION(klon,12)        :: psurf2, load2
     44  REAL                            :: p0           ! Reference pressure
     45  INTEGER                         :: iyr1, iyr2, klev_src2
     46  INTEGER                         :: it, k, i
     47  LOGICAL, PARAMETER              :: lonlyone=.FALSE.
    4948
    5049!****************************************************************************************
     
    5756!****************************************************************************************
    5857     cyear='1980'
    59      ! get_aero_fromfile returns pt_out allocated and initialized with data for nbr_tsteps month
    60      ! pt_out has dimensions (klon, klev_src, nbr_tsteps)
    61      CALL get_aero_fromfile(name_aero, cyear, klev_src, pt_ap, pt_b, p0, pt_out, pt_psurf, pt_load, nbr_tsteps)
     58     ! get_aero_fromfile returns pt_out allocated and initialized with data for 12 month
     59     ! pt_out has dimensions (klon, klev_src, 12)
     60     CALL get_aero_fromfile(name_aero, cyear, klev_src, pt_ap, pt_b, p0, pt_out, psurf, load)
    6261     
    6362
     
    6665!****************************************************************************************     
    6766     cyear='.nat'
    68      ! get_aero_fromfile returns pt_out allocated and initialized with data for nbr_tsteps month
    69      ! pt_out has dimensions (klon, klev_src, nbr_tsteps)
    70      CALL get_aero_fromfile(name_aero, cyear, klev_src, pt_ap, pt_b, p0, pt_out, pt_psurf, pt_load, nbr_tsteps)
    71 
    72   ELSE IF (type == 'annuel') THEN
    73 ! Read and return data from scenario annual files
    74 !****************************************************************************************     
    75      WRITE(cyear,'(I4)') iyr_in
    76      WRITE(lunout,*) 'get_aero 3 iyr_in=', iyr_in,'   ',cyear
    77      ! get_aero_fromfile returns pt_out allocated and initialized with data for nbr_tsteps month
    78      ! pt_out has dimensions (klon, klev_src, nbr_tsteps)
    79      CALL get_aero_fromfile(name_aero, cyear, klev_src, pt_ap, pt_b, p0, pt_out, pt_psurf, pt_load, nbr_tsteps)
    80      
     67     ! get_aero_fromfile returns pt_out allocated and initialized with data for 12 month
     68     ! pt_out has dimensions (klon, klev_src, 12)
     69     CALL get_aero_fromfile(name_aero, cyear, klev_src, pt_ap, pt_b, p0, pt_out, psurf, load)
    8170     
    8271  ELSE IF (type == 'scenario') THEN
     
    8675        cyear='.nat'
    8776        WRITE(lunout,*) 'get_aero 1 iyr_in=', iyr_in,'   ',cyear
    88         ! get_aero_fromfile returns pt_out allocated and initialized with data for nbr_tsteps month
    89         ! pt_out has dimensions (klon, klev_src, nbr_tsteps)
    90         CALL get_aero_fromfile(name_aero, cyear, klev_src, pt_ap, pt_b, p0, pt_out, pt_psurf, pt_load, nbr_tsteps)
     77        ! get_aero_fromfile returns pt_out allocated and initialized with data for 12 month
     78        ! pt_out has dimensions (klon, klev_src, 12)
     79        CALL get_aero_fromfile(name_aero, cyear, klev_src, pt_ap, pt_b, p0, pt_out, psurf, load)
    9180       
    9281     ELSE IF (iyr_in .GE. 2100) THEN
    9382        cyear='2100'
    9483        WRITE(lunout,*) 'get_aero 2 iyr_in=', iyr_in,'   ',cyear
    95         ! get_aero_fromfile returns pt_out allocated and initialized with data for nbr_tsteps month
    96         ! pt_out has dimensions (klon, klev_src, nbr_tsteps)
    97         CALL get_aero_fromfile(name_aero, cyear, klev_src, pt_ap, pt_b, p0, pt_out, pt_psurf, pt_load, nbr_tsteps)
     84        ! get_aero_fromfile returns pt_out allocated and initialized with data for 12 month
     85        ! pt_out has dimensions (klon, klev_src, 12)
     86        CALL get_aero_fromfile(name_aero, cyear, klev_src, pt_ap, pt_b, p0, pt_out, psurf, load)
    9887       
    9988     ELSE
     
    113102        WRITE(cyear,'(I4)') iyr1
    114103        WRITE(lunout,*) 'get_aero 3 iyr_in=', iyr_in,'   ',cyear
    115         ! get_aero_fromfile returns pt_out allocated and initialized with data for nbr_tsteps month
    116         ! pt_out has dimensions (klon, klev_src, nbr_tsteps)
    117         CALL get_aero_fromfile(name_aero, cyear, klev_src, pt_ap, pt_b, p0, pt_out, pt_psurf, pt_load, nbr_tsteps)
     104        ! get_aero_fromfile returns pt_out allocated and initialized with data for 12 month
     105        ! pt_out has dimensions (klon, klev_src, 12)
     106        CALL get_aero_fromfile(name_aero, cyear, klev_src, pt_ap, pt_b, p0, pt_out, psurf, load)
    118107       
    119108        ! If to read two decades:
     
    125114           
    126115           NULLIFY(pt_2)
    127            ! get_aero_fromfile returns pt_2 allocated and initialized with data for nbr_tsteps month
    128            ! pt_2 has dimensions (klon, klev_src, nbr_tsteps)
    129            CALL get_aero_fromfile(name_aero, cyear, klev_src2, pt_ap, pt_b, p0, pt_2, psurf2, load2, nbr_tsteps)
     116           ! get_aero_fromfile returns pt_2 allocated and initialized with data for 12 month
     117           ! pt_2 has dimensions (klon, klev_src, 12)
     118           CALL get_aero_fromfile(name_aero, cyear, klev_src2, pt_ap, pt_b, p0, pt_2, psurf2, load2)
    130119           ! Test for same number of vertical levels
    131120           IF (klev_src /= klev_src2) THEN
     
    135124           
    136125           ! Linare interpolate to the actual year:
    137            DO it=1,nbr_tsteps
     126           DO it=1,12
    138127              DO k=1,klev_src
    139128                 DO i = 1, klon
     
    145134
    146135              DO i = 1, klon
    147                  pt_psurf(i,it) = &
    148                       pt_psurf(i,it) - FLOAT(iyr_in-iyr1)/FLOAT(iyr2-iyr1) * &
    149                       (pt_psurf(i,it) - psurf2(i,it))
    150 
    151                  pt_load(i,it) = &
    152                       pt_load(i,it) - FLOAT(iyr_in-iyr1)/FLOAT(iyr2-iyr1) * &
    153                       (pt_load(i,it) - load2(i,it))
     136                 psurf(i,it) = &
     137                      psurf(i,it) - FLOAT(iyr_in-iyr1)/FLOAT(iyr2-iyr1) * &
     138                      (psurf(i,it) - psurf2(i,it))
     139
     140                 load(i,it) = &
     141                      load(i,it) - FLOAT(iyr_in-iyr1)/FLOAT(iyr2-iyr1) * &
     142                      (load(i,it) - load2(i,it))
    154143              END DO
    155144           END DO
     
    157146           ! Deallocate pt_2 no more needed
    158147           DEALLOCATE(pt_2)
    159            DEALLOCATE(psurf2)
    160            DEALLOCATE(load2)
    161148           
    162149        END IF ! lonlyone
     
    172159
    173160
    174   SUBROUTINE get_aero_fromfile(varname, cyr, klev_src, pt_ap, pt_b, p0, pt_year, pt_psurf_out, pt_load_out, nbr_tsteps)
    175 !****************************************************************************************
    176 ! Read nbr_tsteps month aerosol from file and distribute to local process on physical grid.
     161  SUBROUTINE get_aero_fromfile(varname, cyr, klev_src, pt_ap, pt_b, p0, pt_year, psurf_out, load_out)
     162!****************************************************************************************
     163! Read 12 month aerosol from file and distribute to local process on physical grid.
    177164! Vertical levels, klev_src, may differ from model levels if new file format.
    178165!
     
    210197    REAL, POINTER, DIMENSION(:)           :: pt_b         ! Pointer for describing the vertical levels     
    211198    REAL                                  :: p0           ! Reference pressure value
    212     REAL, POINTER, DIMENSION(:,:,:)       :: pt_year      ! Pointer-variabale from file, nbr_tsteps month, grid : klon,klev_src
    213     REAL, POINTER, DIMENSION(:,:)         :: pt_psurf_out    ! Surface pression for nbr_tsteps months
    214     REAL, POINTER, DIMENSION(:,:)         :: pt_load_out     ! Aerosol mass load in each column
    215     INTEGER                               :: nbr_tsteps ! number of month in file read
     199    REAL, POINTER, DIMENSION(:,:,:)       :: pt_year      ! Pointer-variabale from file, 12 month, grid : klon,klev_src
     200    REAL, DIMENSION(klon,12), INTENT(OUT) :: psurf_out    ! Surface pression for 12 months
     201    REAL, DIMENSION(klon,12), INTENT(OUT) :: load_out     ! Aerosol mass load in each column
    216202
    217203! Local variables
     
    223209    REAL                  :: npole, spole
    224210    REAL, ALLOCATABLE, DIMENSION(:,:,:)   :: varmth
    225     REAL, ALLOCATABLE, DIMENSION(:,:,:,:) :: varyear       ! Global variable read from file, nbr_tsteps month
    226     REAL, ALLOCATABLE, DIMENSION(:,:,:)   :: varyear_glo1D !(klon_glo, klev_src, nbr_tsteps)
     211    REAL, ALLOCATABLE, DIMENSION(:,:,:,:) :: varyear       ! Global variable read from file, 12 month
     212    REAL, ALLOCATABLE, DIMENSION(:,:,:)   :: varyear_glo1D !(klon_glo, klev_src, 12)
    227213    REAL, ALLOCATABLE, DIMENSION(:)       :: varktmp
    228214
    229     REAL, ALLOCATABLE, DIMENSION(:,:,:)   :: psurf_glo2D
    230     REAL, ALLOCATABLE, DIMENSION(:,:)     :: psurf_glo1D
    231     REAL, ALLOCATABLE, DIMENSION(:,:,:)   :: load_glo2D
    232     REAL, ALLOCATABLE, DIMENSION(:,:)     :: load_glo1D
     215    REAL, DIMENSION(iim,jjm+1,12)         :: psurf_glo2D   ! Surface pression for 12 months on dynamics global grid
     216    REAL, DIMENSION(klon_glo,12)          :: psurf_glo1D   ! -"- on physical global grid
     217    REAL, DIMENSION(iim,jjm+1,12)         :: load_glo2D    ! Load for 12 months on dynamics global grid
     218    REAL, DIMENSION(klon_glo,12)          :: load_glo1D    ! -"- on physical global grid
    233219    REAL, DIMENSION(iim,jjm+1)            :: vartmp
    234220    REAL, DIMENSION(iim)                  :: lon_src              ! longitudes in file
     
    287273          CALL abort_gcm('get_aero_fromfile', 'latitudes do not correspond between file and model',1)
    288274       END IF
    289 
    290 ! 1.5) Check number of month in file opened
    291 !
    292 !**************************************************************************************************
    293        ierr = nf90_inq_dimid(ncid, 'TIME',dimid)
    294 !       ierr = nf90_inq_dimlen(ncid, dimid, nbr_tsteps)
    295        CALL check_err( nf90_inquire_dimension(ncid, dimid, len = nbr_tsteps) )
    296        IF (nbr_tsteps /= 12 .AND. nbr_tsteps /= 14) THEN
    297          CALL abort_gcm('get_aero_fromfile', 'not the right number of months in aerosol file read',1)
    298        ENDIF
    299        write(lunout,*)'get_aero_fromfile: ', nbr_tsteps,' months to read from aerosols file'
    300        call bcast(nbr_tsteps)
    301 
    302 ! 1.6) Allocation of some variables once the number of months in the file has been determined
    303 !
    304 !**************************************************************************************************
    305        ALLOCATE(psurf_glo2D(iim, jjm+1, nbr_tsteps), load_glo2D(iim, jjm+1, nbr_tsteps), stat=ierr)
    306        IF (ierr /= 0) CALL abort_gcm('get_aero_fromfile', 'pb in allocation 0.5',1)
    307        ALLOCATE(psurf_glo1D(klon_glo, nbr_tsteps), load_glo1D(klon_glo, nbr_tsteps), stat=ierr)
    308        IF (ierr /= 0) CALL abort_gcm('get_aero_fromfile', 'pb in allocation 0.5',1)
    309 
    310275
    311276! 2) Check if old or new file is avalabale.
     
    336301       
    337302     ! Allocate variables depending on the number of vertical levels
    338        ALLOCATE(varmth(iim, jjm+1, klev_src), varyear(iim, jjm+1, klev_src, nbr_tsteps), stat=ierr)
     303       ALLOCATE(varmth(iim, jjm+1, klev_src), varyear(iim, jjm+1, klev_src, 12), stat=ierr)
    339304       IF (ierr /= 0) CALL abort_gcm('get_aero_fromfile', 'pb in allocation 1',1)
    340305
     
    358323          CALL check_err( nf90_get_var(ncid, varid, varyear(:,:,:,:)) )
    359324         
    360 ! ++) Read surface pression, nbr_tsteps month in one variable
     325! ++) Read surface pression, 12 month in one variable
    361326!****************************************************************************************
    362327          ! Get variable id
     
    398363! ++) Read the aerosol concentration month by month and concatenate to total variable varyear
    399364!****************************************************************************************
    400           DO imth=1, nbr_tsteps
     365          DO imth=1, 12
    401366             IF (imth.EQ.1) THEN
    402367                cvar=TRIM(varname)//'JAN'
     
    459424         
    460425          ! Inverse vertical levels for varyear
    461           DO imth=1, nbr_tsteps
     426          DO imth=1, 12
    462427             varmth(:,:,:) = varyear(:,:,:,imth) ! use varmth temporarly
    463428             DO k=1, klev_src
     
    490455
    491456!     - Invert latitudes if necessary
    492        DO imth=1, nbr_tsteps
     457       DO imth=1, 12
    493458          IF (invert_lat) THEN
    494459
     
    535500       END DO ! imth
    536501       
    537        ALLOCATE(varyear_glo1D(klon_glo, klev_src, nbr_tsteps), stat=ierr)
     502       ALLOCATE(varyear_glo1D(klon_glo, klev_src, 12), stat=ierr)
    538503       IF (ierr /= 0) CALL abort_gcm('get_aero_fromfile', 'pb in allocation 3',1)
    539504       
     
    567532    ! Allocate space for output pointer variable at local process
    568533    IF (ASSOCIATED(pt_year)) DEALLOCATE(pt_year)
    569     write(lunout,*)'get_aero_fromfile: klon, ...',klon, klev_src, nbr_tsteps
    570     ALLOCATE(pt_year(klon, klev_src, nbr_tsteps), stat=ierr)
    571 !    IF (ierr /= 0) CALL abort_gcm('get_aero_fromfile', 'pb in allocation 5.1',1)
    572     IF (ASSOCIATED(pt_psurf_out)) DEALLOCATE(pt_psurf_out)
    573     ALLOCATE(pt_psurf_out(klon, nbr_tsteps), stat=ierr)
    574 !    IF (ierr /= 0) CALL abort_gcm('get_aero_fromfile', 'pb in allocation 5.2',1)
    575     IF (ASSOCIATED(pt_load_out)) DEALLOCATE(pt_load_out)
    576     ALLOCATE(pt_load_out(klon, nbr_tsteps), stat=ierr)
    577 !    IF (ierr /= 0) CALL abort_gcm('get_aero_fromfile', 'pb in allocation 5.3',1)
     534    ALLOCATE(pt_year(klon, klev_src, 12), stat=ierr)
     535    IF (ierr /= 0) CALL abort_gcm('get_aero_fromfile', 'pb in allocation 5',1)
    578536
    579537    ! Scatter global field to local domain at local process
    580538    CALL scatter(varyear_glo1D, pt_year)
    581     CALL scatter(psurf_glo1D, pt_psurf_out)
    582     CALL scatter(load_glo1D,  pt_load_out)
     539    CALL scatter(psurf_glo1D, psurf_out)
     540    CALL scatter(load_glo1D,  load_out)
    583541
    584542! 7) Test for negative values
  • LMDZ4/branches/LMDZ4-dev/libf/phylmd/readaerosol_interp.F90

    r1269 r1270  
    7979
    8080  REAL, DIMENSION(:,:,:), POINTER   :: pt_tmp      ! Pointer allocated in readaerosol
    81   REAL, DIMENSION(:,:), POINTER     :: pt_tmp_surf ! Pointer allocated in readaerosol
    82   REAL, DIMENSION(:,:), POINTER     :: pt_tmp_load ! Pointer allocated in readaerosol
    83   REAL, DIMENSION(:,:), POINTER     :: pt_tmp_pi_surf ! Pointer allocated in readaerosol
    84   REAL, DIMENSION(:,:), POINTER     :: pt_tmp_pi_load ! Pointer allocated in readaerosol
    8581  REAL, POINTER, DIMENSION(:), SAVE :: pt_ap, pt_b ! Pointer for describing the vertical levels
    8682!$OMP THREADPRIVATE(pt_ap, pt_b)
    8783  INTEGER, SAVE                     :: nbr_tsteps ! number of time steps in file read
    8884  REAL, DIMENSION(14), SAVE         :: month_len, month_start, month_mid
    89 !$OMP THREADPRIVATE(month_len, month_start, month_mid)
     85!$OMP THREADPRIVATE(nbr_tsteps, month_len, month_start, month_mid)
    9086  REAL                              :: jDay
    9187
    92 !$OMP THREADPRIVATE(nbr_tsteps)
    9388  LOGICAL            :: lnewday      ! Indicates if first time step at a new day
    9489  LOGICAL            :: OLDNEWDAY
     
    110105
    111106  ! Use phys_cal_mod
    112 ! iday= day_cur
    113 ! iyr = year_cur
    114 ! im  = mth_cur
     107  !iday= day_cur
     108  !iyr = year_cur
     109  !im  = mth_cur
    115110
    116111  iday = INT(r_day)
     
    153148     IF (ierr /= 0) CALL abort_gcm('readaerosol_interp', 'pb in allocation 2',1)
    154149
    155 !     ALLOCATE( psurf_year(klon, 12, naero_spc), pi_psurf_year(klon, 12, naero_spc), stat=ierr)
    156 !     IF (ierr /= 0) CALL abort_gcm('readaerosol_interp', 'pb in allocation 3',1)
    157 !
    158 !     ALLOCATE( load_year(klon, 12, naero_spc), pi_load_year(klon, 12, naero_spc), stat=ierr)
    159 !     IF (ierr /= 0) CALL abort_gcm('readaerosol_interp', 'pb in allocation 4',1)
     150     ALLOCATE( psurf_year(klon, 12, naero_spc), pi_psurf_year(klon, 12, naero_spc), stat=ierr)
     151     IF (ierr /= 0) CALL abort_gcm('readaerosol_interp', 'pb in allocation 3',1)
     152
     153     ALLOCATE( load_year(klon, 12, naero_spc), pi_load_year(klon, 12, naero_spc), stat=ierr)
     154     IF (ierr /= 0) CALL abort_gcm('readaerosol_interp', 'pb in allocation 4',1)
    160155
    161156     lnewday=.TRUE.
     
    172167  IF ( (first .OR. iday==0) .AND. lnewday ) THEN
    173168     NULLIFY(pt_tmp)
    174      NULLIFY(pt_tmp_surf)
    175      NULLIFY(pt_tmp_pi_surf)
    176      NULLIFY(pt_tmp_load)
    177      NULLIFY(pt_tmp_pi_load)
    178169
    179170     ! Reading values corresponding to the closest year taking into count the choice of aer_type.
    180171     ! For aer_type=scenario interpolation between 2 data sets is done in readaerosol.
    181172     CALL readaerosol(name_aero(id_aero), aer_type, iyr, klev_src, pt_ap, pt_b, pt_tmp, &
    182           pt_tmp_surf,pt_tmp_load,nbr_tsteps)
     173          psurf_year(:,:,id_aero), load_year(:,:,id_aero))
    183174     IF (.NOT. ALLOCATED(var_year)) THEN
    184         ALLOCATE(var_year(klon, klev_src, nbr_tsteps, naero_spc), stat=ierr)
    185         IF (ierr /= 0) CALL abort_gcm('readaerosol_interp', 'pb in allocation 5.1',1)
    186         ALLOCATE( psurf_year(klon, nbr_tsteps, naero_spc), load_year(klon, nbr_tsteps, naero_spc), stat=ierr)
    187         IF (ierr /= 0) CALL abort_gcm('readaerosol_interp', 'pb in allocation 5.2',1)
     175        ALLOCATE(var_year(klon, klev_src, 12, naero_spc), stat=ierr)
     176        IF (ierr /= 0) CALL abort_gcm('readaerosol_interp', 'pb in allocation 5',1)
    188177     END IF
    189178     var_year(:,:,:,id_aero) = pt_tmp(:,:,:)
    190      psurf_year(:,:,id_aero) = pt_tmp_surf(:,:)
    191      load_year(:,:,id_aero) = pt_tmp_load(:,:)
    192179
    193180     ! Reading values corresponding to the preindustrial concentrations.
    194181     CALL readaerosol(name_aero(id_aero), 'preind', iyr, pi_klev_src, pt_ap, pt_b, pt_tmp, &
    195           pt_tmp_surf,pt_tmp_load,nbr_tsteps)
     182          pi_psurf_year(:,:,id_aero), pi_load_year(:,:,id_aero))
    196183
    197184     ! klev_src must be the same in both files.
     
    204191
    205192     IF (.NOT. ALLOCATED(pi_var_year)) THEN
    206         ALLOCATE(pi_var_year(klon, klev_src, nbr_tsteps, naero_spc), stat=ierr)
    207         IF (ierr /= 0) CALL abort_gcm('readaerosol_interp', 'pb in allocation 6.1',1)
    208         ALLOCATE( pi_psurf_year(klon, nbr_tsteps, naero_spc), pi_load_year(klon, nbr_tsteps, naero_spc), stat=ierr)
    209         IF (ierr /= 0) CALL abort_gcm('readaerosol_interp', 'pb in allocation 6.2',1)
     193        ALLOCATE(pi_var_year(klon, klev_src, 12, naero_spc), stat=ierr)
     194        IF (ierr /= 0) CALL abort_gcm('readaerosol_interp', 'pb in allocation 6',1)
    210195     END IF
    211196     pi_var_year(:,:,:,id_aero) = pt_tmp(:,:,:)
    212      pi_psurf_year(:,:,id_aero) = pt_tmp_surf(:,:)
    213      pi_load_year(:,:,id_aero) = pt_tmp_load(:,:)
    214197   
    215198     IF (debug) THEN
    216         CALL writefield_phy('var_year_first',var_year(:,:,1,id_aero),klev_src)
    217         CALL writefield_phy('var_year_last',var_year(:,:,nbr_tsteps,id_aero),klev_src)
     199        CALL writefield_phy('var_year_jan',var_year(:,:,1,id_aero),klev_src)
     200        CALL writefield_phy('var_year_dec',var_year(:,:,12,id_aero),klev_src)
    218201        CALL writefield_phy('psurf_src',psurf_year(:,:,id_aero),1)
    219202        CALL writefield_phy('pi_psurf_src',pi_psurf_year(:,:,id_aero),1)
     
    224207     ! Pointer no more useful, deallocate.
    225208     DEALLOCATE(pt_tmp)
    226      DEALLOCATE(pt_tmp_surf)
    227      DEALLOCATE(pt_tmp_load)
    228209
    229210     ! Test if vertical interpolation will be needed.
     
    259240     month_mid(:) = month_start (:) + month_len(:)/2.
    260241
    261      write(55,*)'month_len = ',month_len
    262      write(55,*)'month_start = ',month_start
    263      write(55,*)'month_mid = ',month_mid
    264        
    265242  END IF  ! IF ( (first .OR. iday==0) .AND. lnewday ) THEN
    266243 
     
    277254!****************************************************************************************
    278255    ! Find which months and days to use for time interpolation
     256     nbr_tsteps = 12
    279257     IF (nbr_tsteps == 12) then
    280258       IF (jDay < month_mid(im+1)) THEN
     
    313291     ENDIF
    314292
    315 !     ! Find which months and days to use for time interpolation
    316 !     IF (iday < im*30-15) THEN
    317 !        ! in the first half of the month use month before and actual month
    318 !        im2=im-1
    319 !        day2 = im2*30-15
    320 !        day1 = im2*30+15
    321 !        IF (im2 <= 0) THEN
    322 !           ! the month is january, thus the month before december
    323 !           im2=12
    324 !        END IF
    325 !     ELSE
    326 !        ! the second half of the month
    327 !        im2=im+1
    328 !        IF (im2 > 12) THEN
    329 !           ! the month is december, the following thus january
    330 !           im2=1
    331 !        ENDIF
    332 !        day2 = im*30-15
    333 !        day1 = im*30+15
    334 !     END IF
    335 !      jDay = jDay+1
    336 !      write(55,*)'iday, jDay, im, im2, day1, day2 = ',iday, jDay, im, im2, day1, day2, nbr_tsteps
    337293 
    338294     ! Time interpolation, still on vertical source grid
Note: See TracChangeset for help on using the changeset viewer.