Contents Menu Expand Light mode Dark mode Auto light/dark, in light mode Auto light/dark, in dark mode Skip to content
Gkeyll 1.0 documentation
Light Logo Dark Logo
Gkeyll 1.0 documentation
  • Installing \(\texttt{Gkeyll}\)
  • \(\texttt{Gkeyll}\) Quick Start Guide
  • Publications and theses
  • Presentations
  • Developer notes
    • On Developing and Contributing Code to Gkeyll Ecosystem
    • Suggested templates for issues and pull requests to Gkeyll
    • On use of the Maxima CAS
    • Modal basis functions
    • The recovery Maxima code
    • Strong-Stability preserving Runge-Kutta time-steppers
    • Normalized units for the Vlasov-Maxwell system
    • From normalized to physical units in Vlasov and multi-fluid simulations
    • The eigensystem of the Maxwell equations with extension to perfectly hyperbolic Maxwell equations
    • The eigensystem of the Euler equations
    • The eigensystem of the ten-moment equations
    • Handling two-fluid five-moment and ten-moment source terms
    • Time step calculation in Gkeyll
    • On Utlilizing The Built-In Debugger For Lua
    • The equations of general relativistic hydrodynamics (GRHD) in Gkeyll
    • The eigensystem of the general relativistic hydrodynamics (GRHD) equations
    • Black hole spacetimes in Gkeyll
    • Relativistic primitive variable reconstruction in Gkeyll
    • Tokamak Topology
    • How to run Valgrind on Gkeyll
Back to top
View this page

Modal basis functions¶

Each of the kinetic equations Gkeyll’s solvers discretize using the discontinuous Galerkin algorithm—the Vlasov equation, the gyrokinetic equation, and the PKPM system—all benefit from utilizing polynomials for the basis in the underlying solution space. There is enormous freedom for the specific form of the polynomials, and Gkeyll benefits from a specific class of orthonormal modal basis functions for representing the discrete distribution function and other variables of interest.

These basis functions are defined on a d-dimensional hypercube \(I_d = [-1,1]^d\). Let \(\psi_k(\mathbf{x})\), \(k=1,\ldots,N\), with \(\psi_1\) a constant, be the basis. Then the basis satisfy

\[\langle \psi_k \psi_m \rangle = \delta_{km}\]

where the angle brackets indicate integration over the hypercube \(I_d\). In this note we describe some common operations that are needed while working with these basis sets.

Contents

  • Modal basis functions

    • Pre-computed basis functions

    • Computing cell averages

    • Convolution of two functions

Pre-computed basis functions¶

Precomputed modal basis sets on phase-space for 1x1v, 1x2v, 1x3v, 2x2v, 2x3v, 3x2v, and 3x3v phase-space are stored as Lisp files in gkyl/cas-scripts/basis-precalc directory. Both maximal-order and serendipity basis sets are computed for polynomial orders 1, 2, 3 and 4. Computing orthonormal basis set in higher dimensions is time-consuming and so these pre-computed lisp files should be used. For example:

load("basis-precalc/basisSer2x3v")

will load the serendipity basis sets in 2x3v phase-space.

NOTE: please read Maxima notes to get this command to work.

The files define the following Maxima variables:

varsC, varsP, basisC, basisP

The varsC are the configuration-space independent variables (\(x,y\) in 2X) and varsP are the phase-space independent variables (\(x,y,vx,vy,vz\) in 2X3V). The i-th entry in the list basisC and basisP contain the basis sets of polynomial order \(i\). Hence, to access the phase-space basis for \(p=2\) do something like:

basisP2 : basisP[2].

Computing cell averages¶

Consider some function that is expanded in the basis:

\[f(\mathbf{x}) = \sum_k f_k \psi_k\big(\boldsymbol{\eta}(\mathbf{x})\big)\]

where \(\boldsymbol{\eta}(\mathbf{x})\) maps the physical space to logical space. Then, the cell-average is defined as

\[\overline{f} = \frac{1}{2^d} \langle f \rangle = \frac{1}{2^d} f_1\psi_1 \langle 1 \rangle = f_1\psi_1.\]

where \(\psi_1\) is constant. By orthonormality we have \(\langle \psi_1^2 \rangle = 1\) which indicates that

\[\psi_1 = \frac{1}{\sqrt{2^d}}.\]

This means that the cell-average is given by

\[\overline{f} = \frac{f_1}{\sqrt{2^d}}\]

Convolution of two functions¶

Now consider two functions, \(f\) and \(g\) that are both expanded in the basis. The inner product of the two functions is:

\[\overline{f g} = \frac{1}{2^d} \langle f g \rangle\]

Note the the bar on the LHS, i.e. this expression gives the average of the inner product on a single cell. Now, as the basis functions are orthonormal, this leads to the particularly simple expression

\[\overline{f g} = \frac{1}{2^d} \sum_k f_k g_k\]

This makes it very easy to compute things like electromagnetic energy, and other quadratic quantities.

Next
The recovery Maxima code
Previous
On use of the Maxima CAS
Copyright © 2016-2025, Gkeyll Team
Made with Sphinx and @pradyunsg's Furo
On this page
  • Modal basis functions
    • Pre-computed basis functions
    • Computing cell averages
    • Convolution of two functions