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

large-scale condensation at <100% #609

Merged
merged 6 commits into from
Nov 26, 2024
Merged

large-scale condensation at <100% #609

merged 6 commits into from
Nov 26, 2024

Conversation

minqi6
Copy link
Collaborator

@minqi6 minqi6 commented Nov 19, 2024

The problem is that large-scale condensation at <100% currently gives negative precipitation as the ImplicitCondensation isn't correctly generalised for other thresholds than 1=100%

from #614

using SpeedyWeather
spectral_grid = SpectralGrid(trunc=31, nlayers=8)
large_scale_condensation = ImplicitCondensation(spectral_grid, relative_humidity_threshold = 0.8)
convection = SimplifiedBettsMiller(spectral_grid)
model = PrimitiveWetModel(; spectral_grid, large_scale_condensation, convection)
simulation = initialize!(model, time=DateTime(2007, 1, 1))
run!(simulation, period=Day(20), output=true)

image

Copy link
Member

@milankl milankl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, fantastic!

@milankl milankl changed the title modified code related to parameter relative_humidity_threshold large-scale precipitation at <100% Nov 19, 2024
@milankl milankl changed the title large-scale precipitation at <100% large-scale condensation at <100% Nov 19, 2024
@milankl
Copy link
Member

milankl commented Nov 19, 2024

The tests are running now, would also want to write some additional ones simply testing what you tried with 0.8, 0.9, 1.0 and checking that a 5-day simulation is stable?

@milankl milankl added bug 🐞 Something isn't working humidity 💧 Affecting the hydrological cycle labels Nov 19, 2024
@milankl
Copy link
Member

milankl commented Nov 19, 2024

  1. We have a changelog that needs to be updated with every pull request, you can write something like - bugfix: large-scale condensation also at <100% [#609](https://github.com/SpeedyWeather/SpeedyWeather.jl/pull/609) this just helps us to keep track of changes that were made in different versions of the model. Past versions have this too but it sometimes also good to have one file with a list of all changes listed by version

  2. The tests we'd need would look something like

@testset "Large-scale condensation" begin
    spectral_grid = SpectralGrid(trunc=31, nlayers=8)
    @testset for r in (0.8, 0.9, 1.0)
        large_scale_condensation = ImplicitCondensation(spectral_grid, relative_humidity_threshold=r)
        model = PrimitiveWetModel(spectral_grid; large_scale_condensation)
        simulation = initialize!(model)
        run!(simulation, period=Day(5))
        
        precip = simulation.diagnostic_variables.physics.precip_large_scale

        for ij in eachindex(precip)
            @test precip[ij] >= 0   # precipitation should always be non-negative
        end
    end
end

I would create a new file in test/large_scale_condensation.jl which then needs to be included in test/runtests.jl

@milankl milankl merged commit d856c99 into SpeedyWeather:main Nov 26, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐞 Something isn't working humidity 💧 Affecting the hydrological cycle
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants