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

Last change on this file since 2636 was 2636, checked in by gm, 13 years ago

dynamic mem: #785 ; move ctl_stop & warn in lib_mpp to avoid a circular dependency + ctl_stop improvment

  • Property svn:keywords set to Id
File size: 6.1 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   USE lib_mpp         ! MPP library
24
25   IMPLICIT NONE
26   PRIVATE
27
28   PUBLIC   trc_sbc   ! routine called by step.F90
29
30   !! * Substitutions
31#  include "top_substitute.h90"
32   !!----------------------------------------------------------------------
33   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
34   !! $Id$
35   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
36   !!----------------------------------------------------------------------
37CONTAINS
38
39   SUBROUTINE trc_sbc ( kt )
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      !!            tra = tra + emp * trn / e3t   for k=1
52      !!         where emp, the surface freshwater budget (evaporation minus
53      !!         precipitation minus runoff) 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 tra with the trend associated
57      !!                with the tracer surface boundary condition
58      !!
59      !!----------------------------------------------------------------------
60      USE wrk_nemo, ONLY: wrk_in_use, wrk_not_released
61      USE wrk_nemo, zemps => wrk_2d_1
62      !
63      INTEGER, INTENT( in ) ::   kt          ! ocean time-step index
64      !
65      INTEGER  ::   ji, jj, jn           ! dummy loop indices
66      REAL(wp) ::   zsrau, zse3t   ! temporary scalars
67      REAL(wp), DIMENSION(:,:,:), ALLOCATABLE ::   ztrtrd
68      CHARACTER (len=22) :: charout
69      !!----------------------------------------------------------------------
70
71      IF(wrk_in_use(2, 1))THEN
72         CALL ctl_stop('trc_sbc: requested workspace array unavailable.')   ;   RETURN
73      END IF
74
75      IF( kt == nit000 ) THEN
76         IF(lwp) WRITE(numout,*)
77         IF(lwp) WRITE(numout,*) 'trc_sbc : Passive tracers surface boundary condition'
78         IF(lwp) WRITE(numout,*) '~~~~~~~ '
79      ENDIF
80
81
82      IF( l_trdtrc ) ALLOCATE( ztrtrd(jpi,jpj,jpk) )
83
84      IF( lk_offline ) THEN          ! emps in dynamical files contains emps - rnf
85         zemps(:,:) = emps(:,:) 
86      ELSE                           ! Concentration dilution effect on tracer due to evaporation, precipitation, and river runoff
87         IF( lk_vvl ) THEN                      ! volume variable
88            zemps(:,:) = emps(:,:) - emp(:,:)   
89!!ch         zemps(:,:) = 0.
90         ELSE                                   ! linear free surface
91            IF( ln_rnf ) THEN  ;  zemps(:,:) = emps(:,:) - rnf(:,:)   !  E-P-R
92            ELSE               ;  zemps(:,:) = emps(:,:)
93            ENDIF
94         ENDIF
95      ENDIF 
96
97      ! 0. initialization
98      zsrau = 1. / rau0
99      DO jn = 1, jptra
100         !
101         IF( l_trdtrc ) ztrtrd(:,:,:) = tra(:,:,:,jn)  ! save trends
102         !                                             ! add the trend to the general tracer trend
103         DO jj = 2, jpj
104            DO ji = fs_2, fs_jpim1   ! vector opt.
105               zse3t = 1. / fse3t(ji,jj,1)
106               tra(ji,jj,1,jn) = tra(ji,jj,1,jn) + zemps(ji,jj) *  zsrau * trn(ji,jj,1,jn) * zse3t
107            END DO
108         END DO
109         
110         IF( l_trdtrc ) THEN
111            ztrtrd(:,:,:) = tra(:,:,:,jn) - ztrtrd(:,:,:)
112            CALL trd_tra( kt, 'TRC', jn, jptra_trd_nsr, ztrtrd )
113         END IF
114         !                                                       ! ===========
115      END DO                                                     ! tracer loop
116      !                                                          ! ===========
117      IF( l_trdtrc ) DEALLOCATE( ztrtrd )
118
119      IF( ln_ctl )   THEN
120         WRITE(charout, FMT="('sbc ')") ;  CALL prt_ctl_trc_info(charout)
121                                           CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' )
122      ENDIF
123
124      IF( wrk_not_released(2, 1) )   CALL ctl_stop('trc_sbc: failed to release workspace array')
125      !
126   END SUBROUTINE trc_sbc
127
128#else
129   !!----------------------------------------------------------------------
130   !!   Dummy module :                      NO passive tracer
131   !!----------------------------------------------------------------------
132CONTAINS
133   SUBROUTINE trc_sbc (kt)              ! Empty routine
134      INTEGER, INTENT(in) :: kt
135      WRITE(*,*) 'trc_sbc: You should not have seen this print! error?', kt
136   END SUBROUTINE trc_sbc
137#endif
138   
139   !!======================================================================
140END MODULE trcsbc
Note: See TracBrowser for help on using the repository browser.