Skip to content

Commit 6c65870

Browse files
authored
Merge pull request #500 from MESAHub/restore_convective_bdy_weight
Restore a simplified version of the convective_bdy_weight control
2 parents 9eff49c + 2856f5a commit 6c65870

File tree

7 files changed

+80
-0
lines changed

7 files changed

+80
-0
lines changed

docs/source/changelog.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,18 @@ species to ``X``, ``Y`` or ``Z``, in which case the checks are applied
8080
*individually* to all isotopes of hydrogen, helium or metals,
8181
respectively.
8282

83+
Resolution control convective_bdy_weight has been reintroduced
84+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
85+
86+
The option to add extra resolution at convective boundaries
87+
with the control ``convective_bdy_weight`` was removed after
88+
version 12115, but has now been reintroduced in a simplified form.
89+
This control no longer applies to newly nonconvective zones, but
90+
does add resolution at the location of convective boundaries.
91+
This was found to be important for smooth convective boundary
92+
evolution with convective premixing.
93+
94+
8395
Changes in r22.11.1
8496
===================
8597

star/defaults/controls.defaults

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6265,6 +6265,20 @@
62656265
mesh_dlog_other_dlogP_extra = 0.25d0
62666266
mesh_dlog_photo_dlogP_extra = 1
62676267

6268+
! convective_bdy_weight
6269+
! ~~~~~~~~~~~~~~~~~~~~~
6270+
! convective_bdy_dq_limit
6271+
! ~~~~~~~~~~~~~~~~~~~~~~~
6272+
! convective_bdy_min_dt_yrs
6273+
! ~~~~~~~~~~~~~~~~~~~~~~~~~
6274+
6275+
! Mesh function to enhance resolution near convective boundaries
6276+
6277+
! ::
6278+
6279+
convective_bdy_weight = 0
6280+
convective_bdy_dq_limit = 3d-5
6281+
convective_bdy_min_dt_yrs = 1d-3
62686282

62696283
! max_rel_delta_IE_for_mesh_total_energy_balance
62706284
! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

star/private/ctrls_io.f90

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ module ctrls_io
233233
E_function_weight, E_function_param, P_function_weight, &
234234
mesh_logX_species, &
235235
mesh_logX_min_for_extra, mesh_dlogX_dlogP_extra, mesh_dlogX_dlogP_full_on, mesh_dlogX_dlogP_full_off, &
236+
convective_bdy_min_dt_yrs, convective_bdy_dq_limit, convective_bdy_weight, &
236237

237238
mesh_dlog_eps_min_for_extra, mesh_dlog_eps_dlogP_full_on, mesh_dlog_eps_dlogP_full_off, &
238239
mesh_dlog_pp_dlogP_extra, mesh_dlog_cno_dlogP_extra, mesh_dlog_3alf_dlogP_extra, &
@@ -1488,6 +1489,10 @@ subroutine store_controls(s, ierr)
14881489
s% mesh_dlogX_dlogP_full_on = mesh_dlogX_dlogP_full_on
14891490
s% mesh_dlogX_dlogP_full_off = mesh_dlogX_dlogP_full_off
14901491

1492+
s% convective_bdy_min_dt_yrs = convective_bdy_min_dt_yrs
1493+
s% convective_bdy_weight = convective_bdy_weight
1494+
s% convective_bdy_dq_limit = convective_bdy_dq_limit
1495+
14911496
s% mesh_dlog_eps_min_for_extra = mesh_dlog_eps_min_for_extra
14921497
s% mesh_dlog_eps_dlogP_full_on = mesh_dlog_eps_dlogP_full_on
14931498
s% mesh_dlog_eps_dlogP_full_off = mesh_dlog_eps_dlogP_full_off
@@ -3151,6 +3156,10 @@ subroutine set_controls_for_writing(s, ierr)
31513156
mesh_dlogX_dlogP_full_on = s% mesh_dlogX_dlogP_full_on
31523157
mesh_dlogX_dlogP_full_off = s% mesh_dlogX_dlogP_full_off
31533158

