WVTransform
Represents the state of the ocean in terms of energetically orthogonal wave and geostrophic (vortex) solutions
Declaration
classdef WVTransform < handleOverview
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,
WVTransformConstantStratificationWVTransformHydrostaticWVTransformSingleMode
Topics
- Initialization
waveVortexTransformFromFileInitialize a WVTransform instance from an existing filewaveVortexTransformWithDoubleResolutioncreate a new WVTransform with double resolution
- Domain attributes
Omegafrequency of oscillation of the linear wavesfCoriolis parameterggravity of EarthinertialPeriodinertial periodisBarotropicBoolean indicating whether there is a single (equivalent barotropic) modelatitudecentral latitude of the simulationrho0density of \(\rho_\textrm{nm}\) at the surface (z=0)ttime coordinatet0reference time of Ap, Am, A0- Grid
shouldAntialiaswhether antialiasing is enabled- Spectral
Jj-coordinate matrixKk-coordinate matrixKhhorizontal wavenumber, \(Kh=\sqrt(K^2+L^2)\)Ll-coordinate matrixNjpoints in the j-coordinate,length(z)Nklpoints in the kl-coordinate,length(k)jvertical mode numberkwavenumber coordinate in the x-directionkRadialisotropic wavenumber dimensionkljGridreturns the K, L, J coordinate matriceslwavenumber coordinate in the y-directionspectralMatrixSizereturns the size of any spectral matrix, e.g., Ap, Am, A0
- Spatial
xx coordinateyy coordinatezz coordinateLxdomain size in the x-directionLydomain size in the y-directionLzdomain size in the z-directionNxpoints in the x-coordinate,length(x)Nypoints in the y-coordinate,length(y)Nzpoints in the z-coordinate,length(z)Xx-coordinate matrixYy-coordinate matrixZz-coordinate matrixspatialMatrixSizereturns the size of all real-valued field variablesxyzGridreturns the X, Y, Z coordinate matrices
- Wave-vortex coefficients
- Initial Conditions
addRandomFlowadd randomized flow to the existing stateaddUVEtaadd \((u,v,\eta)\) to the existing valuesinitFromNetCDFFileinitialize the flow from a NetCDF fileinitWithRandomFlowinitialize with a random flow stateinitWithUVEtainitialize with fluid variables \((u,v,\eta)\)initWithUVRhoinitialize with fluid variables \((u,v,\rho)\)- Waves
removeAllremoves all energy from the model
- Energetics
summarizeEnergyContentdisplays a summary of the energy content of the fluidsummarizeModeEnergyList the most energetic modes- Multiplicative factors
A0_TE_factormultiplicative factor that multiplies \(A_0^2\) to compute total energy.Apm_TE_factormultiplicative factor that multiplies \(A_\pm^2\) to compute total energy.
- Wave-vortex sorting matrix
- inverse components (\(S^{-1}\))
A0Nmatrix component that multiplies \(\tilde{\eta}\) to compute \(A_0\).A0Umatrix component that multiplies \(\tilde{u}\) to compute \(A_0\).A0Vmatrix component that multiplies \(\tilde{v}\) to compute \(A_0\).AmNmatrix component that multiplies \(\tilde{\eta}\) to compute \(A_m\).AmUmatrix component that multiplies \(\tilde{u}\) to compute \(A_m\).AmVmatrix component that multiplies \(\tilde{v}\) to compute \(A_m\).ApNmatrix component that multiplies \(\tilde{\eta}\) to compute \(A_p\).ApUmatrix component that multiplies \(\tilde{u}\) to compute \(A_p\).ApVmatrix component that multiplies \(\tilde{v}\) to compute \(A_p\).
- components of \(S\)
NA0matrix component that multiplies \(A_0\) to compute \(\tilde{\eta}\).NAmmatrix component that multiplies \(A_m\) to compute \(\tilde{\eta}\).NApmatrix component that multiplies \(A_p\) to compute \(\tilde{\eta}\).UA0matrix component that multiplies \(A_0\) to compute \(\tilde{u}\).UAmmatrix component that multiplies \(A_m\) to compute \(\tilde{u}\).UApmatrix component that multiplies \(A_p\) to compute \(\tilde{u}\).VA0matrix component that multiplies \(A_0\) to compute \(\tilde{v}\).VAmmatrix component that multiplies \(A_m\) to compute \(\tilde{v}\).VApmatrix component that multiplies \(A_p\) to compute \(\tilde{v}\).WAmmatrix component that multiplies \(A_m\) to compute \(\tilde{w}\).WApmatrix component that multiplies \(A_p\) to compute \(\tilde{w}\).
- inverse components (\(S^{-1}\))
- Potential Vorticity & Enstrophy
- Multiplicative factors
A0_QGPV_factormultiplicative factor that multiplies \(A_0\) to compute quasigeostrophic potential vorticity (QGPV).A0_TZ_factormultiplicative factor that multiplies \(A_0^2\) to compute quasigeostrophic enstrophy.
- Multiplicative factors
- State Variables
F0non-linear flux into A0Fmnon-linear flux into AmFpnon-linear flux into Aprho_eexcess densityrho_totaltotal potential densitysshsea-surface heightssux-component of the fluid velocity at the surfacessvy-component of the fluid velocity at the surfaceuvMaxmax horizontal fluid speedwMaxmax vertical fluid speedzeta_zvertical component of relative vorticity
- Internal
WVTransforminitialize a WVTransform instanceaddToVariableCacheadd variable to internal cache, in case it is needed againclearVariableCacheclear the internal cacheclearVariableCacheOfTimeDependentVariablesclear the internal cache of variables that claim to be time dependentfetchFromVariableCacheretrieve a set of variables from the internal cacheperformOperationcomputes (runs) the operationperformOperationWithNamecomputes (runs) the operationstateVariablesretrieve variables either from cache or by computation
- Metadata
- Dimensions
addDimensionAnnotationsadd one or more WVDimensionsdimensionAnnotationWithNameretrieve a WVDimension by name
- Dimensions
- Flow components
addFlowComponentadd a flow componentaddPrimaryFlowComponentadd a primary flow component, automatically added to the flowflowComponentretrieve a WVFlowComponent by nameprimaryFlowComponentretrieve a WVPrimaryFlowComponent by name
- Utility function
spectralVariableWithResolutioncreate a new variable with different resolution- Metadata
addOperationadd a WVOperationaddPropertyAnnotationsadd a property annotationaddVariableAnnotationsadd a variable annotationoperationWithNameretrieve a WVOperation by namepropertyAnnotationWithNameretrieve a WVPropertyAnnotation by nameremoveOperationremove an existing WVOperationremoveVariableAnnotationsadd a variable annotationvariableAnnotationWithNameretrieve a WVVariableAnnotation by namevariableNamesretrieve the names of all available variables
- Write to file
concatenateVariablesAlongTimeDimensionConcatenate variables along the time dimensioncreateNetCDFFileForTimeStepOutputOutput theWVTransformto file with variable time dimensionwriteToFileOutput theWVTransformto file.
- Operations
- Transformations
convertFromWavenumberToFrequencySummarytransformFromSpatialDomainWithFgtransforms from the spatial domain (z,:,:) to the spectral domain (j,:,:) using the geostrophic F-modestransformFromSpatialDomainWithFiotransforms from the spatial domain (z,:,:) to the spectral domain (j,:,:) using the inertial oscillation F-modestransformFromSpatialDomainWithGgtransforms from the spatial domain (z,:,:) to the spectral domain (j,:,:) using the geostrophic G-modestransformToKLAxestransforms in the spectral domain from (j,kl) to (kAxis,lAxis,j)transformToRadialWavenumbertransforms in the spectral domain from (j,kl) to (j,kRadial)transformToSpatialDomainWithFtransforms from the spectral domain (k,l,j) to the spatial domain (x,y,z) using the F-modestransformToSpatialDomainWithFAllDerivativestransforms 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.transformToSpatialDomainWithGtransforms from the spectral domain (k,l,j) to the spatial domain (x,y,z) using the G-modestransformToSpatialDomainWithGAllDerivativestransforms 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.transformUVEtaToWaveVortextransform fluid variables \((u,v,\eta)\) to wave-vortex coefficients \((A_+,A_-,A_0)\).transformWaveVortexToUVWEtatransform wave-vortex coefficients \((A_+,A_-,A_0)\) to fluid variables \((u,v,\eta)\).
- Transformations
- Properties
effectiveHorizontalGridResolutionreturns the effective grid resolution in meters
- Nonlinear flux and energy transfers
energyFluxFromNonlinearFluxconverts nonlinear flux into energy fluxnonlinearFluxreturns the flux of each coefficient as determined by the nonlinear flux operationnonlinearFluxForFlowComponentsreturns the flux of each coefficient as determined by the nonlinear flux operationnonlinearFluxOperationThe operation responsible for computing the nonlinear fluxnonlinearFluxWithGradientMasksreturns the flux of each coefficient as determined by the nonlinear flux operationnonlinearFluxWithMaskreturns the flux of each coefficient as determined by the nonlinear flux
- Index Gymnastics
indexFromModeNumberreturn the linear index into a spectral matrix given (k,l,j)isValidConjugateModeNumberreturns a boolean indicating whether (k,l,j) is a valid conjugate mode numberisValidModeNumberreturns a boolean indicating whether (k,l,j) is a valid mode numberisValidPrimaryModeNumberreturns a boolean indicating whether (k,l,j) is a valid primary (non-conjugate) mode number
- Masks
maskA0Conjreturns a mask indicating where conjugate solutions live in the A0 matrix.maskA0Primaryreturns a mask indicating where primary solutions live in the A0 matrix.maskAmConjreturns a mask indicating where conjugate solutions live in the Am matrix.maskAmPrimaryreturns a mask indicating where primary solutions live in the Am matrix.maskApConjreturns a mask indicating where conjugate solutions live in the Ap matrix.maskApPrimaryreturns a mask indicating where primary solutions live in the Ap matrix.
- Other
A0geostrophic coefficients at reference time t0 (m)A0ZAmnegative wave coefficients at reference time t0 (m/s)Appositive wave coefficients at reference time t0 (m/s)ApmDApmNK2Lr2squared Rossby radiusPA0conjugateDimensiondftBufferdftConjugateIndexdftPrimaryIndexdiffXdiffYdiffZFdifferentiates a variable of (x,y,z) by projecting onto the F-modes, differentiating, and transforming back to (x,y,z)diffZGdifferentiates a variable of (x,y,z) by projecting onto the G-modes, differentiating, and transforming back to (x,y,z)dimensionAnnotationNameMapdkdldynamicalVariableenstrophyFluxFromF0flowComponentNameMaph_0[Nj Nkl]h_pm[Nj Nkl]hasMeanPressureDifferencechecks if there is a non-zero mean pressure difference between the top and bottom of the fluidhorizontalModesiOmegainitializePrimaryFlowComponentsisHydrostaticisequalkAxisk coordinatekldimension of the interleaved k-l wavenumber coordinateknownDynamicalVariableslAxisl coordinatemodeNumberFromIndexoperationForDynamicalVariableThis function is designed with the following goals:operationNameMapoperationVariableNameMapprimaryFlowComponentNameMappropertyAnnotationNameMapqgpvFluxFromF0spectralVanishingViscosityFilterBuilds the spectral vanishing viscosity operatorsummarizeDegreesOfFreedomsummarizeDynamicalVariablessummarizeFlowComponentstimeDependentVariablesNameMaptotalEnergytotalEnergyOfFlowComponenttotalEnergySpatiallyIntegratedtotalEnstrophytotalEnstrophySpatiallyIntegratedtotalHydrostaticEnergytransformFromSpatialDomainWithFouriertransformToSpatialDomainWithFouriertransformToSpatialDomainWithFourierAtPositiontransformWithG_wgvariableAnnotationNameMapvariableCachevariablesaccess the dynamical variablesvariablesAtPositionaccess the dynamical variables at any position in the domainvelocityFieldReturn the velocity field, which is the sum of the griddedversionwaveCoefficientsAtTimeTwaveVortexTransformWithResolutionwvBufferwvConjugateIndex