# Spatial Grids

The various GYRE frontends all discretize their equations on a spatial grid $$\{x_{1},x_{2},\ldots,x_{N}\}$$ in the dimensionless radial coordinate $$x \equiv r/R$$. The computational cost of a calculation scales with the total number of points $$N$$ in this grid, while the grid’s resolution — i.e., the spacing between adjacent points — impacts both the accuracy of solutions, and in the case of the gyre frontend, the number of solutions that can be found. (The Limitations of the Numerical Method section discusses these behaviors in the context of the stretched string BVP).

## Scaffold Grid

A fresh spatial grid is constructed for each iteration of the main computation loop (see the flow-charts in the Frontends chapter). This is done under the control of the &grid namelist groups; there must be at least one of these, subject to the tag matching rules (see the Working With Tags chapter). If there is more than one matching &grid namelist group, then the final one is used.

Each grid begins as a scaffold grid, comprising the following points:

• an inner point $$\xin$$;

• an outer point $$\xout$$;

• the subset of points of the source grid satisfying $$\xin < x < \xout$$

The source grid can be either the input model grid, or a grid read from file; this choice is determined by the scaffold_src parameter of the &grid namelist group. By default, $$\xin$$ and $$\xout$$ are obtained from the source grid as well (as its inner-most and outer-most point). However, either or both can be overridden using the x_i and x_o parameters.

## Iterative Refinement

Scaffold grids are refined via a sequence of iterations. During a given iteration, each subinterval $$[x_{j},x_{j+1}]$$ is assessed against various criteria (discussed in greater detail below). If any criteria match, then the subinterval is refined by bisection, inserting an additional point at the midpoint

$x_{j+\half} = \frac{x_{j} + x_{j+1}}{2}.$

The sequence terminates if no refinements occur during a given iteration, or if the number of completed iterations equals the value specified by the n_iter_max parameter of the &grid namelist group.

### Mechanical Criterion

The wave criterion involves a local analysis of the mechanical parts of the oscillation equations, with the goal of improving resolution where the displacement perturbation $$\vxi$$ is rapidly varying. Within the subinterval $$[x_{j},x_{j+1}]$$, the $$y_{1}$$ and $$y_{2}$$ solutions (see the Dimensionless Formulation section) take the approximate form

$y_{1,2}(x) \sim \exp [ \chi \, (\ln x - \ln x_{j+\half}) ],$

where $$\chi$$ is one of the two eigenvalues of the mechanical (upper-left) $$2 \times 2$$ submatrix of the full Jacobian matrix $$\mA$$, evaluated at the midpoint $$x_{j+\half}$$.

In propagation zones the imaginary part $$\chi_{\rm i}$$ of the eigenvalue gives the local wavenumber in $$\ln x$$ space, and $$2\pi \chi_{\rm i}^{-1}$$ the corresponding wavelength; while in evanescent zones the real part $$\chi_{\rm r}$$ gives the local exponential growth/decay rate, and $$\chi_{\rm r}^{-1}$$ the corresponding e-folding length.

Based on this analysis, the criterion for refinement of the subinterval is

$( \ln x_{j+1} - \ln x_{j} ) \, \max (\wosc |\chi_{\rm i}|, \wexp |\chi_{\rm r}|) > 2 \pi,$

where $$\wosc$$ and $$\wexp$$ are user-definable weighting parameters. This causes refinement if the subinterval width (in $$\ln x$$ space) exceeds $$\wosc^{-1}$$ times the local wavelength, or $$2\pi \wexp^{-1}$$ times the local e-folding length.

Because there are two possible values for $$\chi$$, the above refinement criterion is applied twice (once for each). Moreover, because $$\chi$$ depends implicitly on the oscillation frequency, the criterion is applied for each frequency in the grid $$\{\omega_{1},\omega_{2},\ldots,\omega_{M}\}$$ (see the Frequency Grids section).

### Thermal Criterion

