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

LowerTriangularMatrix in PrognVars, DiagnVars +restructured #117

Merged
merged 43 commits into from
Aug 9, 2022

Conversation

milankl
Copy link
Member

@milankl milankl commented Jul 29, 2022

No description provided.

@milankl
Copy link
Member Author

milankl commented Aug 2, 2022

@white-alistair This PR is a bit hectic, but I've been restructuring the PrognosticVariables and DiagnosticVariables such that one can now do something like

julia> using SpeedyWeather
julia> progn,diagn,model = initialize_speedy();
julia> progn.
layers     lmax        mmax        n_leapfrog  nlev        pres

so PrognosticVariables contains another struct with layers and pres (as it's just surface separated). Hence, access to the variables is straight forward like

julia> progn.layers[1].leapfrog[1].vor
32×32 LowerTriangularMatrix{ComplexF32}:
...

and it should be super easy to loop over all layers like (which can be a single loop very early on at every time step)

for layer in progn.layers
    func!(layer,...)
end

@milankl milankl marked this pull request as draft August 2, 2022 20:06
@milankl
Copy link
Member Author

milankl commented Aug 2, 2022

With LowerTriangularMatrix as the default struct for spectral coefficients looping in spectral domain is either as before

for m in 1:mmax+1
    for l in m:mmax+1
        vor[l,m]

or more convenient (and faster)

for lm in eachharmonic(vor)
    vor[lm]

which is equivalent to

for lm in 1:length(vor)
    vor[lm]

@white-alistair
Copy link
Member

@white-alistair This PR is a bit hectic, but I've been restructuring the PrognosticVariables and DiagnosticVariables such that one can now do something like

julia> using SpeedyWeather
julia> progn,diagn,model = initialize_speedy();
julia> progn.
layers     lmax        mmax        n_leapfrog  nlev        pres

so PrognosticVariables contains another struct with layers and pres (as it's just surface separated). Hence, access to the variables is straight forward like

julia> progn.layers[1].leapfrog[1].vor
32×32 LowerTriangularMatrix{ComplexF32}:
...

and it should be super easy to loop over all layers like (which can be a single loop very early on at every time step)

for layer in progn.layers
    func!(layer,...)
end

@milankl looks good, nice one!

I see that you moved the parametrization vars into a file column_variables.jl 👍 On a related note, say there are intermediate quantities used in the calculation of some parametrization, would you put those arrays in the IntermediateVariables struct or the ParametrizationVariables struct?

Let me know if you want an actual review of this at some point.

@milankl
Copy link
Member Author

milankl commented Aug 3, 2022

@white-alistair I answered that question in #118, I suggest creating a ColumnVariables struct.

@milankl milankl changed the title Implement LowerTriangularMatrix for spectral transform LowerTriangularMatrix in PrognVars, DiagnVars restructured Aug 8, 2022
@milankl milankl changed the title LowerTriangularMatrix in PrognVars, DiagnVars restructured LowerTriangularMatrix in PrognVars, DiagnVars +restructured Aug 9, 2022
@milankl milankl marked this pull request as ready for review August 9, 2022 17:14
@milankl milankl merged commit 2878c1d into main Aug 9, 2022
@milankl milankl deleted the mk/trianglemat branch August 10, 2022 11:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants