WVTransform
Represents the state of the ocean in terms of energetically orthogonal wave and geostrophic (vortex) solutions
Declaration
classdef WVTransform < handle
Overview
The WVTransform subclasses encapsulate data representing the state of the ocean at a given instant in time. What makes the WVTransform subclasses special is that the state of the ocean is represented as energetically independent waves and geostrophic motions (vortices). These classes can be queried for any ocean state variable including \(u\), \(v\), \(w\), \(\rho\), \(p\), but also Ertel PV, relative vorticity, or custom defined state variables.
The WVTransform is an abstract class and as such you must instatiate one of the concrete subclasses,
WVTransformConstantStratification
WVTransformHydrostatic
WVTransformSingleMode
Topics
- Initialization
waveVortexTransformFromFile
Initialize a WVTransform instance from an existing filewaveVortexTransformWithDoubleResolution
create a new WVTransform with double resolution
- Domain attributes
Omega
frequency of oscillation of the linear wavesf
Coriolis parameterg
gravity of EarthinertialPeriod
inertial periodisBarotropic
Boolean indicating whether there is a single (equivalent barotropic) modelatitude
central latitude of the simulationrho0
density of \(\rho_\textrm{nm}\) at the surface (z=0)t
time coordinatet0
reference time of Ap, Am, A0- Grid
shouldAntialias
whether antialiasing is enabled- Spectral
J
j-coordinate matrixK
k-coordinate matrixKh
horizontal wavenumber, \(Kh=\sqrt(K^2+L^2)\)L
l-coordinate matrixNj
points in the j-coordinate,length(z)
Nkl
points in the kl-coordinate,length(k)
j
vertical mode numberk
wavenumber coordinate in the x-directionkRadial
isotropic wavenumber dimensionkljGrid
returns the K, L, J coordinate matricesl
wavenumber coordinate in the y-directionspectralMatrixSize
returns the size of any spectral matrix, e.g., Ap, Am, A0
- Spatial
x
x coordinatey
y coordinatez
z coordinateLx
domain size in the x-directionLy
domain size in the y-directionLz
domain size in the z-directionNx
points in the x-coordinate,length(x)
Ny
points in the y-coordinate,length(y)
Nz
points in the z-coordinate,length(z)
X
x-coordinate matrixY
y-coordinate matrixZ
z-coordinate matrixspatialMatrixSize
returns the size of all real-valued field variablesxyzGrid
returns the X, Y, Z coordinate matrices
- Wave-vortex coefficients
- Initial Conditions
addRandomFlow
add randomized flow to the existing stateaddUVEta
add \((u,v,\eta)\) to the existing valuesinitFromNetCDFFile
initialize the flow from a NetCDF fileinitWithRandomFlow
initialize with a random flow stateinitWithUVEta
initialize with fluid variables \((u,v,\eta)\)initWithUVRho
initialize with fluid variables \((u,v,\rho)\)- Waves
removeAll
removes all energy from the model
- Energetics
summarizeEnergyContent
displays a summary of the energy content of the fluidsummarizeModeEnergy
List the most energetic modes- Multiplicative factors
A0_TE_factor
multiplicative factor that multiplies \(A_0^2\) to compute total energy.Apm_TE_factor
multiplicative factor that multiplies \(A_\pm^2\) to compute total energy.
- Wave-vortex sorting matrix
- inverse components (\(S^{-1}\))
A0N
matrix component that multiplies \(\tilde{\eta}\) to compute \(A_0\).A0U
matrix component that multiplies \(\tilde{u}\) to compute \(A_0\).A0V
matrix component that multiplies \(\tilde{v}\) to compute \(A_0\).AmN
matrix component that multiplies \(\tilde{\eta}\) to compute \(A_m\).AmU
matrix component that multiplies \(\tilde{u}\) to compute \(A_m\).AmV
matrix component that multiplies \(\tilde{v}\) to compute \(A_m\).ApN
matrix component that multiplies \(\tilde{\eta}\) to compute \(A_p\).ApU
matrix component that multiplies \(\tilde{u}\) to compute \(A_p\).ApV
matrix component that multiplies \(\tilde{v}\) to compute \(A_p\).
- components of \(S\)
NA0
matrix component that multiplies \(A_0\) to compute \(\tilde{\eta}\).NAm
matrix component that multiplies \(A_m\) to compute \(\tilde{\eta}\).NAp
matrix component that multiplies \(A_p\) to compute \(\tilde{\eta}\).UA0
matrix component that multiplies \(A_0\) to compute \(\tilde{u}\).UAm
matrix component that multiplies \(A_m\) to compute \(\tilde{u}\).UAp
matrix component that multiplies \(A_p\) to compute \(\tilde{u}\).VA0
matrix component that multiplies \(A_0\) to compute \(\tilde{v}\).VAm
matrix component that multiplies \(A_m\) to compute \(\tilde{v}\).VAp
matrix component that multiplies \(A_p\) to compute \(\tilde{v}\).WAm
matrix component that multiplies \(A_m\) to compute \(\tilde{w}\).WAp
matrix component that multiplies \(A_p\) to compute \(\tilde{w}\).
- inverse components (\(S^{-1}\))
- Potential Vorticity & Enstrophy
- Multiplicative factors
A0_QGPV_factor
multiplicative factor that multiplies \(A_0\) to compute quasigeostrophic potential vorticity (QGPV).A0_TZ_factor
multiplicative factor that multiplies \(A_0^2\) to compute quasigeostrophic enstrophy.
- Multiplicative factors
- State Variables
F0
non-linear flux into A0Fm
non-linear flux into AmFp
non-linear flux into Aprho_e
excess densityrho_total
total potential densityssh
sea-surface heightssu
x-component of the fluid velocity at the surfacessv
y-component of the fluid velocity at the surfaceuvMax
max horizontal fluid speedwMax
max vertical fluid speedzeta_z
vertical component of relative vorticity
- Internal
WVTransform
initialize a WVTransform instanceaddToVariableCache
add variable to internal cache, in case it is needed againclearVariableCache
clear the internal cacheclearVariableCacheOfTimeDependentVariables
clear the internal cache of variables that claim to be time dependentfetchFromVariableCache
retrieve a set of variables from the internal cacheperformOperation
computes (runs) the operationperformOperationWithName
computes (runs) the operationstateVariables
retrieve variables either from cache or by computation
- Metadata
- Dimensions
addDimensionAnnotations
add one or more WVDimensionsdimensionAnnotationWithName
retrieve a WVDimension by name
- Dimensions
- Flow components
addFlowComponent
add a flow componentaddPrimaryFlowComponent
add a primary flow component, automatically added to the flowflowComponent
retrieve a WVFlowComponent by nameprimaryFlowComponent
retrieve a WVPrimaryFlowComponent by name
- Utility function
spectralVariableWithResolution
create a new variable with different resolution- Metadata
addOperation
add a WVOperationaddPropertyAnnotations
add a property annotationaddVariableAnnotations
add a variable annotationoperationWithName
retrieve a WVOperation by namepropertyAnnotationWithName
retrieve a WVPropertyAnnotation by nameremoveOperation
remove an existing WVOperationremoveVariableAnnotations
add a variable annotationvariableAnnotationWithName
retrieve a WVVariableAnnotation by namevariableNames
retrieve the names of all available variables
- Write to file
concatenateVariablesAlongTimeDimension
Concatenate variables along the time dimensioncreateNetCDFFileForTimeStepOutput
Output theWVTransform
to file with variable time dimensionwriteToFile
Output theWVTransform
to file.
- Operations
- Transformations
convertFromWavenumberToFrequency
SummarytransformFromSpatialDomainWithFg
transforms from the spatial domain (z,:,:) to the spectral domain (j,:,:) using the geostrophic F-modestransformFromSpatialDomainWithFio
transforms from the spatial domain (z,:,:) to the spectral domain (j,:,:) using the inertial oscillation F-modestransformFromSpatialDomainWithGg
transforms from the spatial domain (z,:,:) to the spectral domain (j,:,:) using the geostrophic G-modestransformToKLAxes
transforms in the spectral domain from (j,kl) to (kAxis,lAxis,j)transformToRadialWavenumber
transforms in the spectral domain from (j,kl) to (j,kRadial)transformToSpatialDomainWithF
transforms from the spectral domain (k,l,j) to the spatial domain (x,y,z) using the F-modestransformToSpatialDomainWithFAllDerivatives
transforms from the spectral domain (k,l,j) to the spatial domain (x,y,z) using the F-modes, returning the transformed variable an its derivatives.transformToSpatialDomainWithG
transforms from the spectral domain (k,l,j) to the spatial domain (x,y,z) using the G-modestransformToSpatialDomainWithGAllDerivatives
transforms from the spectral domain (k,l,j) to the spatial domain (x,y,z) using the G-modes, returning the transformed variable an its derivatives.transformUVEtaToWaveVortex
transform fluid variables \((u,v,\eta)\) to wave-vortex coefficients \((A_+,A_-,A_0)\).transformWaveVortexToUVWEta
transform wave-vortex coefficients \((A_+,A_-,A_0)\) to fluid variables \((u,v,\eta)\).
- Transformations
- Properties
effectiveHorizontalGridResolution
returns the effective grid resolution in meters
- Nonlinear flux and energy transfers
energyFluxFromNonlinearFlux
converts nonlinear flux into energy fluxnonlinearFlux
returns the flux of each coefficient as determined by the nonlinear flux operationnonlinearFluxForFlowComponents
returns the flux of each coefficient as determined by the nonlinear flux operationnonlinearFluxOperation
The operation responsible for computing the nonlinear fluxnonlinearFluxWithGradientMasks
returns the flux of each coefficient as determined by the nonlinear flux operationnonlinearFluxWithMask
returns the flux of each coefficient as determined by the nonlinear flux
- Index Gymnastics
indexFromModeNumber
return the linear index into a spectral matrix given (k,l,j)isValidConjugateModeNumber
returns a boolean indicating whether (k,l,j) is a valid conjugate mode numberisValidModeNumber
returns a boolean indicating whether (k,l,j) is a valid mode numberisValidPrimaryModeNumber
returns a boolean indicating whether (k,l,j) is a valid primary (non-conjugate) mode number
- Masks
maskA0Conj
returns a mask indicating where conjugate solutions live in the A0 matrix.maskA0Primary
returns a mask indicating where primary solutions live in the A0 matrix.maskAmConj
returns a mask indicating where conjugate solutions live in the Am matrix.maskAmPrimary
returns a mask indicating where primary solutions live in the Am matrix.maskApConj
returns a mask indicating where conjugate solutions live in the Ap matrix.maskApPrimary
returns a mask indicating where primary solutions live in the Ap matrix.
- Other
A0
geostrophic coefficients at reference time t0 (m)A0Z
Am
negative wave coefficients at reference time t0 (m/s)Ap
positive wave coefficients at reference time t0 (m/s)ApmD
ApmN
K2
Lr2
squared Rossby radiusPA0
conjugateDimension
dftBuffer
dftConjugateIndex
dftPrimaryIndex
diffX
diffY
diffZF
differentiates a variable of (x,y,z) by projecting onto the F-modes, differentiating, and transforming back to (x,y,z)diffZG
differentiates a variable of (x,y,z) by projecting onto the G-modes, differentiating, and transforming back to (x,y,z)dimensionAnnotationNameMap
dk
dl
dynamicalVariable
enstrophyFluxFromF0
flowComponentNameMap
h_0
[Nj Nkl]h_pm
[Nj Nkl]hasMeanPressureDifference
checks if there is a non-zero mean pressure difference between the top and bottom of the fluidhorizontalModes
iOmega
initializePrimaryFlowComponents
isHydrostatic
isequal
kAxis
k coordinatekl
dimension of the interleaved k-l wavenumber coordinateknownDynamicalVariables
lAxis
l coordinatemodeNumberFromIndex
operationForDynamicalVariable
This function is designed with the following goals:operationNameMap
operationVariableNameMap
primaryFlowComponentNameMap
propertyAnnotationNameMap
qgpvFluxFromF0
spectralVanishingViscosityFilter
Builds the spectral vanishing viscosity operatorsummarizeDegreesOfFreedom
summarizeDynamicalVariables
summarizeFlowComponents
timeDependentVariablesNameMap
totalEnergy
totalEnergyOfFlowComponent
totalEnergySpatiallyIntegrated
totalEnstrophy
totalEnstrophySpatiallyIntegrated
totalHydrostaticEnergy
transformFromSpatialDomainWithFourier
transformToSpatialDomainWithFourier
transformToSpatialDomainWithFourierAtPosition
transformWithG_wg
variableAnnotationNameMap
variableCache
variables
access the dynamical variablesvariablesAtPosition
access the dynamical variables at any position in the domainvelocityField
Return the velocity field, which is the sum of the griddedversion
waveCoefficientsAtTimeT
waveVortexTransformWithResolution
wvBuffer
wvConjugateIndex