- Timestamp:
- Jul 22, 2024, 9:29:09 PM (4 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
LMDZ6/branches/Amaury_dev/libf/phylmdiso/limit_read_mod.F90
r5088 r5099 1 ! 1 2 2 ! $Id: limit_read_mod.F90 3435 2019-01-22 15:21:59Z fairhead $ 3 ! 3 4 4 MODULE limit_read_mod 5 ! 5 6 6 ! This module reads the fichier "limit.nc" containing fields for surface forcing. 7 ! 7 8 8 ! Module subroutines : 9 9 ! limit_read_frac : call limit_read_tot and return the fractions … … 11 11 ! limit_read_sst : return sea ice temperature 12 12 ! limit_read_tot : read limit.nc and store the fields in local modules variables 13 ! 13 14 14 IMPLICIT NONE 15 15 … … 54 54 55 55 SUBROUTINE limit_read_frac(itime, dtime, jour, pctsrf_new, is_modified) 56 ! 56 57 57 ! This subroutine is called from "change_srf_frac" for case of 58 58 ! ocean=force or from ocean_slab_frac for ocean=slab. … … 89 89 knon, knindex, & 90 90 rugos_out, alb_out) 91 ! 91 92 92 ! This subroutine is called from surf_land_bucket. 93 93 ! The flag "ok_veget" must can not be true. If coupled run, "ocean=couple" 94 94 ! then this routine will call limit_read_tot. 95 ! 95 96 96 USE dimphy 97 97 USE surface_data … … 139 139 #endif 140 140 ) 141 ! 141 142 142 ! This subroutine returns the sea surface temperature already read from limit.nc. 143 ! 143 144 144 USE dimphy, ONLY : klon 145 145 #ifdef ISO … … 260 260 261 261 SUBROUTINE limit_read_tot(itime, dtime, jour, is_modified) 262 ! 262 263 263 ! Read everything needed from limit.nc 264 ! 264 265 265 ! 0) Initialize 266 266 ! 1) Open the file limit.nc, if it is time … … 332 332 !**************************************************************************************** 333 333 ! 0) Initialization 334 ! 334 335 335 !**************************************************************************************** 336 336 IF (first_call) THEN … … 353 353 IF (is_mpi_root) THEN ! Only master processus 354 354 ierr = NF90_OPEN ('limit.nc', NF90_NOWRITE, nid) 355 IF (ierr /= NF90_NOERR) CALL abort_physic(modname,&355 IF (ierr /= nf90_noerr) CALL abort_physic(modname,& 356 356 'Pb d''ouverture du fichier de conditions aux limites',1) 357 357 … … 359 359 ierr=NF90_INQ_VARID(nid, 'TEMPS', nvarid) 360 360 ierr=NF90_GET_ATT(nid, nvarid, 'calendar', calendar) 361 IF(ierr== NF90_NOERR.AND.calendar/=calend.AND.prt_level>=1) THEN361 IF(ierr==nf90_noerr.AND.calendar/=calend.AND.prt_level>=1) THEN 362 362 WRITE(lunout,*)'BEWARE: gcm and limit.nc calendars differ: ' 363 363 WRITE(lunout,*)' '//TRIM(calend)//' for gcm' … … 371 371 ierr=NF90_INQUIRE(nid, UnlimitedDimID=ndimid) 372 372 ENDIF 373 ierr= NF90_INQUIRE_DIMENSION(nid, ndimid, len=nn)373 ierr=nf90_inquire_dimension(nid, ndimid, len=nn) 374 374 WRITE(abort_message,'(a,2(i0,a))')'limit.nc records number (',nn,') does no'//& 375 375 't match year length (',year_len,')' … … 382 382 ierr=nf90_inq_dimid(nid, 'points_physiques', ndimid) 383 383 ENDIF 384 ierr= NF90_INQUIRE_DIMENSION(nid, ndimid, len=nn)384 ierr=nf90_inquire_dimension(nid, ndimid, len=nn) 385 385 WRITE(abort_message,'(a,2(i0,a))')'limit.nc horizontal number of cells (',nn, & 386 386 ') does not match LMDZ klon_glo (',klon_glo,')' … … 388 388 389 389 ierr = NF90_CLOSE(nid) 390 IF (ierr /= NF90_NOERR) CALL abort_physic(modname,'Pb when closing file', 1)390 IF (ierr /= nf90_noerr) CALL abort_physic(modname,'Pb when closing file', 1) 391 391 END IF ! is_mpi_root 392 392 !$OMP END MASTER … … 398 398 ! The file is read only by the master thread of the master mpi process(is_mpi_root) 399 399 ! Check by the way if the number of records is correct. 400 ! 400 401 401 !**************************************************************************************** 402 402 … … 451 451 452 452 ierr = NF90_OPEN ('limit.nc', NF90_NOWRITE, nid) 453 IF (ierr /= NF90_NOERR) CALL abort_physic(modname,&453 IF (ierr /= nf90_noerr) CALL abort_physic(modname,& 454 454 'Pb d''ouverture du fichier de conditions aux limites',1) 455 455 … … 463 463 !**************************************************************************************** 464 464 ! 2) Read fraction if not type_ocean=couple 465 ! 465 466 466 !**************************************************************************************** 467 467 468 468 IF ( type_ocean /= 'couple') THEN 469 ! 469 470 470 ! Ocean fraction 471 471 ierr = NF90_INQ_VARID(nid, 'FOCE', nvarid) 472 IF (ierr /= NF90_NOERR) CALL abort_physic(modname, 'Le champ <FOCE> est absent',1)472 IF (ierr /= nf90_noerr) CALL abort_physic(modname, 'Le champ <FOCE> est absent',1) 473 473 474 ierr = NF90_GET_VAR(nid,nvarid,pct_glo(:,is_oce),start,epais)475 IF (ierr /= NF90_NOERR) CALL abort_physic(modname,'Lecture echouee pour <FOCE>' ,1)476 ! 474 ierr = nf90_get_var(nid,nvarid,pct_glo(:,is_oce),start,epais) 475 IF (ierr /= nf90_noerr) CALL abort_physic(modname,'Lecture echouee pour <FOCE>' ,1) 476 477 477 ! Sea-ice fraction 478 478 ierr = NF90_INQ_VARID(nid, 'FSIC', nvarid) 479 IF (ierr /= NF90_NOERR) CALL abort_physic(modname,'Le champ <FSIC> est absent',1)480 481 ierr = NF90_GET_VAR(nid,nvarid,pct_glo(:,is_sic),start,epais)482 IF (ierr /= NF90_NOERR) CALL abort_physic(modname,'Lecture echouee pour <FSIC>' ,1)479 IF (ierr /= nf90_noerr) CALL abort_physic(modname,'Le champ <FSIC> est absent',1) 480 481 ierr = nf90_get_var(nid,nvarid,pct_glo(:,is_sic),start,epais) 482 IF (ierr /= nf90_noerr) CALL abort_physic(modname,'Lecture echouee pour <FSIC>' ,1) 483 483 484 484 485 485 ! Read land and continentals fraction only if asked for 486 486 IF (read_continents .OR. itime == 1) THEN 487 ! 487 488 488 ! Land fraction 489 489 ierr = NF90_INQ_VARID(nid, 'FTER', nvarid) 490 IF (ierr /= NF90_NOERR) CALL abort_physic(modname,'Le champ <FTER> est absent',1)490 IF (ierr /= nf90_noerr) CALL abort_physic(modname,'Le champ <FTER> est absent',1) 491 491 492 ierr = NF90_GET_VAR(nid,nvarid,pct_glo(:,is_ter),start,epais)493 IF (ierr /= NF90_NOERR) CALL abort_physic(modname,'Lecture echouee pour <FTER>',1)494 ! 492 ierr = nf90_get_var(nid,nvarid,pct_glo(:,is_ter),start,epais) 493 IF (ierr /= nf90_noerr) CALL abort_physic(modname,'Lecture echouee pour <FTER>',1) 494 495 495 ! Continentale ice fraction 496 496 ierr = NF90_INQ_VARID(nid, 'FLIC', nvarid) 497 IF (ierr /= NF90_NOERR) CALL abort_physic(modname,'Le champ <FLIC> est absent',1)498 499 ierr = NF90_GET_VAR(nid,nvarid,pct_glo(:,is_lic),start,epais)500 IF (ierr /= NF90_NOERR) CALL abort_physic(modname,'Lecture echouee pour <FLIC>',1)497 IF (ierr /= nf90_noerr) CALL abort_physic(modname,'Le champ <FLIC> est absent',1) 498 499 ierr = nf90_get_var(nid,nvarid,pct_glo(:,is_lic),start,epais) 500 IF (ierr /= nf90_noerr) CALL abort_physic(modname,'Lecture echouee pour <FLIC>',1) 501 501 END IF 502 502 … … 505 505 !**************************************************************************************** 506 506 ! 3) Read sea-surface temperature, if not coupled ocean 507 ! 507 508 508 !**************************************************************************************** 509 509 IF ( type_ocean /= 'couple') THEN 510 510 511 511 ierr = NF90_INQ_VARID(nid, 'SST', nvarid) 512 IF (ierr /= NF90_NOERR) CALL abort_physic(modname,'Le champ <SST> est absent',1)513 514 ierr = NF90_GET_VAR(nid,nvarid,sst_glo,start,epais)515 IF (ierr /= NF90_NOERR) CALL abort_physic(modname,'Lecture echouee pour <SST>',1)512 IF (ierr /= nf90_noerr) CALL abort_physic(modname,'Le champ <SST> est absent',1) 513 514 ierr = nf90_get_var(nid,nvarid,sst_glo,start,epais) 515 IF (ierr /= nf90_noerr) CALL abort_physic(modname,'Lecture echouee pour <SST>',1) 516 516 517 517 #ifdef ISO 518 518 IF ((iso_HTO.gt.0).and.(ok_prod_nucl_tritium)) THEN 519 519 ierr = NF90_INQ_VARID(nid, 'TUOCE', nvarid) 520 IF (ierr /= NF90_NOERR) CALL abort_gcm(modname,'Le champ <TUOCE> est absent',1)521 522 ierr = NF90_GET_VAR(nid,nvarid,tuoce_glo,start,epais)523 IF (ierr /= NF90_NOERR) CALL abort_gcm(modname,'Lecture echouee pour <TUOCE>',1)520 IF (ierr /= nf90_noerr) CALL abort_gcm(modname,'Le champ <TUOCE> est absent',1) 521 522 ierr = nf90_get_var(nid,nvarid,tuoce_glo,start,epais) 523 IF (ierr /= nf90_noerr) CALL abort_gcm(modname,'Lecture echouee pour <TUOCE>',1) 524 524 END IF 525 525 #ifdef ISOVERIF … … 539 539 !**************************************************************************************** 540 540 ! 4) Read albedo and rugosity for land surface, only in case of no vegetation model 541 ! 541 542 542 !**************************************************************************************** 543 543 544 544 IF (.NOT. ok_veget) THEN 545 ! 545 546 546 ! Read albedo 547 547 ierr = NF90_INQ_VARID(nid, 'ALB', nvarid) 548 IF (ierr /= NF90_NOERR) CALL abort_physic(modname,'Le champ <ALB> est absent',1)549 550 ierr = NF90_GET_VAR(nid,nvarid,alb_glo,start,epais)551 IF (ierr /= NF90_NOERR) CALL abort_physic(modname,'Lecture echouee pour <ALB>',1)552 ! 548 IF (ierr /= nf90_noerr) CALL abort_physic(modname,'Le champ <ALB> est absent',1) 549 550 ierr = nf90_get_var(nid,nvarid,alb_glo,start,epais) 551 IF (ierr /= nf90_noerr) CALL abort_physic(modname,'Lecture echouee pour <ALB>',1) 552 553 553 ! Read rugosity 554 554 ierr = NF90_INQ_VARID(nid, 'RUG', nvarid) 555 IF (ierr /= NF90_NOERR) CALL abort_physic(modname,'Le champ <RUG> est absent',1)556 557 ierr = NF90_GET_VAR(nid,nvarid,rug_glo,start,epais)558 IF (ierr /= NF90_NOERR) CALL abort_physic(modname,'Lecture echouee pour <RUG>',1)555 IF (ierr /= nf90_noerr) CALL abort_physic(modname,'Le champ <RUG> est absent',1) 556 557 ierr = nf90_get_var(nid,nvarid,rug_glo,start,epais) 558 IF (ierr /= nf90_noerr) CALL abort_physic(modname,'Lecture echouee pour <RUG>',1) 559 559 560 560 END IF … … 562 562 !**************************************************************************************** 563 563 ! 5) Close file and distribuate variables to all processus 564 ! 564 565 565 !**************************************************************************************** 566 566 ierr = NF90_CLOSE(nid) 567 IF (ierr /= NF90_NOERR) CALL abort_physic(modname,'Pb when closing file', 1)567 IF (ierr /= nf90_noerr) CALL abort_physic(modname,'Pb when closing file', 1) 568 568 ENDIF ! is_mpi_root 569 569
Note: See TracChangeset
for help on using the changeset viewer.