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 NEMO/trunk/src/TOP/TRP – NEMO

source: NEMO/trunk/src/TOP/TRP/trcsbc.F90 @ 12377

Last change on this file since 12377 was 12377, checked in by acc, 4 years ago

The big one. Merging all 2019 developments from the option 1 branch back onto the trunk.

This changeset reproduces 2019/dev_r11943_MERGE_2019 on the trunk using a 2-URL merge
onto a working copy of the trunk. I.e.:

svn merge --ignore-ancestry \

svn+ssh://acc@forge.ipsl.jussieu.fr/ipsl/forge/projets/nemo/svn/NEMO/trunk \
svn+ssh://acc@forge.ipsl.jussieu.fr/ipsl/forge/projets/nemo/svn/NEMO/branches/2019/dev_r11943_MERGE_2019 ./

The --ignore-ancestry flag avoids problems that may otherwise arise from the fact that
the merge history been trunk and branch may have been applied in a different order but
care has been taken before this step to ensure that all applicable fixes and updates
are present in the merge branch.

The trunk state just before this step has been branched to releases/release-4.0-HEAD
and that branch has been immediately tagged as releases/release-4.0.2. Any fixes
or additions in response to tickets on 4.0, 4.0.1 or 4.0.2 should be done on
releases/release-4.0-HEAD. From now on future 'point' releases (e.g. 4.0.2) will
remain unchanged with periodic releases as needs demand. Note release-4.0-HEAD is a
transitional naming convention. Future full releases, say 4.2, will have a release-4.2
branch which fulfills this role and the first point release (e.g. 4.2.0) will be made
immediately following the release branch creation.

2020 developments can be started from any trunk revision later than this one.

  • Property svn:keywords set to Id