Similar to the wave criterion discussed above, the thermal criterion involves a local analysis of the energetic parts of the oscillation equation, with the goal of improving resolution where the thermal timescale is very long and perturbations are almost adiabatic. Within the subinterval $$[x_{j},x_{j+1}]$$, the $$y_{5}$$ and $$y_{6}$$ perturbation take the approximate form

$y_{5,6}(x) \sim \exp [ \pm \tau \, (\ln x - \ln x_{j+\half}) ],$

where $$\pm\tau$$ are the eigenvalues of the matrix formed from the energetic (bottom-right) $$2 \times 2$$ submatrix of the full Jacobian matrix $$\mA$$, evaluated at the midpoint $$x_{j+\half}$$.

Based on this analysis, the criterion for refinement of the subinterval is

$( \ln x_{j+1} - \ln x_{j} ) \, \wthm |\tau| > 1,$

where $$\wthm$$ is a user-definable weighting parameter.

Because $$\tau$$ depends implicitly on the oscillation frequency, this criterion is applied for each frequency in the grid $$\{\omega_{1},\omega_{2},\ldots,\omega_{M}\}$$.

### Structural Criteria

The structural criteria have the goal of improving resolution where the stellar structure coefficients are changing rapidly. For a given coefficient $$C$$, the criterion for refinement of the subinterval $$[x_{j},x_{j+1}]$$ is

$( \ln x_{j+1} - \ln x_{j} ) \, \wstr \left| \pderiv{\ln C}{\ln x} \right| > 1,$

where $$\wstr$$ is a user-definable weighting parameter. This criterion is applied separately to the $$V_2 \equiv V/x^{2}$$, $$U$$, $$A^{*}$$, $$c_{1}$$ and $$\Gamma_{1}$$ coefficients (see the Structure Coefficients section).

### Central Criteria

All of the above criteria depend on the logarithmic subinterval width $$(\ln x_{j+1} - \ln x_{j})$$, and cannot be applied to the first subinterval $$[x_{1},x_{2}]$$ if it extends to the center of the star, $$x = 0$$. In such cases, the resolve_ctr parameter of the &grid namelist group determines whether the subinterval is refined. If set to .FALSE., then no refinement occurs; while if set to .TRUE., then the refinement criteria are

$\chi_{\rm i} > 0$

or

$w_{\rm ctr} | \chi_{\rm r} | > 1$

where $$\chi$$ is the eigenvalue from the local analysis (see the Mechanical Criterion section) corresponding to the solution that remains well-behaved at the origin, and $$w_{\rm ctr}$$ is a user-definable weighting parameter. The first criterion causes refinement if the subinterval is in a propagation zone, and the second if the solution slope $$|\sderiv{y}{\ln x}| \sim |\chi_{\rm r}|$$ exceeds $$w_{\rm ctr}^{-1}$$.

Because $$\chi$$ depends implicitly on the oscillation frequency, these criteria are applied for each frequency in the grid $$\{\omega_{1},\omega_{2},\ldots,\omega_{M}\}$$.

## Limiting Controls

A couple of additional controls affect the iterative refinement described above. Refinement of the $$[x_{j},x_{j+1}]$$ subinterval always occurs if

$x_{j+1} - x_{j} > \Delta x_{\rm max},$

and never occurs if

$x_{j+1} - x_{j} < \Delta x_{\rm min},$

where both $$\Delta x_{\rm max}$$ and $$\Delta x_{\rm min}$$ are user-definable.

## Namelist Parameters

The full set of parameters supported by the &grid namelist group is listed in the Grid Parameters section. However, the table below summarizes the mapping between the user-definable controls appearing in the expressions above, and the corresponding namelist parameters.

Symbol

Parameter

$$\wosc$$

w_osc

$$\wexp$$

w_exp

$$\wthm$$

w_thm

$$\wstr$$

w_str

$$\wctr$$

w_ctr

$$\Delta x_{\rm max}$$

dx_max

$$\Delta x_{\rm min}$$

dx_min