New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
p4zflx.F90 in branches/DEV_r1879_FCM/NEMOGCM/NEMO/TOP_SRC/PISCES – NEMO

source: branches/DEV_r1879_FCM/NEMOGCM/NEMO/TOP_SRC/PISCES/p4zflx.F90 @ 2013

Last change on this file since 2013 was 2013, checked in by smasson, 14 years ago

remove propertie svn:executabe of fortran files in DEV_r1879_FCM

  • Property svn:keywords set to Id
File size: 10.9 KB
Line 
1MODULE 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   !!----------------------------------------------------------------------
12#if defined key_pisces
13   !!----------------------------------------------------------------------
14   !!   'key_pisces'                                       PISCES bio-model
15   !!----------------------------------------------------------------------
16   !!   p4z_flx       :   CALCULATES GAS EXCHANGE AND CHEMISTRY AT SEA SURFACE
17   !!   p4z_flx_init  :   Read the namelist
18   !!----------------------------------------------------------------------
19   USE trc
20   USE oce_trc         !
21   USE trc
22   USE sms_pisces
23   USE prtctl_trc
24   USE p4zche
25   USE iom
26#if defined key_cpl_carbon_cycle
27   USE sbc_oce , ONLY :  atm_co2
28#endif
29   USE lib_mpp
30
31   IMPLICIT NONE
32   PRIVATE
33
34   PUBLIC   p4z_flx 
35
36   REAL(wp) :: &  ! pre-industrial atmospheric [co2] (ppm) 
37      atcox  = 0.20946 ,    &  !:
38      atcco2 = 278.            !:
39
40   REAL(wp) :: &
41      xconv  = 0.01/3600      !: coefficients for conversion
42
43   INTEGER  ::  nspyr         !: number of timestep per year
44
45#if defined key_cpl_carbon_cycle
46   REAL(wp), PUBLIC, DIMENSION(jpi,jpj) ::  &
47      oce_co2            !: ocean carbon flux
48   REAL(wp) :: &
49      t_atm_co2_flx,  &  !: Total atmospheric carbon flux per year
50      t_oce_co2_flx      !: Total ocean carbon flux per year
51#endif
52
53   !!* Substitution
54#  include "top_substitute.h90"
55   !!----------------------------------------------------------------------
56   !! NEMO/TOP 2.0 , LOCEAN-IPSL (2007)
57   !! $Id$
58   !! Software governed by the CeCILL licence (modipsl/doc/NEMO_CeCILL.txt)
59   !!----------------------------------------------------------------------
60
61CONTAINS
62
63   SUBROUTINE p4z_flx ( kt )
64      !!---------------------------------------------------------------------
65      !!                     ***  ROUTINE p4z_flx  ***
66      !!
67      !! ** Purpose :   CALCULATES GAS EXCHANGE AND CHEMISTRY AT SEA SURFACE
68      !!
69      !! ** Method  : - ???
70      !!---------------------------------------------------------------------
71      INTEGER, INTENT(in) :: kt
72      INTEGER  ::   ji, jj, jrorr
73      REAL(wp) ::   ztc, ztc2, ztc3, zws, zkgwan
74      REAL(wp) ::   zfld, zflu, zfld16, zflu16, zfact
75      REAL(wp) ::   zph, zah2, zbot, zdic, zalk, zsch_o2, zalka, zsch_co2
76      REAL(wp), DIMENSION(jpi,jpj) ::   zkgco2, zkgo2, zh2co3
77#if defined key_trc_diaadd && defined key_iomput
78      REAL(wp), DIMENSION(jpi,jpj) ::  zcflx, zoflx, zkg, zdpco2, zdpo2
79#endif
80      CHARACTER (len=25) :: charout
81
82      !!---------------------------------------------------------------------
83
84
85      IF( kt == nittrc000  )   CALL p4z_flx_init      ! Initialization (first time-step only)
86
87      ! SURFACE CHEMISTRY (PCO2 AND [H+] IN
88      !     SURFACE LAYER); THE RESULT OF THIS CALCULATION
89      !     IS USED TO COMPUTE AIR-SEA FLUX OF CO2
90
91      DO jrorr = 1, 10
92
93!CDIR NOVERRCHK
94         DO jj = 1, jpj
95!CDIR NOVERRCHK
96            DO ji = 1, jpi
97
98               ! DUMMY VARIABLES FOR DIC, H+, AND BORATE
99               zbot  = borat(ji,jj,1)
100               zfact = rhop(ji,jj,1) / 1000. + rtrn
101               zdic  = trn(ji,jj,1,jpdic) / zfact
102               zph   = MAX( hi(ji,jj,1), 1.e-10 ) / zfact
103               zalka = trn(ji,jj,1,jptal) / zfact
104
105               ! CALCULATE [ALK]([CO3--], [HCO3-])
106               zalk  = zalka - (  akw3(ji,jj,1) / zph - zph + zbot / ( 1.+ zph / akb3(ji,jj,1) )  )
107
108               ! CALCULATE [H+] AND [H2CO3]
109               zah2   = SQRT(  (zdic-zalk)**2 + 4.* ( zalk * ak23(ji,jj,1)   &
110                  &                                        / ak13(ji,jj,1) ) * ( 2.* zdic - zalk )  )
111               zah2   = 0.5 * ak13(ji,jj,1) / zalk * ( ( zdic - zalk ) + zah2 )
112               zh2co3(ji,jj) = ( 2.* zdic - zalk ) / ( 2.+ ak13(ji,jj,1) / zah2 ) * zfact
113               hi(ji,jj,1)   = zah2 * zfact
114            END DO
115         END DO
116      END DO
117
118
119      ! --------------
120      ! COMPUTE FLUXES
121      ! --------------
122
123      ! FIRST COMPUTE GAS EXCHANGE COEFFICIENTS
124      ! -------------------------------------------
125
126!CDIR NOVERRCHK
127      DO jj = 1, jpj
128!CDIR NOVERRCHK
129         DO ji = 1, jpi
130            ztc  = MIN( 35., tn(ji,jj,1) )
131            ztc2 = ztc * ztc
132            ztc3 = ztc * ztc2 
133            ! Compute the schmidt Number both O2 and CO2
134            zsch_co2 = 2073.1 - 125.62 * ztc + 3.6276 * ztc2 - 0.043126 * ztc3
135            zsch_o2  = 1953.4 - 128.0  * ztc + 3.9918 * ztc2 - 0.050091 * ztc3
136            !  wind speed
137            zws  = wndm(ji,jj) * wndm(ji,jj)
138            ! Compute the piston velocity for O2 and CO2
139            zkgwan = 0.3 * zws  + 2.5 * ( 0.5246 + 0.016256 * ztc + 0.00049946  * ztc2 )
140# if defined key_off_degrad
141            zkgwan = zkgwan * xconv * ( 1.- fr_i(ji,jj) ) * tmask(ji,jj,1) * facvol(ji,jj,1)
142#else
143            zkgwan = zkgwan * xconv * ( 1.- fr_i(ji,jj) ) * tmask(ji,jj,1)
144#endif 
145            ! compute gas exchange for CO2 and O2
146            zkgco2(ji,jj) = zkgwan * SQRT( 660./ zsch_co2 )
147            zkgo2 (ji,jj) = zkgwan * SQRT( 660./ zsch_o2 )
148         END DO
149      END DO
150
151      DO jj = 1, jpj
152         DO ji = 1, jpi
153            ! Compute CO2 flux for the sea and air
154#if ! defined key_cpl_carbon_cycle
155            zfld = atcco2 * tmask(ji,jj,1) * chemc(ji,jj,1) * zkgco2(ji,jj)
156            zflu = zh2co3(ji,jj) * tmask(ji,jj,1) * zkgco2(ji,jj)
157#else
158            zfld = atm_co2(ji,jj) * tmask(ji,jj,1) * chemc(ji,jj,1) * zkgco2(ji,jj)
159            zflu = zh2co3(ji,jj) * tmask(ji,jj,1) * zkgco2(ji,jj)
160            ! compute flux of carbon
161            oce_co2(ji,jj) = ( zfld - zflu ) * rfact &
162               &             * e1t(ji,jj) * e2t(ji,jj) * tmask(ji,jj,1) * 1000.
163#endif
164            tra(ji,jj,1,jpdic) = tra(ji,jj,1,jpdic) + ( zfld - zflu ) / fse3t(ji,jj,1)
165
166            ! Compute O2 flux
167            zfld16 = atcox * chemc(ji,jj,2) * tmask(ji,jj,1) * zkgo2(ji,jj)
168            zflu16 = trn(ji,jj,1,jpoxy) * tmask(ji,jj,1) * zkgo2(ji,jj)
169            tra(ji,jj,1,jpoxy) = tra(ji,jj,1,jpoxy) + ( zfld16 - zflu16 ) / fse3t(ji,jj,1)
170
171#if defined key_trc_diaadd 
172            ! Save diagnostics
173#  if ! defined key_iomput
174            trc2d(ji,jj,jp_pcs0_2d    ) = ( zfld - zflu )     * 1000. * tmask(ji,jj,1)
175            trc2d(ji,jj,jp_pcs0_2d + 1) = ( zfld16 - zflu16 ) * 1000. * tmask(ji,jj,1)
176            trc2d(ji,jj,jp_pcs0_2d + 2) = zkgco2(ji,jj) * tmask(ji,jj,1)
177            trc2d(ji,jj,jp_pcs0_2d + 3) = ( atcco2 - zh2co3(ji,jj) / ( chemc(ji,jj,1) + rtrn ) ) &
178               &                            * tmask(ji,jj,1)
179#  else
180            zcflx(ji,jj) = ( zfld - zflu ) * 1000.  * tmask(ji,jj,1)
181            zoflx(ji,jj) = ( zfld16 - zflu16 ) * 1000. * tmask(ji,jj,1)
182            zkg  (ji,jj) = zkgco2(ji,jj) * tmask(ji,jj,1)
183            zdpco2(ji,jj) = ( atcco2 - zh2co3(ji,jj)      / ( chemc(ji,jj,1) + rtrn ) ) &
184              &             * tmask(ji,jj,1)
185            zdpo2 (ji,jj) = ( atcox  - trn(ji,jj,1,jpoxy) / ( chemc(ji,jj,2) + rtrn ) ) &
186              &             * tmask(ji,jj,1)
187#  endif
188#endif
189         END DO
190      END DO
191
192#if defined key_cpl_carbon_cycle
193      ! Total Flux of Carbon
194      DO jj = 1, jpj 
195        DO ji = 1, jpi
196           t_atm_co2_flx = t_atm_co2_flx + atm_co2(ji,jj) * tmask_i(ji,jj)
197           t_oce_co2_flx = t_oce_co2_flx + oce_co2(ji,jj) * tmask_i(ji,jj)
198        END DO
199      END DO
200
201      IF( MOD( kt, nspyr ) == 0 ) THEN
202        IF( lk_mpp ) THEN
203          CALL mpp_sum( t_atm_co2_flx )   ! sum over the global domain
204          CALL mpp_sum( t_oce_co2_flx )   ! sum over the global domain
205        ENDIF
206        ! Conversion in GtC/yr ; negative for outgoing from ocean
207        t_oce_co2_flx = (-1.) * t_oce_co2_flx  * 12. / 1.e15
208        !
209        WRITE(numout,*) ' Atmospheric pCO2    :'
210        WRITE(numout,*) '-------------------- : ',kt,'  ',t_atm_co2_flx
211        WRITE(numout,*) '(ppm)'
212        WRITE(numout,*) 'Total Flux of Carbon out of the ocean :'
213        WRITE(numout,*) '-------------------- : ',t_oce_co2_flx
214        WRITE(numout,*) '(GtC/yr)'
215        t_atm_co2_flx = 0.
216        t_oce_co2_flx = 0.
217# if defined key_iomput
218        CALL iom_put( "tatpco2" , t_atm_co2_flx  )
219        CALL iom_put( "tco2flx" , t_oce_co2_flx  )
220#endif
221      ENDIF
222#endif
223
224      IF(ln_ctl)   THEN  ! print mean trends (used for debugging)
225         WRITE(charout, FMT="('flx ')")
226         CALL prt_ctl_trc_info(charout)
227         CALL prt_ctl_trc(tab4d=tra, mask=tmask, clinfo=ctrcnm)
228      ENDIF
229
230# if defined key_trc_diaadd && defined key_iomput
231      CALL iom_put( "Cflx" , zcflx  )
232      CALL iom_put( "Oflx" , zoflx  )
233      CALL iom_put( "Kg"   , zkg    )
234      CALL iom_put( "Dpco2", zdpco2 )
235      CALL iom_put( "Dpo2" , zdpo2  )
236#endif
237
238   END SUBROUTINE p4z_flx
239
240   SUBROUTINE p4z_flx_init
241
242      !!----------------------------------------------------------------------
243      !!                  ***  ROUTINE p4z_flx_init  ***
244      !!
245      !! ** Purpose :   Initialization of atmospheric conditions
246      !!
247      !! ** Method  :   Read the nampisext namelist and check the parameters
248      !!      called at the first timestep (nittrc000)
249      !! ** input   :   Namelist nampisext
250      !!
251      !!----------------------------------------------------------------------
252
253      NAMELIST/nampisext/ atcco2
254
255      REWIND( numnat )                     ! read numnat
256      READ  ( numnat, nampisext )
257
258      IF(lwp) THEN                         ! control print
259         WRITE(numout,*) ' '
260         WRITE(numout,*) ' Namelist parameters for air-sea exchange, nampisext'
261         WRITE(numout,*) ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
262         WRITE(numout,*) '    Atmospheric pCO2      atcco2      =', atcco2
263      ENDIF
264
265      ! number of time step per year 
266      nspyr = INT( nyear_len(1) * rday / rdt )
267
268#if defined key_cpl_carbon_cycle
269      ! Initialization of Flux of Carbon
270      oce_co2(:,:) = 0.
271      t_atm_co2_flx = 0.
272      t_oce_co2_flx = 0.
273#endif
274
275   END SUBROUTINE p4z_flx_init
276
277#else
278   !!======================================================================
279   !!  Dummy module :                                   No PISCES bio-model
280   !!======================================================================
281CONTAINS
282   SUBROUTINE p4z_flx( kt )                   ! Empty routine
283      INTEGER, INTENT( in ) ::   kt
284      WRITE(*,*) 'p4z_flx: You should not have seen this print! error?', kt
285   END SUBROUTINE p4z_flx
286#endif 
287
288   !!======================================================================
289END MODULE  p4zflx
Note: See TracBrowser for help on using the repository browser.