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.
trasbc.F90 in NEMO/branches/2019/ENHANCE-02_ISF_nemo/src/OCE/TRA – NEMO

source: NEMO/branches/2019/ENHANCE-02_ISF_nemo/src/OCE/TRA/trasbc.F90 @ 11423

Last change on this file since 11423 was 11395, checked in by mathiot, 5 years ago

ENHANCE-02_ISF_nemo : Initial commit isf simplification (add ISF directory, moved isf routine in and split isf cavity and isf parametrisation, ...) (ticket #2142)

  • Property svn:keywords set to Id
File size: 10.9 KB
RevLine 
[3]1MODULE trasbc
2   !!==============================================================================
3   !!                       ***  MODULE  trasbc  ***
4   !! Ocean active tracers:  surface boundary condition
5   !!==============================================================================
[2528]6   !! History :  OPA  !  1998-10  (G. Madec, G. Roullet, M. Imbard)  Original code
7   !!            8.2  !  2001-02  (D. Ludicone)  sea ice and free surface
8   !!  NEMO      1.0  !  2002-06  (G. Madec)  F90: Free form and module
9   !!            3.3  !  2010-04  (M. Leclair, G. Madec)  Forcing averaged over 2 time steps
10   !!             -   !  2010-09  (C. Ethe, G. Madec) Merge TRA-TRC
[5120]11   !!            3.6  !  2014-11  (P. Mathiot) isf melting forcing
[3]12   !!----------------------------------------------------------------------
[503]13
14   !!----------------------------------------------------------------------
[6140]15   !!   tra_sbc       : update the tracer trend at ocean surface
[3]16   !!----------------------------------------------------------------------
[6140]17   USE oce            ! ocean dynamics and active tracers
18   USE sbc_oce        ! surface boundary condition: ocean
19   USE dom_oce        ! ocean space domain variables
20   USE phycst         ! physical constant
21   USE eosbn2         ! Equation Of State
22   USE sbcmod         ! ln_rnf 
23   USE sbcrnf         ! River runoff 
24   USE traqsr         ! solar radiation penetration
25   USE trd_oce        ! trends: ocean variables
26   USE trdtra         ! trends manager: tracers
[9023]27#if defined key_asminc   
28   USE asminc         ! Assimilation increment
29#endif
[4990]30   !
[6140]31   USE in_out_manager ! I/O manager
32   USE prtctl         ! Print control
33   USE iom            ! xIOS server
34   USE lbclnk         ! ocean lateral boundary conditions (or mpp link)
35   USE timing         ! Timing
[3]36
37   IMPLICIT NONE
38   PRIVATE
39
[6140]40   PUBLIC   tra_sbc   ! routine called by step.F90
[3]41
42   !! * Substitutions
43#  include "vectopt_loop_substitute.h90"
44   !!----------------------------------------------------------------------
[9598]45   !! NEMO/OCE 4.0 , NEMO Consortium (2018)
[888]46   !! $Id$
[10068]47   !! Software governed by the CeCILL license (see ./LICENSE)
[3]48   !!----------------------------------------------------------------------
49CONTAINS
50
51   SUBROUTINE tra_sbc ( kt )
52      !!----------------------------------------------------------------------
53      !!                  ***  ROUTINE tra_sbc  ***
54      !!                   
55      !! ** Purpose :   Compute the tracer surface boundary condition trend of
56      !!      (flux through the interface, concentration/dilution effect)
57      !!      and add it to the general trend of tracer equations.
58      !!
[6140]59      !! ** Method :   The (air+ice)-sea flux has two components:
60      !!      (1) Fext, external forcing (i.e. flux through the (air+ice)-sea interface);
61      !!      (2) Fwe , tracer carried with the water that is exchanged with air+ice.
62      !!               The input forcing fields (emp, rnf, sfx, isf) contain Fext+Fwe,
63      !!             they are simply added to the tracer trend (tsa).
64      !!               In linear free surface case (ln_linssh=T), the volume of the
65      !!             ocean does not change with the water exchanges at the (air+ice)-sea
66      !!             interface. Therefore another term has to be added, to mimic the
67      !!             concentration/dilution effect associated with water exchanges.
[664]68      !!
[6140]69      !! ** Action  : - Update tsa with the surface boundary condition trend
70      !!              - send trends to trdtra module for further diagnostics(l_trdtra=T)
[503]71      !!----------------------------------------------------------------------
[2528]72      INTEGER, INTENT(in) ::   kt   ! ocean time-step index
[6140]73      !
[9023]74      INTEGER  ::   ji, jj, jk, jn              ! dummy loop indices 
75      INTEGER  ::   ikt, ikb                    ! local integers
76      REAL(wp) ::   zfact, z1_e3t, zdep, ztim   ! local scalar
[9019]77      REAL(wp), ALLOCATABLE, DIMENSION(:,:,:) ::  ztrdt, ztrds
[3]78      !!----------------------------------------------------------------------
[3294]79      !
[9019]80      IF( ln_timing )   CALL timing_start('tra_sbc')
[3294]81      !
[3]82      IF( kt == nit000 ) THEN
83         IF(lwp) WRITE(numout,*)
84         IF(lwp) WRITE(numout,*) 'tra_sbc : TRAcer Surface Boundary Condition'
85         IF(lwp) WRITE(numout,*) '~~~~~~~ '
86      ENDIF
[6140]87      !
[4990]88      IF( l_trdtra ) THEN                    !* Save ta and sa trends
[9019]89         ALLOCATE( ztrdt(jpi,jpj,jpk) , ztrds(jpi,jpj,jpk) ) 
[7753]90         ztrdt(:,:,:) = tsa(:,:,:,jp_tem)
91         ztrds(:,:,:) = tsa(:,:,:,jp_sal)
[216]92      ENDIF
[6140]93      !
94!!gm  This should be moved into sbcmod.F90 module ? (especially now that ln_traqsr is read in namsbc namelist)
[2528]95      IF( .NOT.ln_traqsr ) THEN     ! no solar radiation penetration
[7753]96         qns(:,:) = qns(:,:) + qsr(:,:)      ! total heat flux in qns
97         qsr(:,:) = 0._wp                     ! qsr set to zero
[2528]98      ENDIF
[3]99
[2528]100      !----------------------------------------
[4990]101      !        EMP, SFX and QNS effects
[2528]102      !----------------------------------------
[6140]103      !                             !==  Set before sbc tracer content fields  ==!
104      IF( kt == nit000 ) THEN             !* 1st time-step
105         IF( ln_rstart .AND.    &               ! Restart: read in restart file
[2528]106              & iom_varid( numror, 'sbc_hc_b', ldstop = .FALSE. ) > 0 ) THEN
[6140]107            IF(lwp) WRITE(numout,*) '          nit000-1 sbc tracer content field read in the restart file'
[4990]108            zfact = 0.5_wp
[7753]109            sbc_tsc(:,:,:) = 0._wp
[9367]110            CALL iom_get( numror, jpdom_autoglo, 'sbc_hc_b', sbc_tsc_b(:,:,jp_tem), ldxios = lrxios )   ! before heat content sbc trend
111            CALL iom_get( numror, jpdom_autoglo, 'sbc_sc_b', sbc_tsc_b(:,:,jp_sal), ldxios = lrxios )   ! before salt content sbc trend
[6140]112         ELSE                                   ! No restart or restart not found: Euler forward time stepping
[4990]113            zfact = 1._wp
[7753]114            sbc_tsc(:,:,:) = 0._wp
115            sbc_tsc_b(:,:,:) = 0._wp
[2528]116         ENDIF
[6140]117      ELSE                                !* other time-steps: swap of forcing fields
[4990]118         zfact = 0.5_wp
[7753]119         sbc_tsc_b(:,:,:) = sbc_tsc(:,:,:)
[2528]120      ENDIF
[6140]121      !                             !==  Now sbc tracer content fields  ==!
122      DO jj = 2, jpj
123         DO ji = fs_2, fs_jpim1   ! vector opt.
[10499]124            sbc_tsc(ji,jj,jp_tem) = r1_rau0_rcp * qns(ji,jj)   ! non solar heat flux
[6140]125            sbc_tsc(ji,jj,jp_sal) = r1_rau0     * sfx(ji,jj)   ! salt flux due to freezing/melting
[3]126         END DO
[6140]127      END DO
128      IF( ln_linssh ) THEN                !* linear free surface 
129         DO jj = 2, jpj                         !==>> add concentration/dilution effect due to constant volume cell
[2528]130            DO ji = fs_2, fs_jpim1   ! vector opt.
[6140]131               sbc_tsc(ji,jj,jp_tem) = sbc_tsc(ji,jj,jp_tem) + r1_rau0 * emp(ji,jj) * tsn(ji,jj,1,jp_tem)
132               sbc_tsc(ji,jj,jp_sal) = sbc_tsc(ji,jj,jp_sal) + r1_rau0 * emp(ji,jj) * tsn(ji,jj,1,jp_sal)
[2528]133            END DO
[6140]134         END DO                                 !==>> output c./d. term
135         IF( iom_use('emp_x_sst') )   CALL iom_put( "emp_x_sst", emp (:,:) * tsn(:,:,1,jp_tem) )
136         IF( iom_use('emp_x_sss') )   CALL iom_put( "emp_x_sss", emp (:,:) * tsn(:,:,1,jp_sal) )
[2528]137      ENDIF
[6140]138      !
139      DO jn = 1, jpts               !==  update tracer trend  ==!
[2528]140         DO jj = 2, jpj
[6140]141            DO ji = fs_2, fs_jpim1   ! vector opt. 
142               tsa(ji,jj,1,jn) = tsa(ji,jj,1,jn) + zfact * ( sbc_tsc_b(ji,jj,jn) + sbc_tsc(ji,jj,jn) ) / e3t_n(ji,jj,1)
[2528]143            END DO
144         END DO
[3]145      END DO
[6140]146      !                 
147      IF( lrst_oce ) THEN           !==  write sbc_tsc in the ocean restart file  ==!
[9367]148         IF( lwxios ) CALL iom_swap(      cwxios_context          )
149         CALL iom_rstput( kt, nitrst, numrow, 'sbc_hc_b', sbc_tsc(:,:,jp_tem), ldxios = lwxios )
150         CALL iom_rstput( kt, nitrst, numrow, 'sbc_sc_b', sbc_tsc(:,:,jp_sal), ldxios = lwxios )
151         IF( lwxios ) CALL iom_swap(      cxios_context          )
[2528]152      ENDIF
153      !
154      !----------------------------------------
155      !        River Runoff effects
156      !----------------------------------------
157      !
[3764]158      IF( ln_rnf ) THEN         ! input of heat and salt due to river runoff
159         zfact = 0.5_wp
[2528]160         DO jj = 2, jpj 
161            DO ji = fs_2, fs_jpim1
[3764]162               IF( rnf(ji,jj) /= 0._wp ) THEN
163                  zdep = zfact / h_rnf(ji,jj)
[2528]164                  DO jk = 1, nk_rnf(ji,jj)
[6140]165                                        tsa(ji,jj,jk,jp_tem) = tsa(ji,jj,jk,jp_tem)                                 &
166                                           &                 +  ( rnf_tsc_b(ji,jj,jp_tem) + rnf_tsc(ji,jj,jp_tem) ) * zdep
167                     IF( ln_rnf_sal )   tsa(ji,jj,jk,jp_sal) = tsa(ji,jj,jk,jp_sal)                                 &
168                                           &                 +  ( rnf_tsc_b(ji,jj,jp_sal) + rnf_tsc(ji,jj,jp_sal) ) * zdep 
[2715]169                  END DO
[2528]170               ENDIF
[2715]171            END DO 
172         END DO 
[3764]173      ENDIF
[6472]174
175      IF( iom_use('rnf_x_sst') )   CALL iom_put( "rnf_x_sst", rnf*tsn(:,:,1,jp_tem) )   ! runoff term on sst
176      IF( iom_use('rnf_x_sss') )   CALL iom_put( "rnf_x_sss", rnf*tsn(:,:,1,jp_sal) )   ! runoff term on sss
177
[9023]178#if defined key_asminc
[6140]179      !
180      !----------------------------------------
[9023]181      !        Assmilation effects
182      !----------------------------------------
183      !
184      IF( ln_sshinc ) THEN         ! input of heat and salt due to assimilation
185          !
186         IF( ln_linssh ) THEN
187            DO jj = 2, jpj 
188               DO ji = fs_2, fs_jpim1
189                  ztim = ssh_iau(ji,jj) / e3t_n(ji,jj,1)
190                  tsa(ji,jj,1,jp_tem) = tsa(ji,jj,1,jp_tem) + tsn(ji,jj,1,jp_tem) * ztim
191                  tsa(ji,jj,1,jp_sal) = tsa(ji,jj,1,jp_sal) + tsn(ji,jj,1,jp_sal) * ztim
192               END DO
193            END DO
194         ELSE
195            DO jj = 2, jpj 
196               DO ji = fs_2, fs_jpim1
197                  ztim = ssh_iau(ji,jj) / ( ht_n(ji,jj) + 1. - ssmask(ji, jj) )
198                  tsa(ji,jj,:,jp_tem) = tsa(ji,jj,:,jp_tem) + tsn(ji,jj,:,jp_tem) * ztim
199                  tsa(ji,jj,:,jp_sal) = tsa(ji,jj,:,jp_sal) + tsn(ji,jj,:,jp_sal) * ztim
200               END DO 
201            END DO 
202         ENDIF
203         !
204      ENDIF
205      !
206#endif
207      !
[6140]208      IF( l_trdtra )   THEN                      ! save the horizontal diffusive trends for further diagnostics
[7753]209         ztrdt(:,:,:) = tsa(:,:,:,jp_tem) - ztrdt(:,:,:)
210         ztrds(:,:,:) = tsa(:,:,:,jp_sal) - ztrds(:,:,:)
[4990]211         CALL trd_tra( kt, 'TRA', jp_tem, jptra_nsr, ztrdt )
212         CALL trd_tra( kt, 'TRA', jp_sal, jptra_nsr, ztrds )
[9019]213         DEALLOCATE( ztrdt , ztrds ) 
[216]214      ENDIF
[503]215      !
[2528]216      IF(ln_ctl)   CALL prt_ctl( tab3d_1=tsa(:,:,:,jp_tem), clinfo1=' sbc  - Ta: ', mask1=tmask,   &
217         &                       tab3d_2=tsa(:,:,:,jp_sal), clinfo2=       ' Sa: ', mask2=tmask, clinfo3='tra' )
[503]218      !
[9019]219      IF( ln_timing )   CALL timing_stop('tra_sbc')
[3294]220      !
[3]221   END SUBROUTINE tra_sbc
222
223   !!======================================================================
224END MODULE trasbc
Note: See TracBrowser for help on using the repository browser.