Changeset 9385 for branches/UKMO/dev_r5518_GO6_package/NEMOGCM/NEMO/TOP_SRC/MEDUSA/trcini_medusa.F90
- Timestamp:
- 2018-03-08T12:36:19+01:00 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/UKMO/dev_r5518_GO6_package/NEMOGCM/NEMO/TOP_SRC/MEDUSA/trcini_medusa.F90
r9114 r9385 324 324 IF(lwp) WRITE(numout,*) ' ~~~~~~~~~~~~~~' 325 325 IF(lwp) CALL flush(numout) 326 !! 327 !!---------------------------------------------------------------------- 328 !! JPALM (23-01-2017): new way to initialize CO2-atm for cmip6 329 !! initially done in trcsms_medusa 330 !!---------------------------------------------------------------------- 331 !! 332 IF( ( .NOT.lk_oasis ) .AND. ( .NOT.lk_pi_co2 ) ) THEN 333 IF(lwp) WRITE(numout,*) ' trc_ini_medusa: initialisating atm CO2 record' 334 CALL trc_ini_medusa_co2atm 335 ENDIF 326 336 327 337 END SUBROUTINE trc_ini_medusa … … 480 490 END SUBROUTINE trc_ini_medusa_river 481 491 492 SUBROUTINE trc_ini_medusa_co2atm 493 !!---------------------------------------------------------------------- 494 !! *** trc_ini_medusa_co2atm *** 495 !! 496 !! ** Purpose : initialization atmospheric co2 record 497 !! 498 !! ** Method : - Read the xco2 file 499 !!---------------------------------------------------------------------- 500 INTEGER :: jn, jm, io, ierr, inum, iostatus 501 INTEGER, PARAMETER :: iskip = 4 ! number of 1st descriptor lines 502 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:) :: zyy !: xCO2 record years 503 CHARACTER (len=10), PARAMETER :: clname = 'xco2.atm' !! atm CO2 record file 504 !!---------------------------------------------------------------------- 505 506 IF(lwp) WRITE(numout,*) 507 IF(lwp) WRITE(numout,*) ' trc_ini_medusa_co2atm: initialisation of atm CO2 historical record' 508 IF(lwp) WRITE(numout,*) ' ~~~~~~~~~~~' 509 510 511 IF(lwp) WRITE(numout,*) 'read of formatted file xco2.atm' 512 513 CALL ctl_opn( inum, clname, 'OLD', 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. ) 514 !!! 515 ! -Compute the number of year in the file 516 ! -File starts in co2_yinit, jn represents the record number in the file. 517 ! -Remove the file head (iskip lines) to jn 518 ! -The year is jn + yinit - 1 519 !! Determine the number of lines in xCO2 input file 520 iostatus = 0 521 jn = 1 522 DO WHILE ( iostatus == 0 ) 523 READ(inum,'(1x)', IOSTAT=iostatus, END=100) 524 jn = jn + 1 525 ENDDO 526 IF( iostatus .NE. 0 ) THEN 527 !! Error while reading xCO2 input file 528 CALL ctl_stop('trc_ini_medusa_co2atm: & 529 & Error on the 1st reading of xco2.atm') 530 RETURN 531 ENDIF 532 100 co2_rec = jn - 1 - iskip 533 IF ( lwp) WRITE(numout,*) ' ', co2_rec ,' years read in the file' 534 ! ! Allocate CO2 hist arrays 535 ierr = 0 536 ALLOCATE( hist_pco2(co2_rec),zyy(co2_rec), STAT=ierr ) 537 IF( ierr > 0 ) THEN 538 CALL ctl_stop( 'trc_ini_medusa_co2atm: unable to allocate array' ) 539 RETURN 540 ENDIF 541 542 REWIND(inum) 543 544 DO jm = 1, iskip ! Skip over 1st six descriptor lines 545 READ(inum,'(1x)') 546 END DO 547 ! file starts in 1931 do jn represent the year in the century.jhh 548 ! Read file till the end 549 ! allocate start and end year of the file 550 DO jn = 1, co2_rec 551 READ(inum,'(F6.1,F12.7)', IOSTAT=io) zyy(jn), hist_pco2(jn) 552 IF( io .NE. 0 ) THEN 553 !! Error while reading xCO2 input file 554 CALL ctl_stop('trc_ini_medusa_co2atm: & 555 & Error on the 2nd reading of xco2.atm') 556 RETURN 557 ENDIF 558 559 IF(jn==1) co2_yinit = zyy(jn) 560 END DO 561 co2_yend = co2_yinit + real(co2_rec) - 1. 562 563 IF(lwp) THEN ! Control print 564 WRITE(numout,*) 565 WRITE(numout,*) 'CO2 hist start year: ', co2_yinit 566 WRITE(numout,*) 'CO2 hist end year: ', co2_yend 567 WRITE(numout,*) ' Year xCO2 atm ' 568 DO jn = 1, co2_rec 569 WRITE(numout, '(F6.1,F12.7)') zyy(jn), hist_pco2(jn) 570 END DO 571 ENDIF 572 573 END SUBROUTINE trc_ini_medusa_co2atm 574 575 482 576 #else 483 577 !!----------------------------------------------------------------------
Note: See TracChangeset
for help on using the changeset viewer.