File size: 10.0 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 iom
22   USE trd_oce
23   USE trdtra
24
25   IMPLICIT NONE
26   PRIVATE
27
28   PUBLIC   trc_sbc   ! routine called by step.F90
29
30   !! * Substitutions
31#  include "do_loop_substitute.h90"
32   !!----------------------------------------------------------------------
33   !! NEMO/TOP 4.0 , NEMO Consortium (2018)
34   !! $Id$
35   !! Software governed by the CeCILL license (see ./LICENSE)
36   !!----------------------------------------------------------------------
37CONTAINS
38
39   SUBROUTINE trc_sbc ( kt, Kmm, ptr, Krhs )
40      !!----------------------------------------------------------------------
41      !!                  ***  ROUTINE trc_sbc  ***
42      !!                   
43      !! ** Purpose :   Compute the tracer surface boundary condition trend of
44      !!      (concentration/dilution effect) and add it to the general
45      !!       trend of tracer equations.
46      !!
47      !! ** Method :
48      !!      * concentration/dilution effect:
49      !!            The surface freshwater flux modify the ocean volume
50      !!         and thus the concentration of a tracer as :
51      !!            tr(Krhs) = tr(Krhs) + emp * tr(Kmm) / e3t   for k=1
52      !!         where emp, the surface freshwater budget (evaporation minus
53      !!         precipitation ) given in kg/m2/s is divided
54      !!         by 1035 kg/m3 (density of ocean water) to obtain m/s.
55      !!
56      !! ** Action  : - Update the 1st level of tr(:,:,:,:,Krhs) with the trend associated
57      !!                with the tracer surface boundary condition
58      !!
59      !!----------------------------------------------------------------------
60      INTEGER,                                    INTENT(in   ) :: kt        ! ocean time-step index
61      INTEGER,                                    INTENT(in   ) :: Kmm, Krhs ! time level indices
62      REAL(wp), DIMENSION(jpi,jpj,jpk,jptra,jpt), INTENT(inout) :: ptr       ! passive tracers and RHS of tracer equation
63      !
64      INTEGER  ::   ji, jj, jn                      ! dummy loop indices
65      REAL(wp) ::   zse3t, zrtrn, zfact     ! local scalars
66      REAL(wp) ::   zftra, zdtra, ztfx, ztra   !   -      -
67      CHARACTER (len=22) :: charout
68      REAL(wp), DIMENSION(jpi,jpj)   ::   zsfx
69      REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) ::   ztrtrd
70      !!---------------------------------------------------------------------
71      !
72      IF( ln_timing )   CALL timing_start('trc_sbc')
73      !
74      ! Allocate temporary workspace
75      IF( l_trdtrc )  ALLOCATE( ztrtrd(jpi,jpj,jpk) )
76      !
77      zrtrn = 1.e-15_wp
78
79      IF( kt == nittrc000 ) THEN
80         IF(lwp) WRITE(numout,*)
81         IF(lwp) WRITE(numout,*) 'trc_sbc : Passive tracers surface boundary condition'
82         IF(lwp) WRITE(numout,*) '~~~~~~~ '
83         !
84         IF( ln_rsttr .AND. .NOT.ln_top_euler .AND.   &                     ! Restart: read in restart  file
85            iom_varid( numrtr, 'sbc_'//TRIM(ctrcnm(1))//'_b', ldstop = .FALSE. ) > 0 ) THEN
86            IF(lwp) WRITE(numout,*) '          nittrc000-1 surface tracer content forcing fields read in the restart file'
87            zfact = 0.5_wp
88            DO jn = 1, jptra
89               CALL iom_get( numrtr, jpdom_autoglo, 'sbc_'//TRIM(ctrcnm(jn))//'_b', sbc_trc_b(:,:,jn) )   ! before tracer content sbc
90            END DO
91         ELSE                                         ! No restart or restart not found: Euler forward time stepping
92           zfact = 1._wp
93           sbc_trc_b(:,:,:) = 0._wp
94         ENDIF
95      ELSE                                         ! Swap of forcing fields
96         IF( ln_top_euler ) THEN
97            zfact = 1._wp
98            sbc_trc_b(:,:,:) = 0._wp
99         ELSE
100            zfact = 0.5_wp
101            sbc_trc_b(:,:,:) = sbc_trc(:,:,:)
102         ENDIF
103         !
104      ENDIF
105
106      ! Coupling online : river runoff is added to the horizontal divergence (hdiv) 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.ln_linssh ) 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      SELECT CASE ( nn_ice_tr )
118
119      CASE ( -1 ) ! No tracers in sea ice (null concentration in sea ice)
120         !
121         DO jn = 1, jptra
122            DO_2D_01_00
123               sbc_trc(ji,jj,jn) = zsfx(ji,jj) * r1_rau0 * ptr(ji,jj,1,jn,Kmm)
124            END_2D
125         END DO
126         !
127      CASE ( 0 )  ! Same concentration in sea ice and in the ocean
128         !
129         DO jn = 1, jptra
130            DO_2D_01_00
131               sbc_trc(ji,jj,jn) = ( zsfx(ji,jj) + fmmflx(ji,jj) ) * r1_rau0 * ptr(ji,jj,1,jn,Kmm)
132            END_2D
133         END DO
134         !
135      CASE ( 1 )  ! Specific treatment of sea ice fluxes with an imposed concentration in sea ice
136         !
137         DO jn = 1, jptra
138            DO_2D_01_00
139               zse3t = 1. / e3t(ji,jj,1,Kmm)
140               ! tracer flux at the ice/ocean interface (tracer/m2/s)
141               zftra = - trc_i(ji,jj,jn) * fmmflx(ji,jj) ! uptake of tracer in the sea ice
142               !                                         ! only used in the levitating sea ice case
143               ! tracer flux only       : add concentration dilution term in net tracer flux, no F-M in volume flux
144               ! tracer and mass fluxes : no concentration dilution term in net tracer flux, F-M term in volume flux
145               ztfx  = zftra                        ! net tracer flux
146               !
147               zdtra = r1_rau0 * ( ztfx + ( zsfx(ji,jj) + fmmflx(ji,jj) ) * ptr(ji,jj,1,jn,Kmm) ) 
148               IF ( zdtra < 0. ) THEN
149                  zdtra  = MAX(zdtra, -ptr(ji,jj,1,jn,Kmm) * e3t(ji,jj,1,Kmm) / r2dttrc )   ! avoid negative concentrations to arise
150               ENDIF
151               sbc_trc(ji,jj,jn) =  zdtra 
152            END_2D
153         END DO
154      END SELECT
155      !
156      CALL lbc_lnk( 'trcsbc', sbc_trc(:,:,:), 'T', 1. )
157      !                                       Concentration dilution effect on tracers due to evaporation & precipitation
158      DO jn = 1, jptra
159         !
160         IF( l_trdtrc )   ztrtrd(:,:,:) = ptr(:,:,:,jn,Krhs)  ! save trends
161         !
162         DO_2D_01_00
163            zse3t = zfact / e3t(ji,jj,1,Kmm)
164            ptr(ji,jj,1,jn,Krhs) = ptr(ji,jj,1,jn,Krhs) + ( sbc_trc_b(ji,jj,jn) + sbc_trc(ji,jj,jn) ) * zse3t
165         END_2D
166         !
167         IF( l_trdtrc ) THEN
168            ztrtrd(:,:,:) = ptr(:,:,:,jn,Krhs) - ztrtrd(:,:,:)
169            CALL trd_tra( kt, Kmm, Krhs, 'TRC', jn, jptra_nsr, ztrtrd )
170         END IF
171         !                                                       ! ===========
172      END DO                                                     ! tracer loop
173      !                                                          ! ===========
174      !
175      !                                           Write in the tracer restar  file
176      !                                          *******************************
177      IF( lrst_trc .AND. .NOT.ln_top_euler ) THEN
178         IF(lwp) WRITE(numout,*)
179         IF(lwp) WRITE(numout,*) 'sbc : ocean surface tracer content forcing fields written in tracer restart file ',   &
180            &                    'at it= ', kt,' date= ', ndastp
181         IF(lwp) WRITE(numout,*) '~~~~'
182         DO jn = 1, jptra
183            CALL iom_rstput( kt, nitrst, numrtw, 'sbc_'//TRIM(ctrcnm(jn))//'_b', sbc_trc(:,:,jn) )
184         END DO
185      ENDIF
186      !
187      IF( sn_cfctl%l_prttrc )   THEN
188         WRITE(charout, FMT="('sbc ')") ;  CALL prt_ctl_trc_info(charout)
189                                           CALL prt_ctl_trc( tab4d=ptr(:,:,:,:,Krhs), mask=tmask, clinfo=ctrcnm, clinfo2='trd' )
190      ENDIF
191      IF( l_trdtrc )  DEALLOCATE( ztrtrd )
192      !
193      IF( ln_timing )   CALL timing_stop('trc_sbc')
194      !
195   END SUBROUTINE trc_sbc
196
197#else
198   !!----------------------------------------------------------------------
199   !!   Dummy module :                      NO passive tracer
200   !!----------------------------------------------------------------------
201   USE par_oce
202   USE par_trc
203CONTAINS
204   SUBROUTINE trc_sbc ( kt, Kmm, ptr, Krhs )      ! Empty routine
205      INTEGER,                                    INTENT(in   ) :: kt        ! ocean time-step index
206      INTEGER,                                    INTENT(in   ) :: Kmm, Krhs ! time level indices
207      REAL(wp), DIMENSION(jpi,jpj,jpk,jptra,jpt), INTENT(inout) :: ptr       ! passive tracers and RHS of tracer equation
208      WRITE(*,*) 'trc_sbc: You should not have seen this print! error?', kt
209   END SUBROUTINE trc_sbc
210#endif
211   
212   !!======================================================================
213END MODULE trcsbc
Note: See TracBrowser for help on using the repository browser.