Mesa学习笔记#1:Running MESA
Running MESA
关于如何使用MESA来演化一颗恒星。***$MESA_DIR***
目录有许多子目录。这些子目录中的大多数都是模块(MESA中的“M”),它们提供一些特定的功能(例如,“kap”提供计算不透明度的例程)。最重要的模块是“star”,它包含一个模块,该模块知道如何将所有其他模块的功能放在一起,通过一个步骤推进一个star模型的状态,然后为下一步建立一个新的时间增量。基本上,这就是它的全部功能。
这里是为了一个可以用这些模块进行多步恒星演化的程序。这样的程序位于star/work目录中,我们将从那里开始。
1. Make a copy of the star/work directory
在主MESA目录之外的其他地方执行和存储工作。这将在将来的某个时候对新的MESA版本进行更新时简化工作。因此,每当启动一个新的MESA项目时,应该创建一个新的star/work目录副本。
cp -r $MESA_DIR/star/work tutorial
复制了工作副本,接下来开始编译其中的代码。
cd tutorial
./mk
2. Set up configuration files
工作目录已经包含了一组简单的配置文件,将从一个15太阳质量的恒星演化到零龄主序(核心氢点火)。现在,不需要编辑任何内容,查看一下这些文件。
2.1. inlist
这是MESA启动时读取的第一个内列表文件。文件inlist
通常用于指示MESA读取一个或多个其他内链表文件。
恒星文件inlist
包含五个部分 (technically fortran “namelists”) :
star_job - options for the program that evolves the star
eos - options for the MESA eos module
kap - options for the MESA kap module
controls - options for the MESA star module
pgstar - options for on-screen plotting
名称列表中定义都是这样的形式:
name = value ! comment
使用正常的fortran语法指定值。空行和注释行可以自由地包含在列表中。在包含名称-值对的行开始使用空格也是可以的,因此可以(也应该)缩进内容以使其更具可读性。
所有的控件在初始化时都有合理的默认值,因此只需要设置实际想要更改的那些。
! This is the first inlist file that MESA reads when it starts.
! This file tells MESA to go look elsewhere for its configuration
! info. This makes changing between different inlists easier, by
! allowing you to easily change the name of the file that gets read.
&star_job
read_extra_star_job_inlist1 = .true.
extra_star_job_inlist1_name = 'inlist_project'
/ ! end of star_job namelist
&eos
read_extra_eos_inlist1 = .true.
extra_eos_inlist1_name = 'inlist_project'
/ ! end of eos namelist
&kap
read_extra_kap_inlist1 = .true.
extra_kap_inlist1_name = 'inlist_project'
/ ! end of kap namelist
&controls
read_extra_controls_inlist1 = .true.
extra_controls_inlist1_name = 'inlist_project'
/ ! end of controls namelist
&pgstar
read_extra_pgstar_inlist1 = .true.
extra_pgstar_inlist1_name = 'inlist_pgstar'
/ ! end of pgstar namelist
2.2. inlist_project
我们将使用这些选项从一个前主序模型构建一个15倍太阳质量的恒星,然后在到达零龄主序(ZAMS)时停止演化。
! inlist to evolve a 15 solar mass star
! For the sake of future readers of this file (yourself included),
! ONLY include the controls you are actually using. DO NOT include
! all of the other controls that simply have their default values.
&star_job
! see star/defaults/star_job.defaults
! begin with a pre-main sequence model
create_pre_main_sequence_model = .true.
! save a model at the end of the run
save_model_when_terminate = .false.
save_model_filename = '15M_at_TAMS.mod'