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 on Ticket #1134 – Attachment – NEMO

Ticket #1134: trcsbc.F90

File trcsbc.F90, 6.6 KB (added by mouchet, 11 years ago)
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
24   IMPLICIT NONE
25   PRIVATE
26
27   PUBLIC   trc_sbc   ! routine called by step.F90
28!AM<
29   INTEGER, SAVE, DIMENSION(jptra) :: jn_tremp    ! tracer factors for emp
30!>AM
31
32   !! * Substitutions
33#  include "top_substitute.h90"
34   !!----------------------------------------------------------------------
35   !! NEMO/TOP 3.3 , NEMO Consortium (2010)
36   !! $Id: trcsbc.F90 3580 2012-11-16 14:49:18Z cetlod $
37   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
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!AM:
52      !!      If jn_tremp(jn) = 1 then
53      !!            The surface freshwater flux modify the ocean volume
54      !!         and thus the concentration of a tracer as :
55      !!            tra = tra + emp * trn / e3t   for k=1
56      !!         where emp, the surface freshwater budget (evaporation minus
57      !!         precipitation ) given in kg/m2/s is divided
58      !!         by 1035 kg/m3 (density of ocean water) to obtain m/s.
59      !!
60      !! ** Action  : - Update the 1st level of tra with the trend associated
61      !!                with the tracer surface boundary condition
62      !!
63      !!----------------------------------------------------------------------
64      !
65      INTEGER, INTENT( in ) ::   kt          ! ocean time-step index
66      !
67      INTEGER  ::   ji, jj, jn           ! dummy loop indices
68      REAL(wp) ::   zsrau, zse3t   ! temporary scalars
69      CHARACTER (len=22) :: charout
70      REAL(wp), POINTER, DIMENSION(:,:  ) :: zemps
71      REAL(wp), POINTER, DIMENSION(:,:,:) :: ztrtrd
72      !
73!AM<
74      NAMELIST/namtrc_emp/ jn_tremp
75!>AM
76      !!---------------------------------------------------------------------
77      !
78      IF( nn_timing == 1 )  CALL timing_start('trc_sbc')
79      !
80      ! Allocate temporary workspace
81                      CALL wrk_alloc( jpi, jpj,      zemps  )
82      IF( l_trdtrc )  CALL wrk_alloc( jpi, jpj, jpk, ztrtrd )
83
84      IF( kt == nittrc000 ) THEN
85!AM<
86         !! initialize jn_tremp
87         DO jn=1,jptra
88          jn_tremp(jn)=1
89         ENDDO
90!>AM
91         IF(lwp) WRITE(numout,*)
92         IF(lwp) WRITE(numout,*) 'trc_sbc : Passive tracers surface boundary condition'
93         IF(lwp) WRITE(numout,*) '~~~~~~~ '
94!AM<
95         REWIND( numnat )               ! read namelist_top
96         READ  ( numnat, namtrc_emp )
97         IF(lwp) WRITE(numout,*) 'jn_tremp',jn_tremp
98!>AM
99      ENDIF
100
101      ! Coupling online : river runoff is added to the horizontal divergence (hdivn) in the subroutine sbc_rnf_div
102      ! one only consider the concentration/dilution effect due to evaporation minus precipitation + freezing/melting of sea-ice
103
104      ! Coupling in offline, hdivn is computed from ocean horizontal velocities only ; the runoff are not included.
105      ! emps in dynamical files contains (emps - rnf)
106      IF( .NOT. lk_offline .AND. lk_vvl ) THEN  ! online coupling + volume variable
107         zemps(:,:) = emps(:,:) - emp(:,:)   
108      ELSE
109         zemps(:,:) = emps(:,:)
110      ENDIF 
111
112      ! 0. initialization
113      zsrau = 1. / rau0
114      DO jn = 1, jptra
115         !
116         IF( l_trdtrc ) ztrtrd(:,:,:) = tra(:,:,:,jn)  ! save trends
117!AM<
118         IF (jn_tremp(jn) >= 1) THEN
119         !                                  ! if relevant, add the trend to the general tracer trend
120           DO jj = 2, jpj
121            DO ji = fs_2, fs_jpim1   ! vector opt.
122               zse3t = 1. / fse3t(ji,jj,1)
123               tra(ji,jj,1,jn) = tra(ji,jj,1,jn) + zemps(ji,jj)  *  zsrau * trn(ji,jj,1,jn) * zse3t
124            END DO
125           END DO
126         END IF
127!>AM
128         IF( l_trdtrc ) THEN
129            ztrtrd(:,:,:) = tra(:,:,:,jn) - ztrtrd(:,:,:)
130            CALL trd_tra( kt, 'TRC', jn, jptra_trd_nsr, ztrtrd )
131         END IF
132         !                                                       ! ===========
133      END DO                                                     ! tracer loop
134      !                                                          ! ===========
135      IF( ln_ctl )   THEN
136         WRITE(charout, FMT="('sbc ')") ;  CALL prt_ctl_trc_info(charout)
137                                           CALL prt_ctl_trc( tab4d=tra, mask=tmask, clinfo=ctrcnm, clinfo2='trd' )
138      ENDIF
139                      CALL wrk_dealloc( jpi, jpj,      zemps  )
140      IF( l_trdtrc )  CALL wrk_dealloc( jpi, jpj, jpk, ztrtrd )
141      !
142      IF( nn_timing == 1 )  CALL timing_stop('trc_sbc')
143      !
144   END SUBROUTINE trc_sbc
145
146#else
147   !!----------------------------------------------------------------------
148   !!   Dummy module :                      NO passive tracer
149   !!----------------------------------------------------------------------
150CONTAINS
151   SUBROUTINE trc_sbc (kt)              ! Empty routine
152      INTEGER, INTENT(in) :: kt
153      WRITE(*,*) 'trc_sbc: You should not have seen this print! error?', kt
154   END SUBROUTINE trc_sbc
155#endif
156   
157   !!======================================================================
158END MODULE trcsbc