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.
trcsms_cfc.F90 in NEMO/branches/2020/dev_12905_xios_restart/src/TOP/CFC – NEMO

source: NEMO/branches/2020/dev_12905_xios_restart/src/TOP/CFC/trcsms_cfc.F90 @ 13727

Last change on this file since 13727 was 13727, checked in by andmirek, 4 years ago

Ticket #2462: Upate to trunk rev 13688

  • Property svn:keywords set to Id
File size: 13.6 KB
Line 
1MODULE trcsms_cfc
2   !!======================================================================
3   !!                      ***  MODULE trcsms_cfc  ***
4   !! TOP : CFC main model
5   !!======================================================================
6   !! History :  OPA  !  1999-10  (JC. Dutay)  original code
7   !!  NEMO      1.0  !  2004-03  (C. Ethe) free form + modularity
8   !!            2.0  !  2007-12  (C. Ethe, G. Madec)  reorganisation
9   !!            4.0  !  2016-11  (T. Lovato) Add SF6, Update Schmidt number
10   !!----------------------------------------------------------------------
11   !!   trc_sms_cfc  :  compute and add CFC suface forcing to CFC trends
12   !!   cfc_init     :  sets constants for CFC surface forcing computation
13   !!----------------------------------------------------------------------
14   USE oce_trc       ! Ocean variables
15   USE par_trc       ! TOP parameters
16   USE trc           ! TOP variables
17   USE trd_oce
18   USE trdtrc
19   USE iom           ! I/O library
20
21   IMPLICIT NONE
22   PRIVATE
23
24   PUBLIC   trc_sms_cfc         ! called in ???   
25   PUBLIC   trc_sms_cfc_alloc   ! called in trcini_cfc.F90
26
27   INTEGER , PUBLIC, PARAMETER ::   jphem  =   2   ! parameter for the 2 hemispheres
28   INTEGER , PUBLIC            ::   jpyear         ! Number of years read in input data file (in trcini_cfc)
29   INTEGER , PUBLIC            ::   ndate_beg      ! initial calendar date (aammjj) for CFC
30   INTEGER , PUBLIC            ::   nyear_res      ! restoring time constant (year)
31   INTEGER , PUBLIC            ::   nyear_beg      ! initial year (aa)
32   
33   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   p_cfc    ! partial hemispheric pressure for all CFC
34   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   xphem    ! spatial interpolation factor for patm
35   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   qtr_cfc  ! flux at surface
36   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   qint_cfc ! cumulative flux
37   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:,:) ::   atm_cfc  ! partial hemispheric pressure for used CFC
38   REAL(wp), PUBLIC, ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   patm     ! atmospheric function
39
40   REAL(wp),         ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   soa      ! coefficient for solubility of CFC [mol/l/atm]
41   REAL(wp),         ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   sob      !    "               "
42   REAL(wp),         ALLOCATABLE, SAVE, DIMENSION(:,:)   ::   sca      ! coefficients for schmidt number in degrees Celsius
43   !                          ! coefficients for conversion
44   REAL(wp) ::   xconv1 = 1.0          ! conversion from to
45   REAL(wp) ::   xconv2 = 0.01/3600.   ! conversion from cm/h to m/s:
46   REAL(wp) ::   xconv3 = 1.0e+3       ! conversion from mol/l/atm to mol/m3/atm
47   REAL(wp) ::   xconv4 = 1.0e-12      ! conversion from mol/m3/atm to mol/m3/pptv
48
49   !! * Substitutions
50#  include "do_loop_substitute.h90"
51#  include "domzgr_substitute.h90"
52   !!----------------------------------------------------------------------
53   !! NEMO/TOP 4.0 , NEMO Consortium (2018)
54   !! $Id$
55   !! Software governed by the CeCILL license (see ./LICENSE)
56   !!----------------------------------------------------------------------
57CONTAINS
58
59   SUBROUTINE trc_sms_cfc( kt, Kbb, Kmm, Krhs )
60      !!----------------------------------------------------------------------
61      !!                     ***  ROUTINE trc_sms_cfc  ***
62      !!
63      !! ** Purpose :   Compute the surface boundary contition on CFC 11
64      !!             passive tracer associated with air-mer fluxes and add it
65      !!             to the general trend of tracers equations.
66      !!
67      !! ** Method  : - get the atmospheric partial pressure - given in pico -
68      !!              - computation of solubility ( in 1.e-12 mol/l then in 1.e-9 mol/m3)
69      !!              - computation of transfert speed ( given in cm/hour ----> cm/s )
70      !!              - the input function is given by :
71      !!                speed * ( concentration at equilibrium - concentration at surface )
72      !!              - the input function is in pico-mol/m3/s and the
73      !!                CFC concentration in pico-mol/m3
74      !!----------------------------------------------------------------------
75      INTEGER, INTENT(in) ::   kt               ! ocean time-step index
76      INTEGER, INTENT(in) ::   Kbb, Kmm, Krhs   ! ocean time level
77      !
78      INTEGER  ::   ji, jj, jn, jl, jm
79      INTEGER  ::   iyear_beg, iyear_end
80      INTEGER  ::   im1, im2, ierr
81      REAL(wp) ::   ztap, zdtap       
82      REAL(wp) ::   zt1, zt2, zt3, zt4, zv2
83      REAL(wp) ::   zsol      ! solubility
84      REAL(wp) ::   zsch      ! schmidt number
85      REAL(wp) ::   zpp_cfc   ! atmospheric partial pressure of CFC
86      REAL(wp) ::   zca_cfc   ! concentration at equilibrium
87      REAL(wp) ::   zak_cfc   ! transfert coefficients
88      REAL(wp), ALLOCATABLE, DIMENSION(:,:)  ::   zpatm     ! atmospheric function
89      !!----------------------------------------------------------------------
90      !
91      IF( ln_timing )   CALL timing_start('trc_sms_cfc')
92      !
93      ALLOCATE( zpatm(jphem,jp_cfc), STAT=ierr )
94      IF( ierr > 0 ) THEN
95         CALL ctl_stop( 'trc_sms_cfc: unable to allocate zpatm array' )   ;   RETURN
96      ENDIF
97
98      IF( kt == nittrc000 )   CALL cfc_init
99
100      ! Temporal interpolation
101      ! ----------------------
102      iyear_beg = nyear - 1900
103      IF ( nmonth <= 6 ) THEN
104         iyear_beg = iyear_beg - 1
105         im1       =  6 - nmonth + 1
106         im2       =  6 + nmonth - 1
107      ELSE
108         im1       = 12 - nmonth + 7
109         im2       =      nmonth - 7
110      ENDIF
111      ! Avoid bad interpolation if starting date is =< 1900
112      IF( iyear_beg .LE. 0      )  iyear_beg = 1
113      IF( iyear_beg .GE. jpyear )  iyear_beg = jpyear - 1
114      !
115      iyear_end = iyear_beg + 1
116
117      !                                                  !------------!
118      DO jl = 1, jp_cfc                                  !  CFC loop  !
119         !                                               !------------!
120         jn = jp_cfc0 + jl - 1
121         ! time interpolation at time kt
122         DO jm = 1, jphem
123            zpatm(jm,jl) = (  atm_cfc(iyear_beg, jm, jl) * REAL(im1, wp)  &
124               &           +  atm_cfc(iyear_end, jm, jl) * REAL(im2, wp) ) / 12.
125         END DO
126         
127         !                                                         !------------!
128         DO_2D( 1, 1, 1, 1 )                                       !  i-j loop  !
129            !                                                      !------------!
130            ! space interpolation
131            zpp_cfc  =       xphem(ji,jj)   * zpatm(1,jl)   &
132               &     + ( 1.- xphem(ji,jj) ) * zpatm(2,jl)
133
134            ! Computation of concentration at equilibrium : in picomol/l
135            ! coefficient for solubility for CFC-11/12 in  mol/l/atm
136            IF( tmask(ji,jj,1) .GE. 0.5 ) THEN
137               ztap  = ( ts(ji,jj,1,jp_tem,Kmm) + 273.16 ) * 0.01
138               zdtap = sob(1,jl) + ztap * ( sob(2,jl) + ztap * sob(3,jl) ) 
139               zsol  =  EXP( soa(1,jl) + soa(2,jl) / ztap + soa(3,jl) * LOG( ztap )   &
140                  &                    + soa(4,jl) * ztap * ztap + ts(ji,jj,1,jp_sal,Kmm) * zdtap ) 
141            ELSE
142               zsol  = 0.e0
143            ENDIF
144            ! conversion from mol/l/atm to mol/m3/atm and from mol/m3/atm to mol/m3/pptv   
145            zsol = xconv4 * xconv3 * zsol * tmask(ji,jj,1) 
146            ! concentration at equilibrium
147            zca_cfc = xconv1 * zpp_cfc * zsol * tmask(ji,jj,1)             
148            ! Computation of speed transfert
149            !    Schmidt number revised in Wanninkhof (2014)
150            zt1  = ts(ji,jj,1,jp_tem,Kmm)
151            zt2  = zt1 * zt1 
152            zt3  = zt1 * zt2
153            zt4  = zt2 * zt2
154            zsch = sca(1,jl) + sca(2,jl) * zt1 + sca(3,jl) * zt2 + sca(4,jl) * zt3 + sca(5,jl) * zt4
155
156            !    speed transfert : formulae revised in Wanninkhof (2014)
157            zv2     = wndm(ji,jj) * wndm(ji,jj)
158            zsch    = zsch / 660.
159            zak_cfc = ( 0.251 * xconv2 * zv2 / SQRT(zsch) ) * tmask(ji,jj,1)
160
161            ! Input function  : speed *( conc. at equil - concen at surface )
162            ! tr(:,:,:,:,Kmm) in pico-mol/l idem qtr; ak in en m/a
163            qtr_cfc(ji,jj,jl) = -zak_cfc * ( tr(ji,jj,1,jn,Kbb) - zca_cfc )   &
164               &                         * tmask(ji,jj,1) * ( 1. - fr_i(ji,jj) )
165            ! Add the surface flux to the trend
166            tr(ji,jj,1,jn,Krhs) = tr(ji,jj,1,jn,Krhs) + qtr_cfc(ji,jj,jl) / e3t(ji,jj,1,Kmm) 
167
168            ! cumulation of surface flux at each time step
169            qint_cfc(ji,jj,jl) = qint_cfc(ji,jj,jl) + qtr_cfc(ji,jj,jl) * rn_Dt
170            !                                               !----------------!
171         END_2D
172         !                                                  !----------------!
173      END DO                                                !  end CFC loop  !
174      !
175      IF( lrst_trc ) THEN
176         IF(lwp) WRITE(numout,*)
177         IF(lwp) WRITE(numout,*) 'trc_sms_cfc : cumulated input function fields written in ocean restart file ',   &
178            &                    'at it= ', kt,' date= ', ndastp
179         IF(lwp) WRITE(numout,*) '~~~~'
180         jl = 0
181         IF( lwxios ) CALL iom_swap(      cwtxios_context         )
182         DO jn = jp_cfc0, jp_cfc1
183             jl = jl + 1
184            CALL iom_rstput( kt, nitrst, numrtw, 'qint_'//ctrcnm(jn), qint_cfc(:,:,jl), ldxios = lwxios )
185         END DO
186         IF( lwxios ) CALL iom_swap(      cxios_context         )
187      ENDIF                                           
188      !
189      IF( lk_iomput ) THEN
190         jl = 0
191         DO jn = jp_cfc0, jp_cfc1
192            jl = jl + 1
193            CALL iom_put( 'qtr_'//TRIM(ctrcnm(jn)) , qtr_cfc (:,:,jl) )
194            CALL iom_put( 'qint_'//TRIM(ctrcnm(jn)), qint_cfc(:,:,jl) )
195         ENDDO
196      END IF
197      !
198      IF( l_trdtrc ) THEN
199          DO jn = jp_cfc0, jp_cfc1
200            CALL trd_trc( tr(:,:,:,jn,Krhs), jn, jptra_sms, kt, Kmm )   ! save trends
201          END DO
202      END IF
203      !
204      IF( ln_timing )   CALL timing_stop('trc_sms_cfc')
205      !
206   END SUBROUTINE trc_sms_cfc
207
208
209   SUBROUTINE cfc_init
210      !!---------------------------------------------------------------------
211      !!                     ***  cfc_init  *** 
212      !!
213      !! ** Purpose : sets constants for CFC model
214      !!---------------------------------------------------------------------
215      INTEGER ::   jn, jl   !
216      !!----------------------------------------------------------------------
217      !
218      jn = 0 
219      ! coefficient for CFC11
220      !----------------------
221      if ( ln_cfc11 ) then
222         jn = jn + 1
223         ! Solubility
224         soa(1,jn) = -229.9261 
225         soa(2,jn) =  319.6552
226         soa(3,jn) =  119.4471
227         soa(4,jn) =  -1.39165
228
229         sob(1,jn) =  -0.142382
230         sob(2,jn) =   0.091459
231         sob(3,jn) =  -0.0157274
232
233         ! Schmidt number
234         sca(1,jn) = 3579.2
235         sca(2,jn) = -222.63
236         sca(3,jn) = 7.5749
237         sca(4,jn) = -0.14595
238         sca(5,jn) = 0.0011874
239
240         ! atm. concentration
241         atm_cfc(:,:,jn) = p_cfc(:,:,1)
242      endif
243
244      ! coefficient for CFC12
245      !----------------------
246      if ( ln_cfc12 ) then
247         jn = jn + 1
248         ! Solubility
249         soa(1,jn) = -218.0971
250         soa(2,jn) =  298.9702
251         soa(3,jn) =  113.8049
252         soa(4,jn) =  -1.39165
253
254         sob(1,jn) =  -0.143566
255         sob(2,jn) =   0.091015
256         sob(3,jn) =  -0.0153924
257
258         ! schmidt number
259         sca(1,jn) = 3828.1
260         sca(2,jn) = -249.86
261         sca(3,jn) = 8.7603
262         sca(4,jn) = -0.1716
263         sca(5,jn) = 0.001408
264
265         ! atm. concentration
266         atm_cfc(:,:,jn) = p_cfc(:,:,2)
267      endif
268
269      ! coefficient for SF6
270      !----------------------
271      if ( ln_sf6 ) then
272         jn = jn + 1
273         ! Solubility
274         soa(1,jn) = -80.0343
275         soa(2,jn) = 117.232
276         soa(3,jn) =  29.5817
277         soa(4,jn) =   0.0
278
279         sob(1,jn) =  0.0335183 
280         sob(2,jn) = -0.0373942 
281         sob(3,jn) =  0.00774862
282
283         ! schmidt number
284         sca(1,jn) = 3177.5
285         sca(2,jn) = -200.57
286         sca(3,jn) = 6.8865
287         sca(4,jn) = -0.13335
288         sca(5,jn) = 0.0010877
289 
290         ! atm. concentration
291         atm_cfc(:,:,jn) = p_cfc(:,:,3)
292       endif
293
294      IF( ln_rsttr ) THEN
295         IF(lwp) WRITE(numout,*)
296         IF(lwp) WRITE(numout,*) ' Read specific variables from CFC model '
297         IF(lwp) WRITE(numout,*) ' ~~~~~~~~~~~~~~'
298         !
299         jl = 0
300         IF(lrtxios) CALL iom_swap(crtxios_context)
301         DO jn = jp_cfc0, jp_cfc1
302            jl = jl + 1
303            CALL iom_get( numrtr, jpdom_auto, 'qint_'//ctrcnm(jn), qint_cfc(:,:,jl), ldxios = lrtxios ) 
304         END DO
305         IF(lrtxios) CALL iom_swap(cxios_context)
306      ENDIF
307      IF(lwp) WRITE(numout,*)
308      !
309   END SUBROUTINE cfc_init
310
311
312   INTEGER FUNCTION trc_sms_cfc_alloc()
313      !!----------------------------------------------------------------------
314      !!                     ***  ROUTINE trc_sms_cfc_alloc  ***
315      !!----------------------------------------------------------------------
316      ALLOCATE( xphem   (jpi,jpj)        , atm_cfc(jpyear,jphem,jp_cfc)  ,    &
317         &      qtr_cfc (jpi,jpj,jp_cfc) , qint_cfc(jpi,jpj,jp_cfc)      ,    &
318         &      soa(4,jp_cfc)    ,  sob(3,jp_cfc)   ,  sca(5,jp_cfc)     ,    &
319         &      STAT=trc_sms_cfc_alloc )
320         !
321      IF( trc_sms_cfc_alloc /= 0 ) CALL ctl_stop( 'STOP', 'trc_sms_cfc_alloc : failed to allocate arrays.' )
322      !
323   END FUNCTION trc_sms_cfc_alloc
324
325   !!======================================================================
326END MODULE trcsms_cfc
Note: See TracBrowser for help on using the repository browser.