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 @ 5184

Last change on this file since 5184 was 5184, checked in by vancop, 9 years ago

TOP ice routines

  • Property svn:keywords set to Id
File size: 9.2 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   !! * Substitutions
32#  include "top_substitute.h90"
33   !!----------------------------------------------------------------------
34   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
35   !! $Id$
36   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
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
54      !!         precipitation ) given in kg/m2/s is divided
55      !!         by 1035 kg/m3 (density of ocean water) to obtain m/s.
56      !!
57      !! ** Action  : - Update the 1st level of tra with the trend associated
58      !!                with the tracer surface boundary condition
59      !!
60      !!----------------------------------------------------------------------
61      !
62      INTEGER, INTENT( in ) ::   kt          ! ocean time-step index
63      !
64      INTEGER  ::   ji, jj, jn                                     ! dummy loop indices
65      REAL(wp) ::   zsrau, zse3t                                   ! temporary scalars
66      REAL(wp) ::   zswitch, zftra, zcd, zdtra, ztfx, ztra, zeuler ! temporary scalars
67      CHARACTER (len=22) :: charout
68      REAL(wp), POINTER, DIMENSION(:,:  ) :: zsfx
69      REAL(wp), POINTER, DIMENSION(:,:,:) :: ztrtrd
70
71      !!---------------------------------------------------------------------
72      !
73      IF( nn_timing == 1 )  CALL timing_start('trc_sbc')
74      !
75      ! Allocate temporary workspace
76                      CALL wrk_alloc( jpi, jpj,      zsfx   )
77      IF( l_trdtrc )  CALL wrk_alloc( jpi, jpj, jpk, ztrtrd )
78
79      SELECT CASE( nn_ice_embd )         ! levitating or embedded sea-ice option
80         CASE( 0    )   ;   zswitch = 1  ! (0) standard levitating sea-ice : salt exchange only
81         CASE( 1, 2 )   ;   zswitch = 0  ! (1) levitating sea-ice: salt and volume exchange but no pressure effect                               
82                                         ! (2) embedded sea-ice : salt and volume fluxes and pressure
83      END SELECT
84
85      IF( kt == nittrc000 ) THEN
86         IF(lwp) WRITE(numout,*)
87         IF(lwp) WRITE(numout,*) 'trc_sbc : Passive tracers surface boundary condition'
88         IF(lwp) WRITE(numout,*) '~~~~~~~ '
89      ENDIF
90
91      ! Coupling online : river runoff is added to the horizontal divergence (hdivn) in the subroutine sbc_rnf_div
92      ! one only consider the concentration/dilution effect due to evaporation minus precipitation + freezing/melting of sea-ice
93      ! Coupling offline : runoff are in emp which contains E-P-R
94      !
95      IF( .NOT. lk_offline .AND. lk_vvl ) THEN  ! online coupling with vvl
96         zsfx(:,:) = 0._wp
97      ELSE                                      ! online coupling free surface or offline with free surface
98         zsfx(:,:) = emp(:,:)
99      ENDIF
100
101      ! 0. initialization
102      zsrau = 1. / rau0
103
104      zeuler = 1.   ;  IF ( neuler .EQ. 0 ) zeuler = 0.
105
106      DO jn = 1, jptra
107         !
108         IF( l_trdtrc ) ztrtrd(:,:,:) = tra(:,:,:,jn)  ! save trends
109         !                                             ! add the trend to the general tracer trend
110
111         IF ( nn_ice_tr == -1 ) THEN  ! identical concentrations in ice and ocean (old code)
112
113            DO jj = 2, jpj
114               DO ji = fs_2, fs_jpim1   ! vector opt.
115                  zse3t = 1. / fse3t(ji,jj,1)
116                  tra(ji,jj,1,jn) = tra(ji,jj,1,jn) + zsfx(ji,jj) *  zsrau * trn(ji,jj,1,jn) * zse3t
117               END DO
118            END DO
119
120         ELSE
121
122            DO jj = 2, jpj
123               DO ji = fs_2, fs_jpim1   ! vector opt.
124   
125                  zse3t = 1. / fse3t(ji,jj,1)
126                 
127                  ! tracer flux at the ice/ocean interface (tracer/m2/s)
128                  zftra = - trc_i(ji,jj,jn) * fmmflx(ji,jj) ! uptake of tracer in the sea ice
129                  zcd   =   trc_o(ji,jj,jn) * fmmflx(ji,jj) ! concentration dilution due to freezing-melting,
130                                                               ! only used in the levitating sea ice case
131                  ! tracer flux only       : add concentration dilution term in net tracer flux, no F-M in volume flux
132                  ! tracer and mass fluxes : no concentration dilution term in net tracer flux, F-M term in volume flux
133                  ztfx  = zftra + zswitch * zcd                ! net tracer flux (+C/D if no ice/ocean mass exchange)
134   
135                  ! tracer change (left member: euler; right member:leapfrog)
136                  ztra = ( 1. - zeuler ) * trn(ji,jj,1,jn) + zeuler * trb(ji,jj,1,jn)
137                 
138                  ! MAX is there to avoid integral ocean uptake in the case of freezing (for iron)
139                  zdtra = MAX ( - ztra / r2dtra(1) , zsrau * ( ztfx + zsfx(ji,jj) * trn(ji,jj,1,jn) ) * zse3t ) ! tracer tendency
140                  ! r2dtra is time step
141                  tra(ji,jj,1,jn) = tra(ji,jj,1,jn) + zdtra ! new line
142   
143   !              IF ( ztfx .NE. 0.0 ) THEN
144   !                  WRITE(numout,*) ji, jj, jn
145   !                  WRITE(numout,*) ' trc_o  : ', trc_o(ji,jj,jn)
146   !                  WRITE(numout,*) ' trc_i  : ', trc_i(ji,jj,jn)
147   !                  WRITE(numout,*) ' fmmflx : ', fmmflx(ji,jj)
148   !                  WRITE(numout,*) ' zswitch: ', zswitch
149   !                  WRITE(numout,*) ' zcd   : ', zcd
150   !                  WRITE(numout,*) ' zftra : ', zftra
151   !                  WRITE(numout,*) ' ztfx  : ', ztfx
152   !                  WRITE(numout,*) ' zsrau : ', zsrau
153   !                  WRITE(numout,*) ' zsfx  : ', zsfx(ji,jj)
154   !                  WRITE(numout,*) ' zse3t : ', zse3t
155   !                  WRITE(numout,*) ' ztra  : ', ztra
156   !                  WRITE(numout,*) ' zdtra : ', zdtra
157   !                  WRITE(numout,*) ' Old tendency : ', zsfx(ji,jj) * zsrau * trn(ji,jj,1,jn) * zse3t
158   !              ENDIF
159   
160               END DO
161            END DO
162   
163         ENDIF
164         
165         IF( l_trdtrc ) THEN
166            ztrtrd(:,:,:) = tra(:,:,:,jn) - ztrtrd(:,:,:)
167            CALL trd_tra( kt, 'TRC', jn, jptra_nsr, ztrtrd )
168         END IF
169         !                                                       ! ===========
170      END DO                                                     ! tracer loop
171      !                                                          ! ===========
172      IF( ln_ctl )   THEN
173         WRITE(charout, FMT="('sbc ')") ;  CALL prt_ctl_trc_info(charout)
174                                           CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' )
175      ENDIF
176                      CALL wrk_dealloc( jpi, jpj,      zsfx   )
177      IF( l_trdtrc )  CALL wrk_dealloc( jpi, jpj, jpk, ztrtrd )
178      !
179      IF( nn_timing == 1 )  CALL timing_stop('trc_sbc')
180      !
181   END SUBROUTINE trc_sbc
182
183#else
184   !!----------------------------------------------------------------------
185   !!   Dummy module :                      NO passive tracer
186   !!----------------------------------------------------------------------
187CONTAINS
188   SUBROUTINE trc_sbc (kt)              ! Empty routine
189      INTEGER, INTENT(in) :: kt
190      WRITE(*,*) 'trc_sbc: You should not have seen this print! error?', kt
191   END SUBROUTINE trc_sbc
192#endif
193   
194   !!======================================================================
195END MODULE trcsbc
Note: See TracBrowser for help on using the repository browser.