New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
Changeset 10302 for branches/UKMO/dev_r5518_GO6_package_FOAMv14/NEMOGCM/NEMO/TOP_SRC/MEDUSA/trcini_medusa.F90 – NEMO

Ignore:
Timestamp:
2018-11-13T18:21:16+01:00 (5 years ago)
Author:
dford
Message:

Merge in revisions 8447:10159 of dev_r5518_GO6_package.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/UKMO/dev_r5518_GO6_package_FOAMv14/NEMOGCM/NEMO/TOP_SRC/MEDUSA/trcini_medusa.F90

    r8147 r10302  
    271271      zn_dms_srf(:,:)  = 0.0 
    272272      za_dms_srf(:,:)  = 0.0 
    273       zn_chl_srf(:,:)  = 2.0E-8 !! Chl srf 
     273      zn_chl_srf(:,:)  = 2.0E-8 !! Chl cpl - set first as surf 
    274274      !! 
    275275      IF(lwp) WRITE(numout,*) ' trc_ini_medusa: DMS and CO2 flux (UKESM) initialised to zero' 
     
    278278         CO2Flux_out_cpl(:,:) =  zn_co2_flx(:,:)   !! Coupling variable 
    279279         DMS_out_cpl(:,:)     =  zn_dms_srf(:,:)   !! Coupling variable 
    280          chloro_out_cpl(:,:)  =  zn_chl_srf(:,:)   !! Coupling variable 
     280         chloro_out_cpl(:,:)  =  zn_chl_srf(:,:) * scl_chl   !! Coupling variable 
    281281      END IF 
    282282      !! 
     
    324324      IF(lwp) WRITE(numout,*) ' ~~~~~~~~~~~~~~' 
    325325      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 ) .AND. ( xobs_xco2a <= 0.0 ) ) THEN 
     333         IF(lwp) WRITE(numout,*) ' trc_ini_medusa: initialisating atm CO2 record' 
     334         CALL trc_ini_medusa_co2atm 
     335      ENDIF 
    326336 
    327337   END SUBROUTINE trc_ini_medusa 
     
    480490   END SUBROUTINE trc_ini_medusa_river 
    481491    
     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 
    482576#else 
    483577   !!---------------------------------------------------------------------- 
Note: See TracChangeset for help on using the changeset viewer.