Working With Tags

This chapter uses a worked example to demonstrate tags — a simple yet powerful feature allowing a much greater degree of control over GYRE calculations.

Example Tag Usage

Consider applying gyre to calculate the eigenfrequencies of a red giant branch (RGB) stellar model. Because non-radial p-modes in the convective envelope couple with high-order g-modes in the radiative core, the frequency spacing of the non-radial modes is much smaller than that of the radial modes. In such cases, we ideally want to use a coarse frequency scan for the radial modes and a fine frequency scan for the non-radial modes.

The following input file, which is designed to work with the \(2\,\Msun\) RGB model in $GYRE_DIR/models/mesa/rgb/rgb.mesa, achieves this goal using tags:

&constants
/

&model
  model_type = 'EVOL'  ! Obtain stellar structure from an evolutionary model
  file = 'rgb.mesa'    ! File name of the evolutionary model
  file_format = 'MESA' ! File format of the evolutionary model
/

&mode
  l = 0          ! Harmonic degree
  tag = 'radial' ! Matching tag
/

&mode
  l = 1              ! Harmonic degree
  tag = 'non-radial' ! Matching tag
/

&mode
  l = 2              ! Harmonic degree
  tag = 'non-radial' ! Matching tag
/

&osc
  outer_bound = 'VACUUM' ! Assume the density vanishes at the stellar surface
/

&rot
/

&num
  diff_scheme = 'COLLOC_GL4' ! 4th-order collocation scheme for difference equations
/

&scan
  grid_type = 'LINEAR' ! Scan grid uniform in frequency
  freq_min = 41        ! Minimum frequency to scan from
  freq_max = 43        ! Maximum frequency to scan to
  freq_units = 'UHZ'   ! Frequency units
  n_freq = 10          ! Number of frequency points in scan
  tag_list = 'radial'  ! Pair only with 'radial' &mode groups
/

&scan
  grid_type = 'LINEAR' 	  ! Scan grid uniform in frequency
  freq_min = 41        	  ! Minimum frequency to scan from
  freq_max = 43           ! Maximum frequency to scan to
  freq_units = 'UHZ'      ! Frequency units
  n_freq = 100            ! Number of frequency points in scan
  tag_list = 'non-radial' ! Pair only with 'non-radial' &mode groups
/

&grid
  w_osc = 10  ! Oscillatory region weight parameter
  w_exp = 2   ! Exponential region weight parameter
  w_ctr = 100 ! Central region weight parameter
/

&ad_output
  summary_file = 'summary.h5'                  ! File name for summary file
  summary_item_list = 'l,n_pg,freq,freq_units' ! Items to appear in summary file
  freq_units = 'UHZ'                           ! Units of freq output items
/

&nad_output
/

Observe that each &mode namelist groups has a tag parameter. When processing a given &mode, gyre pairs it up with other namelist groups that match one of the following criteria:

  • The namelist group doesn’t have a tag_list parameter;

  • The namelist does have a tag_list parameter, and the parameter value (a comma-separated list) contains the tag value defined in the &mode group.

In the example given above, the &osc namelist group doesn’t have a tag_list parameter; therefore, it is paired with all three &mode namelist groups, irrespective of their tag values. However, the two &scan namelist groups each have tag_list parameters. In the first group the radial tag appears, and so this group is paired with the first &mode namelist group (i.e., the \(\ell=0\) mode). Likewise, in the second group the non-radial tag appears, and so this group is paired with the second and third &mode namelist groups (i.e., the \(\ell=1\) and \(\ell=2\) modes).

Tag Rules

In addition to the matching criteria given above, there are a couple of rules that must be obeyed by tags:

  • Tag names can’t contain commas (however, they can be otherwise arbitrary);

  • If a &mode namelist group doesn’t have a tag parameter, then only namelists without a tag_list parameter will be paired with it;

  • The &constants, &model, &ad_output and &nad_output namelist groups don’t support tags.