WVTransformStratifiedQG
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
WVTransformStratifiedQGcreate a wave-vortex transform for variable stratification
- Primary flow components
geostrophicComponentreturns the geostrophic flow 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
- 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
- Geostrophic Motions
- 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 flowgeostrophicKineticEnergykinetic 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
A0NA0ZFMatrixFinvMatrixGMatrixGinvMatrixJKK2KhLLr2N2N2FunctionNA0NjNzP0Preconditioner 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.QG0QG0invUA0VA0XYZbetachebfunForZArrayclassRequiredPropertyNamescrossSpectrumWithFgTransformcrossSpectrumWithGgTransformdLnN2diffXdiffYdiffZFdiffZGeffectiveJMaxenstrophyFluxFromF0ffluxForForcingggeometryFromFilegeometryFromGrouph_0[Nj 1]h_pmhydrostaticTransforminertialPeriodjkAxiskPseudoRadialkljGridlAxislatitudemaxFgmaxFwmodeNumberFromIndexnamesOfRequiredPropertiesForGeometrynamesOfRequiredPropertiesForRotatingFPlanenamesOfRequiredPropertiesForTransformnamesOfTransformVariablesnewNonrequiredPropertyNamesnewRequiredPropertyNamesplanetaryRadiuspropertyAnnotationsForRotatingFPlaneqgpvFluxFromF0requiredPropertiesForGeometryFromGrouprequiredPropertiesForRotatingFPlaneFromGrouprequiredPropertiesForTransformFromGrouprho0, dLnN2rhoFunctioneta_true operation needs rhoFunctionrho_nm0rotationRatespatialMatrixSizespectralMatrixSizespectrumWithFgTransformspectrumWithGgTransformthrowErrorIfDensityViolationchecks if the proposed coefficients are a valid adiabatic re-arrangement of the base statetotalEnstrophytotalEnstrophySpatiallyIntegratedtransformFromGrouptransformFromSpatialDomainWithFiotransformFromSpatialDomainWithFouriertransformQGPVToWaveVortextransformToSpatialDomainWithFouriertransformToSpatialDomainWithFourierAtPositiontransformWithG_wgverticalModesverticalProjectionOperatorsWithFreeSurfacexyzGridzz_int