source: NEMO/trunk/src/NST/agrif_top_interp.F90 @ 12377

Last change on this file since 12377 was 12377, checked in by acc, 8 months ago

The big one. Merging all 2019 developments from the option 1 branch back onto the trunk.

This changeset reproduces 2019/dev_r11943_MERGE_2019 on the trunk using a 2-URL merge
onto a working copy of the trunk. I.e.:

svn merge —ignore-ancestry \

svn+ssh://acc@forge.ipsl.jussieu.fr/ipsl/forge/projets/nemo/svn/NEMO/trunk \
svn+ssh://acc@forge.ipsl.jussieu.fr/ipsl/forge/projets/nemo/svn/NEMO/branches/2019/dev_r11943_MERGE_2019 ./

The —ignore-ancestry flag avoids problems that may otherwise arise from the fact that
the merge history been trunk and branch may have been applied in a different order but
care has been taken before this step to ensure that all applicable fixes and updates
are present in the merge branch.

The trunk state just before this step has been branched to releases/release-4.0-HEAD
and that branch has been immediately tagged as releases/release-4.0.2. Any fixes
or additions in response to tickets on 4.0, 4.0.1 or 4.0.2 should be done on
releases/release-4.0-HEAD. From now on future 'point' releases (e.g. 4.0.2) will
remain unchanged with periodic releases as needs demand. Note release-4.0-HEAD is a
transitional naming convention. Future full releases, say 4.2, will have a release-4.2
branch which fulfills this role and the first point release (e.g. 4.2.0) will be made
immediately following the release branch creation.

2020 developments can be started from any trunk revision later than this one.

  • Property svn:keywords set to Id
