Our first MESA task involves the evolution of a massive star model until the end of core Helium burning. For this, go to the google spreadsheet (and navigate to the tab Day2_Massive_lab1) and select an initial mass and a parameter set for superad_reduction (either TRUE, FALSE, or MODIFIED) by writing your name in the appropriate column.
NOTE 1: For the collaborative/group work part of this lab, you will be entering the results of one of your two runs into the spreadsheet. Check whether you will be recording a run with superad_reduction TRUE, FALSE or MODIFIED. If you have chosen a parameter set with FALSE, then you will be using the values from the end of this Section's run. If it is TRUE, or MODIFIED, then you will be using the values from the end of your run in Section 1.4.
VERY IMPORTANT NOTE 2: The higher the value of M, the longer the run will take. If you are concerned about the time it will take for your computer to run higher mass models, choose a lower initial mass. Conversely, if you know your computer can run MESA faster, please select a higher initial mass. Finally, if your computer is extremely fast or if you finish early, feel free to to run multiple parameters if any are unclaimed after your first run is complete.
Expected speed roughly corresponds to the number of threads available as follows:
< 4 threads: slow
4-8 threads: average
8-16 threads: fast
> 16 threads: not that much faster than 16.
And not all CPU's are equally fast.
NOTE 3: Throughout these tasks we will need to edit the following;
inlist
inlist_mass_Z_wind_rotation
inlist_to_end_core_he_burn
As was the case during the monday labs, inlist is the main inlist file which is often used to point to other inlists we may wish to use - this allows users to systematically change a base model setup. For example, we can keep the initial mass value in a separate inlist, which in our case is inlist_mass_Z_wind_rotation, and change only that file for any other masses we wish to test. The final inlist we wish to change for this lab, inlist_to_core_he_burn, will contain our stopping condition and any relevant physics for this stage of evolution. Meanwhile, inlist_common, which we will not change, contains all of the core physics we wish to implement in our model. You may wish to take a look through this inlist if you have the time.
NOTE 4: Throughout this minilab, you will be presented with three ways of going through the lab, which are analagous to difficulty. 1) "Do it myself" - only the question is given with no hints, except a link to the MESA documentation. 2) "Hints" - Several hints are given in order to direct you in to the right path. 3) "Basic solution" - The code block is given, however there may still be some things which need to be edited. If you are really stuck, then there are full solutions available in Section 1.6.
NOTE 5: Each part where MESA code will be added to our inlists will have a question(s) associated with it. These should help you if you are stuck to figure out where this code should go, and what values are needed to put into the inlists. Each question has a Hint and an Answer which can be revealed by clicking the drop down menu option.
Task 1. Load a saved model file
Start by loading in the saved model file for your chosen mass.
Modeling up through the core Helium burning phase can take a while to model appropriately, so we provide a basis to start from - XX_M_TAMS.mod, where XX is the mass of the model you have chosen - in a subfolder within your working directory; TAMS_models/XX_M_TAMS.mod.
From the options available, choose the mod file which corresponds to your chosen initial mass. This model has finished core Hydrogen burning (the Terminal Age Main Sequence, or TAMS), and we will now continue its evolution by modifying inlist_to_end_core_he_burn. Then, load it in to the appropriate inlist (more hints below).
If you would like to attempt this yourself, stop reading here and go for it!
If you would like some hints to help direct you, check out the questions below. If you would like the code required for this section, look at the grey minted code block - both of which are in the drop down menus.
Hinting Questions:
Which inlist do we want to edit?
Which namelist section does this go into?
What is the name of the file we wish to load?
Where would we look on the MESA documentation website for this?
Hints
Which inlist looks at this phase of evolution?
It is not controls
Something to do with the terminal age main sequence
See Reference tab on the website
Answers
inlist_to_end_core_he_burn
star_job
'[Mass]_M_TAMS.mod’
Partial Solution
! Modify inlist_to_end_core_he_burn
! These lines go somewhere within &star_job.
! --- load previously saved model ---
load_saved_model = .true.
load_model_filename = 'XX_M_TAMS.mod' ! replace XX with your chosen mass
When testing that the code compiles and runs, we do NOT want to wait for the star’s entire evolution. We merely want to make sure that the model is running. So, terminate the program after you are confident that MESA is running (10 steps or less!) by entering CTRL+C into the terminal. In fact, the model currently has no stopping conditions and so it will continue going until it runs into a convergence problem, or told to stop.
It is always a good idea to test a model every time you change things or when new, uncertain physics is added. So, save the inlist file and test that the model runs. This is done by the following commands in Terminal (for Linux and Mac systems):
./clean
./mk
./rn
At this point you may receive and error saying "Permission Denied". This is because you downloaded these from the internet, so your computer may not just let them be executable automatically. If that's the case, you can make all the shell scripts executable by running the following:
$ chmod a+x clean mk rn re rn1
Note that ./clean && ./mk will recompile the program, whereas we have only edited namelist files so far, not changed any source code. So if you have compiled within this directory previously, and you have only modified the inlists since then, you can skip the step where you ./clean && ./mk.
Our model starts at the end of the main sequence (central hydrogen mass fraction < 0.001) and we want to evolve the star through core Helium burning. MESA includes a suite of stopping conditions for us to use, including maximum model number, mass fraction in the core/envelope, core/surface temperature, and many more.
Task 2. Stopping Conditions
Enter the stopping conditions for the model so that the model stops when the central mass fraction of Helium-4 becomes < 0.001
Hinting Questions
Which namelist section does this go into?
How do we write '0.001' in double precision in a MESA inlist?
Hints
NOT &star_job
10 = 1d1
Answers
&controls
1d-3
Partial Solution
! Modify inlist_to_end_core_he_burn
! These lines go somewhere within &controls.
! --- stopping conditions ---
xa_central_lower_limit_species(1) = 'he4'
xa_central_lower_limit(1) = 1d-3
Now when we run the model later in the lab, it will eventually stop once the fraction of central Helium-4 drops below the value set in your inlist.
A word of warning: This condition does not differentiate between phases of stellar evolution, only fractional abundances. So, it is possible to have a model stop with this condition during, say, the early main sequence. If you would like to test this yourself, try running your model at TAMS to center c12 < 0.1.
Now the model should start and stop where we want it to.
Next, we will turn to including some physics - mixing and overshooting (we can also add in Mass Loss, but this is a Bonus Task).
As discussed in detail during Monday’s labs on AGB stars, Convective Boundary Mixing is a broad term encompassing hydrodynamic mixing instabilities at the convective boundaries, and Overshooting is one way to parameterise the extra mixing caused by motion of fluid past the Schwarzschild or Ledoux boundary of a convective region. Note that overshooting only mixes the chemical elements; for a more complete CBM prescription which also takes into account impacts on the relevant thermodynamic gradients, one would have to adjust run_star_extras.f90.
For the purposes of this lab, we are interested in setting the following:
Scheme: What prescription for overshooting? This is typically going to be either step, or exponential (or 'other' along with a custom routine implemented in run_star_extras.f90). 'Step' overshooting sets a constant mixing coefficient some distance (a fraction of the pressure scale height) above and/or below a convective region, whereas 'exponential' results in an exponentially decreasing mixing coefficient further away from a convective region, with an e-folding scale proportional to the pressure scale height.
Zone Location: Where is the convection region specifically in the star? Is this overshooting only going to happen on the core or shell? Or any convection zone.
Zone Type: What conditions in the convective region do we want to be met for there to be overshooting with this scheme? E.g. Do we only want overshooting to occur for convective regions which are burning hydrogen? Or all convection zones?
Boundary Location: Will overshooting occur on the top, bottom or both sides of the convection zone?
f : How far will the overshooting region extend? This is a positive real number quantity multiplied by the local pressure scale height (Hp) to determine the overall height of the overshooting region.
f0: Where does overshooting begin? This quantity determines how far into the convective region the overshooting scheme will start, and is also multiplied by the pressure scale height. NOTE: This quantity should always be less than f otherwise the overshooting will be occuring exclusively within the convective zone!
The equation for exponential overshooting is given below.
where D represents the compositional mixing diffusion coefficient, and D0 and Hp,0 are evaluated at a location r0 which is a distance f0*Hp[evaluated at the convective boundary] inside the convective boundary.
The controls for overshooting go within the &controls section. The full documentation for overshooting is provided on the MESA website here.
Task 3. Enable Overshooting
Add overshooting to inlist_to_end_core_he_burn using the exponential overshooting scheme, with f = 0.005 and f0 = 0.001. Ensure that this prescription applies to all overshooting zones.
Hinting Questions
Which namelist section does this go into?
Is it possible to add in multiple overshooting settings? If so, how can this be done?
Hints
This information can be found in the documentation
Yes.
Answers
&controls
Each time an overshooting prescription is given, you must enter a number to identify it's "precedence". Lower numbers mean higher precedence. This means that specific strengths of overshooting can be applied to specific zones, or even specific faces of zones.
Partial Solution
! Modify inlist_to_end_core_he_burn
! These lines go somewhere within &controls.
overshoot_scheme(1) = 'exponential'
overshoot_zone_type(1) = 'any'
overshoot_zone_loc(1) = 'any'
overshoot_bdy_loc(1) = 'any'
overshoot_f(1) = 0.05d0
overshoot_f0(1) = 0.001d0
Here, it would be a good idea to re-run the model quickly for a few timesteps just to check if you can see a white region on the Kippenhahn diagram in pgstar, corresponding to overshooting (white) surrounding the convective regions (light blue), as in Fig. 1. Then terminate the run (CTRL+C). Again, this should not take many timesteps, only 10 or 20.
A Kippenhahn diagram is a particularly useful and ubiquitous diagram in stellar evolution which simultaneously provides a history and profile of the stellar model. This is effectively a space-time diagram for stars. In Figure 1, we can trace the history on the X-axis (left is younger), in this case tracked by model_number (a time step in MESA), and see the time-evolution of stellar mass, core mass, and convective regions. Additionally, we can trace the profile of the model at each time through the Y-axis, in this case a mass coordinate, where we can examine the location of convective regions, nuclear burning regions, et cetera.
Figure 1: Example Kippenhahn plot from pgstar. White can be seen on the edges of convective regions - these are our overshooting regions.
Now that we have the desired physics present in our model, we will run our star from TAMS until the end of core Helium burning.
TAMS to End core Helium Burning
Duration ~ 5 Mins, 8 THREADS
While the model is running, you will start seeing two sets of output. One is the terminal output (Fig. 2), which provides a text-based summary of stellar properties, and the other is graphical through pgplot (Fig. 3) which we have enabled in inlist_pgstar. Note that you find the Kippenhahn diagram and H-R Diagram in different windows within pgplot.
If you have time at the end, you may wish to edit inlist_pgstar to change which plots you see, remove some, or add others. For the full list of pgplot options, see the documentation here.
Figure 2: Terminal output for the test model.
Figure 3: PGplot output for the test model. The top text provides a summary of the model’s properties as it is running live. On the left, there is a T-center, ρ-center diagram which tracks the history of the central temperature and density of the model. Below this are profiles of different properties of the model. In the centre, there is a T-ρ profile of the model, and below that are several history plots for different properties of the model. The final column on the right provides mass-coordinate profile plots showing mass fractions, energy generation, mixing profiles and individual temperature and density plots.
If you put your name next to a row in the Google spreadsheet that corresponds to Superad_reduction = FALSE then don’t forget to add your final values of the effective temperature and radius to the spreadsheet (see 1.3.6 for instructions).
What is the Effective (surface) Temperature of the model at the final step?
What is the radius of the model at the final step?
Bonus: Pgstar exits once the model is completed. What could we put into our inlists to preserve the Pgstar output on our screen? Alternatively, what could we put into our inlists to save the output of Pgstar as a .png?
Hints
You can find this in the final output of the terminal or in the text output in pgstar.
Same with this.
Check the MESA docs for pgplot - here.
Answers
Varies with mass!
Varies with mass!
pause_before_terminate = .true.
Now that we have run a model with standard MLT for comparison, let's enable the new implicit superadiabatic reduction hack. A full description of the implementation is found in MESA VI (Jermyn et. al. 2023) , Section 7.2; here we will provide a short description.
Computing massive stars can become a significant numerical challenge, with conditions in the envelope or near the surface resulting in impractically short timesteps. For the last decade, MESA has had the option to use a method known as MLT++ to reduce the superadiabaticity (i.e. reduce the deviation of the stellar temperature gradient from the adiabatic temperagure gradient). This method was first documented in MESA II (Paxton et. al. 2013) , Section 7.2 and is still in use today. Anyone interested in testing the differences between superad_reduction and MLT++ are encouraged to try the Bonus Task in Section 1.6.2.
Typically, it is the Eddington limit which is the driving factor of these issues. The Eddington limit is given below.
where the Eddington luminosity LEdd is defined as LEdd = 4πGcM/κ where κ is the opacity (with some intentional ambiguity between whether this is a local opacity or an average opacity, e.g. electron scattering).
When using superad_reduction, a model which has convective regions close to the Eddington limit will artificially enhance the transfer of energy through these regions by adjusting the difference between radiative temperature gradient and the Ledoux gradient (which captures the ‘superadiabaticity’) by a factor of fΓ: ∇rad,modified − ∇L = (∇rad − ∇L)/ fΓ. The form of fΓ is given below.
Here, α1, α2, Γc, δc are free parameters which control the energy enhancement, while g and h are functions which also control the amount of energy enhancement. β is the gas pressure ratio β = Pgas/(Prad + Pgas), and Γinv = 4(1 − β)/(4 − 3β) is the Eddington factor required for a density inversion.
Now that we have a model from the previous section that ran without superad_reduction, we want to test what happens if we put superad_reduction on with default values.
If you have chosen to do a model with the TRUE option for superad_reduction in the spreadsheet, then keep superad_reduction_Gamma_limit_scale = 5.0d0.
If you have chosen to do a model with the MODIFIED option for superad_reduction in the spreadsheet, then change superad_reduction_Gamma_limit_scale = 2.5d0.
If, however, you have chosen to do a model with the FALSE option for superad_reduction in the spreadsheet, then you have a choice between either superad_reduction_Gamma_limit_scale = 2.5d0 or 5.0d0.
The inlist options we will want to use are given under Partial Solutions, but you may wish to find them yourself in the documentation (linked here).
Task 4. Include superad_reduction
Enter the controls for superad_reduction into your inlist_to_end_core_he_burn. If you have selected TRUE or FALSE for superad_reduction option in the spreadsheet, use the default values for this task. If you have selected MODIFIED, change superad_reduction_Gamma_limit_scale = 2.5d0. NOTE These are placed in the &controls namelist.
You may also wish to label your LOGS directory to be distinct from previous runs. The following code to do so goes in the &controls namelist section:
log_directory = 'LOGS_20_M_superad_reduction'
Pensive Questions: These are open-ended questions for thought provocation, as opposed to assistance in building the MESA inlist.
What are you expecting to see that is different between this run and the previous?
What effects could superad_reduction have on the post-Helium burning evolution of this model?
Partial Solution
! Modify inlist_to_end_core_he_burn
! These lines go somewhere within &controls.
use_superad_reduction = .true.
superad_reduction_Gamma_limit = 0.5d0
superad_reduction_Gamma_limit_scale = 5d0
superad_reduction_Gamma_inv_scale = 5d0
superad_reduction_diff_grads_limit = 1d-3
superad_reduction_limit = -1d0
superad_reduction from TAMs to End He
Duration ~ 5 Mins, 8 THREADS
When you're done, enter the required values of Temperature and Radius into the spreadsheet if you are running a model with superad_reduction as TRUE or MODIFIED.
What is the Effective (surface) Temperature of the model at the final step?
What is the radius of the model at the final step?
How do these quantities compare to the same mass model without superad_reduction?
Answers
XXX
YYY
Smaller radius, hotter temperature, more flux at the surface, density inversion etc.
Congratulations! Once you are comfortable with what has been presented here and with what you have done with your models, feel free to try the Bonus Tasks.