Example Walkthrough: Composite Polytrope¶
As the second example of build_poly in action, let’s build a two-region composite polytrope. The polytropic index is \(n=3\) in the inner region, and \(n=1.5\) in the outer region. At the boundary between the regions, located at radial coordinate \(z=1.4\), the logarithmic density jump is \(\Delta = -0.5\).
Assembling a Namelist File¶
Using a text editor, create the file
the following content cut-and-pasted in:
&poly n_r = 2 ! Number of regions n_poly = 3.0, 1.5 ! Polytropic indices of regions z_b = 1.4 ! Radial coordinate of region boundaries Delta_b = -0.5 ! Logarithmic density jump at region boundaries / &num dz = 1E-2 ! Radial spacing of points toler = 1E-10 ! Tolerance of integrator / &out file = 'poly.composite.h5' ! Name of output file /
Again, detailed information on the namelist groups expected in build_poly input files can be found in the Input Files section. Here, let’s briefly narrate the parameters appearing in the file above:
&polynamelist group, the
n_rparameter sets the number of regions; the
n_polyparameter sets the polytropic indices in the two regions; the
z_bsets the radial coordinate of the boundary between the regions; and the
Delta_bsets the density jump at this boundary.
&numnamelist group, the
dzparameter sets the radial spacing of points, and the
tolerparameter sets the tolerance of the numerical integrator.
&outputnamelist group, the
fileparameter sets the name of the output file.
As before, to run build_poly use the command
There is no screen output produced during the run, but at the end the
poly.composite.h5 will be written to disk. This file, which is in
POLY format, can be used as the input stellar
model in a GYRE calculation; but it can also be explored in Python
(see Fig. 13) using the
read_model function from