Changeset 2408 for LMDZ5/branches/testing/libf/phylmd/readaerosol.F90
- Timestamp:
- Dec 14, 2015, 11:43:09 AM (9 years ago)
- Location:
- LMDZ5/branches/testing
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
LMDZ5/branches/testing
- Property svn:mergeinfo changed
/LMDZ5/trunk merged: 2293-2295,2297,2299-2302,2305-2313,2315,2317-2380,2382-2396
- Property svn:mergeinfo changed
-
LMDZ5/branches/testing/libf/phylmd/readaerosol.F90
r1910 r2408 20 20 !**************************************************************************************** 21 21 USE dimphy 22 USE print_control_mod, ONLY: lunout 22 23 23 24 IMPLICIT NONE 24 25 INCLUDE "iniprint.h"26 25 27 26 ! Input arguments … … 130 129 IF (klev_src /= klev_src2) THEN 131 130 WRITE(lunout,*) 'Two aerosols files with different number of vertical levels is not allowded' 132 CALL abort_ gcm('readaersosol','Error in number of vertical levels',1)131 CALL abort_physic('readaersosol','Error in number of vertical levels',1) 133 132 END IF 134 133 … … 162 161 ELSE 163 162 WRITE(lunout,*)'This option is not implemented : aer_type = ', type,' name_aero=',name_aero 164 CALL abort_ gcm('readaerosol','Error : aer_type parameter not accepted',1)163 CALL abort_physic('readaerosol','Error : aer_type parameter not accepted',1) 165 164 END IF ! type 166 165 … … 179 178 ! 3) Read field month by month 180 179 ! 4) Close file 181 ! 5) Transform the global field from 2D( iim, jjp+1) to 1D(klon_glo)180 ! 5) Transform the global field from 2D(nbp_lon,nbp_lat) to 1D(klon_glo) 182 181 ! - Also the levels and the latitudes have to be inversed 183 182 ! … … 189 188 USE netcdf 190 189 USE dimphy 191 USE mod_grid_phy_lmdz 190 USE mod_grid_phy_lmdz, ONLY: nbp_lon, nbp_lat, klon_glo, & 191 grid2Dto1D_glo 192 192 USE mod_phys_lmdz_para 193 193 USE iophy, ONLY : io_lon, io_lat 194 USE print_control_mod, ONLY: lunout 194 195 195 196 IMPLICIT NONE 196 197 197 INCLUDE "dimensions.h"198 INCLUDE "iniprint.h"199 200 198 ! Input argumets 201 199 CHARACTER(len=7), INTENT(IN) :: varname … … 224 222 REAL, ALLOCATABLE, DIMENSION(:) :: varktmp 225 223 226 REAL, DIMENSION( iim,jjm+1,12) :: psurf_glo2D ! Surface pression for 12 months on dynamics global grid224 REAL, DIMENSION(nbp_lon,nbp_lat,12) :: psurf_glo2D ! Surface pression for 12 months on dynamics global grid 227 225 REAL, DIMENSION(klon_glo,12) :: psurf_glo1D ! -"- on physical global grid 228 REAL, DIMENSION( iim,jjm+1,12) :: load_glo2D ! Load for 12 months on dynamics global grid226 REAL, DIMENSION(nbp_lon,nbp_lat,12) :: load_glo2D ! Load for 12 months on dynamics global grid 229 227 REAL, DIMENSION(klon_glo,12) :: load_glo1D ! -"- on physical global grid 230 REAL, DIMENSION( iim,jjm+1) :: vartmp231 REAL, DIMENSION( iim) :: lon_src ! longitudes in file232 REAL, DIMENSION( jjm+1) :: lat_src, lat_src_inv ! latitudes in file228 REAL, DIMENSION(nbp_lon,nbp_lat) :: vartmp 229 REAL, DIMENSION(nbp_lon) :: lon_src ! longitudes in file 230 REAL, DIMENSION(nbp_lat) :: lat_src, lat_src_inv ! latitudes in file 233 231 LOGICAL :: new_file ! true if new file format detected 234 232 LOGICAL :: invert_lat ! true if the field has to be inverted for latitudes … … 260 258 WRITE(lunout,*) 'longitudes in model :', io_lon 261 259 262 CALL abort_ gcm('get_aero_fromfile', 'longitudes are not the same in file and model',1)260 CALL abort_physic('get_aero_fromfile', 'longitudes are not the same in file and model',1) 263 261 END IF 264 262 … … 268 266 269 267 ! Invert source latitudes 270 DO j = 1, jjm+1271 lat_src_inv(j) = lat_src( jjm+1+1 -j)268 DO j = 1, nbp_lat 269 lat_src_inv(j) = lat_src(nbp_lat +1 -j) 272 270 END DO 273 271 … … 283 281 WRITE(lunout,*) 'latitudes in file ', TRIM(fname),' : ', lat_src 284 282 WRITE(lunout,*) 'latitudes in model :', io_lat 285 CALL abort_ gcm('get_aero_fromfile', 'latitudes do not correspond between file and model',1)283 CALL abort_physic('get_aero_fromfile', 'latitudes do not correspond between file and model',1) 286 284 END IF 287 285 … … 297 295 IF (ierr /= NF90_NOERR) THEN 298 296 ! Dimension PRESNIVS not found either 299 CALL abort_ gcm('get_aero_fromfile', 'dimension lev or presnivs not in file',1)297 CALL abort_physic('get_aero_fromfile', 'dimension lev or presnivs not in file',1) 300 298 ELSE 301 299 ! Old file found … … 314 312 315 313 ! Allocate variables depending on the number of vertical levels 316 ALLOCATE(varmth( iim, jjm+1, klev_src), varyear(iim, jjm+1, klev_src, 12), stat=ierr)317 IF (ierr /= 0) CALL abort_ gcm('get_aero_fromfile', 'pb in allocation 1',1)314 ALLOCATE(varmth(nbp_lon,nbp_lat, klev_src), varyear(nbp_lon,nbp_lat, klev_src, 12), stat=ierr) 315 IF (ierr /= 0) CALL abort_physic('get_aero_fromfile', 'pb in allocation 1',1) 318 316 319 317 ALLOCATE(pt_ap(klev_src), pt_b(klev_src), varktmp(klev_src), stat=ierr) 320 IF (ierr /= 0) CALL abort_ gcm('get_aero_fromfile', 'pb in allocation 2',1)318 IF (ierr /= 0) CALL abort_physic('get_aero_fromfile', 'pb in allocation 2',1) 321 319 322 320 ! 3) Read all variables from file … … 333 331 ! IF (nbr_tsteps /= 12 .AND. nbr_tsteps /= 14) THEN 334 332 IF (nbr_tsteps /= 12 ) THEN 335 CALL abort_gcm('get_aero_fromfile', 'not the right number of months in aerosol file read (should be 12 for the moment)',1) 333 CALL abort_physic('get_aero_fromfile', 'not the right number of months in aerosol file read (should be 12 for the moment)' & 334 ,1) 336 335 ENDIF 337 336 … … 435 434 436 435 437 ! 5) Transform the global field from 2D( iim, jjp+1) to 1D(klon_glo)436 ! 5) Transform the global field from 2D(nbp_lon,nbp_lat) to 1D(klon_glo) 438 437 !**************************************************************************************** 439 438 ! Test if vertical levels have to be inversed … … 448 447 varmth(:,:,:) = varyear(:,:,:,imth) ! use varmth temporarly 449 448 DO k=1, klev_src 450 DO j=1, jjm+1451 DO i=1, iim449 DO j=1, nbp_lat 450 DO i=1, nbp_lon 452 451 varyear(i,j,k,imth) = varmth(i,j,klev_src+1-k) 453 452 END DO … … 482 481 varmth(:,:,:) = varyear(:,:,:,imth) ! use varmth temporarly 483 482 DO k=1,klev_src 484 DO j=1, jjm+1485 DO i=1, iim486 varyear(i,j,k,imth) = varmth(i, jjm+1+1-j,k)483 DO j=1,nbp_lat 484 DO i=1,nbp_lon 485 varyear(i,j,k,imth) = varmth(i,nbp_lat+1-j,k) 487 486 END DO 488 487 END DO … … 491 490 ! Invert latitudes for surface pressure 492 491 vartmp(:,:) = psurf_glo2D(:,:,imth) 493 DO j=1, jjm+1494 DO i=1, iim495 psurf_glo2D(i,j,imth)= vartmp(i, jjm+1+1-j)492 DO j=1,nbp_lat 493 DO i=1,nbp_lon 494 psurf_glo2D(i,j,imth)= vartmp(i,nbp_lat+1-j) 496 495 END DO 497 496 END DO … … 499 498 ! Invert latitudes for the load 500 499 vartmp(:,:) = load_glo2D(:,:,imth) 501 DO j=1, jjm+1502 DO i=1, iim503 load_glo2D(i,j,imth)= vartmp(i, jjm+1+1-j)500 DO j=1,nbp_lat 501 DO i=1,nbp_lon 502 load_glo2D(i,j,imth)= vartmp(i,nbp_lat+1-j) 504 503 END DO 505 504 END DO … … 509 508 DO k=1, klev_src 510 509 npole=0. ! North pole, j=1 511 spole=0. ! South pole, j= jjm+1512 DO i=1, iim510 spole=0. ! South pole, j=nbp_lat 511 DO i=1,nbp_lon 513 512 npole = npole + varyear(i,1,k,imth) 514 spole = spole + varyear(i, jjm+1,k,imth)513 spole = spole + varyear(i,nbp_lat,k,imth) 515 514 END DO 516 npole = npole/REAL( iim)517 spole = spole/REAL( iim)515 npole = npole/REAL(nbp_lon) 516 spole = spole/REAL(nbp_lon) 518 517 varyear(:,1, k,imth) = npole 519 varyear(:, jjm+1,k,imth) = spole518 varyear(:,nbp_lat,k,imth) = spole 520 519 END DO 521 520 END DO ! imth 522 521 523 522 ALLOCATE(varyear_glo1D(klon_glo, klev_src, 12), stat=ierr) 524 IF (ierr /= 0) CALL abort_ gcm('get_aero_fromfile', 'pb in allocation 3',1)523 IF (ierr /= 0) CALL abort_physic('get_aero_fromfile', 'pb in allocation 3',1) 525 524 526 525 ! Transform from 2D to 1D field … … 546 545 IF (.NOT. ASSOCIATED(pt_ap)) THEN ! if pt_ap is allocated also pt_b is allocated 547 546 ALLOCATE(pt_ap(klev_src), pt_b(klev_src), stat=ierr) 548 IF (ierr /= 0) CALL abort_ gcm('get_aero_fromfile', 'pb in allocation 4',1)547 IF (ierr /= 0) CALL abort_physic('get_aero_fromfile', 'pb in allocation 4',1) 549 548 END IF 550 549 CALL bcast(pt_ap) … … 554 553 IF (ASSOCIATED(pt_year)) DEALLOCATE(pt_year) 555 554 ALLOCATE(pt_year(klon, klev_src, 12), stat=ierr) 556 IF (ierr /= 0) CALL abort_ gcm('get_aero_fromfile', 'pb in allocation 5',1)555 IF (ierr /= 0) CALL abort_physic('get_aero_fromfile', 'pb in allocation 5',1) 557 556 558 557 ! Scatter global field to local domain at local process … … 572 571 SUBROUTINE check_err(status,text) 573 572 USE netcdf 573 USE print_control_mod, ONLY: lunout 574 574 IMPLICIT NONE 575 575 576 INCLUDE "iniprint.h"577 576 INTEGER, INTENT (IN) :: status 578 577 CHARACTER(len=*), INTENT (IN), OPTIONAL :: text … … 583 582 WRITE(lunout,*) 'Error in get_aero_fromfile : ',text 584 583 END IF 585 CALL abort_ gcm('get_aero_fromfile',trim(nf90_strerror(status)),1)584 CALL abort_physic('get_aero_fromfile',trim(nf90_strerror(status)),1) 586 585 END IF 587 586
Note: See TracChangeset
for help on using the changeset viewer.