Skip to content

Commit

Permalink
Merge pull request #444 from SpeedyWeather/mk/cooling
Browse files Browse the repository at this point in the history
Simple radiation schemes: UniformCooling, TransparentShortwave
  • Loading branch information
milankl authored Feb 16, 2024
2 parents 1486833 + ec4563e commit 2148c0c
Show file tree
Hide file tree
Showing 18 changed files with 112 additions and 1,464 deletions.
4 changes: 2 additions & 2 deletions src/SpeedyWeather.jl
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,8 @@ include("physics/large_scale_condensation.jl")
include("physics/surface_fluxes.jl")
include("physics/convection.jl")
include("physics/zenith.jl")
# include("physics/shortwave_radiation.jl")
# include("physics/longwave_radiation.jl")
include("physics/shortwave_radiation.jl")
include("physics/longwave_radiation.jl")
include("physics/pretty_printing.jl")

# OCEAN AND LAND
Expand Down
2 changes: 1 addition & 1 deletion src/dynamics/initial_conditions.jl
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ function initialize_humidity!( progn::PrognosticVariables,
temp_grid = gridded(progn.layers[end].timesteps[1].temp,model.spectral_transform)
humid_surf_grid = zero(pres_surf_grid)
for ij in eachgridpoint(humid_surf_grid)
q_sat = saturation_humidity(temp_grid[ij],exp(pres_surf_grid[ij]),model.clausis_clapeyron)
q_sat = saturation_humidity(temp_grid[ij],exp(pres_surf_grid[ij]),model.clausius_clapeyron)
humid_surf_grid[ij] = relhumid_ref*q_sat
end

Expand Down
18 changes: 13 additions & 5 deletions src/dynamics/models.jl
Original file line number Diff line number Diff line change
Expand Up @@ -163,13 +163,15 @@ Base.@kwdef mutable struct PrimitiveDryModel{NF<:AbstractFloat, D<:AbstractDevic

# PHYSICS/PARAMETERIZATIONS
physics::Bool = true
boundary_layer_drag::BoundaryLayerDrag{NF} = NoBoundaryLayerDrag(spectral_grid)
boundary_layer_drag::BoundaryLayerDrag{NF} = BulkRichardsonDrag(spectral_grid)
temperature_relaxation::TemperatureRelaxation{NF} = NoTemperatureRelaxation(spectral_grid)
static_energy_diffusion::VerticalDiffusion{NF} = NoVerticalDiffusion(spectral_grid)
surface_thermodynamics::AbstractSurfaceThermodynamics{NF} = SurfaceThermodynamicsConstant(spectral_grid)
surface_wind::AbstractSurfaceWind{NF} = SurfaceWind(spectral_grid)
surface_heat_flux::AbstractSurfaceHeat{NF} = SurfaceSensibleHeat(spectral_grid)

shortwave_radiation::AbstractShortwave{NF} = NoShortwave(spectral_grid)
longwave_radiation::AbstractLongwave{NF} = UniformCooling(spectral_grid)

# NUMERICS
time_stepping::TimeStepper{NF} = Leapfrog(spectral_grid)
spectral_transform::SpectralTransform{NF} = SpectralTransform(spectral_grid)
Expand Down Expand Up @@ -215,6 +217,8 @@ function initialize!(model::PrimitiveDry;time::DateTime = DEFAULT_DATE)
initialize!(model.boundary_layer_drag,model)
initialize!(model.temperature_relaxation,model)
initialize!(model.static_energy_diffusion,model)
initialize!(model.shortwave_radiation,model)
initialize!(model.longwave_radiation,model)

# initial conditions
prognostic_variables = PrognosticVariables(spectral_grid,model)
Expand Down Expand Up @@ -255,8 +259,8 @@ Base.@kwdef mutable struct PrimitiveWetModel{NF<:AbstractFloat, D<:AbstractDevic

# PHYSICS/PARAMETERIZATIONS
physics::Bool = true
clausis_clapeyron::AbstractClausiusClapeyron{NF} = ClausiusClapeyron(spectral_grid,atmosphere)
boundary_layer_drag::BoundaryLayerDrag{NF} = NoBoundaryLayerDrag(spectral_grid)
clausius_clapeyron::AbstractClausiusClapeyron{NF} = ClausiusClapeyron(spectral_grid,atmosphere)
boundary_layer_drag::BoundaryLayerDrag{NF} = BulkRichardsonDrag(spectral_grid)
temperature_relaxation::TemperatureRelaxation{NF} = NoTemperatureRelaxation(spectral_grid)
static_energy_diffusion::VerticalDiffusion{NF} = NoVerticalDiffusion(spectral_grid)
humidity_diffusion::VerticalDiffusion{NF} = NoVerticalDiffusion(spectral_grid)
Expand All @@ -266,7 +270,9 @@ Base.@kwdef mutable struct PrimitiveWetModel{NF<:AbstractFloat, D<:AbstractDevic
surface_heat_flux::AbstractSurfaceHeat{NF} = SurfaceSensibleHeat(spectral_grid)
evaporation::AbstractEvaporation{NF} = SurfaceEvaporation(spectral_grid)
convection::AbstractConvection{NF} = SimplifiedBettsMiller(spectral_grid)

shortwave_radiation::AbstractShortwave{NF} = NoShortwave(spectral_grid)
longwave_radiation::AbstractLongwave{NF} = UniformCooling(spectral_grid)

# NUMERICS
time_stepping::TimeStepper{NF} = Leapfrog(spectral_grid)
spectral_transform::SpectralTransform{NF} = SpectralTransform(spectral_grid)
Expand Down Expand Up @@ -318,6 +324,8 @@ function initialize!(model::PrimitiveWet;time::DateTime = DEFAULT_DATE)
initialize!(model.humidity_diffusion,model)
initialize!(model.large_scale_condensation,model)
initialize!(model.convection,model)
initialize!(model.shortwave_radiation,model)
initialize!(model.longwave_radiation,model)

# initial conditions
prognostic_variables = PrognosticVariables(spectral_grid,model)
Expand Down
8 changes: 2 additions & 6 deletions src/physics/column_variables.jl
Original file line number Diff line number Diff line change
Expand Up @@ -146,15 +146,11 @@ function reset_column!(column::ColumnVariables{NF}) where NF
column.flux_temp_upward .= 0
column.flux_temp_downward .= 0

# Convection
# Convection and precipitation
column.cloud_top = column.nlev+1 # also diagnostic from condensation
column.conditional_instability = false
column.activate_convection = false
column.excess_humid = 0
column.precip_convection = 0

# Large-scale condensation
column.precip_large_scale = 0

return nothing
end

Expand Down
Loading

0 comments on commit 2148c0c

Please sign in to comment.