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
First we are going to run a stellar model without modifying the mass loss scheme, so it serves as a basis of comparison for our next tasks. Let's prepare the MESA inlists and make sure that the parameters we are interested in get printed in the terminal.
1. If you haven't already downloaded all the materials from the Google Drive folder of the school, please download the MINILAB3_winds directory, then navigate into the folder of our session, and move MINILAB3_winds to your working directory.
2. Navigate to the directory of MINILAB3 by using the cd command
cd $TUESDAY_MASSIVE_STARS/MINILAB3_winds/20M/
3. Open the inlist file inlist_to_end_core_c_burn and start the run from the end of core helium burning by loading the pre-computed model 'after_core_he_burn.mod' adding the following lines to the &star_job section in the inlist
load_saved_model = .true.
load_model_filename = 'after_core_he_burn.mod'
4. We will want to look at some summary properties of these stars at the end of the run. To the terminal output, add the values of the stellar radius, star mass, envelope mass, total hydrogen mass, surface hydrogen fraction, surface helium fraction, stellar luminosity and effective temperature to the terminal at each timestep by adding the following lines to the &controls section of the inlist
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'
5. Compile the simulation using the command
./clean && ./mk
Note! If you get a Permission denied error, you can overcome it by typing 'chmod +x exe' in the terminal, where you replace 'exe' with the relevant executable.
6. First, let's evolve the 20Msun star with no mass loss. Run the simulation using the command
./rn
7. Write down the values of the stellar radius, mass, envelope mass, total hydrogen mass, surface hydrogen fraction, and surface helium fraction, stellar luminosity and effective temperature, at the end of core carbon on a piece of paper.
You will later explore how different schemes of mass loss affect some of these values. As a sanity check, compare the values you wrote down to the pre-computed values that appear on the in the Day2_Massive_lab3 tab of the google spreadsheet under the header 'Standard simulation from the end of he core burning to the the end of c core burning'.
Solution:
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
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 the Other_wind hook
In this part we are going to add wind mass loss to our stellar model by using the other_wind_routine. The 'other' hooks in MESA are extremally useful as they allow us to implement different physical concepts through run_star_extras.f90 without changing the source-code.
Applying different schemes of stellar winds to the star could be relevant for studying mass transfer in binary systems, the formation and evolution of Wolf-Rayet stars, and many other processes in life and death of massive stars.
Many processes by which stars launch winds are poorly-understood. In this next section, we will therefore instead take a parameterized approach, considering constant mass loss rates and their impact on the stellar structure and evolution in the HR diagram. To do this, we need to use the other_wind hook in run_star_extras.f90.
Open the file $MESA_DIR/star/other/other_wind.f90.
From there, copy the subroutine null_other_wind to your run_star_extras.f90 file located in $TUESDAY_WORK_DIR/MINILAB3_winds/20M/src/. This routine turns on a stellar wind through which the star loses mass at a constant rate specified by w (in units of M⊙/year). Rename this routine to be called other_wind_routine for clarity. Don't forget to rename both the beginning (declaration) and the end statement of the subroutine!
Note 1: that the commented segments in this subroutine are of no concern to the winds we are going to implement in this Minilab, but are very important for more complex schemes.
Note 2: if you worked with run_star_extras.f90 in the past, you might have noticed that the version of run_star_extras.f90 available in the directory of Minilab3 has some additions compared to the standard version. Additional routines, such as alpha_mlt_routine.f90, are designed to implement physics that better represents processes in massive stars.
Choose a constant mass loss rate between 5e-4 solar masses per year and 9.5e-4 solar masses per year which you would like to apply to the star by writing your name next to the chosen rate in the Day2_Massive_lab3 tab of the google spreadsheet.
The wind rate is determined in other_wind_routine by the value w, which has units of solar masses per year.
Set this value to a constant mass loss rate by modifying the following line in other_wind_routine in src/run_star_extras.f90:
w = 0 !replace 0 with chosen 5d-4 <= Mdot <= 9.5d-4 in solar masses per year
Note! Runs with higher values of w tend to take longer runtime, so only choose a high value of w if you have a strong computer.
Spoiler:
While it's generally best practice not to hard-code in values into run_star_extras.f90, if you try to implement this via an x_ctrl(), you will notice that you will get Fortran errors upon compilation. We will explain how to address this in the next Task, but for now, assume that the other_wind_routine subroutine only has access to its inputs, i.e. Lsurf, Msurf, Rsurf, Tsurf, X, Y, Z, and not the star pointer s%
4. Now that our wind routine is implemented, we need to tell MESA to actually use that wind routine. Add a pointer to other_wind_routine in the subroutine extras_controls by adding the line
s% other_wind => other_wind_routine
5. Finally, activate the other_wind_routine in your simulations run by adding the following line to the &controls section of inlist_to_end_core_c_burn:
use_other_wind = .true.
6. Don’t forget to recompile the simulations by using the command
./clean && ./mk
Note that including every change made to run_star_extras.f90 requires a recompilation.
7. Run the simulation:
./rn
If everything is running correctly, you should see the star_mass parameter in your terminal output changes its value during the evolution of the star.
8. Find the same variables as before for this case: Radius, Luminosity, Effective Temperature, envelope mass, total mass of H, surface fraction of H, and surface fraction of He. Also calculate the mass lost (star_mass at the beginning of the run - star_mass at the end of the run). Write the values you find in the Day2_Massive_lab3 tab of the google spreadsheet.
9. Compare your results with your group-mates - how much mass was lost in each case? how did it affect the final radius of the star? Which other physical properties of the star change when substantially increasing the mass loss?
Solution:
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
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 how should look like at this stage. For a detailed explanation about the meaning of each statement in other_wind_routine please see the Solutions tab.
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
When this is done, please move on to Minilab 3: Task 2: Sub-KH mass-loss!