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

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

A few cosmetic changes before SETTE

  • 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) ::   zse3t                                          ! temporary scalars
66      REAL(wp) ::   zswitch, zftra, zcd, zdtra, ztfx, ztra         ! 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      WRITE(numout,*) ' trc_sbc initial values', trn(3,2,1,2), trb(3,2,1,2), tra(3,2,1,2)
102
103      ! 0. initialization
104      DO jn = 1, jptra
105         !
106         IF( l_trdtrc ) ztrtrd(:,:,:) = tra(:,:,:,jn)  ! save trends
107         !                                             ! add the trend to the general tracer trend
108
109         IF ( nn_ice_tr == -1 ) THEN  ! identical concentrations in ice and ocean (old code)
110
111            DO jj = 2, jpj
112               DO ji = fs_2, fs_jpim1   ! vector opt.
113                  zse3t = 1. / fse3t(ji,jj,1)
114                  tra(ji,jj,1,jn) = tra(ji,jj,1,jn) + zsfx(ji,jj) * r1_rau0 * trn(ji,jj,1,jn) * zse3t
115               END DO
116            END DO
117
118         ELSE
119
120            DO jj = 2, jpj
121               DO ji = fs_2, fs_jpim1   ! vector opt.
122
123                  zse3t = 1. / fse3t(ji,jj,1)
124                 
125                  ! tracer flux at the ice/ocean interface (tracer/m2/s)
126                  zftra = - trc_i(ji,jj,jn) * fmmflx(ji,jj) ! uptake of tracer in the sea ice
127                  zcd   =   trc_o(ji,jj,jn) * fmmflx(ji,jj) ! concentration dilution due to freezing-melting,
128                                                               ! only used in the levitating sea ice case
129                  ! tracer flux only       : add concentration dilution term in net tracer flux, no F-M in volume flux
130                  ! tracer and mass fluxes : no concentration dilution term in net tracer flux, F-M term in volume flux
131                  ztfx  = zftra + zswitch * zcd                ! net tracer flux (+C/D if no ice/ocean mass exchange)
132   
133                  zdtra = r1_rau0 * ( ztfx + zsfx(ji,jj) * trn(ji,jj,1,jn) ) * zse3t
134                  tra(ji,jj,1,jn) = MAX( tra(ji,jj,1,jn) + zdtra, 0.) ! avoid integral ocean uptake if freezing (for iron)
135   
136!                 IF ( ztfx .NE. 0.0 ) THEN
137                  IF ( ( ji .EQ. 3 ) .AND. ( jj .EQ. 2 )  .AND. ( jn .EQ. 2 ) ) THEN
138                      WRITE(numout,*) ji, jj, jn
139                      WRITE(numout,*) ' trn    : ', trn(ji,jj,1,jn)
140                      WRITE(numout,*) ' trb    : ', trb(ji,jj,1,jn)
141                      WRITE(numout,*) ' tra    : ', tra(ji,jj,1,jn)
142                      WRITE(numout,*) ' trc_o  : ', trc_o(ji,jj,jn)
143                      WRITE(numout,*) ' trc_i  : ', trc_i(ji,jj,jn)
144                      WRITE(numout,*) ' fmmflx : ', fmmflx(ji,jj)
145                      WRITE(numout,*) ' zswitch: ', zswitch
146                      WRITE(numout,*) ' zcd   : ', zcd
147                      WRITE(numout,*) ' zftra : ', zftra
148                      WRITE(numout,*) ' ztfx  : ', ztfx
149                      WRITE(numout,*) ' r1_rau0 : ', r1_rau0
150                      WRITE(numout,*) ' zsfx  : ', zsfx(ji,jj)
151                      WRITE(numout,*) ' zse3t : ', zse3t
152                      WRITE(numout,*) ' ztra  : ', ztra
153                      WRITE(numout,*) ' zdtra : ', zdtra
154                      WRITE(numout,*) ' Old tendency : ', zsfx(ji,jj) * r1_rau0 * trn(ji,jj,1,jn) * zse3t
155                  ENDIF
156   
157               END DO
158            END DO
159   
160         ENDIF
161         
162         IF( l_trdtrc ) THEN
163            ztrtrd(:,:,:) = tra(:,:,:,jn) - ztrtrd(:,:,:)
164            CALL trd_tra( kt, 'TRC', jn, jptra_nsr, ztrtrd )
165         END IF
166         !                                                       ! ===========
167      END DO                                                     ! tracer loop
168      !                                                          ! ===========
169      IF( ln_ctl )   THEN
170         WRITE(charout, FMT="('sbc ')") ;  CALL prt_ctl_trc_info(charout)
171                                           CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' )
172      ENDIF
173                      CALL wrk_dealloc( jpi, jpj,      zsfx   )
174      IF( l_trdtrc )  CALL wrk_dealloc( jpi, jpj, jpk, ztrtrd )
175      !
176      IF( nn_timing == 1 )  CALL timing_stop('trc_sbc')
177      !
178   END SUBROUTINE trc_sbc
179
180#else
181   !!----------------------------------------------------------------------
182   !!   Dummy module :                      NO passive tracer
183   !!----------------------------------------------------------------------
184CONTAINS
185   SUBROUTINE trc_sbc (kt)              ! Empty routine
186      INTEGER, INTENT(in) :: kt
187      WRITE(*,*) 'trc_sbc: You should not have seen this print! error?', kt
188   END SUBROUTINE trc_sbc
189#endif
190   
191   !!======================================================================
192END MODULE trcsbc
Note: See TracBrowser for help on using the repository browser.