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 | ! make sure that closed boundaries are correctly defined in k_top that will be used to compute all mask arrays |
---|
114 | ! |
---|
115 | zmsk(:,:) = 1._wp ! default: no closed boundaries |
---|
116 | IF( jperio == 0 .OR. jperio == 2 .OR. jperio == 3 .OR. jperio == 5 ) THEN ! E-W closed |
---|
117 | zmsk( mi0( 1+nn_hls):mi1( 1+nn_hls),:) = 0._wp ! first column of inner global domain at 0 |
---|
118 | zmsk( mi0(jpiglo-nn_hls):mi1(jpiglo-nn_hls),:) = 0._wp ! last column of inner global domain at 0 |
---|
119 | ENDIF |
---|
120 | IF( .NOT. ( jperio == 2 .OR. jperio == 7 ) ) THEN ! S closed |
---|
121 | zmsk(:,mj0( 1+nn_hls):mj1( 1+nn_hls) ) = 0._wp ! first line of inner global domain at 0 |
---|
122 | ENDIF |
---|
123 | IF( jperio == 0 .OR. jperio == 1 ) THEN ! N closed |
---|
124 | zmsk(:,mj0(jpjglo-nn_hls):mj1(jpjglo-nn_hls) ) = 0._wp ! last line of inner global domain at 0 |
---|
125 | ENDIF |
---|
126 | CALL lbc_lnk( 'usrdef_zgr', zmsk, 'T', 1. ) ! set halos |
---|
127 | k_top(:,:) = k_top(:,:) * NINT( zmsk(:,:) ) |
---|
128 | ! |
---|
129 | !!gm to be remove when removing the OLD definition of e3 scale factors so that gde3w disappears |
---|
130 | ! Compute gde3w_0 (vertical sum of e3w) |
---|
131 | gde3w_0(:,:,1) = 0.5_wp * e3w_0(:,:,1) |
---|
132 | DO jk = 2, jpk |
---|
133 | gde3w_0(:,:,jk) = gde3w_0(:,:,jk-1) + e3w_0(:,:,jk) |
---|
134 | END DO |
---|
135 | ! |
---|
136 | ! Any closed seas (defined by closea_mask > 0 in domain_cfg file) to be filled |
---|
137 | ! in at runtime if ln_closea=.false. |
---|
138 | IF( ln_closea ) THEN |
---|
139 | IF ( ln_maskcs ) THEN |
---|
140 | ! mask all the closed sea |
---|
141 | CALL clo_msk( k_top, k_bot, mask_opnsea, 'mask_opensea' ) |
---|
142 | ELSE IF ( ln_mask_csundef ) THEN |
---|
143 | ! defined closed sea are kept |
---|
144 | ! mask all the undefined closed sea |
---|
145 | CALL clo_msk( k_top, k_bot, mask_csundef, 'mask_csundef' ) |
---|
146 | END IF |
---|
147 | END IF |
---|
148 | ! |
---|
149 | IF(lwp) THEN ! Control print |
---|
150 | WRITE(numout,*) |
---|
151 | WRITE(numout,*) ' Type of vertical coordinate (read in ', TRIM( cn_domcfg ), ' file or set in userdef_nam) :' |
---|
152 | WRITE(numout,*) ' z-coordinate - full steps ln_zco = ', ln_zco |
---|
153 | WRITE(numout,*) ' z-coordinate - partial steps ln_zps = ', ln_zps |
---|
154 | WRITE(numout,*) ' s- or hybrid z-s-coordinate ln_sco = ', ln_sco |
---|
155 | WRITE(numout,*) ' ice shelf cavities ln_isfcav = ', ln_isfcav |
---|
156 | ENDIF |
---|
157 | |
---|
158 | ioptio = 0 ! Check Vertical coordinate options |
---|
159 | IF( ln_zco ) ioptio = ioptio + 1 |
---|
160 | IF( ln_zps ) ioptio = ioptio + 1 |
---|
161 | IF( ln_sco ) ioptio = ioptio + 1 |
---|
162 | IF( ioptio /= 1 ) CALL ctl_stop( ' none or several vertical coordinate options used' ) |
---|
163 | |
---|
164 | |
---|
165 | ! ! top/bottom ocean level indices for t-, u- and v-points (f-point also for top) |
---|
166 | CALL zgr_top_bot( k_top, k_bot ) ! with a minimum value set to 1 |
---|
167 | ! |
---|
168 | ! ! ice shelf draft and bathymetry |
---|
169 | DO_2D_11_11 |
---|
170 | ikt = mikt(ji,jj) |
---|
171 | ikb = mbkt(ji,jj) |
---|
172 | bathy (ji,jj) = gdepw_0(ji,jj,ikb+1) |
---|
173 | risfdep(ji,jj) = gdepw_0(ji,jj,ikt ) |
---|
174 | END_2D |
---|
175 | ! |
---|
176 | ! ! deepest/shallowest W level Above/Below ~10m |
---|
177 | !!gm BUG in s-coordinate this does not work! |
---|
178 | zrefdep = 10._wp - 0.1_wp * MINVAL( e3w_1d ) ! ref. depth with tolerance (10% of minimum layer thickness) |
---|
179 | nlb10 = MINLOC( gdepw_1d, mask = gdepw_1d > zrefdep, dim = 1 ) ! shallowest W level Below ~10m |
---|
180 | nla10 = nlb10 - 1 ! deepest W level Above ~10m |
---|
181 | !!gm end bug |
---|
182 | ! |
---|
183 | IF( nprint == 1 .AND. lwp ) THEN |
---|
184 | WRITE(numout,*) ' MIN val k_top ', MINVAL( k_top(:,:) ), ' MAX ', MAXVAL( k_top(:,:) ) |
---|
185 | WRITE(numout,*) ' MIN val k_bot ', MINVAL( k_bot(:,:) ), ' MAX ', MAXVAL( k_bot(:,:) ) |
---|
186 | WRITE(numout,*) ' MIN val depth t ', MINVAL( gdept_0(:,:,:) ), & |
---|
187 | & ' w ', MINVAL( gdepw_0(:,:,:) ), '3w ', MINVAL( gde3w_0(:,:,:) ) |
---|
188 | WRITE(numout,*) ' MIN val e3 t ', MINVAL( e3t_0(:,:,:) ), ' f ', MINVAL( e3f_0(:,:,:) ), & |
---|
189 | & ' u ', MINVAL( e3u_0(:,:,:) ), ' u ', MINVAL( e3v_0(:,:,:) ), & |
---|
190 | & ' uw', MINVAL( e3uw_0(:,:,:) ), ' vw', MINVAL( e3vw_0(:,:,:)), & |
---|
191 | & ' w ', MINVAL( e3w_0(:,:,:) ) |
---|
192 | |
---|
193 | WRITE(numout,*) ' MAX val depth t ', MAXVAL( gdept_0(:,:,:) ), & |
---|
194 | & ' w ', MAXVAL( gdepw_0(:,:,:) ), '3w ', MAXVAL( gde3w_0(:,:,:) ) |
---|
195 | WRITE(numout,*) ' MAX val e3 t ', MAXVAL( e3t_0(:,:,:) ), ' f ', MAXVAL( e3f_0(:,:,:) ), & |
---|
196 | & ' u ', MAXVAL( e3u_0(:,:,:) ), ' u ', MAXVAL( e3v_0(:,:,:) ), & |
---|
197 | & ' uw', MAXVAL( e3uw_0(:,:,:) ), ' vw', MAXVAL( e3vw_0(:,:,:) ), & |
---|
198 | & ' w ', MAXVAL( e3w_0(:,:,:) ) |
---|
199 | ENDIF |
---|
200 | ! |
---|
201 | END SUBROUTINE dom_zgr |
---|
202 | |
---|
203 | |
---|
204 | SUBROUTINE zgr_read( ld_zco , ld_zps , ld_sco , ld_isfcav, & ! type of vertical coordinate |
---|
205 | & pdept_1d, pdepw_1d, pe3t_1d , pe3w_1d , & ! 1D reference vertical coordinate |
---|
206 | & pdept , pdepw , & ! 3D t & w-points depth |
---|
207 | & pe3t , pe3u , pe3v , pe3f , & ! vertical scale factors |
---|
208 | & pe3w , pe3uw , pe3vw , & ! - - - |
---|
209 | & k_top , k_bot ) ! top & bottom ocean level |
---|
210 | !!--------------------------------------------------------------------- |
---|
211 | !! *** ROUTINE zgr_read *** |
---|
212 | !! |
---|
213 | !! ** Purpose : Read the vertical information in the domain configuration file |
---|
214 | !! |
---|
215 | !!---------------------------------------------------------------------- |
---|
216 | LOGICAL , INTENT(out) :: ld_zco, ld_zps, ld_sco ! vertical coordinate flags |
---|
217 | LOGICAL , INTENT(out) :: ld_isfcav ! under iceshelf cavity flag |
---|
218 | REAL(wp), DIMENSION(:) , INTENT(out) :: pdept_1d, pdepw_1d ! 1D grid-point depth [m] |
---|
219 | REAL(wp), DIMENSION(:) , INTENT(out) :: pe3t_1d , pe3w_1d ! 1D vertical scale factors [m] |
---|
220 | REAL(wp), DIMENSION(:,:,:), INTENT(out) :: pdept, pdepw ! grid-point depth [m] |
---|
221 | REAL(wp), DIMENSION(:,:,:), INTENT(out) :: pe3t , pe3u , pe3v , pe3f ! vertical scale factors [m] |
---|
222 | REAL(wp), DIMENSION(:,:,:), INTENT(out) :: pe3w , pe3uw, pe3vw ! - - - |
---|
223 | INTEGER , DIMENSION(:,:) , INTENT(out) :: k_top , k_bot ! first & last ocean level |
---|
224 | ! |
---|
225 | INTEGER :: jk ! dummy loop index |
---|
226 | INTEGER :: inum ! local logical unit |
---|
227 | REAL(WP) :: z_zco, z_zps, z_sco, z_cav |
---|
228 | REAL(wp), DIMENSION(jpi,jpj) :: z2d ! 2D workspace |
---|
229 | !!---------------------------------------------------------------------- |
---|
230 | ! |
---|
231 | IF(lwp) THEN |
---|
232 | WRITE(numout,*) |
---|
233 | WRITE(numout,*) ' zgr_read : read the vertical coordinates in ', TRIM( cn_domcfg ), ' file' |
---|
234 | WRITE(numout,*) ' ~~~~~~~~' |
---|
235 | ENDIF |
---|
236 | ! |
---|
237 | CALL iom_open( cn_domcfg, inum ) |
---|
238 | ! |
---|
239 | ! !* type of vertical coordinate |
---|
240 | CALL iom_get( inum, 'ln_zco' , z_zco ) |
---|
241 | CALL iom_get( inum, 'ln_zps' , z_zps ) |
---|
242 | CALL iom_get( inum, 'ln_sco' , z_sco ) |
---|
243 | IF( z_zco == 0._wp ) THEN ; ld_zco = .false. ; ELSE ; ld_zco = .true. ; ENDIF |
---|
244 | IF( z_zps == 0._wp ) THEN ; ld_zps = .false. ; ELSE ; ld_zps = .true. ; ENDIF |
---|
245 | IF( z_sco == 0._wp ) THEN ; ld_sco = .false. ; ELSE ; ld_sco = .true. ; ENDIF |
---|
246 | ! |
---|
247 | ! !* ocean cavities under iceshelves |
---|
248 | CALL iom_get( inum, 'ln_isfcav', z_cav ) |
---|
249 | IF( z_cav == 0._wp ) THEN ; ld_isfcav = .false. ; ELSE ; ld_isfcav = .true. ; ENDIF |
---|
250 | ! |
---|
251 | ! !* vertical scale factors |
---|
252 | CALL iom_get( inum, jpdom_unknown, 'e3t_1d' , pe3t_1d ) ! 1D reference coordinate |
---|
253 | CALL iom_get( inum, jpdom_unknown, 'e3w_1d' , pe3w_1d ) |
---|
254 | ! |
---|
255 | CALL iom_get( inum, jpdom_global, 'e3t_0' , pe3t , cd_type = 'T', psgn = 1._wp, kfill = jpfillcopy ) ! 3D coordinate |
---|
256 | CALL iom_get( inum, jpdom_global, 'e3u_0' , pe3u , cd_type = 'U', psgn = 1._wp, kfill = jpfillcopy ) |
---|
257 | CALL iom_get( inum, jpdom_global, 'e3v_0' , pe3v , cd_type = 'V', psgn = 1._wp, kfill = jpfillcopy ) |
---|
258 | CALL iom_get( inum, jpdom_global, 'e3f_0' , pe3f , cd_type = 'F', psgn = 1._wp, kfill = jpfillcopy ) |
---|
259 | CALL iom_get( inum, jpdom_global, 'e3w_0' , pe3w , cd_type = 'W', psgn = 1._wp, kfill = jpfillcopy ) |
---|
260 | CALL iom_get( inum, jpdom_global, 'e3uw_0' , pe3uw, cd_type = 'U', psgn = 1._wp, kfill = jpfillcopy ) |
---|
261 | CALL iom_get( inum, jpdom_global, 'e3vw_0' , pe3vw, cd_type = 'V', psgn = 1._wp, kfill = jpfillcopy ) |
---|
262 | ! |
---|
263 | ! !* depths |
---|
264 | ! !- old depth definition (obsolescent feature) |
---|
265 | IF( iom_varid( inum, 'gdept_1d', ldstop = .FALSE. ) > 0 .AND. & |
---|
266 | & iom_varid( inum, 'gdepw_1d', ldstop = .FALSE. ) > 0 .AND. & |
---|
267 | & iom_varid( inum, 'gdept_0' , ldstop = .FALSE. ) > 0 .AND. & |
---|
268 | & iom_varid( inum, 'gdepw_0' , ldstop = .FALSE. ) > 0 ) THEN |
---|
269 | CALL ctl_warn( 'zgr_read : old definition of depths and scale factors used ', & |
---|
270 | & ' depths at t- and w-points read in the domain configuration file') |
---|
271 | CALL iom_get( inum, jpdom_unknown, 'gdept_1d', pdept_1d ) |
---|
272 | CALL iom_get( inum, jpdom_unknown, 'gdepw_1d', pdepw_1d ) |
---|
273 | CALL iom_get( inum, jpdom_global , 'gdept_0' , pdept, kfill = jpfillcopy ) |
---|
274 | CALL iom_get( inum, jpdom_global , 'gdepw_0' , pdepw, kfill = jpfillcopy ) |
---|
275 | ! |
---|
276 | ELSE !- depths computed from e3. scale factors |
---|
277 | CALL e3_to_depth( pe3t_1d, pe3w_1d, pdept_1d, pdepw_1d ) ! 1D reference depth |
---|
278 | CALL e3_to_depth( pe3t , pe3w , pdept , pdepw ) ! 3D depths |
---|
279 | IF(lwp) THEN |
---|
280 | WRITE(numout,*) |
---|
281 | WRITE(numout,*) ' Reference 1D z-coordinate depth and scale factors:' |
---|
282 | WRITE(numout, "(9x,' level gdept_1d gdepw_1d e3t_1d e3w_1d ')" ) |
---|
283 | WRITE(numout, "(10x, i4, 4f9.2)" ) ( jk, pdept_1d(jk), pdepw_1d(jk), pe3t_1d(jk), pe3w_1d(jk), jk = 1, jpk ) |
---|
284 | ENDIF |
---|
285 | ENDIF |
---|
286 | ! |
---|
287 | ! !* ocean top and bottom level |
---|
288 | CALL iom_get( inum, jpdom_global, 'top_level' , z2d ) ! 1st wet T-points (ISF) |
---|
289 | k_top(:,:) = NINT( z2d(:,:) ) |
---|
290 | CALL iom_get( inum, jpdom_global, 'bottom_level' , z2d ) ! last wet T-points |
---|
291 | k_bot(:,:) = NINT( z2d(:,:) ) |
---|
292 | ! |
---|
293 | ! reference depth for negative bathy (wetting and drying only) |
---|
294 | IF( ll_wd ) CALL iom_get( inum, 'rn_wd_ref_depth' , ssh_ref ) |
---|
295 | ! |
---|
296 | CALL iom_close( inum ) |
---|
297 | ! |
---|
298 | END SUBROUTINE zgr_read |
---|
299 | |
---|
300 | |
---|
301 | SUBROUTINE zgr_top_bot( k_top, k_bot ) |
---|
302 | !!---------------------------------------------------------------------- |
---|
303 | !! *** ROUTINE zgr_top_bot *** |
---|
304 | !! |
---|
305 | !! ** Purpose : defines the vertical index of ocean bottom (mbk. arrays) |
---|
306 | !! |
---|
307 | !! ** Method : computes from k_top and k_bot with a minimum value of 1 over land |
---|
308 | !! |
---|
309 | !! ** Action : mikt, miku, mikv : vertical indices of the shallowest |
---|
310 | !! ocean level at t-, u- & v-points |
---|
311 | !! (min value = 1) |
---|
312 | !! ** Action : mbkt, mbku, mbkv : vertical indices of the deeptest |
---|
313 | !! ocean level at t-, u- & v-points |
---|
314 | !! (min value = 1 over land) |
---|
315 | !!---------------------------------------------------------------------- |
---|
316 | INTEGER , DIMENSION(:,:), INTENT(in) :: k_top, k_bot ! top & bottom ocean level indices |
---|
317 | ! |
---|
318 | INTEGER :: ji, jj ! dummy loop indices |
---|
319 | REAL(wp), DIMENSION(jpi,jpj) :: zk ! workspace |
---|
320 | !!---------------------------------------------------------------------- |
---|
321 | ! |
---|
322 | IF(lwp) WRITE(numout,*) |
---|
323 | IF(lwp) WRITE(numout,*) ' zgr_top_bot : ocean top and bottom k-index of T-, U-, V- and W-levels ' |
---|
324 | IF(lwp) WRITE(numout,*) ' ~~~~~~~~~~~' |
---|
325 | ! |
---|
326 | mikt(:,:) = MAX( k_top(:,:) , 1 ) ! top ocean k-index of T-level (=1 over land) |
---|
327 | ! |
---|
328 | mbkt(:,:) = MAX( k_bot(:,:) , 1 ) ! bottom ocean k-index of T-level (=1 over land) |
---|
329 | |
---|
330 | ! ! N.B. top k-index of W-level = mikt |
---|
331 | ! ! bottom k-index of W-level = mbkt+1 |
---|
332 | DO_2D_10_10 |
---|
333 | miku(ji,jj) = MAX( mikt(ji+1,jj ) , mikt(ji,jj) ) |
---|
334 | mikv(ji,jj) = MAX( mikt(ji ,jj+1) , mikt(ji,jj) ) |
---|
335 | mikf(ji,jj) = MAX( mikt(ji ,jj+1) , mikt(ji,jj), mikt(ji+1,jj ), mikt(ji+1,jj+1) ) |
---|
336 | ! |
---|
337 | mbku(ji,jj) = MIN( mbkt(ji+1,jj ) , mbkt(ji,jj) ) |
---|
338 | mbkv(ji,jj) = MIN( mbkt(ji ,jj+1) , mbkt(ji,jj) ) |
---|
339 | END_2D |
---|
340 | ! converte into REAL to use lbc_lnk ; impose a min value of 1 as a zero can be set in lbclnk |
---|
341 | zk(:,:) = REAL( miku(:,:), wp ) ; CALL lbc_lnk( 'domzgr', zk, 'U', 1. ) ; miku(:,:) = MAX( NINT( zk(:,:) ), 1 ) |
---|
342 | zk(:,:) = REAL( mikv(:,:), wp ) ; CALL lbc_lnk( 'domzgr', zk, 'V', 1. ) ; mikv(:,:) = MAX( NINT( zk(:,:) ), 1 ) |
---|
343 | zk(:,:) = REAL( mikf(:,:), wp ) ; CALL lbc_lnk( 'domzgr', zk, 'F', 1. ) ; mikf(:,:) = MAX( NINT( zk(:,:) ), 1 ) |
---|
344 | ! |
---|
345 | zk(:,:) = REAL( mbku(:,:), wp ) ; CALL lbc_lnk( 'domzgr', zk, 'U', 1. ) ; mbku(:,:) = MAX( NINT( zk(:,:) ), 1 ) |
---|
346 | zk(:,:) = REAL( mbkv(:,:), wp ) ; CALL lbc_lnk( 'domzgr', zk, 'V', 1. ) ; mbkv(:,:) = MAX( NINT( zk(:,:) ), 1 ) |
---|
347 | ! |
---|
348 | END SUBROUTINE zgr_top_bot |
---|
349 | |
---|
350 | !!====================================================================== |
---|
351 | END MODULE domzgr |
---|