[3443] | 1 | MODULE p4zflx |
---|
| 2 | !!====================================================================== |
---|
| 3 | !! *** MODULE p4zflx *** |
---|
| 4 | !! TOP : PISCES CALCULATES GAS EXCHANGE AND CHEMISTRY AT SEA SURFACE |
---|
| 5 | !!====================================================================== |
---|
| 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 | !!---------------------------------------------------------------------- |
---|
| 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 | !!---------------------------------------------------------------------- |
---|
| 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 | |
---|
| 25 | IMPLICIT NONE |
---|
| 26 | PRIVATE |
---|
| 27 | |
---|
| 28 | PUBLIC p4z_flx |
---|
| 29 | PUBLIC p4z_flx_init |
---|
| 30 | PUBLIC p4z_flx_alloc |
---|
| 31 | |
---|
[4147] | 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 |
---|
| 39 | REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:) :: atcco2h, years |
---|
| 40 | INTEGER :: nmaxrec, numco2 |
---|
| 41 | |
---|
[4147] | 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 | |
---|
[7646] | 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 | |
---|
| 50 | REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: satmco2 !: atmospheric pco2 |
---|
| 51 | |
---|
| 52 | REAL(wp) :: xconv = 0.01_wp / 3600._wp !: coefficients for conversion |
---|
| 53 | |
---|
| 54 | !!---------------------------------------------------------------------- |
---|
| 55 | !! NEMO/TOP 3.3 , NEMO Consortium (2010) |
---|
[7698] | 56 | !! $Id$ |
---|
[3443] | 57 | !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) |
---|
| 58 | !!---------------------------------------------------------------------- |
---|
| 59 | CONTAINS |
---|
| 60 | |
---|
[5385] | 61 | SUBROUTINE p4z_flx ( kt, knt ) |
---|
[3443] | 62 | !!--------------------------------------------------------------------- |
---|
| 63 | !! *** ROUTINE p4z_flx *** |
---|
| 64 | !! |
---|
| 65 | !! ** Purpose : CALCULATES GAS EXCHANGE AND CHEMISTRY AT SEA SURFACE |
---|
| 66 | !! |
---|
| 67 | !! ** Method : |
---|
| 68 | !! - Include total atm P correction via Esbensen & Kushnir (1981) |
---|
| 69 | !! - Remove Wanninkhof chemical enhancement; |
---|
| 70 | !! - Add option for time-interpolation of atcco2.txt |
---|
| 71 | !!--------------------------------------------------------------------- |
---|
| 72 | ! |
---|
[5385] | 73 | INTEGER, INTENT(in) :: kt, knt ! |
---|
[3443] | 74 | ! |
---|
| 75 | INTEGER :: ji, jj, jm, iind, iindm1 |
---|
[6291] | 76 | REAL(wp) :: ztc, ztc2, ztc3, ztc4, zws, zkgwan |
---|
[3443] | 77 | REAL(wp) :: zfld, zflu, zfld16, zflu16, zfact |
---|
[6945] | 78 | REAL(wp) :: zvapsw, zsal, zfco2, zxc2, xCO2approx, ztkel, zfugcoeff |
---|
[7646] | 79 | REAL(wp) :: zph, zdic, zsch_o2, zsch_co2 |
---|
[3443] | 80 | REAL(wp) :: zyr_dec, zdco2dt |
---|
| 81 | CHARACTER (len=25) :: charout |
---|
[6945] | 82 | REAL(wp), POINTER, DIMENSION(:,:) :: zkgco2, zkgo2, zh2co3, zoflx, zw2d, zpco2atm |
---|
[3443] | 83 | !!--------------------------------------------------------------------- |
---|
| 84 | ! |
---|
| 85 | IF( nn_timing == 1 ) CALL timing_start('p4z_flx') |
---|
| 86 | ! |
---|
[6945] | 87 | CALL wrk_alloc( jpi, jpj, zkgco2, zkgo2, zh2co3, zoflx, zpco2atm ) |
---|
[3443] | 88 | ! |
---|
| 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 | |
---|
[7646] | 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) |
---|
[7698] | 107 | !$OMP PARALLEL DO schedule(static) private(jj,ji) |
---|
| 108 | DO jj = 1, jpj |
---|
| 109 | DO ji = 1, jpi |
---|
| 110 | satmco2(ji,jj) = atcco2 |
---|
| 111 | END DO |
---|
| 112 | END DO |
---|
[3443] | 113 | ENDIF |
---|
| 114 | |
---|
[7698] | 115 | IF( l_co2cpl ) THEN |
---|
| 116 | !$OMP PARALLEL DO schedule(static) private(jj,ji) |
---|
| 117 | DO jj = 1, jpj |
---|
| 118 | DO ji = 1, jpi |
---|
| 119 | satmco2(ji,jj) = atm_co2(ji,jj) |
---|
| 120 | END DO |
---|
| 121 | END DO |
---|
| 122 | END IF |
---|
[3443] | 123 | |
---|
[7698] | 124 | !$OMP PARALLEL |
---|
| 125 | !$OMP DO schedule(static) private(jj,ji,zfact,zdic,zph) |
---|
[7646] | 126 | DO jj = 1, jpj |
---|
| 127 | DO ji = 1, jpi |
---|
| 128 | ! DUMMY VARIABLES FOR DIC, H+, AND BORATE |
---|
| 129 | zfact = rhop(ji,jj,1) / 1000. + rtrn |
---|
| 130 | zdic = trb(ji,jj,1,jpdic) |
---|
| 131 | zph = MAX( hi(ji,jj,1), 1.e-10 ) / zfact |
---|
| 132 | ! CALCULATE [H2CO3] |
---|
| 133 | zh2co3(ji,jj) = zdic/(1. + ak13(ji,jj,1)/zph + ak13(ji,jj,1)*ak23(ji,jj,1)/zph**2) |
---|
[3443] | 134 | END DO |
---|
| 135 | END DO |
---|
| 136 | |
---|
| 137 | ! -------------- |
---|
| 138 | ! COMPUTE FLUXES |
---|
| 139 | ! -------------- |
---|
| 140 | |
---|
| 141 | ! FIRST COMPUTE GAS EXCHANGE COEFFICIENTS |
---|
| 142 | ! ------------------------------------------- |
---|
| 143 | |
---|
[7698] | 144 | !$OMP DO schedule(static) private(jj,ji,ztc,ztc2,ztc3,ztc4,zsch_co2,zsch_o2,zws,zkgwan) |
---|
[3443] | 145 | DO jj = 1, jpj |
---|
| 146 | DO ji = 1, jpi |
---|
| 147 | ztc = MIN( 35., tsn(ji,jj,1,jp_tem) ) |
---|
| 148 | ztc2 = ztc * ztc |
---|
| 149 | ztc3 = ztc * ztc2 |
---|
[6291] | 150 | ztc4 = ztc2 * ztc2 |
---|
[3443] | 151 | ! Compute the schmidt Number both O2 and CO2 |
---|
[6291] | 152 | zsch_co2 = 2116.8 - 136.25 * ztc + 4.7353 * ztc2 - 0.092307 * ztc3 + 0.0007555 * ztc4 |
---|
| 153 | zsch_o2 = 1920.4 - 135.6 * ztc + 5.2122 * ztc2 - 0.109390 * ztc3 + 0.0009377 * ztc4 |
---|
[3443] | 154 | ! wind speed |
---|
| 155 | zws = wndm(ji,jj) * wndm(ji,jj) |
---|
| 156 | ! Compute the piston velocity for O2 and CO2 |
---|
[6291] | 157 | zkgwan = 0.251 * zws |
---|
[3443] | 158 | zkgwan = zkgwan * xconv * ( 1.- fr_i(ji,jj) ) * tmask(ji,jj,1) |
---|
| 159 | ! compute gas exchange for CO2 and O2 |
---|
| 160 | zkgco2(ji,jj) = zkgwan * SQRT( 660./ zsch_co2 ) |
---|
| 161 | zkgo2 (ji,jj) = zkgwan * SQRT( 660./ zsch_o2 ) |
---|
| 162 | END DO |
---|
| 163 | END DO |
---|
| 164 | |
---|
[7646] | 165 | |
---|
[7698] | 166 | !$OMP DO schedule(static) private(jj,ji,ztkel,zsal,zvapsw,zxc2,zfugcoeff,zfco2,zfld,zflu,zflu16) |
---|
[3443] | 167 | DO jj = 1, jpj |
---|
| 168 | DO ji = 1, jpi |
---|
[7646] | 169 | ztkel = tempis(ji,jj,1) + 273.15 |
---|
| 170 | zsal = salinprac(ji,jj,1) + ( 1.- tmask(ji,jj,1) ) * 35. |
---|
[6945] | 171 | zvapsw = EXP(24.4543 - 67.4509*(100.0/ztkel) - 4.8489*LOG(ztkel/100) - 0.000544*zsal) |
---|
| 172 | zpco2atm(ji,jj) = satmco2(ji,jj) * ( patm(ji,jj) - zvapsw ) |
---|
| 173 | zxc2 = ( 1.0 - zpco2atm(ji,jj) * 1E-6 )**2 |
---|
| 174 | zfugcoeff = EXP( patm(ji,jj) * (chemc(ji,jj,2) + 2.0 * zxc2 * chemc(ji,jj,3) ) & |
---|
| 175 | & / ( 82.05736 * ztkel )) |
---|
| 176 | zfco2 = zpco2atm(ji,jj) * zfugcoeff |
---|
| 177 | |
---|
[3443] | 178 | ! Compute CO2 flux for the sea and air |
---|
[6945] | 179 | zfld = zfco2 * chemc(ji,jj,1) * zkgco2(ji,jj) ! (mol/L) * (m/s) |
---|
| 180 | zflu = zh2co3(ji,jj) * zkgco2(ji,jj) ! (mol/L) (m/s) ? |
---|
[5385] | 181 | oce_co2(ji,jj) = ( zfld - zflu ) * rfact2 * e1e2t(ji,jj) * tmask(ji,jj,1) * 1000. |
---|
[3443] | 182 | ! compute the trend |
---|
[6945] | 183 | tra(ji,jj,1,jpdic) = tra(ji,jj,1,jpdic) + ( zfld - zflu ) * rfact2 / e3t_n(ji,jj,1) * tmask(ji,jj,1) |
---|
[3443] | 184 | |
---|
| 185 | ! Compute O2 flux |
---|
[6945] | 186 | zfld16 = patm(ji,jj) * chemo2(ji,jj,1) * zkgo2(ji,jj) ! (mol/L) * (m/s) |
---|
| 187 | zflu16 = trb(ji,jj,1,jpoxy) * zkgo2(ji,jj) |
---|
| 188 | zoflx(ji,jj) = ( zfld16 - zflu16 ) * tmask(ji,jj,1) |
---|
[6140] | 189 | tra(ji,jj,1,jpoxy) = tra(ji,jj,1,jpoxy) + zoflx(ji,jj) * rfact2 / e3t_n(ji,jj,1) |
---|
[3443] | 190 | END DO |
---|
| 191 | END DO |
---|
[7698] | 192 | !$OMP END PARALLEL |
---|
[3443] | 193 | |
---|
[4996] | 194 | t_oce_co2_flx = glob_sum( oce_co2(:,:) ) ! Total Flux of Carbon |
---|
| 195 | t_oce_co2_flx_cum = t_oce_co2_flx_cum + t_oce_co2_flx ! Cumulative Total Flux of Carbon |
---|
| 196 | ! t_atm_co2_flx = glob_sum( satmco2(:,:) * e1e2t(:,:) ) ! Total atmospheric pCO2 |
---|
| 197 | t_atm_co2_flx = atcco2 ! Total atmospheric pCO2 |
---|
| 198 | |
---|
[3443] | 199 | IF(ln_ctl) THEN ! print mean trends (used for debugging) |
---|
| 200 | WRITE(charout, FMT="('flx ')") |
---|
| 201 | CALL prt_ctl_trc_info(charout) |
---|
| 202 | CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm) |
---|
| 203 | ENDIF |
---|
| 204 | |
---|
[5385] | 205 | IF( lk_iomput .AND. knt == nrdttrc ) THEN |
---|
[4996] | 206 | CALL wrk_alloc( jpi, jpj, zw2d ) |
---|
| 207 | IF( iom_use( "Cflx" ) ) THEN |
---|
[7698] | 208 | !$OMP PARALLEL DO schedule(static) private(jj,ji) |
---|
| 209 | DO jj = 1, jpj |
---|
| 210 | DO ji = 1, jpi |
---|
| 211 | zw2d(ji,jj) = oce_co2(ji,jj) / e1e2t(ji,jj) * rfact2r |
---|
| 212 | END DO |
---|
| 213 | END DO |
---|
[4996] | 214 | CALL iom_put( "Cflx" , zw2d ) |
---|
| 215 | ENDIF |
---|
| 216 | IF( iom_use( "Oflx" ) ) THEN |
---|
[7698] | 217 | !$OMP PARALLEL DO schedule(static) private(jj,ji) |
---|
| 218 | DO jj = 1, jpj |
---|
| 219 | DO ji = 1, jpi |
---|
| 220 | zw2d(ji,jj) = zoflx(ji,jj) * 1000 * tmask(ji,jj,1) |
---|
| 221 | END DO |
---|
| 222 | END DO |
---|
[4996] | 223 | CALL iom_put( "Oflx" , zw2d ) |
---|
| 224 | ENDIF |
---|
| 225 | IF( iom_use( "Kg" ) ) THEN |
---|
[7698] | 226 | !$OMP PARALLEL DO schedule(static) private(jj,ji) |
---|
| 227 | DO jj = 1, jpj |
---|
| 228 | DO ji = 1, jpi |
---|
| 229 | zw2d(ji,jj) = zkgco2(ji,jj) * tmask(ji,jj,1) |
---|
| 230 | END DO |
---|
| 231 | END DO |
---|
[4996] | 232 | CALL iom_put( "Kg" , zw2d ) |
---|
| 233 | ENDIF |
---|
| 234 | IF( iom_use( "Dpco2" ) ) THEN |
---|
[7698] | 235 | !$OMP PARALLEL DO schedule(static) private(jj,ji) |
---|
| 236 | DO jj = 1, jpj |
---|
| 237 | DO ji = 1, jpi |
---|
| 238 | zw2d(ji,jj) = ( zpco2atm(ji,jj) - zh2co3(ji,jj) / ( chemc(ji,jj,1) + rtrn ) ) * tmask(ji,jj,1) |
---|
| 239 | END DO |
---|
| 240 | END DO |
---|
[4996] | 241 | CALL iom_put( "Dpco2" , zw2d ) |
---|
| 242 | ENDIF |
---|
| 243 | IF( iom_use( "Dpo2" ) ) THEN |
---|
[7698] | 244 | !$OMP PARALLEL DO schedule(static) private(jj,ji) |
---|
| 245 | DO jj = 1, jpj |
---|
| 246 | DO ji = 1, jpi |
---|
| 247 | zw2d(ji,jj) = ( atcox * patm(ji,jj) - atcox * trb(ji,jj,1,jpoxy) / ( chemo2(ji,jj,1) + rtrn ) ) * tmask(ji,jj,1) |
---|
| 248 | END DO |
---|
| 249 | END DO |
---|
[4996] | 250 | CALL iom_put( "Dpo2" , zw2d ) |
---|
| 251 | ENDIF |
---|
| 252 | IF( iom_use( "tcflx" ) ) CALL iom_put( "tcflx" , t_oce_co2_flx * rfact2r ) ! molC/s |
---|
| 253 | CALL iom_put( "tcflxcum" , t_oce_co2_flx_cum ) ! molC |
---|
| 254 | ! |
---|
| 255 | CALL wrk_dealloc( jpi, jpj, zw2d ) |
---|
[3443] | 256 | ENDIF |
---|
| 257 | ! |
---|
[6945] | 258 | CALL wrk_dealloc( jpi, jpj, zkgco2, zkgo2, zh2co3, zoflx, zpco2atm ) |
---|
[3443] | 259 | ! |
---|
| 260 | IF( nn_timing == 1 ) CALL timing_stop('p4z_flx') |
---|
| 261 | ! |
---|
| 262 | END SUBROUTINE p4z_flx |
---|
| 263 | |
---|
| 264 | |
---|
| 265 | SUBROUTINE p4z_flx_init |
---|
| 266 | !!---------------------------------------------------------------------- |
---|
| 267 | !! *** ROUTINE p4z_flx_init *** |
---|
| 268 | !! |
---|
| 269 | !! ** Purpose : Initialization of atmospheric conditions |
---|
| 270 | !! |
---|
| 271 | !! ** Method : Read the nampisext namelist and check the parameters |
---|
| 272 | !! called at the first timestep (nittrc000) |
---|
| 273 | !! ** input : Namelist nampisext |
---|
| 274 | !!---------------------------------------------------------------------- |
---|
| 275 | NAMELIST/nampisext/ln_co2int, atcco2, clname, nn_offset |
---|
[7698] | 276 | INTEGER :: jm, jj, ji |
---|
[4147] | 277 | INTEGER :: ios ! Local integer output status for namelist read |
---|
[3443] | 278 | !!---------------------------------------------------------------------- |
---|
| 279 | ! |
---|
[4147] | 280 | |
---|
| 281 | REWIND( numnatp_ref ) ! Namelist nampisext in reference namelist : Pisces atm. conditions |
---|
| 282 | READ ( numnatp_ref, nampisext, IOSTAT = ios, ERR = 901) |
---|
| 283 | 901 IF( ios /= 0 ) CALL ctl_nam ( ios , 'nampisext in reference namelist', lwp ) |
---|
| 284 | |
---|
| 285 | REWIND( numnatp_cfg ) ! Namelist nampisext in configuration namelist : Pisces atm. conditions |
---|
| 286 | READ ( numnatp_cfg, nampisext, IOSTAT = ios, ERR = 902 ) |
---|
| 287 | 902 IF( ios /= 0 ) CALL ctl_nam ( ios , 'nampisext in configuration namelist', lwp ) |
---|
[4624] | 288 | IF(lwm) WRITE ( numonp, nampisext ) |
---|
[3443] | 289 | ! |
---|
| 290 | IF(lwp) THEN ! control print |
---|
| 291 | WRITE(numout,*) ' ' |
---|
| 292 | WRITE(numout,*) ' Namelist parameters for air-sea exchange, nampisext' |
---|
| 293 | WRITE(numout,*) ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' |
---|
| 294 | WRITE(numout,*) ' Choice for reading in the atm pCO2 file or constant value, ln_co2int =', ln_co2int |
---|
| 295 | WRITE(numout,*) ' ' |
---|
| 296 | ENDIF |
---|
[7646] | 297 | IF( .NOT.ln_co2int .AND. .NOT.ln_presatmco2 ) THEN |
---|
[3443] | 298 | IF(lwp) THEN ! control print |
---|
| 299 | WRITE(numout,*) ' Constant Atmospheric pCO2 value atcco2 =', atcco2 |
---|
| 300 | WRITE(numout,*) ' ' |
---|
| 301 | ENDIF |
---|
[7698] | 302 | !$OMP PARALLEL DO schedule(static) private(jj,ji) |
---|
| 303 | DO jj = 1, jpj |
---|
| 304 | DO ji = 1, jpi |
---|
| 305 | satmco2(ji,jj) = atcco2 ! Initialisation of atmospheric pco2 |
---|
| 306 | END DO |
---|
| 307 | END DO |
---|
[7646] | 308 | ELSEIF( ln_co2int .AND. .NOT.ln_presatmco2 ) THEN |
---|
[3443] | 309 | IF(lwp) THEN |
---|
| 310 | WRITE(numout,*) ' Atmospheric pCO2 value from file clname =', TRIM( clname ) |
---|
| 311 | WRITE(numout,*) ' Offset model-data start year nn_offset =', nn_offset |
---|
| 312 | WRITE(numout,*) ' ' |
---|
| 313 | ENDIF |
---|
| 314 | CALL ctl_opn( numco2, TRIM( clname) , 'OLD', 'FORMATTED', 'SEQUENTIAL', -1 , numout, lwp ) |
---|
| 315 | jm = 0 ! Count the number of record in co2 file |
---|
| 316 | DO |
---|
| 317 | READ(numco2,*,END=100) |
---|
| 318 | jm = jm + 1 |
---|
| 319 | END DO |
---|
| 320 | 100 nmaxrec = jm - 1 |
---|
| 321 | ALLOCATE( years (nmaxrec) ) ; years (:) = 0._wp |
---|
| 322 | ALLOCATE( atcco2h(nmaxrec) ) ; atcco2h(:) = 0._wp |
---|
| 323 | |
---|
| 324 | REWIND(numco2) |
---|
| 325 | DO jm = 1, nmaxrec ! get xCO2 data |
---|
| 326 | READ(numco2, *) years(jm), atcco2h(jm) |
---|
| 327 | IF(lwp) WRITE(numout, '(f6.0,f7.2)') years(jm), atcco2h(jm) |
---|
| 328 | END DO |
---|
| 329 | CLOSE(numco2) |
---|
[7646] | 330 | ELSEIF( .NOT.ln_co2int .AND. ln_presatmco2 ) THEN |
---|
| 331 | IF(lwp) THEN |
---|
| 332 | WRITE(numout,*) ' Spatialized Atmospheric pCO2 from an external file' |
---|
| 333 | WRITE(numout,*) ' ' |
---|
| 334 | ENDIF |
---|
| 335 | ELSE |
---|
| 336 | IF(lwp) THEN |
---|
| 337 | WRITE(numout,*) ' Spatialized Atmospheric pCO2 from an external file' |
---|
| 338 | WRITE(numout,*) ' ' |
---|
| 339 | ENDIF |
---|
[3443] | 340 | ENDIF |
---|
[7646] | 341 | |
---|
[3443] | 342 | ! |
---|
[7698] | 343 | !$OMP PARALLEL DO schedule(static) private(jj,ji) |
---|
| 344 | DO jj = 1, jpj |
---|
| 345 | DO ji = 1, jpi |
---|
| 346 | oce_co2(ji,jj) = 0._wp ! Initialization of Flux of Carbon |
---|
| 347 | END DO |
---|
| 348 | END DO |
---|
[4996] | 349 | t_oce_co2_flx = 0._wp |
---|
[3443] | 350 | t_atm_co2_flx = 0._wp |
---|
| 351 | ! |
---|
| 352 | CALL p4z_patm( nit000 ) |
---|
| 353 | ! |
---|
| 354 | END SUBROUTINE p4z_flx_init |
---|
| 355 | |
---|
| 356 | SUBROUTINE p4z_patm( kt ) |
---|
| 357 | |
---|
| 358 | !!---------------------------------------------------------------------- |
---|
| 359 | !! *** ROUTINE p4z_atm *** |
---|
| 360 | !! |
---|
| 361 | !! ** Purpose : Read and interpolate the external atmospheric sea-levl pressure |
---|
| 362 | !! ** Method : Read the files and interpolate the appropriate variables |
---|
| 363 | !! |
---|
| 364 | !!---------------------------------------------------------------------- |
---|
| 365 | !! * arguments |
---|
| 366 | INTEGER, INTENT( in ) :: kt ! ocean time step |
---|
[7698] | 367 | INTEGER :: jj, ji |
---|
[3443] | 368 | ! |
---|
| 369 | INTEGER :: ierr |
---|
[4147] | 370 | INTEGER :: ios ! Local integer output status for namelist read |
---|
[3443] | 371 | CHARACTER(len=100) :: cn_dir ! Root directory for location of ssr files |
---|
| 372 | TYPE(FLD_N) :: sn_patm ! informations about the fields to be read |
---|
[7646] | 373 | TYPE(FLD_N) :: sn_atmco2 ! informations about the fields to be read |
---|
[3443] | 374 | !! |
---|
[7646] | 375 | NAMELIST/nampisatm/ ln_presatm, ln_presatmco2, sn_patm, sn_atmco2, cn_dir |
---|
[3443] | 376 | |
---|
[4147] | 377 | ! ! ----------------------- ! |
---|
[3443] | 378 | IF( kt == nit000 ) THEN ! First call kt=nittrc000 ! |
---|
| 379 | |
---|
[4147] | 380 | REWIND( numnatp_ref ) ! Namelist nampisatm in reference namelist : Pisces atm. sea level pressure file |
---|
| 381 | READ ( numnatp_ref, nampisatm, IOSTAT = ios, ERR = 901) |
---|
| 382 | 901 IF( ios /= 0 ) CALL ctl_nam ( ios , 'nampisatm in reference namelist', lwp ) |
---|
| 383 | |
---|
| 384 | REWIND( numnatp_cfg ) ! Namelist nampisatm in configuration namelist : Pisces atm. sea level pressure file |
---|
| 385 | READ ( numnatp_cfg, nampisatm, IOSTAT = ios, ERR = 902 ) |
---|
| 386 | 902 IF( ios /= 0 ) CALL ctl_nam ( ios , 'nampisatm in configuration namelist', lwp ) |
---|
[4624] | 387 | IF(lwm) WRITE ( numonp, nampisatm ) |
---|
[3443] | 388 | ! |
---|
| 389 | ! |
---|
| 390 | IF(lwp) THEN !* control print |
---|
| 391 | WRITE(numout,*) |
---|
| 392 | WRITE(numout,*) ' Namelist nampisatm : Atmospheric Pressure as external forcing' |
---|
| 393 | WRITE(numout,*) ' constant atmopsheric pressure (F) or from a file (T) ln_presatm = ', ln_presatm |
---|
[7646] | 394 | WRITE(numout,*) ' spatial atmopsheric CO2 for flux calcs ln_presatmco2 = ', ln_presatmco2 |
---|
[3443] | 395 | WRITE(numout,*) |
---|
| 396 | ENDIF |
---|
| 397 | ! |
---|
| 398 | IF( ln_presatm ) THEN |
---|
| 399 | ALLOCATE( sf_patm(1), STAT=ierr ) !* allocate and fill sf_patm (forcing structure) with sn_patm |
---|
| 400 | IF( ierr > 0 ) CALL ctl_stop( 'STOP', 'p4z_flx: unable to allocate sf_patm structure' ) |
---|
| 401 | ! |
---|
| 402 | CALL fld_fill( sf_patm, (/ sn_patm /), cn_dir, 'p4z_flx', 'Atmospheric pressure ', 'nampisatm' ) |
---|
| 403 | ALLOCATE( sf_patm(1)%fnow(jpi,jpj,1) ) |
---|
| 404 | IF( sn_patm%ln_tint ) ALLOCATE( sf_patm(1)%fdta(jpi,jpj,1,2) ) |
---|
| 405 | ENDIF |
---|
| 406 | ! |
---|
[7646] | 407 | IF( ln_presatmco2 ) THEN |
---|
| 408 | ALLOCATE( sf_atmco2(1), STAT=ierr ) !* allocate and fill sf_atmco2 (forcing structure) with sn_atmco2 |
---|
| 409 | IF( ierr > 0 ) CALL ctl_stop( 'STOP', 'p4z_flx: unable to allocate sf_atmco2 structure' ) |
---|
| 410 | ! |
---|
| 411 | CALL fld_fill( sf_atmco2, (/ sn_atmco2 /), cn_dir, 'p4z_flx', 'Atmospheric co2 partial pressure ', 'nampisatm' ) |
---|
| 412 | ALLOCATE( sf_atmco2(1)%fnow(jpi,jpj,1) ) |
---|
| 413 | IF( sn_atmco2%ln_tint ) ALLOCATE( sf_atmco2(1)%fdta(jpi,jpj,1,2) ) |
---|
| 414 | ENDIF |
---|
| 415 | ! |
---|
[7698] | 416 | IF( .NOT.ln_presatm ) THEN |
---|
| 417 | !$OMP PARALLEL DO schedule(static) private(jj,ji) |
---|
| 418 | DO jj = 1, jpj |
---|
| 419 | DO ji = 1, jpi |
---|
| 420 | patm(ji,jj) = 1.e0 ! Initialize patm if no reading from a file |
---|
| 421 | END DO |
---|
| 422 | END DO |
---|
| 423 | ENDIF |
---|
[3443] | 424 | ! |
---|
| 425 | ENDIF |
---|
| 426 | ! |
---|
| 427 | IF( ln_presatm ) THEN |
---|
| 428 | CALL fld_read( kt, 1, sf_patm ) !* input Patm provided at kt + 1/2 |
---|
[7698] | 429 | !$OMP PARALLEL DO schedule(static) private(jj,ji) |
---|
| 430 | DO jj = 1, jpj |
---|
| 431 | DO ji = 1, jpi |
---|
| 432 | patm(ji,jj) = sf_patm(1)%fnow(ji,jj,1) ! atmospheric pressure |
---|
| 433 | END DO |
---|
| 434 | END DO |
---|
[3443] | 435 | ENDIF |
---|
| 436 | ! |
---|
[7646] | 437 | IF( ln_presatmco2 ) THEN |
---|
| 438 | CALL fld_read( kt, 1, sf_atmco2 ) !* input atmco2 provided at kt + 1/2 |
---|
[7698] | 439 | !$OMP PARALLEL DO schedule(static) private(jj,ji) |
---|
| 440 | DO jj = 1, jpj |
---|
| 441 | DO ji = 1, jpi |
---|
| 442 | satmco2(ji,jj) = sf_atmco2(1)%fnow(ji,jj,1) ! atmospheric pressure |
---|
| 443 | END DO |
---|
| 444 | END DO |
---|
[7646] | 445 | ELSE |
---|
[7698] | 446 | !$OMP PARALLEL DO schedule(static) private(jj,ji) |
---|
| 447 | DO jj = 1, jpj |
---|
| 448 | DO ji = 1, jpi |
---|
| 449 | satmco2(ji,jj) = atcco2 ! Initialize atmco2 if no reading from a file |
---|
| 450 | END DO |
---|
| 451 | END DO |
---|
[7646] | 452 | ENDIF |
---|
| 453 | ! |
---|
[3443] | 454 | END SUBROUTINE p4z_patm |
---|
| 455 | |
---|
[7646] | 456 | |
---|
[3443] | 457 | INTEGER FUNCTION p4z_flx_alloc() |
---|
| 458 | !!---------------------------------------------------------------------- |
---|
| 459 | !! *** ROUTINE p4z_flx_alloc *** |
---|
| 460 | !!---------------------------------------------------------------------- |
---|
[7646] | 461 | ALLOCATE( satmco2(jpi,jpj), patm(jpi,jpj), STAT=p4z_flx_alloc ) |
---|
[3443] | 462 | ! |
---|
| 463 | IF( p4z_flx_alloc /= 0 ) CALL ctl_warn('p4z_flx_alloc : failed to allocate arrays') |
---|
| 464 | ! |
---|
| 465 | END FUNCTION p4z_flx_alloc |
---|
| 466 | |
---|
| 467 | !!====================================================================== |
---|
[5656] | 468 | END MODULE p4zflx |
---|