3159+
convective_bdy_min_dt_yrs = s% convective_bdy_min_dt_yrs
3160+
convective_bdy_weight = s% convective_bdy_weight
3161+
convective_bdy_dq_limit = s% convective_bdy_dq_limit
3162+
31543163
mesh_dlog_eps_min_for_extra = s% mesh_dlog_eps_min_for_extra
31553164
mesh_dlog_eps_dlogP_full_on = s% mesh_dlog_eps_dlogP_full_on
31563165
mesh_dlog_eps_dlogP_full_off = s% mesh_dlog_eps_dlogP_full_off

star/private/mesh_functions.f90

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ integer function num_mesh_functions(s)
7676
i = 0
7777
if (s% use_other_mesh_functions) &
7878
call s% how_many_other_mesh_fcns(s% id, i)
79+
if (s% convective_bdy_weight > 0) i=i+1
7980
if (s% E_function_weight > 0) i=i+1
8081
if (s% P_function_weight > 0) i=i+1
8182
if (s% T_function1_weight > 0) i=i+1
@@ -175,6 +176,9 @@ subroutine set_mesh_function_data( &
175176
if (s% omega_function_weight > 0 .and. s% rotation_flag) then
176177
i = i+1; names(i) = 'omega_function'
177178
end if
179+
if (s% convective_bdy_weight > 0) then
180+
i = i+1; names(i) = 'convective_bdy'
181+
end if
178182
do k=1,num_xa_function
179183
if (do_mass_function(s, s% xa_function_species(k), s% xa_function_weight(k), j)) then
180184
i = i+1; names(i) = trim(s% xa_function_species(k))
@@ -263,6 +267,9 @@ subroutine set_mesh_function_data( &
263267
vals(k,i) = s% omega_function_weight*log10(max(1d-99,abs(s% omega(k))))
264268
end do
265269

270+
else if (names(i) == 'convective_bdy') then
271+
call do_conv_bdy(i)
272+
266273
else
267274
do k=1,num_xa_function
268275
call do1_xa_function(k,i)
@@ -274,6 +281,37 @@ subroutine set_mesh_function_data( &
274281

275282
contains
276283

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+
277315
subroutine do1_xa_function(k,i)
278316
integer, intent(in) :: k,i
279317
real(dp) :: weight, param

star/test_suite/16M_conv_premix/inlist_16M_conv_premix

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@
8585
! RELAXED VALUE FOR TEST SUITE
8686
mesh_delta_coeff = 0.5 ! 0.2
8787

88+
convective_bdy_weight = 2
89+
8890
! Output
8991

9092
photo_interval = 50 ! 500

star/test_suite/diffusion_smoothness/inlist_diffusion_smoothness

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@
6464
limit_for_rel_error_in_energy_conservation = 1d-6 ! this makes d2N2 too large. takes 63 steps. log_rel_run_E_err -3.5859393528096946
6565
limit_for_rel_error_in_energy_conservation = 1d-5 ! this is smooth enough. takes 58 steps. log_rel_run_E_err -3.4820705862368895
6666
hard_limit_for_rel_error_in_energy_conservation = 1d-4
67+
68+
convective_bdy_weight = 1
6769

6870
cool_wind_RGB_scheme = 'Reimers'
6971
cool_wind_AGB_scheme = 'Blocker'

star_data/private/star_controls.inc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -597,6 +597,9 @@
597597
real(dp) :: mesh_dlogX_dlogP_full_on(num_mesh_logX)
598598
real(dp) :: mesh_dlogX_dlogP_full_off(num_mesh_logX)
599599

600+
real(dp) :: convective_bdy_weight, &
601+
convective_bdy_dq_limit, convective_bdy_min_dt_yrs
602+
600603
real(dp) :: mesh_dlog_eps_min_for_extra
601604
real(dp) :: mesh_dlog_eps_dlogP_full_on
602605
real(dp) :: mesh_dlog_eps_dlogP_full_off

0 commit comments

Comments
 (0)