# Wiki

# gyre / Understanding Grids

Contents

## Overview

To get the best out of GYRE, it's important to understand how the spatial and frequency grids are constructed, and how their choice can affect results.

## Spatial Grid

GYRE solves the pulsation equations on a spatial grid --- a set of discrete points spanning some range of values \([x_{\rm i},x_{\rm o}]\) in the dimensionless radial coordinate \(x=r/R_{*}\). This grid must be fine enough to adequately resolve the wavefunctions of the pulsation modes being sought; but this requirement must be balanced by the fact that the computation time scales (approximately linearly) with the number of points in the grid.

By default the spatial grid is based on the underlying model grid. This is usually adequate for modes with low radial orders (i.e., the fundamental mode and first few overtones), since these modes' wavefunctions are slowly varying functions of \(x\). However, for high-order p- and g-modes, the wavefunctions can vary rapidly with \(x\) and it is necessary to refine the model grid. The refinement is controlled by the `&grid`

namelist group in the namelist input file.

### Adding Points Near Center

The first step during refinement involves adding points near the center of the star, under the control of the `n_inner`

parameter in the `&grid`

namelist. GYRE locates the inner turning point \(x_{\rm turn}\), where wavefunctions transition from oscillatory to evanescent, and calculates a target grid spacing

GYRE then adds points within the interval \([x_{\rm i},x_{\rm turn}]\) to ensure that the resulting grid spacing \(\Delta x\) is less than or equal to \(\Delta x_{\rm targ}\).

An important wrinkle in this process is that \(x_{\rm turn}\) depends on the oscillation frequency \(\omega\), which isn't known *a priori*. Therefore, GYRE evaluates \(x_{\rm turn}\) at each of the frequencies in the frequency grid. When evaluating the above expression for the target grid spacing, it uses \(\min(x_{\rm turn})\); but when establishing the interval in which to add points, it uses \(\max(x_{\rm turn})\).

### Adding Points Throughout Star

The next step during refinement is to add points throughout the star, under the control of the `alpha`

parameters. Each of these parameters governs the evaluation of a corresponding target grid spacing \(\Delta x_{\rm targ}\) across the grid. For the `alpha_osc`

and `alpha_exp`

parameters, the target grid spacings are evaluated from the real and imaginary parts of the local radial wavenumber \(k_{r}\), as

For the `alpha_thm`

parameter, the target grid spacing is evaluated from the local thermal wavenumber \(\tau\), as

Finally, for the `alpha_str`

parameter, the target grid spacing is evaluated from the maximal relative jump \(J = \Delta f/f\) in any of the five adiabatic structure variables (\(V_2,A^{*},U,c_{1},\Gamma_{1}\)), as

Once these target grid spacings have been evaluated, GYRE calculates the overall target grid spacing as

and then add points within the interval \([x_{\rm i},x_{\rm o}]\) to ensure that the resulting grid spacing is less than or equal to \(x_{\rm targ}\).

This whole process is repeated until there are no more points to be added, or the number of iterations exceeds the `n_iter_max`

parameter. Since \(\operatorname{Re}(k_{r})\), \(\operatorname{Im}(k_{r})\) and \(\tau\) depend on the oscillation frequency, the corresponding maxima (over all frequencies in the frequency grid) are used when evaluating \(\Delta x_{\rm targ,osc}\), \(\Delta x_{\rm targ,exp}\) and \(\Delta x_{\rm targ,thm}\), respectively.

### General Guidelines

Lest the forgeoing exposition be too complex, here is a good general-purpose choice for the `&grid`

namelist group:

&grid n_inner = 5 alpha_osc = 10 alpha_exp = 2 /

Updated