Henrik-Knierim / mesa_custom_EoS

A module to implement your EoS into MESA!
GNU General Public License v3.0
1 stars 0 forks source link

Beginner's Question on How to Construct an EOS File #1

Open HaihaoSHI opened 3 months ago

HaihaoSHI commented 3 months ago

Hi,I’m a beginner trying to understand how to create and use my own equation of state (EOS) in MESA. I have downloaded some EOS files from the internet, such as SFHo, but I’m not sure how to begin using them in MESA.

When I opened the EOS files, I felt a bit overwhelmed and unsure of how to proceed with integrating them into my simulations. Could you please guide me on the first steps I should take to build and implement an EOS in MESA? Any advice or pointers to relevant documentation or tutorials would be greatly appreciated.

TAT

Henrik-Knierim commented 3 months ago

Hello,

There are essentially two main steps involved:

  1. Create mesa-style EoS tables.
  2. Implement the EoSs following the tutorial in the README file of this repo.

It sounds like you’re currently struggling with the first part, correct? To start, most EOS tables in MESA use $(\log Q, \log T, X, Z)$ as inputs, where $\log Q = \log \rho - 2 \log T +12$. MESA retrieves data by first interpolating within tables for fixed values of $X$ and $Z$ (i.e, using $(\log Q, \log T)$ as inputs) and then interpolating between the different $(X, Z)$ tables. The different $(X, Z)$ are indexed by their name. For example, inside the $MESA_DIR/data/eosDT_data directory, you'll find mesa-eosDT_00z00x.data for $Z = 0$ and $X = 0$, mesa-eosDT_00z20x.data for $Z = 0$ and $X = 0.2$, etc.

If you open one of these files, such asmesa-eosDT_00z00x.data, you’ll see the format used for MESA’s EOS files. Most of the values should be self-explanatory, and you should be able to modify them according to the EOS you’re working with. However, if anything is unclear, you can refer to the mesa documentation. If your EOS does not provide all the quantities listed, you may need to use thermodynamic relations to derive the missing information from what you have.

I hope this helps!

Cheers

Henrik

HaihaoSHI commented 3 months ago

Thank you very much for your guidance. I have successfully built my own EOS and successfully ran it. PS: The _run_star_extras.f90_ file encountered some errors when running on my computer, but they were minor issues. I have made the necessary corrections and attached the file. Once again, I express my gratitude! run_star_extras.zip

Henrik-Knierim commented 3 months ago

Glad I could help! And thanks for attaching your file, I'll check it out in the next few days!