1 | MODULE isftbl |
---|
2 | !!====================================================================== |
---|
3 | !! *** MODULE isftbl *** |
---|
4 | !! isftbl module : compute properties of top boundary layer |
---|
5 | !!====================================================================== |
---|
6 | !! History : 4.1 ! 2019-09 (P. Mathiot) original code |
---|
7 | !!---------------------------------------------------------------------- |
---|
8 | |
---|
9 | !!---------------------------------------------------------------------- |
---|
10 | !! isftbl : routine to compute : |
---|
11 | !! - geometry of the ice shelf tbl (isf_tbl_lvl, isftbl_ktop, isftbl_kbot) |
---|
12 | !! (top and bottom level, thickness and fraction of deepest level affected) |
---|
13 | !! - tbl averaged properties (isf_tbl, isf_tbl_avg) |
---|
14 | !!---------------------------------------------------------------------- |
---|
15 | |
---|
16 | USE dom_oce ! vertical scale factor |
---|
17 | USE lbclnk ! lbc_lnk subroutine |
---|
18 | |
---|
19 | IMPLICIT NONE |
---|
20 | |
---|
21 | PRIVATE |
---|
22 | |
---|
23 | PUBLIC isf_tbl, isf_tbl_avg, isf_tbl_lvl, isftbl_ktop, isftbl_kbot |
---|
24 | |
---|
25 | CONTAINS |
---|
26 | |
---|
27 | SUBROUTINE isf_tbl( pvarin, pvarout, cd_ptin, ktop, phtbl, kbot, pfrac ) |
---|
28 | !!-------------------------------------------------------------------- |
---|
29 | !! *** SUBROUTINE isf_tbl *** |
---|
30 | !! |
---|
31 | !! ** Purpose : compute mean T/S/U/V in the boundary layer at T- point |
---|
32 | !! |
---|
33 | !!-------------------------------------------------------------------- |
---|
34 | !!-------------------------- OUT ------------------------------------- |
---|
35 | REAL(wp), DIMENSION(jpi,jpj) , INTENT( out) :: pvarout ! 2d average of pvarin |
---|
36 | !!-------------------------- IN ------------------------------------- |
---|
37 | CHARACTER(len=1) , INTENT(in ) :: cd_ptin ! point of variable in/out |
---|
38 | REAL(wp), DIMENSION(jpi,jpj,jpk) , INTENT(in ) :: pvarin ! 3d variable to average over the tbl |
---|
39 | INTEGER, DIMENSION(jpi,jpj) , INTENT(in ) :: ktop ! top level |
---|
40 | REAL(wp), DIMENSION(jpi,jpj) , INTENT(in ) :: phtbl ! tbl thickness |
---|
41 | !!-------------------------- IN OPTIONAL ----------------------------- |
---|
42 | INTEGER, DIMENSION(jpi,jpj), OPTIONAL, INTENT(in ) :: kbot ! bottom level |
---|
43 | REAL(wp), DIMENSION(jpi,jpj), OPTIONAL, INTENT(in ) :: pfrac ! fraction of bottom cell affected by tbl |
---|
44 | !!-------------------------------------------------------------------- |
---|
45 | INTEGER :: ji, jj ! loop index |
---|
46 | INTEGER , DIMENSION(jpi,jpj) :: ikbot ! bottom level of the tbl |
---|
47 | REAL(wp), DIMENSION(jpi,jpj) :: zhtbl ! thickness of the tbl |
---|
48 | REAL(wp), DIMENSION(jpi,jpj) :: zfrac ! thickness of the tbl |
---|
49 | !!-------------------------------------------------------------------- |
---|
50 | ! |
---|
51 | SELECT CASE ( cd_ptin ) |
---|
52 | CASE ( 'U' ) |
---|
53 | ! |
---|
54 | ! copy phtbl (phtbl is INTENT in as we don't want to change it) |
---|
55 | zhtbl = phtbl |
---|
56 | ! |
---|
57 | ! compute tbl lvl and thickness |
---|
58 | CALL isf_tbl_lvl( hu_n, e3u_n, ktop, ikbot, zhtbl, zfrac ) |
---|
59 | ! |
---|
60 | ! compute tbl property at U point |
---|
61 | CALL isf_tbl_avg( miku, ikbot, zhtbl, zfrac, e3u_n, pvarin, pvarout ) |
---|
62 | ! |
---|
63 | ! compute tbl property at T point |
---|
64 | DO jj = 1, jpj |
---|
65 | DO ji = 2, jpi |
---|
66 | pvarout(ji,jj) = 0.5_wp * (pvarout(ji,jj) + pvarout(ji-1,jj)) |
---|
67 | END DO |
---|
68 | END DO |
---|
69 | ! |
---|
70 | ! check if needed (probably yes) |
---|
71 | CALL lbc_lnk('sbcisf', pvarout,'T',-1.) |
---|
72 | ! |
---|
73 | CASE ( 'V' ) |
---|
74 | ! |
---|
75 | ! copy phtbl (phtbl is INTENT in as we don't want to change it) |
---|
76 | zhtbl = phtbl |
---|
77 | ! |
---|
78 | ! compute tbl lvl and thickness |
---|
79 | CALL isf_tbl_lvl( hv_n, e3v_n, ktop, ikbot, zhtbl, zfrac ) |
---|
80 | ! |
---|
81 | ! compute tbl property at V point |
---|
82 | CALL isf_tbl_avg( mikv, ikbot, zhtbl, zfrac, e3v_n, pvarin, pvarout ) |
---|
83 | ! |
---|
84 | ! pvarout is an averaging of wet point |
---|
85 | DO jj = 2, jpj |
---|
86 | DO ji = 1, jpi |
---|
87 | pvarout(ji,jj) = 0.5_wp * (pvarout(ji,jj) + pvarout(ji,jj-1)) |
---|
88 | END DO |
---|
89 | END DO |
---|
90 | ! |
---|
91 | ! check if needed (probably yes) |
---|
92 | CALL lbc_lnk('sbcisf', pvarout,'T',-1.) |
---|
93 | ! |
---|
94 | CASE ( 'T' ) |
---|
95 | ! |
---|
96 | ! compute tbl property at T point |
---|
97 | CALL isf_tbl_avg( ktop, kbot, phtbl, pfrac, e3t_n, pvarin, pvarout ) |
---|
98 | ! |
---|
99 | END SELECT |
---|
100 | ! |
---|
101 | ! mask mean tbl value |
---|
102 | pvarout(:,:) = pvarout(:,:) * ssmask(:,:) |
---|
103 | ! |
---|
104 | END SUBROUTINE isf_tbl |
---|
105 | |
---|
106 | SUBROUTINE isf_tbl_avg( ktop, kbot, phtbl, pfrac, pe3, pvarin, pvarout ) |
---|
107 | !!-------------------------------------------------------------------- |
---|
108 | !! *** ROUTINE isf_tbl_lvl *** |
---|
109 | !! |
---|
110 | !! ** Purpose : compute mean property in the boundary layer |
---|
111 | !! |
---|
112 | !! ** Method : Depth average is made between the top level ktop and the bottom level kbot |
---|
113 | !! over a thickness phtbl. The bottom level is partially counted (pfrac). |
---|
114 | !! |
---|
115 | !!-------------------------------------------------------------------- |
---|
116 | !!-------------------------- OUT ------------------------------------- |
---|
117 | REAL(wp), DIMENSION(jpi,jpj) , INTENT( out) :: pvarout ! tbl property averaged over phtbl between level ktop and kbot |
---|
118 | !!-------------------------- IN ------------------------------------- |
---|
119 | INTEGER, DIMENSION(jpi,jpj) , INTENT(in ) :: ktop, kbot ! top and bottom level of the top boundary layer |
---|
120 | REAL(wp), DIMENSION(jpi,jpj) , INTENT(in ) :: phtbl, pfrac ! fraction of bottom level to be affected by the tbl |
---|
121 | REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(in ) :: pe3 ! vertical scale factor |
---|
122 | REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(in ) :: pvarin ! tbl property to average between ktop, kbot over phtbl |
---|
123 | !!-------------------------------------------------------------------- |
---|
124 | INTEGER :: ji,jj,jk ! loop indices |
---|
125 | INTEGER :: ikt, ikb ! top and bottom levels |
---|
126 | !!-------------------------------------------------------------------- |
---|
127 | ! |
---|
128 | ! compute tbl top.bottom level and thickness |
---|
129 | DO jj = 1,jpj |
---|
130 | DO ji = 1,jpi |
---|
131 | ! |
---|
132 | ! tbl top/bottom indices initialisation |
---|
133 | ikt = ktop(ji,jj) ; ikb = kbot(ji,jj) |
---|
134 | ! |
---|
135 | ! level fully include in the ice shelf boundary layer |
---|
136 | pvarout(ji,jj) = SUM( pvarin(ji,jj,ikt:ikb-1) * pe3(ji,jj,ikt:ikb-1) ) / phtbl(ji,jj) |
---|
137 | ! |
---|
138 | ! level partially include in ice shelf boundary layer |
---|
139 | pvarout(ji,jj) = pvarout(ji,jj) + pvarin(ji,jj,ikb) * pe3(ji,jj,ikb) / phtbl(ji,jj) * pfrac(ji,jj) |
---|
140 | ! |
---|
141 | END DO |
---|
142 | END DO |
---|
143 | |
---|
144 | END SUBROUTINE isf_tbl_avg |
---|
145 | |
---|
146 | SUBROUTINE isf_tbl_lvl( phw, pe3, ktop, kbot, phtbl, pfrac ) |
---|
147 | !!-------------------------------------------------------------------- |
---|
148 | !! *** ROUTINE isf_tbl_lvl *** |
---|
149 | !! |
---|
150 | !! ** Purpose : - compute bottom level fully included in the top boundary layer |
---|
151 | !! - thickness of the top boundary layer |
---|
152 | !! |
---|
153 | !!--------------------------------------------------------------------- |
---|
154 | !!-------------------------- OUT -------------------------------------- |
---|
155 | INTEGER, DIMENSION(jpi,jpj) , INTENT( out) :: kbot ! bottom level of the top boundary layer |
---|
156 | REAL(wp), DIMENSION(jpi,jpj) , INTENT( out) :: pfrac ! fraction of bottom level in the tbl |
---|
157 | !!-------------------------- IN -------------------------------------- |
---|
158 | INTEGER, DIMENSION(jpi,jpj) , INTENT(in ) :: ktop ! top level of the top boundary layer |
---|
159 | REAL(wp), DIMENSION(jpi,jpj) , INTENT(in ) :: phw ! water column thickness |
---|
160 | REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(in ) :: pe3 ! vertical scale factor |
---|
161 | !!-------------------------- INOUT ------------------------------------ |
---|
162 | REAL(wp), DIMENSION(jpi,jpj) , INTENT(inout) :: phtbl ! top boundary layer thickness |
---|
163 | !!--------------------------------------------------------------------- |
---|
164 | INTEGER :: ji,jj,jk |
---|
165 | INTEGER :: ikt, ikb |
---|
166 | !!--------------------------------------------------------------------- |
---|
167 | ! |
---|
168 | ! get htbl |
---|
169 | DO jj = 1,jpj |
---|
170 | DO ji = 1,jpi |
---|
171 | ! |
---|
172 | ! tbl top/bottom indices initialisation |
---|
173 | ikt = ktop(ji,jj) |
---|
174 | ! |
---|
175 | ! limit the tbl to water thickness. |
---|
176 | phtbl(ji,jj) = MIN( phtbl(ji,jj), phw(ji,jj) ) |
---|
177 | ! |
---|
178 | ! thickness of boundary layer must be at least the top level thickness |
---|
179 | phtbl(ji,jj) = MAX( phtbl(ji,jj), pe3(ji,jj,ikt) ) |
---|
180 | ! |
---|
181 | END DO |
---|
182 | END DO |
---|
183 | ! |
---|
184 | ! get ktbl |
---|
185 | CALL isftbl_kbot(ktop, phtbl, pe3, kbot) |
---|
186 | ! |
---|
187 | ! get pfrac |
---|
188 | DO jj = 1,jpj |
---|
189 | DO ji = 1,jpi |
---|
190 | ! |
---|
191 | ! tbl top/bottom indices initialisation |
---|
192 | ikt = ktop(ji,jj) ; ikb = kbot(ji,jj) |
---|
193 | ! |
---|
194 | ! proportion of the bottom cell included in ice shelf boundary layer |
---|
195 | pfrac(ji,jj) = ( phtbl(ji,jj) - SUM( pe3(ji,jj,ikt:ikb-1) ) ) / pe3(ji,jj,ikb) |
---|
196 | ! |
---|
197 | END DO |
---|
198 | END DO |
---|
199 | ! |
---|
200 | END SUBROUTINE isf_tbl_lvl |
---|
201 | ! |
---|
202 | SUBROUTINE isftbl_kbot(ktop, phtbl, pe3, kbot) |
---|
203 | !!-------------------------------------------------------------------- |
---|
204 | !! *** ROUTINE isf_tbl_lvl *** |
---|
205 | !! |
---|
206 | !! ** Purpose : compute bottom level of the isf top boundary layer |
---|
207 | !! |
---|
208 | !!-------------------------------------------------------------------- |
---|
209 | !!-------------------------- OUT ------------------------------------- |
---|
210 | INTEGER, DIMENSION(jpi,jpj) , INTENT( out) :: kbot ! bottom level of the top boundary layer |
---|
211 | !!-------------------------- IN ------------------------------------- |
---|
212 | REAL(wp), DIMENSION(jpi,jpj) , INTENT(in ) :: phtbl ! top boundary layer thickness |
---|
213 | INTEGER, DIMENSION(jpi,jpj) , INTENT(in ) :: ktop ! top level of the top boundary layer |
---|
214 | REAL(wp), DIMENSION(jpi,jpj,jpk), INTENT(in ) :: pe3 ! vertical scale factor |
---|
215 | !!-------------------------------------------------------------------- |
---|
216 | INTEGER :: ji, jj |
---|
217 | INTEGER :: ikt, ikb |
---|
218 | !!-------------------------------------------------------------------- |
---|
219 | ! |
---|
220 | ! phtbl need to be bounded by water column thickness before |
---|
221 | ! test: if htbl = water column thickness, should return mbathy |
---|
222 | ! test: if htbl = 0 should return ktop (phtbl cap to e3t(ji,jj,1)) |
---|
223 | ! |
---|
224 | ! get ktbl |
---|
225 | DO jj = 1,jpj |
---|
226 | DO ji = 1,jpi |
---|
227 | ! |
---|
228 | ! determine the deepest level influenced by the boundary layer |
---|
229 | ikt = ktop(ji,jj) |
---|
230 | ikb = ikt |
---|
231 | DO WHILE ( SUM(pe3(ji,jj,ikt:ikb-1)) < phtbl(ji,jj ) ) ; ikb = ikb + 1 ; END DO |
---|
232 | kbot(ji,jj) = ikb - 1 |
---|
233 | ! |
---|
234 | END DO |
---|
235 | END DO |
---|
236 | ! |
---|
237 | END SUBROUTINE isftbl_kbot |
---|
238 | ! |
---|
239 | SUBROUTINE isftbl_ktop(pdep, ktop) |
---|
240 | !!-------------------------------------------------------------------- |
---|
241 | !! *** ROUTINE isf_tbl_lvl *** |
---|
242 | !! |
---|
243 | !! ** Purpose : compute top level of the isf top boundary layer in case of an ice shelf parametrisation |
---|
244 | !! |
---|
245 | !!-------------------------------------------------------------------- |
---|
246 | !!-------------------------- OUT ------------------------------------- |
---|
247 | INTEGER, DIMENSION(jpi,jpj), INTENT( out) :: ktop ! top level affected by the ice shelf parametrisation |
---|
248 | !!-------------------------- IN ------------------------------------- |
---|
249 | REAL(wp), DIMENSION(jpi,jpj), INTENT(in ) :: pdep ! top depth of the parametrisation influence |
---|
250 | !!-------------------------------------------------------------------- |
---|
251 | INTEGER :: ji,jj |
---|
252 | INTEGER :: ikt |
---|
253 | !!-------------------------------------------------------------------- |
---|
254 | ! |
---|
255 | ! compute top level (need to be recomputed each time (z*, z~) |
---|
256 | ! be sure pdep is already correctly bounded |
---|
257 | ! test: this routine run on isfdraft should return mikt |
---|
258 | ! test: this routine run with pdep = 0 should return 1 |
---|
259 | ! |
---|
260 | DO ji = 1, jpi |
---|
261 | DO jj = 1, jpj |
---|
262 | ikt = 2 |
---|
263 | DO WHILE ( gdepw_n(ji,jj,ikt) <= pdep(ji,jj ) ) ; ikt = ikt + 1 ; END DO |
---|
264 | ktop(ji,jj) = ikt - 1 |
---|
265 | END DO |
---|
266 | END DO |
---|
267 | ! |
---|
268 | END SUBROUTINE isftbl_ktop |
---|
269 | |
---|
270 | END MODULE isftbl |
---|