# Example Walkthrough: Simple Polytrope¶

As the first example of build_poly in action, let’s build a simple (i.e., single-region) $$n=3$$ polytrope, that for instance describes the structure of a radiation-pressure dominated, fully convective star.

## Assembling a Namelist File¶

First, let’s assemble a namelist file containing the various parameters which control a build_poly run. Using a text editor, create the file build_poly.simple.in with the following content cut-and-pasted in:

&poly
n_poly = 3.0  ! Polytropic index of single region
/

&num
dz = 1E-2     ! Radial spacing of points
toler = 1E-10 ! Tolerance of integrator
/

&out
file = 'poly.simple.h5' ! Name of output file
/


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:

• In the &poly namelist group, the n_poly parameter sets the polytropic index.

• In the &num namelist group, the dz parameter sets the radial spacing of points, and the toler parameter sets the tolerance of the numerical integrator.

• In the &output namelist group, the file parameter sets the name of the output file.

## Running build_poly¶

To run build_poly, use the command


span.prompt1:before {
content: "$"; }$GYRE_DIR/bin/build_poly build_poly.simple.in


There is no screen output produced during the run, but at the end the poly.simple.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. 12) using the read_model function from PyGYRE.

Fig. 12 Plot of the Lane-Emden solution variable $$\theta$$, density $$\rho$$, pressure $$P$$ and interior mass $$M_{r}$$ as a function of radial coordinate, for the simple polytrope. (Source)