WVTransformHydrostatic
A class for disentangling hydrostatic waves and vortices in variable stratification
Declaration
classdef WVTransformHydrostatic < WVTransformOverview
To initialization an instance of the WVTransformHydrostatic class you must specific the domain size, the number of grid points and either the density profile or the stratification profile.
N0 = 3*2*pi/3600;
L_gm = 1300;
N2 = @(z) N0*N0*exp(2*z/L_gm);
wvt = WVTransformHydrostatic([100e3, 100e3, 4000],[64, 64, 65], N2=N2,latitude=30);
Topics
- Initialization
WVTransformHydrostaticcreate a wave-vortex transform for variable stratification
- Primary flow components
geostrophicComponentreturns the geostrophic flow componentwaveComponentreturns the internal gravity wave flow componentinertialComponentreturns the inertial oscillation flow componentmdaComponentreturns the mean density anomaly component
- Stratification
effectiveVerticalGridResolutionreturns the effective vertical grid resolution in meters- Validation
isDensityInValidRangechecks if the density field is a valid adiabatic re-arrangement of the base state
- Initial conditions
- Waves
addGMSpectrumadd waves following a Garrett-Munk spectrumaddWaveModesadd amplitudes of the given wave modesaddWavesWithFrequencySpectrumadd waves with a specified frequency spectruminitWavesWithFrequencySpectruminitialize with waves of a specified frequency spectruminitWithAlternativeSpectruminitialize with an alternative formulation of the GM spectrum in the wavenumber domain.initWithGMSpectruminitialize the wave field following a Garrett-Munk spectruminitWithWaveModesinitialize with the given wave modesremoveAllWavesremoves all wave from the model, including inertial oscillationssetWaveModesset amplitudes of the given wave modes
- Geostrophic Motions
initWithGeostrophicStreamfunctioninitialize with a geostrophic streamfunctionsetGeostrophicStreamfunctionset a geostrophic streamfunctionaddGeostrophicStreamfunctionadd a geostrophic streamfunction to existing geostrophic motionssetGeostrophicModesset amplitudes of the given geostrophic modesaddGeostrophicModesadd amplitudes of the given geostrophic modesremoveAllGeostrophicMotionsremove all geostrophic motions
- Inertial Oscillations
addInertialMotionsadd inertial motions to existing inertial motionsinitWithInertialMotionsinitialize with inertial motionsremoveAllInertialMotionsremove all inertial motionssetInertialMotionsset inertial motions
- Mean density anomaly
addMeanDensityAnomalyadd inertial motions to existing inertial motionsinitWithMeanDensityAnomalyinitialize with inertial motionsremoveAllMeanDensityAnomalyremove all mean density anomaliessetMeanDensityAnomalyset inertial motions
- Waves
- Operations
- Grid transformation
transformFromDFTGridToWVGridconvert from DFT to WV gridtransformFromWVGridToDFTGridconvert from a WV to DFT grid
- Fourier transformation
transformFromSpatialDomainToDFTGridtransform from \((x,y,z)\) to \((k,l,z)\) on the DFT gridtransformToSpatialDomainFromDFTGridtransform from \((k,l,z)\) on the DFT grid to \((x,y,z)\)transformToSpatialDomainFromDFTGridAtPositiontransform from \((k,l)\) on the DFT grid to \((x,y)\) at any position
- Transformations
transformToKLAxestransforms in the spectral domain from (j,kl) to (kAxis,lAxis,j)transformToOmegaAxistransforms in the from (j,kRadial) to omegaAxistransformToPseudoRadialWavenumbertransforms in the from (j,kRadial) to kPseudoRadialtransformToPseudoRadialWavenumberA0transforms in the from (j,kRadial) to kPseudoRadialtransformToPseudoRadialWavenumberApmtransforms in the from (j,kRadial) to kPseudoRadialtransformToRadialWavenumbertransforms in the spectral domain from (j,kl) to (j,kRadial)
- Grid transformation
- Domain attributes
- Spatial grid
- DFT grid
Nk_dftlength of the k-wavenumber dimension on the DFT gridNl_dftlength of the l-wavenumber dimension on the DFT gridconjugateDimensionassumed conjugate dimensionkMode_dftk mode-number on the DFT gridk_dftk wavenumber dimension on the DFT gridlMode_dftl mode-number on the DFT gridl_dftl wavenumber dimension on the DFT grid
- WV grid
Nkllength of the combined kl-wavenumber dimension on the WV griddftConjugateIndexindex into the DFT grid of the conjugate of each WV modedftConjugateIndices2Dindex into the DFT grid of the conjugate of each WV modedftPrimaryIndexindex into the DFT grid of each WV modedftPrimaryIndices2Dindex into the DFT grid of each WV modedkwavenumber spacing of the \(k\) axisdlwavenumber spacing of the \(l\) axiskwavenumber dimension on the WV gridkMode_wvk mode number on the WV gridkRadialradial (k,l) wavenumber on the WV gridklwavenumber dimensionlwavenumber dimension on the WV gridlMode_wvl mode number on the WV gridshouldAntialiaswhether the WV grid includes quadratically aliased wavenumbersshouldExcludeNyquistwhether the WV grid includes Nyquist wavenumbersshouldExludeConjugateswhether the WV grid includes wavenumbers that are Hermitian conjugateswvConjugateIndexindex into the WV mode that matches the dftConjugateIndices
- Utility function
degreesOfFreedomForComplexMatrixa matrix with the number of degrees-of-freedom at each entrydegreesOfFreedomForRealMatrixa matrix with the number of degrees-of-freedom at each entryindicesOfFourierConjugatesa matrix of linear indices of the conjugateisHermitianCheck if the matrix is Hermitian. Report errors.setConjugateToUnityset the conjugate of the wavenumber (iK,iL) to 1
- Properties
effectiveHorizontalGridResolutionreturns the effective grid resolution in meters
- Energetics
geostrophicEnergytotal energy of the geostrophic flowinertialEnergytotal energy of the inertial flowmdaEnergytotal energy of the mean density anomalygeostrophicKineticEnergykinetic energy of the geostrophic flowwaveEnergytotal energy of the geostrophic flowgeostrophicPotentialEnergypotential energy of the geostrophic flow
- Index gymnastics
indexFromKLModeNumberreturn the linear index into k_wv and l_wv from a mode numberindexFromModeNumberreturn the linear index into a spectral matrix given (k,l,j)indicesFromDFTGridToWVGridindices to convert from DFT to WV gridindicesFromWVGridToDFTGridindices to convert from WV to DFT gridindicesFromWVGridToFFTWGridindices to convert from WV to DFT gridisValidConjugateKLModeNumberreturn a boolean indicating whether (k,l) is a valid conjugate WV mode numberisValidConjugateModeNumberreturns a boolean indicating whether (k,l,j) is a valid conjugate mode numberisValidKLModeNumberreturn a boolean indicating whether (k,l) is a valid WV mode numberisValidModeNumberreturns a boolean indicating whether (k,l,j) is a valid mode numberisValidPrimaryKLModeNumberreturn a boolean indicating whether (k,l) is a valid primary (non-conjugate) WV mode numberisValidPrimaryModeNumberreturns a boolean indicating whether (k,l,j) is a valid primary (non-conjugate) mode numberklModeNumberFromIndexreturn mode number from a linear index into a WV matrixprimaryKLModeNumberFromKLModeNumbertakes any valid WV mode number and returns the primary mode number
- Masks
maskForAliasedModesreturns a mask with locations of modes that will alias with a quadratic multiplication.maskForConjugateFourierCoefficientsa mask indicate the components that are redundant conjugatesmaskForNyquistModesreturns a mask with locations of modes that are not fully resolved
- Developer
propertyAnnotationsForGeometryreturn array of CAPropertyAnnotations initialized by default
- Internal
quadraturePointsForStratifiedFlowreturn the quadrature points for a given stratificationverticalProjectionOperatorsWithRigidLidreturn the normalized projection operators with prefactors
- Other
A0NA0ZApmDApmNFMatrixFetaFinvMatrixFuFvGMatrixGinvMatrixJKK2KhLLr2N2N2FunctionNA0NAmNApNjNzOmegaP0Preconditioner for F, size(P)=[Nj 1]. Fu = uhat, (PF)u = Puhat, so ubar==PuhatPA0PF0size(PF,PG)=[Nj x Nz]PF0invTransformation matricesQ0Preconditioner for G, size(Q)=[Nj 1]. Geta = etahat, (QG)eta = Qetahat, so etabar==Qetahat.QG0QG0invUA0UAmUApVA0VAmVApWAmWApXYZbetaboussinesqTransformchebfunForZArrayclassRequiredPropertyNamescrossSpectrumWithFgTransformcrossSpectrumWithGgTransformdLnN2diffXdiffYdiffZFdiffZGeffectiveJMaxenstrophyFluxFromF0exactPotentialEnstrophyexactTotalEnergyffluxAtTimeCellArrayy0 is a 3x1 cell arrayfluxForForcingggeometryFromFilegeometryFromGrouph_0[Nj 1]h_pmiOmegainertialPeriodjkAxiskPseudoRadialkljGridlAxislatitudemaxFgmaxFwmodeNumberFromIndexnamesOfRequiredPropertiesForGeometrynamesOfRequiredPropertiesForRotatingFPlanenamesOfRequiredPropertiesForTransformnamesOfTransformVariablesnewNonrequiredPropertyNamesnewRequiredPropertyNamesplanetaryRadiuspropertyAnnotationsForRotatingFPlaneqgpvFluxFromF0requiredPropertiesForGeometryFromGrouprequiredPropertiesForRotatingFPlaneFromGrouprequiredPropertiesForTransformFromGrouprho0, dLnN2rhoFunctioneta_true operation needs rhoFunctionrho_nm0rk4FluxForForcingrotationRatespatialFluxForForcingWithNamespatialMatrixSizespectralMatrixSizespectrumWithFgTransformspectrumWithGgTransformsumFluxDictionarythrowErrorIfDensityViolationchecks if the proposed coefficients are a valid adiabatic re-arrangement of the base statetotalEnstrophytotalEnstrophySpatiallyIntegratedtransformFromGrouptransformFromSpatialDomainWithFiotransformFromSpatialDomainWithFouriertransformToSpatialDomainWithFouriertransformToSpatialDomainWithFourierAtPositiontransformWithG_wgverticalModesverticalProjectionOperatorsWithFreeSurfacevolumeIntegralwaveCoefficientsAtTimeTwaveVortexTransformWithExplicitAntialiasingxyzGridzz_int