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

Different vertical advection schemes #362

Merged
merged 19 commits into from
Aug 28, 2023
Merged

Different vertical advection schemes #362

merged 19 commits into from
Aug 28, 2023

Conversation

simone-silvestri
Copy link
Collaborator

@simone-silvestri simone-silvestri commented Jul 24, 2023

The objective of this PR is to implement some stable vertical advection schemes (Upwinding and WENO)
Following http://www.gfdl.noaa.gov/idealized-spectral-models-quickstart, it looks like upwinding with semi-implicit time stepping requires reconstructing advected variables from previous time steps.

An example of 10 days simulation with third order upwinding (left) and second order centered advection (right)

Screenshot 2023-07-21 at 6 07 29 PM

@milankl milankl added vertical ⬆️ Affecting the vertical dimension dynamics 〰️ Affects the dynamical core labels Jul 24, 2023
@simone-silvestri
Copy link
Collaborator Author

Difference between upwind third order (top, 3-point stencil) and upwind fifth order (bottom, 5-point stencil)

upwind5-upwind3.mp4

@milankl
Copy link
Member

milankl commented Jul 25, 2023

This is awesome!!

The Jablonowski test case (see also #265) can now be run as follows

using SpeedyWeather

# no mountains, no physics
spectral_grid = SpectralGrid(trunc=31,nlev=8)
orography = NoOrography(spectral_grid);

# I believe I deviated slightly here from the Jablonowski initial temperature profile for the stratosphere, will check
initial_conditions = ZonalWind()
model = PrimitiveDryModel(;spectral_grid,orography,initial_conditions,physics=false);
simulation = initialize!(model);

run!(simulation,n_days=10)

which yields
image

@milankl
Copy link
Member

milankl commented Jul 25, 2023

ZonalWind are the Jablonowski initial conditions with perturbation

julia> initial_conditions = ZonalWind()
ZonalWind <: InitialConditions:
 η₀::Float64 = 0.252
 u₀::Float64 = 35.0
 perturb_lat::Float64 = 40.0
 perturb_lon::Float64 = 20.0
 perturb_uₚ::Float64 = 1.0
 perturb_radius::Float64 = 0.1
 ΔT::Float64 = 0.0
 Tmin::Float64 = 200.0
 pressure_on_orography::Bool = false

But I think they use another ΔT to have an increasing temperature in the stratosphere

@simone-silvestri
Copy link
Collaborator Author

simone-silvestri commented Jul 25, 2023

The results seem to be roughly the same with all advection schemes in this case (probably, there is not much influence of the vertical advection).
I can try increasing the resolution and seeing if the solution varies.

Is there a way to validate the exactness of the solution (i.e., a reference solution?) Or is there a particularly unstable case we can test to see if there is some stability improvement?
Not convecting cases, though since, even if more stable than centered, upwind advection will not cut it

@simone-silvestri
Copy link
Collaborator Author

simone-silvestri commented Jul 26, 2023

Using

spectral_grid = SpectralGrid(trunc=170,nlev=40)

and 30 day time integration

vorticity.mp4
temperature.mp4

src/dynamics/tendencies_dynamics.jl Show resolved Hide resolved
src/dynamics/diagnostic_variables.jl Outdated Show resolved Hide resolved
src/dynamics/diagnostic_variables.jl Outdated Show resolved Hide resolved
src/dynamics/models.jl Outdated Show resolved Hide resolved
@milankl milankl marked this pull request as ready for review August 15, 2023 15:27
@milankl milankl added this to the v0.6 milestone Aug 15, 2023
@milankl
Copy link
Member

milankl commented Aug 15, 2023

Quick speed comparison

image

@milankl
Copy link
Member

milankl commented Aug 23, 2023

@simone-silvestri is there anything you wanted to add here? Have you checked that it's not allocating?

@milankl
Copy link
Member

milankl commented Aug 23, 2023

In https://speedyweather.github.io/SpeedyWeather.jl/previews/PR365/primitiveequation/#Vertical-advection (may need some minutes to build) you can see the current state of the documentation. I won't go into details of the reconstruction and what schemes that means, but if you could have a look at that section and feel free to add anything that's important to understand the code! ❤️

@simone-silvestri
Copy link
Collaborator Author

@simone-silvestri is there anything you wanted to add here? Have you checked that it's not allocating?

I think it is ready to go. I will check that it does not allocate but it shouldn't (only tuples)
I ll also take a look at the documentation and fill it accordingly

@simone-silvestri
Copy link
Collaborator Author

This seems to be ready, should I merge and look at the docs in your new PR? Should I add some tests before?

@milankl milankl merged commit 4952295 into main Aug 28, 2023
@milankl milankl deleted the ss/vertical_upwinding branch September 7, 2023 21:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dynamics 〰️ Affects the dynamical core vertical ⬆️ Affecting the vertical dimension
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants