You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+13-13Lines changed: 13 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,18 +1,18 @@
1
1
MesaScript
2
2
==========
3
3
4
-
###MESA Requirement!
4
+
###MESA Requirement!
5
5
In its current state, MesaScript requires MESA rev. 5596 or above. This is due
6
6
to a sensitivity to where the `'.inc'` files are stored on earlier versions. If
7
7
there is demand for MesaScript for earlier revisions, I will look into making
8
8
it backward compatible.
9
9
10
-
###The Short Short Version
10
+
###The Short Short Version
11
11
To get up and running fast, skip to installation, then try and use the included
12
12
sample file, `sample.rb` (via running `ruby sample.rb` in the command line). The
13
13
comments in `sample.rb` should get you started, especially if you have at least
14
14
a little Ruby know-how.
15
-
###What is MesaScript?
15
+
###What is MesaScript?
16
16
Lightweight, Ruby-based language that provides a powerful way to make inlists
17
17
for MESA projects. Really, MesaScript is a DSL (domain-specific language) built
18
18
on top of Ruby, so Ruby code "just works" inside MesaScript (if you're familiar
@@ -43,7 +43,7 @@ are pretty wide open. You could easily make a script that starts with a given
43
43
set of parameters, run MESA star, then use the output of that run to dictate a
44
44
new inlist and run, creating a chain (maybe a MESA root find of sorts).
45
45
46
-
###Installation
46
+
###Installation
47
47
MesaScript is now available as a gem! Assuming you have the `gem` command up
48
48
and running (you probably do, but if not, check out
49
49
[RubyGems](https://rubygems.org) to get it up and running). Simply run
@@ -91,7 +91,7 @@ work. The `mesa_script.rb` file generates all the necessary data it needs from
91
91
the MESA source on the fly (this also makes it nearly MESA version
92
92
independent).
93
93
94
-
###Basic Usage
94
+
###Basic Usage
95
95
The `mesa_script.rb` file defines just one class, Inlist, which we'll interact
96
96
with primarily through one class method, `make_inlist`. Just put the following
97
97
in a file to make a blank inlist:
@@ -113,14 +113,14 @@ by the way). Then to actually generate the inlist, enter
113
113
MesaScript, and you did so using fewer lines than it would have taken to
114
114
actually make that inlist on your own (technically)!
115
115
116
-
###Entering Inlist Commands
116
+
###Entering Inlist Commands
117
117
Making blank inlists is boring, so now let's cover how you actually make useful
118
118
inlists. For mesa inlists, there are really only two types of declarations:
119
119
those for scalars and those for array. Let's talk about scalars first, since
120
120
they are far more common. Then we'll get to the more complicated array
121
121
assignments.
122
122
123
-
####Scalar Assignments
123
+
####Scalar Assignments
124
124
As an example, let's say we want to set the initial mass of our star to 2.0
125
125
solar masses. The inlist command for this is `initial_mass`. In a regular
126
126
inlist file, we would need to put this in the proper namelist, `&controls` as
@@ -143,7 +143,7 @@ called `initial_mass`. (For the person curious as to why I didn't program this
143
143
functionality in, google something like "instance_eval setter method" to
144
144
discover what took me too long to figure out.)
145
145
146
-
####Array Assignments
146
+
####Array Assignments
147
147
As an example, let's say we want to set a lower limit on a certain central
148
148
abundance as a stopping condition. Then we would, at the minimum, need to set
149
149
the inlist command `xa_central_lower_limit_species(1) = 'h1'`, for example. In MesaScript, there are three ways to do this:
@@ -160,7 +160,7 @@ work:
160
160
I tried to program this functionality in, and the kind people at
161
161
[StackOverflow](http://stackoverflow.com/questions/21036873/how-do-i-write-a-method-to-edit-an-array-hash-using-parentheses-instead-of-squar/21044781?noredirect=1#21044781) kindly but firmly convinced me it was utterly impossible to to with Ruby without writing a parser of my own. Just stick to the bracket syntax or the less natural parentheses/space notations.
162
162
163
-
####Other Details
163
+
####Other Details
164
164
That's really all you need to know to start making inlists with MesaScript,
165
165
though I should remind you, especially if you aren't familiar with Ruby, about
166
166
the basic types of entries you might use. Most inlist commands are one of the
@@ -218,10 +218,10 @@ inlist commands so you don't forget to change a particular command when you
218
218
move on to a different run (like forgetting to change a `LOG_dir`, which I've
219
219
done a few too many times and thus overwritten some data).
220
220
221
-
###Deeper and Deeper...
221
+
###Deeper and Deeper...
222
222
Are you still reading this? Well, you must want to do more.
223
223
224
-
###Using Custom Namelists
224
+
###Using Custom Namelists
225
225
You can also make MesaScript know about additional namelists (or forget about
226
226
the standard three). After requiring the `mesa_script` file, you can change the
227
227
namelists it cares about via the following commands (obviously subbing out any
@@ -252,7 +252,7 @@ That *should* set things up to work with custom namelists, so long as the
252
252
`.inc` and `.defaults` files are formatted more or less the same as the "stock"
253
253
ones.
254
254
255
-
###Accessing Current Values and Displaying Default Values
255
+
###Accessing Current Values and Displaying Default Values
256
256
Perhaps you want to display a default value in your inlist, but not actually
257
257
change it. Well, most of the assignment methods mentioned earlier
258
258
are also getter methods. I haven't mentioned how these methods actually work, so I'll do so now since you're still reading this manifesto.
@@ -297,5 +297,5 @@ Note that these array methods, as indicated, point to hashes (not arrays) of
297
297
values. So `xa_central_lower_limit_species[1] = 'h1'` would return
298
298
`{1 => 'h1'}`.
299
299
300
-
##Further Work
300
+
##Further Work
301
301
I warmly welcome bug reports, feature suggestions, and most all, pull requests!
0 commit comments