Skip to content

Commit

Permalink
Removed Part II, simplified assignment.
Browse files Browse the repository at this point in the history
  • Loading branch information
iancze committed Jan 14, 2024
1 parent b596a88 commit 2e89aa1
Show file tree
Hide file tree
Showing 8 changed files with 103 additions and 440 deletions.
9 changes: 1 addition & 8 deletions docs/api.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
# API

## Reading
Use these reader routines to analyze the output from your MESA-Web run. The output is returned as an {class}`astropy.table.Table` object. See the [Astropy Table Documentation](https://docs.astropy.org/en/stable/table/) for more on how to work with these objects.

```{eval-rst}
.. automodule:: as4012_sstr.reader
:members:
```

## Material Properties

```{eval-rst}
.. automodule:: as4012_sstr.properties
:members:
```
43 changes: 14 additions & 29 deletions docs/assignment.md
Original file line number Diff line number Diff line change
@@ -1,42 +1,27 @@
# Assignment
# Assignment Questions

Many questions ask for narrative text to explain your results. Write at most 3 sentences for each sub-question.
Many questions ask for narrative text to explain your results. Direct and concise explanations are desirable.

For more information, there is the very helpful textbook [Stellar structure and Evolution](https://sta.rl.talis.com/link?url=https%3A%2F%2Fdoi-org.ezproxy.st-andrews.ac.uk%2F10.1007%2F978-3-642-30304-3&sig=fdcd1071b225a1cf90b44eda5279280c95987ab43c127ec62127524cf667c523) by Kippenhahn et al., available through the StA library as an E-Textbook. Highly relevant sub-chapters are 1.1, 1.2, 10.1, 11.1, 11.2, 12.1, and 12.2.
1. Read [Asplund et al. 2009ARA&A..47..481A](https://ui.adsabs.harvard.edu/abs/2009ARA%26A..47..481A/abstract), Sections 1-3, and Table 4. What are the recommended values for *mass fractions* $X$ (H), $Y$ (He), and $Z$ (Table 4) for the protosun and the present day photospheric values. Why do they differ?

## Part I: Stellar structure and evolution with MESA
2. Using the logarithmic abundances in Asplund+09 Table 1, calculate the present day photospheric value of $X_C$, the mass fraction of carbon. Note that Asplund+09 use $\log$ to mean $\log_{10}$, not $\ln$.

1. (2pts) **Abundances**: Read [Asplund et al. 2009ARA&A..47..481A](https://ui.adsabs.harvard.edu/abs/2009ARA%26A..47..481A/abstract), paying particular attention to Section 1, Section 3, Tables 1 and 3, and the definition of logarithmic abundances in S3.0. What are the recommended values for *mass fractions* $X$ (H), $Y$ (He), $Z$ (all elements except H and He), and $X_\mathrm{C}$ (just C) for the protosun, how do they differ from the present day values, and why?
3. Read chapter 12 of [Stellar structure and Evolution](https://sta.rl.talis.com/link?url=https%3A%2F%2Fdoi-org.ezproxy.st-andrews.ac.uk%2F10.1007%2F978-3-642-30304-3&sig=fdcd1071b225a1cf90b44eda5279280c95987ab43c127ec62127524cf667c523) by Kippenhahn et al., available through the StA library as an E-Textbook. Then read Section 6 of [Paxton et al. 2011](https://ui.adsabs.harvard.edu/abs/2011ApJS..192....3P/abstract), the paper describing MESA, which is a Henyey-like code. What are the advantages of a Henyey scheme over a Schwarzchild (shooting) scheme?

2. (2pts) **MESA run**: Choose one initial stellar mass from the set of {0.8, 0.9, 1.0, 1.1, 1.2} $M_\odot$ and submit a MESA-Web [calculation](http://user.astro.wisc.edu/~townsend/static.php?ref=mesa-web-submit). Leave all other parameters at their default values. Download the run output when completed. Before continuing, review the MESA-Web [output documentation](http://user.astro.wisc.edu/~townsend/static.php?ref=mesa-web-output).

2.0. View the `.mp4` movie. What does each frame in the movie represent? Does the movie play linearly with time? Why or why not?

2.1. What calculations did MESA perform? What is represented by each `profileXX.data` file?
4. Submit a MESA-Web [calculation](http://user.astro.wisc.edu/~townsend/static.php?ref=mesa-web-submit) for a $1 M_\odot$ star, leaving all other parameters at their default values. Download the run output when completed. Before continuing, review the MESA-Web [output documentation](http://user.astro.wisc.edu/~townsend/static.php?ref=mesa-web-output). View the `.mp4` movie. What does each frame in the movie represent? Does the movie play linearly with time? Why or why not?

2.2 Use `trimmed_history.data` to plot $L$ vs. $T_\mathrm{eff}$ for all timesteps in the model. You may wish to use either a scatter plot or `plt.plot` with `markerstyle="."` to show the timesteps.
5. Use {meth}`as4012_sstr.reader.read_history` and `trimmed_history.data` to plot the evolutionary track of $L$ vs. $T_\mathrm{eff}$ for all timesteps in the model. Set the axis limits to zoom into when the star is on (and nearly on) the main sequence. Use the `stellar_age` quantity to check your $L$ vs. $T_\mathrm{eff}$ plot comports with your understanding of the main sequence lifetime of the Sun. Is the star truly stationary in the HRD for the entirety of the main sequence?

2.3. Use `trimmed_history.data` and the `plot_abundances` routine to create a plot of the mass fractions $X$, $Y$, $Z$, and $X_\mathrm{C}$ of the star as a function of time. How do the initial mass fractions compare to the Asplund+09 values for the protosun?
6. Use {meth}`as4012_sstr.reader.read_history` and `trimmed_history.data` to plot the mass fractions $X$, $Y$, $Z$, and $X_\mathrm{C}$ at the centre of the star as a function of time, up to $10^{10}$ yrs. How do the initial mass fractions $X$, $Y$, and $Z$ compare to the Asplund+09 values for the protosun?

3. (2pts) **ZAMS**: From your plot, identify the time step $i$ (integer) and Age (yr) corresponding to the start of the Zero-Age Main Sequence (ZAMS), after the model has settled but before the core helium abundance starts to increase significantly.

3.1. Read `trimmed_history.data` at this time step $i$ to determine the ZAMS radius $R_\star$, luminosity $L_\star$, effective temperature $T_\mathrm{eff}$, as well as the temperature and pressure values in the core, $T_c$ and $P_c$, respectively.

3.2. Use the `profiles.index` file to map time step index $i$ to appropriate `profileXX.data` file. Read the correct `profileXX.data` file for your time step and plot quantities $\nabla$ ?? vs. mass enclosed coordinate $m$ to answer which zones are convective and which are radiative? Why?

3.3. What is the star's primary energy source at this stage? How do you know?

## Part II: Solving the stellar structure equations yourself using the shooting method (Schwarzchild)

As you saw in Part I, the shooting method of solving the equations of stellar structure ([Schwarzchild 1958](https://encore.st-andrews.ac.uk/iii/encore/record/C__Rb3087134__Sstructure%20and%20evolution%20of%20stars__Orightresult__U__X7?lang=eng&suite=def)) has been eclipsed by modern partial differential equation solvers. However, its implementation is simple enough to expose you to the numerical techniques used in stellar structure calculations.

As you work through this part, reference the equations of stellar structure and their Eulerian/Lagrangian formulations as presented in Lectures 2 & 3.

1. Start from the template code in `template/example.py`. Use the routines in `as4012_sstr.properties` to set up your `odeint` call. Rewrite the numerical integration scheme using the Lagrangian equations with enclosed mass $m$ as an independent variable.
7. Inspect the quantities provided by {meth}`as4012_sstr.reader.read_history` and design a set of criteria by which you might determine the Zero-Age Main Sequence (ZAMS) of your model. Plot these criteria (or some combination of them) vs. stellar age to determine the ZAMS age and closest time step (model number).

2. (6pts) **Lagrangian Scheme, outward**: Use $T(0) = T_c$ and $P(0) = P_c$ from your MESA-Web run as boundary conditions. Use XX as an example for outward integration of the Euler equations using ODEint. Set up and run a scheme that integrates the Lagrange equations outward from the centre of the star to $m=0.5M_\star$. Plot the results (which?) as a function of $m$, but anticipate that you will combine this with #5. Additionally, record the values of $r$, $P$, $L$, $T$ at the fitting point for the inward integration.
8. What are the ZAMS radius $R_\star$, luminosity $L_\star$, and effective temperature $T_\mathrm{eff}$? How do these compare to present day values for the Sun?

5. (3pts) **Lagrangian Scheme, inward**: Write a second Lagrangian integration scheme that works inward from $M_\star$ to $m=0.5M_\star$. Use the surface values of $R_\star$ and $L_\star$ from your MESA-Web run as boundary conditions. Plot the results (which?) as a function of $m$. Additionally, record the values of $r$, $P$, $L$, $T$ at the fitting point for the inward integration. Combine your plot with #4.
9. Use the `profiles.index` file to map the model number to the appropriate `profileXX.data` file. Read this profile and plot quantities $\nabla$ ?? vs. mass enclosed coordinate $m$ to answer which zones are convective and which are radiative? Why?

10. Revisit the `.mp4` movie produced by MESA, and pay particular attention to the plot in the centre of the top row. Pause and advance the movie up through the model number corresponding to ZAMS. Black regions represent radiative zones. Describe how the internal structure of the star changes as it moves from the pre-main sequence to the main sequence.

10. Rerun MESA web for a $2.0 M_\odot$ star and redo your calculation for the ZAMS age. How does this value compare to the ZAMS age for your $1.0 M_\odot$ star?

11. Identify the convective and radiative regions of the $2.0 M_\odot$ star at the ZAMS and compare them to that of the $1.0 M_\odot$ star. Do all main sequence stars have a structure similar to the Sun: nuclear-burning core interior to a radiative zone interior to a convective layer?
69 changes: 2 additions & 67 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,79 +2,14 @@
* University of St Andrews, Spring 2024
* Instructor: Dr. Ian Czekala

For this assessed computational project, you will compute the internal structure of a Sun-like star on the Zero-Age-Main-Sequence (ZAMS) using the Modules for Experiments in Stellar Astrophysics (MESA) code. In Part I, you will use the online interface MESA-web to run a numerical integration and write your own Python code to analyze the output. In Part II, you will implement your own Lagrangian scheme to solve the equations of stellar structure, and compare your results to your MESA run in Part I. For the full assignment, see the [**Assignment Questions**](doc/assignment.md).

## Submission

All materials must be submitted through Moodle by **23:59 February 23rd, 2024**. There will be a penalty of 5% of the total available marks per day or partial day of late submission, including weekends and holidays. Requests for extensions made after the end of Week 5 (Feb 16) will not be considered.

Use the Moodle submission tool to submit:

**Report** containing the narrative text, plots, and numerical results requested for each question. You are free to prepare this report with whatever combination of tools you wish, but it must be self-contained *as a single PDF*. I would suggest either
* save plots as `*.png`, insert into Word or LaTeX document, add text, save to PDF.
* work directly in a Jupyter Notebook, plots appear in Notebook, add text with markdown cells, export to PDF.

**Code**: your `*.py` or `*.ipynb` files. Alternatively, create a "secret" [Gist](https://gist.github.com/) with your code and submit the link.

## Grading Rubric
The assignment counts for 25% of your module grade. The [**Assignment Questions**](doc/assignment.md) have point values listed beside them. There are an additional XX points awarded for report quality, for a total of YY points.

**Excellent** quality reports will:
* Demonstrate a correct understanding of the underlying physics solved by the MESA code.
* Concisely and directly explain the significance of numerical results using narrative text.
* Contain correct numerical results, and correctly implement the Lagrangian scheme.
* Demonstrate an understanding of how the Lagrangian scheme in Part II relates to the output from MESA in Part I.

**Average** quality reports may:
* Demonstrate a largely correct understanding of the subject matter, but may evidence small misconceptions.
* Present correct numerical results, but may fail to fully explain their significance.
* Be vague or overly wordy with their narrative text.
* Fail to demonstrate understanding of the conceptual links between Part I and II.

**Poor** quality reports may:
* Demonstrate an incorrect understanding of the subject matter and the numerical calculations.
* Contain numerical errors.
* Fail to connect physical and numerical understanding across parts of the assignment.
* Be incomplete.

The narrative aspect of your report is as important to understanding the results of your analysis as your numerical values are. Assume that you are writing a technical report to your manager or team members. Take pride in your work and strive for clarity, concision, and excellence.


## Assignment Questions

See the [**Assignment Questions**](doc/assignment.md).

## Code Installation

[![tests](https://github.com/iancze/AS4012-MESA/actions/workflows/tests.yml/badge.svg)](https://github.com/iancze/AS4012-MESA/actions/workflows/tests.yml)

This repository includes code to help you analyze and plot the output from your MESA-Web run. To install this code into your Python environment

1. Download this repository from GitHub.
2. Enter the root of the repository, and run
```
pip install .
```
3. Now, in your Python interpreter, you should be able to do
```
>>> import as4012_sstr
```
If you have any issues, please review the [guide to installing Python packages](https://packaging.python.org/en/latest/tutorials/installing-packages/). If your issues persist, please contact <ic95@st-andrews.ac.uk>.

## References

* [Asplund et al. 2009ARA&A..47..481A](https://ui.adsabs.harvard.edu/abs/2009ARA%26A..47..481A/abstract) You can download the article if you are on the StA network, otherwise there is a copy on Moodle.
* [R. Kippenhahn, A. Weigert, A. Weiss (2013) "Stellar structure and Evolution](https://sta.rl.talis.com/link?url=https%3A%2F%2Fdoi-org.ezproxy.st-andrews.ac.uk%2F10.1007%2F978-3-642-30304-3&sig=fdcd1071b225a1cf90b44eda5279280c95987ab43c127ec62127524cf667c523) E-Textbook (free to StA)
* [MESA-Web](http://user.astro.wisc.edu/~townsend/static.php?ref=mesa-web) the online interface you will use to run MESA.
* [Fields et al. 2023](https://ui.adsabs.harvard.edu/abs/2023arXiv230915930F/abstract): Publication to appear in the Astronomy Education Journal describing MESA-Web
* [MESA](https://docs.mesastar.org/en/release-r23.05.1/), the underlying software (FYI).
* [DSFE 2018 grading rubric](https://matthew-brett.github.io/dsfe/projects/rubric), inspiration for rubric.
For this assessed computational project, you will compute the internal structure of a Sun-like star on the Zero-Age-Main-Sequence (ZAMS) using the Modules for Experiments in Stellar Astrophysics (MESA) code. For the full assignment, see the [**Assignment Questions**](assignment.md).


```{toctree}
:caption: Contents
:maxdepth: 2
information
assignment
api
```
65 changes: 65 additions & 0 deletions docs/information.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Information

## Submission

All materials must be submitted through Moodle by **23:59 February 23rd, 2024**. There will be a penalty of 5% of the total available marks per day or partial day of late submission, including weekends and holidays.

Use the Moodle submission tool to submit:

**Report** containing the narrative text, plots, and numerical results requested for each question. You are free to prepare this report with whatever combination of tools you wish, but it must contain all of your answers and be self-contained *as a single PDF*. I would suggest either
* save plots as `*.png`, insert into Word or LaTeX document, add text, save to PDF.
* work directly in a Jupyter Notebook combining text, numbers and plots then [export to PDF](https://jupyterlab.readthedocs.io/en/stable/user/export.html).

**Code**: your `*.py` or `*.ipynb` files. Alternatively, create a "secret" [Gist](https://gist.github.com/) with your code and submit the link. These will not be graded, nor will I reference them for numerical answers or plots.

## Grading Rubric

**Excellent** quality reports will:
* Demonstrate a correct understanding of the underlying physics solved by the MESA code.
* Concisely and directly explain the significance of numerical results using narrative text.
* Contain correct numerical results and properly labeled plots.

**Average** quality reports may:
* Demonstrate a largely correct understanding of the subject matter, but may evidence small misconceptions.
* Present correct numerical results, but may sometimes fail to fully explain their significance.
* Be vague or overly wordy with their narrative text.

**Poor** quality reports may:
* Demonstrate an incorrect understanding of the subject matter and the numerical calculations.
* Contain numerical errors.
* Fail to connect physical and numerical understanding across parts of the assignment.
* Be incomplete.

The assignment counts for 25% of your module grade. The [**Assignment Questions**](assignment.md) have point values listed beside them, which total 20 pts. The remaining 5 points are awarded for report quality.

The narrative aspect of your report is as important to understanding the results of your analysis as your numerical values are. Assume that you are writing a technical report to your manager or team members. Take pride in your work and strive for clarity, concision, and excellence.

## Code Installation

[![tests](https://github.com/iancze/AS4012-MESA/actions/workflows/tests.yml/badge.svg)](https://github.com/iancze/AS4012-MESA/actions/workflows/tests.yml)

This repository repackages the `mesa_web.py` reader routines to help you analyze the output from your MESA-Web run. To install this code into your Python environment

1. Download this repository from GitHub.
2. Enter the root of the repository, and run
```
pip install .
```
3. Now, in your Python interpreter, you should be able to do
```
>>> from as4012_sstr import reader
>>> table = reader.read_history(...)
```

See the [](api.md) for full documentation of the reading routines.

If you have any issues, please review the [guide to installing Python packages](https://packaging.python.org/en/latest/tutorials/installing-packages/). If your issues persist, please contact <ic95@st-andrews.ac.uk> listing the steps you tried following the guide.

## References

* [Asplund et al. 2009ARA&A..47..481A](https://ui.adsabs.harvard.edu/abs/2009ARA%26A..47..481A/abstract) You can download the article if you are on the StA network, otherwise there is a copy on Moodle.
* [R. Kippenhahn, A. Weigert, A. Weiss (2013) "Stellar structure and Evolution](https://sta.rl.talis.com/link?url=https%3A%2F%2Fdoi-org.ezproxy.st-andrews.ac.uk%2F10.1007%2F978-3-642-30304-3&sig=fdcd1071b225a1cf90b44eda5279280c95987ab43c127ec62127524cf667c523) E-Textbook (free to StA)
* [MESA-Web](http://user.astro.wisc.edu/~townsend/static.php?ref=mesa-web) the online interface you will use to run MESA.
* [Paxton et al. 2011](https://ui.adsabs.harvard.edu/abs/2011ApJS..192....3P/abstract): the definitive MESA publication
* [Fields et al. 2023](https://ui.adsabs.harvard.edu/abs/2023arXiv230915930F/abstract): Publication to appear in the Astronomy Education Journal describing MESA-Web
* [DSFE 2018 grading rubric](https://matthew-brett.github.io/dsfe/projects/rubric), inspiration for rubric.
21 changes: 0 additions & 21 deletions src/as4012_sstr/constants.py

This file was deleted.

Loading

0 comments on commit 2e89aa1

Please sign in to comment.