# About Legolas

## Origins

The development of Legolas started due to the need of a new and flexible numerical tool to solve the full system of linearised MHD equations with various physical effects included. Calculating all eigenvalues for such setups is relatively straightforward for homogeneous cases since this boils down to calculating the algebraic system of linearised equations, writing down the matrices and plugging them into your favourite eigenvalue problem solver. However, this becomes extremely difficult (or even impossible) to do for more general cases with inhomogeneous equilibria, unless some rather special conditions are applied to the system to make it analytically tractable.

Legolas actually builds on the heritage of early numerical codes, most notably LEDA (Kerner, 1985), meant for studies of ideal and resistive MHD spectra.
The original LEDA code has had several extensions over the past decades, such as LEDA2 (Van Der Linden, 1992) for non-adiabatic spectra and LEDAFLOW (Nijboer, 1997) for non-static spectra.
These codes were not mergeable however, such that a combination of for example non-adiabatic effects, flow and resistivity was not possible without a major undertaking.
This prompted us to start from scratch on a brand new, modern MHD spectral code which we named Legolas,
short for “** L**arge

**igensystem**

__E__**enerator for**

__G__**ne-dimensional p**

__O__**mas”.**

__las__Development on Legolas started late 2019 by Niels Claes as part of his PhD studies. He was joined in mid 2020 by Jordi De Jonghe, and both of them are currently maintaining and developing the code even further in close collaboration. This is all done under the supervision of Rony Keppens at the Centre for mathematical Plasma-Astrophysics at the KU Leuven, Belgium, as part of the ERC PROMINENT project.

## Aims

The main goal of Legolas is to provide a new and modern user-friendly code, making use of the most recent developments in linear algebra and theoretical (linear) MHD. This allows for detailed, high-resolution studies of the full (M)HD linear spectrum through fully realistic setups and parametric studies, including a myriad of physical effects.

## Features

Legolas is written in modern Fortran and is highly modularised. This allows for easy maintenance and makes the code ready to be extended with additional physics and modern algorithmic requirements. At the time of writing, Legolas currently supports both 3D Cartesian or cylindrical geometries with 1D variation. Various physical effects are implemented:

- background flows, allowing for non-static equilibrium conditions
- external gravity
- resistivity, either constant values or realistic temperature-dependent profiles
- optically thin radiative losses, based on modern cooling curves
- anisotropic thermal conduction, with fully customisable parallel/perpendicular effects with respect to the magnetic field
- viscosity
- Hall MHD

Note that Legolas can calculate spectra in either full MHD or in hydrodynamics (no magnetic field).