1 | MODULE dommsk |
---|
2 | !!====================================================================== |
---|
3 | !! *** MODULE dommsk *** |
---|
4 | !! Ocean initialization : domain land/sea mask |
---|
5 | !!====================================================================== |
---|
6 | !! History : OPA ! 1987-07 (G. Madec) Original code |
---|
7 | !! 6.0 ! 1993-03 (M. Guyon) symetrical conditions (M. Guyon) |
---|
8 | !! 7.0 ! 1996-01 (G. Madec) suppression of common work arrays |
---|
9 | !! - ! 1996-05 (G. Madec) mask computed from tmask |
---|
10 | !! 8.0 ! 1997-02 (G. Madec) mesh information put in domhgr.F |
---|
11 | !! 8.1 ! 1997-07 (G. Madec) modification of kbat and fmask |
---|
12 | !! - ! 1998-05 (G. Roullet) free surface |
---|
13 | !! 8.2 ! 2000-03 (G. Madec) no slip accurate |
---|
14 | !! - ! 2001-09 (J.-M. Molines) Open boundaries |
---|
15 | !! NEMO 1.0 ! 2002-08 (G. Madec) F90: Free form and module |
---|
16 | !! - ! 2005-11 (V. Garnier) Surface pressure gradient organization |
---|
17 | !! 3.2 ! 2009-07 (R. Benshila) Suppression of rigid-lid option |
---|
18 | !! 3.6 ! 2015-05 (P. Mathiot) ISF: add wmask,wumask and wvmask |
---|
19 | !! 4.0 ! 2016-06 (G. Madec, S. Flavoni) domain configuration / user defined interface |
---|
20 | !!---------------------------------------------------------------------- |
---|
21 | |
---|
22 | !!---------------------------------------------------------------------- |
---|
23 | !! dom_msk : compute land/ocean mask |
---|
24 | !!---------------------------------------------------------------------- |
---|
25 | USE oce ! ocean dynamics and tracers |
---|
26 | USE dom_oce ! ocean space and time domain |
---|
27 | USE domutl ! |
---|
28 | USE usrdef_fmask ! user defined fmask |
---|
29 | USE bdy_oce ! open boundary |
---|
30 | ! |
---|
31 | USE in_out_manager ! I/O manager |
---|
32 | USE iom ! IOM library |
---|
33 | USE lbclnk ! ocean lateral boundary conditions (or mpp link) |
---|
34 | USE lib_mpp ! Massively Parallel Processing library |
---|
35 | |
---|
36 | IMPLICIT NONE |
---|
37 | PRIVATE |
---|
38 | |
---|
39 | PUBLIC dom_msk ! routine called by inidom.F90 |
---|
40 | |
---|
41 | ! !!* Namelist namlbc : lateral boundary condition * |
---|
42 | REAL(wp) :: rn_shlat ! type of lateral boundary condition on velocity |
---|
43 | LOGICAL, PUBLIC :: ln_vorlat ! consistency of vorticity boundary condition |
---|
44 | ! with analytical eqs. |
---|
45 | |
---|
46 | !! * Substitutions |
---|
47 | # include "do_loop_substitute.h90" |
---|
48 | !!---------------------------------------------------------------------- |
---|
49 | !! NEMO/OCE 4.0 , NEMO Consortium (2018) |
---|
50 | !! $Id$ |
---|
51 | !! Software governed by the CeCILL license (see ./LICENSE) |
---|
52 | !!---------------------------------------------------------------------- |
---|
53 | CONTAINS |
---|
54 | |
---|
55 | SUBROUTINE dom_msk( k_top, k_bot ) |
---|
56 | !!--------------------------------------------------------------------- |
---|
57 | !! *** ROUTINE dom_msk *** |
---|
58 | !! |
---|
59 | !! ** Purpose : Compute land/ocean mask arrays at tracer points, hori- |
---|
60 | !! zontal velocity points (u & v), vorticity points (f) points. |
---|
61 | !! |
---|
62 | !! ** Method : The ocean/land mask at t-point is deduced from ko_top |
---|
63 | !! and ko_bot, the indices of the fist and last ocean t-levels which |
---|
64 | !! are either defined in usrdef_zgr or read in zgr_read. |
---|
65 | !! The velocity masks (umask, vmask, wmask, wumask, wvmask) |
---|
66 | !! are deduced from a product of the two neighboring tmask. |
---|
67 | !! The vorticity mask (fmask) is deduced from tmask taking |
---|
68 | !! into account the choice of lateral boundary condition (rn_shlat) : |
---|
69 | !! rn_shlat = 0, free slip (no shear along the coast) |
---|
70 | !! rn_shlat = 2, no slip (specified zero velocity at the coast) |
---|
71 | !! 0 < rn_shlat < 2, partial slip | non-linear velocity profile |
---|
72 | !! 2 < rn_shlat, strong slip | in the lateral boundary layer |
---|
73 | !! |
---|
74 | !! tmask_i : interior ocean mask at t-point, i.e. excluding duplicated |
---|
75 | !! rows/lines due to cyclic or North Fold boundaries as well |
---|
76 | !! as MPP halos. |
---|
77 | !! tmask_h : halo mask at t-point, i.e. excluding duplicated rows/lines |
---|
78 | !! due to cyclic or North Fold boundaries as well as MPP halos. |
---|
79 | !! |
---|
80 | !! ** Action : tmask, umask, vmask, wmask, wumask, wvmask : land/ocean mask |
---|
81 | !! at t-, u-, v- w, wu-, and wv-points (=0. or 1.) |
---|
82 | !! fmask : land/ocean mask at f-point (=0., or =1., or |
---|
83 | !! =rn_shlat along lateral boundaries) |
---|
84 | !! tmask_i : interior ocean mask |
---|
85 | !! tmask_h : halo mask |
---|
86 | !! ssmask , ssumask, ssvmask, ssfmask : 2D ocean mask |
---|
87 | !!---------------------------------------------------------------------- |
---|
88 | INTEGER, DIMENSION(:,:), INTENT(in) :: k_top, k_bot ! first and last ocean level |
---|
89 | ! |
---|
90 | INTEGER :: ji, jj, jk ! dummy loop indices |
---|
91 | INTEGER :: iktop, ikbot ! - - |
---|
92 | INTEGER :: ios, inum |
---|
93 | REAL(wp), ALLOCATABLE, DIMENSION(:,:) :: zwf ! 2D workspace |
---|
94 | !! |
---|
95 | NAMELIST/namlbc/ rn_shlat, ln_vorlat |
---|
96 | NAMELIST/nambdy/ ln_bdy ,nb_bdy, ln_coords_file, cn_coords_file, & |
---|
97 | & ln_mask_file, cn_mask_file, cn_dyn2d, nn_dyn2d_dta, & |
---|
98 | & cn_dyn3d, nn_dyn3d_dta, cn_tra, nn_tra_dta, & |
---|
99 | & ln_tra_dmp, ln_dyn3d_dmp, rn_time_dmp, rn_time_dmp_out, & |
---|
100 | & cn_ice, nn_ice_dta, & |
---|
101 | & ln_vol, nn_volctl, nn_rimwidth |
---|
102 | !!--------------------------------------------------------------------- |
---|
103 | ! |
---|
104 | READ ( numnam_ref, namlbc, IOSTAT = ios, ERR = 901 ) |
---|
105 | 901 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namlbc in reference namelist' ) |
---|
106 | READ ( numnam_cfg, namlbc, IOSTAT = ios, ERR = 902 ) |
---|
107 | 902 IF( ios > 0 ) CALL ctl_nam ( ios , 'namlbc in configuration namelist' ) |
---|
108 | IF(lwm) WRITE ( numond, namlbc ) |
---|
109 | |
---|
110 | IF(lwp) THEN ! control print |
---|
111 | WRITE(numout,*) |
---|
112 | WRITE(numout,*) 'dommsk : ocean mask ' |
---|
113 | WRITE(numout,*) '~~~~~~' |
---|
114 | WRITE(numout,*) ' Namelist namlbc' |
---|
115 | WRITE(numout,*) ' lateral momentum boundary cond. rn_shlat = ',rn_shlat |
---|
116 | WRITE(numout,*) ' consistency with analytical form ln_vorlat = ',ln_vorlat |
---|
117 | ENDIF |
---|
118 | ! |
---|
119 | IF(lwp) WRITE(numout,*) |
---|
120 | IF ( rn_shlat == 0. ) THEN ; IF(lwp) WRITE(numout,*) ' ==>>> ocean lateral free-slip' |
---|
121 | ELSEIF ( rn_shlat == 2. ) THEN ; IF(lwp) WRITE(numout,*) ' ==>>> ocean lateral no-slip' |
---|
122 | ELSEIF ( 0. < rn_shlat .AND. rn_shlat < 2. ) THEN ; IF(lwp) WRITE(numout,*) ' ==>>> ocean lateral partial-slip' |
---|
123 | ELSEIF ( 2. < rn_shlat ) THEN ; IF(lwp) WRITE(numout,*) ' ==>>> ocean lateral strong-slip' |
---|
124 | ELSE |
---|
125 | CALL ctl_stop( 'dom_msk: wrong value for rn_shlat (i.e. a negalive value). We stop.' ) |
---|
126 | ENDIF |
---|
127 | |
---|
128 | ! Ocean/land mask at t-point (computed from ko_top and ko_bot) |
---|
129 | ! ---------------------------- |
---|
130 | ! |
---|
131 | tmask(:,:,:) = 0._wp |
---|
132 | DO_2D_11_11 |
---|
133 | iktop = k_top(ji,jj) |
---|
134 | ikbot = k_bot(ji,jj) |
---|
135 | IF( iktop /= 0 ) THEN ! water in the column |
---|
136 | tmask(ji,jj,iktop:ikbot) = 1._wp |
---|
137 | ENDIF |
---|
138 | END_2D |
---|
139 | ! |
---|
140 | ! the following is mandatory |
---|
141 | ! it masks boundaries (bathy=0) where needed depending on the configuration (closed, periodic...) |
---|
142 | !!$ IF( .NOT. (nbondj == 1 .OR. nbondj == 0 .OR. l_Jperio) ) THEN |
---|
143 | !!$ tmask(mi0( 1 ):mi1(jpiglo),mj0(Njs0):mj1(Njs0 ),:) = 0._wp ! line number Njs0 at 0 |
---|
144 | !!$ ENDIF |
---|
145 | !!$ IF( .NOT. (nbondi == 1 .OR. nbondi == 0 .OR. l_Iperio) ) THEN |
---|
146 | !!$ tmask(mi0(Nis0):mi1( Nis0),mj0( 1 ):mj1(jpjglo),:) = 0._wp ! column number Nis0 at 0 |
---|
147 | !!$ ENDIF |
---|
148 | !!$ CALL lbc_lnk( 'dommsk', tmask, 'T', 1._wp ) ! Lateral boundary conditions |
---|
149 | |
---|
150 | ! Mask corrections for bdy (read in mppini2) |
---|
151 | READ ( numnam_ref, nambdy, IOSTAT = ios, ERR = 903) |
---|
152 | 903 IF( ios /= 0 ) CALL ctl_nam ( ios , 'nambdy in reference namelist' ) |
---|
153 | READ ( numnam_cfg, nambdy, IOSTAT = ios, ERR = 904 ) |
---|
154 | 904 IF( ios > 0 ) CALL ctl_nam ( ios , 'nambdy in configuration namelist' ) |
---|
155 | ! ------------------------ |
---|
156 | IF ( ln_bdy .AND. ln_mask_file ) THEN |
---|
157 | CALL iom_open( cn_mask_file, inum ) |
---|
158 | CALL iom_get ( inum, jpdom_global, 'bdy_msk', bdytmask(:,:) ) |
---|
159 | CALL iom_close( inum ) |
---|
160 | DO_3D_11_11( 1, jpkm1 ) |
---|
161 | tmask(ji,jj,jk) = tmask(ji,jj,jk) * bdytmask(ji,jj) |
---|
162 | END_3D |
---|
163 | ENDIF |
---|
164 | |
---|
165 | ! Ocean/land mask at u-, v-, and f-points (computed from tmask) |
---|
166 | ! ---------------------------------------- |
---|
167 | ! NB: at this point, fmask is designed for free slip lateral boundary condition |
---|
168 | DO_3D_00_00( 1, jpk ) |
---|
169 | umask(ji,jj,jk) = tmask(ji,jj ,jk) * tmask(ji+1,jj ,jk) |
---|
170 | vmask(ji,jj,jk) = tmask(ji,jj ,jk) * tmask(ji ,jj+1,jk) |
---|
171 | fmask(ji,jj,jk) = tmask(ji,jj ,jk) * tmask(ji+1,jj ,jk) & |
---|
172 | & * tmask(ji,jj+1,jk) * tmask(ji+1,jj+1,jk) |
---|
173 | END_3D |
---|
174 | CALL lbc_lnk_multi( 'dommsk', umask, 'U', 1., vmask, 'V', 1., fmask, 'F', 1. ) ! Lateral boundary conditions |
---|
175 | |
---|
176 | ! Ocean/land mask at wu-, wv- and w points (computed from tmask) |
---|
177 | !----------------------------------------- |
---|
178 | wmask (:,:,1) = tmask(:,:,1) ! surface |
---|
179 | wumask(:,:,1) = umask(:,:,1) |
---|
180 | wvmask(:,:,1) = vmask(:,:,1) |
---|
181 | DO jk = 2, jpk ! interior values |
---|
182 | wmask (:,:,jk) = tmask(:,:,jk) * tmask(:,:,jk-1) |
---|
183 | wumask(:,:,jk) = umask(:,:,jk) * umask(:,:,jk-1) |
---|
184 | wvmask(:,:,jk) = vmask(:,:,jk) * vmask(:,:,jk-1) |
---|
185 | END DO |
---|
186 | |
---|
187 | ! Ocean/land column mask at t-, u-, and v-points (i.e. at least 1 wet cell in the vertical) |
---|
188 | ! ---------------------------------------------- |
---|
189 | ssmask (:,:) = MAXVAL( tmask(:,:,:), DIM=3 ) |
---|
190 | ssumask(:,:) = MAXVAL( umask(:,:,:), DIM=3 ) |
---|
191 | ssvmask(:,:) = MAXVAL( vmask(:,:,:), DIM=3 ) |
---|
192 | |
---|
193 | ! Interior domain mask (used for global sum) |
---|
194 | ! -------------------- |
---|
195 | ! |
---|
196 | CALL dom_uniq( tmask_h, 'T' ) |
---|
197 | ! |
---|
198 | ! ! interior mask : 2D ocean mask x halo mask |
---|
199 | tmask_i(:,:) = ssmask(:,:) * tmask_h(:,:) |
---|
200 | |
---|
201 | ! Lateral boundary conditions on velocity (modify fmask) |
---|
202 | ! --------------------------------------- |
---|
203 | IF( rn_shlat /= 0 ) THEN ! Not free-slip lateral boundary condition |
---|
204 | ! |
---|
205 | ALLOCATE( zwf(jpi,jpj) ) |
---|
206 | ! |
---|
207 | DO jk = 1, jpk |
---|
208 | zwf(:,:) = fmask(:,:,jk) |
---|
209 | DO_2D_00_00 |
---|
210 | IF( fmask(ji,jj,jk) == 0._wp ) THEN |
---|
211 | fmask(ji,jj,jk) = rn_shlat * MIN( 1._wp , MAX( zwf(ji+1,jj), zwf(ji,jj+1), & |
---|
212 | & zwf(ji-1,jj), zwf(ji,jj-1) ) ) |
---|
213 | ENDIF |
---|
214 | END_2D |
---|
215 | DO jj = 2, jpjm1 |
---|
216 | IF( fmask(1,jj,jk) == 0._wp ) THEN |
---|
217 | fmask(1 ,jj,jk) = rn_shlat * MIN( 1._wp , MAX( zwf(2,jj), zwf(1,jj+1), zwf(1,jj-1) ) ) |
---|
218 | ENDIF |
---|
219 | IF( fmask(jpi,jj,jk) == 0._wp ) THEN |
---|
220 | fmask(jpi,jj,jk) = rn_shlat * MIN( 1._wp , MAX( zwf(jpi,jj+1), zwf(jpim1,jj), zwf(jpi,jj-1) ) ) |
---|
221 | ENDIF |
---|
222 | END DO |
---|
223 | DO ji = 2, jpim1 |
---|
224 | IF( fmask(ji,1,jk) == 0._wp ) THEN |
---|
225 | fmask(ji, 1 ,jk) = rn_shlat * MIN( 1._wp , MAX( zwf(ji+1,1), zwf(ji,2), zwf(ji-1,1) ) ) |
---|
226 | ENDIF |
---|
227 | IF( fmask(ji,jpj,jk) == 0._wp ) THEN |
---|
228 | fmask(ji,jpj,jk) = rn_shlat * MIN( 1._wp , MAX( zwf(ji+1,jpj), zwf(ji-1,jpj), zwf(ji,jpjm1) ) ) |
---|
229 | ENDIF |
---|
230 | END DO |
---|
231 | END DO |
---|
232 | ! |
---|
233 | DEALLOCATE( zwf ) |
---|
234 | ! |
---|
235 | CALL lbc_lnk( 'dommsk', fmask, 'F', 1._wp ) ! Lateral boundary conditions on fmask |
---|
236 | ! |
---|
237 | ! CAUTION : The fmask may be further modified in dyn_vor_init ( dynvor.F90 ) depending on ln_vorlat |
---|
238 | ! |
---|
239 | ENDIF |
---|
240 | |
---|
241 | ! User defined alteration of fmask (use to reduce ocean transport in specified straits) |
---|
242 | ! -------------------------------- |
---|
243 | ! |
---|
244 | CALL usr_def_fmask( cn_cfg, nn_cfg, fmask ) |
---|
245 | ! |
---|
246 | END SUBROUTINE dom_msk |
---|
247 | |
---|
248 | !!====================================================================== |
---|
249 | END MODULE dommsk |
---|