Exponential Integrator¶
This module implements the solution to the exponential integrator for the linear operator of the rotating shallow water equations as used by pypint.
Consider the RSWE, neglecting the nonlinear terms. We may write this as:
We may solve this via an integrating factor method, yielding:
to which we may freely apply various choices of timestepping. The exponential integrator then requires the efficient computation of the matrix exponential. We write the matrix exponential in the form:
where \(r_{k}^{\alpha}\) is a matrix containing the eigenvectors of the linear operator (for a corresponding wavenumber, k, as we are working in Fourier space) and \(\omega_{k}^{\alpha}\) is a vector containing the associated eigenvalues of the linear operator, such that:
with \(\alpha = -1, 0, 1\). This reduces the problem to an easier problem of finding the eigenvalues/eigenvectors and applying these. These are pre-computed for speed as they will not change over the course of the computation for constant gravity, rotation, and water depth.
Classes¶
-ExponentialIntegrator : Implements the exponential integrator for the RSWE
Notes¶
We write the linear operator, L, as:
which becomes, in Fourier space:
See Also¶
numpy
-
class
rswe_exponential_integrator.ExponentialIntegrator[source]¶ Implements the exponential integrator for the Rotating Shallow Water Equations.
This class implements the exponential integrator objects, which precompute and store the eigenvalues and eigenvectors of the linear operator in Fourier space and apply the matrix exponential for a given timestep when invoked. See module header for explanation of computation.
Methods
- call : Invoke the matrix exponential
- project_basis : Use the computed eigenbasis to project
-
call(U_hat, t)[source]¶ Call to invoke the exponential integrator on a given initial solution over some time.
Propagates the solution to the linear problem for some time, t, based on the initial condition, U. U is, in general, the value at the beginning of a timestep and t is the timestep, although this need not be the case.
Parameters
- U_hat : the Fourier modes of the unknown solution, ordered as below
- t : the time at which the solution is desired (or timestep to be used)
Returns
- U_hat_sp : The computed solution, propagated by time t
Notes
- Works in -t direction as well.
- Input order: v1[:,:] = U_hat[0,:,:], v2[:,:] = U_hat[1,:,:], h[:,:] = U_hat[2,:,:]
-
project_basis(U_hat, t)[source]¶ Call to invoke the exponential integrator on a given initial solution over some time.
Propagates the solution to the linear problem for some time, t, based on the initial condition, U. U is, in general, the value at the beginning of a timestep and t is the timestep, although this need not be the case.
Parameters
- U_hat : the Fourier modes of the unknown solution, ordered as below
- t : the time at which the solution is desired (or timestep to be used)
Returns
- U_hat_sp : The computed solution, propagated by time t
Notes
- Works in -t direction as well.
- Input order: v1[:,:] = U_hat[0,:,:], v2[:,:] = U_hat[1,:,:], h[:,:] = U_hat[2,:,:]
-
class
rswe_exponential_integrator.ExponentialIntegrator_FullEqs(control)[source]¶ Implements the exponential integrator for the dimensional, perturbation-height Rotating Shallow Water Equations which have been symmetrised with respect to the geopotential height.
This class implements the exponential integrator objects, which precompute and store the eigenvalues and eigenvectors of the linear operator in Fourier space and apply the matrix exponential for a given timestep when invoked. See module header for explanation of computation.
Attributes
- f0 : the Coriolis parameter
- g : the gravitational acceleration
- H0 : the mean water depth
- deriv_factor : factor of 2*pi/L due to spectral differentiation
- _Nx : Number of grid points, such that domain is Nx X Nx
- eVals : Vector of eigenvalues, ordered alpha = 0, -1, 1
- eBasis : Corresponding orthonormalised matrix of eigenvectors, arranged in columns
Methods
- create_eigenvalues : Set up the analytically-computed eigenvalues for L
- create_eigenbasis : Set up the analyticall-computed eigenbasis for L
- call : Invoke the matrix exponential
Parameters
- control : Control object containing the relevant parameters/constants for initialisation
-
create_eigenbasis(k1, k2)[source]¶ Create the eigenbasis of the linear operator. As with the eigenvalues, it is an implementation of an analytical solution.
This method computes the eigenvector matrix for a given wavenumber pair. It does not solve the eigenvalue problem, rather the analytical solution has been found for the representation of the linear operator which has been used.
Parameters
- k1, k2 : the wavenumbers in the x- and y- directions
Returns
- A : eigenvectors of L in columns, with slow mode 1st then fast waves in - and + directions
Notes
- Note that these have been found analytically and so an arbitrary L is not currently supported.
- The eigenbasis is orthonormalised
-
create_eigenvalues(k1, k2)[source]¶ Creates the eigenvalues required for the creation of the eigenbasis (of the linear operator).
This method returns the eigenvectors of the linear operator of the RSWE as formulated in spectral space. These have been found analytically to be:
\[evals = \alpha\sqrt{f_{0}^{2} + \beta^{2}gH_{0}|k|^{2}}\]where \(\beta = 2\pi/L\) and \(\alpha = 0, -1, +1\), respectively.
Parameters
- k1, k2 : the wavenumbers in the x- and y- directions
Returns
- eVals : eigenvalues for slow mode and fast waves in - and + directions, in that order
Notes
Note that these have been found analytically and so an arbitrary L is not currently supported.