# Code description

The primary reference and description for Fyris Alpha is :

Sutherland, R. S. (2010) *A new computational fluid dynamics code I: Fyris Alpha*, Astrophysics and Space Science, 327, 173 (DOI: 10.1007/s10509-010-0336-8).

A PDF copy of the paper is available: A New Computational Fluid Dynamics Code I: Fyris A (PDF, 2.3 MB)

*Fyris Alpha* is a high resolution, shock capturing, multi-phase, up-wind Godunov method hydrodynamics code, which includes a variable equation of state, and optional microphysics such as cooling, gravity and mutlitple tracer variables. *Fyris Alpha *is a successor to earlier generations of hydrodynamics codes which arose from the original work by Collella and Woodward (1984) and earlier pioneering work by van Leer (1979) on high resolution shock capturing hydrodynamics and the PPM algorithm. The Riemann solver used is a new solver, derived from the exact solver of Gottlieb and Groth (1988), which is significantly faster than previous solvers.

The* Fyris Alpha* and ZLS has been designed and written from the ground up, and is not re-write of the older FORTRAN *ppmlr* code (cf. Sutherland et al. 2003, 2007). The new design addresses some of the shortcomings of *ppmlr*, particularly in the areas of:

- redesigning to allow for more general refined resolution nested meshes
- dynamical allocation of memory resources
- code improvement and significant performance increases - to allow more microphysics to be incorporated
- greatly improved microphysics, including a variable equation of state and ionisation directly in the code
- to a lesser extent, allowing for more ease in modifying and extending the code in the future.

To address these aims, the lower level 'C' language was chosen. It offers comparable high performance (albeit with more work from the writer), a great deal more flexibility than FORTRAN, portability across many platforms, and access to a range of existing utility code and Opensource standards that made the framework easier to build.

## Fyris Alpha key features

The *Fyris Alpha *runs approximately 4 times faster than *ppmlr*, for a single grid adiabatic simulation in 3D, owing to more efficient code design, a new Riemann solver and a number of optimizations.

With the new performance, the aim was to enhance the microphysics calculations that take place in the hydrodynamic code so that the simulation output can be analysed more in terms of astrophysical observables, such as X-Ray emission, or Hα line emission. The philosophy is to take the hydro code closer to the observable domain, rather than trying to derive primitive variables from the observed quantities.

*Fyris Alpha* uses an iterative Riemann solver in a high order Lagrangian Godunov scheme to integrate the ideal Eulerian hydrodynamic system. Following earlier shock capturing methods, a Riemann solver is used to compute the states at the boundaries between cells on a grid and the solutions are used to update the grid.

The cells are defined in a standard conservative way, using the coordinates of the left and right boundaries cell and the average variable value in the cell. With a sequence of cells, the PPM algorithm uses the integral of the cells to interpolate and fit parabolae to each cell that preserve the integrals, and hence the average cell values. With the parabolae, the cell boundary left and right states are estimated by averaging the parabola over a domain determined by the strength of the cell-cell interaction. *Fyris Alpha* uses the maximum of the flow speed and the sound speeds in the cells to determine these domains.

## Riemann solver

*Fyris Alpha* has been designed to accept a range of Rieman solvers (each identified by a short codename), and all the solvers of a given system of equations (hydrodynamics here) use a standard interface, making interchange a simple matter. In addition to CW84, we have the solver from Toro (1999): TORO99, which is exact, albeit relatively slow. We also have: the Toro hybrid solver: AIRS, a two shock only version of the TORO99 iterator, TSS99, and a non-iterative primitive variable approximate solver: PVRS, also from Toro (1999). Apart from the very fast PVRS solver, the solvers from Toro (1999) are generally slower than others, but are retained for cross-checking and teaching purposes (they are well documented).

The main Riemann solver used by *Fyris Alpha* is based on the solver of Gottlieb & Groth (1988). This solver was published there as part of a review of exact solvers after development of approximate solvers of the Roe-Pike variety began to dominate, and as such is probably the last fast exact solver developed. It differs from the van Leer type in that it iterates on the velocity of the star region, rather than the pressure. This simplifies some of the transcendental functions required, increasing the speed, with a minor degree of complexity added due to the possibility of zero and differing signs in the velocity compared to the positive definite nature of the pressure. *Fyris Alpha*can use the exact solver of Gottlieb & Groth, GG88, or more commonly, a two-shock version, where we followed the Colella & Woodward example in simplifying the van Leer solver, and applied that to the GG88 solver. The resulting solver, RSS06, is an iterative two shock solver that iterates on *u_**, and is on average about twice as fast as the CW84 solver, but returns essentially identical results, making it an ideal substitute.

## Equation of State

All else being equal, *Fyris Alpha* is between 3 and 4 times faster than the earlier ppmlr code in 2D. This has allowed the incorporation of more calculations allowing for a more general equation of state. An advantage of the GG88 and RSS06 solvers is that they are formulated in a way that allows the adiabatic index to be different on each side of the boundary. ppmlr allowed for a single global mean molecular weight *\mu* and adiabatic index *\gamma*. So a given simulation was restricted to a single state: ionised (*\mu = 0.6224*,*\gamma= 5/3* ), neutral (*\mu = 1.30*, *\gamma= 5/3*), or even molecular (*\mu = 2.4*, *\gamma= 7/5*). By allowing *\mu* to vary and using a caloric equation to give temperature *T = EOS_{C}( \rho, P, \mu)*, and allowing *\gamma* to vary and using a baric equations to relate pressure *P*, internal energy *e* and *\gamma*, i.e., *P = EOS_{B}( \rho, e, \gamma)*, we pave the way to multi-phase models.

*Fyris Alpha* has a range of options, from a single *\mu* and *\gamma* as before, with fixed relationships between *(P, \rho, e, T, \mu, \gamma)*. Or to allow *\mu* and *\gamma* to be simple functions linked to the cooling function table. Tabulated as a function of temperature, internal tables are computed to allow *\mu* and *\gamma* to be determined as function of *T , P/\rho* or *e*, and so can be varied cell by cell. In the setup for each Riemann problem the effective *\gamma* is determined for the averaged left and right states.

## Cooling

*Fyris Alpha* generally computes cooling from a cooling function pre-generated for the problem as a function of temperature. When variables *\mu* and *\gamma* are in use then the table also includes ionisation fractions and the consistent values for *mu* and *gamma* at each temperature with the corresponding cooling. Cooling is computed with either an explicit 4th order stable Runge-Kutta integrator, or as an implicit multi-step eulerian integration, both of which give essentially the same results, with the default Runge-Kutta integrator being marginally faster. Cooling functions and equations of state variables \*gamma* and \*mu* are precomputed using the*MAPPINGS III* code on a case by case basis.