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
rho_nmno-motion density profileN2\(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
- 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
- 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
- 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
inertialEnergytotal 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
- 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\).A0ZApmDApmNFetaFuFvLr2squared 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}\).NAmNApOmegaP0Preconditioner 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}\).UAmUApVA0matrix component that multiplies \(A_0\) to compute \(\tilde{v}\).VAmVApWAmWApbetaboussinesqTransformbuoyancyPeriodchebfunForZArrayclassRequiredPropertyNamesconjPhasephase of the Am wave modescrossSpectrumWithFgTransformcrossSpectrumWithGgTransformdiffXdiffYdiffZFdiffZGeffectiveJMaxenstrophyFluxFromF0etaapproximate isopycnal deviationexactPotentialEnstrophyexactTotalEnergyfluxAtTimeCellArrayy0 is a 3x1 cell arrayfluxForForcinggeometryFromFilegeometryFromGrouph_pmiOmegaintZFintZGjvertical mode numberkAxisk coordinatekPseudoRadialkljGridlAxisl coordinatemaxFgmaxFwmodeNumberFromIndexnamesOfRequiredPropertiesForGeometrynamesOfRequiredPropertiesForRotatingFPlanenamesOfRequiredPropertiesForTransformnamesOfTransformVariablesnewNonrequiredPropertyNamesnewRequiredPropertyNamesppressure anomalyphasephase of the Ap wave modespiheight anomalypropertyAnnotationsForRotatingFPlaneqgpvFluxFromF0requiredPropertiesForGeometryFromGrouprequiredPropertiesForRotatingFPlaneFromGrouprequiredPropertiesForTransformFromGrouprhoFunctioneta_true operation needs rhoFunctionrho_barmean densityrho_eexcess densityrho_nm0\(\rho_\textrm{nm}(z)\), no-motion density at timet0rho_totaltotal potential densityrk4FluxForForcingshouldUseTrueNoMotionProfilewhether eta_true uses rho_nm instead of rho_nm0spatialFluxForForcingWithNamespatialMatrixSizespectralMatrixSizespectrumWithFgTransformspectrumWithGgTransformsshsea-surface heightsumFluxDictionarythrowErrorIfDensityViolationchecks if the proposed coefficients are a valid adiabatic re-arrangement of the base statetotalEnstrophytotalEnstrophySpatiallyIntegratedtransformFromGrouptransformFromSpatialDomainWithFiotransformFromSpatialDomainWithFouriertransformToSpatialDomainWithFouriertransformToSpatialDomainWithFourierAtPositiontransformWithG_wgux-component of the fluid velocityuvMaxmax horizontal fluid speedvy-component of the fluid velocityverticalProjectionOperatorsWithFreeSurfacevolumeIntegralwz-component of the fluid velocitywMaxmax vertical fluid speedwaveCoefficientsAtTimeTwaveVortexTransformWithExplicitAntialiasingxyzGridzz coordinatez_intQuadrature weights for the vertical gridzeta_xx-component component of relative vorticityzeta_yy-component component of relative vorticityzeta_zvertical component of relative vorticity