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

source: branches/2014/dev_4707_CNRS04_bgc_ice/NEMOGCM/NEMO/TOP_SRC/TRP/trcsbc.F90 @ 4720

Last change on this file since 4720 was 4720, checked in by vancop, 10 years ago

[sea ice tracer boundary conditions ORCA2_LIM2 PISCES]

  • Property svn:keywords set to Id
File size: 9.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 trdmod_oce
22   USE trdtra
23   ! MV 2013
24   USE sbc_oce         ! Required to get access to fmmflx
25   USE dom_oce         ! Required to get access to r2dtra
26   ! END MV 2013
27
28   IMPLICIT NONE
29   PRIVATE
30
31   PUBLIC   trc_sbc   ! routine called by step.F90
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) ::   zsrau, zse3t   ! temporary scalars
68      CHARACTER (len=22) :: charout
69      REAL(wp), POINTER, DIMENSION(:,:  ) :: zsfx
70      REAL(wp), POINTER, DIMENSION(:,:,:) :: ztrtrd
71
72      ! MV 2013
73      REAL(wp) ::   zswitch    ,               &  ! virtual salt flux or vvl
74                    zftra      ,               &
75                    zcd        ,               &
76                    zdtra      ,               &
77                    ztfx       ,               &
78                    ztra       ,               &
79                    zeuler                        ! euler or leapfrog
80      ! END MV 2013
81      !!---------------------------------------------------------------------
82      !
83      IF( nn_timing == 1 )  CALL timing_start('trc_sbc')
84      !
85      ! Allocate temporary workspace
86                      CALL wrk_alloc( jpi, jpj,      zsfx   )
87      IF( l_trdtrc )  CALL wrk_alloc( jpi, jpj, jpk, ztrtrd )
88
89      ! MV 2013
90      SELECT CASE( nn_ice_embd )         ! levitating or embedded sea-ice option
91         CASE( 0    )   ;   zswitch = 1  ! (0) standard levitating sea-ice : salt exchange only
92         CASE( 1, 2 )   ;   zswitch = 0  ! (1) levitating sea-ice: salt and volume exchange but no pressure effect                               
93                                         ! (2) embedded sea-ice : salt and volume fluxes and pressure
94      END SELECT
95      ! END MV 2013
96
97      IF( kt == nittrc000 ) THEN
98         IF(lwp) WRITE(numout,*)
99         IF(lwp) WRITE(numout,*) 'trc_sbc : Passive tracers surface boundary condition'
100         IF(lwp) WRITE(numout,*) '~~~~~~~ '
101      ENDIF
102
103      ! Coupling online : river runoff is added to the horizontal divergence (hdivn) in the subroutine sbc_rnf_div
104      ! one only consider the concentration/dilution effect due to evaporation minus precipitation + freezing/melting of sea-ice
105      ! Coupling offline : runoff are in emp which contains E-P-R
106      !
107      IF( .NOT. lk_offline .AND. lk_vvl ) THEN  ! online coupling with vvl
108         zsfx(:,:) = 0._wp
109      ELSE                                      ! online coupling free surface or offline with free surface
110         zsfx(:,:) = emp(:,:)
111      ENDIF
112
113      ! 0. initialization
114      zsrau = 1. / rau0
115      IF ( neuler .EQ. 0 ) THEN
116          zeuler = 0.0
117      ELSE
118          zeuler = 1.0
119      ENDIF
120
121      i_code = 1
122
123      DO jn = 1, jptra
124         !
125         IF( l_trdtrc ) ztrtrd(:,:,:) = tra(:,:,:,jn)  ! save trends
126         !                                             ! add the trend to the general tracer trend
127!        MV 2013 sea ice tracers
128!        OLD LOOP
129         IF ( i_code == 0 ) THEN
130
131         DO jj = 2, jpj
132            DO ji = fs_2, fs_jpim1   ! vector opt.
133               zse3t = 1. / fse3t(ji,jj,1)
134               tra(ji,jj,1,jn) = tra(ji,jj,1,jn) + zsfx(ji,jj) *  zsrau * trn(ji,jj,1,jn) * zse3t
135            END DO
136         END DO
137!        NEW LOOP
138         
139         ELSE ! i_code
140
141         DO jj = 2, jpj
142            DO ji = fs_2, fs_jpim1   ! vector opt.
143
144               zse3t = 1. / fse3t(ji,jj,1)
145               
146               ! tracer flux at the ice/ocean interface (tracer/m2/s)
147               zftra = - trc_i(ji,jj,jn) * fmmflx(ji,jj) ! uptake of tracer in the sea ice
148               zcd   =   trc_o(ji,jj,jn) * fmmflx(ji,jj) ! concentration dilution due to freezing-melting,
149                                                            ! only used in the levitating sea ice case
150               ! tracer flux only       : add concentration dilution term in net tracer flux, no F-M in volume flux
151               ! tracer and mass fluxes : no concentration dilution term in net tracer flux, F-M term in volume flux
152               ztfx  = zftra + zswitch * zcd                ! net tracer flux (+C/D if no ice/ocean mass exchange)
153
154               ! tracer change (left member: euler; right member:leapfrog)
155               ztra = ( 1. - zeuler ) * trn(ji,jj,1,jn) + zeuler * trb(ji,jj,1,jn)
156               
157               ! MAX is there to avoid integral ocean uptake in the case of freezing (for iron)
158               zdtra = MAX ( - ztra / r2dtra(1) , zsrau * ( ztfx + zsfx(ji,jj) * trn(ji,jj,1,jn) ) * zse3t ) ! tracer tendency
159               ! r2dtra is time step
160               tra(ji,jj,1,jn) = tra(ji,jj,1,jn) + zdtra ! new line
161
162!              IF ( ztfx .NE. 0.0 ) THEN
163!                  WRITE(numout,*) ji, jj, jn
164!                  WRITE(numout,*) ' trc_o  : ', trc_o(ji,jj,jn)
165!                  WRITE(numout,*) ' trc_i  : ', trc_i(ji,jj,jn)
166!                  WRITE(numout,*) ' fmmflx : ', fmmflx(ji,jj)
167!                  WRITE(numout,*) ' zswitch: ', zswitch
168!                  WRITE(numout,*) ' zcd   : ', zcd
169!                  WRITE(numout,*) ' zftra : ', zftra
170!                  WRITE(numout,*) ' ztfx  : ', ztfx
171!                  WRITE(numout,*) ' zsrau : ', zsrau
172!                  WRITE(numout,*) ' zsfx  : ', zsfx(ji,jj)
173!                  WRITE(numout,*) ' zse3t : ', zse3t
174!                  WRITE(numout,*) ' ztra  : ', ztra
175!                  WRITE(numout,*) ' zdtra : ', zdtra
176!                  WRITE(numout,*) ' Old tendency : ', zsfx(ji,jj) * zsrau * trn(ji,jj,1,jn) * zse3t
177!              ENDIF
178
179            END DO
180         END DO
181
182         ENDIF ! i_code
183!        END MV 2013
184         
185         IF( l_trdtrc ) THEN
186            ztrtrd(:,:,:) = tra(:,:,:,jn) - ztrtrd(:,:,:)
187            CALL trd_tra( kt, 'TRC', jn, jptra_trd_nsr, ztrtrd )
188         END IF
189         !                                                       ! ===========
190      END DO                                                     ! tracer loop
191      !                                                          ! ===========
192      IF( ln_ctl )   THEN
193         WRITE(charout, FMT="('sbc ')") ;  CALL prt_ctl_trc_info(charout)
194                                           CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' )
195      ENDIF
196                      CALL wrk_dealloc( jpi, jpj,      zsfx   )
197      IF( l_trdtrc )  CALL wrk_dealloc( jpi, jpj, jpk, ztrtrd )
198      !
199      IF( nn_timing == 1 )  CALL timing_stop('trc_sbc')
200      !
201   END SUBROUTINE trc_sbc
202
203#else
204   !!----------------------------------------------------------------------
205   !!   Dummy module :                      NO passive tracer
206   !!----------------------------------------------------------------------
207CONTAINS
208   SUBROUTINE trc_sbc (kt)              ! Empty routine
209      INTEGER, INTENT(in) :: kt
210      WRITE(*,*) 'trc_sbc: You should not have seen this print! error?', kt
211   END SUBROUTINE trc_sbc
212#endif
213   
214   !!======================================================================
215END MODULE trcsbc
Note: See TracBrowser for help on using the repository browser.