Skip to content

Commit

Permalink
ConstantPressure no op for ShallowWater
Browse files Browse the repository at this point in the history
  • Loading branch information
milankl committed Dec 13, 2024
1 parent 26b4592 commit 70c46d1
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
3 changes: 3 additions & 0 deletions src/dynamics/initial_conditions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,9 @@ function initialize!( progn::PrognosticVariables,
return nothing
end

# for shallow water constant pressure = 0 as pres=interface displacement here
initialize!(::PrognosticVariables, ::ConstantPressure, ::ShallowWater) = nothing

export ConstantRelativeHumidity
@kwdef struct ConstantRelativeHumidity <: AbstractInitialConditions
relhumid_ref::Float64 = 0.7
Expand Down
28 changes: 24 additions & 4 deletions test/forcing_drag.jl
Original file line number Diff line number Diff line change
@@ -1,14 +1,34 @@
@testset "Forcing and drag" begin
@testset "Forcing and drag: 2D" begin
# 2D models
spectral_grid = SpectralGrid(trunc=31, nlayers=1)
drag = JetDrag(spectral_grid, time_scale=Day(6))
forcing = StochasticStirring(spectral_grid)
random_process = SpectralAR1Process(spectral_grid)
initial_conditions = StartFromRest()

@testset for Model in (BarotropicModel, ShallowWaterModel, PrimitiveDryModel, PrimitiveWetModel)
model = Model(spectral_grid; initial_conditions, forcing, drag)
@testset for Model in (BarotropicModel, ShallowWaterModel)
model = Model(spectral_grid; initial_conditions, forcing, drag, random_process)
simulation = initialize!(model)

run!(simulation, period=Day(5))
run!(simulation, period=Day(15), output=true)
@test simulation.model.feedback.nars_detected == false
end
end

@testset "Forcing and drag: 3D" begin

# 3D models
spectral_grid = SpectralGrid(trunc=31, nlayers=8)
drag = JetDrag(spectral_grid, time_scale=Day(6))
forcing = StochasticStirring(spectral_grid)
random_process = SpectralAR1Process(spectral_grid)
initial_conditions = StartFromRest()

@testset for Model in (PrimitiveDryModel, PrimitiveWetModel)
model = Model(spectral_grid; initial_conditions, forcing, drag, random_process)
simulation = initialize!(model)

run!(simulation, period=Day(15), output=true)
@test simulation.model.feedback.nars_detected == false
end
end

0 comments on commit 70c46d1

Please sign in to comment.