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

source: branches/dev_r2586_dynamic_mem/NEMOGCM/NEMO/TOP_SRC/TRP/trcsbc.F90 @ 2633

Last change on this file since 2633 was 2633, checked in by trackstand2, 13 years ago

Renamed wrk_use => wrk_in_use and wrk_release => wrk_not_released

  • Property svn:keywords set to Id
File size: 6.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   !! * Modules used
19   USE oce_trc             ! ocean dynamics and active tracers variables
20   USE trc                 ! ocean  passive tracers variables
21   USE prtctl_trc          ! Print control for debbuging
22   USE trdmod_oce
23   USE trdtra
24
25   IMPLICIT NONE
26   PRIVATE
27
28   !! * Routine accessibility
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   !!----------------------------------------------------------------------
38
39CONTAINS
40
41   SUBROUTINE trc_sbc ( kt )
42      !!----------------------------------------------------------------------
43      !!                  ***  ROUTINE trc_sbc  ***
44      !!                   
45      !! ** Purpose :   Compute the tracer surface boundary condition trend of
46      !!      (concentration/dilution effect) and add it to the general
47      !!       trend of tracer equations.
48      !!
49      !! ** Method :
50      !!      * concentration/dilution effect:
51      !!            The surface freshwater flux modify the ocean volume
52      !!         and thus the concentration of a tracer as :
53      !!            tra = tra + emp * trn / e3t   for k=1
54      !!         where emp, the surface freshwater budget (evaporation minus
55      !!         precipitation minus runoff) given in kg/m2/s is divided
56      !!         by 1035 kg/m3 (density of ocean water) to obtain m/s.
57      !!
58      !! ** Action  : - Update the 1st level of tra with the trend associated
59      !!                with the tracer surface boundary condition
60      !!
61      !!----------------------------------------------------------------------
62      USE wrk_nemo, ONLY: wrk_in_use, wrk_not_released
63      USE wrk_nemo, zemps => wrk_2d_1
64      !! * Arguments
65      INTEGER, INTENT( in ) ::   kt          ! ocean time-step index
66
67      !! * Local declarations
68      INTEGER  ::   ji, jj, jn           ! dummy loop indices
69      REAL(wp) ::   zsrau, zse3t   ! temporary scalars
70      REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::   ztrtrd
71      CHARACTER (len=22) :: charout
72      !!----------------------------------------------------------------------
73
74      IF(wrk_in_use(2, 1))THEN
75         CALL ctl_stop('trc_sbc: requested workspace array unavailable.')
76         RETURN
77      END IF
78
79      IF( kt == nit000 ) THEN
80         IF(lwp) WRITE(numout,*)
81         IF(lwp) WRITE(numout,*) 'trc_sbc : Passive tracers surface boundary condition'
82         IF(lwp) WRITE(numout,*) '~~~~~~~ '
83      ENDIF
84
85
86      IF( l_trdtrc ) ALLOCATE( ztrtrd(jpi,jpj,jpk) )
87
88      IF( lk_offline ) THEN          ! emps in dynamical files contains emps - rnf
89         zemps(:,:) = emps(:,:) 
90      ELSE                           ! Concentration dilution effect on tracer due to evaporation, precipitation, and river runoff
91         IF( lk_vvl ) THEN                      ! volume variable
92            zemps(:,:) = emps(:,:) - emp(:,:)   
93!!ch         zemps(:,:) = 0.
94         ELSE                                   ! linear free surface
95            IF( ln_rnf ) THEN  ;  zemps(:,:) = emps(:,:) - rnf(:,:)   !  E-P-R
96            ELSE               ;  zemps(:,:) = emps(:,:)
97            ENDIF
98         ENDIF
99      ENDIF 
100
101      ! 0. initialization
102      zsrau = 1. / rau0
103      DO jn = 1, jptra
104         !
105         IF( l_trdtrc ) ztrtrd(:,:,:) = tra(:,:,:,jn)  ! save trends
106         !                                             ! add the trend to the general tracer trend
107         DO jj = 2, jpj
108            DO ji = fs_2, fs_jpim1   ! vector opt.
109               zse3t = 1. / fse3t(ji,jj,1)
110               tra(ji,jj,1,jn) = tra(ji,jj,1,jn) + zemps(ji,jj) *  zsrau * trn(ji,jj,1,jn) * zse3t
111            END DO
112         END DO
113         
114         IF( l_trdtrc ) THEN
115            ztrtrd(:,:,:) = tra(:,:,:,jn) - ztrtrd(:,:,:)
116            CALL trd_tra( kt, 'TRC', jn, jptra_trd_nsr, ztrtrd )
117         END IF
118         !                                                       ! ===========
119      END DO                                                     ! tracer loop
120      !                                                          ! ===========
121      IF( l_trdtrc ) DEALLOCATE( ztrtrd )
122
123      IF( ln_ctl )   THEN
124         WRITE(charout, FMT="('sbc ')") ;  CALL prt_ctl_trc_info(charout)
125                                           CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' )
126      ENDIF
127
128      IF(wrk_not_released(2, 1))THEN
129         CALL ctl_stop('trc_sbc: failed to release workspace array.')
130      END IF
131
132   END SUBROUTINE trc_sbc
133
134#else
135   !!----------------------------------------------------------------------
136   !!   Dummy module :                      NO passive tracer
137   !!----------------------------------------------------------------------
138CONTAINS
139   SUBROUTINE trc_sbc (kt)              ! Empty routine
140      INTEGER, INTENT(in) :: kt
141      WRITE(*,*) 'trc_sbc: You should not have seen this print! error?', kt
142   END SUBROUTINE trc_sbc
143#endif
144   
145   !!======================================================================
146END MODULE trcsbc
Note: See TracBrowser for help on using the repository browser.