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