File size: 5.0 KB
RevLine 
[636]1MODULE agrif_top_interp
[9019]2   !!======================================================================
3   !!                   ***  MODULE  agrif_top_interp  ***
4   !! AGRIF: interpolation package for TOP
5   !!======================================================================
6   !! History :  2.0  !  ???
7   !!----------------------------------------------------------------------
[1206]8#if defined key_agrif && defined key_top
[9019]9   !!----------------------------------------------------------------------
10   !!   'key_agrif'                                              AGRIF zoom
11   !!   'key_top'                                           on-line tracers
12   !!----------------------------------------------------------------------
[636]13   USE par_oce
14   USE oce
15   USE dom_oce     
[782]16   USE agrif_oce
[2715]17   USE agrif_top_sponge
[5656]18   USE par_trc
[1271]19   USE trc
[12377]20   USE vremap
[9019]21   !
22   USE lib_mpp     ! MPP library
[628]23
[636]24   IMPLICIT NONE
25   PRIVATE
[628]26
[5656]27   PUBLIC Agrif_trc, interptrn
[636]28
[2715]29  !!----------------------------------------------------------------------
[9598]30   !! NEMO/NST 4.0 , NEMO Consortium (2018)
[1156]31   !! $Id$
[10068]32   !! Software governed by the CeCILL license (see ./LICENSE)
[1156]33   !!----------------------------------------------------------------------
[6140]34CONTAINS
[1156]35
[1271]36   SUBROUTINE Agrif_trc
[3680]37      !!----------------------------------------------------------------------
[9019]38      !!                   ***  ROUTINE Agrif_trc  ***
[3680]39      !!----------------------------------------------------------------------
40      !
41      IF( Agrif_Root() )   RETURN
[9019]42      !
43      Agrif_SpecialValue    = 0._wp
[636]44      Agrif_UseSpecialValue = .TRUE.
[9019]45      !
[5656]46      CALL Agrif_Bc_variable( trn_id, procname=interptrn )
[636]47      Agrif_UseSpecialValue = .FALSE.
[5656]48      !
49   END SUBROUTINE Agrif_trc
[636]50
[12377]51   SUBROUTINE interptrn( ptab, i1, i2, j1, j2, k1, k2, n1, n2, before )
[9019]52      !!----------------------------------------------------------------------
[9788]53      !!                  *** ROUTINE interptrn ***
[9019]54      !!----------------------------------------------------------------------
55      REAL(wp), DIMENSION(i1:i2,j1:j2,k1:k2,n1:n2), INTENT(inout) ::   ptab
56      INTEGER                                     , INTENT(in   ) ::   i1, i2, j1, j2, k1, k2, n1, n2
57      LOGICAL                                     , INTENT(in   ) ::   before
[5656]58      !
[12377]59      INTEGER  ::   ji, jj, jk, jn, ibdy, jbdy   ! dummy loop indices
[9031]60      INTEGER  ::   imin, imax, jmin, jmax, N_in, N_out
[9806]61      REAL(wp) ::   zrho, z1, z2, z3, z4, z5, z6, z7
[12377]62
[9031]63      ! vertical interpolation:
[12377]64      REAL(wp), DIMENSION(i1:i2,j1:j2,1:jpk,1:jptra) :: ptab_child
65      REAL(wp), DIMENSION(k1:k2,1:jptra) :: tabin
[9031]66      REAL(wp), DIMENSION(k1:k2) :: h_in
[9788]67      REAL(wp), DIMENSION(1:jpk) :: h_out
[12377]68      !!----------------------------------------------------------------------
[9031]69
[9788]70      IF( before ) THEN         
71         DO jn = 1,jptra
[9031]72            DO jk=k1,k2
73               DO jj=j1,j2
74                 DO ji=i1,i2
[12377]75                       ptab(ji,jj,jk,jn) = tr(ji,jj,jk,jn,Kmm_a)
[9031]76                 END DO
[9788]77              END DO
78           END DO
79        END DO
80
[9031]81# if defined key_vertical
82        DO jk=k1,k2
83           DO jj=j1,j2
84              DO ji=i1,i2
[12377]85                 ptab(ji,jj,jk,jptra+1) = tmask(ji,jj,jk) * e3t(ji,jj,jk,Kmm_a) 
[9031]86              END DO
87           END DO
88        END DO
89# endif
[9788]90      ELSE 
[9031]91
[12377]92# if defined key_vertical
[9031]93         DO jj=j1,j2
94            DO ji=i1,i2
[12377]95               ptab_child(ji,jj,:) = 0._wp
[9031]96               N_in = 0
97               DO jk=k1,k2 !k2 = jpk of parent grid
98                  IF (ptab(ji,jj,jk,n2) == 0) EXIT
99                  N_in = N_in + 1
100                  tabin(jk,:) = ptab(ji,jj,jk,n1:n2-1)
101                  h_in(N_in) = ptab(ji,jj,jk,n2)
102               END DO
103               N_out = 0
104               DO jk=1,jpk ! jpk of child grid
[12377]105                  IF (tmask(ji,jj,jk) == 0) EXIT
[9031]106                  N_out = N_out + 1
[12377]107                  h_out(jk) = e3t(ji,jj,jk,Krhs_a)
[9031]108               ENDDO
109               IF (N_in > 0) THEN
[12377]110                  CALL reconstructandremap(tabin(1:N_in,1:jptra),h_in,ptab_child(ji,jj,1:N_out,1:jptra),h_out,N_in,N_out,jptra)
[9031]111               ENDIF
112            ENDDO
113         ENDDO
114# else
115         ptab_child(i1:i2,j1:j2,1:jpk,1:jptra) = ptab(i1:i2,j1:j2,1:jpk,1:jptra)
116# endif
[9788]117         !
118         DO jn=1, jptra
[12377]119            tr(i1:i2,j1:j2,1:jpk,jn,Krhs_a)=ptab_child(i1:i2,j1:j2,1:jpk,jn)*tmask(i1:i2,j1:j2,1:jpk) 
[9788]120         END DO
[9031]121
[628]122      ENDIF
[3680]123      !
[5656]124   END SUBROUTINE interptrn
[2715]125
[628]126#else
[9019]127   !!----------------------------------------------------------------------
128   !!   Empty module                                           no TOP AGRIF
129   !!----------------------------------------------------------------------
[636]130CONTAINS
131   SUBROUTINE Agrif_TOP_Interp_empty
132      !!---------------------------------------------
133      !!   *** ROUTINE agrif_Top_Interp_empty ***
134      !!---------------------------------------------
135      WRITE(*,*)  'agrif_top_interp : You should not have seen this print! error?'
136   END SUBROUTINE Agrif_TOP_Interp_empty
[628]137#endif
[9019]138
139   !!======================================================================
[636]140END MODULE agrif_top_interp
Note: See TracBrowser for help on using the repository browser.