Skip to content

Commit

Permalink
Merge pull request #8 from AshtonSBradley/wave_action
Browse files Browse the repository at this point in the history
add wave_action
  • Loading branch information
AshtonSBradley authored Oct 17, 2023
2 parents ebf6012 + 330de50 commit 8170a27
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/analysis.jl
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ end
kdensity(k,ψ,X,K)
Calculates the angle integrated momentum density ``|\\phi(k)|^2``, at the
points `k`, with the usual radial weight in `k` space ensuring normalization under ∫dk. Arrays `X`, `K` should be computed using `makearrays`.
points `k`, with the usual radial weight in `k` space ensuring normalization under ∫dk. Units will be population per wavenumber. Arrays `X`, `K` should be computed using `makearrays`.
"""
function kdensity(k,psi::Psi{2})
@unpack ψ,X,K = psi;
Expand All @@ -352,6 +352,15 @@ function kdensity(k,psi::Psi{3})
return sinc_reduce(k,X...,C)
end

"""
wave_action(k,ψ,X,K)
Calculates the angle integrated wave-action spectrum ``|\\phi(\\mathbf{k})|^2``, at the
points `k`, without the radial weight in `k` space ensuring normalization under ∫dk. Units will be population per wavenumber cubed. Isotropy is not assumed. Arrays `X`, `K` should be computed using `makearrays`.
"""
wave_action(k,psi::Psi{2}) = kdensity(k,psi::Psi{2}) ./k
wave_action(k,psi::Psi{3}) = kdensity(k,psi::Psi{3})./k^2

"""
incompressible_spectrum(k,ψ)
Expand Down

0 comments on commit 8170a27

Please sign in to comment.