- Timestamp:
- 2018-10-29T11:44:36+01:00 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/UKMO/dev_r5518_AMM15_package/NEMOGCM/NEMO/NST_SRC/agrif_top_sponge.F90
r10246 r10248 1 1 #define SPONGE_TOP 2 2 3 M oduleagrif_top_sponge3 MODULE agrif_top_sponge 4 4 #if defined key_agrif && defined key_top 5 5 USE par_oce 6 USE par_trc 6 7 USE oce 7 8 USE dom_oce … … 16 17 PRIVATE 17 18 18 PUBLIC Agrif_Sponge_ Trc, interptrn19 PUBLIC Agrif_Sponge_trc, interptrn_sponge 19 20 20 !! * Substitutions21 !! * Substitutions 21 22 # include "domzgr_substitute.h90" 22 23 !!---------------------------------------------------------------------- 23 !! NEMO/NST 3. 3, NEMO Consortium (2010)24 !! NEMO/NST 3.6 , NEMO Consortium (2010) 24 25 !! $Id$ 25 26 !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt) 26 27 !!---------------------------------------------------------------------- 27 28 28 29 CONTAINS 29 30 30 SUBROUTINE Agrif_Sponge_ Trc31 SUBROUTINE Agrif_Sponge_trc 31 32 !!--------------------------------------------- 32 33 !! *** ROUTINE Agrif_Sponge_Trc *** 33 34 !!--------------------------------------------- 34 35 !! 35 INTEGER :: ji,jj,jk,jn36 36 REAL(wp) :: timecoeff 37 REAL(wp) :: ztra, zabe1, zabe2, zbtr38 REAL(wp), POINTER, DIMENSION(:,:) :: ztru, ztrv39 REAL(wp), POINTER, DIMENSION(:,:,:,:) :: ztabr40 REAL(wp), POINTER, DIMENSION(:,:,:,:) :: trbdiff41 37 42 38 #if defined SPONGE_TOP 43 CALL wrk_alloc( jpi, jpj, ztru, ztrv )44 CALL wrk_alloc( jpi, jpj, jpk, jptra, ztabr, trbdiff )45 46 39 timecoeff = REAL(Agrif_NbStepint(),wp)/Agrif_rhot() 47 40 CALL Agrif_sponge 48 41 Agrif_SpecialValue=0. 49 42 Agrif_UseSpecialValue = .TRUE. 50 ztabr = 0.e051 CALL Agrif_Bc_Variable( ztabr, tra_id,calledweight=timecoeff,procname=interptrn)43 tabspongedone_trn = .FALSE. 44 CALL Agrif_Bc_Variable(trn_sponge_id,calledweight=timecoeff,procname=interptrn_sponge) 52 45 Agrif_UseSpecialValue = .FALSE. 53 54 trbdiff(:,:,:,:) = trb(:,:,:,:) - ztabr(:,:,:,:)55 56 CALL Agrif_sponge57 58 DO jn = 1, jptra59 DO jk = 1, jpkm160 !61 DO jj = 1, jpjm162 DO ji = 1, jpim163 zabe1 = umask(ji,jj,jk) * spe1ur(ji,jj) * fse3u(ji,jj,jk)64 zabe2 = vmask(ji,jj,jk) * spe2vr(ji,jj) * fse3v(ji,jj,jk)65 ztru(ji,jj) = zabe1 * ( trbdiff(ji+1,jj ,jk,jn) - trbdiff(ji,jj,jk,jn) )66 ztrv(ji,jj) = zabe2 * ( trbdiff(ji ,jj+1,jk,jn) - trbdiff(ji,jj,jk,jn) )67 ENDDO68 ENDDO69 70 DO jj = 2,jpjm171 DO ji = 2,jpim172 zbtr = spbtr2(ji,jj) / fse3t(ji,jj,jk)73 ! horizontal diffusive trends74 ztra = zbtr * ( ztru(ji,jj) - ztru(ji-1,jj) + ztrv(ji,jj) - ztrv(ji,jj-1) )75 ! add it to the general tracer trends76 tra(ji,jj,jk,jn) = tra(ji,jj,jk,jn) + ztra77 END DO78 END DO79 !80 ENDDO81 ENDDO82 83 CALL wrk_dealloc( jpi, jpj, ztru, ztrv )84 CALL wrk_dealloc( jpi, jpj, jpk, jptra, trbdiff, ztabr )85 46 86 47 #endif … … 88 49 END SUBROUTINE Agrif_Sponge_Trc 89 50 90 SUBROUTINE interptrn (tabres,i1,i2,j1,j2,k1,k2,n1,n2)51 SUBROUTINE interptrn_sponge(tabres,i1,i2,j1,j2,k1,k2,n1,n2,before) 91 52 !!--------------------------------------------- 92 !! *** ROUTINE interpt n***53 !! *** ROUTINE interptrn_sponge *** 93 54 !!--------------------------------------------- 94 55 INTEGER, INTENT(in) :: i1,i2,j1,j2,k1,k2,n1,n2 95 56 REAL(wp), DIMENSION(i1:i2,j1:j2,k1:k2,n1:n2), INTENT(inout) :: tabres 57 LOGICAL, INTENT(in) :: before 58 59 60 INTEGER :: ji, jj, jk, jn ! dummy loop indices 61 62 REAL(wp) :: ztra, zabe1, zabe2, zbtr 63 REAL(wp), DIMENSION(i1:i2,j1:j2) :: ztu, ztv 64 REAL(wp), DIMENSION(i1:i2,j1:j2,k1:k2,n1:n2) ::trbdiff 96 65 ! 97 tabres(i1:i2,j1:j2,k1:k2,n1:n2) = trn(i1:i2,j1:j2,k1:k2,n1:n2) 66 IF (before) THEN 67 tabres(i1:i2,j1:j2,k1:k2,n1:n2) = trn(i1:i2,j1:j2,k1:k2,n1:n2) 68 ELSE 98 69 99 END SUBROUTINE interptrn 70 trbdiff(:,:,:,:) = trb(i1:i2,j1:j2,:,:) - tabres(:,:,:,:) 71 DO jn = 1, jptra 72 DO jk = 1, jpkm1 73 74 DO jj = j1,j2-1 75 DO ji = i1,i2-1 76 zabe1 = fsaht_spu(ji,jj) * umask(ji,jj,jk) * re2u_e1u(ji,jj) * fse3u_n(ji,jj,jk) 77 zabe2 = fsaht_spv(ji,jj) * vmask(ji,jj,jk) * re1v_e2v(ji,jj) * fse3v_n(ji,jj,jk) 78 ztu(ji,jj) = zabe1 * ( trbdiff(ji+1,jj ,jk,jn) - trbdiff(ji,jj,jk,jn) ) 79 ztv(ji,jj) = zabe2 * ( trbdiff(ji ,jj+1,jk,jn) - trbdiff(ji,jj,jk,jn) ) 80 ENDDO 81 ENDDO 82 83 DO jj = j1+1,j2-1 84 DO ji = i1+1,i2-1 85 86 IF (.NOT. tabspongedone_trn(ji,jj)) THEN 87 zbtr = r1_e12t(ji,jj) / fse3t(ji,jj,jk) 88 ! horizontal diffusive trends 89 ztra = zbtr * ( ztu(ji,jj) - ztu(ji-1,jj ) + ztv(ji,jj) - ztv(ji ,jj-1) ) 90 ! add it to the general tracer trends 91 tra(ji,jj,jk,jn) = tra(ji,jj,jk,jn) + ztra 92 ENDIF 93 94 ENDDO 95 ENDDO 96 97 ENDDO 98 ENDDO 99 100 tabspongedone_trn(i1+1:i2-1,j1+1:j2-1) = .TRUE. 101 ENDIF 102 ! 103 END SUBROUTINE interptrn_sponge 100 104 101 105 #else
Note: See TracChangeset
for help on using the changeset viewer.