Nektar++: Spectral/hp Element Framework

Version 4.0.0

User Guide

December 1, 2015

Department of Aeronautics, Imperial College London, UK Scientific Computing and Imaging Institute, University of Utah, USA ii Contents

Introduction iv

I Getting Started1

1 Installation2 1.1 Installing Debian/Ubuntu Packages...... 2 1.2 Installing Redhat/Fedora Packages...... 3 1.3 Installing from Source...... 3 1.3.1 Obtaining the source code...... 3 1.3.2 Linux...... 4 1.3.3 OSX...... 6 1.3.4 Windows...... 8 1.3.5 CMake Option Reference...... 12

2 Mathematical Formulation 15 2.1 Background...... 15 2.2 Methods overview...... 16 2.2.1 The finite element method (FEM)...... 16 2.2.2 High-order finite element methods...... 16 2.2.3 The Galerkin formulation...... 18

II Applications and Utilities 20

3 ADRSolver 21 3.1 Synopsis...... 21 3.2 Usage...... 21 3.3 Session file configuration...... 22 3.3.1 Solver Info...... 22 3.3.2 Parameters...... 23

iii iv Contents

3.3.3 Functions...... 23 3.4 Examples...... 23 3.4.1 1D Advection equation...... 23 3.4.2 2D Helmholtz Problem...... 25 3.4.3 Advection dominated mass transport in a pipe...... 27

4 Acoustic Perturbation Equations Solver 32 4.1 Synopsis...... 32 4.2 Usage...... 32 4.3 Session file configuration...... 33 4.3.1 Solver Info...... 33 4.3.2 Parameters...... 33 4.3.3 Functions...... 33 4.4 Examples...... 33 4.4.1 Aeroacoustic Wave Propagation...... 33

5 Cardiac Electrophysiology Solver 37 5.1 Synopsis...... 37 5.1.1 Bidomain Model...... 37 5.1.2 Monodomain Model...... 37 5.1.3 Cell Models...... 38 5.2 Usage...... 38 5.3 Session file configuration...... 38 5.3.1 Solver Info...... 38 5.3.2 Parameters...... 39 5.3.3 Functions...... 40 5.3.4 Filters...... 40 5.3.5 Stimuli...... 41

6 Compressible Flow Solver 43 6.1 Synopsis...... 43 6.1.1 Euler equations...... 43 6.1.2 Compressible Navier-Stokes equations...... 44 6.1.3 Numerical discretisation...... 44 6.2 Usage...... 45 6.3 Session file configuration...... 45 6.4 Examples...... 50 6.4.1 Shock capturing...... 50 6.4.2 Variable polynomial order...... 52

7 Incompressible Navier-Stokes Solver 54 7.1 Synopsis...... 54 7.1.1 Velocity Correction Scheme...... 54 7.1.2 Direct solver (coupled approach)...... 56 7.1.3 Linear Stability Analysis...... 57 Contents v

7.2 Usage...... 60 7.3 Session file configuration...... 60 7.3.1 Solver Info...... 60 7.3.2 Parameters...... 63 7.4 Stability analysis Session file configuration...... 63 7.4.1 Solver Info...... 64 7.4.2 Parameters...... 65 7.4.3 Functions...... 65 7.5 Examples...... 65 7.5.1 Kovasznay Flow 2D...... 65 7.5.2 Steady Kovasznay Oseen Flow using the direct solver...... 68 7.5.3 Laminar Channel Flow 2D...... 69 7.5.4 Laminar Channel Flow 3D...... 70 7.5.5 Laminar Channel Flow Quasi-3D...... 72 7.5.6 Turbulent Channel Flow...... 74 7.5.7 Turbulent Pipe Flow...... 77 7.5.8 Aortic Blood Flow...... 78 7.5.9 2D direct stability analysis of the channel flow...... 81 7.5.10 2D adjoint stability analysis of the channel flow...... 86 7.5.11 2D Transient Growth analysis of a flow past a backward-facing step 88 7.5.12 BiGlobal Floquet analysis of a of flow past a cylinder...... 92

8 Pulse Wave Solver 97 8.1 Synopsis...... 97 8.2 Usage...... 98 8.3 Session file configuration...... 98 8.3.1 Pulse Wave Sovler mesh connectivity...... 98 8.3.2 Session Info...... 100 8.3.3 Parameters...... 100 8.3.4 Boundary conditions...... 101 8.3.5 Functions...... 102 8.4 Examples...... 102 8.4.1 Human Vascular Network...... 102 8.4.2 Stented Artery...... 107 8.4.3 Stented Artery...... 107 8.5 Further Information...... 111 8.6 Future Development...... 112

