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_r5171_CNRS_LIM3_seaicebgc/NEMOGCM/NEMO/TOP_SRC/TRP – NEMO

source: branches/2015/dev_r5171_CNRS_LIM3_seaicebgc/NEMOGCM/NEMO/TOP_SRC/TRP/trcsbc.F90 @ 5360

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

dev_r5171_CNRS_LIM3_seaicebgc : minor corrections

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