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 9385 for branches/UKMO/dev_r5518_GO6_package/NEMOGCM/NEMO – NEMO

Ignore:
Timestamp:
2018-03-08T12:36:19+01:00 (6 years ago)
Author:
marc
Message:

GMED ticket 380. Merge changes from Julien's branches/NERC/dev_r5518_GO6_CO2_cmip.

Location:
branches/UKMO/dev_r5518_GO6_package/NEMOGCM/NEMO/TOP_SRC
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/UKMO/dev_r5518_GO6_package/NEMOGCM/NEMO/TOP_SRC/CFC/trcini_cfc.F90

    r8280 r9385  
    4444      !! ** Method  : - Read the namcfc namelist and check the parameter values 
    4545      !!---------------------------------------------------------------------- 
    46       INTEGER  ::  ji, jj, jn, jl, jm, js, io, ierr 
     46      INTEGER  ::  ji, jj, jn, jl, jm, js, io, iostatus, ierr 
    4747      INTEGER  ::  iskip = 7   ! number of 1st descriptor lines 
    4848      REAL(wp) ::  zyy, zyd 
     
    5757       
    5858      CALL ctl_opn( inum, clname, 'OLD', 'FORMATTED', 'SEQUENTIAL', -1, numout, .FALSE. ) 
    59       REWIND(inum) 
    6059       
    6160      ! compute the number of year in the file 
    6261      ! file starts in 1931 do jn represent the year in the century 
     62      iostatus = 0 
    6363      jn = 31  
    64       DO  
    65         READ(inum,'(1x)',END=100)  
     64      DO WHILE ( iostatus == 0 ) 
     65        READ(inum,'(1x)', IOSTAT=iostatus, END=100) 
    6666        jn = jn + 1 
    67       END DO 
     67      ENDDO 
     68      IF( iostatus .NE. 0 ) THEN 
     69        !! Error while reading CFC input file  
     70        CALL ctl_stop('trc_ini_cfc:  & 
     71                      & Error on the 1st reading of cfc1112sf6.atm') 
     72        RETURN 
     73      ENDIF 
    6874 100  jpyear = jn - 1 - iskip 
    6975      IF ( lwp) WRITE(numout,*) '    ', jpyear ,' years read' 
     
    7278      ALLOCATE( p_cfc(jpyear,jphem,3), STAT=ierr ) 
    7379      IF( ierr > 0 ) THEN 
    74          CALL ctl_stop( 'trc_ini_cfc: unable to allocate p_cfc array' )   ;   RETURN 
     80         CALL ctl_stop( 'trc_ini_cfc: unable to allocate p_cfc array' )    
     81         RETURN 
    7582      ENDIF 
    7683      IF( trc_sms_cfc_alloc() /= 0 )   CALL ctl_stop( 'STOP', 'trc_ini_cfc: unable to allocate CFC arrays' ) 
     
    101108      ! file starts in 1931 do jn represent the year in the century.jhh 
    102109      ! Read file till the end 
    103       jn = 31 
    104       DO  
     110      DO jn = 31, jpyear  
     111        !!READ(inum, '(F6.1,6F7.2)', IOSTAT=io) zyy, p_cfc(jn,1,1), p_cfc(jn,1,2), & 
    105112        READ(inum,*, IOSTAT=io) zyy, p_cfc(jn,1,1), p_cfc(jn,1,2), & 
    106113             & p_cfc(jn,1,3), p_cfc(jn,2,1),  & 
    107114             & p_cfc(jn,2,2), p_cfc(jn,2,3) 
    108         IF( io < 0 ) exit 
    109         jn = jn + 1 
     115        IF( io .NE.0 )  THEN 
     116          !! Error while reading CFC input file  
     117          CALL ctl_stop('trc_ini_cfc:   & 
     118                        & Error on the 2nd reading of cfc1112sf6.atm') 
     119          RETURN 
     120        ENDIF 
    110121      END DO 
    111122 
  • branches/UKMO/dev_r5518_GO6_package/NEMOGCM/NEMO/TOP_SRC/MEDUSA/air_sea.F90

    r9257 r9385  
    6767# endif 
    6868      USE in_out_manager,    ONLY: lwp, numout 
    69       USE oce,               ONLY: PCO2a_in_cpl 
    7069      USE par_kind,          ONLY: wp 
    7170      USE par_oce,           ONLY: jpi, jpim1, jpj, jpjm1 
    72       USE sbc_oce,           ONLY: fr_i, lk_oasis, qsr, wndm 
     71      USE sbc_oce,           ONLY: fr_i, qsr, wndm 
    7372      USE sms_medusa,        ONLY: jdms, jdms_input, jdms_model,          & 
    7473                                   jriver_alk, jriver_c,                  & 
     
    152151            !! OPEN wet point IF..THEN loop 
    153152            IF (tmask(ji,jj,1) == 1) then 
    154                IF (lk_oasis) THEN 
    155                   !! use 2D atm xCO2 from atm coupling 
    156                   f_xco2a(ji,jj) = PCO2a_in_cpl(ji,jj) 
    157                   !!!  
    158                   !!! Jpalm test on atm xCO2 
    159                   IF ( (f_xco2a(ji,jj) > 1500.0 ).OR.(f_xco2a(ji,jj) < 100.0 ) ) THEN 
    160                     IF(lwp) THEN  
    161                        WRITE(numout,*) ' atm xCO2 = ',f_xco2a(ji,jj),          & 
    162                                        ' -- ji =', mig(ji),' jj = ', mjg(jj) 
    163                     ENDIF 
    164                     CALL ctl_stop( 'MEDUSA - Air-Sea :', 'unrealistic atm xCO2 ' ) 
    165                  ENDIF  
    166                ENDIF 
    167153               !! 
    168154               !! AXY (23/06/15): as part of an effort to update the  
     
    261247               !!          must be associated to air-sea flux or air xCO2... 
    262248               !!          Check MOCSY outputs 
    263               IF ( (f_pco2w(ji,jj) > 1.E4 ).OR.(f_pco2w(ji,jj) < 0.0 ) .OR.     & 
    264                    (f_fco2w(ji,jj) > 1.E4 ).OR.(f_fco2w(ji,jj) < 0.0 ) .OR.     &    
    265                    (f_fco2atm(ji,jj) > 1.E4 ).OR.(f_fco2atm(ji,jj) < 0.0 ) .OR.     & 
    266                    (f_co2flux(ji,jj) > 1.E-2 ).OR.(f_co2flux(ji,jj) < -1.E-2 ) .OR.     & 
    267                    (f_dpco2(ji,jj) > 1.E4 ).OR.(f_dpco2(ji,jj) < -1.E4 ) ) THEN 
    268                  IF(lwp) THEN  
    269                      WRITE(numout,*) ' surface T = ',ztmp(ji,jj) 
    270                      WRITE(numout,*) ' surface S = ',zsal(ji,jj) 
    271                      WRITE(numout,*) ' surface ALK = ',zalk(ji,jj) 
    272                      WRITE(numout,*) ' surface DIC = ',zdic(ji,jj) 
    273                      WRITE(numout,*) ' KW660 = ',f_kw660(ji,jj) 
    274                      WRITE(numout,*) ' atm xCO2 = ',f_xco2a(ji,jj)    
    275                      WRITE(numout,*) ' surface pco2w  = ',f_pco2w(ji,jj) 
    276                      WRITE(numout,*) ' surface fco2w  = ',f_fco2w(ji,jj) 
    277                      WRITE(numout,*) ' surface fco2a  = ',f_fco2atm(ji,jj) 
    278                      WRITE(numout,*) ' surface co2flx = ',f_co2flux(ji,jj) 
    279                      WRITE(numout,*) ' surface dpco2  = ',f_dpco2(ji,jj) 
    280                      WRITE(numout,*) ' MOCSY output: ji =', mig(ji),' jj = ', mjg(jj),  & 
    281                                        ' kt = ', kt      
    282                      WRITE(numout,*) 'MEDUSA - Air-Sea OUTPUT: unrealistic surface Carb. Chemistry' 
    283                  ENDIF      
    284                  CALL ctl_stop( 'MEDUSA - Air-Sea OUTPUT: ',            & 
    285                                 'unrealistic surface Carb. Chemistry -- OUTPUTS' ) 
    286               ENDIF      
     249               !!=================== 
     250               !! Jpalm -- 19-02-2018 -- remove the cap - only check MOCSY inputs 
     251               !!       because of specific area in arabic sea where strangely 
     252               !!       with core 2 forcing, ALK is lower than DIC and result in  
     253               !!       Enormous dpco2 - even if all carb chem caract are OK. 
     254               !!       and this check stops the model. 
     255               !!       --Input checks are already more than enough to stop the 
     256               !!       model if carb chem goes crazy.  
     257               !!       we remove the mocsy output checks 
     258               !!=================== 
     259               !!IF ( (f_pco2w(ji,jj) > 1.E4 ).OR.(f_pco2w(ji,jj) < 0.0 ) .OR.     & 
     260               !!    (f_fco2w(ji,jj) > 1.E4 ).OR.(f_fco2w(ji,jj) < 0.0 ) .OR.     &    
     261               !!    (f_fco2atm(ji,jj) > 1.E4 ).OR.(f_fco2atm(ji,jj) < 0.0 ) .OR.     & 
     262               !!    (f_co2flux(ji,jj) > 1.E-1 ).OR.(f_co2flux(ji,jj) < -1.E-1 ) .OR.     & 
     263               !!    (f_dpco2(ji,jj) > 1.E4 ).OR.(f_dpco2(ji,jj) < -1.E4 ) ) THEN 
     264               !!  IF(lwp) THEN  
     265               !!      WRITE(numout,*) ' surface T = ',ztmp(ji,jj) 
     266               !!      WRITE(numout,*) ' surface S = ',zsal(ji,jj) 
     267               !!      WRITE(numout,*) ' surface ALK = ',zalk(ji,jj) 
     268               !!      WRITE(numout,*) ' surface DIC = ',zdic(ji,jj) 
     269               !!      WRITE(numout,*) ' KW660 = ',f_kw660(ji,jj) 
     270               !!      WRITE(numout,*) ' atm xCO2 = ',f_xco2a(ji,jj)    
     271               !!      WRITE(numout,*) ' surface pco2w  = ',f_pco2w(ji,jj) 
     272               !!      WRITE(numout,*) ' surface fco2w  = ',f_fco2w(ji,jj) 
     273               !!      WRITE(numout,*) ' surface fco2a  = ',f_fco2atm(ji,jj) 
     274               !!      WRITE(numout,*) ' surface co2flx = ',f_co2flux(ji,jj) 
     275               !!      WRITE(numout,*) ' surface dpco2  = ',f_dpco2(ji,jj) 
     276               !!      WRITE(numout,*) ' MOCSY output: ji =', mig(ji),' jj = ', mjg(jj),  & 
     277               !!                        ' kt = ', kt      
     278               !!      WRITE(numout,*) 'MEDUSA - Air-Sea OUTPUT: unrealistic surface Carb. Chemistry' 
     279               !!  ENDIF      
     280               !!  CALL ctl_stop( 'MEDUSA - Air-Sea OUTPUT: ',            & 
     281               !!                 'unrealistic surface Carb. Chemistry -- OUTPUTS' ) 
     282               !!ENDIF      
    287283            ENDIF 
    288284         ENDDO 
  • branches/UKMO/dev_r5518_GO6_package/NEMOGCM/NEMO/TOP_SRC/MEDUSA/carb_chem.F90

    r8441 r9385  
    103103               !! OPEN wet point IF..THEN loop 
    104104               IF (tmask(ji,jj,jk).eq.1) THEN 
    105                   IF (lk_oasis) THEN 
    106                      !! use 2D atm xCO2 from atm coupling 
    107                      f_xco2a(ji,jj) = PCO2a_in_cpl(ji,jj) 
    108                   ENDIF 
    109105                  !! Do carbonate chemistry 
    110106                  !! 
  • branches/UKMO/dev_r5518_GO6_package/NEMOGCM/NEMO/TOP_SRC/MEDUSA/sms_medusa.F90

    r9258 r9385  
    283283#if defined key_roam 
    284284!!---------------------------------------------------------------------- 
    285 !! Atmospheric pCO2 data (1859 to 2100 inclusive) 
    286 !!---------------------------------------------------------------------- 
    287 !! 
    288    REAL(wp), DIMENSION(242)         ::   hist_pco2 !: pCO2 
    289  
    290 # if defined key_rcp26 
    291       !! UKMO, run AJKKH + KAAEC, RCP 2.6, pCO2 time evolution 
    292       DATA hist_pco2 / 286.0230, 286.1730, 286.3230, 286.4480, 286.5730, & 
    293       & 286.7230, 286.8480, 286.9480, 287.0480, 287.1730, & 
    294       & 287.3230, 287.4730, 287.6480, 287.8480, 288.0730, & 
    295       & 288.3480, 288.6480, 288.9730, 289.3470, 289.7470, & 
    296       & 290.1730, 290.6470, 291.1470, 291.6220, 292.0720, & 
    297       & 292.5220, 292.9220, 293.2470, 293.5220, 293.7470, & 
    298       & 293.9470, 294.1220, 294.2720, 294.4220, 294.5470, & 
    299       & 294.6470, 294.7470, 294.8470, 294.9710, 295.1710, & 
    300       & 295.4460, 295.7470, 296.0720, 296.4210, 296.7710, & 
    301       & 297.1460, 297.5710, 298.0210, 298.4460, 298.8460, & 
    302       & 299.2460, 299.6450, 300.0210, 300.3710, 300.7200, & 
    303       & 301.0450, 301.3460, 301.6710, 302.0200, 302.3450, & 
    304       & 302.6450, 302.9700, 303.3450, 303.7200, 304.0700, & 
    305       & 304.4700, 304.9200, 305.3440, 305.7700, 306.2450, & 
    306       & 306.7190, 307.1700, 307.6440, 308.1190, 308.5440, & 
    307       & 308.9440, 309.3440, 309.6940, 309.9440, 310.1190, & 
    308       & 310.2440, 310.3190, 310.3190, 310.2440, 310.1440, & 
    309       & 310.0690, 310.0440, 310.0690, 310.1440, 310.2690, & 
    310       & 310.4440, 310.6940, 311.0430, 311.4440, 311.8690, & 
    311       & 312.3680, 312.9430, 313.5430, 314.1680, 314.7900, & 
    312       & 315.4430, 316.2150, 317.0170, 317.7370, 318.3400, & 
    313       & 318.8680, 319.5900, 320.5890, 321.5470, 322.5770, & 
    314       & 323.8440, 324.9260, 325.7960, 327.0810, 328.6180, & 
    315       & 329.6830, 330.5250, 331.6880, 333.2120, 334.7870, & 
    316       & 336.4640, 338.2990, 339.6660, 340.7310, 342.1360, & 
    317       & 343.7200, 345.2200, 346.7350, 348.5820, 350.6740, & 
    318       & 352.4230, 353.7910, 354.9530, 355.8210, 356.7130, & 
    319       & 358.0630, 359.7720, 361.3970, 363.0900, 365.2560, & 
    320       & 367.2810, 368.7980, 370.4000, 372.4550, 374.6920, & 
    321       & 376.7440, 378.7440, 380.7580, 382.7080, 384.7300, & 
    322       & 386.9310, 389.2150, 391.4910, 393.7710, 396.0460, & 
    323       & 398.3240, 400.6080, 402.8950, 405.1780, 407.4550, & 
    324       & 409.7260, 411.9930, 414.2500, 416.4410, 418.5280, & 
    325       & 420.5250, 422.4390, 424.2720, 426.0200, 427.6750, & 
    326       & 429.2360, 430.7050, 432.0850, 433.3580, 434.5140, & 
    327       & 435.5740, 436.5490, 437.4420, 438.2550, 438.9810, & 
    328       & 439.6110, 440.1430, 440.5770, 440.9450, 441.2660, & 
    329       & 441.5410, 441.7840, 442.0050, 442.2040, 442.3780, & 
    330       & 442.5210, 442.6200, 442.6720, 442.6810, 442.6540, & 
    331       & 442.5830, 442.4670, 442.3270, 442.1680, 441.9960, & 
    332       & 441.8060, 441.5930, 441.3440, 441.0540, 440.7230, & 
    333       & 440.3510, 439.9300, 439.4650, 438.9730, 438.4630, & 
    334       & 437.9400, 437.4020, 436.8400, 436.2640, 435.6850, & 
    335       & 435.1030, 434.5160, 433.9170, 433.3060, 432.7010, & 
    336       & 432.1110, 431.5380, 430.9810, 430.4320, 429.8860, & 
    337       & 429.3370, 428.7810, 428.2220, 427.6490, 427.0660, & 
    338       & 426.4890, 425.9270, 425.3840, 424.8610, 424.3540, & 
    339       & 423.8540, 423.3540, 422.8530, 422.3510, 421.8410, & 
    340       & 421.3250, 420.8190 / 
    341 # else 
    342       !! UKMO, run AJKKH + KAAEF, RCP 8.5, pCO2 time evolution 
    343       DATA hist_pco2 / 286.0230, 286.1730, 286.3230, 286.4480, 286.5730, & 
    344       & 286.7230, 286.8480, 286.9480, 287.0480, 287.1730, & 
    345       & 287.3230, 287.4730, 287.6480, 287.8480, 288.0730, & 
    346       & 288.3480, 288.6480, 288.9730, 289.3470, 289.7470, & 
    347       & 290.1730, 290.6470, 291.1470, 291.6220, 292.0720, & 
    348       & 292.5220, 292.9220, 293.2470, 293.5220, 293.7470, & 
    349       & 293.9470, 294.1220, 294.2720, 294.4220, 294.5470, & 
    350       & 294.6470, 294.7470, 294.8470, 294.9710, 295.1710, & 
    351       & 295.4460, 295.7470, 296.0720, 296.4210, 296.7710, & 
    352       & 297.1460, 297.5710, 298.0210, 298.4460, 298.8460, & 
    353       & 299.2460, 299.6450, 300.0210, 300.3710, 300.7200, & 
    354       & 301.0450, 301.3460, 301.6710, 302.0200, 302.3450, & 
    355       & 302.6450, 302.9700, 303.3450, 303.7200, 304.0700, & 
    356       & 304.4700, 304.9200, 305.3440, 305.7700, 306.2450, & 
    357       & 306.7190, 307.1700, 307.6440, 308.1190, 308.5440, & 
    358       & 308.9440, 309.3440, 309.6940, 309.9440, 310.1190, & 
    359       & 310.2440, 310.3190, 310.3190, 310.2440, 310.1440, & 
    360       & 310.0690, 310.0440, 310.0690, 310.1440, 310.2690, & 
    361       & 310.4440, 310.6940, 311.0430, 311.4440, 311.8690, & 
    362       & 312.3680, 312.9430, 313.5430, 314.1680, 314.7900, & 
    363       & 315.4430, 316.2150, 317.0170, 317.7370, 318.3400, & 
    364       & 318.8680, 319.5900, 320.5890, 321.5470, 322.5770, & 
    365       & 323.8440, 324.9260, 325.7960, 327.0810, 328.6180, & 
    366       & 329.6830, 330.5250, 331.6880, 333.2120, 334.7870, & 
    367       & 336.4640, 338.2990, 339.6660, 340.7310, 342.1360, & 
    368       & 343.7200, 345.2200, 346.7350, 348.5820, 350.6740, & 
    369       & 352.4230, 353.7910, 354.9530, 355.8210, 356.7130, & 
    370       & 358.0630, 359.7720, 361.3970, 363.0900, 365.2560, & 
    371       & 367.2810, 368.7980, 370.4000, 372.4550, 374.6920, & 
    372       & 376.7440, 378.7440, 380.7580, 382.7080, 384.7300, & 
    373       & 386.9420, 389.2540, 391.5670, 393.9370, 396.3920, & 
    374       & 398.9320, 401.5550, 404.2550, 407.0220, 409.8530, & 
    375       & 412.7470, 415.7050, 418.7210, 421.7880, 424.9180, & 
    376       & 428.1200, 431.3970, 434.7470, 438.1650, 441.6410, & 
    377       & 445.1700, 448.7530, 452.3920, 456.0950, 459.8810, & 
    378       & 463.7680, 467.7660, 471.8750, 476.0960, 480.4210, & 
    379       & 484.8390, 489.3470, 493.9430, 498.6400, 503.4380, & 
    380       & 508.3410, 513.3630, 518.5160, 523.8050, 529.2290, & 
    381       & 534.7780, 540.4450, 546.2230, 552.1120, 558.1110, & 
    382       & 564.2110, 570.4130, 576.7390, 583.1990, 589.7980, & 
    383       & 596.5390, 603.4110, 610.4060, 617.4940, 624.6500, & 
    384       & 631.8800, 639.1750, 646.5360, 653.9800, 661.5230, & 
    385       & 669.1840, 676.9570, 684.8290, 692.7790, 700.7690, & 
    386       & 708.8050, 716.8870, 725.0020, 733.1770, 741.3900, & 
    387       & 749.6700, 758.0480, 766.5050, 775.0350, 783.6110, & 
    388       & 792.2200, 800.8740, 809.5680, 818.2760, 827.0090, & 
    389       & 835.8020, 844.6550, 853.5730, 862.5690, 871.6190, & 
    390       & 880.7020, 889.8240, 898.9590, 908.1270, 917.3080, & 
    391       & 926.4960, 935.7040 / 
    392 # endif 
     285!! JPALM -- change hist_pco2 init 
     286!!---------------------------------------------------------------------- 
     287!! 
     288   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:)   ::   hist_pco2 !: pCO2 
     289   INTEGER  :: co2_rec 
     290   REAL(wp) :: co2_yinit, co2_yend    !: First and Last year read in the xCO2.atm file 
     291#endif 
     292 
     293!!---------------------------------------------------------------------- 
     294!! JPALM -- PI CO2 key 
     295!!---------------------------------------------------------------------- 
     296!! 
     297#if defined key_axy_pi_co2 
     298   LOGICAL , PUBLIC ::   lk_pi_co2 = .TRUE.  !: PI xCO2 used 
     299#else 
     300   LOGICAL , PUBLIC ::   lk_pi_co2 = .FALSE. !: PI xCO2 unused 
    393301#endif 
    394302 
  • branches/UKMO/dev_r5518_GO6_package/NEMOGCM/NEMO/TOP_SRC/MEDUSA/trcbio_medusa.F90

    r9257 r9385  
    8181                                            gdept_0, gdept_n,               & 
    8282                                            gdepw_0, gdepw_n,               & 
    83                                             nday_year, nsec_day, nyear,     & 
     83                                            nday_year, nsec_day,            & 
     84                                            nyear, nyear_len, ndastp,       & 
     85                                            nsec_month,                     & 
    8486                                            rdt, tmask, mig, mjg, nimpp,    & 
    8587                                            njmpp  
     
    9294                                            mpp_min, mpp_minloc,            & 
    9395                                            ctl_stop, ctl_warn, lk_mpp   
    94       USE oce,                        ONLY: tsb, tsn 
     96      USE oce,                        ONLY: tsb, tsn, PCO2a_in_cpl 
    9597      USE par_kind,                   ONLY: wp 
    9698      USE par_medusa,                 ONLY: jpalk, jpchd, jpchn, jpdet,     & 
     
    102104      !! JPALM (27-06-2016): add lk_oasis for CO2 and DMS coupling with atm 
    103105      USE sbc_oce,                    ONLY: lk_oasis 
    104       USE sms_medusa,                 ONLY: hist_pco2 
     106      USE sms_medusa,                 ONLY: hist_pco2, co2_yinit, co2_yend, & 
     107                                            lk_pi_co2 
    105108      USE trc,                        ONLY: ln_rsttr, nittrc000, trn 
    106109      USE bio_medusa_init_mod,        ONLY: bio_medusa_init 
     
    114117      USE bio_medusa_diag_slice_mod,  ONLY: bio_medusa_diag_slice 
    115118      USE bio_medusa_fin_mod,         ONLY: bio_medusa_fin 
     119      USE trcstat,                    ONLY: trc_rst_dia_stat 
    116120 
    117121      IMPLICIT NONE 
     
    181185      !!  
    182186      !! temporary variables 
    183       REAL(wp) ::    fq0,fq1,fq2,fq3,fq4 
     187      REAL(wp) ::    fq3,fq4 
     188      REAL(wp) ::    this_y, this_d, this_s, fyear 
    184189      !! 
    185190      !! T and S check temporary variable 
     
    293298      !!------------------------------------------------------------------ 
    294299      !! 
    295       !! what's atmospheric pCO2 doing? (data start in 1859) 
    296       iyr1  = nyear - 1859 + 1 
    297       iyr2  = iyr1 + 1 
    298       if (iyr1 .le. 1) then 
    299          !! before 1860 
    300          f_xco2a(:,:) = hist_pco2(1) 
    301       elseif (iyr2 .ge. 242) then 
    302          !! after 2099 
    303          f_xco2a(:,:) = hist_pco2(242) 
    304       else 
    305          !! just right 
    306          fq0 = hist_pco2(iyr1) 
    307          fq1 = hist_pco2(iyr2) 
    308          fq2 = real(nsec_day) / (60.0 * 60.0 * 24.0) 
    309          !! AXY (14/06/12): tweaked to make more sense (and be correct) 
    310 #  if defined key_bs_axy_yrlen 
    311          !! bugfix: for 360d year with HadGEM2-ES forcing 
    312          fq3 = (real(nday_year) - 1.0 + fq2) / 360.0   
    313 #  else 
    314          !! original use of 365 days (not accounting for leap year or  
    315          !! 360d year) 
    316          fq3 = (real(nday_year) - 1.0 + fq2) / 365.0 
    317 #  endif 
    318          fq4 = (fq0 * (1.0 - fq3)) + (fq1 * fq3) 
    319          f_xco2a(:,:) = fq4 
    320       endif 
    321 #  if defined key_axy_pi_co2 
    322       !! OCMIP pre-industrial pCO2 
    323       !! f_xco2a(:,:) = 284.725  !! CMIP5 pre-industrial pCO2 
    324       f_xco2a = 284.317          !! CMIP6 pre-industrial pCO2  
    325 #  endif 
    326       !! IF(lwp) WRITE(numout,*) ' MEDUSA nyear     =', nyear 
    327       !! IF(lwp) WRITE(numout,*) ' MEDUSA nsec_day  =', real(nsec_day) 
    328       !! IF(lwp) WRITE(numout,*) ' MEDUSA nday_year =', real(nday_year) 
    329       !! AXY (29/01/14): remove surplus diagnostics 
    330       !! IF(lwp) WRITE(numout,*) ' MEDUSA fq0       =', fq0 
    331       !! IF(lwp) WRITE(numout,*) ' MEDUSA fq1       =', fq1 
    332       !! IF(lwp) WRITE(numout,*) ' MEDUSA fq2       =', fq2 
    333       !! IF(lwp) WRITE(numout,*) ' MEDUSA fq3       =', fq3 
    334       IF(lwp) WRITE(numout,*) ' MEDUSA atm pCO2  =', f_xco2a(1,1) 
     300      IF (lk_oasis) THEN  
     301         !! xCO2 from coupled 
     302         IF ( ( kt == nittrc000 ) .AND. lwp )     & 
     303             WRITE(numout,*) '** MEDUSA Atm xCO2 given by the UM **' 
     304         f_xco2a(:,:) = PCO2a_in_cpl(:,:) 
     305         !! Check the xCO2 from the UM is OK 
     306         !! piece of code moved from air-sea.F90 
     307         !!--- 
     308         DO jj = 2,jpjm1 
     309            DO ji = 2,jpim1 
     310               !! OPEN wet point IF..THEN loop 
     311               IF (tmask(ji,jj,1) == 1) then 
     312                  !!! Jpalm test on atm xCO2 
     313                  IF ( (f_xco2a(ji,jj) .GT. 10000.0 ).OR.     & 
     314                       (f_xco2a(ji,jj) .LE. 0.0 ) ) THEN 
     315                     IF(lwp) THEN 
     316                        WRITE(numout,*) ' atm xCO2 = ',f_xco2a(ji,jj),       & 
     317                                        ' -- ji =', mig(ji),' jj = ', mjg(jj) 
     318                     ENDIF 
     319                     CALL ctl_stop( 'MEDUSA - trc_bio :',     & 
     320                                    'unrealistic coupled atm xCO2 ' ) 
     321                  ENDIF 
     322               ENDIF 
     323            ENDDO 
     324         ENDDO 
     325         !!---  
     326      ELSEIF (lk_pi_co2) THEN 
     327         !! OCMIP pre-industrial xCO2 
     328         IF ( ( kt == nittrc000 ) .AND. lwp )     & 
     329             WRITE(numout,*) '** MEDUSA Atm xCO2 fixed to pre-industrial value **' 
     330         !! f_xco2a(:,:) = 284.725       !! CMIP5 pre-industrial pCO2 
     331         f_xco2a(:,:) = 284.317          !! CMIP6 pre-industrial pCO2  
     332      ELSE       
     333         !! xCO2 from file 
     334         !! AXY - JPALM new interpolation scheme usinf nyear_len 
     335         this_y = real(nyear) 
     336         this_d = real(nday_year) 
     337         this_s = real(nsec_day) 
     338         !! 
     339         fyear = this_y + ((this_d - 1) + (this_s / (60. * 60. * 24.))) / real(nyear_len(1)) 
     340         !! 
     341         IF ( ( kt == nittrc000 ) .AND. lwp ) THEN  
     342            WRITE(numout,*) '** MEDUSA Atm xCO2 from file **' 
     343            WRITE(numout,*) ' MEDUSA year      =', this_y 
     344            WRITE(numout,*) ' Year length      =', real(nyear_len(1)) 
     345            WRITE(numout,*) ' MEDUSA nday_year =', this_d 
     346            WRITE(numout,*) ' MEDUSA nsec_day  =', this_s 
     347         ENDIF 
     348         !!  
     349         !! different case test  
     350         IF (fyear .LE. co2_yinit) THEN 
     351            !! before first record -- pre-industrial value 
     352            f_xco2a(:,:) = hist_pco2(1)   
     353         ELSEIF (fyear .GE. co2_yend) THEN 
     354            !! after last record - continue to use the last value 
     355            f_xco2a(:,:) = hist_pco2(int(co2_yend - co2_yinit + 1.) ) 
     356         ELSE 
     357            !! just right 
     358            iyr1 = int(fyear - co2_yinit) + 1 
     359            iyr2 = iyr1 + 1  
     360            fq3 = fyear - real(iyr1) - co2_yinit + 1. 
     361            fq4 = ((1 - fq3) * hist_pco2(iyr1)) + (fq3 * hist_pco2(iyr2)) 
     362            f_xco2a(:,:) = fq4 
     363            !! 
     364            IF ( ( kt == nittrc000 ) .AND. lwp ) THEN  
     365               WRITE(numout,*) ' MEDUSA year1     =', iyr1 
     366               WRITE(numout,*) ' MEDUSA year2     =', iyr2 
     367               WRITE(numout,*) ' xCO2 year1       =', hist_pco2(iyr1) 
     368               WRITE(numout,*) ' xCO2 year2       =', hist_pco2(iyr2) 
     369               WRITE(numout,*) ' Year2 weight     =', fq3 
     370            ENDIF 
     371         ENDIF 
     372      ENDIF 
     373  
     374      !! Writing xCO2 in output on start and on the 1st tsp of each  month 
     375      IF ( (kt == nittrc000 .AND. .NOT.ln_rsttr) .OR.                        & 
     376           ( nsec_month .LE. INT(rdt) ) )  THEN 
     377           IF ( lwp )  WRITE(numout,*) ' *** Atm xCO2 *** -- kt:', kt,       & 
     378                                       ';  current date:', ndastp 
     379          call trc_rst_dia_stat(f_xco2a(:,:), 'atm xCO2') 
     380      ENDIF 
    335381# endif 
    336382 
     
    358404      !!          x * 30d + 1*rdt(i.e: mod = rdt)    
    359405      !!          ++ need to pass carb-chem output var through restarts 
    360       If ( (kt == nittrc000 .AND. .NOT.ln_rsttr) .OR.                        & 
    361            ((86400*mod(nn_date0,100) + mod(kt*rdt,2592000.)) == rdt) ) THEN 
     406      !!If ( (kt == nitt8rc000 .AND. .NOT.ln_rsttr) .OR.          & 
     407      !!     ( (mod(kt*rdt,2592000.)) == rdt) THEN 
     408      !!============================= 
     409      !! (Jpalm -- updated for restartability issues) 
     410      !! We want this to be start of month or if starting afresh from   
     411      !! climatology - marc 20/6/17  
     412      !!If ( (kt == nittrc000 .AND. .NOT.ln_rsttr) .OR.                         &  
     413      !!     ((86400*mod(nn_date0,100) + mod(kt*rdt,2592000.)) == rdt) ) THEN  
     414      !!============================= 
     415      !! Jpalm -- 15-02-2018 -- need to change 3D carb-chem call freq again. 
     416      !! previous call did not work, probably the (86400*mod(nn_date0,100) part 
     417      !! should not be in... 
     418      !! now use the NEMO calendar tool : nsec_month to be sure to call  
     419      !! at the beginning of a new month . 
     420      IF ( (kt == nittrc000 .AND. .NOT.ln_rsttr) .OR.                        & 
     421           ( nsec_month .LE. INT(rdt) ) )  THEN 
     422           IF ( lwp )  WRITE(numout,*)                                       &          
     423                              ' *** 3D carb chem call *** -- kt:', kt,       & 
     424                              ';  current date:', ndastp  
    362425         !!--------------------------------------------------------------- 
    363426         !! Calculate the carbonate chemistry for the whole ocean on the first 
     
    502565         !!              Exceptionnal value did exist 
    503566         !! 
    504          Call trc_bio_check(kt) 
     567         Call trc_bio_check(kt, jk) 
    505568 
    506569         !!================================================================ 
     
    810873   END SUBROUTINE trc_bio_exceptionnal_fix  
    811874 
    812    SUBROUTINE trc_bio_check(kt) 
     875   SUBROUTINE trc_bio_check(kt, jk) 
    813876      !!----------------------------------- 
    814877      !! JPALM -- 14-12-2017 -- Still dealing with this micro-boil/carb failure 
     
    824887      INTEGER               :: ii,ij         ! temporary scalars  
    825888      INTEGER, DIMENSION(2) :: ilocs         !  
    826       INTEGER, INTENT( in ) :: kt 
     889      INTEGER, INTENT( in ) :: kt, jk 
    827890      !! 
    828891      !!========================== 
     
    852915         IF(lwp) THEN 
    853916            WRITE(numout,*) 'trc_bio:tracer anomaly: *****    WARNING     *****' 
    854             WRITE(numout,*) 'trc_bio:tracer anomaly: sea surface DIC > 4000 ' 
    855             WRITE(numout,9600) kt, zmax, ii, ij 
     917            WRITE(numout,*) 'trc_bio:tracer anomaly: DIC concentration > 4000 ' 
     918            WRITE(numout,9600) kt, zmax, ii, ij, jk 
    856919            WRITE(numout,*) 'trc_bio:tracer anomaly: ***** END OF WARNING *****' 
    857920         ENDIF 
     
    869932         IF(lwp) THEN 
    870933            WRITE(numout,*) 'trc_bio:tracer anomaly: *****    WARNING     *****' 
    871             WRITE(numout,*) 'trc_bio:tracer anomaly: sea surface DIC <= 0 ' 
    872             WRITE(numout,9700) kt, zmin, ii, ij 
     934            WRITE(numout,*) 'trc_bio:tracer anomaly: DIC concentration <= 0 ' 
     935            WRITE(numout,9700) kt, zmin, ii, ij, jk 
    873936            WRITE(numout,*) 'trc_bio:tracer anomaly: ***** END OF WARNING *****' 
    874937         ENDIF 
     
    901964         IF(lwp) THEN 
    902965            WRITE(numout,*) 'trc_bio:tracer anomaly: *****     WARNING    *****' 
    903             WRITE(numout,*) 'trc_bio:tracer anomaly: sea surface Alkalinity > 4000 ' 
    904             WRITE(numout,9800) kt, zmax, ii, ij 
     966            WRITE(numout,*) 'trc_bio:tracer anomaly: ALK concentration > 4000 ' 
     967            WRITE(numout,9800) kt, zmax, ii, ij, jk 
    905968            WRITE(numout,*) 'trc_bio:tracer anomaly: ***** END OF WARNING *****' 
    906969         ENDIF 
     
    918981         IF(lwp) THEN 
    919982            WRITE(numout,*) 'trc_bio:tracer anomaly: *****    WARNING     *****' 
    920             WRITE(numout,*) 'trc_bio:tracer anomaly:  sea surface Alkalinity <= 0 ' 
    921             WRITE(numout,9900) kt, zmin, ii, ij 
     983            WRITE(numout,*) 'trc_bio:tracer anomaly:  ALK concentration <= 0 ' 
     984            WRITE(numout,9900) kt, zmin, ii, ij, jk 
    922985            WRITE(numout,*) 'trc_bio:tracer anomaly: ***** END OF WARNING *****' 
    923986         ENDIF 
     
    925988 
    926989 
    927 9600  FORMAT ('trc_bio:tracer anomaly: kt=',i6,' max DIC: ',f16.10,', i j: ',2i5) 
    928 9700  FORMAT ('trc_bio:tracer anomaly: kt=',i6,' min DIC: ',f16.10,', i j: ',2i5) 
    929 9800  FORMAT ('trc_bio:tracer anomaly: kt=',i6,' max ALK: ',f16.10,', i j: ',2i5) 
    930 9900  FORMAT ('trc_bio:tracer anomaly: kt=',i6,' min ALK: ',f16.10,', i j: ',2i5) 
     9909600  FORMAT ('trc_bio:tracer anomaly: kt=',i6,' max DIC: ',f16.10,', i j k: ',3i5) 
     9919700  FORMAT ('trc_bio:tracer anomaly: kt=',i6,' min DIC: ',f16.10,', i j k: ',3i5) 
     9929800  FORMAT ('trc_bio:tracer anomaly: kt=',i6,' max ALK: ',f16.10,', i j k: ',3i5) 
     9939900  FORMAT ('trc_bio:tracer anomaly: kt=',i6,' min ALK: ',f16.10,', i j k: ',3i5) 
    931994 
    932995   END SUBROUTINE trc_bio_check 
  • branches/UKMO/dev_r5518_GO6_package/NEMOGCM/NEMO/TOP_SRC/MEDUSA/trcini_medusa.F90

    r9114 r9385  
    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 ) ) 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   !!---------------------------------------------------------------------- 
  • branches/UKMO/dev_r5518_GO6_package/NEMOGCM/NEMO/TOP_SRC/trcrst.F90

    r9262 r9385  
    378378            !! 
    379379            IF(lwp) WRITE(numout,*) ' CFC averaged properties absent - setting to zero ...' 
    380             qint_cfc(:,:,jn)  = 0.0   !! CHN 
     380            qint_cfc(:,:,jl)  = 0.0   !! CHN 
    381381         ENDIF 
    382382         !! 
Note: See TracChangeset for help on using the changeset viewer.