[mesa-users] remove_embedded_semiconvection
Kevin Moore
klmoore at soe.ucsc.edu
Wed Feb 18 03:41:28 EST 2015
Hi all,
I’m curious if anyone has any extensive experience with this subroutine.
I’ve sometimes wanted to remove semiconvection zones (often just a single cell) embedded in convection zones, but the default subroutine to do this is not working as I expected (eg. not converting the semiconvective zones to convective zones). I wrote my own that seems to work better for my cases so am sharing it in case anyone else wants to use it or point out what the original use case was.
The main changes I made were to explicitly look for all semiconvective zones in a bulk semiconvective/convective region, and also to update the s% cdc variable in addition to s% D_mix, since it’s used later in subroutines in mix_info.f. I’ve only tested it for about an hour, so users beware...
In mesa/star/private/mix_info.f (I’m using ver. 6794, but ver. 7385 is similar), replace the original clean_region subroutine with:
subroutine clean_region
integer :: kbot1, ktop1, i, j
integer :: k_semi_bot, k_semi_top
include 'formats'
if (dbg) write(*,3) 'clean_region semiconvective', kbot, ktop
kbot1 = kbot
ktop1 = ktop
do while (kbot1 > ktop1)
k_semi_bot = kbot1
k_semi_top = ktop1
!Look for semiconvective regions inside the overall mixing region, starting from
!the core and working outward:
do i=kbot1,ktop1,-1
if(s% mixing_type(i) == semiconvective_mixing) then
k_semi_bot = i
!Find the top of that semiconvective region:
do j=k_semi_bot,ktop1,-1
if(s% mixing_type(j) == convective_mixing) then
k_semi_top = j+1
exit
end if
end do
exit
end if
end do
!Exit if there's no embedded semiconvection zone:
if(k_semi_bot == kbot1 .or. k_semi_top == ktop1) then
return
!Check if semiconvective region bounded by convection. Here, we know that
!k_semi_bot < kbot1 and k_semi_top > ktop1.
else
!Merge semiconvection region with surrounding convection zones:
s% cdc(k_semi_top:k_semi_bot) = (s% cdc(k_semi_top-1) + s% cdc(k_semi_bot+1))/2d0
s% D_mix(k_semi_top:k_semi_bot) = (s% D_mix(k_semi_top-1) + s% D_mix(k_semi_bot+1))/2d0
s% conv_vel(k_semi_top:k_semi_bot) = (s% conv_vel(k_semi_top-1) + s% conv_vel(k_semi_bot+1))/2d0
s% mixing_type(k_semi_top:k_semi_bot) = convective_mixing
if (dbg) write(*,3) 'merge semiconvective island', k_semi_bot, k_semi_top
kbot1 = k_semi_top-1
end if
end do
end subroutine clean_region
Since this involves editing code in star/private, I’ll assume anyone who wants to actually play with this will know how to recompile and link the new code themselves.
I’ve been using this with the necessary inlist option:
remove_embedded_semiconvection = .true. !Default: false
and a custom semiconvection prescription (so not sure about a good test case with the Langer prescription yet).
-Kevin
More information about the Mesa-users
mailing list