Closed navidcy closed 2 years ago
90edadb is a temporary hack
Needs to be cleaned up. But seems to work!!
ok @glwagner and @szy21, feel free to review this!
Looks great to me! It seems possible to reuse one
Params
struct by adding a type parameterN
corresponding to the number of layers. Then we can define the aliasesconst SingleLayerParams = Params{1} const TwoLayerParams = Params{2}
I don't see this as necessary for this PR though, just future cleanup.
I agree! Can you open an issue with these ideas for a future cleanup?
This PR attempts to optimize the 2-layer configuration of
MultiLayerQG
module by hard-coding the PV-streamfunction relationships. To do so we create aTwoLayerParams <: AbstractParams
and then use this type to add methods in bothstreamfunctionfrompv!
andpvfromstreamfunction!
functions that include the hard-coded PV-streamfunction relationships for 2-layer configurations.Some benchmarks for 2- and 3-layer configs with
nx = ny = 128
:with
nlayers=2
before this PR
after this PR
with
nlayers=3
(shouldn't be affected by this PR)before this PR
after this PR
1650-fold faster for 2-layer config. We'll take that as an improvement. (Possibly even faster for higher grid resolution!)
Closes #267.