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/CMIP5_IPSL/NEMO/TOP_SRC/PISCES – NEMO

source: branches/CMIP5_IPSL/NEMO/TOP_SRC/PISCES/p4zflx.F90 @ 1830

Last change on this file since 1830 was 1830, checked in by cetlod, 14 years ago

Computation of additional diagnostics for PISCES model ( under CPP key key_diaar5 )

  • needed for AR5 outputs (vertical inventories, passive tracers at surface,... )
  • new output file with suffix dbio_T
  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 10.9 KB
RevLine 
[935]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         !
[1119]21   USE trc
[1073]22   USE sms_pisces
[935]23   USE prtctl_trc
24   USE p4zche
[1457]25   USE iom
[1534]26#if defined key_cpl_carbon_cycle
27   USE sbc_oce , ONLY :  atm_co2
28#endif
[1298]29   USE lib_mpp
30
[935]31   IMPLICIT NONE
32   PRIVATE
33
[1073]34   PUBLIC   p4z_flx 
[935]35
36   REAL(wp) :: &  ! pre-industrial atmospheric [co2] (ppm) 
[1457]37      atcox  = 0.20946 ,    &  !:
38      atcco2 = 278.            !:
[935]39
[1534]40   REAL(wp) :: &
[1735]41      xconv  = 0.01/3600      !: coefficients for conversion
[1534]42
[1735]43   INTEGER  ::  nspyr         !: number of timestep per year
44
[1534]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
[935]53   !!* Substitution
[1808]54#  include "top_substitute.h90"
[935]55   !!----------------------------------------------------------------------
56   !! NEMO/TOP 2.0 , LOCEAN-IPSL (2007)
[1152]57   !! $Id$
[935]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
[1735]72      INTEGER  ::   ji, jj, jrorr
[1457]73      REAL(wp) ::   ztc, ztc2, ztc3, zws, zkgwan
[935]74      REAL(wp) ::   zfld, zflu, zfld16, zflu16, zfact
[1457]75      REAL(wp) ::   zph, zah2, zbot, zdic, zalk, zsch_o2, zalka, zsch_co2
[1534]76      REAL(wp), DIMENSION(jpi,jpj) ::   zkgco2, zkgo2, zh2co3
[1457]77#if defined key_trc_diaadd && defined key_iomput
[1678]78      REAL(wp), DIMENSION(jpi,jpj) ::  zcflx, zoflx, zkg, zdpco2, zdpo2
[1457]79#endif
[935]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
[1457]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
[1007]136            !  wind speed
[1457]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 )
[935]140# if defined key_off_degrad
[1457]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 )
[935]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
[1534]154#if ! defined key_cpl_carbon_cycle
[935]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)
[1534]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)
[935]160            ! compute flux of carbon
[1534]161            oce_co2(ji,jj) = ( zfld - zflu ) * rfact &
[935]162               &             * e1t(ji,jj) * e2t(ji,jj) * tmask(ji,jj,1) * 1000.
[1534]163#endif
164            tra(ji,jj,1,jpdic) = tra(ji,jj,1,jpdic) + ( zfld - zflu ) / fse3t(ji,jj,1)
[935]165
166            ! Compute O2 flux
[1678]167            zfld16 = atcox * chemc(ji,jj,2) * tmask(ji,jj,1) * zkgo2(ji,jj)
[935]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
[1534]171#if defined key_trc_diaadd 
[935]172            ! Save diagnostics
[1534]173#  if ! defined key_iomput
174            trc2d(ji,jj,jp_pcs0_2d    ) = ( zfld - zflu )     * 1000. * tmask(ji,jj,1)
[1329]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)
[1678]177            trc2d(ji,jj,jp_pcs0_2d + 3) = ( atcco2 - zh2co3(ji,jj) / ( chemc(ji,jj,1) + rtrn ) ) &
178               &                            * tmask(ji,jj,1)
[1534]179#  else
[1457]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)
[1678]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)
[1534]187#  endif
188#endif
[1457]189         END DO
190      END DO
191
[1534]192#if defined key_cpl_carbon_cycle
[935]193      ! Total Flux of Carbon
[1534]194      DO jj = 1, jpj 
[935]195        DO ji = 1, jpi
[1534]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)
[935]198        END DO
199      END DO
200
201      IF( MOD( kt, nspyr ) == 0 ) THEN
[1534]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
[1830]206        ! Conversion in GtC/yr ; negative for outgoing from ocean
207        t_oce_co2_flx = (-1.) * t_oce_co2_flx  * 12. / 1.e15
208        !
[935]209        WRITE(numout,*) ' Atmospheric pCO2    :'
[1534]210        WRITE(numout,*) '-------------------- : ',kt,'  ',t_atm_co2_flx
[935]211        WRITE(numout,*) '(ppm)'
[1830]212        WRITE(numout,*) 'Total Flux of Carbon out of the ocean :'
213        WRITE(numout,*) '-------------------- : ',t_oce_co2_flx
214        WRITE(numout,*) '(GtC/yr)'
[1534]215        t_atm_co2_flx = 0.
216        t_oce_co2_flx = 0.
[1830]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
[935]221      ENDIF
[1534]222#endif
[935]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
[1457]230# if defined key_trc_diaadd && defined key_iomput
[1678]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  )
[1457]236#endif
[935]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      !!
[1119]247      !! ** Method  :   Read the nampisext namelist and check the parameters
[935]248      !!      called at the first timestep (nittrc000)
[1119]249      !! ** input   :   Namelist nampisext
[935]250      !!
251      !!----------------------------------------------------------------------
252
[1119]253      NAMELIST/nampisext/ atcco2
[935]254
255      REWIND( numnat )                     ! read numnat
[1119]256      READ  ( numnat, nampisext )
[935]257
258      IF(lwp) THEN                         ! control print
259         WRITE(numout,*) ' '
[1119]260         WRITE(numout,*) ' Namelist parameters for air-sea exchange, nampisext'
[935]261         WRITE(numout,*) ' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~'
262         WRITE(numout,*) '    Atmospheric pCO2      atcco2      =', atcco2
263      ENDIF
264
[1735]265      ! number of time step per year 
266      nspyr = INT( nyear_len(1) * rday / rdt )
267
[1534]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
[1298]274
[935]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.