Changeset 2836


Ignore:
Timestamp:
Mar 29, 2017, 3:34:39 PM (8 years ago)
Author:
acozic
Message:

make some modification to remove the reading of p0 that is not present in forcage files. And add the possibility to have dim in "presnivs" and "time_counter"

File:
1 edited

Legend:

Unmodified
Added
Removed
  • LMDZ5/trunk/libf/phylmd/readaerosol.F90

    r2823 r2836  
    4242  REAL, POINTER, DIMENSION(:,:,:) :: pt_2
    4343  REAL, DIMENSION(klon,12)        :: psurf2, load2
    44   REAL                            :: p0           ! Reference pressure
    4544  INTEGER                         :: iyr1, iyr2, klev_src2
    4645  INTEGER                         :: it, k, i
     
    5857     ! get_aero_fromfile returns pt_out allocated and initialized with data for 12 month
    5958     ! pt_out has dimensions (klon, klev_src, 12)
    60      CALL get_aero_fromfile(name_aero, cyear, filename, klev_src, pt_ap, pt_b, p0, pt_out, psurf, load)
     59     CALL get_aero_fromfile(name_aero, cyear, filename, klev_src, pt_ap, pt_b, pt_out, psurf, load)
    6160     
    6261
     
    6766     ! get_aero_fromfile returns pt_out allocated and initialized with data for 12 month
    6867     ! pt_out has dimensions (klon, klev_src, 12)
    69      CALL get_aero_fromfile(name_aero, cyear, filename, klev_src, pt_ap, pt_b, p0, pt_out, psurf, load)
     68     CALL get_aero_fromfile(name_aero, cyear, filename, klev_src, pt_ap, pt_b, pt_out, psurf, load)
    7069     
    7170  ELSE IF (type == 'annuel') THEN
     
    7675     ! get_aero_fromfile returns pt_out allocated and initialized with data for nbr_tsteps month
    7776     ! pt_out has dimensions (klon, klev_src, 12)
    78      CALL get_aero_fromfile(name_aero, cyear, filename, klev_src, pt_ap, pt_b, p0, pt_out, psurf, load)
     77     CALL get_aero_fromfile(name_aero, cyear, filename, klev_src, pt_ap, pt_b, pt_out, psurf, load)
    7978     
    8079  ELSE IF (type == 'scenario') THEN
     
    8685        ! get_aero_fromfile returns pt_out allocated and initialized with data for 12 month
    8786        ! pt_out has dimensions (klon, klev_src, 12)
    88         CALL get_aero_fromfile(name_aero, cyear, filename, klev_src, pt_ap, pt_b, p0, pt_out, psurf, load)
     87        CALL get_aero_fromfile(name_aero, cyear, filename, klev_src, pt_ap, pt_b, pt_out, psurf, load)
    8988       
    9089     ELSE IF (iyr_in .GE. 2100) THEN
     
    9392        ! get_aero_fromfile returns pt_out allocated and initialized with data for 12 month
    9493        ! pt_out has dimensions (klon, klev_src, 12)
    95         CALL get_aero_fromfile(name_aero, cyear, filename, klev_src, pt_ap, pt_b, p0, pt_out, psurf, load)
     94        CALL get_aero_fromfile(name_aero, cyear, filename, klev_src, pt_ap, pt_b, pt_out, psurf, load)
    9695       
    9796     ELSE
     
    113112        ! get_aero_fromfile returns pt_out allocated and initialized with data for 12 month
    114113        ! pt_out has dimensions (klon, klev_src, 12)
    115         CALL get_aero_fromfile(name_aero, cyear, filename, klev_src, pt_ap, pt_b, p0, pt_out, psurf, load)
     114        CALL get_aero_fromfile(name_aero, cyear, filename, klev_src, pt_ap, pt_b, pt_out, psurf, load)
    116115       
    117116        ! If to read two decades:
     
    125124           ! get_aero_fromfile returns pt_2 allocated and initialized with data for 12 month
    126125           ! pt_2 has dimensions (klon, klev_src, 12)
    127            CALL get_aero_fromfile(name_aero, cyear, filename, klev_src2, pt_ap, pt_b, p0, pt_2, psurf2, load2)
     126           CALL get_aero_fromfile(name_aero, cyear, filename, klev_src2, pt_ap, pt_b, pt_2, psurf2, load2)
    128127           ! Test for same number of vertical levels
    129128           IF (klev_src /= klev_src2) THEN
     
    168167
    169168
    170   SUBROUTINE get_aero_fromfile(varname, cyr, filename, klev_src, pt_ap, pt_b, p0, pt_year, psurf_out, load_out)
     169  SUBROUTINE get_aero_fromfile(varname, cyr, filename, klev_src, pt_ap, pt_b, pt_year, psurf_out, load_out)
    171170!****************************************************************************************
    172171! Read 12 month aerosol from file and distribute to local process on physical grid.
     
    205204    REAL, POINTER, DIMENSION(:)           :: pt_ap        ! Pointer for describing the vertical levels     
    206205    REAL, POINTER, DIMENSION(:)           :: pt_b         ! Pointer for describing the vertical levels     
    207     REAL                                  :: p0           ! Reference pressure value
    208206    REAL, POINTER, DIMENSION(:,:,:)       :: pt_year      ! Pointer-variabale from file, 12 month, grid : klon,klev_src
    209207    REAL, DIMENSION(klon,12), INTENT(OUT) :: psurf_out    ! Surface pression for 12 months
     
    292290       IF (ierr /= NF90_NOERR) THEN
    293291          ! Coordinate axe lev not found. Check for presnivs.
    294           ierr = nf90_inq_dimid(ncid, 'PRESNIVS', dimid)
     292          ierr = nf90_inq_dimid(ncid, 'presnivs', dimid)
    295293          IF (ierr /= NF90_NOERR) THEN
    296              ! Dimension PRESNIVS not found either
    297              CALL abort_physic('get_aero_fromfile', 'dimension lev or presnivs not in file',1)
    298           ELSE
    299              ! Old file found
    300              new_file=.FALSE.
    301              WRITE(lunout,*) 'Vertical interpolation for ',TRIM(varname),' will not be done'
    302           END IF
     294             ierr = nf90_inq_dimid(ncid, 'PRESNIVS', dimid)
     295             IF (ierr /= NF90_NOERR) THEN
     296                ! Dimension PRESNIVS not found either
     297                CALL abort_physic('get_aero_fromfile', 'dimension lev,PRESNIVS or presnivs not in file',1)
     298             ELSE
     299                ! Old file found
     300                new_file=.FALSE.
     301                WRITE(lunout,*) 'Vertical interpolation for ',TRIM(varname),' will not be done'
     302             END IF
     303          ELSE
     304             ! New file found
     305             new_file=.TRUE.
     306             WRITE(lunout,*) 'Vertical interpolation for ',TRIM(varname),' will be done'
     307          ENDIF
    303308       ELSE
    304309          ! New file found
     
    328333!**************************************************************************************************
    329334       ierr = nf90_inq_dimid(ncid, 'TIME',dimid)
    330        CALL check_err( nf90_inquire_dimension(ncid, dimid, len = nbr_tsteps),"pb inq dim TIME" )
     335       if (ierr /= NF90_NOERR) THEN
     336          ierr = nf90_inq_dimid(ncid, 'time_counter', dimid)
     337          CALL check_err( nf90_inquire_dimension(ncid, dimid, len = nbr_tsteps),"pb inq dim TIME or time_counter" )
     338       ENDIF
    331339!       IF (nbr_tsteps /= 12 .AND. nbr_tsteps /= 14) THEN
    332340       IF (nbr_tsteps /= 12 ) THEN
     
    382390          CALL check_err( nf90_get_var(ncid, varid, pt_b),"pb get var b" )
    383391
    384 ! ++) Read p0 : reference pressure
    385 !****************************************************************************************
    386           ! Get variable id
    387           CALL check_err( nf90_inq_varid(ncid, "p0", varid),"pb inq var p0" )
    388           ! Get the variable
    389           CALL check_err( nf90_get_var(ncid, varid, p0),"pb get var p0" )
    390392         
    391393
Note: See TracChangeset for help on using the changeset viewer.