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.
agrif_top_sponge.F90 in trunk/NEMOGCM/NEMO/NST_SRC – NEMO

source: trunk/NEMOGCM/NEMO/NST_SRC/agrif_top_sponge.F90 @ 7881

Last change on this file since 7881 was 6140, checked in by timgraham, 8 years ago

Merge of branches/2015/dev_merge_2015 back into trunk. Merge excludes NEMOGCM/TOOLS/OBSTOOLS/ for now due to issues with the change of file type. Will sort these manually with further commits.

Branch merged as follows:
In the working copy of branch ran:
svn merge svn+ssh://forge.ipsl.jussieu.fr/ipsl/forge/projets/nemo/svn/trunk@HEAD
Small conflicts due to bug fixes applied to trunk since the dev_merge_2015 was copied. Bug fixes were applied to the branch as well so these were easy to resolve.
Branch committed at this stage

In working copy run:
svn switch svn+ssh://forge.ipsl.jussieu.fr/ipsl/forge/projets/nemo/svn/trunk
to switch working copy

Run:
svn merge --reintegrate svn+ssh://forge.ipsl.jussieu.fr/ipsl/forge/projets/nemo/svn/branches/2015/dev_merge_2015
to merge the branch into the trunk and then commit - no conflicts at this stage.

  • Property svn:keywords set to Id
File size: 4.6 KB
RevLine 
[1271]1#define SPONGE_TOP
2
[5656]3MODULE agrif_top_sponge
[6140]4   !!======================================================================
5   !!                ***  MODULE agrif_top_sponge  ***
6   !! AGRIF :   define in memory AGRIF variables for sea-ice
7   !!======================================================================
8   !! History :  2.0  ! 2006-08  (R. Benshila, L. Debreu)  Original code
9   !!----------------------------------------------------------------------
10
11   !!----------------------------------------------------------------------
12   !!   Agrif_Sponge_trc :
13   !!   interptrn_sponge : 
14   !!----------------------------------------------------------------------
[1271]15#if defined key_agrif && defined key_top
16   USE par_oce
[5656]17   USE par_trc
[1271]18   USE oce
[6140]19   USE trc
[1271]20   USE dom_oce
21   USE agrif_oce
[3680]22   USE agrif_opa_sponge
[6140]23   !
24   USE in_out_manager
[2715]25   USE lib_mpp
[3294]26   USE wrk_nemo 
[1271]27
28   IMPLICIT NONE
29   PRIVATE
30
[5656]31   PUBLIC Agrif_Sponge_trc, interptrn_sponge
[1271]32
33   !!----------------------------------------------------------------------
[6140]34   !! NEMO/NST 3.7 , NEMO Consortium (2015)
[2528]35   !! $Id$
36   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
[1271]37   !!----------------------------------------------------------------------
[5656]38CONTAINS
[1271]39
[5656]40   SUBROUTINE Agrif_Sponge_trc
[6140]41      !!----------------------------------------------------------------------
42      !!                   *** ROUTINE Agrif_Sponge_Trc ***
43      !!----------------------------------------------------------------------
44      REAL(wp) ::   timecoeff
45      !!----------------------------------------------------------------------
46      !
[1271]47#if defined SPONGE_TOP
[6140]48      timecoeff = REAL( Agrif_NbStepint(), wp ) / Agrif_rhot()
[5656]49      CALL Agrif_sponge
[6140]50      Agrif_SpecialValue    = 0._wp
[1271]51      Agrif_UseSpecialValue = .TRUE.
[6140]52      tabspongedone_trn     = .FALSE.
53      CALL Agrif_Bc_Variable( trn_sponge_id, calledweight=timecoeff, procname=interptrn_sponge )
[1271]54      Agrif_UseSpecialValue = .FALSE.
55#endif
[6140]56      !
[1271]57   END SUBROUTINE Agrif_Sponge_Trc
58
[5656]59
[6140]60   SUBROUTINE interptrn_sponge( tabres, i1, i2, j1, j2, k1, k2, n1, n2, before )
61      !!----------------------------------------------------------------------
62      !!                   *** ROUTINE interptrn_sponge ***
63      !!----------------------------------------------------------------------
64      INTEGER                                     , INTENT(in   ) ::   i1, i2, j1, j2, k1, k2, n1, n2
65      REAL(wp), DIMENSION(i1:i2,j1:j2,k1:k2,n1:n2), INTENT(inout) ::   tabres
66      LOGICAL                                     , INTENT(in   ) ::   before
67      !
[5656]68      INTEGER  ::   ji, jj, jk, jn   ! dummy loop indices
[6140]69      REAL(wp) ::   zabe1, zabe2
70      REAL(wp), DIMENSION(i1:i2,j1:j2)             ::   ztu, ztv
71      REAL(wp), DIMENSION(i1:i2,j1:j2,k1:k2,n1:n2) ::   trbdiff
72      !!----------------------------------------------------------------------
[3680]73      !
[6140]74      IF( before ) THEN
[5656]75         tabres(i1:i2,j1:j2,k1:k2,n1:n2) = trn(i1:i2,j1:j2,k1:k2,n1:n2)
76      ELSE     
[6140]77!!gm line below use of :,:  versus i1:i2,j1:j2  ....   strange, not wrong.    ===>> to be corrected
[5656]78         trbdiff(:,:,:,:) = trb(i1:i2,j1:j2,:,:) - tabres(:,:,:,:)     
79         DO jn = 1, jptra
80            DO jk = 1, jpkm1
81               DO jj = j1,j2-1
82                  DO ji = i1,i2-1
[6140]83                     zabe1 = fsaht_spu(ji,jj) * e2_e1u(ji,jj) * e3u_n(ji,jj,jk) * umask(ji,jj,jk)
84                     zabe2 = fsaht_spv(ji,jj) * e1_e2v(ji,jj) * e3v_n(ji,jj,jk) * vmask(ji,jj,jk)
[5656]85                     ztu(ji,jj) = zabe1 * ( trbdiff(ji+1,jj  ,jk,jn) - trbdiff(ji,jj,jk,jn) )
86                     ztv(ji,jj) = zabe2 * ( trbdiff(ji  ,jj+1,jk,jn) - trbdiff(ji,jj,jk,jn) )
[6140]87                  END DO
88               END DO
89               !
[5656]90               DO jj = j1+1,j2-1
91                  DO ji = i1+1,i2-1
[6140]92                     IF( .NOT. tabspongedone_trn(ji,jj) ) THEN
93                        tra(ji,jj,jk,jn) = tra(ji,jj,jk,jn) + (  ztu(ji,jj) - ztu(ji-1,jj  )     &
94                           &                                   + ztv(ji,jj) - ztv(ji  ,jj-1)  )  &
95                           &                                * r1_e1e2t(ji,jj) / e3t_n(ji,jj,jk)
[5656]96                     ENDIF
[6140]97                  END DO
98               END DO
99            END DO
100            !
101         END DO
102         !
[5656]103         tabspongedone_trn(i1+1:i2-1,j1+1:j2-1) = .TRUE.
104      ENDIF
105      !                 
106   END SUBROUTINE interptrn_sponge
107
[1271]108#else
[6140]109
[1271]110CONTAINS
111   SUBROUTINE agrif_top_sponge_empty
112      WRITE(*,*)  'agrif_top_sponge : You should not have seen this print! error?'
113   END SUBROUTINE agrif_top_sponge_empty
114#endif
115
[6140]116   !!======================================================================
[1271]117END MODULE agrif_top_sponge
Note: See TracBrowser for help on using the repository browser.