1 | MODULE domzgr |
---|
2 | !!============================================================================== |
---|
3 | !! *** MODULE domzgr *** |
---|
4 | !! Ocean domain : definition of the vertical coordinate system |
---|
5 | !!============================================================================== |
---|
6 | !! History : OPA ! 1995-12 (G. Madec) Original code : s vertical coordinate |
---|
7 | !! ! 1997-07 (G. Madec) lbc_lnk call |
---|
8 | !! ! 1997-04 (J.-O. Beismann) |
---|
9 | !! 8.5 ! 2002-09 (A. Bozec, G. Madec) F90: Free form and module |
---|
10 | !! - ! 2002-09 (A. de Miranda) rigid-lid + islands |
---|
11 | !! NEMO 1.0 ! 2003-08 (G. Madec) F90: Free form and module |
---|
12 | !! - ! 2005-10 (A. Beckmann) modifications for hybrid s-ccordinates & new stretching function |
---|
13 | !! 2.0 ! 2006-04 (R. Benshila, G. Madec) add zgr_zco |
---|
14 | !! 3.0 ! 2008-06 (G. Madec) insertion of domzgr_zps.h90 & conding style |
---|
15 | !! 3.2 ! 2009-07 (R. Benshila) Suppression of rigid-lid option |
---|
16 | !! 3.3 ! 2010-11 (G. Madec) add mbk. arrays associated to the deepest ocean level |
---|
17 | !! 3.4 ! 2012-08 (J. Siddorn) added Siddorn and Furner stretching function |
---|
18 | !! 3.4 ! 2012-12 (R. Bourdalle-Badie and G. Reffray) modify C1D case |
---|
19 | !! 3.6 ! 2014-11 (P. Mathiot and C. Harris) add ice shelf capabilitye |
---|
20 | !! 3.? ! 2015-11 (H. Liu) Modifications for Wetting/Drying |
---|
21 | !!---------------------------------------------------------------------- |
---|
22 | |
---|
23 | !!---------------------------------------------------------------------- |
---|
24 | !! dom_zgr : read or set the ocean vertical coordinate system |
---|
25 | !! zgr_read : read the vertical information in the domain configuration file |
---|
26 | !! zgr_top_bot : ocean top and bottom level for t-, u, and v-points with 1 as minimum value |
---|
27 | !!--------------------------------------------------------------------- |
---|
28 | USE oce ! ocean variables |
---|
29 | USE dom_oce ! ocean domain |
---|
30 | USE usrdef_zgr ! user defined vertical coordinate system |
---|
31 | USE closea ! closed seas |
---|
32 | USE depth_e3 ! depth <=> e3 |
---|
33 | USE wet_dry, ONLY: ll_wd, ssh_ref ! Wetting and drying |
---|
34 | ! |
---|
35 | USE in_out_manager ! I/O manager |
---|
36 | USE iom ! I/O library |
---|
37 | USE lbclnk ! ocean lateral boundary conditions (or mpp link) |
---|
38 | USE lib_mpp ! distributed memory computing library |
---|
39 | |
---|
40 | IMPLICIT NONE |
---|
41 | PRIVATE |
---|
42 | |
---|
43 | PUBLIC dom_zgr ! called by dom_init.F90 |
---|
44 | |
---|
45 | !! * Substitutions |
---|
46 | # include "do_loop_substitute.h90" |
---|
47 | !!---------------------------------------------------------------------- |
---|
48 | !! NEMO/OCE 4.0 , NEMO Consortium (2018) |
---|
49 | !! $Id$ |
---|
50 | !! Software governed by the CeCILL license (see ./LICENSE) |
---|
51 | !!---------------------------------------------------------------------- |
---|
52 | CONTAINS |
---|
53 | |
---|
54 | SUBROUTINE dom_zgr( k_top, k_bot ) |
---|
55 | !!---------------------------------------------------------------------- |
---|
56 | !! *** ROUTINE dom_zgr *** |
---|
57 | !! |
---|
58 | !! ** Purpose : set the depth of model levels and the resulting |
---|
59 | !! vertical scale factors. |
---|
60 | !! |
---|
61 | !! ** Method : - reference 1D vertical coordinate (gdep._1d, e3._1d) |
---|
62 | !! - read/set ocean depth and ocean levels (bathy, mbathy) |
---|
63 | !! - vertical coordinate (gdep., e3.) depending on the |
---|
64 | !! coordinate chosen : |
---|
65 | !! ln_zco=T z-coordinate |
---|
66 | !! ln_zps=T z-coordinate with partial steps |
---|
67 | !! ln_zco=T s-coordinate |
---|
68 | !! |
---|
69 | !! ** Action : define gdep., e3., mbathy and bathy |
---|
70 | !!---------------------------------------------------------------------- |
---|
71 | INTEGER, DIMENSION(:,:), INTENT(out) :: k_top, k_bot ! ocean first and last level indices |
---|
72 | ! |
---|
73 | INTEGER :: ji,jj,jk ! dummy loop index |
---|
74 | INTEGER :: ikt, ikb ! top/bot index |
---|
75 | INTEGER :: ioptio, ibat, ios ! local integer |
---|
76 | REAL(wp) :: zrefdep ! depth of the reference level (~10m) |
---|
77 | REAL(wp), DIMENSION(jpi,jpj) :: zmsk |
---|
78 | !!---------------------------------------------------------------------- |
---|
79 | ! |
---|
80 | IF(lwp) THEN ! Control print |
---|
81 | WRITE(numout,*) |
---|
82 | WRITE(numout,*) 'dom_zgr : vertical coordinate' |
---|
83 | WRITE(numout,*) '~~~~~~~' |
---|
84 | ENDIF |
---|
85 | |
---|
86 | IF( ln_linssh .AND. lwp) WRITE(numout,*) ' linear free surface: the vertical mesh does not change in time' |
---|
87 | |
---|
88 | |
---|
89 | IF( ln_read_cfg ) THEN !== read in mesh_mask.nc file ==! |
---|
90 | IF(lwp) WRITE(numout,*) |
---|
91 | IF(lwp) WRITE(numout,*) ' ==>>> Read vertical mesh in ', TRIM( cn_domcfg ), ' file' |
---|
92 | ! |
---|
93 | CALL zgr_read ( ln_zco , ln_zps , ln_sco, ln_isfcav, & |
---|
94 | & gdept_1d, gdepw_1d, e3t_1d, e3w_1d , & ! 1D gridpoints depth |
---|
95 | & gdept_0 , gdepw_0 , & ! gridpoints depth |
---|
96 | & e3t_0 , e3u_0 , e3v_0 , e3f_0 , & ! vertical scale factors |
---|
97 | & e3w_0 , e3uw_0 , e3vw_0 , & ! vertical scale factors |
---|
98 | & k_top , k_bot ) ! 1st & last ocean level |
---|
99 | ! |
---|
100 | ELSE !== User defined configuration ==! |
---|
101 | IF(lwp) WRITE(numout,*) |
---|
102 | IF(lwp) WRITE(numout,*) ' User defined vertical mesh (usr_def_zgr)' |
---|
103 | ! |
---|
104 | CALL usr_def_zgr( ln_zco , ln_zps , ln_sco, ln_isfcav, & |
---|
105 | & gdept_1d, gdepw_1d, e3t_1d, e3w_1d , & ! 1D gridpoints depth |
---|
106 | & gdept_0 , gdepw_0 , & ! gridpoints depth |
---|
107 | & e3t_0 , e3u_0 , e3v_0 , e3f_0 , & ! vertical scale factors |
---|
108 | & e3w_0 , e3uw_0 , e3vw_0 , & ! vertical scale factors |
---|
109 | & k_top , k_bot ) ! 1st & last ocean level |
---|
110 | ! |
---|
111 | ENDIF |
---|
112 | ! |
---|
113 | ! the following is mandatory |
---|
114 | ! make sure that closed boundaries are correctly defined in k_top that will be used to compute all mask arrays |
---|
115 | ! |
---|
116 | zmsk(:,:) = 1._wp ! default: no closed boundaries |
---|
117 | IF( jperio == 0 .OR. jperio == 2 .OR. jperio == 3 .OR. jperio == 5 ) THEN ! E-W closed |
---|
118 | zmsk( mi0( 1+nn_hls):mi1( 1+nn_hls),:) = 0._wp ! first column of inner global domain at 0 |
---|
119 | zmsk( mi0(jpiglo-nn_hls):mi1(jpiglo-nn_hls),:) = 0._wp ! last column of inner global domain at 0 |
---|
120 | ENDIF |
---|
121 | IF( .NOT. ( jperio == 2 .OR. jperio == 7 ) ) THEN ! S closed |
---|
122 | zmsk(:,mj0( 1+nn_hls):mj1( 1+nn_hls) ) = 0._wp ! first line of inner global domain at 0 |
---|
123 | ENDIF |
---|
124 | IF( jperio == 0 .OR. jperio == 1 ) THEN ! N closed |
---|
125 | zmsk(:,mj0(jpjglo-nn_hls):mj1(jpjglo-nn_hls) ) = 0._wp ! last line of inner global domain at 0 |
---|
126 | ENDIF |
---|
127 | CALL lbc_lnk( 'usrdef_zgr', zmsk, 'T', 1. ) ! set halos |
---|
128 | k_top(:,:) = k_top(:,:) * NINT( zmsk(:,:) ) |
---|
129 | ! |
---|
130 | !!gm to be remove when removing the OLD definition of e3 scale factors so that gde3w disappears |
---|
131 | ! Compute gde3w_0 (vertical sum of e3w) |
---|
132 | gde3w_0(:,:,1) = 0.5_wp * e3w_0(:,:,1) |
---|
133 | DO jk = 2, jpk |
---|
134 | gde3w_0(:,:,jk) = gde3w_0(:,:,jk-1) + e3w_0(:,:,jk) |
---|
135 | END DO |
---|
136 | ! |
---|
137 | ! Any closed seas (defined by closea_mask > 0 in domain_cfg file) to be filled |
---|
138 | ! in at runtime if ln_closea=.false. |
---|
139 | IF( ln_closea ) THEN |
---|
140 | IF ( ln_maskcs ) THEN |
---|
141 | ! mask all the closed sea |
---|
142 | CALL clo_msk( k_top, k_bot, mask_opnsea, 'mask_opensea' ) |
---|
143 | ELSE IF ( ln_mask_csundef ) THEN |
---|
144 | ! defined closed sea are kept |
---|
145 | ! mask all the undefined closed sea |
---|
146 | CALL clo_msk( k_top, k_bot, mask_csundef, 'mask_csundef' ) |
---|
147 | END IF |
---|
148 | END IF |
---|
149 | ! |
---|
150 | IF(lwp) THEN ! Control print |
---|
151 | WRITE(numout,*) |
---|
152 | WRITE(numout,*) ' Type of vertical coordinate (read in ', TRIM( cn_domcfg ), ' file or set in userdef_nam) :' |
---|
153 | WRITE(numout,*) ' z-coordinate - full steps ln_zco = ', ln_zco |
---|
154 | WRITE(numout,*) ' z-coordinate - partial steps ln_zps = ', ln_zps |
---|
155 | WRITE(numout,*) ' s- or hybrid z-s-coordinate ln_sco = ', ln_sco |
---|
156 | WRITE(numout,*) ' ice shelf cavities ln_isfcav = ', ln_isfcav |
---|
157 | ENDIF |
---|
158 | |
---|
159 | ioptio = 0 ! Check Vertical coordinate options |
---|
160 | IF( ln_zco ) ioptio = ioptio + 1 |
---|
161 | IF( ln_zps ) ioptio = ioptio + 1 |
---|
162 | IF( ln_sco ) ioptio = ioptio + 1 |
---|
163 | IF( ioptio /= 1 ) CALL ctl_stop( ' none or several vertical coordinate options used' ) |
---|
164 | |
---|
165 | |
---|
166 | ! ! top/bottom ocean level indices for t-, u- and v-points (f-point also for top) |
---|
167 | CALL zgr_top_bot( k_top, k_bot ) ! with a minimum value set to 1 |
---|
168 | ! |
---|
169 | ! ! ice shelf draft and bathymetry |
---|
170 | DO_2D_11_11 |
---|
171 | ikt = mikt(ji,jj) |
---|
172 | ikb = mbkt(ji,jj) |
---|
173 | bathy (ji,jj) = gdepw_0(ji,jj,ikb+1) |
---|
174 | risfdep(ji,jj) = gdepw_0(ji,jj,ikt ) |
---|
175 | END_2D |
---|
176 | ! |
---|
177 | ! ! deepest/shallowest W level Above/Below ~10m |
---|
178 | !!gm BUG in s-coordinate this does not work! |
---|
179 | zrefdep = 10._wp - 0.1_wp * MINVAL( e3w_1d ) ! ref. depth with tolerance (10% of minimum layer thickness) |
---|
180 | nlb10 = MINLOC( gdepw_1d, mask = gdepw_1d > zrefdep, dim = 1 ) ! shallowest W level Below ~10m |
---|
181 | nla10 = nlb10 - 1 ! deepest W level Above ~10m |
---|
182 | !!gm end bug |
---|
183 | ! |
---|
184 | IF( nprint == 1 .AND. lwp ) THEN |
---|
185 | WRITE(numout,*) ' MIN val k_top ', MINVAL( k_top(:,:) ), ' MAX ', MAXVAL( k_top(:,:) ) |
---|
186 | WRITE(numout,*) ' MIN val k_bot ', MINVAL( k_bot(:,:) ), ' MAX ', MAXVAL( k_bot(:,:) ) |
---|
187 | WRITE(numout,*) ' MIN val depth t ', MINVAL( gdept_0(:,:,:) ), & |
---|
188 | & ' w ', MINVAL( gdepw_0(:,:,:) ), '3w ', MINVAL( gde3w_0(:,:,:) ) |
---|
189 | WRITE(numout,*) ' MIN val e3 t ', MINVAL( e3t_0(:,:,:) ), ' f ', MINVAL( e3f_0(:,:,:) ), & |
---|
190 | & ' u ', MINVAL( e3u_0(:,:,:) ), ' u ', MINVAL( e3v_0(:,:,:) ), & |
---|
191 | & ' uw', MINVAL( e3uw_0(:,:,:) ), ' vw', MINVAL( e3vw_0(:,:,:)), & |
---|
192 | & ' w ', MINVAL( e3w_0(:,:,:) ) |
---|
193 | |
---|
194 | WRITE(numout,*) ' MAX val depth t ', MAXVAL( gdept_0(:,:,:) ), & |
---|
195 | & ' w ', MAXVAL( gdepw_0(:,:,:) ), '3w ', MAXVAL( gde3w_0(:,:,:) ) |
---|
196 | WRITE(numout,*) ' MAX val e3 t ', MAXVAL( e3t_0(:,:,:) ), ' f ', MAXVAL( e3f_0(:,:,:) ), & |
---|
197 | & ' u ', MAXVAL( e3u_0(:,:,:) ), ' u ', MAXVAL( e3v_0(:,:,:) ), & |
---|
198 | & ' uw', MAXVAL( e3uw_0(:,:,:) ), ' vw', MAXVAL( e3vw_0(:,:,:) ), & |
---|
199 | & ' w ', MAXVAL( e3w_0(:,:,:) ) |
---|
200 | ENDIF |
---|
201 | ! |
---|
202 | END SUBROUTINE dom_zgr |
---|
203 | |
---|
204 | |
---|
205 | SUBROUTINE zgr_read( ld_zco , ld_zps , ld_sco , ld_isfcav, & ! type of vertical coordinate |
---|
206 | & pdept_1d, pdepw_1d, pe3t_1d , pe3w_1d , & ! 1D reference vertical coordinate |
---|
207 | & pdept , pdepw , & ! 3D t & w-points depth |
---|
208 | & pe3t , pe3u , pe3v , pe3f , & ! vertical scale factors |
---|
209 | & pe3w , pe3uw , pe3vw , & ! - - - |
---|
210 | & k_top , k_bot ) ! top & bottom ocean level |
---|
211 | !!--------------------------------------------------------------------- |
---|
212 | !! *** ROUTINE zgr_read *** |
---|
213 | !! |
---|
214 | !! ** Purpose : Read the vertical information in the domain configuration file |
---|
215 | !! |
---|
216 | !!---------------------------------------------------------------------- |
---|
217 | LOGICAL , INTENT(out) :: ld_zco, ld_zps, ld_sco ! vertical coordinate flags |
---|
218 | LOGICAL , INTENT(out) :: ld_isfcav ! under iceshelf cavity flag |
---|
219 | REAL(wp), DIMENSION(:) , INTENT(out) :: pdept_1d, pdepw_1d ! 1D grid-point depth [m] |
---|
220 | REAL(wp), DIMENSION(:) , INTENT(out) :: pe3t_1d , pe3w_1d ! 1D vertical scale factors [m] |
---|
221 | REAL(wp), DIMENSION(:,:,:), INTENT(out) :: pdept, pdepw ! grid-point depth [m] |
---|
222 | REAL(wp), DIMENSION(:,:,:), INTENT(out) :: pe3t , pe3u , pe3v , pe3f ! vertical scale factors [m] |
---|
223 | REAL(wp), DIMENSION(:,:,:), INTENT(out) :: pe3w , pe3uw, pe3vw ! - - - |
---|
224 | INTEGER , DIMENSION(:,:) , INTENT(out) :: k_top , k_bot ! first & last ocean level |
---|
225 | ! |
---|
226 | INTEGER :: jk ! dummy loop index |
---|
227 | INTEGER :: inum ! local logical unit |
---|
228 | REAL(WP) :: z_zco, z_zps, z_sco, z_cav |
---|
229 | REAL(wp), DIMENSION(jpi,jpj) :: z2d ! 2D workspace |
---|
230 | !!---------------------------------------------------------------------- |
---|
231 | ! |
---|
232 | IF(lwp) THEN |
---|
233 | WRITE(numout,*) |
---|
234 | WRITE(numout,*) ' zgr_read : read the vertical coordinates in ', TRIM( cn_domcfg ), ' file' |
---|
235 | WRITE(numout,*) ' ~~~~~~~~' |
---|
236 | ENDIF |
---|
237 | ! |
---|
238 | CALL iom_open( cn_domcfg, inum ) |
---|
239 | ! |
---|
240 | ! !* type of vertical coordinate |
---|
241 | CALL iom_get( inum, 'ln_zco' , z_zco ) |
---|
242 | CALL iom_get( inum, 'ln_zps' , z_zps ) |
---|
243 | CALL iom_get( inum, 'ln_sco' , z_sco ) |
---|
244 | IF( z_zco == 0._wp ) THEN ; ld_zco = .false. ; ELSE ; ld_zco = .true. ; ENDIF |
---|
245 | IF( z_zps == 0._wp ) THEN ; ld_zps = .false. ; ELSE ; ld_zps = .true. ; ENDIF |
---|
246 | IF( z_sco == 0._wp ) THEN ; ld_sco = .false. ; ELSE ; ld_sco = .true. ; ENDIF |
---|
247 | ! |
---|
248 | ! !* ocean cavities under iceshelves |
---|
249 | CALL iom_get( inum, 'ln_isfcav', z_cav ) |
---|
250 | IF( z_cav == 0._wp ) THEN ; ld_isfcav = .false. ; ELSE ; ld_isfcav = .true. ; ENDIF |
---|
251 | ! |
---|
252 | ! !* vertical scale factors |
---|
253 | CALL iom_get( inum, jpdom_unknown, 'e3t_1d' , pe3t_1d ) ! 1D reference coordinate |
---|
254 | CALL iom_get( inum, jpdom_unknown, 'e3w_1d' , pe3w_1d ) |
---|
255 | ! |
---|
256 | CALL iom_get( inum, jpdom_global, 'e3t_0' , pe3t , cd_type = 'T', psgn = 1._wp, kfill = jpfillcopy ) ! 3D coordinate |
---|
257 | CALL iom_get( inum, jpdom_global, 'e3u_0' , pe3u , cd_type = 'U', psgn = 1._wp, kfill = jpfillcopy ) |
---|
258 | CALL iom_get( inum, jpdom_global, 'e3v_0' , pe3v , cd_type = 'V', psgn = 1._wp, kfill = jpfillcopy ) |
---|
259 | CALL iom_get( inum, jpdom_global, 'e3f_0' , pe3f , cd_type = 'F', psgn = 1._wp, kfill = jpfillcopy ) |
---|
260 | CALL iom_get( inum, jpdom_global, 'e3w_0' , pe3w , cd_type = 'W', psgn = 1._wp, kfill = jpfillcopy ) |
---|
261 | CALL iom_get( inum, jpdom_global, 'e3uw_0' , pe3uw, cd_type = 'U', psgn = 1._wp, kfill = jpfillcopy ) |
---|
262 | CALL iom_get( inum, jpdom_global, 'e3vw_0' , pe3vw, cd_type = 'V', psgn = 1._wp, kfill = jpfillcopy ) |
---|
263 | ! |
---|
264 | ! !* depths |
---|
265 | ! !- old depth definition (obsolescent feature) |
---|
266 | IF( iom_varid( inum, 'gdept_1d', ldstop = .FALSE. ) > 0 .AND. & |
---|
267 | & iom_varid( inum, 'gdepw_1d', ldstop = .FALSE. ) > 0 .AND. & |
---|
268 | & iom_varid( inum, 'gdept_0' , ldstop = .FALSE. ) > 0 .AND. & |
---|
269 | & iom_varid( inum, 'gdepw_0' , ldstop = .FALSE. ) > 0 ) THEN |
---|
270 | CALL ctl_warn( 'zgr_read : old definition of depths and scale factors used ', & |
---|
271 | & ' depths at t- and w-points read in the domain configuration file') |
---|
272 | CALL iom_get( inum, jpdom_unknown, 'gdept_1d', pdept_1d ) |
---|
273 | CALL iom_get( inum, jpdom_unknown, 'gdepw_1d', pdepw_1d ) |
---|
274 | CALL iom_get( inum, jpdom_global , 'gdept_0' , pdept, kfill = jpfillcopy ) |
---|
275 | CALL iom_get( inum, jpdom_global , 'gdepw_0' , pdepw, kfill = jpfillcopy ) |
---|
276 | ! |
---|
277 | ELSE !- depths computed from e3. scale factors |
---|
278 | CALL e3_to_depth( pe3t_1d, pe3w_1d, pdept_1d, pdepw_1d ) ! 1D reference depth |
---|
279 | CALL e3_to_depth( pe3t , pe3w , pdept , pdepw ) ! 3D depths |
---|
280 | IF(lwp) THEN |
---|
281 | WRITE(numout,*) |
---|
282 | WRITE(numout,*) ' Reference 1D z-coordinate depth and scale factors:' |
---|
283 | WRITE(numout, "(9x,' level gdept_1d gdepw_1d e3t_1d e3w_1d ')" ) |
---|
284 | WRITE(numout, "(10x, i4, 4f9.2)" ) ( jk, pdept_1d(jk), pdepw_1d(jk), pe3t_1d(jk), pe3w_1d(jk), jk = 1, jpk ) |
---|
285 | ENDIF |
---|
286 | ENDIF |
---|
287 | ! |
---|
288 | ! !* ocean top and bottom level |
---|
289 | CALL iom_get( inum, jpdom_global, 'top_level' , z2d ) ! 1st wet T-points (ISF) |
---|
290 | k_top(:,:) = NINT( z2d(:,:) ) |
---|
291 | CALL iom_get( inum, jpdom_global, 'bottom_level' , z2d ) ! last wet T-points |
---|
292 | k_bot(:,:) = NINT( z2d(:,:) ) |
---|
293 | ! |
---|
294 | ! reference depth for negative bathy (wetting and drying only) |
---|
295 | IF( ll_wd ) CALL iom_get( inum, 'rn_wd_ref_depth' , ssh_ref ) |
---|
296 | ! |
---|
297 | CALL iom_close( inum ) |
---|
298 | ! |
---|
299 | END SUBROUTINE zgr_read |
---|
300 | |
---|
301 | |
---|
302 | SUBROUTINE zgr_top_bot( k_top, k_bot ) |
---|
303 | !!---------------------------------------------------------------------- |
---|
304 | !! *** ROUTINE zgr_top_bot *** |
---|
305 | !! |
---|
306 | !! ** Purpose : defines the vertical index of ocean bottom (mbk. arrays) |
---|
307 | !! |
---|
308 | !! ** Method : computes from k_top and k_bot with a minimum value of 1 over land |
---|
309 | !! |
---|
310 | !! ** Action : mikt, miku, mikv : vertical indices of the shallowest |
---|
311 | !! ocean level at t-, u- & v-points |
---|
312 | !! (min value = 1) |
---|
313 | !! ** Action : mbkt, mbku, mbkv : vertical indices of the deeptest |
---|
314 | !! ocean level at t-, u- & v-points |
---|
315 | !! (min value = 1 over land) |
---|
316 | !!---------------------------------------------------------------------- |
---|
317 | INTEGER , DIMENSION(:,:), INTENT(in) :: k_top, k_bot ! top & bottom ocean level indices |
---|
318 | ! |
---|
319 | INTEGER :: ji, jj ! dummy loop indices |
---|
320 | REAL(wp), DIMENSION(jpi,jpj) :: zk ! workspace |
---|
321 | !!---------------------------------------------------------------------- |
---|
322 | ! |
---|
323 | IF(lwp) WRITE(numout,*) |
---|
324 | IF(lwp) WRITE(numout,*) ' zgr_top_bot : ocean top and bottom k-index of T-, U-, V- and W-levels ' |
---|
325 | IF(lwp) WRITE(numout,*) ' ~~~~~~~~~~~' |
---|
326 | ! |
---|
327 | mikt(:,:) = MAX( k_top(:,:) , 1 ) ! top ocean k-index of T-level (=1 over land) |
---|
328 | ! |
---|
329 | mbkt(:,:) = MAX( k_bot(:,:) , 1 ) ! bottom ocean k-index of T-level (=1 over land) |
---|
330 | |
---|
331 | ! ! N.B. top k-index of W-level = mikt |
---|
332 | ! ! bottom k-index of W-level = mbkt+1 |
---|
333 | DO_2D_10_10 |
---|
334 | miku(ji,jj) = MAX( mikt(ji+1,jj ) , mikt(ji,jj) ) |
---|
335 | mikv(ji,jj) = MAX( mikt(ji ,jj+1) , mikt(ji,jj) ) |
---|
336 | mikf(ji,jj) = MAX( mikt(ji ,jj+1) , mikt(ji,jj), mikt(ji+1,jj ), mikt(ji+1,jj+1) ) |
---|
337 | ! |
---|
338 | mbku(ji,jj) = MIN( mbkt(ji+1,jj ) , mbkt(ji,jj) ) |
---|
339 | mbkv(ji,jj) = MIN( mbkt(ji ,jj+1) , mbkt(ji,jj) ) |
---|
340 | END_2D |
---|
341 | ! converte into REAL to use lbc_lnk ; impose a min value of 1 as a zero can be set in lbclnk |
---|
342 | zk(:,:) = REAL( miku(:,:), wp ) ; CALL lbc_lnk( 'domzgr', zk, 'U', 1. ) ; miku(:,:) = MAX( NINT( zk(:,:) ), 1 ) |
---|
343 | zk(:,:) = REAL( mikv(:,:), wp ) ; CALL lbc_lnk( 'domzgr', zk, 'V', 1. ) ; mikv(:,:) = MAX( NINT( zk(:,:) ), 1 ) |
---|
344 | zk(:,:) = REAL( mikf(:,:), wp ) ; CALL lbc_lnk( 'domzgr', zk, 'F', 1. ) ; mikf(:,:) = MAX( NINT( zk(:,:) ), 1 ) |
---|
345 | ! |
---|
346 | zk(:,:) = REAL( mbku(:,:), wp ) ; CALL lbc_lnk( 'domzgr', zk, 'U', 1. ) ; mbku(:,:) = MAX( NINT( zk(:,:) ), 1 ) |
---|
347 | zk(:,:) = REAL( mbkv(:,:), wp ) ; CALL lbc_lnk( 'domzgr', zk, 'V', 1. ) ; mbkv(:,:) = MAX( NINT( zk(:,:) ), 1 ) |
---|
348 | ! |
---|
349 | END SUBROUTINE zgr_top_bot |
---|
350 | |
---|
351 | !!====================================================================== |
---|
352 | END MODULE domzgr |
---|