# From Stretched String to GYRE¶

The numerical technique demonstrated in the The Stretched String Problem section provides a powerful analog to how GYRE solves the oscillation equations. The full gory details of GYRE’s approach are laid out in Townsend & Teitler (2013); in this section we briefly summarize it, highlighting similarities and differences with the stretched-string problem.

## Separation¶

Similar to the stretched-string problem, GYRE begins by separating variables in space and time. For the radial displacement perturbation \(\xir\), trial solutions take the form

In addition to the same sinusoidal time dependence as in eqn. (3), an additional spherical harmonic term \(Y^{m}_{\ell}\) appears because we are separating in three (spherical) spatial coordinates rather than one.

## Discretization¶

As with the stretched-string problem, GYRE then discretizes the governing equations on a spatial grid \(\{x_{1},x_{2},\ldots,x_{N}\}\). However, a couple of important differences arise at this juncture. First, the system of oscillation equations are fourth order (sixth, in the non-adiabatic case). Rather than employing finite-difference approximations to high-order differential operators, GYRE instead decomposes the problem into set of coupled first-order equations. This set is written generically as

where \(\vty\) is a vector of \(\neq\) dependent variables, and \(\mA\) is a \(\neq \times \neq\) Jacobian matrix. In the adiabatic case, \(\neq=4\); in the non-adiabatic case, \(\neq=6\).

Second, while this equation could be discretized using a simple
finite-difference approximation to the left-hand side, GYRE offers
more-sophisticated approaches with higher orders of accuracy. These
include the Magnus schemes described in Townsend & Teitler (2013),
and implicit Runge-Kutta schemes mentioned in
Townsend et al. (2018). The choice of scheme is set by the
`diff_scheme`

parameter of the `&num`

namelist
group. The discretization leads to difference equations of the form

relating the dependent variable vector at adjacent grid points. The \(\neq \times \neq\) fundamental solution matrix \(\mY_{k+1,k}\) is evaluated from the value(s) of \(\mA\) within the interval \([x_{k},x_{k+1}]\) using the discretization scheme.

There are \(N-1\) of these sets of difference equations. They are augmented with the boundary conditions

where \(\subin{\mB}\) is a \(\nin \times \neq\) matrix representing the \(\nin\) inner boundary conditions, and \(\subout{\mB}\) is a \(\nout \times \neq\) matrix representing the outer boundary conditions (note that \(\nin + \nout = \neq\)). Together, the difference equations and boundary conditions comprise a linear system of \(\neq\,N\) algebraic equations and \(\neq N\) unknowns.

## Linear System¶

The linear system can be written in the same form (4) as with the stretched-string problem. However, now \(\vu\) is the vector with components

and the system matrix \(\mS\) is an \(\neq N \times \neq N\) block-staircase matrix with components

As before, the linear system (4) has non-trivial solutions only when the determinant of \(\mS\) vanishes. Thus, GYRE finds eigenvalues of the oscillation equation by solving the characteristic equation

where the dimensionless frequency

is the product of the star’s dynamical timescale and the oscillation frequency \(\sigma\). (Internally, GYRE works extensively with such dimensionless quantities, as it improves the stability of the numerical algorithms).

## Scanning for Eigenfrequencies¶

In the adiabatic case, GYRE searches for roots of the discriminant function \(\Dfunc\) using the same bracketing and refinement strategies as the stretched-string problem.

In the non-adiabatic case, a complication is that the discriminant function and the dimensionless frequency are both complex quantities. Solving the characteristic equation in the complex plane is computationally challenging because there is no equivalent to bracketing and refinement. GYRE implements a couple of different approaches to the problem, as discussed in the Non-Adiabatic Calculations chapter.