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
N2\(N^2(z)\), squared buoyancy frequency of the no-motion density, \(N^2\equiv - \frac{g}{\rho_0} \frac{\partial \rho_\textrm{nm}}{\partial z}\)dLnN2\(\frac{\partial \ln N^2}{\partial z}\), vertical variation of the log of the squared buoyancy frequencyverticalModesinstance of the InternalModes classeffectiveVerticalGridResolutionreturns the effective vertical grid resolution in meters- Vertical modes
FMatrixtransformation matrix \(F_g\)FinvMatrixtransformation matrix \(F_g^{-1}\)GMatrixtransformation matrix \(G_g\)GinvMatrixtransformation matrix \(G_g^{-1}\)
- 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
- Energetics of flow components
geostrophicEnergytotal energy, geostrophic
- 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
- Wave-vortex coefficients
- at time \(t\)
A0tgeostrophic coefficients time t
- at time \(t\)
- Domain Attributes
fCoriolis parameterggravity of EarthinertialPeriodinertial periodlatitudecentral latitude of the simulationplanetaryRadiusradius of the planetary bodyrho0, dLnN2rotationRaterotation rate of the planetary body- Grid
- Spectral
- Spatial
- 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
- Stratification
h_0[Nj 1]
- 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
geostrophicKineticEnergykinetic 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
- Utilities
placeParticlesOnIsopycnalplaces Lagrangian particles along a specified isopycnal
- Developer
propertyAnnotationsForGeometryreturn array of CAPropertyAnnotations initialized by default
- State Variables
- Potential Vorticity & Enstrophy
qgpvquasigeostrophic potential vorticity
- Internal
quadraturePointsForStratifiedFlowreturn the quadrature points for a given stratificationverticalProjectionOperatorsWithRigidLidreturn the normalized projection operators with prefactors
- Other
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\).A0ZLr2squared Rossby radiusN2Functiontakes \(z\) values and returns the squared buoyancy frequency of the no-motion density.NA0matrix component that multiplies \(A_0\) to compute \(\tilde{\eta}\).P0Preconditioner 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.QG0Preconditioned G-mode forward transformationQG0invPreconditioned G-mode inverse transformationUA0matrix component that multiplies \(A_0\) to compute \(\tilde{u}\).VA0matrix component that multiplies \(A_0\) to compute \(\tilde{v}\).betabuoyancyPeriodchebfunForZArrayclassRequiredPropertyNamescrossSpectrumWithFgTransformcrossSpectrumWithGgTransformdiffXdiffYdiffZFdiffZGeffectiveJMaxenstrophyFluxFromF0etaapproximate isopycnal deviationfluxForForcinggeometryFromFilegeometryFromGrouph_pmhydrostaticTransformintZFintZGjvertical mode numberkAxisk coordinatekPseudoRadialkljGridlAxisl coordinatemaxFgmaxFwmodeNumberFromIndexnamesOfRequiredPropertiesForGeometrynamesOfRequiredPropertiesForRotatingFPlanenamesOfRequiredPropertiesForTransformnamesOfTransformVariablesnewNonrequiredPropertyNamesnewRequiredPropertyNamesppressure anomalypiheight anomalypropertyAnnotationsForRotatingFPlaneqgpvFluxFromF0requiredPropertiesForGeometryFromGrouprequiredPropertiesForRotatingFPlaneFromGrouprequiredPropertiesForTransformFromGrouprhoFunctioneta_true operation needs rhoFunctionrho_eexcess densityrho_nm0\(\rho_\textrm{nm}(z)\), no-motion density at timet0rho_totaltotal potential densityspatialMatrixSizespectralMatrixSizespectrumWithFgTransformspectrumWithGgTransformsshsea-surface heightthrowErrorIfDensityViolationchecks if the proposed coefficients are a valid adiabatic re-arrangement of the base statetotalEnstrophytotalEnstrophySpatiallyIntegratedtransformFromGrouptransformFromSpatialDomainWithFiotransformFromSpatialDomainWithFouriertransformQGPVToWaveVortextransformToSpatialDomainWithFouriertransformToSpatialDomainWithFourierAtPositiontransformWithG_wgux-component of the fluid velocityuvMaxmax horizontal fluid speedvy-component of the fluid velocityverticalProjectionOperatorsWithFreeSurfacexyzGridzz coordinatez_intQuadrature weights for the vertical gridzeta_zvertical component of relative vorticity