9 Shallow Water Solver 113 9.1 Synopsis...... 113 9.1.1 The Shallow Water Equations...... 113 9.2 Usage...... 114 9.3 Session file configuration...... 114 9.3.1 Solver Info...... 114 9.3.2 Parameters...... 114 vi Contents

9.3.3 Functions...... 114 9.4 Examples...... 114 9.4.1 Rossby modon case...... 114

10 Utilities for Pre- and Post-Processing 117 10.1 MeshConvert...... 117 10.1.1 Exporting a mesh from Gmsh...... 117 10.1.2 Defining physical surfaces and volumes...... 118 10.1.3 Converting the MSH to Nektar++ format...... 118 10.1.4 MeshConvert modules...... 119 10.2 Field Convert...... 122 10.2.1 Calculating vorticity...... 122 10.2.2 Sub-range of the domain...... 122 10.2.3 Extracting a boundary region...... 123 10.2.4 Interpolating one filed to another...... 124 10.2.5 Interpolating a field to a series of points...... 124 10.2.6 Running in parallel...... 125 10.2.7 Processing large files...... 125

IIIReference 127

11 XML Input File Reference 128 11.1 Geometry...... 128 11.1.1 Vertices...... 129 11.1.2 Edges...... 129 11.1.3 Faces...... 129 11.1.4 Element...... 130 11.1.5 Curved Edges and Faces...... 130 11.1.6 Composites...... 131 11.1.7 Domain...... 131 11.2 Expansions...... 131 11.3 Conditions...... 131 11.3.1 Parameters...... 132 11.3.2 Solver Information...... 132 11.3.3 Variables...... 132 11.3.4 Global System Solution Information...... 132 11.3.5 Boundary Regions and Conditions...... 133 11.3.6 Functions...... 135 11.3.7 Quasi-3D approach...... 135

12 Optimisation 138 12.1 Operator evaluation strategies...... 138 12.1.1 Selecting an operator strategy...... 139 12.1.2 XML syntax...... 139 Contents vii

12.1.3 Selecting different operator strategies...... 140

13 Command-line Options 141

14 Frequently Asked Questions 143 14.1 Compilation and Testing...... 143 14.2 Usage...... 144 Introduction

Nektar++ is a tensor product based finite element package designed to allow one to construct efficient classical low polynomial order h-type solvers (where h is the size of the finite element) as well as higher p-order piecewise polynomial order solvers. The framework currently has the following capabilities:

• Representation of one, two and three-dimensional fields as a collection of piecewise continuous or discontinuous polynomial domains.

• Segment, plane and volume domains are permissible, as well as domains representing curves and surfaces (dimensionally-embedded domains).

• Hybrid shaped elements, i.e triangles and quadrilaterals or tetrahedra, prisms and hexahedra.

• Both hierarchical and nodal expansion bases.

• Continuous or discontinuous Galerkin operators.

• Cross platform support for Linux, Mac OS X and Windows.

The framework comes with a number of solvers and also allows one to construct a variety of new solvers.

Our current goals are to develop:

• Automatic auto-tuning of optimal operator implementations based upon not only h and p but also hardware considerations and mesh connectivity.

• Temporal and spatial adaption.

• Features enabling evaluation of high-order meshing techniques.

viii Part I

Getting Started

1 Chapter 1

Installation

Nektar++ is available in both a source-code distribution and a number of pre-compiled binary packages for a number of operating systems. We recommend using the pre- compiled packages if you wish to use existing Nektar++ solvers for simulation and do not need to perform additional code development.

1.1 Installing Debian/Ubuntu Packages

Binary packages are available for current Debian/Ubuntu based Linux distributions. These can be installed through the use of standard system package management utilities, such as Apt, if administrative access is available.

1. Add the appropriate line for the Debian-based distribution to the end of the file /etc/apt/sources.list

Distribution Repository Debian 7.0 (wheezy) deb http://www.nektar.info/debian wheezy contrib Ubuntu 14.04 (trusty) deb http://www.nektar.info/ubuntu trusty contrib

2. Update the package lists

apt-get update

3. Install the required Nektar++ packages:

apt-get install nektar++

Any additional dependencies required for Nektar++ to function will be automati- cally installed.

2 1.2 Installing Redhat/Fedora Packages 3

Tip Nektar++ is s