- Timestamp:
- 2017-12-26T17:32:56+01:00 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2017/dev_merge_2017/NEMOGCM/NEMO/TOP_SRC/PISCES/P4Z/p4zflx.F90
r9125 r9169 4 4 !! TOP : PISCES CALCULATES GAS EXCHANGE AND CHEMISTRY AT SEA SURFACE 5 5 !!====================================================================== 6 !! History : 7 !! 8 !! 9 !! 10 !! 11 !! 6 !! History : - ! 1988-07 (E. MAIER-REIMER) Original code 7 !! - ! 1998 (O. Aumont) additions 8 !! - ! 1999 (C. Le Quere) modifications 9 !! 1.0 ! 2004 (O. Aumont) modifications 10 !! 2.0 ! 2007-12 (C. Ethe, G. Madec) F90 11 !! ! 2011-02 (J. Simeon, J. Orr) Include total atm P correction 12 12 !!---------------------------------------------------------------------- 13 13 !! p4z_flx : CALCULATES GAS EXCHANGE AND CHEMISTRY AT SEA SURFACE … … 15 15 !! p4z_patm : Read sfc atm pressure [atm] for each grid cell 16 16 !!---------------------------------------------------------------------- 17 USE oce_trc 18 USE trc 19 USE sms_pisces 20 USE p4zche 21 USE prtctl_trc 22 USE iom 23 USE fldread 17 USE oce_trc ! shared variables between ocean and passive tracers 18 USE trc ! passive tracers common variables 19 USE sms_pisces ! PISCES Source Minus Sink variables 20 USE p4zche ! Chemical model 21 USE prtctl_trc ! print control for debugging 22 USE iom ! I/O manager 23 USE fldread ! read input fields 24 24 25 25 IMPLICIT NONE … … 30 30 PUBLIC p4z_flx_alloc 31 31 32 ! !!** Namelist nampisext **33 REAL(wp) :: atcco2!: pre-industrial atmospheric [co2] (ppm)34 LOGICAL :: ln_co2int!: flag to read in a file and interpolate atmospheric pco2 or not35 CHARACTER(len=34) :: clname!: filename of pco2 values36 INTEGER :: nn_offset!: Offset model-data start year (default = 0)32 ! !!** Namelist nampisext ** 33 REAL(wp) :: atcco2 !: pre-industrial atmospheric [co2] (ppm) 34 LOGICAL :: ln_co2int !: flag to read in a file and interpolate atmospheric pco2 or not 35 CHARACTER(len=34) :: clname !: filename of pco2 values 36 INTEGER :: nn_offset !: Offset model-data start year (default = 0) 37 37 38 38 !! Variables related to reading atmospheric CO2 time history 39 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:) :: atcco2h, years40 INTEGER :: nmaxrec, numco241 42 ! !!* nampisatm namelist (Atmospheric PRessure) *39 INTEGER :: nmaxrec, numco2 ! 40 REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:) :: atcco2h, years ! 41 42 ! !!* nampisatm namelist (Atmospheric PRessure) * 43 43 LOGICAL, PUBLIC :: ln_presatm !: ref. pressure: global mean Patm (F) or a constant (F) 44 44 LOGICAL, PUBLIC :: ln_presatmco2 !: accounting for spatial atm CO2 in the compuation of carbon flux (T) or not (F) 45 45 46 REAL(wp) , ALLOCATABLE, SAVE, DIMENSION(:,:) :: patm ! atmospheric pressure at kt [N/m2]47 TYPE(FLD), ALLOCATABLE, DIMENSION(:) :: sf_patm ! structure of input fields (file informations, fields read)48 TYPE(FLD), ALLOCATABLE, DIMENSION(:) :: sf_atmco2 ! structure of input fields (file informations, fields read)49 50 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: satmco2 !: atmospheric pco251 52 REAL(wp) :: xconv = 0.01_wp / 3600._wp!: coefficients for conversion46 REAL(wp) , ALLOCATABLE, SAVE, DIMENSION(:,:) :: patm ! atmospheric pressure at kt [N/m2] 47 TYPE(FLD), ALLOCATABLE, DIMENSION(:) :: sf_patm ! structure of input fields (file informations, fields read) 48 TYPE(FLD), ALLOCATABLE, DIMENSION(:) :: sf_atmco2 ! structure of input fields (file informations, fields read) 49 50 REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: satmco2 !: atmospheric pco2 51 52 REAL(wp) :: xconv = 0.01_wp / 3600._wp !: coefficients for conversion 53 53 54 54 !!---------------------------------------------------------------------- … … 70 70 !! - Add option for time-interpolation of atcco2.txt 71 71 !!--------------------------------------------------------------------- 72 !73 72 INTEGER, INTENT(in) :: kt, knt ! 74 73 ! … … 79 78 REAL(wp) :: zph, zdic, zsch_o2, zsch_co2 80 79 REAL(wp) :: zyr_dec, zdco2dt 81 CHARACTER (len=25) :: charout82 REAL(wp), DIMENSION(jpi,jpj) :: zkgco2, zkgo2, zh2co3, zoflx, zpco2atm83 REAL(wp), ALLOCATABLE, DIMENSION(:,:) :: zw2d80 CHARACTER (len=25) :: charout 81 REAL(wp), DIMENSION(jpi,jpj) :: zkgco2, zkgo2, zh2co3, zoflx, zpco2atm 82 REAL(wp), ALLOCATABLE, DIMENSION(:,:) :: zw2d 84 83 !!--------------------------------------------------------------------- 85 84 ! 86 85 IF( ln_timing ) CALL timing_start('p4z_flx') 87 86 ! 88 89 87 ! SURFACE CHEMISTRY (PCO2 AND [H+] IN 90 88 ! SURFACE LAYER); THE RESULT OF THIS CALCULATION 91 89 ! IS USED TO COMPUTE AIR-SEA FLUX OF CO2 92 90 93 IF( kt /= nit000 .AND. .NOT.l_co2cpl .AND. knt == 1 ) CALL p4z_patm( kt )! Get sea-level pressure (E&K [1981] climatology) for use in flux calcs91 IF( kt /= nit000 .AND. .NOT.l_co2cpl .AND. knt == 1 ) CALL p4z_patm( kt ) ! Get sea-level pressure (E&K [1981] climatology) for use in flux calcs 94 92 95 93 IF( ln_co2int .AND. .NOT.ln_presatmco2 .AND. .NOT.l_co2cpl ) THEN … … 226 224 !! ** Method : Read the nampisext namelist and check the parameters 227 225 !! called at the first timestep (nittrc000) 226 !! 228 227 !! ** input : Namelist nampisext 229 228 !!---------------------------------------------------------------------- 230 INTEGER :: jm 231 INTEGER :: ios ! Local integer 232 ! 229 INTEGER :: jm, ios ! Local integer 230 !! 233 231 NAMELIST/nampisext/ln_co2int, atcco2, clname, nn_offset 234 232 !!---------------------------------------------------------------------- 235 ! 236 233 IF(lwp) THEN 234 WRITE(numout,*) 235 WRITE(numout,*) ' p4z_flx_init : atmospheric conditions for air-sea flux calculation' 236 WRITE(numout,*) ' ~~~~~~~~~~~~' 237 ENDIF 238 ! 237 239 REWIND( numnatp_ref ) ! Namelist nampisext in reference namelist : Pisces atm. conditions 238 240 READ ( numnatp_ref, nampisext, IOSTAT = ios, ERR = 901) 239 901 IF( ios /= 0 ) CALL ctl_nam ( ios , 'nampisext in reference namelist', lwp ) 240 241 901 IF( ios /= 0 ) CALL ctl_nam ( ios , 'nampisext in reference namelist', lwp ) 241 242 REWIND( numnatp_cfg ) ! Namelist nampisext in configuration namelist : Pisces atm. conditions 242 243 READ ( numnatp_cfg, nampisext, IOSTAT = ios, ERR = 902 ) 243 902 IF( ios > 0 ) CALL ctl_nam ( ios , 'nampisext in configuration namelist', lwp )244 902 IF( ios > 0 ) CALL ctl_nam ( ios , 'nampisext in configuration namelist', lwp ) 244 245 IF(lwm) WRITE ( numonp, nampisext ) 245 246 ! 246 247 IF(lwp) THEN ! control print 247 WRITE(numout,*) ' ' 248 WRITE(numout,*) ' Namelist parameters for air-sea exchange, nampisext' 249 WRITE(numout,*) ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' 250 WRITE(numout,*) ' Choice for reading in the atm pCO2 file or constant value, ln_co2int =', ln_co2int 251 WRITE(numout,*) ' ' 252 ENDIF 248 WRITE(numout,*) ' Namelist : nampisext --- parameters for air-sea exchange' 249 WRITE(numout,*) ' reading in the atm pCO2 file or constant value ln_co2int =', ln_co2int 250 ENDIF 251 252 !!gm BUG !!! ===>>> ln_presatm and ln_presatmco2 are used below, but read in namelist 253 !!gm at the end of the routine via a CALL to CALL p4z_patm( nit000 ) 254 253 255 IF( .NOT.ln_co2int .AND. .NOT.ln_presatmco2 ) THEN 254 256 IF(lwp) THEN ! control print 255 WRITE(numout,*) ' Constant Atmospheric pCO2 value atcco2 =', atcco2 256 WRITE(numout,*) ' ' 257 WRITE(numout,*) ' Constant Atmospheric pCO2 value atcco2 =', atcco2 257 258 ENDIF 258 259 satmco2(:,:) = atcco2 ! Initialisation of atmospheric pco2 259 260 ELSEIF( ln_co2int .AND. .NOT.ln_presatmco2 ) THEN 260 261 IF(lwp) THEN 261 WRITE(numout,*) ' Atmospheric pCO2 value from file clname =', TRIM( clname )262 WRITE(numout,*) ' Offset model-data start year nn_offset =', nn_offset263 WRITE(numout,*) ' '262 WRITE(numout,*) ' Constant Atmospheric pCO2 value atcco2 =', atcco2 263 WRITE(numout,*) ' Atmospheric pCO2 value from file clname =', TRIM( clname ) 264 WRITE(numout,*) ' Offset model-data start year nn_offset =', nn_offset 264 265 ENDIF 265 266 CALL ctl_opn( numco2, TRIM( clname) , 'OLD', 'FORMATTED', 'SEQUENTIAL', -1 , numout, lwp ) … … 270 271 END DO 271 272 100 nmaxrec = jm - 1 272 ALLOCATE( years (nmaxrec) ) ;years (:) = 0._wp273 ALLOCATE( atcco2h(nmaxrec) ) ;atcco2h(:) = 0._wp274 273 ALLOCATE( years (nmaxrec) ) ; years (:) = 0._wp 274 ALLOCATE( atcco2h(nmaxrec) ) ; atcco2h(:) = 0._wp 275 ! 275 276 REWIND(numco2) 276 277 DO jm = 1, nmaxrec ! get xCO2 data … … 282 283 IF(lwp) THEN 283 284 WRITE(numout,*) ' Spatialized Atmospheric pCO2 from an external file' 284 WRITE(numout,*) ' '285 285 ENDIF 286 286 ELSE 287 287 IF(lwp) THEN 288 288 WRITE(numout,*) ' Spatialized Atmospheric pCO2 from an external file' 289 WRITE(numout,*) ' '290 289 ENDIF 291 290 ENDIF … … 304 303 !! *** ROUTINE p4z_atm *** 305 304 !! 306 !! ** Purpose : Read and interpolate the external atmospheric sea-lev l pressure305 !! ** Purpose : Read and interpolate the external atmospheric sea-level pressure 307 306 !! ** Method : Read the files and interpolate the appropriate variables 308 307 !! 309 308 !!---------------------------------------------------------------------- 310 INTEGER, INTENT( in ) :: kt ! ocean time step 311 ! 312 INTEGER :: ierr 313 INTEGER :: ios ! Local integer output status for namelist read 314 CHARACTER(len=100) :: cn_dir ! Root directory for location of ssr files 315 TYPE(FLD_N) :: sn_patm ! informations about the fields to be read 316 TYPE(FLD_N) :: sn_atmco2 ! informations about the fields to be read 309 INTEGER, INTENT(in) :: kt ! ocean time step 310 ! 311 INTEGER :: ierr, ios ! Local integer 312 CHARACTER(len=100) :: cn_dir ! Root directory for location of ssr files 313 TYPE(FLD_N) :: sn_patm ! informations about the fields to be read 314 TYPE(FLD_N) :: sn_atmco2 ! informations about the fields to be read 317 315 !! 318 316 NAMELIST/nampisatm/ ln_presatm, ln_presatmco2, sn_patm, sn_atmco2, cn_dir 319 317 !!---------------------------------------------------------------------- 320 321 ! ! ----------------------- ! 322 IF( kt == nit000 ) THEN ! First call kt=nittrc000 ! 323 318 ! 319 IF( kt == nit000 ) THEN !== First call kt=nittrc000 ==! 320 ! 321 IF(lwp) THEN 322 WRITE(numout,*) 323 WRITE(numout,*) ' p4z_patm : sea-level atmospheric pressure' 324 WRITE(numout,*) ' ~~~~~~~~' 325 ENDIF 326 ! 324 327 REWIND( numnatp_ref ) ! Namelist nampisatm in reference namelist : Pisces atm. sea level pressure file 325 328 READ ( numnatp_ref, nampisatm, IOSTAT = ios, ERR = 901) 326 329 901 IF( ios /= 0 ) CALL ctl_nam ( ios , 'nampisatm in reference namelist', lwp ) 327 328 330 REWIND( numnatp_cfg ) ! Namelist nampisatm in configuration namelist : Pisces atm. sea level pressure file 329 331 READ ( numnatp_cfg, nampisatm, IOSTAT = ios, ERR = 902 ) 330 902 IF( ios /= 0 )CALL ctl_nam ( ios , 'nampisatm in configuration namelist', lwp )332 902 IF( ios > 0 ) CALL ctl_nam ( ios , 'nampisatm in configuration namelist', lwp ) 331 333 IF(lwm) WRITE ( numonp, nampisatm ) 332 334 ! 333 335 ! 334 336 IF(lwp) THEN !* control print 335 WRITE(numout,*) 336 WRITE(numout,*) ' Namelist nampisatm : Atmospheric Pressure as external forcing' 337 WRITE(numout,*) ' constant atmopsheric pressure (F) or from a file (T) ln_presatm = ', ln_presatm 338 WRITE(numout,*) ' spatial atmopsheric CO2 for flux calcs ln_presatmco2 = ', ln_presatmco2 339 WRITE(numout,*) 337 WRITE(numout,*) ' Namelist : nampisatm --- Atmospheric Pressure as external forcing' 338 WRITE(numout,*) ' constant atmopsheric pressure (F) or from a file (T) ln_presatm = ', ln_presatm 339 WRITE(numout,*) ' spatial atmopsheric CO2 for flux calcs ln_presatmco2 = ', ln_presatmco2 340 340 ENDIF 341 341 ! … … 358 358 ENDIF 359 359 ! 360 IF( .NOT.ln_presatm ) patm(:,:) = 1. e0! Initialize patm if no reading from a file360 IF( .NOT.ln_presatm ) patm(:,:) = 1._wp ! Initialize patm if no reading from a file 361 361 ! 362 362 ENDIF
Note: See TracChangeset
for help on using the changeset viewer.