@@ -76,6 +76,7 @@ integer function num_mesh_functions(s)
76
76
i = 0
77
77
if (s% use_other_mesh_functions) &
78
78
call s% how_many_other_mesh_fcns(s% id, i)
79
+ if (s% convective_bdy_weight > 0 ) i= i+1
79
80
if (s% E_function_weight > 0 ) i= i+1
80
81
if (s% P_function_weight > 0 ) i= i+1
81
82
if (s% T_function1_weight > 0 ) i= i+1
@@ -175,6 +176,9 @@ subroutine set_mesh_function_data( &
175
176
if (s% omega_function_weight > 0 .and. s% rotation_flag) then
176
177
i = i+1 ; names(i) = ' omega_function'
177
178
end if
179
+ if (s% convective_bdy_weight > 0 ) then
180
+ i = i+1 ; names(i) = ' convective_bdy'
181
+ end if
178
182
do k= 1 ,num_xa_function
179
183
if (do_mass_function(s, s% xa_function_species(k), s% xa_function_weight(k), j)) then
180
184
i = i+1 ; names(i) = trim (s% xa_function_species(k))
@@ -263,6 +267,9 @@ subroutine set_mesh_function_data( &
263
267
vals(k,i) = s% omega_function_weight* log10 (max (1d-99 ,abs (s% omega(k))))
264
268
end do
265
269
270
+ else if (names(i) == ' convective_bdy' ) then
271
+ call do_conv_bdy(i)
272
+
266
273
else
267
274
do k= 1 ,num_xa_function
268
275
call do1_xa_function(k,i)
@@ -274,6 +281,37 @@ subroutine set_mesh_function_data( &
274
281
275
282
contains
276
283
284
+
285
+ subroutine do_conv_bdy (i )
286
+ integer , intent (in ) :: i
287
+ integer :: k, j
288
+
289
+ vals(1 :nz,i) = 0
290
+
291
+ if (s% dt < s% convective_bdy_min_dt_yrs* secyer) return
292
+
293
+ ! do k=1,nz
294
+ ! if (s% dq(k) < s% convective_bdy_dq_limit) cycle
295
+ ! if (s% cz_bdy_dq(k) /= 0) vals(k,i) = s% convective_bdy_weight
296
+ ! end do
297
+
298
+ do j = 1 , s% num_conv_boundaries
299
+ k = s% conv_bdy_loc(j)
300
+ if (s% dq(k) < s% convective_bdy_dq_limit) cycle
301
+ vals(k,i) = s% convective_bdy_weight
302
+ if (k < nz .and. s% top_conv_bdy(i)) then
303
+ vals(k+1 ,i) = s% convective_bdy_weight
304
+ else if (k > 1 .and. .not. s% top_conv_bdy(i)) then
305
+ vals(k-1 ,i) = s% convective_bdy_weight
306
+ end if
307
+ end do
308
+
309
+ do k= 2 ,nz
310
+ vals(k,i) = vals(k,i) + vals(k-1 ,i)
311
+ end do
312
+
313
+ end subroutine do_conv_bdy
314
+
277
315
subroutine do1_xa_function (k ,i )
278
316
integer , intent (in ) :: k,i
279
317
real (dp) :: weight, param
0 commit comments