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.
trcsbc.F90 in branches/2015/dev_r5204_CNRS_PISCES_dcy/NEMOGCM/NEMO/TOP_SRC/TRP – NEMO

source: branches/2015/dev_r5204_CNRS_PISCES_dcy/NEMOGCM/NEMO/TOP_SRC/TRP/trcsbc.F90 @ 5367

Last change on this file since 5367 was 5367, checked in by cetlod, 9 years ago

NEMOGCM_dev_r5204_CNRS_PISCES_dcy : merge in dev_r5171_CNRS_LIM3_seaicebgc

  • Property svn:keywords set to Id
File size: 8.6 KB
RevLine 
[941]1MODULE trcsbc
2   !!==============================================================================
3   !!                       ***  MODULE  trcsbc  ***
4   !! Ocean passive tracers:  surface boundary condition
[1175]5   !!======================================================================
[2528]6   !! History :  8.2  !  1998-10  (G. Madec, G. Roullet, M. Imbard)  Original code
7   !!            8.2  !  2001-02  (D. Ludicone)  sea ice and free surface
8   !!            8.5  !  2002-06  (G. Madec)  F90: Free form and module
9   !!            9.0  !  2004-03  (C. Ethe)  adapted for passive tracers
10   !!                 !  2006-08  (C. Deltel) Diagnose ML trends for passive tracers
[941]11   !!==============================================================================
12#if defined key_top
13   !!----------------------------------------------------------------------
14   !!   'key_top'                                                TOP models
15   !!----------------------------------------------------------------------
16   !!   trc_sbc      : update the tracer trend at ocean surface
17   !!----------------------------------------------------------------------
[2715]18   USE oce_trc         ! ocean dynamics and active tracers variables
19   USE trc             ! ocean  passive tracers variables
20   USE prtctl_trc      ! Print control for debbuging
[4990]21   USE trd_oce
[2528]22   USE trdtra
[941]23
24   IMPLICIT NONE
25   PRIVATE
26
[2715]27   PUBLIC   trc_sbc   ! routine called by step.F90
[941]28
[5367]29   REAL(wp) ::   r2dt  !  time-step at surface
30
[941]31   !! * Substitutions
32#  include "top_substitute.h90"
33   !!----------------------------------------------------------------------
[2528]34   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
[1152]35   !! $Id$
[2715]36   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
[941]37   !!----------------------------------------------------------------------
38CONTAINS
39
40   SUBROUTINE trc_sbc ( kt )
41      !!----------------------------------------------------------------------
42      !!                  ***  ROUTINE trc_sbc  ***
43      !!                   
44      !! ** Purpose :   Compute the tracer surface boundary condition trend of
45      !!      (concentration/dilution effect) and add it to the general
46      !!       trend of tracer equations.
47      !!
48      !! ** Method :
49      !!      * concentration/dilution effect:
50      !!            The surface freshwater flux modify the ocean volume
51      !!         and thus the concentration of a tracer as :
52      !!            tra = tra + emp * trn / e3t   for k=1
53      !!         where emp, the surface freshwater budget (evaporation minus
[3680]54      !!         precipitation ) given in kg/m2/s is divided
[1739]55      !!         by 1035 kg/m3 (density of ocean water) to obtain m/s.
[941]56      !!
57      !! ** Action  : - Update the 1st level of tra with the trend associated
58      !!                with the tracer surface boundary condition
59      !!
60      !!----------------------------------------------------------------------
[2715]61      !
[941]62      INTEGER, INTENT( in ) ::   kt          ! ocean time-step index
[2715]63      !
[5367]64      INTEGER  ::   ji, jj, jn                                     ! dummy loop indices
65      REAL(wp) ::   zse3t, zrtrn, zratio                           ! temporary scalars
66      REAL(wp) ::   zswitch, zftra, zcd, zdtra, ztfx, ztra         ! temporary scalars
[941]67      CHARACTER (len=22) :: charout
[3625]68      REAL(wp), POINTER, DIMENSION(:,:  ) :: zsfx
[3294]69      REAL(wp), POINTER, DIMENSION(:,:,:) :: ztrtrd
[5367]70
[3294]71      !!---------------------------------------------------------------------
72      !
73      IF( nn_timing == 1 )  CALL timing_start('trc_sbc')
74      !
75      ! Allocate temporary workspace
[3625]76                      CALL wrk_alloc( jpi, jpj,      zsfx   )
[3294]77      IF( l_trdtrc )  CALL wrk_alloc( jpi, jpj, jpk, ztrtrd )
[5367]78      !
79      zrtrn = 1.e-15_wp
[941]80
[5367]81      SELECT CASE( nn_ice_embd )         ! levitating or embedded sea-ice option
82         CASE( 0    )   ;   zswitch = 1  ! (0) standard levitating sea-ice : salt exchange only
83         CASE( 1, 2 )   ;   zswitch = 0  ! (1) levitating sea-ice: salt and volume exchange but no pressure effect                               
84                                         ! (2) embedded sea-ice : salt and volume fluxes and pressure
85      END SELECT
86
87      IF( ln_top_euler) THEN
88         r2dt =  rdttrc(1)              ! = rdttrc (use Euler time stepping)
89      ELSE
90         IF( neuler == 0 .AND. kt == nittrc000 ) THEN     ! at nittrc000
91            r2dt = rdttrc(1)           ! = rdttrc (restarting with Euler time stepping)
92         ELSEIF( kt <= nittrc000 + nn_dttrc ) THEN          ! at nittrc000 or nittrc000+1
93            r2dt = 2. * rdttrc(1)       ! = 2 rdttrc (leapfrog)
94         ENDIF
95      ENDIF
96
97
[3294]98      IF( kt == nittrc000 ) THEN
[941]99         IF(lwp) WRITE(numout,*)
100         IF(lwp) WRITE(numout,*) 'trc_sbc : Passive tracers surface boundary condition'
101         IF(lwp) WRITE(numout,*) '~~~~~~~ '
102      ENDIF
103
[3680]104      ! Coupling online : river runoff is added to the horizontal divergence (hdivn) in the subroutine sbc_rnf_div
105      ! one only consider the concentration/dilution effect due to evaporation minus precipitation + freezing/melting of sea-ice
[3719]106      ! Coupling offline : runoff are in emp which contains E-P-R
107      !
108      IF( .NOT. lk_offline .AND. lk_vvl ) THEN  ! online coupling with vvl
109         zsfx(:,:) = 0._wp
110      ELSE                                      ! online coupling free surface or offline with free surface
[3681]111         zsfx(:,:) = emp(:,:)
[3680]112      ENDIF
[2528]113
[941]114      ! 0. initialization
115      DO jn = 1, jptra
[2528]116         !
[1175]117         IF( l_trdtrc ) ztrtrd(:,:,:) = tra(:,:,:,jn)  ! save trends
[2528]118         !                                             ! add the trend to the general tracer trend
[5367]119
120         IF ( nn_ice_tr == -1 ) THEN  ! No tracers in sea ice (null concentration in sea ice)
121
122            DO jj = 2, jpj
123               DO ji = fs_2, fs_jpim1   ! vector opt.
124                  zse3t = 1. / fse3t(ji,jj,1)
125                  tra(ji,jj,1,jn) = tra(ji,jj,1,jn) + zsfx(ji,jj) * r1_rau0 * trn(ji,jj,1,jn) * zse3t
126               END DO
[941]127            END DO
[5367]128
129         ELSE
130
131            DO jj = 2, jpj
132               DO ji = fs_2, fs_jpim1   ! vector opt.
133
134                  zse3t = 1. / fse3t(ji,jj,1)
135                 
136                  ! tracer flux at the ice/ocean interface (tracer/m2/s)
137                  zftra = - trc_i(ji,jj,jn) * fmmflx(ji,jj) ! uptake of tracer in the sea ice
138                  zcd   =   trc_o(ji,jj,jn) * fmmflx(ji,jj) ! concentration dilution due to freezing-melting,
139                                                               ! only used in the levitating sea ice case
140                  ! tracer flux only       : add concentration dilution term in net tracer flux, no F-M in volume flux
141                  ! tracer and mass fluxes : no concentration dilution term in net tracer flux, F-M term in volume flux
142                  ztfx  = zftra + zswitch * zcd                ! net tracer flux (+C/D if no ice/ocean mass exchange)
143   
144                  zdtra = r1_rau0 * ( ztfx + zsfx(ji,jj) * trn(ji,jj,1,jn) ) * zse3t
145                  IF ( zdtra < 0. ) THEN
146                     zratio = -zdtra * r2dt / ( trn(ji,jj,1,jn) + zrtrn )
147                     zdtra = MIN(1.0, zratio) * zdtra ! avoid negative concentrations to arise
148                  ENDIF
149                     
150                  tra(ji,jj,1,jn) = tra(ji,jj,1,jn) + zdtra 
151   
152               END DO
153            END DO
154   
155         ENDIF
[941]156         
[1175]157         IF( l_trdtrc ) THEN
158            ztrtrd(:,:,:) = tra(:,:,:,jn) - ztrtrd(:,:,:)
[4990]159            CALL trd_tra( kt, 'TRC', jn, jptra_nsr, ztrtrd )
[1175]160         END IF
161         !                                                       ! ===========
162      END DO                                                     ! tracer loop
163      !                                                          ! ===========
[2528]164      IF( ln_ctl )   THEN
165         WRITE(charout, FMT="('sbc ')") ;  CALL prt_ctl_trc_info(charout)
166                                           CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' )
[941]167      ENDIF
[3625]168                      CALL wrk_dealloc( jpi, jpj,      zsfx   )
[3294]169      IF( l_trdtrc )  CALL wrk_dealloc( jpi, jpj, jpk, ztrtrd )
170      !
171      IF( nn_timing == 1 )  CALL timing_stop('trc_sbc')
172      !
[941]173   END SUBROUTINE trc_sbc
174
175#else
176   !!----------------------------------------------------------------------
177   !!   Dummy module :                      NO passive tracer
178   !!----------------------------------------------------------------------
179CONTAINS
180   SUBROUTINE trc_sbc (kt)              ! Empty routine
181      INTEGER, INTENT(in) :: kt
182      WRITE(*,*) 'trc_sbc: You should not have seen this print! error?', kt
183   END SUBROUTINE trc_sbc
184#endif
185   
186   !!======================================================================
187END MODULE trcsbc
Note: See TracBrowser for help on using the repository browser.