Skip to content

Commit a7b64d4

Browse files
committed
restore simplified version of convective_bdy_weight controls
1 parent c5afb09 commit a7b64d4

File tree

4 files changed

+47
-0
lines changed

4 files changed

+47
-0
lines changed

star/defaults/controls.defaults

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

6268+
!### convective_bdy_weight
6269+
!### convective_bdy_dq_limit
6270+
!### convective_bdy_min_dt_yrs
6271+
6272+
! Mesh function to enhance resolution near convective boundaries
6273+
! including regions that are newly nonconvective because of moving boundary.
6274+
6275+
convective_bdy_weight = 0
6276+
convective_bdy_dq_limit = 1d-4
6277+
convective_bdy_min_dt_yrs = 1d-3
62686278

62696279
! max_rel_delta_IE_for_mesh_total_energy_balance
62706280
! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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, &
@@ -1493,6 +1494,10 @@ subroutine store_controls(s, ierr)
14931494
s% mesh_dlogX_dlogP_full_on = mesh_dlogX_dlogP_full_on
14941495
s% mesh_dlogX_dlogP_full_off = mesh_dlogX_dlogP_full_off
14951496

1497+
s% convective_bdy_min_dt_yrs = convective_bdy_min_dt_yrs
1498+
s% convective_bdy_weight = convective_bdy_weight
1499+
s% convective_bdy_dq_limit = convective_bdy_dq_limit
1500+
14961501
s% mesh_dlog_eps_min_for_extra = mesh_dlog_eps_min_for_extra
14971502
s% mesh_dlog_eps_dlogP_full_on = mesh_dlog_eps_dlogP_full_on
14981503
s% mesh_dlog_eps_dlogP_full_off = mesh_dlog_eps_dlogP_full_off
@@ -3179,6 +3184,10 @@ subroutine set_controls_for_writing(s, ierr)
31793184
mesh_dlogX_dlogP_full_on = s% mesh_dlogX_dlogP_full_on
31803185
mesh_dlogX_dlogP_full_off = s% mesh_dlogX_dlogP_full_off
31813186

3187+
convective_bdy_min_dt_yrs = s% convective_bdy_min_dt_yrs
3188+
convective_bdy_weight = s% convective_bdy_weight
3189+
convective_bdy_dq_limit = s% convective_bdy_dq_limit
3190+
31823191
mesh_dlog_eps_min_for_extra = s% mesh_dlog_eps_min_for_extra
31833192
mesh_dlog_eps_dlogP_full_on = s% mesh_dlog_eps_dlogP_full_on
31843193
mesh_dlog_eps_dlogP_full_off = s% mesh_dlog_eps_dlogP_full_off

star/private/mesh_functions.f90

Lines changed: 25 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) = 'newly_nonconv'
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,10 @@ 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) == 'newly_nonconv') then
271+
!call do_newly_nonconvective(i)
272+
call do_mix_type_change(i)
273+
266274
else
267275
do k=1,num_xa_function
268276
call do1_xa_function(k,i)
@@ -274,6 +282,23 @@ subroutine set_mesh_function_data( &
274282

275283
contains
276284

285+
286+
subroutine do_mix_type_change(i)
287+
integer, intent(in) :: i
288+
integer :: k, j
289+
if (s% dt < s% convective_bdy_min_dt_yrs*secyer) return
290+
do k=1,nz
291+
if (s% dq(k) < s% convective_bdy_dq_limit) cycle
292+
if (s% cz_bdy_dq(k) /= 0) vals(k,i) = s% convective_bdy_weight
293+
end do
294+
do j=1,5
295+
do k=2,nz
296+
vals(k,i) = vals(k,i) + vals(k-1,i)
297+
end do
298+
end do
299+
300+
end subroutine do_mix_type_change
301+
277302
subroutine do1_xa_function(k,i)
278303
integer, intent(in) :: k,i
279304
real(dp) :: weight, param

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)