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.
trasbc.F90 in trunk/NEMOGCM/NEMO/OPA_SRC/TRA – NEMO

source: trunk/NEMOGCM/NEMO/OPA_SRC/TRA/trasbc.F90 @ 5296

Last change on this file since 5296 was 5120, checked in by acc, 9 years ago

#1473. Re-organisation and optimisation of ice shelf cavity option. This commit merges changes from the dev_r5094_UKMO_ISFCLEAN branch onto the trunk. Results will change, even with ln_isfcav=F, due to a return to original definitions of the vertical metrics. All changes have been reviewed and SETTE tested.

  • Property svn:keywords set to Id
File size: 16.5 KB
RevLine 
[3]1MODULE trasbc
2   !!==============================================================================
3   !!                       ***  MODULE  trasbc  ***
4   !! Ocean active tracers:  surface boundary condition
5   !!==============================================================================
[2528]6   !! History :  OPA  !  1998-10  (G. Madec, G. Roullet, M. Imbard)  Original code
7   !!            8.2  !  2001-02  (D. Ludicone)  sea ice and free surface
8   !!  NEMO      1.0  !  2002-06  (G. Madec)  F90: Free form and module
9   !!            3.3  !  2010-04  (M. Leclair, G. Madec)  Forcing averaged over 2 time steps
10   !!             -   !  2010-09  (C. Ethe, G. Madec) Merge TRA-TRC
[5120]11   !!            3.6  !  2014-11  (P. Mathiot) isf melting forcing
[3]12   !!----------------------------------------------------------------------
[503]13
14   !!----------------------------------------------------------------------
[3]15   !!   tra_sbc      : update the tracer trend at ocean surface
16   !!----------------------------------------------------------------------
17   USE oce             ! ocean dynamics and active tracers
[888]18   USE sbc_oce         ! surface boundary condition: ocean
[3]19   USE dom_oce         ! ocean space domain variables
20   USE phycst          ! physical constant
[4990]21   USE sbcmod          ! ln_rnf 
22   USE sbcrnf          ! River runoff 
[216]23   USE traqsr          ! solar radiation penetration
[4990]24   USE trd_oce         ! trends: ocean variables
25   USE trdtra          ! trends manager: tracers
26   !
[3]27   USE in_out_manager  ! I/O manager
[258]28   USE prtctl          ! Print control
[2528]29   USE sbcrnf          ! River runoff 
[4990]30   USE sbcisf          ! Ice shelf   
[2528]31   USE sbcmod          ! ln_rnf 
32   USE iom
33   USE lbclnk          ! ocean lateral boundary conditions (or mpp link)
[3294]34   USE wrk_nemo        ! Memory Allocation
35   USE timing          ! Timing
[4990]36   USE eosbn2
[3]37
38   IMPLICIT NONE
39   PRIVATE
40
[503]41   PUBLIC   tra_sbc    ! routine called by step.F90
[3]42
43   !! * Substitutions
44#  include "domzgr_substitute.h90"
45#  include "vectopt_loop_substitute.h90"
46   !!----------------------------------------------------------------------
[4990]47   !! NEMO/OPA 3.7 , NEMO Consortium (2014)
[888]48   !! $Id$
[2715]49   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
[3]50   !!----------------------------------------------------------------------
51CONTAINS
52
53   SUBROUTINE tra_sbc ( kt )
54      !!----------------------------------------------------------------------
55      !!                  ***  ROUTINE tra_sbc  ***
56      !!                   
57      !! ** Purpose :   Compute the tracer surface boundary condition trend of
58      !!      (flux through the interface, concentration/dilution effect)
59      !!      and add it to the general trend of tracer equations.
60      !!
61      !! ** Method :
[664]62      !!      Following Roullet and Madec (2000), the air-sea flux can be divided
63      !!      into three effects: (1) Fext, external forcing;
64      !!      (2) Fwi, concentration/dilution effect due to water exchanged
65      !!         at the surface by evaporation, precipitations and runoff (E-P-R);
66      !!      (3) Fwe, tracer carried with the water that is exchanged.
[3625]67      !!            - salinity    : salt flux only due to freezing/melting
68      !!            sa = sa +  sfx / rau0 / e3t  for k=1
[664]69      !!
70      !!      Fext, flux through the air-sea interface for temperature and salt:
[3]71      !!            - temperature : heat flux q (w/m2). If penetrative solar
72      !!         radiation q is only the non solar part of the heat flux, the
73      !!         solar part is added in traqsr.F routine.
74      !!            ta = ta + q /(rau0 rcp e3t)  for k=1
75      !!            - salinity    : no salt flux
[664]76      !!
77      !!      The formulation for Fwb and Fwi vary according to the free
78      !!      surface formulation (linear or variable volume).
79      !!      * Linear free surface
80      !!            The surface freshwater flux modifies the ocean volume
[3]81      !!         and thus the concentration of a tracer and the temperature.
82      !!         First order of the effect of surface freshwater exchange
83      !!         for salinity, it can be neglected on temperature (especially
[664]84      !!         as the temperature of precipitations and runoffs is usually
85      !!         unknown).
[3]86      !!            - temperature : we assume that the temperature of both
87      !!         precipitations and runoffs is equal to the SST, thus there
88      !!         is no additional flux since in this case, the concentration
89      !!         dilution effect is balanced by the net heat flux associated
[664]90      !!         to the freshwater exchange (Fwe+Fwi=0):
91      !!            (Tp P - Te E) + SST (P-E) = 0 when Tp=Te=SST
[3]92      !!            - salinity    : evaporation, precipitation and runoff
[3625]93      !!         water has a zero salinity  but there is a salt flux due to
94      !!         freezing/melting, thus:
95      !!            sa = sa + emp * sn / rau0 / e3t   for k=1
96      !!                    + sfx    / rau0 / e3t
[3]97      !!         where emp, the surface freshwater budget (evaporation minus
98      !!         precipitation minus runoff) given in kg/m2/s is divided
[4990]99      !!         by rau0 (density of sea water) to obtain m/s.   
[664]100      !!         Note: even though Fwe does not appear explicitly for
101      !!         temperature in this routine, the heat carried by the water
102      !!         exchanged through the surface is part of the total heat flux
103      !!         forcing and must be taken into account in the global heat
104      !!         balance).
105      !!      * nonlinear free surface (variable volume, lk_vvl)
106      !!         contrary to the linear free surface case, Fwi is properly
107      !!         taken into account by using the true layer thicknesses to       
108      !!         calculate tracer content and advection. There is no need to
109      !!         deal with it in this routine.
110      !!           - temperature: Fwe=SST (P-E+R) is added to Fext.
111      !!           - salinity:  Fwe = 0, there is no surface flux of salt.
[3]112      !!
113      !! ** Action  : - Update the 1st level of (ta,sa) with the trend associated
114      !!                with the tracer surface boundary condition
[4990]115      !!              - send trends to trdtra module (l_trdtra=T)
[503]116      !!----------------------------------------------------------------------
[2528]117      INTEGER, INTENT(in) ::   kt   ! ocean time-step index
[3]118      !!
[2528]119      INTEGER  ::   ji, jj, jk, jn           ! dummy loop indices 
[4990]120      INTEGER  ::   ikt, ikb 
121      INTEGER  ::   nk_isf
[3625]122      REAL(wp) ::   zfact, z1_e3t, zdep
[4990]123      REAL(wp) ::   zalpha, zhk
124      REAL(wp) ::  zt_frz, zpress
[3294]125      REAL(wp), POINTER, DIMENSION(:,:,:) ::  ztrdt, ztrds
[3]126      !!----------------------------------------------------------------------
[3294]127      !
128      IF( nn_timing == 1 )  CALL timing_start('tra_sbc')
129      !
[3]130      IF( kt == nit000 ) THEN
131         IF(lwp) WRITE(numout,*)
132         IF(lwp) WRITE(numout,*) 'tra_sbc : TRAcer Surface Boundary Condition'
133         IF(lwp) WRITE(numout,*) '~~~~~~~ '
134      ENDIF
135
[4990]136      IF( l_trdtra ) THEN                    !* Save ta and sa trends
[3294]137         CALL wrk_alloc( jpi, jpj, jpk, ztrdt, ztrds ) 
138         ztrdt(:,:,:) = tsa(:,:,:,jp_tem)
139         ztrds(:,:,:) = tsa(:,:,:,jp_sal)
[216]140      ENDIF
141
[2528]142!!gm      IF( .NOT.ln_traqsr )   qsr(:,:) = 0.e0   ! no solar radiation penetration
143      IF( .NOT.ln_traqsr ) THEN     ! no solar radiation penetration
144         qns(:,:) = qns(:,:) + qsr(:,:)      ! total heat flux in qns
145         qsr(:,:) = 0.e0                     ! qsr set to zero
146      ENDIF
[3]147
[2528]148      !----------------------------------------
[4990]149      !        EMP, SFX and QNS effects
[2528]150      !----------------------------------------
151      !                                          Set before sbc tracer content fields
152      !                                          ************************************
153      IF( kt == nit000 ) THEN                      ! Set the forcing field at nit000 - 1
154         !                                         ! -----------------------------------
155         IF( ln_rstart .AND.    &                     ! Restart: read in restart file
156              & iom_varid( numror, 'sbc_hc_b', ldstop = .FALSE. ) > 0 ) THEN
157            IF(lwp) WRITE(numout,*) '          nit000-1 surface tracer content forcing fields red in the restart file'
[4990]158            zfact = 0.5_wp
[2528]159            CALL iom_get( numror, jpdom_autoglo, 'sbc_hc_b', sbc_tsc_b(:,:,jp_tem) )   ! before heat content sbc trend
160            CALL iom_get( numror, jpdom_autoglo, 'sbc_sc_b', sbc_tsc_b(:,:,jp_sal) )   ! before salt content sbc trend
161         ELSE                                         ! No restart or restart not found: Euler forward time stepping
[4990]162            zfact = 1._wp
163            sbc_tsc_b(:,:,:) = 0._wp
[2528]164         ENDIF
165      ELSE                                         ! Swap of forcing fields
166         !                                         ! ----------------------
[4990]167         zfact = 0.5_wp
[2528]168         sbc_tsc_b(:,:,:) = sbc_tsc(:,:,:)
169      ENDIF
170      !                                          Compute now sbc tracer content fields
171      !                                          *************************************
172
173                                                   ! Concentration dilution effect on (t,s) due to 
174                                                   ! evaporation, precipitation and qns, but not river runoff
175                                               
[3625]176      IF( lk_vvl ) THEN                            ! Variable Volume case  ==>> heat content of mass flux is in qns
[3294]177         DO jj = 1, jpj
178            DO ji = 1, jpi 
[3625]179               sbc_tsc(ji,jj,jp_tem) = r1_rau0_rcp * qns(ji,jj)                              ! non solar heat flux
180               sbc_tsc(ji,jj,jp_sal) = r1_rau0     * sfx(ji,jj)                              ! salt flux due to freezing/melting
[2528]181            END DO
[3]182         END DO
[3625]183      ELSE                                         ! Constant Volume case ==>> Concentration dilution effect
[2528]184         DO jj = 2, jpj
185            DO ji = fs_2, fs_jpim1   ! vector opt.
186               ! temperature : heat flux
[3625]187               sbc_tsc(ji,jj,jp_tem) = r1_rau0_rcp * qns(ji,jj)                          &   ! non solar heat flux
188                  &                  + r1_rau0     * emp(ji,jj)  * tsn(ji,jj,1,jp_tem)       ! concent./dilut. effect
189               ! salinity    : salt flux + concent./dilut. effect (both in sfx)
190               sbc_tsc(ji,jj,jp_sal) = r1_rau0  * (  sfx(ji,jj)                          &   ! salt flux (freezing/melting)
191                  &                                + emp(ji,jj) * tsn(ji,jj,1,jp_sal) )      ! concent./dilut. effect
[2528]192            END DO
193         END DO
[4990]194         IF( iom_use('emp_x_sst') )   CALL iom_put( "emp_x_sst", emp (:,:) * tsn(:,:,1,jp_tem) )   ! c/d term on sst
195         IF( iom_use('emp_x_sss') )   CALL iom_put( "emp_x_sss", emp (:,:) * tsn(:,:,1,jp_sal) )   ! c/d term on sss
[2528]196      ENDIF
197      ! Concentration dilution effect on (t,s) due to evapouration, precipitation and qns, but not river runoff 
198      DO jn = 1, jpts
199         DO jj = 2, jpj
200            DO ji = fs_2, fs_jpim1   ! vector opt.
201               z1_e3t = zfact / fse3t(ji,jj,1)
202               tsa(ji,jj,1,jn) = tsa(ji,jj,1,jn) + ( sbc_tsc_b(ji,jj,jn) + sbc_tsc(ji,jj,jn) ) * z1_e3t
203            END DO
204         END DO
[3]205      END DO
[2528]206      !                                          Write in the ocean restart file
207      !                                          *******************************
208      IF( lrst_oce ) THEN
209         IF(lwp) WRITE(numout,*)
210         IF(lwp) WRITE(numout,*) 'sbc : ocean surface tracer content forcing fields written in ocean restart file ',   &
211            &                    'at it= ', kt,' date= ', ndastp
212         IF(lwp) WRITE(numout,*) '~~~~'
213         CALL iom_rstput( kt, nitrst, numrow, 'sbc_hc_b', sbc_tsc(:,:,jp_tem) )
214         CALL iom_rstput( kt, nitrst, numrow, 'sbc_sc_b', sbc_tsc(:,:,jp_sal) )
215      ENDIF
216      !
[4990]217      !
[2528]218      !----------------------------------------
[4990]219      !       Ice Shelf effects (ISF)
220      !     tbl treated as in Losh (2008) JGR
221      !----------------------------------------
222      !
223      IF( nn_isf > 0 ) THEN
224         zfact = 0.5e0
225         DO jj = 2, jpj
226            DO ji = fs_2, fs_jpim1
227         
228               ikt = misfkt(ji,jj)
229               ikb = misfkb(ji,jj)
230   
231               ! level fully include in the ice shelf boundary layer
232               ! if isfdiv, we have to remove heat flux due to inflow at 0oC (as in rnf when you add rnf at sst)
233               ! sign - because fwf sign of evapo (rnf sign of precip)
234               DO jk = ikt, ikb - 1
235               ! compute tfreez for the temperature correction (we add water at freezing temperature)
236!                  zpress = grav*rau0*fsdept(ji,jj,jk)*1.e-04
237                  zt_frz = -1.9 !eos_fzp( tsn(ji,jj,jk,jp_sal), zpress )
238               ! compute trend
239                  tsa(ji,jj,jk,jp_tem) = tsa(ji,jj,jk,jp_tem)                                          &
240                     &           + zfact * (risf_tsc_b(ji,jj,jp_tem) + risf_tsc(ji,jj,jp_tem)          &
241                     &               - rdivisf * (fwfisf(ji,jj) + fwfisf_b(ji,jj)) * zt_frz * r1_rau0) &
242                     &           * r1_hisf_tbl(ji,jj)
243                  tsa(ji,jj,jk,jp_sal) = tsa(ji,jj,jk,jp_sal)                                          &
244                     &           + zfact * (risf_tsc_b(ji,jj,jp_sal) + risf_tsc(ji,jj,jp_sal)) * r1_hisf_tbl(ji,jj)
245               END DO
246   
247               ! level partially include in ice shelf boundary layer
248               ! compute tfreez for the temperature correction (we add water at freezing temperature)
249!               zpress = grav*rau0*fsdept(ji,jj,ikb)*1.e-04
250               zt_frz = -1.9 !eos_fzp( tsn(ji,jj,ikb,jp_sal), zpress )
251               ! compute trend
252               tsa(ji,jj,ikb,jp_tem) = tsa(ji,jj,ikb,jp_tem)                                           &
253                  &              + zfact * (risf_tsc_b(ji,jj,jp_tem) + risf_tsc(ji,jj,jp_tem)          &
254                  &                  - rdivisf * (fwfisf(ji,jj) + fwfisf_b(ji,jj)) * zt_frz * r1_rau0) & 
255                  &              * r1_hisf_tbl(ji,jj) * ralpha(ji,jj)
256               tsa(ji,jj,ikb,jp_sal) = tsa(ji,jj,ikb,jp_sal)                                           &
257                  &              + zfact * (risf_tsc_b(ji,jj,jp_sal) + risf_tsc(ji,jj,jp_sal)) * r1_hisf_tbl(ji,jj) * ralpha(ji,jj) 
258            END DO
259         END DO
260         IF( lrst_oce ) THEN
261            IF(lwp) WRITE(numout,*)
262            IF(lwp) WRITE(numout,*) 'sbc : isf surface tracer content forcing fields written in ocean restart file ',   &
263               &                    'at it= ', kt,' date= ', ndastp
264            IF(lwp) WRITE(numout,*) '~~~~'
265            CALL iom_rstput( kt, nitrst, numrow, 'fwf_isf_b', fwfisf(:,:)          )
266            CALL iom_rstput( kt, nitrst, numrow, 'isf_hc_b' , risf_tsc(:,:,jp_tem) )
267            CALL iom_rstput( kt, nitrst, numrow, 'isf_sc_b' , risf_tsc(:,:,jp_sal) )
268         ENDIF
269      END IF
270      !
271      !----------------------------------------
[2528]272      !        River Runoff effects
273      !----------------------------------------
274      !
[3764]275      IF( ln_rnf ) THEN         ! input of heat and salt due to river runoff
276         zfact = 0.5_wp
[2528]277         DO jj = 2, jpj 
278            DO ji = fs_2, fs_jpim1
[3764]279               IF( rnf(ji,jj) /= 0._wp ) THEN
280                  zdep = zfact / h_rnf(ji,jj)
[2528]281                  DO jk = 1, nk_rnf(ji,jj)
282                                        tsa(ji,jj,jk,jp_tem) = tsa(ji,jj,jk,jp_tem)   &
283                                          &               +  ( rnf_tsc_b(ji,jj,jp_tem) + rnf_tsc(ji,jj,jp_tem) ) * zdep
284                     IF( ln_rnf_sal )   tsa(ji,jj,jk,jp_sal) = tsa(ji,jj,jk,jp_sal)   &
285                                          &               +  ( rnf_tsc_b(ji,jj,jp_sal) + rnf_tsc(ji,jj,jp_sal) ) * zdep 
[2715]286                  END DO
[2528]287               ENDIF
[2715]288            END DO 
289         END DO 
[3764]290      ENDIF
291 
[4990]292      IF( l_trdtra )   THEN                      ! send trends for further diagnostics
[2528]293         ztrdt(:,:,:) = tsa(:,:,:,jp_tem) - ztrdt(:,:,:)
294         ztrds(:,:,:) = tsa(:,:,:,jp_sal) - ztrds(:,:,:)
[4990]295         CALL trd_tra( kt, 'TRA', jp_tem, jptra_nsr, ztrdt )
296         CALL trd_tra( kt, 'TRA', jp_sal, jptra_nsr, ztrds )
[3294]297         CALL wrk_dealloc( jpi, jpj, jpk, ztrdt, ztrds ) 
[216]298      ENDIF
[503]299      !
[2528]300      IF(ln_ctl)   CALL prt_ctl( tab3d_1=tsa(:,:,:,jp_tem), clinfo1=' sbc  - Ta: ', mask1=tmask,   &
301         &                       tab3d_2=tsa(:,:,:,jp_sal), clinfo2=       ' Sa: ', mask2=tmask, clinfo3='tra' )
[503]302      !
[3294]303      IF( nn_timing == 1 )  CALL timing_stop('tra_sbc')
304      !
[3]305   END SUBROUTINE tra_sbc
306
307   !!======================================================================
308END MODULE trasbc
Note: See TracBrowser for help on using the repository browser.