WVTransformStratifiedQG
Represent stratified quasigeostrophic flow with variable stratification.
Declaration
classdef WVTransformStratifiedQG < WVTransformOverview
To initialize an instance of the WVTransformStratifiedQG class you must specify 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 = WVTransformStratifiedQG([100e3,100e3,4000],[64,64,65],N2Function=N2,latitude=30);
The quasigeostrophic state is stored in
A0, with current-time view
A0t. This transform has no active Ap, Am, Apt, or Amt content.
Topics
- Create and restore a transform
WVTransformStratifiedQGCreate a stratified quasigeostrophic transform.waveVortexTransformFromFileRestore a WVTransformStratifiedQG instance from an existing file
- Inspect the domain
- Physical environment
- Planetary rotation
betaMeridional gradient of the Coriolis parameter.fCoriolis parameter in radians per second.inertialPeriodInertial period in seconds.latitudeCentral latitude of the rotating domain in degrees north.planetaryRadiusRadius of the rotating planetary body in meters.rotationRatePlanetary rotation rate in radians per second.
- Stratification and reference density
N2Buoyancy frequency squared sampled on the vertical grid.N2FunctionFunction returning buoyancy frequency squared at requested depths.buoyancyPeriodShortest buoyancy period in seconds.dLnN2\(\partial_z \ln N^2\), vertical derivative of the logarithm of squared buoyancy frequencyrho0Boussinesq reference density in kilograms per cubic meter.rhoFunctionFunction returning the no-motion density profile at requested depths.
- Gravity
gGravitational acceleration in meters per second squared.
- Planetary rotation
- Spatial grid
- Coordinate axes
- Coordinate arrays
- Domain dimensions
- Resolution and shape
NxNumber of spatial grid points in the x direction.NyNumber of spatial grid points in the y direction.NzNumber of vertical spatial grid points.spatialMatrixSizeShape of a gridded physical-space field.
- Quadrature and integration
z_intVertical quadrature weights in meters.
- Spectral grid
- Compact grid vectors
- Compact grid arrays
KX-direction angular-wavenumber array in \(\mathrm{rad\,m^{-1}}\) with shape[Nj Nkl].LY-direction angular-wavenumber array in \(\mathrm{rad\,m^{-1}}\) with shape[Nj Nkl].JDimensionless vertical-mode index array with shape[Nj Nkl].kljGridReturn spectral-coordinate arrays in wave-vortex layout.
- Wavenumber spacing
- Horizontal wavenumber geometry
- Resolution and shape
NjNumber of retained vertical modes.NklNumber of retained compact horizontal-wavenumber columns.spectralMatrixSizeShape of a wave-vortex coefficient array.effectiveHorizontalGridResolutionreturns the effective grid resolution in meterseffectiveVerticalGridResolutionreturns the effective vertical grid resolution in meterseffectiveJMaxLargest active vertical-mode index.summarizeDegreesOfFreedomSummarize the spatial grid and active spectral degrees of freedom.
- Vertical modes and scaling
verticalModesVertical-mode solution used to construct the transform basis.h_0Geostrophic equivalent-depth scale for each vertical mode.h_pmWave equivalent depth on the spectral grid.Lr2Squared Rossby deformation radius in square meters.waveModeVerticalStructureAtIndexReturn wave vertical-structure factors at one vertical grid index.
- Vertical-mode transformation matrices
FMatrixTransformation matrix \(F\) projecting F-grid values onto vertical modes; shape[Nj Nz].FinvMatrixTransformation matrix \(F^{-1}\) reconstructing F-grid values from vertical modes; shape[Nz Nj].GMatrixTransformation matrix \(G\) projecting G-grid values onto vertical modes; shape[Nj Nz].GinvMatrixTransformation matrix \(G^{-1}\) reconstructing G-grid values from vertical modes; shape[Nz Nj].
- Transform configuration
isHydrostaticWhether the transform uses the hydrostatic approximation.shouldAntialiasWhether the spectral grid excludes modes that alias quadratic products.
- Physical environment
- Initialize the flow
- General initialization
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)\)removeAllremoves all energy from the model
- 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
- General initialization
- Evaluate physical fields
- Registered variables
hasVariableWithNameTest whether state variables are registered by name.summarizeVariablesPrint a table of registered state variables and cache status.variableNamesReturn the names of all registered state variables.variableWithNameCompute or retrieve one or more registered transform variables.
- On the model grid
- Velocity
- Density and displacement
- Pressure and surface fields
- Vorticity and geostrophic fields
- At arbitrary positions
variableAtPositionWithNameAccess dynamical variables at arbitrary positions in the domain.
- Isopycnal utilities
placeParticlesOnIsopycnalReturn particle depths on the isopycnal identified by a no-motion depth.
- Registered variables
- Manage forcing and closures
- Configure forcing
addForcingAdd forcing or closure objects to this transform.setForcingReplace the complete forcing registry.removeForcingRemove the exact registered forcing objects.removeAllForcingRemove every forcing and closure from this transform.
- Inspect forcing and closures
forcingarray of WVForcing objectsforcingNamesReturn forcing and closure names in application order.forcingWithNameReturn registered forcing objects by name.hasForcingWithNameTest whether forcing objects are registered by name.hasClosureWhether a closure is currently attached to the transform.
- Summarize forcing
summarizeForcingPrint a table of registered forcing and closure objects.
- Configure forcing
- Analyze the flow
- Flow diagnostics
hasMeanPressureDifferenceDiagnose an MDA mean-pressure difference between the boundaries.uvMaxmax horizontal fluid speed
- Density validity
isDensityInValidRangeTest whether total density remains within the no-motion density range.
- Potential vorticity and enstrophy
totalEnstrophyPotential enstrophy computed from geostrophic coefficients.totalEnstrophySpatiallyIntegratedPotential enstrophy evaluated from the gridded QGPV field.
- Spectra
- Spectral fields
kAxisCenteredNx-by-1 x-wavenumber axis in \(\mathrm{rad\,m^{-1}}\).lAxisCenteredNy-by-1 y-wavenumber axis in \(\mathrm{rad\,m^{-1}}\).transformToKLAxestransforms in the spectral domain from (j,kl) to (kAxis,lAxis,j)crossSpectrumWithFgTransformCompute a real modal cross-spectrum using the F-basis transform.crossSpectrumWithGgTransformCompute a real modal cross-spectrum using the G-basis transform.spectrumWithFgTransformCompute a modal autospectrum using the F-basis transform.spectrumWithGgTransformCompute a modal autospectrum using the G-basis transform.
- Radial wavenumber
kRadialradial (k,l) wavenumber on the WV gridtransformToRadialWavenumbertransforms in the spectral domain from (j,kl) to (j,kRadial)
- Spectral fields
- Flow diagnostics
- Analyze energy
- Component energy
geostrophicKineticEnergykinetic energy of the geostrophic flowgeostrophicPotentialEnergypotential energy of the geostrophic flowgeostrophicEnergytotal energy, geostrophictotalEnergyOfFlowComponentCompute the energy carried by one flow component.
- Total energy
totalEnergyTotal energy computed from wave-vortex coefficients.totalEnergySpatiallyIntegratedTotal energy computed from physical-space fields.
- Energy summaries
summarizeEnergyContentdisplays a summary of the energy content of the fluidsummarizeModeEnergyList the most energetic modes
- Component energy
- Save transform state
writeToFileWrite this instance to NetCDF file.
- Convert representations
- Physical fields and coefficients
transformQGPVToWaveVortexProject quasigeostrophic potential vorticity ontoA0coefficients.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)\).
- Physical fields and coefficients
- Differentiate and integrate fields
diffXDifferentiate a gridded field in the periodic x direction.diffYDifferentiate a gridded field in the periodic y direction.diffZFDifferentiate an F-grid field with respect to z.diffZGDifferentiate a G-grid field with respect to z.intZFReturn the first antiderivative of an F-representation.intZGReturn the bottom-zero first antiderivative of a G-representation.
- Inspect flow components
- Primary flow components
geostrophicComponentreturns the geostrophic flow componentprimaryFlowComponentsPrimary flow components that partition the active coefficient state.primaryFlowComponentNamesretrieve the names of all available variablesprimaryFlowComponentWithNameretrieve a WVPrimaryFlowComponent by name
- Registered and combined components
flowComponentsAll registered physical and diagnostic flow components.flowComponentNamesretrieve the names of all available variablesflowComponentWithNameretrieve a WVFlowComponent by nametotalFlowComponentCombined view of all primary flow components.
- Summarize flow components
summarizeFlowComponentsPrint a table of registered primary and diagnostic components.
- Primary flow components
- Inspect wave-vortex coefficients
- Create a related transform
hydrostaticTransformCreate the corresponding hydrostatic wave-vortex transform.spectralVariableWithResolutioncreate a new variable with different resolutionwaveVortexTransformWithDoubleResolutioncreate a new WVTransform with double resolutionwaveVortexTransformWithResolutionCreate the same transform family at a new resolution.
- Extend a transform
- Flow components
addFlowComponentadd a flow component and its standard variablesaddPrimaryFlowComponentadd a primary flow component, automatically added to the flow
- Operations and variables
addOperationRegister one or more operations and their output variables.operationWithNameretrieve a WVOperation by nameremoveOperationRemove the exact registered operation and its cached outputs.
- Flow components
- Get package information
versionInstalled WaveVortexModel version.
Developer Topics
These items document internal implementation details and are not part of the primary public API.
- Projection and reconstruction coefficients
A0NProjects density displacement onto \(A_0\).A0UProjects \(u\) onto \(A_0\).A0VProjects \(v\) onto \(A_0\).A0ZProjects vertical vorticity onto \(A_0\).NA0Reconstructs density displacement from \(A_0\).PA0Reconstructs pressure height from \(A_0\).UA0Reconstructs \(u\) from \(A_0\).VA0Reconstructs \(v\) from \(A_0\).
- Geometry and mode indexing
- Mode numbers and validity
isValidConjugateKLModeNumberreturn 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 numberkMode_dftk mode-number on the DFT gridkMode_wvk mode number on the WV gridlMode_dftl mode-number on the DFT gridlMode_wvl mode number on the WV gridprimaryKLModeNumberFromKLModeNumbertakes any valid WV mode number and returns the primary mode number
- Linear-index conversion
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)klModeNumberFromIndexreturn mode number from a linear index into a WV matrixmodeNumberFromIndexReturn mode numbers for spectral linear indices.
- DFT and WV layout metadata
Nk_dftlength of the k-wavenumber dimension on the DFT gridNl_dftlength of the l-wavenumber dimension on the DFT gridconjugateDimensionassumed conjugate dimensiondftConjugateIndices2Dindex into the DFT grid of the conjugate of each WV modedftPrimaryIndices2Dindex into the DFT grid of each WV modeindicesOfFourierConjugatesa matrix of linear indices of the conjugatek_dftk wavenumber dimension on the DFT gridklwavenumber dimensionl_dftl wavenumber dimension on the DFT gridshouldExcludeConjugateswhether the WV grid excludes redundant Hermitian-conjugate wavenumbersshouldExcludeNyquistwhether the WV grid includes Nyquist wavenumbers
- Layout conversion
indicesFromDFTGridToWVGridindices to convert from DFT to WV gridindicesFromWVGridToDFTGridindices to convert from WV to DFT gridtransformFromDFTGridToWVGridconvert from DFT to WV gridtransformFromSpatialDomainToDFTGridtransform from \((x,y,z)\) to \((k,l,z)\) on the DFT gridtransformFromWVGridToDFTGridconvert from a WV to 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
- Masks and Hermitian bookkeeping
isHermitianCheck if the matrix is Hermitian. Report errors.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 resolvedsetConjugateToUnityset the conjugate of the wavenumber (iK,iL) to 1
- Mode numbers and validity
- Spectral transforms and operators
P0Preconditioner for F, size(P)=[Nj 1]. Fu = uhat, (PF)u = Puhat, so ubar==PuhatPF0size(PF,PG)=[Nj x Nz]PF0invTransformation matricesQ0Preconditioner for G, size(Q)=[Nj 1]. Geta = etahat, (QG)eta = Qetahat, so etabar==Qetahat.QG0dimensionless preconditioned G-mode forward transformationQG0invdimensionless preconditioned G-mode inverse transformationdegreesOfFreedomForComplexMatrixa matrix with the number of degrees-of-freedom at each entrydegreesOfFreedomForRealMatrixa matrix with the number of degrees-of-freedom at each entryfastTransformfast transform objecttransformFromSpatialDomainWithFiotransformFromSpatialDomainWithFouriertransformToSpatialDomainWithFouriertransformToSpatialDomainWithFourierAtPositiontransformWithG_wg
- Nonlinear flux and forcing internals
- Persistence internals
classRequiredPropertyNamesgeometryFromGroupnamesOfRequiredPropertiesForGeometrynamesOfRequiredPropertiesForRotatingFPlanenamesOfRequiredPropertiesForTransformnamesOfTransformVariablesnewNonrequiredPropertyNamesnewRequiredPropertyNamesrequiredPropertiesForGeometryFromGrouprequiredPropertiesForRotatingFPlaneFromGrouprequiredPropertiesForTransformFromGrouptransformFromGroup
- Caches and registries
propertyAnnotationsForGeometryreturn array of CAPropertyAnnotations initialized by defaultpropertyAnnotationsForRotatingFPlane
- Class internals
chebfunForZArraymaxFgmaxFwquadraturePointsForStratifiedFlowreturn the quadrature points for a given stratificationthrowErrorIfDensityViolationchecks if the proposed coefficients are a valid adiabatic re-arrangement of the base stateverticalProjectionOperatorsWithRigidLidreturn the normalized projection operators with prefactors