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.
usrdef_zgr.F90 in NEMO/trunk/tests/LOCK_EXCHANGE/MY_SRC – NEMO

source: NEMO/trunk/tests/LOCK_EXCHANGE/MY_SRC/usrdef_zgr.F90 @ 12377

Last change on this file since 12377 was 12377, checked in by acc, 4 years 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: 8.2 KB
Line 
1MODULE usrdef_zgr
2   !!======================================================================
3   !!                   ***  MODULE  usrdef_zgr  ***
4   !!
5   !!                   ===  LOCK_EXCHANGE case  ===
6   !!
7   !! Ocean domain : user defined vertical coordinate system
8   !!======================================================================
9   !! History :  4.0  ! 2016-08  (G. Madec, S. Flavoni)  Original code
10   !!----------------------------------------------------------------------
11
12   !!----------------------------------------------------------------------
13   !!   usr_def_zgr   : user defined vertical coordinate system (required)
14   !!       zgr_z1d   : reference 1D z-coordinate
15   !!---------------------------------------------------------------------
16   USE oce            ! ocean variables
17   USE usrdef_nam     ! User defined : namelist variables
18   !
19   USE in_out_manager ! I/O manager
20   USE lbclnk         ! ocean lateral boundary conditions (or mpp link)
21   USE lib_mpp        ! distributed memory computing library
22   USE timing         ! Timing
23
24   IMPLICIT NONE
25   PRIVATE
26
27   PUBLIC   usr_def_zgr   ! called by domzgr.F90
28
29   !!----------------------------------------------------------------------
30   !! NEMO/OCE 4.0 , NEMO Consortium (2018)
31   !! $Id$
32   !! Software governed by the CeCILL license (see ./LICENSE)
33   !!----------------------------------------------------------------------
34CONTAINS             
35
36   SUBROUTINE usr_def_zgr( ld_zco  , ld_zps  , ld_sco  , ld_isfcav,    &   ! type of vertical coordinate
37      &                    pdept_1d, pdepw_1d, pe3t_1d , pe3w_1d  ,    &   ! 1D reference vertical coordinate
38      &                    pdept , pdepw ,                             &   ! 3D t & w-points depth
39      &                    pe3t  , pe3u  , pe3v , pe3f ,               &   ! vertical scale factors
40      &                    pe3w  , pe3uw , pe3vw,                      &   !     -      -      -
41      &                    k_top  , k_bot    )                             ! top & bottom ocean level
42      !!---------------------------------------------------------------------
43      !!              ***  ROUTINE usr_def_zgr  ***
44      !!
45      !! ** Purpose :   User defined the vertical coordinates
46      !!
47      !!----------------------------------------------------------------------
48      LOGICAL                   , INTENT(out) ::   ld_zco, ld_zps, ld_sco      ! vertical coordinate flags
49      LOGICAL                   , INTENT(out) ::   ld_isfcav                   ! under iceshelf cavity flag
50      REAL(wp), DIMENSION(:)    , INTENT(out) ::   pdept_1d, pdepw_1d          ! 1D grid-point depth     [m]
51      REAL(wp), DIMENSION(:)    , INTENT(out) ::   pe3t_1d , pe3w_1d           ! 1D grid-point depth     [m]
52      REAL(wp), DIMENSION(:,:,:), INTENT(out) ::   pdept, pdepw                ! grid-point depth        [m]
53      REAL(wp), DIMENSION(:,:,:), INTENT(out) ::   pe3t , pe3u , pe3v , pe3f   ! vertical scale factors  [m]
54      REAL(wp), DIMENSION(:,:,:), INTENT(out) ::   pe3w , pe3uw, pe3vw         ! i-scale factors
55      INTEGER , DIMENSION(:,:)  , INTENT(out) ::   k_top, k_bot                ! first & last ocean level
56      !
57      INTEGER  ::   jk   ! dummy indices
58      REAL(wp), DIMENSION(jpi,jpj) ::   z2d   ! 2D workspace
59      !!----------------------------------------------------------------------
60      !
61      IF(lwp) WRITE(numout,*)
62      IF(lwp) WRITE(numout,*) 'usr_def_zgr : LOCK_EXCHANGE configuration (z-coordinate closed box ocean without cavities)'
63      IF(lwp) WRITE(numout,*) '~~~~~~~~~~~'
64      !
65      !
66      ! type of vertical coordinate   ==>>>   here LOCK EXCHANGE : flat bottom always
67      ! ---------------------------
68      ld_zco    = .TRUE.       ! z-partial-step coordinate
69      ld_zps    = .FALSE.      ! z-partial-step coordinate
70      ld_sco    = .FALSE.      ! s-coordinate
71      ld_isfcav = .FALSE.      ! ISF Ice Shelves Flag
72      !
73      !
74      ! Build the vertical coordinate system
75      ! ------------------------------------
76      !
77      !                       !==  UNmasked meter bathymetry  ==!
78      !
79      ! flat bassin (20m deep and 64000m wide, set through the jpk and jpi (see userdef_nam.F90))
80      CALL zgr_z1d( pdept_1d, pdepw_1d, pe3t_1d , pe3w_1d )   ! Reference z-coordinate system
81      !
82      !
83      !                       !==  top masked level bathymetry  ==!  (all coordinates)
84      !
85      ! no ocean cavities : top ocean level is ONE, except over land
86      ! the ocean basin surrounded by land (1 grid-point) set through lbc_lnk call as jperio=0
87      z2d(:,:) = 1._wp                    ! surface ocean is the 1st level
88      CALL lbc_lnk( 'usrdef_zgr', z2d, 'T', 1. )        ! closed basin since jperio = 0 (see userdef_nam.F90)
89      k_top(:,:) = NINT( z2d(:,:) )
90      !
91      !                             
92      !                       !==  z-coordinate  ==!   (step-like topography)
93      !
94      !                                !* bottom ocean compute from the depth of grid-points
95      k_bot(:,:) = jpkm1 * k_top(:,:)     ! here use k_top as a land mask
96      !                                !* horizontally uniform coordinate (reference z-co everywhere)
97      DO jk = 1, jpk
98         pdept(:,:,jk) = pdept_1d(jk)
99         pdepw(:,:,jk) = pdepw_1d(jk)
100         pe3t (:,:,jk) = pe3t_1d (jk)
101         pe3u (:,:,jk) = pe3t_1d (jk)
102         pe3v (:,:,jk) = pe3t_1d (jk)
103         pe3f (:,:,jk) = pe3t_1d (jk)
104         pe3w (:,:,jk) = pe3w_1d (jk)
105         pe3uw(:,:,jk) = pe3w_1d (jk)
106         pe3vw(:,:,jk) = pe3w_1d (jk)
107      END DO
108      !
109   END SUBROUTINE usr_def_zgr
110
111
112   SUBROUTINE zgr_z1d( pdept_1d, pdepw_1d, pe3t_1d , pe3w_1d )   ! 1D reference vertical coordinate
113      !!----------------------------------------------------------------------
114      !!                   ***  ROUTINE zgr_z1d  ***
115      !!
116      !! ** Purpose :   set the depth of model levels and the resulting
117      !!      vertical scale factors.
118      !!
119      !! ** Method  :   1D z-coordinate system (use in all type of coordinate)
120      !!       The depth of model levels is set from dep(k), an analytical function:
121      !!                   w-level: depw_1d  = dep(k)
122      !!                   t-level: dept_1d  = dep(k+0.5)
123      !!       The scale factors are the discrete derivative of the depth:
124      !!                   e3w_1d(jk) = dk[ dept_1d ]
125      !!                   e3t_1d(jk) = dk[ depw_1d ]
126      !!
127      !!            ===    Here constant vertical resolution   ===
128      !!
129      !! ** Action  : - pdept_1d, pdepw_1d : depth of T- and W-point (m)
130      !!              - pe3t_1d , pe3w_1d  : scale factors at T- and W-levels (m)
131      !!----------------------------------------------------------------------
132      REAL(wp), DIMENSION(:), INTENT(out) ::   pdept_1d, pdepw_1d   ! 1D grid-point depth        [m]
133      REAL(wp), DIMENSION(:), INTENT(out) ::   pe3t_1d , pe3w_1d    ! 1D vertical scale factors  [m]
134      !
135      INTEGER  ::   jk       ! dummy loop indices
136      REAL(wp) ::   zt, zw   ! local scalar
137      !!----------------------------------------------------------------------
138      !
139      IF(lwp) THEN                         ! Parameter print
140         WRITE(numout,*)
141         WRITE(numout,*) '    zgr_z1d : Reference vertical z-coordinates: uniform dz = ', rn_dz
142         WRITE(numout,*) '    ~~~~~~~'
143      ENDIF
144      !
145      ! Reference z-coordinate (depth - scale factor at T- and W-points)   ! Madec & Imbard 1996 function
146      ! ----------------------
147      DO jk = 1, jpk
148         zw = REAL( jk , wp )
149         zt = REAL( jk , wp ) + 0.5_wp
150         pdepw_1d(jk) =    rn_dz *   REAL( jk-1 , wp )
151         pdept_1d(jk) =    rn_dz * ( REAL( jk-1 , wp ) + 0.5_wp )
152         pe3w_1d (jk) =    rn_dz
153         pe3t_1d (jk) =    rn_dz
154      END DO
155      !
156      IF(lwp) THEN                        ! control print
157         WRITE(numout,*)
158         WRITE(numout,*) '              Reference 1D z-coordinate depth and scale factors:'
159         WRITE(numout, "(9x,' level  gdept_1d  gdepw_1d  e3t_1d   e3w_1d  ')" )
160         WRITE(numout, "(10x, i4, 4f9.2)" ) ( jk, pdept_1d(jk), pdepw_1d(jk), pe3t_1d(jk), pe3w_1d(jk), jk = 1, jpk )
161      ENDIF
162      !
163   END SUBROUTINE zgr_z1d
164   
165   !!======================================================================
166END MODULE usrdef_zgr
Note: See TracBrowser for help on using the repository browser.