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

source: trunk/NEMO/NST_SRC/agrif_top_update.F90 @ 700

Last change on this file since 700 was 699, checked in by smasson, 17 years ago

insert revision Id

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 2.6 KB
Line 
1   !!----------------------------------------------------------------------
2   !! $Id$
3   !!----------------------------------------------------------------------
4#define TWO_WAY
5
6MODULE agrif_top_update
7
8#if defined key_agrif && defined key_passivetrc
9   USE par_oce
10   USE oce
11   USE dom_oce
12   USE trcstp
13   USE sms
14
15   IMPLICIT NONE
16   PRIVATE
17
18   PUBLIC Agrif_Update_Trc
19
20   INTEGER, PARAMETER :: nbclineupdate = 3
21   INTEGER :: nbcline
22
23   CONTAINS
24
25   SUBROUTINE Agrif_Update_Trc( kt )
26      !!---------------------------------------------
27      !!   *** ROUTINE Agrif_Update_Trc ***
28      !!---------------------------------------------
29      INTEGER, INTENT(in) :: kt
30 
31      REAL(wp), DIMENSION(jpi,jpj,jpk,jptra) :: ztra
32
33      IF ((Agrif_NbStepint() .NE. (Agrif_irhot()-1)).AND.(kt /= 0)) RETURN
34
35#if defined TWO_WAY
36      Agrif_UseSpecialValueInUpdate = .TRUE.
37      Agrif_SpecialValueFineGrid = 0.
38 
39     IF (MOD(nbcline,nbclineupdate) == 0) THEN
40         CALL Agrif_Update_Variable(ztra,trn, procname=updateTRC)
41      ELSE
42         CALL Agrif_Update_Variable(ztra,trn,locupdate=(/0,2/), procname=updateTRC)
43      ENDIF
44
45      Agrif_UseSpecialValueInUpdate = .FALSE.
46#endif
47
48   END SUBROUTINE Agrif_Update_Trc
49
50   SUBROUTINE updateTRC(tabres,i1,i2,j1,j2,k1,k2,before)
51      !!---------------------------------------------
52      !!   *** ROUTINE UpdateTrc ***
53      !!---------------------------------------------
54#  include "domzgr_substitute.h90"
55
56      INTEGER, INTENT(in) :: i1,i2,j1,j2,k1,k2
57      REAL, DIMENSION(i1:i2,j1:j2,k1:k2,jptra), INTENT(inout) :: tabres
58      LOGICAL, INTENT(in) :: before
59   
60      INTEGER :: ji,jj,jk,jn
61
62      DO jn=1, jptra 
63
64         IF (before) THEN
65            DO jk=k1,k2
66               DO jj=j1,j2
67                  DO ji=i1,i2
68                     tabres(ji,jj,jk,jn) = trn(ji,jj,jk,jn)
69                  ENDDO
70               ENDDO
71            ENDDO
72         ELSE
73            DO jk=k1,k2
74               DO jj=j1,j2
75                  DO ji=i1,i2
76                     IF (tabres(ji,jj,jk,jn).NE.0.) THEN
77                        trn(ji,jj,jk,jn) = tabres(ji,jj,jk,jn) * tmask(ji,jj,jk)
78                     ENDIF
79                  ENDDO
80               ENDDO
81            ENDDO
82         ENDIF
83
84      END DO
85
86   END SUBROUTINE updateTRC
87
88#else
89CONTAINS
90   SUBROUTINE agrif_top_update_empty
91      !!---------------------------------------------
92      !!   *** ROUTINE agrif_Top_update_empty ***
93      !!---------------------------------------------
94      WRITE(*,*)  'agrif_top_update : You should not have seen this print! error?'
95   END SUBROUTINE agrif_top_update_empty
96#endif
97END Module agrif_top_update
Note: See TracBrowser for help on using the repository browser.