FourierFlows / FourierFlows.jl

Tools for building fast, hackable, pseudospectral partial differential equation solvers on periodic domains
https://bit.ly/FourierFlows
MIT License
207 stars 29 forks source link

Fix bug in `radialspectrum()` #318

Closed parfenyev closed 2 years ago

parfenyev commented 2 years ago

Fixing bug in the function radialspectrum(). Now the definitions of lshift and kshift are consistent with the operation fftshift.

navidcy commented 2 years ago

You'd probably need to import fftshift, e.g., add it in

https://github.com/parfenyev/FourierFlows.jl/blob/ebeb30c9fed132a97e3bf19870ccd3f18290dc15/src/FourierFlows.jl#L77

parfenyev commented 2 years ago

In your version I have the problem with interpolation:

MethodError: no method matching scale(::Interpolations.BSplineInterpolation{ComplexF64, 2, Matrix{ComplexF64}, BSpline{Linear{Throw{OnGrid}}}, Tuple{Base.OneTo{Int64}, Base.OneTo{Int64}}}, ::Matrix{Float64}, ::StepRangeLen{Float64, Base.TwicePrecision{Float64}, Base.TwicePrecision{Float64}, Int64})
Closest candidates are:
  scale(::AbstractInterpolation{T, N, IT}, ::AbstractRange...) where {T, N, IT} at ~/.julia/packages/Interpolations/y4lLj/src/scaling/scaling.jl:27

Probably, it happens because interpolation works only on uniformly spaced grids and this is the way to control this.

navidcy commented 2 years ago

Yeap, fair. Forget my suggestion then! :)

navidcy commented 2 years ago

Thanks @parfenyev!