Domains
SawyerEliassenSolver.Domains.Grid — Typestruct Grid{T<:Union{Float32, Float64}}The physical grid. $x$ is uniformly spaced and periodic with the left boundary at $x[1]$ and the right boundary at $x[NX + 1] = x[1]$ as is standard for DFTs. $z$ is a standard DCT/DST type II grid – uniformly spaced interior points with the boundaries at $z[1/2]$ and $z[NZ + 1/2]$. The float type of the grid determines the float point precision of the simulation and since we use FFTW is restriced to Float32 or Float64.
Fields
NX::Int64: Number of grid points in $x$NZ::Int64: Number of grid points in $z$x_bounds::Tuple{T, T} where T<:Union{Float32, Float64}: Lower and upper $x$ bounds: $[x₀,x₁)$z_bounds::Tuple{T, T} where T<:Union{Float32, Float64}: Lower and upper $z$ bounds: $[z₀,z₁]$
SawyerEliassenSolver.Domains.Grid — MethodGrid(NX, NZ, x_bounds, z_bounds) -> Any
4 argument constructor for Grid uses the default float type of Float64.
SawyerEliassenSolver.Domains.Grid — MethodGrid(FT, NX, NZ, x_bounds, z_bounds) -> Grid
Create a physical Grid with float type FT and (NX,NZ) points. The lateral bounds, [x₀,x₁) are set with a 2-tuple x_bounds or a single number LX which is equivalent to passing (0, LX). Similarly, the vertical bounds [z₀,z₁] are set by the 2-tuple z_bounds or a height LZ equivalent to (-LZ, 0).
Examples
julia> grid = Grid(256,128,(-1000,1000),(-1,1))
Grid{Float64}:
├── NX: 256
├── NZ: 128
├─── x: [-1000,1000)
└─── z: [-1,1]julia> grid = Grid(Float32,256,128,(-1000,1000),10)
Grid{Float32}:
├── NX: 256
├── NZ: 128
├─── x: [-1000,1000)
└─── z: [-10,0]SawyerEliassenSolver.Domains.gridpoints — Methodgridpoints(
grid::Grid
) -> Tuple{Union{Base.ReshapedArray{Float32, 2, LinRange{Float32, Int64}, Tuple{}}, Base.ReshapedArray{Float64, 2, LinRange{Float64, Int64}, Tuple{}}}, Union{Base.ReshapedArray{Float32, 2, LinRange{Float32, Int64}, Tuple{}}, Base.ReshapedArray{Float64, 2, LinRange{Float64, Int64}, Tuple{}}}}
Get both the $x$ and $z$ gridpoints, reshaped to size (NX,1) and (1,NZ) ready for broadcasting.
SawyerEliassenSolver.Domains.stepsize — Methodstepsize(
grid::Grid
) -> Tuple{Union{Float32, Float64}, Union{Float32, Float64}}
SawyerEliassenSolver.Domains.xgridpoints — Methodxgridpoints(
grid::Grid
) -> Union{LinRange{Float32, Int64}, LinRange{Float64, Int64}}
LinRange of the $x$ gridpoints.
SawyerEliassenSolver.Domains.xstepsize — Methodxstepsize(grid::Grid) -> Union{Float32, Float64}
SawyerEliassenSolver.Domains.zgridpoints — Methodzgridpoints(
grid::Grid
) -> Union{LinRange{Float32, Int64}, LinRange{Float64, Int64}}
LinRange of the $z$ gridpoints.
SawyerEliassenSolver.Domains.zstepsize — Methodzstepsize(grid::Grid) -> Union{Float32, Float64}
SawyerEliassenSolver.Domains.Domain — Typestruct Domain{T<:Union{Float32, Float64}}The domain, both physical and spectral, on which a problem is defined. This struct also stores the FFTW plans for transforming between the physical and spectral representations of variables.
SawyerEliassenSolver.Domains.Domain — MethodDomain(grid::Grid{T}; dealias_x, dealias_z) -> Domain
Construct a domain from a grid. To dealias the products with the background flow a number of the higher wavenumbers can be zeroed out. The number of retained wavenumbers are CNX = grid.NX ÷ 2 - dealias_x and CNZ = grid.NZ - 1 - dealias_z Note that we already drop the Nyquist wavenumber in $x$ as well as the zeroth (barotropic) cosine mode / highest sine mode.
Examples
Build an domain with no dealiasing.
julia> grid = Grid(16,8,1,1);
julia> domain = Domain(grid)
Domain:
├─────────── grid: Grid with eltype Float64 and size (16, 8)
├─────── spectral: Spectral domain of size (9, 8) and spectral resolution (8, 7)
└───── transforms: FFTW transforms: rfft, type II DST and type II DCT.A domain with dealising in the vertical.
julia> grid = Grid(16,8,1,1);
julia> domain = Domain(grid, dealias_z=2)
Domain:
├─────────── grid: Grid with eltype Float64 and size (16, 8)
├─────── spectral: Spectral domain of size (9, 8) and spectral resolution (8, 5)
└───── transforms: FFTW transforms: rfft, type II DST and type II DCT.SawyerEliassenSolver.Domains.consistent_domains — Methodconsistent_domains(a, B...) -> Bool
Check that these variables have the same domain.
SawyerEliassenSolver.Domains.get_domain — FunctionGet the domain this object is defined over.
SawyerEliassenSolver.Domains.gridpoints — Methodgridpoints(
domain::Domain
) -> Tuple{Union{Base.ReshapedArray{Float32, 2, LinRange{Float32, Int64}, Tuple{}}, Base.ReshapedArray{Float64, 2, LinRange{Float64, Int64}, Tuple{}}}, Union{Base.ReshapedArray{Float32, 2, LinRange{Float32, Int64}, Tuple{}}, Base.ReshapedArray{Float64, 2, LinRange{Float64, Int64}, Tuple{}}}}
SawyerEliassenSolver.Domains.resolved_cosine_indices — Methodresolved_cosine_indices(domain::Domain) -> UnitRange{Int64}
SawyerEliassenSolver.Domains.resolved_fourier_indices — Methodresolved_fourier_indices(domain::Domain) -> UnitRange{Int64}
SawyerEliassenSolver.Domains.resolved_sine_indices — Methodresolved_sine_indices(domain::Domain) -> UnitRange{Int64}
SawyerEliassenSolver.Domains.stepsize — Methodstepsize(
domain::Domain
) -> Tuple{Union{Float32, Float64}, Union{Float32, Float64}}
SawyerEliassenSolver.Domains.wavenumbers — Methodwavenumbers(
domain::Domain
) -> Tuple{Union{Base.ReshapedArray{Float32, 2, StepRangeLen{Float32, Float64, Float64, Int64}, Tuple{}}, Base.ReshapedArray{Float64, 2, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}, Tuple{}}}, Union{Base.ReshapedArray{Float32, 2, StepRangeLen{Float32, Float64, Float64, Int64}, Tuple{}}, Base.ReshapedArray{Float64, 2, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}, Tuple{}}}}
Resolved $k_x$ and $k_z$ reshaped to size (CNX,1) and (1,CNZ) ready for broadcasting.
SawyerEliassenSolver.Domains.wavenumbers_full — Methodwavenumbers_full(
domain::Domain
) -> Tuple{Union{Base.ReshapedArray{Float32, 2, StepRangeLen{Float32, Float64, Float64, Int64}, Tuple{}}, Base.ReshapedArray{Float64, 2, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}, Tuple{}}}, Union{Base.ReshapedArray{Float32, 2, StepRangeLen{Float32, Float64, Float64, Int64}, Tuple{}}, Base.ReshapedArray{Float64, 2, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}, Tuple{}}}}
$k_x$ and $k_z$ including unresolved zeroed-out wavenumbers reshaped to size (NX ÷ 2 + 1,1) and (1,NZ) ready for broadcasting.
SawyerEliassenSolver.Domains.xgridpoints — Methodxgridpoints(
domain::Domain
) -> Union{LinRange{Float32, Int64}, LinRange{Float64, Int64}}
SawyerEliassenSolver.Domains.xstepsize — Methodxstepsize(domain::Domain) -> Union{Float32, Float64}
SawyerEliassenSolver.Domains.xwavenumbers — Methodxwavenumbers(
domain::Domain
) -> Union{StepRangeLen{Float32, Float64, Float64, Int64}, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}}
The resolved $x$ wavenumbers $k_x$.
SawyerEliassenSolver.Domains.xwavenumbers_full — Methodxwavenumbers_full(
domain::Domain
) -> Union{StepRangeLen{Float32, Float64, Float64, Int64}, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}}
The $x$ wavenumbers $k_x$ including unresolved zeroed-out wavenumbers.
SawyerEliassenSolver.Domains.zgridpoints — Methodzgridpoints(
domain::Domain
) -> Union{LinRange{Float32, Int64}, LinRange{Float64, Int64}}
SawyerEliassenSolver.Domains.zstepsize — Methodzstepsize(domain::Domain) -> Union{Float32, Float64}
SawyerEliassenSolver.Domains.zwavenumbers — Methodzwavenumbers(
domain::Domain
) -> Union{StepRangeLen{Float32, Float64, Float64, Int64}, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}}
The resolved $z$ wavenumbers $k_z$.
SawyerEliassenSolver.Domains.zwavenumbers_full — Methodzwavenumbers_full(
domain::Domain
) -> Union{StepRangeLen{Float32, Float64, Float64, Int64}, StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64}}
The $z$ wavenumbers $k_z$ including unresolved zeroed-out wavenumbers.