Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimized PV inversion for two layer case in MultilayerQG #267

Closed
glwagner opened this issue Nov 16, 2021 · 4 comments · Fixed by #270
Closed

Optimized PV inversion for two layer case in MultilayerQG #267

glwagner opened this issue Nov 16, 2021 · 4 comments · Fixed by #270

Comments

@glwagner
Copy link
Member

Currently we implement "optimized" functions for extracting PV from the QG streamfunction, and vice versa, in the single layer case:

function streamfunctionfrompv!(ψh, qh, params::SingleLayerParams, grid)
@. ψh = -grid.invKrsq * qh
return nothing
end
function pvfromstreamfunction!(qh, ψh, params::SingleLayerParams, grid)
@. qh = -grid.Krsq * ψh
return nothing
end

The inversion is also trivial in the two layer case, so we should support that.

To implement this I propose generalize SingleLayerParams to NLayerParams{N, ...}, where N is the number of layers. Then we have aliases

const SingleLayerParams = NLayerParams{1}
const TwoLayerParams = NLayerParams{2}

and we can implement optimized inversion routines for these two cases.

cc @szy21

@navidcy
Copy link
Member

navidcy commented Nov 16, 2021

This is a duplicate or related to #112

@navidcy
Copy link
Member

navidcy commented Nov 16, 2021

We should resolve this! It’ll make the MultiLayerQG so much faster!

@glwagner
Copy link
Member Author

It's related to #112 but not a duplicate. #112 is about accelerating the arbitrary-layer case. This issue is about accelerating the two layer case.

@glwagner
Copy link
Member Author

I think even if #112 is somehow resolved (eg by using KernelAbstractions --- a good solution for that issue still isn't clear to me), we probably still want to implement a special optimized method for two layer case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants