InternalModesFiniteDifference
Solve the vertical eigenvalue problems with finite-difference matrices.
Declaration
classdef InternalModesFiniteDifference < InternalModesBaseOverview
InternalModesFiniteDifference discretizes the fixed-\(K\) and
fixed-\(\omega\) eigenvalue problems directly on the supplied depth
grid. It uses arbitrary-order finite-difference stencils generated
from the Fornberg weights algorithm and optionally interpolates the
resulting modes onto a separate output grid.
This class is mainly useful as a baseline against the spectral methods discussed in Section 3 of Early, Lelong, and Smith (2020), where the manuscript explains why finite differencing becomes less attractive when many frequencies or wavenumbers are required.
im = InternalModesFiniteDifference(rho=rho, zIn=zIn, zOut=zOut, latitude=latitude, orderOfAccuracy=4);
[F, G, h, omega] = im.modesAtWavenumber(2*pi/1000);
Topics
- Create and initialize modes
InternalModesFiniteDifferenceInitialize the finite-difference solver.orderOfAccuracyFormal order of accuracy for the finite-difference stencils.
- Compute modes
bottomModesAtWavenumberReturn the bottom SQG mode at fixed horizontal wavenumber.boundaryModesAtWavenumberReturn either the surface or bottom SQG mode at fixed horizontal wavenumber.surfaceModesAtWavenumberReturn the surface SQG mode at fixed horizontal wavenumber.
Developer Topics
These items document internal implementation details and are not part of the primary public API.
- Developer topics
ApplyBoundaryConditionsApply the current lower and upper boundary conditions to an EVP pair.Diff1First-derivative finite-difference matrix.Diff2Second-derivative finite-difference matrix.FiniteDifferenceMatrixBuild a finite-difference differentiation matrix with boundary stencils.InitializeOutputTransformationPrepare the interpolation from the differentiation grid to the public output grid.ModesFromGEPSolve a generalized EVP and map its modes onto the public grid.N2_z_diffBuoyancy frequency squared sampled onz_diff.NormalizeModesNormalize finite-difference modes using the active convention.T_outTransformation fromz_difffunctions to the public output grid.nNumber of differentiation-grid points.rho_z_diffBackground density sampled onz_diff.weightsReturn Fornberg finite-difference weights for one stencil location.z_diffDepth grid used for differentiation and the generalized EVP.