InternalModes
Create vertical-mode solvers from gridded or analytical stratification.
Declaration
classdef InternalModes < handleOverview
InternalModes is the user-facing wrapper around the concrete
solver classes. It initializes one of the numerical, analytical, or
asymptotic implementations, then forwards the common public
interface for requesting \(F_j(z)\), \(G_j(z)\), \(h_j\), SQG modes, and
background-stratification diagnostics.
The wrapper follows the vertical eigenvalue problems described in Section 2.3 of Early, Lelong, and Smith (2020):
\[\partial_{zz} G_j = -\frac{N^2 - \omega^2}{g h_j} G_j\]for fixed \(\omega\), and
\[\partial_{zz} G_j - K^2 G_j = -\frac{N^2 - f_0^2}{g h_j} G_j\]for fixed \(K\).
The primary construction path is either:
- gridded density:
InternalModes(rho, zIn, zOut, latitude, ...) - analytical density or
N2:InternalModes(rhoOrN2, [zBottom 0], zOut, latitude, ...)
The wrapper also supports built-in benchmark profiles through the shorthand
im = InternalModes("constant", "wkbAdaptiveSpectral", 128);
and exposes quick comparison figures for those benchmark cases.
im = InternalModes(rho, zIn, zOut, latitude, "method", "wkbAdaptiveSpectral");
[F, G, h, omega] = im.modesAtWavenumber(2*pi/1000);
psi = im.surfaceModesAtWavenumber(2*pi/1000);
Topics
- Create and initialize modes
InternalModesInitialize the wrapper from a profile or a built-in benchmark case.methodName of the selected concrete solver implementation.
- Inspect grids and stratification
LzTotal water-column depth.N2Buoyancy frequency squared sampled onzOut.N2FunctionFunction handle for the benchmark buoyancy-frequency profile \(N^2(z)\).f0Coriolis parameter at the selected latitude.latitudein degrees used to computef0.rhoBackground density sampled onzOut.rho0Reference surface density.rhoFunctionFunction handle for the benchmark density profile \(\bar{\rho}(z)\).rho_zFirst depth derivative of the background density sampled onzOut.rho_zzSecond depth derivative of the background density sampled onzOut.zOutput depth grid on which public profiles and modes are returned.
- Configure normalization and boundaries
lowerBoundaryLower boundary condition at the ocean bottom.normalizationMode normalization convention.upperBoundaryUpper boundary condition at the ocean surface.
- Compute modes
bottomModesAtWavenumberReturn the bottom SQG mode at fixed horizontal wavenumber.modesAtFrequencyReturn vertical modes for a fixed frequency.modesAtWavenumberReturn vertical modes for a fixed horizontal wavenumber.nModesOptional cap on the number of modes returned.projectOntoGModesAtWavenumberProject a profile onto theGmodes at fixed horizontal wavenumber.showLowestModesAtFrequencyPlot the lowest resolved modes at a fixed frequency.showLowestModesAtWavenumberPlot the lowest resolved modes at a fixed horizontal wavenumber.surfaceModesAtWavenumberReturn the surface SQG mode at fixed horizontal wavenumber.
- Inspect analytical solutions
ConditionNumberAsFunctionOfModeNumberCompute condition number as a function of retained mode count.NumberOfWellConditionedModesEstimate how many columns of a mode matrix remain numerically well conditioned.RenormalizeForGoodConditioningRenormalize a mode matrix by matching column norms to a common scale.StratificationProfileWithNameReturn one of the built-in benchmark stratification profiles.showRelativeErrorAtFrequencyPlot benchmark relative errors for a built-in profile at fixed \(\omega\).showRelativeErrorAtWavenumberPlot benchmark relative errors for a built-in profile at fixed \(K\).stratificationName of the active built-in benchmark stratification profile.
Developer Topics
These items document internal implementation details and are not part of the primary public API.
- Developer topics
ConditionNumberAsFunctionOfModeNumberForModeIndicesCompute mode-matrix condition numbers for selected truncation indices.ProfileWithDoubleExponentialPlusPycnoclineBuild a two-exponential pycnocline profile used by the built-in benchmarks.ProfileWithDoubleGaussianExponentialPlusPycnoclineBuild a mixed Gaussian-exponential pycnocline profile used by the built-in benchmarks.ProfileWithDoubleGaussianPlusPycnoclineBuild a double-Gaussian pycnocline profile used by the built-in benchmarks.internalModesConcrete solver instance created by the wrapper.isRunningTestCaseFlag indicating whether the wrapper was initialized from a built-in benchmark case.shouldShowDiagnosticsToggle diagnostic messages from the concrete solver.