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 | #if defined key_pisces |
---|
14 | !!---------------------------------------------------------------------- |
---|
15 | !! 'key_pisces' PISCES bio-model |
---|
16 | !!---------------------------------------------------------------------- |
---|
17 | !! p4z_flx : CALCULATES GAS EXCHANGE AND CHEMISTRY AT SEA SURFACE |
---|
18 | !! p4z_flx_init : Read the namelist |
---|
19 | !! p4z_patm : Read sfc atm pressure [atm] for each grid cell |
---|
20 | !!---------------------------------------------------------------------- |
---|
21 | USE oce_trc ! shared variables between ocean and passive tracers |
---|
22 | USE trc ! passive tracers common variables |
---|
23 | USE sms_pisces ! PISCES Source Minus Sink variables |
---|
24 | USE p4zche ! Chemical model |
---|
25 | USE prtctl_trc ! print control for debugging |
---|
26 | USE iom ! I/O manager |
---|
27 | USE fldread ! read input fields |
---|
28 | #if defined key_cpl_carbon_cycle |
---|
29 | USE sbc_oce, ONLY : atm_co2 ! atmospheric pCO2 |
---|
30 | #endif |
---|
31 | |
---|
32 | IMPLICIT NONE |
---|
33 | PRIVATE |
---|
34 | |
---|
35 | PUBLIC p4z_flx |
---|
36 | PUBLIC p4z_flx_init |
---|
37 | PUBLIC p4z_flx_alloc |
---|
38 | |
---|
39 | ! !!** Namelist nampisext ** |
---|
40 | REAL(wp) :: atcco2 !: pre-industrial atmospheric [co2] (ppm) |
---|
41 | LOGICAL :: ln_co2int !: flag to read in a file and interpolate atmospheric pco2 or not |
---|
42 | CHARACTER(len=34) :: clname !: filename of pco2 values |
---|
43 | INTEGER :: nn_offset !: Offset model-data start year (default = 0) |
---|
44 | #if defined key_gas |
---|
45 | REAL(wp) :: atccos |
---|
46 | REAL(wp) :: atcn2o |
---|
47 | #endif |
---|
48 | |
---|
49 | !! Variables related to reading atmospheric CO2 time history |
---|
50 | REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:) :: atcco2h, years |
---|
51 | INTEGER :: nmaxrec, numco2 |
---|
52 | |
---|
53 | ! !!* nampisatm namelist (Atmospheric PRessure) * |
---|
54 | LOGICAL, PUBLIC :: ln_presatm !: ref. pressure: global mean Patm (F) or a constant (F) |
---|
55 | |
---|
56 | REAL(wp) , ALLOCATABLE, SAVE, DIMENSION(:,:) :: patm ! atmospheric pressure at kt [N/m2] |
---|
57 | TYPE(FLD), ALLOCATABLE, DIMENSION(:) :: sf_patm ! structure of input fields (file informations, fields read) |
---|
58 | |
---|
59 | |
---|
60 | REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: oce_co2 !: ocean carbon flux |
---|
61 | REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:) :: satmco2 !: atmospheric pco2 |
---|
62 | |
---|
63 | REAL(wp) :: xconv = 0.01_wp / 3600._wp !: coefficients for conversion |
---|
64 | |
---|
65 | !!* Substitution |
---|
66 | # include "top_substitute.h90" |
---|
67 | !!---------------------------------------------------------------------- |
---|
68 | !! NEMO/TOP 3.3 , NEMO Consortium (2010) |
---|
69 | !! $Id$ |
---|
70 | !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) |
---|
71 | !!---------------------------------------------------------------------- |
---|
72 | CONTAINS |
---|
73 | |
---|
74 | SUBROUTINE p4z_flx ( kt, knt ) |
---|
75 | !!--------------------------------------------------------------------- |
---|
76 | !! *** ROUTINE p4z_flx *** |
---|
77 | !! |
---|
78 | !! ** Purpose : CALCULATES GAS EXCHANGE AND CHEMISTRY AT SEA SURFACE |
---|
79 | !! |
---|
80 | !! ** Method : |
---|
81 | !! - Include total atm P correction via Esbensen & Kushnir (1981) |
---|
82 | !! - Pressure correction NOT done for key_cpl_carbon_cycle |
---|
83 | !! - Remove Wanninkhof chemical enhancement; |
---|
84 | !! - Add option for time-interpolation of atcco2.txt |
---|
85 | !!--------------------------------------------------------------------- |
---|
86 | ! |
---|
87 | INTEGER, INTENT(in) :: kt, knt ! |
---|
88 | ! |
---|
89 | INTEGER :: ji, jj, jm, iind, iindm1 |
---|
90 | REAL(wp) :: ztc, ztc2, ztc3, ztc4, zws, zkgwan |
---|
91 | REAL(wp) :: zfld, zflu, zfld16, zflu16, zfact |
---|
92 | REAL(wp) :: zvapsw, zsal, zfco2, zxc2, xCO2approx, ztkel, zfugcoeff |
---|
93 | REAL(wp) :: zph, zah2, zbot, zdic, zalk, zsch_o2, zalka, zsch_co2 |
---|
94 | REAL(wp) :: zyr_dec, zdco2dt |
---|
95 | CHARACTER (len=25) :: charout |
---|
96 | REAL(wp), POINTER, DIMENSION(:,:) :: zkgco2, zkgo2, zh2co3, zoflx, zw2d, zpco2atm |
---|
97 | REAL(wp) :: zsch_dms, zfludms,zflddms |
---|
98 | REAL(wp) :: zfldco, zfluco, zsch_co, zkin_vis, zD |
---|
99 | REAL(wp) :: zfldcos, zflucos |
---|
100 | REAL(wp) :: zfldisp, zfluisp, zsch_isp, zsch_cos |
---|
101 | REAL(wp) :: zsch_n2o, zfldn2o, zflun2o |
---|
102 | REAL(wp), POINTER, DIMENSION(:,:) :: zkgdms, zdmsflx |
---|
103 | REAL(wp), POINTER, DIMENSION(:,:) :: zkgco, zcoflx, zkgisp, zispflx |
---|
104 | REAL(wp), POINTER, DIMENSION(:,:) :: zH_cos, zkgcos, zcosflx |
---|
105 | REAL(wp), POINTER, DIMENSION(:,:) :: zkgn2o, znflx |
---|
106 | |
---|
107 | !!--------------------------------------------------------------------- |
---|
108 | ! |
---|
109 | IF( nn_timing == 1 ) CALL timing_start('p4z_flx') |
---|
110 | ! |
---|
111 | CALL wrk_alloc( jpi, jpj, zkgco2, zkgo2, zh2co3, zoflx, zpco2atm ) |
---|
112 | IF( lk_gas ) THEN |
---|
113 | CALL wrk_alloc( jpi, jpj, zkgco, zcoflx, zkgisp, zispflx ) |
---|
114 | CALL wrk_alloc( jpi, jpj, zcosflx, zkgcos, zH_cos ) |
---|
115 | CALL wrk_alloc( jpi, jpj, zkgdms, zdmsflx ) |
---|
116 | CALL wrk_alloc( jpi, jpj, zkgn2o, znflx ) |
---|
117 | ENDIF |
---|
118 | ! |
---|
119 | |
---|
120 | ! SURFACE CHEMISTRY (PCO2 AND [H+] IN |
---|
121 | ! SURFACE LAYER); THE RESULT OF THIS CALCULATION |
---|
122 | ! IS USED TO COMPUTE AIR-SEA FLUX OF CO2 |
---|
123 | |
---|
124 | IF( kt /= nit000 .AND. knt == 1 ) CALL p4z_patm( kt ) ! Get sea-level pressure (E&K [1981] climatology) for use in flux calcs |
---|
125 | |
---|
126 | IF( ln_co2int ) THEN |
---|
127 | ! Linear temporal interpolation of atmospheric pco2. atcco2.txt has annual values. |
---|
128 | ! Caveats: First column of .txt must be in years, decimal years preferably. |
---|
129 | ! For nn_offset, if your model year is iyy, nn_offset=(years(1)-iyy) |
---|
130 | ! then the first atmospheric CO2 record read is at years(1) |
---|
131 | zyr_dec = REAL( nyear + nn_offset, wp ) + REAL( nday_year, wp ) / REAL( nyear_len(1), wp ) |
---|
132 | jm = 1 |
---|
133 | DO WHILE( jm <= nmaxrec .AND. years(jm) < zyr_dec ) ; jm = jm + 1 ; END DO |
---|
134 | iind = jm ; iindm1 = jm - 1 |
---|
135 | zdco2dt = ( atcco2h(iind) - atcco2h(iindm1) ) / ( years(iind) - years(iindm1) + rtrn ) |
---|
136 | atcco2 = zdco2dt * ( zyr_dec - years(iindm1) ) + atcco2h(iindm1) |
---|
137 | satmco2(:,:) = atcco2 |
---|
138 | ENDIF |
---|
139 | |
---|
140 | #if defined key_cpl_carbon_cycle |
---|
141 | satmco2(:,:) = atm_co2(:,:) |
---|
142 | #endif |
---|
143 | |
---|
144 | DO jm = 1, 10 |
---|
145 | !CDIR NOVERRCHK |
---|
146 | DO jj = 1, jpj |
---|
147 | !CDIR NOVERRCHK |
---|
148 | DO ji = 1, jpi |
---|
149 | |
---|
150 | ! DUMMY VARIABLES FOR DIC, H+, AND BORATE |
---|
151 | zbot = borat(ji,jj,1) |
---|
152 | zfact = rhop(ji,jj,1) / 1000. + rtrn |
---|
153 | zdic = trb(ji,jj,1,jpdic) / zfact |
---|
154 | zph = MAX( hi(ji,jj,1), 1.e-10 ) / zfact |
---|
155 | zalka = trb(ji,jj,1,jptal) / zfact |
---|
156 | |
---|
157 | ! CALCULATE [ALK]([CO3--], [HCO3-]) |
---|
158 | zalk = zalka - ( akw3(ji,jj,1) / zph - zph / aphscale(ji,jj,1) & |
---|
159 | & + zbot / ( 1.+ zph / akb3(ji,jj,1) ) ) |
---|
160 | |
---|
161 | ! CALCULATE [H+] AND [H2CO3] |
---|
162 | zah2 = SQRT( (zdic-zalk)**2 + 4.* ( zalk * ak23(ji,jj,1) & |
---|
163 | & / ak13(ji,jj,1) ) * ( 2.* zdic - zalk ) ) |
---|
164 | zah2 = 0.5 * ak13(ji,jj,1) / zalk * ( ( zdic - zalk ) + zah2 ) |
---|
165 | zh2co3(ji,jj) = ( 2.* zdic - zalk ) / ( 2.+ ak13(ji,jj,1) / zah2 ) * zfact |
---|
166 | hi(ji,jj,1) = zah2 * zfact |
---|
167 | END DO |
---|
168 | END DO |
---|
169 | END DO |
---|
170 | |
---|
171 | |
---|
172 | ! -------------- |
---|
173 | ! COMPUTE FLUXES |
---|
174 | ! -------------- |
---|
175 | |
---|
176 | ! FIRST COMPUTE GAS EXCHANGE COEFFICIENTS |
---|
177 | ! ------------------------------------------- |
---|
178 | |
---|
179 | !CDIR NOVERRCHK |
---|
180 | DO jj = 1, jpj |
---|
181 | !CDIR NOVERRCHK |
---|
182 | DO ji = 1, jpi |
---|
183 | ztc = MIN( 35., tsn(ji,jj,1,jp_tem) ) |
---|
184 | ztc2 = ztc * ztc |
---|
185 | ztc3 = ztc * ztc2 |
---|
186 | ztc4 = ztc2 * ztc2 |
---|
187 | ! Compute the schmidt Number both O2 and CO2 |
---|
188 | zsch_co2 = 2116.8 - 136.25 * ztc + 4.7353 * ztc2 - 0.092307 * ztc3 + 0.0007555 * ztc4 |
---|
189 | zsch_o2 = 1920.4 - 135.6 * ztc + 5.2122 * ztc2 - 0.109390 * ztc3 + 0.0009377 * ztc4 |
---|
190 | ! wind speed |
---|
191 | zws = wndm(ji,jj) * wndm(ji,jj) |
---|
192 | ! Compute the piston velocity for O2 and CO2 |
---|
193 | zkgwan = 0.251 * zws |
---|
194 | zkgwan = zkgwan * xconv * ( 1.- fr_i(ji,jj) ) * tmask(ji,jj,1) |
---|
195 | # if defined key_degrad |
---|
196 | zkgwan = zkgwan * facvol(ji,jj,1) |
---|
197 | #endif |
---|
198 | ! compute gas exchange for CO2 and O2 |
---|
199 | zkgco2(ji,jj) = zkgwan * SQRT( 660./ zsch_co2 ) |
---|
200 | zkgo2 (ji,jj) = zkgwan * SQRT( 660./ zsch_o2 ) |
---|
201 | END DO |
---|
202 | END DO |
---|
203 | |
---|
204 | IF( lk_gas ) THEN |
---|
205 | !CDIR NOVERRCHK |
---|
206 | DO jj = 1, jpj |
---|
207 | !CDIR NOVERRCHK |
---|
208 | DO ji = 1, jpi |
---|
209 | ztc = MIN( 35., tsn(ji,jj,1,jp_tem) ) |
---|
210 | ztc2 = ztc * ztc |
---|
211 | ztc3 = ztc * ztc2 |
---|
212 | |
---|
213 | zsch_dms = 3628.5 - 234.58 * ztc + 7.8601 * ztc2 - 0.1148 * ztc3 |
---|
214 | !zsch_co = 1889.126 - 127.2150 * ztc + 4.499079 * ztc2 - |
---|
215 | !0.08973561 * ztc3 |
---|
216 | zsch_co = 2124 - 140.07 * ztc + 4.3825 * ztc2 - 0.0553 * ztc3 |
---|
217 | ! pb with the above equation - this one comes from Zafiriou 2008 see w/ B. Bonsang |
---|
218 | zsch_isp = 3546.535 - 217.2178 * ztc + 5.732073 * ztc2 - 0.06035193 * ztc3 |
---|
219 | !compute Schmidt number for cos, taken from Ulshofer |
---|
220 | zkin_vis = (1.792747 - 0.05126103 * ztc + 0.0005918645 * ztc2 ) * 1.E-6 ! m2/s |
---|
221 | zD = ( 10**( -1010. / ( ztc + 273.15 ) - 1.3246) ) * 1.E-4 ! cm2/s to m2/s |
---|
222 | zsch_cos = zkin_vis / zD |
---|
223 | ! wind speed |
---|
224 | zws = wndm(ji,jj) * wndm(ji,jj) |
---|
225 | ! Compute the piston velocity for O2 and CO2 |
---|
226 | zkgwan = 0.251 * zws |
---|
227 | zkgwan = zkgwan * xconv * ( 1.- fr_i(ji,jj) ) * tmask(ji,jj,1) |
---|
228 | # if defined key_degrad |
---|
229 | zkgwan = zkgwan * facvol(ji,jj,1) |
---|
230 | #endif |
---|
231 | ! compute gas exchange for DMS, CO, Isoprene, COS and N2O |
---|
232 | zkgdms(ji,jj) = zkgwan * SQRT( 660./ zsch_dms ) |
---|
233 | zkgco (ji,jj) = zkgwan * SQRT( 660./ zsch_co ) |
---|
234 | zkgisp(ji,jj) = zkgwan * SQRT( 660./ zsch_isp) |
---|
235 | zkgcos(ji,jj) = zkgwan * SQRT( 660./ zsch_cos) |
---|
236 | zH_cos(ji,jj) = EXP( 12.722 - 3496./ ( ztc + 273.15 ) ) + rtrn |
---|
237 | ! |
---|
238 | zsch_n2o = 2301.1 - 151.1 * ztc + 4.7364 * ztc2 - 0.059431 * ztc3 |
---|
239 | zkgn2o(ji,jj) = zkgwan * SQRT( 660./ zsch_n2o ) |
---|
240 | END DO |
---|
241 | END DO |
---|
242 | ! |
---|
243 | ENDIF |
---|
244 | |
---|
245 | DO jj = 1, jpj |
---|
246 | DO ji = 1, jpi |
---|
247 | ztkel = tsn(ji,jj,1,jp_tem) + 273.15 |
---|
248 | zsal = tsn(ji,jj,1,jp_sal) + ( 1.- tmask(ji,jj,1) ) * 35. |
---|
249 | zvapsw = EXP(24.4543 - 67.4509*(100.0/ztkel) - 4.8489*LOG(ztkel/100) - 0.000544*zsal) |
---|
250 | zpco2atm(ji,jj) = satmco2(ji,jj) * ( patm(ji,jj) - zvapsw ) |
---|
251 | zxc2 = (1.0 - zpco2atm(ji,jj) * 1E-6 )**2 |
---|
252 | zfugcoeff = EXP(patm(ji,jj) * (chemc(ji,jj,2) + 2.0 * zxc2 * chemc(ji,jj,3) ) & |
---|
253 | & / (82.05736 * ztkel)) |
---|
254 | zfco2 = zpco2atm(ji,jj) * zfugcoeff |
---|
255 | |
---|
256 | ! Compute CO2 flux for the sea and air |
---|
257 | zfld = zfco2 * chemc(ji,jj,1) * zkgco2(ji,jj) ! (mol/L) * (m/s) |
---|
258 | zflu = zh2co3(ji,jj) * zkgco2(ji,jj) ! (mol/L) (m/s) ? |
---|
259 | oce_co2(ji,jj) = ( zfld - zflu ) * rfact2 * e1e2t(ji,jj) * tmask(ji,jj,1) * 1000. |
---|
260 | ! compute the trend |
---|
261 | tra(ji,jj,1,jpdic) = tra(ji,jj,1,jpdic) + ( zfld - zflu ) * rfact2 / fse3t(ji,jj,1) * tmask(ji,jj,1) |
---|
262 | |
---|
263 | ! Compute O2 flux |
---|
264 | zfld16 = patm(ji,jj) * chemo2(ji,jj,1) * zkgo2(ji,jj) ! (mol/L) * (m/s) |
---|
265 | zflu16 = trb(ji,jj,1,jpoxy) * zkgo2(ji,jj) |
---|
266 | zoflx(ji,jj) = ( zfld16 - zflu16 ) * tmask(ji,jj,1) |
---|
267 | tra(ji,jj,1,jpoxy) = tra(ji,jj,1,jpoxy) + zoflx(ji,jj) * rfact2 / fse3t(ji,jj,1) |
---|
268 | END DO |
---|
269 | END DO |
---|
270 | |
---|
271 | |
---|
272 | IF( lk_gas ) THEN |
---|
273 | DO jj = 1, jpj |
---|
274 | DO ji = 1, jpi |
---|
275 | ! Compute DMS flux |
---|
276 | zfludms = trb(ji,jj,1,jpdms) * tmask(ji,jj,1) * zkgdms(ji,jj) |
---|
277 | zdmsflx(ji,jj) = -1. * zfludms |
---|
278 | tra(ji,jj,1,jpdms) = tra(ji,jj,1,jpdms) - ( zfludms ) / fse3t(ji,jj,1) |
---|
279 | |
---|
280 | ! Compute CO flux |
---|
281 | zfldco = atco * patm(ji,jj) * chemcos(ji,jj,1) *tmask(ji,jj,1) * zkgco(ji,jj) |
---|
282 | zfluco = trb(ji,jj,1,jpco) * tmask(ji,jj,1) * zkgco(ji,jj) |
---|
283 | zcoflx(ji,jj) = zfldco - zfluco |
---|
284 | tra(ji,jj,1,jpco) = tra(ji,jj,1,jpco) + zcoflx(ji,jj) / fse3t(ji,jj,1) |
---|
285 | |
---|
286 | ! Compute isoprene flux |
---|
287 | zfldisp = atisp * patm(ji,jj) * chemcos(ji,jj,2) *tmask(ji,jj,1) * zkgisp(ji,jj) ! (mol/L) * (m/s) |
---|
288 | zfluisp = trb(ji,jj,1,jpisp) * tmask(ji,jj,1) * zkgisp(ji,jj) |
---|
289 | zispflx(ji,jj) = zfldisp - zfluisp |
---|
290 | tra(ji,jj,1,jpisp) = tra(ji,jj,1,jpisp) + zispflx(ji,jj) / fse3t(ji,jj,1) |
---|
291 | |
---|
292 | ! Compute COS flux |
---|
293 | zfldcos = atccos * patm(ji,jj) * chemcos(ji,jj,3) *tmask(ji,jj,1) *zkgcos(ji,jj) ! (mol/L) * (m/s) |
---|
294 | zflucos = trb(ji,jj,1,jpcos) * tmask(ji,jj,1) * zkgcos(ji,jj) |
---|
295 | zcosflx(ji,jj) = zfldcos - zflucos |
---|
296 | tra(ji,jj,1,jpcos) = tra(ji,jj,1,jpcos) + zcosflx(ji,jj) / fse3t(ji,jj,1) |
---|
297 | |
---|
298 | ! Compute N2O flux |
---|
299 | zfldn2o = atcn2o * patm(ji,jj) * chemn2o(ji,jj) *tmask(ji,jj,1) * zkgn2o(ji,jj) |
---|
300 | zflun2o = trb(ji,jj,1,jpn2o) * tmask(ji,jj,1) * zkgn2o(ji,jj) |
---|
301 | znflx(ji,jj) = zfldn2o - zflun2o |
---|
302 | tra(ji,jj,1,jpn2o) = tra(ji,jj,1,jpn2o) + znflx(ji,jj) / fse3t(ji,jj,1) |
---|
303 | END DO |
---|
304 | END DO |
---|
305 | ENDIF |
---|
306 | |
---|
307 | |
---|
308 | t_oce_co2_flx = glob_sum( oce_co2(:,:) ) ! Total Flux of Carbon |
---|
309 | t_oce_co2_flx_cum = t_oce_co2_flx_cum + t_oce_co2_flx ! Cumulative Total Flux of Carbon |
---|
310 | ! t_atm_co2_flx = glob_sum( satmco2(:,:) * e1e2t(:,:) ) ! Total atmospheric pCO2 |
---|
311 | t_atm_co2_flx = atcco2 ! Total atmospheric pCO2 |
---|
312 | |
---|
313 | IF(ln_ctl) THEN ! print mean trends (used for debugging) |
---|
314 | WRITE(charout, FMT="('flx ')") |
---|
315 | CALL prt_ctl_trc_info(charout) |
---|
316 | CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm) |
---|
317 | ENDIF |
---|
318 | |
---|
319 | IF( lk_iomput .AND. knt == nrdttrc ) THEN |
---|
320 | CALL wrk_alloc( jpi, jpj, zw2d ) |
---|
321 | IF( iom_use( "Cflx" ) ) THEN |
---|
322 | zw2d(:,:) = oce_co2(:,:) / e1e2t(:,:) * rfact2r |
---|
323 | CALL iom_put( "Cflx" , zw2d ) |
---|
324 | ENDIF |
---|
325 | IF( iom_use( "Oflx" ) ) THEN |
---|
326 | zw2d(:,:) = zoflx(:,:) * 1000 * tmask(:,:,1) |
---|
327 | CALL iom_put( "Oflx" , zw2d ) |
---|
328 | ENDIF |
---|
329 | IF( iom_use( "Kg" ) ) THEN |
---|
330 | zw2d(:,:) = zkgco2(:,:) * tmask(:,:,1) |
---|
331 | CALL iom_put( "Kg" , zw2d ) |
---|
332 | ENDIF |
---|
333 | IF( iom_use( "Dpco2" ) ) THEN |
---|
334 | zw2d(:,:) = ( zpco2atm(:,:) - zh2co3(:,:) / ( chemc(:,:,1) + rtrn ) ) * tmask(:,:,1) |
---|
335 | CALL iom_put( "Dpco2" , zw2d ) |
---|
336 | ENDIF |
---|
337 | IF( iom_use( "Dpo2" ) ) THEN |
---|
338 | zw2d(:,:) = ( atcox * patm(:,:) - atcox * trb(:,:,1,jpoxy) / ( chemo2(:,:,1) + rtrn ) ) * tmask(:,:,1) |
---|
339 | CALL iom_put( "Dpo2" , zw2d ) |
---|
340 | ENDIF |
---|
341 | IF( iom_use( "tcflx" ) ) CALL iom_put( "tcflx" , t_oce_co2_flx * rfact2r ) ! molC/s |
---|
342 | CALL iom_put( "tcflxcum" , t_oce_co2_flx_cum ) ! molC |
---|
343 | ! |
---|
344 | IF (lk_gas) THEN |
---|
345 | IF ( iom_use( "DMSflx" ) ) THEN |
---|
346 | zw2d(:,:) = zdmsflx(:,:) * 1000 * tmask(:,:,1) |
---|
347 | CALL iom_put( "DMSflx" , zw2d ) |
---|
348 | ENDIF |
---|
349 | IF ( iom_use( "COflx" ) ) THEN |
---|
350 | zw2d(:,:) = zcoflx(:,:) * 1000 * tmask(:,:,1) |
---|
351 | CALL iom_put( "COflx" , zw2d ) |
---|
352 | ENDIF |
---|
353 | IF ( iom_use( "ISPflx" ) ) THEN |
---|
354 | zw2d(:,:) = zispflx(:,:) * 1000 * tmask(:,:,1) |
---|
355 | CALL iom_put( "ISPflx" , zw2d ) |
---|
356 | ENDIF |
---|
357 | IF ( iom_use( "COSflx" ) ) THEN |
---|
358 | zw2d(:,:) = zcosflx(:,:) * 1000 * tmask(:,:,1) |
---|
359 | CALL iom_put( "COSflx" , zw2d ) |
---|
360 | ENDIF |
---|
361 | IF ( iom_use( "H_cos" ) ) THEN |
---|
362 | zw2d(:,:) = zH_cos(:,:) * tmask(:,:,1) |
---|
363 | CALL iom_put( "H_cos" , zw2d ) |
---|
364 | ENDIF |
---|
365 | IF ( iom_use( "N2Oflx" ) ) THEN |
---|
366 | zw2d(:,:) = znflx(:,:) * 1000 * tmask(:,:,1) |
---|
367 | CALL iom_put( "N2Oflx" , zw2d ) |
---|
368 | ENDIF |
---|
369 | ENDIF |
---|
370 | |
---|
371 | CALL wrk_dealloc( jpi, jpj, zw2d ) |
---|
372 | ELSE |
---|
373 | IF( ln_diatrc ) THEN |
---|
374 | trc2d(:,:,jp_pcs0_2d ) = oce_co2(:,:) / e1e2t(:,:) * rfact2r |
---|
375 | trc2d(:,:,jp_pcs0_2d + 1) = zoflx(:,:) * 1000 * tmask(:,:,1) |
---|
376 | trc2d(:,:,jp_pcs0_2d + 2) = zkgco2(:,:) * tmask(:,:,1) |
---|
377 | trc2d(:,:,jp_pcs0_2d + 3) = ( zpco2atm(:,:) - zh2co3(:,:) / ( chemc(:,:,1) + rtrn ) ) * tmask(:,:,1) |
---|
378 | ENDIF |
---|
379 | ENDIF |
---|
380 | ! |
---|
381 | CALL wrk_dealloc( jpi, jpj, zkgco2, zkgo2, zh2co3, zoflx, zpco2atm ) |
---|
382 | ! |
---|
383 | IF( nn_timing == 1 ) CALL timing_stop('p4z_flx') |
---|
384 | ! |
---|
385 | END SUBROUTINE p4z_flx |
---|
386 | |
---|
387 | |
---|
388 | SUBROUTINE p4z_flx_init |
---|
389 | !!---------------------------------------------------------------------- |
---|
390 | !! *** ROUTINE p4z_flx_init *** |
---|
391 | !! |
---|
392 | !! ** Purpose : Initialization of atmospheric conditions |
---|
393 | !! |
---|
394 | !! ** Method : Read the nampisext namelist and check the parameters |
---|
395 | !! called at the first timestep (nittrc000) |
---|
396 | !! ** input : Namelist nampisext |
---|
397 | !!---------------------------------------------------------------------- |
---|
398 | NAMELIST/nampisext/ln_co2int, atcco2, clname, & |
---|
399 | #ifdef key_gas |
---|
400 | & atccos, atcn2o, & |
---|
401 | #endif |
---|
402 | & nn_offset |
---|
403 | INTEGER :: jm |
---|
404 | INTEGER :: ios ! Local integer output status for namelist read |
---|
405 | !!---------------------------------------------------------------------- |
---|
406 | ! |
---|
407 | |
---|
408 | REWIND( numnatp_ref ) ! Namelist nampisext in reference namelist : Pisces atm. conditions |
---|
409 | READ ( numnatp_ref, nampisext, IOSTAT = ios, ERR = 901) |
---|
410 | 901 IF( ios /= 0 ) CALL ctl_nam ( ios , 'nampisext in reference namelist', lwp ) |
---|
411 | |
---|
412 | REWIND( numnatp_cfg ) ! Namelist nampisext in configuration namelist : Pisces atm. conditions |
---|
413 | READ ( numnatp_cfg, nampisext, IOSTAT = ios, ERR = 902 ) |
---|
414 | 902 IF( ios /= 0 ) CALL ctl_nam ( ios , 'nampisext in configuration namelist', lwp ) |
---|
415 | IF(lwm) WRITE ( numonp, nampisext ) |
---|
416 | ! |
---|
417 | IF(lwp) THEN ! control print |
---|
418 | WRITE(numout,*) ' ' |
---|
419 | WRITE(numout,*) ' Namelist parameters for air-sea exchange, nampisext' |
---|
420 | WRITE(numout,*) ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~' |
---|
421 | WRITE(numout,*) ' Choice for reading in the atm pCO2 file or constant value, ln_co2int =', ln_co2int |
---|
422 | WRITE(numout,*) ' ' |
---|
423 | ENDIF |
---|
424 | IF( .NOT.ln_co2int ) THEN |
---|
425 | IF(lwp) THEN ! control print |
---|
426 | WRITE(numout,*) ' Constant Atmospheric pCO2 value atcco2 =', atcco2 |
---|
427 | WRITE(numout,*) ' ' |
---|
428 | ENDIF |
---|
429 | satmco2(:,:) = atcco2 ! Initialisation of atmospheric pco2 |
---|
430 | ELSE |
---|
431 | IF(lwp) THEN |
---|
432 | WRITE(numout,*) ' Atmospheric pCO2 value from file clname =', TRIM( clname ) |
---|
433 | WRITE(numout,*) ' Offset model-data start year nn_offset =', nn_offset |
---|
434 | WRITE(numout,*) ' ' |
---|
435 | ENDIF |
---|
436 | CALL ctl_opn( numco2, TRIM( clname) , 'OLD', 'FORMATTED', 'SEQUENTIAL', -1 , numout, lwp ) |
---|
437 | jm = 0 ! Count the number of record in co2 file |
---|
438 | DO |
---|
439 | READ(numco2,*,END=100) |
---|
440 | jm = jm + 1 |
---|
441 | END DO |
---|
442 | 100 nmaxrec = jm - 1 |
---|
443 | ALLOCATE( years (nmaxrec) ) ; years (:) = 0._wp |
---|
444 | ALLOCATE( atcco2h(nmaxrec) ) ; atcco2h(:) = 0._wp |
---|
445 | |
---|
446 | REWIND(numco2) |
---|
447 | DO jm = 1, nmaxrec ! get xCO2 data |
---|
448 | READ(numco2, *) years(jm), atcco2h(jm) |
---|
449 | IF(lwp) WRITE(numout, '(f6.0,f7.2)') years(jm), atcco2h(jm) |
---|
450 | END DO |
---|
451 | CLOSE(numco2) |
---|
452 | ENDIF |
---|
453 | ! |
---|
454 | oce_co2(:,:) = 0._wp ! Initialization of Flux of Carbon |
---|
455 | t_oce_co2_flx = 0._wp |
---|
456 | t_atm_co2_flx = 0._wp |
---|
457 | ! |
---|
458 | CALL p4z_patm( nit000 ) |
---|
459 | ! |
---|
460 | END SUBROUTINE p4z_flx_init |
---|
461 | |
---|
462 | SUBROUTINE p4z_patm( kt ) |
---|
463 | |
---|
464 | !!---------------------------------------------------------------------- |
---|
465 | !! *** ROUTINE p4z_atm *** |
---|
466 | !! |
---|
467 | !! ** Purpose : Read and interpolate the external atmospheric sea-levl pressure |
---|
468 | !! ** Method : Read the files and interpolate the appropriate variables |
---|
469 | !! |
---|
470 | !!---------------------------------------------------------------------- |
---|
471 | !! * arguments |
---|
472 | INTEGER, INTENT( in ) :: kt ! ocean time step |
---|
473 | ! |
---|
474 | INTEGER :: ierr |
---|
475 | INTEGER :: ios ! Local integer output status for namelist read |
---|
476 | CHARACTER(len=100) :: cn_dir ! Root directory for location of ssr files |
---|
477 | TYPE(FLD_N) :: sn_patm ! informations about the fields to be read |
---|
478 | !! |
---|
479 | NAMELIST/nampisatm/ ln_presatm, sn_patm, cn_dir |
---|
480 | |
---|
481 | ! ! ----------------------- ! |
---|
482 | IF( kt == nit000 ) THEN ! First call kt=nittrc000 ! |
---|
483 | |
---|
484 | REWIND( numnatp_ref ) ! Namelist nampisatm in reference namelist : Pisces atm. sea level pressure file |
---|
485 | READ ( numnatp_ref, nampisatm, IOSTAT = ios, ERR = 901) |
---|
486 | 901 IF( ios /= 0 ) CALL ctl_nam ( ios , 'nampisatm in reference namelist', lwp ) |
---|
487 | |
---|
488 | REWIND( numnatp_cfg ) ! Namelist nampisatm in configuration namelist : Pisces atm. sea level pressure file |
---|
489 | READ ( numnatp_cfg, nampisatm, IOSTAT = ios, ERR = 902 ) |
---|
490 | 902 IF( ios /= 0 ) CALL ctl_nam ( ios , 'nampisatm in configuration namelist', lwp ) |
---|
491 | IF(lwm) WRITE ( numonp, nampisatm ) |
---|
492 | ! |
---|
493 | ! |
---|
494 | IF(lwp) THEN !* control print |
---|
495 | WRITE(numout,*) |
---|
496 | WRITE(numout,*) ' Namelist nampisatm : Atmospheric Pressure as external forcing' |
---|
497 | WRITE(numout,*) ' constant atmopsheric pressure (F) or from a file (T) ln_presatm = ', ln_presatm |
---|
498 | WRITE(numout,*) |
---|
499 | ENDIF |
---|
500 | ! |
---|
501 | IF( ln_presatm ) THEN |
---|
502 | ALLOCATE( sf_patm(1), STAT=ierr ) !* allocate and fill sf_patm (forcing structure) with sn_patm |
---|
503 | IF( ierr > 0 ) CALL ctl_stop( 'STOP', 'p4z_flx: unable to allocate sf_patm structure' ) |
---|
504 | ! |
---|
505 | CALL fld_fill( sf_patm, (/ sn_patm /), cn_dir, 'p4z_flx', 'Atmospheric pressure ', 'nampisatm' ) |
---|
506 | ALLOCATE( sf_patm(1)%fnow(jpi,jpj,1) ) |
---|
507 | IF( sn_patm%ln_tint ) ALLOCATE( sf_patm(1)%fdta(jpi,jpj,1,2) ) |
---|
508 | ENDIF |
---|
509 | ! |
---|
510 | IF( .NOT.ln_presatm ) patm(:,:) = 1.e0 ! Initialize patm if no reading from a file |
---|
511 | ! |
---|
512 | ENDIF |
---|
513 | ! |
---|
514 | IF( ln_presatm ) THEN |
---|
515 | CALL fld_read( kt, 1, sf_patm ) !* input Patm provided at kt + 1/2 |
---|
516 | patm(:,:) = sf_patm(1)%fnow(:,:,1) ! atmospheric pressure |
---|
517 | ENDIF |
---|
518 | ! |
---|
519 | END SUBROUTINE p4z_patm |
---|
520 | |
---|
521 | INTEGER FUNCTION p4z_flx_alloc() |
---|
522 | !!---------------------------------------------------------------------- |
---|
523 | !! *** ROUTINE p4z_flx_alloc *** |
---|
524 | !!---------------------------------------------------------------------- |
---|
525 | ALLOCATE( oce_co2(jpi,jpj), satmco2(jpi,jpj), patm(jpi,jpj), STAT=p4z_flx_alloc ) |
---|
526 | ! |
---|
527 | IF( p4z_flx_alloc /= 0 ) CALL ctl_warn('p4z_flx_alloc : failed to allocate arrays') |
---|
528 | ! |
---|
529 | END FUNCTION p4z_flx_alloc |
---|
530 | |
---|
531 | #else |
---|
532 | !!====================================================================== |
---|
533 | !! Dummy module : No PISCES bio-model |
---|
534 | !!====================================================================== |
---|
535 | CONTAINS |
---|
536 | SUBROUTINE p4z_flx( kt ) ! Empty routine |
---|
537 | INTEGER, INTENT( in ) :: kt |
---|
538 | WRITE(*,*) 'p4z_flx: You should not have seen this print! error?', kt |
---|
539 | END SUBROUTINE p4z_flx |
---|
540 | #endif |
---|
541 | |
---|
542 | !!====================================================================== |
---|
543 | END MODULE p4zflx |
---|