[3443] | 1 | MODULE p4zflx |
---|
| 2 | !!====================================================================== |
---|
| 3 | !! *** MODULE p4zflx *** |
---|
| 4 | !! TOP : PISCES CALCULATES GAS EXCHANGE AND CHEMISTRY AT SEA SURFACE |
---|
| 5 | !!====================================================================== |
---|
[9169] | 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 |
---|
[3443] | 12 | !!---------------------------------------------------------------------- |
---|
| 13 | !! p4z_flx : CALCULATES GAS EXCHANGE AND CHEMISTRY AT SEA SURFACE |
---|
| 14 | !! p4z_flx_init : Read the namelist |
---|
| 15 | !! p4z_patm : Read sfc atm pressure [atm] for each grid cell |
---|
| 16 | !!---------------------------------------------------------------------- |
---|
[9169] | 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 |
---|
[13286] | 21 | USE prtctl ! print control for debugging |
---|
[9169] | 22 | USE iom ! I/O manager |
---|
| 23 | USE fldread ! read input fields |
---|
[3443] | 24 | |
---|
| 25 | IMPLICIT NONE |
---|
| 26 | PRIVATE |
---|
| 27 | |
---|
| 28 | PUBLIC p4z_flx |
---|
| 29 | PUBLIC p4z_flx_init |
---|
| 30 | PUBLIC p4z_flx_alloc |
---|
| 31 | |
---|
[9169] | 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) |
---|
[3443] | 37 | |
---|
| 38 | !! Variables related to reading atmospheric CO2 time history |
---|
[9169] | 39 | INTEGER :: nmaxrec, numco2 ! |
---|
| 40 | REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:) :: atcco2h, years ! |
---|
[3443] | 41 | |
---|
[9169] | 42 | ! !!* nampisatm namelist (Atmospheric PRessure) * |
---|
[7646] | 43 | LOGICAL, PUBLIC :: ln_presatm !: ref. pressure: global mean Patm (F) or a constant (F) |
---|
| 44 | LOGICAL, PUBLIC :: ln_presatmco2 !: accounting for spatial atm CO2 in the compuation of carbon flux (T) or not (F) |
---|
[3443] | 45 | |
---|
[9169] | 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) |
---|
[3443] | 49 | |
---|
[9169] | 50 | REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: satmco2 !: atmospheric pco2 |
---|
[3443] | 51 | |
---|
[9169] | 52 | REAL(wp) :: xconv = 0.01_wp / 3600._wp !: coefficients for conversion |
---|
[3443] | 53 | |
---|
[12377] | 54 | !! * Substitutions |
---|
| 55 | # include "do_loop_substitute.h90" |
---|
[13237] | 56 | # include "domzgr_substitute.h90" |
---|
[3443] | 57 | !!---------------------------------------------------------------------- |
---|
[10067] | 58 | !! NEMO/TOP 4.0 , NEMO Consortium (2018) |
---|
[7753] | 59 | !! $Id$ |
---|
[10068] | 60 | !! Software governed by the CeCILL license (see ./LICENSE) |
---|
[3443] | 61 | !!---------------------------------------------------------------------- |
---|
| 62 | CONTAINS |
---|
| 63 | |
---|
[12377] | 64 | SUBROUTINE p4z_flx ( kt, knt, Kbb, Kmm, Krhs ) |
---|
[3443] | 65 | !!--------------------------------------------------------------------- |
---|
| 66 | !! *** ROUTINE p4z_flx *** |
---|
| 67 | !! |
---|
| 68 | !! ** Purpose : CALCULATES GAS EXCHANGE AND CHEMISTRY AT SEA SURFACE |
---|
| 69 | !! |
---|
| 70 | !! ** Method : |
---|
| 71 | !! - Include total atm P correction via Esbensen & Kushnir (1981) |
---|
| 72 | !! - Remove Wanninkhof chemical enhancement; |
---|
| 73 | !! - Add option for time-interpolation of atcco2.txt |
---|
| 74 | !!--------------------------------------------------------------------- |
---|
[5385] | 75 | INTEGER, INTENT(in) :: kt, knt ! |
---|
[12377] | 76 | INTEGER, INTENT(in) :: Kbb, Kmm, Krhs ! time level indices |
---|
[3443] | 77 | ! |
---|
| 78 | INTEGER :: ji, jj, jm, iind, iindm1 |
---|
[6291] | 79 | REAL(wp) :: ztc, ztc2, ztc3, ztc4, zws, zkgwan |
---|
[3443] | 80 | REAL(wp) :: zfld, zflu, zfld16, zflu16, zfact |
---|
[6945] | 81 | REAL(wp) :: zvapsw, zsal, zfco2, zxc2, xCO2approx, ztkel, zfugcoeff |
---|
[7646] | 82 | REAL(wp) :: zph, zdic, zsch_o2, zsch_co2 |
---|
[3443] | 83 | REAL(wp) :: zyr_dec, zdco2dt |
---|
[9169] | 84 | CHARACTER (len=25) :: charout |
---|
[15459] | 85 | REAL(wp), DIMENSION(jpi,jpj) :: zkgco2, zkgo2, zh2co3, zoflx, zpco2atm, zpco2oce |
---|
[3443] | 86 | !!--------------------------------------------------------------------- |
---|
| 87 | ! |
---|
[9124] | 88 | IF( ln_timing ) CALL timing_start('p4z_flx') |
---|
[3443] | 89 | ! |
---|
| 90 | ! SURFACE CHEMISTRY (PCO2 AND [H+] IN |
---|
| 91 | ! SURFACE LAYER); THE RESULT OF THIS CALCULATION |
---|
| 92 | ! IS USED TO COMPUTE AIR-SEA FLUX OF CO2 |
---|
| 93 | |
---|
[9169] | 94 | 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 |
---|
[3443] | 95 | |
---|
[7646] | 96 | IF( ln_co2int .AND. .NOT.ln_presatmco2 .AND. .NOT.l_co2cpl ) THEN |
---|
[3443] | 97 | ! Linear temporal interpolation of atmospheric pco2. atcco2.txt has annual values. |
---|
| 98 | ! Caveats: First column of .txt must be in years, decimal years preferably. |
---|
| 99 | ! For nn_offset, if your model year is iyy, nn_offset=(years(1)-iyy) |
---|
| 100 | ! then the first atmospheric CO2 record read is at years(1) |
---|
| 101 | zyr_dec = REAL( nyear + nn_offset, wp ) + REAL( nday_year, wp ) / REAL( nyear_len(1), wp ) |
---|
[4148] | 102 | jm = 1 |
---|
| 103 | DO WHILE( jm <= nmaxrec .AND. years(jm) < zyr_dec ) ; jm = jm + 1 ; END DO |
---|
[3443] | 104 | iind = jm ; iindm1 = jm - 1 |
---|
| 105 | zdco2dt = ( atcco2h(iind) - atcco2h(iindm1) ) / ( years(iind) - years(iindm1) + rtrn ) |
---|
| 106 | atcco2 = zdco2dt * ( zyr_dec - years(iindm1) ) + atcco2h(iindm1) |
---|
[7753] | 107 | satmco2(:,:) = atcco2 |
---|
[3443] | 108 | ENDIF |
---|
| 109 | |
---|
[7753] | 110 | IF( l_co2cpl ) satmco2(:,:) = atm_co2(:,:) |
---|
[3443] | 111 | |
---|
[15090] | 112 | DO_2D( nn_hls, nn_hls, nn_hls, nn_hls ) |
---|
[12377] | 113 | ! DUMMY VARIABLES FOR DIC, H+, AND BORATE |
---|
| 114 | zfact = rhop(ji,jj,1) / 1000. + rtrn |
---|
| 115 | zdic = tr(ji,jj,1,jpdic,Kbb) |
---|
| 116 | zph = MAX( hi(ji,jj,1), 1.e-10 ) / zfact |
---|
| 117 | ! CALCULATE [H2CO3] |
---|
| 118 | zh2co3(ji,jj) = zdic/(1. + ak13(ji,jj,1)/zph + ak13(ji,jj,1)*ak23(ji,jj,1)/zph**2) |
---|
| 119 | END_2D |
---|
[3443] | 120 | |
---|
| 121 | ! -------------- |
---|
| 122 | ! COMPUTE FLUXES |
---|
| 123 | ! -------------- |
---|
| 124 | |
---|
| 125 | ! FIRST COMPUTE GAS EXCHANGE COEFFICIENTS |
---|
| 126 | ! ------------------------------------------- |
---|
| 127 | |
---|
[15090] | 128 | DO_2D( nn_hls, nn_hls, nn_hls, nn_hls ) |
---|
[12377] | 129 | ztc = MIN( 35., ts(ji,jj,1,jp_tem,Kmm) ) |
---|
| 130 | ztc2 = ztc * ztc |
---|
| 131 | ztc3 = ztc * ztc2 |
---|
| 132 | ztc4 = ztc2 * ztc2 |
---|
| 133 | ! Compute the schmidt Number both O2 and CO2 |
---|
| 134 | zsch_co2 = 2116.8 - 136.25 * ztc + 4.7353 * ztc2 - 0.092307 * ztc3 + 0.0007555 * ztc4 |
---|
| 135 | zsch_o2 = 1920.4 - 135.6 * ztc + 5.2122 * ztc2 - 0.109390 * ztc3 + 0.0009377 * ztc4 |
---|
| 136 | ! wind speed |
---|
| 137 | zws = wndm(ji,jj) * wndm(ji,jj) |
---|
| 138 | ! Compute the piston velocity for O2 and CO2 |
---|
| 139 | zkgwan = 0.251 * zws |
---|
| 140 | zkgwan = zkgwan * xconv * ( 1.- fr_i(ji,jj) ) * tmask(ji,jj,1) |
---|
| 141 | ! compute gas exchange for CO2 and O2 |
---|
| 142 | zkgco2(ji,jj) = zkgwan * SQRT( 660./ zsch_co2 ) |
---|
| 143 | zkgo2 (ji,jj) = zkgwan * SQRT( 660./ zsch_o2 ) |
---|
| 144 | END_2D |
---|
[3443] | 145 | |
---|
[7646] | 146 | |
---|
[15090] | 147 | DO_2D( nn_hls, nn_hls, nn_hls, nn_hls ) |
---|
[12377] | 148 | ztkel = tempis(ji,jj,1) + 273.15 |
---|
| 149 | zsal = salinprac(ji,jj,1) + ( 1.- tmask(ji,jj,1) ) * 35. |
---|
| 150 | zvapsw = EXP(24.4543 - 67.4509*(100.0/ztkel) - 4.8489*LOG(ztkel/100) - 0.000544*zsal) |
---|
| 151 | zpco2atm(ji,jj) = satmco2(ji,jj) * ( patm(ji,jj) - zvapsw ) |
---|
| 152 | zxc2 = ( 1.0 - zpco2atm(ji,jj) * 1E-6 )**2 |
---|
| 153 | zfugcoeff = EXP( patm(ji,jj) * (chemc(ji,jj,2) + 2.0 * zxc2 * chemc(ji,jj,3) ) & |
---|
| 154 | & / ( 82.05736 * ztkel )) |
---|
| 155 | zfco2 = zpco2atm(ji,jj) * zfugcoeff |
---|
[6945] | 156 | |
---|
[12377] | 157 | ! Compute CO2 flux for the sea and air |
---|
| 158 | zfld = zfco2 * chemc(ji,jj,1) * zkgco2(ji,jj) ! (mol/L) * (m/s) |
---|
| 159 | zflu = zh2co3(ji,jj) * zkgco2(ji,jj) ! (mol/L) (m/s) ? |
---|
[15459] | 160 | zpco2oce(ji,jj) = zh2co3(ji,jj) / ( chemc(ji,jj,1) * zfugcoeff + rtrn ) |
---|
| 161 | oce_co2(ji,jj) = ( zfld - zflu ) * tmask(ji,jj,1) |
---|
[12377] | 162 | ! compute the trend |
---|
| 163 | tr(ji,jj,1,jpdic,Krhs) = tr(ji,jj,1,jpdic,Krhs) + oce_co2(ji,jj) * rfact2 / e3t(ji,jj,1,Kmm) |
---|
[3443] | 164 | |
---|
[12377] | 165 | ! Compute O2 flux |
---|
| 166 | zfld16 = patm(ji,jj) * chemo2(ji,jj,1) * zkgo2(ji,jj) ! (mol/L) * (m/s) |
---|
| 167 | zflu16 = tr(ji,jj,1,jpoxy,Kbb) * zkgo2(ji,jj) |
---|
| 168 | zoflx(ji,jj) = ( zfld16 - zflu16 ) * tmask(ji,jj,1) |
---|
| 169 | tr(ji,jj,1,jpoxy,Krhs) = tr(ji,jj,1,jpoxy,Krhs) + zoflx(ji,jj) * rfact2 / e3t(ji,jj,1,Kmm) |
---|
| 170 | END_2D |
---|
[3443] | 171 | |
---|
[10425] | 172 | IF( iom_use("tcflx") .OR. iom_use("tcflxcum") .OR. kt == nitrst & |
---|
| 173 | & .OR. (ln_check_mass .AND. kt == nitend) ) & |
---|
[12276] | 174 | t_oce_co2_flx = glob_sum( 'p4zflx', oce_co2(:,:) * e1e2t(:,:) * 1000. ) ! Total Flux of Carbon |
---|
[4996] | 175 | t_oce_co2_flx_cum = t_oce_co2_flx_cum + t_oce_co2_flx ! Cumulative Total Flux of Carbon |
---|
[10425] | 176 | ! t_atm_co2_flx = glob_sum( 'p4zflx', satmco2(:,:) * e1e2t(:,:) ) ! Total atmospheric pCO2 |
---|
[4996] | 177 | t_atm_co2_flx = atcco2 ! Total atmospheric pCO2 |
---|
| 178 | |
---|
[12377] | 179 | IF(sn_cfctl%l_prttrc) THEN ! print mean trends (used for debugging) |
---|
[3443] | 180 | WRITE(charout, FMT="('flx ')") |
---|
[13286] | 181 | CALL prt_ctl_info( charout, cdcomp = 'top' ) |
---|
| 182 | CALL prt_ctl(tab4d_1=tr(:,:,:,:,Krhs), mask1=tmask, clinfo=ctrcnm) |
---|
[3443] | 183 | ENDIF |
---|
| 184 | |
---|
[5385] | 185 | IF( lk_iomput .AND. knt == nrdttrc ) THEN |
---|
[12276] | 186 | CALL iom_put( "AtmCo2" , satmco2(:,:) * tmask(:,:,1) ) ! Atmospheric CO2 concentration |
---|
| 187 | CALL iom_put( "Cflx" , oce_co2(:,:) * 1000. ) |
---|
| 188 | CALL iom_put( "Oflx" , zoflx(:,:) * 1000. ) |
---|
| 189 | CALL iom_put( "Kg" , zkgco2(:,:) * tmask(:,:,1) ) |
---|
[15459] | 190 | CALL iom_put( "Dpco2" , ( zpco2atm(:,:) - zpco2oce(:,:) ) * tmask(:,:,1) ) |
---|
| 191 | CALL iom_put( "pCO2sea" , zpco2oce(:,:) * tmask(:,:,1) ) |
---|
[12377] | 192 | CALL iom_put( "Dpo2" , ( atcox * patm(:,:) - atcox * tr(:,:,1,jpoxy,Kbb) / ( chemo2(:,:,1) + rtrn ) ) * tmask(:,:,1) ) |
---|
[12276] | 193 | CALL iom_put( "tcflx" , t_oce_co2_flx ) ! molC/s |
---|
| 194 | CALL iom_put( "tcflxcum", t_oce_co2_flx_cum ) ! molC |
---|
[3443] | 195 | ENDIF |
---|
| 196 | ! |
---|
[9124] | 197 | IF( ln_timing ) CALL timing_stop('p4z_flx') |
---|
[3443] | 198 | ! |
---|
| 199 | END SUBROUTINE p4z_flx |
---|
| 200 | |
---|
| 201 | |
---|
| 202 | SUBROUTINE p4z_flx_init |
---|
| 203 | !!---------------------------------------------------------------------- |
---|
| 204 | !! *** ROUTINE p4z_flx_init *** |
---|
| 205 | !! |
---|
| 206 | !! ** Purpose : Initialization of atmospheric conditions |
---|
| 207 | !! |
---|
| 208 | !! ** Method : Read the nampisext namelist and check the parameters |
---|
| 209 | !! called at the first timestep (nittrc000) |
---|
[9169] | 210 | !! |
---|
[3443] | 211 | !! ** input : Namelist nampisext |
---|
| 212 | !!---------------------------------------------------------------------- |
---|
[9169] | 213 | INTEGER :: jm, ios ! Local integer |
---|
| 214 | !! |
---|
[3443] | 215 | NAMELIST/nampisext/ln_co2int, atcco2, clname, nn_offset |
---|
| 216 | !!---------------------------------------------------------------------- |
---|
[9169] | 217 | IF(lwp) THEN |
---|
| 218 | WRITE(numout,*) |
---|
| 219 | WRITE(numout,*) ' p4z_flx_init : atmospheric conditions for air-sea flux calculation' |
---|
| 220 | WRITE(numout,*) ' ~~~~~~~~~~~~' |
---|
| 221 | ENDIF |
---|
[3443] | 222 | ! |
---|
[4147] | 223 | READ ( numnatp_ref, nampisext, IOSTAT = ios, ERR = 901) |
---|
[11536] | 224 | 901 IF( ios /= 0 ) CALL ctl_nam ( ios , 'nampisext in reference namelist' ) |
---|
[4147] | 225 | READ ( numnatp_cfg, nampisext, IOSTAT = ios, ERR = 902 ) |
---|
[11536] | 226 | 902 IF( ios > 0 ) CALL ctl_nam ( ios , 'nampisext in configuration namelist' ) |
---|
[4624] | 227 | IF(lwm) WRITE ( numonp, nampisext ) |
---|
[3443] | 228 | ! |
---|
| 229 | IF(lwp) THEN ! control print |
---|
[9169] | 230 | WRITE(numout,*) ' Namelist : nampisext --- parameters for air-sea exchange' |
---|
| 231 | WRITE(numout,*) ' reading in the atm pCO2 file or constant value ln_co2int =', ln_co2int |
---|
[3443] | 232 | ENDIF |
---|
[9248] | 233 | ! |
---|
| 234 | CALL p4z_patm( nit000 ) |
---|
| 235 | ! |
---|
| 236 | IF( .NOT.ln_co2int .AND. .NOT.ln_presatmco2 ) THEN |
---|
[3443] | 237 | IF(lwp) THEN ! control print |
---|
[9169] | 238 | WRITE(numout,*) ' Constant Atmospheric pCO2 value atcco2 =', atcco2 |
---|
[3443] | 239 | ENDIF |
---|
[7753] | 240 | satmco2(:,:) = atcco2 ! Initialisation of atmospheric pco2 |
---|
[7646] | 241 | ELSEIF( ln_co2int .AND. .NOT.ln_presatmco2 ) THEN |
---|
[3443] | 242 | IF(lwp) THEN |
---|
[9169] | 243 | WRITE(numout,*) ' Constant Atmospheric pCO2 value atcco2 =', atcco2 |
---|
| 244 | WRITE(numout,*) ' Atmospheric pCO2 value from file clname =', TRIM( clname ) |
---|
| 245 | WRITE(numout,*) ' Offset model-data start year nn_offset =', nn_offset |
---|
[3443] | 246 | ENDIF |
---|
| 247 | CALL ctl_opn( numco2, TRIM( clname) , 'OLD', 'FORMATTED', 'SEQUENTIAL', -1 , numout, lwp ) |
---|
| 248 | jm = 0 ! Count the number of record in co2 file |
---|
| 249 | DO |
---|
| 250 | READ(numco2,*,END=100) |
---|
| 251 | jm = jm + 1 |
---|
| 252 | END DO |
---|
| 253 | 100 nmaxrec = jm - 1 |
---|
[9169] | 254 | ALLOCATE( years (nmaxrec) ) ; years (:) = 0._wp |
---|
| 255 | ALLOCATE( atcco2h(nmaxrec) ) ; atcco2h(:) = 0._wp |
---|
| 256 | ! |
---|
[3443] | 257 | REWIND(numco2) |
---|
| 258 | DO jm = 1, nmaxrec ! get xCO2 data |
---|
| 259 | READ(numco2, *) years(jm), atcco2h(jm) |
---|
| 260 | IF(lwp) WRITE(numout, '(f6.0,f7.2)') years(jm), atcco2h(jm) |
---|
| 261 | END DO |
---|
| 262 | CLOSE(numco2) |
---|
[7646] | 263 | ELSEIF( .NOT.ln_co2int .AND. ln_presatmco2 ) THEN |
---|
[9248] | 264 | IF(lwp) WRITE(numout,*) ' Spatialized Atmospheric pCO2 from an external file' |
---|
[7646] | 265 | ELSE |
---|
[9248] | 266 | IF(lwp) WRITE(numout,*) ' Spatialized Atmospheric pCO2 from an external file' |
---|
[3443] | 267 | ENDIF |
---|
| 268 | ! |
---|
[7753] | 269 | oce_co2(:,:) = 0._wp ! Initialization of Flux of Carbon |
---|
[4996] | 270 | t_oce_co2_flx = 0._wp |
---|
[3443] | 271 | t_atm_co2_flx = 0._wp |
---|
| 272 | ! |
---|
| 273 | END SUBROUTINE p4z_flx_init |
---|
| 274 | |
---|
[9124] | 275 | |
---|
[3443] | 276 | SUBROUTINE p4z_patm( kt ) |
---|
| 277 | !!---------------------------------------------------------------------- |
---|
| 278 | !! *** ROUTINE p4z_atm *** |
---|
| 279 | !! |
---|
[9169] | 280 | !! ** Purpose : Read and interpolate the external atmospheric sea-level pressure |
---|
[3443] | 281 | !! ** Method : Read the files and interpolate the appropriate variables |
---|
| 282 | !! |
---|
| 283 | !!---------------------------------------------------------------------- |
---|
[9169] | 284 | INTEGER, INTENT(in) :: kt ! ocean time step |
---|
[3443] | 285 | ! |
---|
[9169] | 286 | INTEGER :: ierr, ios ! Local integer |
---|
| 287 | CHARACTER(len=100) :: cn_dir ! Root directory for location of ssr files |
---|
| 288 | TYPE(FLD_N) :: sn_patm ! informations about the fields to be read |
---|
| 289 | TYPE(FLD_N) :: sn_atmco2 ! informations about the fields to be read |
---|
[3443] | 290 | !! |
---|
[7646] | 291 | NAMELIST/nampisatm/ ln_presatm, ln_presatmco2, sn_patm, sn_atmco2, cn_dir |
---|
[9124] | 292 | !!---------------------------------------------------------------------- |
---|
[9169] | 293 | ! |
---|
| 294 | IF( kt == nit000 ) THEN !== First call kt=nittrc000 ==! |
---|
| 295 | ! |
---|
| 296 | IF(lwp) THEN |
---|
| 297 | WRITE(numout,*) |
---|
| 298 | WRITE(numout,*) ' p4z_patm : sea-level atmospheric pressure' |
---|
| 299 | WRITE(numout,*) ' ~~~~~~~~' |
---|
| 300 | ENDIF |
---|
| 301 | ! |
---|
[4147] | 302 | READ ( numnatp_ref, nampisatm, IOSTAT = ios, ERR = 901) |
---|
[11536] | 303 | 901 IF( ios /= 0 ) CALL ctl_nam ( ios , 'nampisatm in reference namelist' ) |
---|
[4147] | 304 | READ ( numnatp_cfg, nampisatm, IOSTAT = ios, ERR = 902 ) |
---|
[11536] | 305 | 902 IF( ios > 0 ) CALL ctl_nam ( ios , 'nampisatm in configuration namelist' ) |
---|
[4624] | 306 | IF(lwm) WRITE ( numonp, nampisatm ) |
---|
[3443] | 307 | ! |
---|
| 308 | ! |
---|
| 309 | IF(lwp) THEN !* control print |
---|
[9169] | 310 | WRITE(numout,*) ' Namelist : nampisatm --- Atmospheric Pressure as external forcing' |
---|
| 311 | WRITE(numout,*) ' constant atmopsheric pressure (F) or from a file (T) ln_presatm = ', ln_presatm |
---|
| 312 | WRITE(numout,*) ' spatial atmopsheric CO2 for flux calcs ln_presatmco2 = ', ln_presatmco2 |
---|
[3443] | 313 | ENDIF |
---|
| 314 | ! |
---|
| 315 | IF( ln_presatm ) THEN |
---|
| 316 | ALLOCATE( sf_patm(1), STAT=ierr ) !* allocate and fill sf_patm (forcing structure) with sn_patm |
---|
| 317 | IF( ierr > 0 ) CALL ctl_stop( 'STOP', 'p4z_flx: unable to allocate sf_patm structure' ) |
---|
| 318 | ! |
---|
| 319 | CALL fld_fill( sf_patm, (/ sn_patm /), cn_dir, 'p4z_flx', 'Atmospheric pressure ', 'nampisatm' ) |
---|
| 320 | ALLOCATE( sf_patm(1)%fnow(jpi,jpj,1) ) |
---|
| 321 | IF( sn_patm%ln_tint ) ALLOCATE( sf_patm(1)%fdta(jpi,jpj,1,2) ) |
---|
| 322 | ENDIF |
---|
| 323 | ! |
---|
[7646] | 324 | IF( ln_presatmco2 ) THEN |
---|
| 325 | ALLOCATE( sf_atmco2(1), STAT=ierr ) !* allocate and fill sf_atmco2 (forcing structure) with sn_atmco2 |
---|
| 326 | IF( ierr > 0 ) CALL ctl_stop( 'STOP', 'p4z_flx: unable to allocate sf_atmco2 structure' ) |
---|
| 327 | ! |
---|
| 328 | CALL fld_fill( sf_atmco2, (/ sn_atmco2 /), cn_dir, 'p4z_flx', 'Atmospheric co2 partial pressure ', 'nampisatm' ) |
---|
| 329 | ALLOCATE( sf_atmco2(1)%fnow(jpi,jpj,1) ) |
---|
| 330 | IF( sn_atmco2%ln_tint ) ALLOCATE( sf_atmco2(1)%fdta(jpi,jpj,1,2) ) |
---|
| 331 | ENDIF |
---|
| 332 | ! |
---|
[9169] | 333 | IF( .NOT.ln_presatm ) patm(:,:) = 1._wp ! Initialize patm if no reading from a file |
---|
[3443] | 334 | ! |
---|
| 335 | ENDIF |
---|
| 336 | ! |
---|
| 337 | IF( ln_presatm ) THEN |
---|
| 338 | CALL fld_read( kt, 1, sf_patm ) !* input Patm provided at kt + 1/2 |
---|
[15459] | 339 | patm(:,:) = sf_patm(1)%fnow(:,:,1)/101325.0 ! atmospheric pressure |
---|
[3443] | 340 | ENDIF |
---|
| 341 | ! |
---|
[7646] | 342 | IF( ln_presatmco2 ) THEN |
---|
| 343 | CALL fld_read( kt, 1, sf_atmco2 ) !* input atmco2 provided at kt + 1/2 |
---|
[7753] | 344 | satmco2(:,:) = sf_atmco2(1)%fnow(:,:,1) ! atmospheric pressure |
---|
[7646] | 345 | ELSE |
---|
[7753] | 346 | satmco2(:,:) = atcco2 ! Initialize atmco2 if no reading from a file |
---|
[7646] | 347 | ENDIF |
---|
| 348 | ! |
---|
[3443] | 349 | END SUBROUTINE p4z_patm |
---|
| 350 | |
---|
[7646] | 351 | |
---|
[3443] | 352 | INTEGER FUNCTION p4z_flx_alloc() |
---|
| 353 | !!---------------------------------------------------------------------- |
---|
| 354 | !! *** ROUTINE p4z_flx_alloc *** |
---|
| 355 | !!---------------------------------------------------------------------- |
---|
[7646] | 356 | ALLOCATE( satmco2(jpi,jpj), patm(jpi,jpj), STAT=p4z_flx_alloc ) |
---|
[3443] | 357 | ! |
---|
[10425] | 358 | IF( p4z_flx_alloc /= 0 ) CALL ctl_stop( 'STOP', 'p4z_flx_alloc : failed to allocate arrays' ) |
---|
[3443] | 359 | ! |
---|
| 360 | END FUNCTION p4z_flx_alloc |
---|
| 361 | |
---|
| 362 | !!====================================================================== |
---|
[5656] | 363 | END MODULE p4zflx |
---|