Evolving stellar models with varied mass loss rate
Standard simulation from the end of helium core burning to the the end of carbon core burning
In this part you practiced starting a run from a particular point in the evolution by loading a saved model. You also learned how to print a stellar parameter to the terminal for easy tracking. Another way to find the radius of the star is by importing this variable from the output of history.data and profileX.data files using you favorite post processing tool.
This is how your inlist_to_end_core_c_burn should look like at the end of this task:
&star_job
show_log_description_at_start = .false.
! You added to start the run by loading a saved model
load_saved_model = .true.
load_model_filename = 'after_core_he_burn.mod'
change_initial_net = .true.
new_net_name = 'co_burn_plus.net'
save_model_when_terminate = .true.
save_model_filename = 'after_core_c_burn.mod'
required_termination_code_string = 'xa_central_lower_limit'
/ ! end of star_job namelist
&eos
/ ! end of eos namelist
&kap
/ ! end of kap namelist
&controls
xa_central_lower_limit_species(1) = 'c12'
xa_central_lower_limit(1) = 1d-3
! limit max_model_number as part of test_suite
max_model_number = 10000
!max_number_retries = 37
! wind
! atmosphere
! rotation
! mlt
alpha_semiconvection = 0
thermohaline_coeff = 0
! mixing
! timesteps
! mesh
! solver
! output
terminal_show_age_units = 'years'
terminal_show_timestep_units = 'days'
terminal_show_log_dt = .false.
terminal_show_log_age = .false.
! You added to easily find the history values relevant for the lab
num_trace_history_values = 8
trace_history_value_name(1) = 'log_R'
trace_history_value_name(2) = 'star_mass'
trace_history_value_name(3) = 'envelope_mass'
trace_history_value_name(4) = 'total_mass_h1'
trace_history_value_name(5) = 'surface_h1'
trace_history_value_name(6) = 'surface_he4'
trace_history_value_name(7) = 'log_L'
trace_history_value_name(8) = 'log_Teff'
!photo_interval = 10
!profile_interval = 2
!history_interval = 1
!terminal_interval = 1
x_integer_ctrl(1) = 5 ! Inlist part number
/ ! end of controls namelist
&pgstar
! Profile_Panels3_xmin = 0 ! 2.5 ! -101d0
! Profile_Panels3_xmax = -101d0 !
! TRho_Profile_xmin = 2.5
! TRho_Profile_xmax = 7.5
! TRho_Profile_ymin = 8.4
! TRho_Profile_ymax = 9.2
/ ! end of pgstar namelist
Using other_wind hook
In this part your learned how to implement mass loss at a constant rate in a stellar model by using the other wind hook through run_star_extras.f90. By working together, you found the effects of mass loss on the stellar radius and the critical mass loss rate needed for envelope stripping.
This is how your inlist_to_end_core_c_burn should look like at the end of this task:
&star_job
show_log_description_at_start = .false.
! You added to start the run by loading a saved model
load_saved_model = .true.
load_model_filename = 'after_core_he_burn.mod'
change_initial_net = .true.
new_net_name = 'co_burn_plus.net'
save_model_when_terminate = .true.
save_model_filename = 'after_core_c_burn.mod'
required_termination_code_string = 'xa_central_lower_limit'
/ ! end of star_job namelist
&eos
/ ! end of eos namelist
&kap
/ ! end of kap namelist
&controls
xa_central_lower_limit_species(1) = 'c12'
xa_central_lower_limit(1) = 1d-3
! limit max_model_number as part of test_suite
max_model_number = 10000
!max_number_retries = 37
! wind
! You added to activate other_wind_routine in your simulation
use_other_wind = .true.
! atmosphere
! rotation
! mlt
alpha_semiconvection = 0
thermohaline_coeff = 0
! mixing
! timesteps
! mesh
! solver
! output
terminal_show_age_units = 'years'
terminal_show_timestep_units = 'days'
terminal_show_log_dt = .false.
terminal_show_log_age = .false.
! You added to easily find the history values relevant for the lab
num_trace_history_values = 8
trace_history_value_name(1) = 'log_R'
trace_history_value_name(2) = 'star_mass'
trace_history_value_name(3) = 'envelope_mass'
trace_history_value_name(4) = 'total_mass_h1'
trace_history_value_name(5) = 'surface_h1'
trace_history_value_name(6) = 'surface_he4'
trace_history_value_name(7) = 'log_L'
trace_history_value_name(8) = 'log_Teff'
!photo_interval = 10
!profile_interval = 2
!history_interval = 1
!terminal_interval = 1
x_integer_ctrl(1) = 5 ! Inlist part number
/ ! end of controls namelist
&pgstar
! Profile_Panels3_xmin = 0 ! 2.5 ! -101d0
! Profile_Panels3_xmax = -101d0 !
! TRho_Profile_xmin = 2.5
! TRho_Profile_xmax = 7.5
! TRho_Profile_ymin = 8.4
! TRho_Profile_ymax = 9.2
/ ! end of pgstar namelist
This is how your run_star_extras.f90 is supposed to look like at the end of this task.
module run_star_extras
...
subroutine extras_controls(id, ierr)
integer, intent(in) :: id
integer, intent(out) :: ierr
type (star_info), pointer :: s
ierr = 0
call star_ptr(id, s, ierr)
if (ierr /= 0) return
s% extras_startup => extras_startup
s% extras_check_model => extras_check_model
s% extras_finish_step => extras_finish_step
s% extras_after_evolve => extras_after_evolve
s% how_many_extra_history_columns => how_many_extra_history_columns
s% data_for_extra_history_columns => data_for_extra_history_columns
s% how_many_extra_profile_columns => how_many_extra_profile_columns
s% data_for_extra_profile_columns => data_for_extra_profile_columns
s% other_wind => other_wind_routine ! You added as a pointer to other_wind
end subroutine subroutine extras_controls
...
! You added to control to make the star lose mass at a constant rate
subroutine other_wind_routine(id, Lsurf, Msurf, Rsurf, Tsurf, X, Y, Z, w, ierr)
use star_def
integer, intent(in) :: id
real(dp), intent(in) :: Lsurf, Msurf, Rsurf, Tsurf, X, Y, Z !surface values (cgs)
real(dp), intent(out) :: w ! wind in units of Msun/year (value is >= 0)
integer, intent(out) :: ierr
w = 0.0003d0 ! An example of a value that can be chosen
ierr = 0
end subroutine other_wind_routine
...
end module run_star_extras
Lets understand to better understand the other_wind_routine by breaking it down to pieces
subroutine other_wind_routine(id, Lsurf, Msurf, Rsurf, Tsurf, X, Y, Z, w, ierr)
In this part we declare the subroutine and specify both the variables it needs to receive as input and the variables it will give as output, in that order.
use star_def
In this part we access the module star_def
integer, intent(in) :: id
real(dp), intent(in) :: Lsurf, Msurf, Rsurf, Tsurf, X, Y, Z !surface values (cgs)
In this part we declare the input variables that the subroutine receive, including their type.
real(dp), intent(out) :: w ! wind in units of Msun/year (value is >= 0)
integer, intent(out) :: ierr
In this part we declare the output variables the subroutine will produce, including their type.
w = 0.0003d0
ierr = 0
In this part we implement a constant mass loss rate, and we can verify of the subroutine worked well by printing the value of the error.
end subroutine other_wind_routine
In this part we declare the end of the subroutine.
By comparing the final radius of the star after gradually increasing the mass loss rates, we can see that at some point the stellar radius becomes drastically smaller after a small change in the mass loss rate. This is the point in the evolution where the star is completely stripped of the envelope, and the stripped core keeps evolving .
Implementing sub-Kelvin-Helmholtz mass loss in other wind routine
In this part you learned how to implement a mass loss that depends on surface stellar parameters by using the other_wind hook through run_star_extras.f90. You also learned how to set a parameter in the &controls segment of the inlist and access it as part of the star structure in run_star_extras.f90.. By working together, you found the effects of mass loss on the stellar radius and the critical Kelvin-Helmholtz mass loss rate fraction needed for envelope stripping. This is how your other wind routine is supposed to look like at the end of this task
This is how your inlist_to_end_core_c_burn should look like at this point:
&star_job
show_log_description_at_start = .false.
! You added to start the run by loading a saved model
load_saved_model = .true.
load_model_filename = 'after_core_he_burn.mod'
change_initial_net = .true.
new_net_name = 'co_burn_plus.net'
save_model_when_terminate = .true.
save_model_filename = 'after_core_c_burn.mod'
required_termination_code_string = 'xa_central_lower_limit'
/ ! end of star_job namelist
&eos
/ ! end of eos namelist
&kap
/ ! end of kap namelist
&controls
! You added so you can later access it in run_star_extras.f90
x_ctrl(1) = 0 !replace 0 with your chosen fraction of the KH mass loss rate
xa_central_lower_limit_species(1) = 'c12'
xa_central_lower_limit(1) = 1d-3
! limit max_model_number as part of test_suite
max_model_number = 10000
!max_number_retries = 37
! wind
! atmosphere
! rotation
! mlt
alpha_semiconvection = 0
thermohaline_coeff = 0
! mixing
! timesteps
! mesh
! solver
! output
terminal_show_age_units = 'years'
terminal_show_timestep_units = 'days'
terminal_show_log_dt = .false.
terminal_show_log_age = .false.
! You added to easily find the history values relevant for the lab
num_trace_history_values = 8
trace_history_value_name(1) = 'log_R'
trace_history_value_name(2) = 'star_mass'
trace_history_value_name(3) = 'envelope_mass'
trace_history_value_name(4) = 'total_mass_h1'
trace_history_value_name(5) = 'surface_h1'
trace_history_value_name(6) = 'surface_he4'
trace_history_value_name(7) = 'log_L'
trace_history_value_name(8) = 'log_Teff'
!photo_interval = 10
!profile_interval = 2
!history_interval = 1
!terminal_interval = 1
x_integer_ctrl(1) = 5 ! Inlist part number
/ ! end of controls namelist
&pgstar
! Profile_Panels3_xmin = 0 ! 2.5 ! -101d0
! Profile_Panels3_xmax = -101d0 !
! TRho_Profile_xmin = 2.5
! TRho_Profile_xmax = 7.5
! TRho_Profile_ymin = 8.4
! TRho_Profile_ymax = 9.2
/ ! end of pgstar namelist
This is how your run_star_extras.f90 how should look like at the end of this task:
module run_star_extras
...
subroutine extras_controls(id, ierr)
integer, intent(in) :: id
integer, intent(out) :: ierr
type (star_info), pointer :: s
ierr = 0
call star_ptr(id, s, ierr)
if (ierr /= 0) return
s% extras_startup => extras_startup
s% extras_check_model => extras_check_model
s% extras_finish_step => extras_finish_step
s% extras_after_evolve => extras_after_evolve
s% how_many_extra_history_columns => how_many_extra_history_columns
s% data_for_extra_history_columns => data_for_extra_history_columns
s% how_many_extra_profile_columns => how_many_extra_profile_columns
s% data_for_extra_profile_columns => data_for_extra_profile_columns
s% other_wind => other_wind_routine ! You added as a pointer to other_wind
end subroutine subroutine extras_controls
...
! You added to control to make the star lose mass at a constant rate
subroutine other_wind_routine(id, Lsurf, Msurf, Rsurf, Tsurf, X, Y, Z, w, ierr)
use star_def
integer, intent(in) :: id
real(dp), intent(in) :: Lsurf, Msurf, Rsurf, Tsurf, X, Y, Z !surface values (cgs)
real(dp), intent(out) :: w ! wind in units of Msun/year (value is >= 0)
integer, intent(out) :: ierr
! Sub KH mass loss rate
w = s% x_ctrl(1)*(6.7d-7)*((Msurf/Msun)**(-1))*(Rsurf/Rsun)*(Lsurf/Lsun)
ierr = 0
end subroutine other_wind_routine
...
end module run_star_extras
Bonus task: Running a stellar model with Kelvin-Helmholtz mass loss
Your simulation crashed while trying to apply the Kelvin-Helmholtz mass loss to the stellar model. As you might have noticed by planting the prints at the end of other_wind_routine, the Kelvin-Helmholtz mass loss rate reached very high values pretty quickly during the run. For this reason the star got out of equilibrium and didn’t manage to readjust itself thermally.
This is how your run_star_extras.f90 how should look like at this stage:
module run_star_extras
...
subroutine extras_controls(id, ierr)
integer, intent(in) :: id
integer, intent(out) :: ierr
type (star_info), pointer :: s
ierr = 0
call star_ptr(id, s, ierr)
if (ierr /= 0) return
s% extras_startup => extras_startup
s% extras_check_model => extras_check_model
s% extras_finish_step => extras_finish_step
s% extras_after_evolve => extras_after_evolve
s% how_many_extra_history_columns => how_many_extra_history_columns
s% data_for_extra_history_columns => data_for_extra_history_columns
s% how_many_extra_profile_columns => how_many_extra_profile_columns
s% data_for_extra_profile_columns => data_for_extra_profile_columns
s% other_wind => other_wind_routine ! You added as a pointer to other_wind
end subroutine subroutine extras_controls
...
! You added to control to make the star lose mass at a constant rate
subroutine other_wind_routine(id, Lsurf, Msurf, Rsurf, Tsurf, X, Y, Z, w, ierr)
use star_def
integer, intent(in) :: id
real(dp), intent(in) :: Lsurf, Msurf, Rsurf, Tsurf, X, Y, Z !surface values (cgs)
real(dp), intent(out) :: w ! wind in units of Msun/year (value is >= 0)
integer, intent(out) :: ierr
! Sub KH mass loss rate
w = s% x_ctrl(1)*(6.7d-7)*((Msurf/Msun)**(-1))*(Rsurf/Rsun)*(Lsurf/Lsun)
print *, "The value of Msurf is", (Msurf/Msun)
print *, "The value of Rsurf is", (Rsurf/Rsun)
print *, "The value of Lsurf is", (Lsurf/Lsun)
print *, "The value of w is", w
ierr = 0
end subroutine other_wind_routine
...
end module run_star_extras