CliMA / ClimaCore.jl

CliMA model dycore
https://clima.github.io/ClimaCore.jl/dev
Apache License 2.0
85 stars 8 forks source link

Kinetic energy spectrum #78

Open simonbyrne opened 3 years ago

simonbyrne commented 3 years ago

The easiest way to do this is to probably interpolate to a regular grid (using the same approach we use for plotting), then take the FFT.

tapios commented 3 years ago

We have code for this. It's just a matter of adapting it, e.g., for sphere (https://github.com/CliMA/ClimateMachine.jl/blob/9503cbc83eb098f0d92bef72745a1d214175940c/src/Diagnostics/atmos_gcm_spectra.jl) and for box (https://github.com/CliMA/ClimateMachine.jl/blob/9503cbc83eb098f0d92bef72745a1d214175940c/src/Common/Spectra/power_spectrum_les.jl).

jakebolewski commented 3 years ago

I think the biggest issue with adapting the code is just getting pulling out the components of the field vector and copying them into Array's as we don't support direct indexing on Fields.

That should be straightforward but we need to add Array copy constructors for Fields. you can also call (parent(field)) to get an array that is indexable for people who are implementing this.