Skip to content

Commit

Permalink
Merge pull request #3150 from CliMA/cs/rcemip_insolation
Browse files Browse the repository at this point in the history
added rcemipii insolation, changed insolation argument
  • Loading branch information
szy21 authored Jun 29, 2024
2 parents ba8e013 + 4ff2565 commit a40b55c
Show file tree
Hide file tree
Showing 27 changed files with 76 additions and 45 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ ClimaAtmos.jl Release Notes

Main
-------
- ![][badge-💥breaking] Change the "idealized_insolation" argument to "insolation",
and add RCEMIP insolation. PR [#3150](https://github.com/CliMA/ClimaAtmos.jl/pull/3150)

v0.26.3
-------
Expand Down
6 changes: 3 additions & 3 deletions config/default_configs/default_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ dt_rad:
idealized_clouds:
help: "Use idealized clouds in radiation model [`false` (default), `true`]"
value: false
idealized_insolation:
help: "Use idealized insolation in radiation model [`false`, `true` (default)]"
value: true
insolation:
help: "Insolation used in radiation model [`idealized` (default), `timevarying`, `rcemipii`]"
value: "idealized"
add_isothermal_boundary_layer:
help: "Add an isothermal boundary layer above the domain top for radiation [`false`, `true` (default)]"
value: true
Expand Down
2 changes: 1 addition & 1 deletion config/gpu_configs/gpu_aquaplanet_dyamond_ss_1process.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dz_top: 3000.0
moist: equil
precip_model: 1M
rad: allskywithclear
idealized_insolation: false
insolation: "timevarying"
dt_rad: 1hours
vert_diff: FriersonDiffusion
implicit_diffusion: true
Expand Down
2 changes: 1 addition & 1 deletion config/gpu_configs/gpu_aquaplanet_dyamond_ss_2process.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dz_top: 3000.0
moist: "equil"
precip_model: "1M"
rad: "allskywithclear"
idealized_insolation: false
insolation: "timevarying"
dt_rad: "1hours"
dt_cloud_fraction: "1hours"
vert_diff: "FriersonDiffusion"
Expand Down
2 changes: 1 addition & 1 deletion config/gpu_configs/gpu_aquaplanet_dyamond_ss_4process.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dz_top: 3000.0
moist: "equil"
precip_model: "1M"
rad: "allskywithclear"
idealized_insolation: false
insolation: "timevarying"
dt_rad: "1hours"
dt_cloud_fraction: "1hours"
vert_diff: "FriersonDiffusion"
Expand Down
2 changes: 1 addition & 1 deletion config/gpu_configs/gpu_aquaplanet_dyamond_ws_1process.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dz_top: 3000.0
moist: "equil"
precip_model: "1M"
rad: "allskywithclear"
idealized_insolation: false
insolation: "timevarying"
dt_rad: "1hours"
dt_cloud_fraction: "1hours"
vert_diff: "FriersonDiffusion"
Expand Down
2 changes: 1 addition & 1 deletion config/gpu_configs/gpu_aquaplanet_dyamond_ws_2process.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dz_top: 3000.0
moist: "equil"
precip_model: "1M"
rad: "allskywithclear"
idealized_insolation: false
insolation: "timevarying"
dt_rad: "1hours"
dt_cloud_fraction: "1hours"
vert_diff: "FriersonDiffusion"
Expand Down
2 changes: 1 addition & 1 deletion config/gpu_configs/gpu_aquaplanet_dyamond_ws_4process.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dz_top: 3000.0
moist: "equil"
precip_model: "1M"
rad: "allskywithclear"
idealized_insolation: false
insolation: "timevarying"
dt_rad: "1hours"
dt_cloud_fraction: "1hours"
vert_diff: "FriersonDiffusion"
Expand Down
2 changes: 1 addition & 1 deletion config/longrun_configs/amip_target_diagedmf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ override_τ_precip: false
rad: "allskywithclear"
dt_rad: "1hours"
dt_cloud_fraction: "1hours"
idealized_insolation: false
insolation: "timevarying"
surface_setup: "DefaultMoninObukhov"
turbconv: "diagnostic_edmfx"
ode_algo: ARS343
Expand Down
2 changes: 1 addition & 1 deletion config/longrun_configs/longrun_aquaplanet_dyamond.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ moist: "equil"
precip_model: "0M"
cloud_model: "grid_scale"
rad: "allskywithclear"
idealized_insolation: false
insolation: "timevarying"
dt_rad: "1hours"
vert_diff: "true"
surface_setup: "DefaultMoninObukhov"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ vert_diff: "FriersonDiffusion"
implicit_diffusion: true
approximate_linear_solve_iters: 2
rad: "clearsky"
idealized_insolation: false
insolation: "timevarying"
dt_rad: "1hours"
albedo_model: "RegressionFunctionAlbedo"
prognostic_surface: "PrognosticSurfaceTemperature"
Expand Down
2 changes: 1 addition & 1 deletion config/model_configs/aquaplanet_diagedmf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dz_top: 3000.0
moist: equil
surface_setup: DefaultMoninObukhov
rad: allskywithclear
idealized_insolation: false
insolation: "timevarying"
dt_rad: 1hours
dt_cloud_fraction: 1hours
turbconv: diagnostic_edmfx
Expand Down
2 changes: 1 addition & 1 deletion config/model_configs/aquaplanet_progedmf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dz_top: 3000.0
moist: equil
surface_setup: DefaultMoninObukhov
rad: allskywithclear
idealized_insolation: false
insolation: "timevarying"
dt_rad: 1hours
dt_cloud_fraction: 1hours
turbconv: prognostic_edmfx
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ vert_diff: "FriersonDiffusion"
implicit_diffusion: true
approximate_linear_solve_iters: 2
rad: "clearsky"
idealized_insolation: false
insolation: "timevarying"
dt_rad: "1hours"
prognostic_surface: "PrognosticSurfaceTemperature"
check_conservation: true
Expand Down
2 changes: 1 addition & 1 deletion config/model_configs/gpu_aquaplanet_dyamond.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ dz_top: 3000.0
moist: "equil"
precip_model: "1M"
rad: "allskywithclear"
idealized_insolation: false
insolation: "timevarying"
dt_rad: "1hours"
dt_cloud_fraction: "1hours"
vert_diff: "FriersonDiffusion"
Expand Down
1 change: 1 addition & 0 deletions config/model_configs/rcemipii_sphere_diagnostic_edmfx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ rad: allskywithclear
turbconv: diagnostic_edmfx
implicit_diffusion: true
approximate_linear_solve_iters: 2
insolation: rcemipii
prognostic_tke: true
edmfx_upwinding: first_order
edmfx_entr_model: "Generalized"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ dz_top: 10000.0
idealized_clouds: true
dz_bottom: 100.0
config: "column"
idealized_insolation: false
insolation: "timevarying"
z_max: 70000.0
dt_save_to_sol: "30hours"
rad: "allskywithclear"
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ t_end: "15hours"
non_orographic_gravity_wave: true
dz_bottom: 300.0
vert_diff: "true"
idealized_insolation: false
insolation: "timevarying"
z_max: 55000.0
precip_model: "0M"
cloud_model: "grid_scale"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ moist: "equil"
precip_model: "1M"
rad: "allskywithclear"
aerosol_radiation: true
idealized_insolation: false
insolation: "timevarying"
rayleigh_sponge: true
non_orographic_gravity_wave: true
orographic_gravity_wave: "gfdl_restart"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ approximate_linear_solve_iters: 2
moist: "nonequil"
precip_model: "nothing"
rad: "allskywithclear"
idealized_insolation: false
insolation: "timevarying"
rayleigh_sponge: true
surface_setup: "DefaultMoninObukhov"
toml: [toml/sphere_aquaplanet_rhoe_equilmoist_allsky_gw_res.toml]
2 changes: 1 addition & 1 deletion config/perf_configs/flame_perf_gw.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ rayleigh_sponge: true
toml:
- "toml/flame_perf_gw.toml"
orographic_gravity_wave: "raw_topo"
idealized_insolation: false
insolation: "timevarying"
non_orographic_gravity_wave: true
z_max: 55000.0
34 changes: 30 additions & 4 deletions src/callbacks/callbacks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ NVTX.@annotate function rrtmgp_model_callback!(integrator)

(; ᶜts, cloud_diagnostics_tuple, sfc_conditions) = p.precomputed
(; params) = p
(; idealized_insolation, idealized_h2o, idealized_clouds) = p.radiation
(; idealized_h2o, idealized_clouds) = p.radiation
(; ᶠradiation_flux, radiation_model) = p.radiation
(; radiation_mode) = p.atmos

Expand Down Expand Up @@ -128,8 +128,9 @@ NVTX.@annotate function rrtmgp_model_callback!(integrator)
end
end

if !idealized_insolation && !(p.atmos.surface_albedo isa CouplerAlbedo)
set_insolation_variables!(Y, p, t)
if p.atmos.insolation isa IdealizedInsolation ||
!(p.atmos.surface_albedo isa CouplerAlbedo)
set_insolation_variables!(Y, p, t, p.atmos.insolation)
end

if !idealized_clouds && !(
Expand Down Expand Up @@ -176,8 +177,33 @@ NVTX.@annotate function rrtmgp_model_callback!(integrator)
return nothing
end

function set_insolation_variables!(Y, p, t)
#Uniform insolation, magnitudes from Wing et al. (2018)
#Note that the TOA downward shortwave fluxes won't be the same as the values in the paper if add_isothermal_boundary_layer is true
function set_insolation_variables!(Y, p, t, ::RCEMIPIIInsolation)
FT = Spaces.undertype(axes(Y.c))
(; radiation_model) = p.radiation
radiation_model.cos_zenith .= cosd(FT(42.05))
radiation_model.weighted_irradiance .= FT(551.58)
end

function set_insolation_variables!(Y, p, t, ::IdealizedInsolation)
FT = Spaces.undertype(axes(Y.c))
bottom_coords = Fields.coordinate_field(Spaces.level(Y.c, 1))
if eltype(bottom_coords) <: Geometry.LatLongZPoint
latitude = Fields.field2array(bottom_coords.lat)
else
latitude = Fields.field2array(zero(bottom_coords.z)) # flat space is on Equator
end
(; radiation_model) = p.radiation
# perpetual equinox with no diurnal cycle
radiation_model.cos_zenith .= cos(FT(π) / 3)
weighted_irradiance =
@. 1360 * (1 + FT(1.2) / 4 * (1 - 3 * sind(latitude)^2)) /
(4 * cos(FT(π) / 3))
radiation_model.weighted_irradiance .= weighted_irradiance
end

function set_insolation_variables!(Y, p, t, ::TimeVaryingInsolation)
FT = Spaces.undertype(axes(Y.c))
params = p.params
insolation_params = CAP.insolation_params(params)
Expand Down
4 changes: 0 additions & 4 deletions src/parameterized_tendencies/radiation/RRTMGPInterface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,23 @@ using NVTX
abstract type AbstractRRTMGPMode end
struct GrayRadiation <: AbstractRRTMGPMode
idealized_h2o::Bool
idealized_insolation::Bool
idealized_clouds::Bool
add_isothermal_boundary_layer::Bool
end
struct ClearSkyRadiation <: AbstractRRTMGPMode
idealized_h2o::Bool
idealized_insolation::Bool
idealized_clouds::Bool
add_isothermal_boundary_layer::Bool
aerosol_radiation::Bool
end
struct AllSkyRadiation <: AbstractRRTMGPMode
idealized_h2o::Bool
idealized_insolation::Bool
idealized_clouds::Bool
add_isothermal_boundary_layer::Bool
aerosol_radiation::Bool
end
struct AllSkyRadiationWithClearSkyDiagnostics <: AbstractRRTMGPMode
idealized_h2o::Bool
idealized_insolation::Bool
idealized_clouds::Bool
add_isothermal_boundary_layer::Bool
aerosol_radiation::Bool
Expand Down
12 changes: 2 additions & 10 deletions src/parameterized_tendencies/radiation/radiation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function radiation_model_cache(
)
context = ClimaComms.context(axes(Y.c))
device = context.device
(; idealized_h2o, idealized_insolation, idealized_clouds) = radiation_mode
(; idealized_h2o, idealized_clouds) = radiation_mode
if !(radiation_mode isa RRTMGPI.GrayRadiation)
(; aerosol_radiation) = radiation_mode
if aerosol_radiation && !("SO4" in aerosol_names)
Expand Down Expand Up @@ -207,14 +207,7 @@ function radiation_model_cache(
)
end

if idealized_insolation # perpetual equinox with no diurnal cycle
cos_zenith = cos(FT(π) / 3)
weighted_irradiance =
@. 1360 * (1 + FT(1.2) / 4 * (1 - 3 * sind(latitude)^2)) /
(4 * cos_zenith)
else
cos_zenith = weighted_irradiance = NaN # initialized in callback
end
cos_zenith = weighted_irradiance = NaN # initialized in callback

radiation_model = RRTMGPI.RRTMGPModel(
rrtmgp_params,
Expand All @@ -237,7 +230,6 @@ function radiation_model_cache(
)
end
return (;
idealized_insolation,
orbital_data,
idealized_h2o,
idealized_clouds,
Expand Down
18 changes: 12 additions & 6 deletions src/solver/model_getters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,18 @@ function get_sfc_temperature_form(parsed_args)
end
end

function get_insolation_form(parsed_args)
insolation = parsed_args["insolation"]
@assert insolation in ("idealized", "timevarying", "rcemipii")
return if insolation == "idealized"
IdealizedInsolation()
elseif insolation == "timevarying"
TimeVaryingInsolation()
elseif insolation == "rcemipii"
RCEMIPIIInsolation()
end
end

function get_hyperdiffusion_model(parsed_args, ::Type{FT}) where {FT}
hyperdiff_name = parsed_args["hyperdiff"]
if hyperdiff_name in ("ClimaHyperdiffusion", "true", true)
Expand Down Expand Up @@ -202,8 +214,6 @@ end
function get_radiation_mode(parsed_args, ::Type{FT}) where {FT}
idealized_h2o = parsed_args["idealized_h2o"]
@assert idealized_h2o in (true, false)
idealized_insolation = parsed_args["idealized_insolation"]
@assert idealized_insolation in (true, false)
idealized_clouds = parsed_args["idealized_clouds"]
@assert idealized_clouds in (true, false)
add_isothermal_boundary_layer = parsed_args["add_isothermal_boundary_layer"]
Expand All @@ -224,30 +234,26 @@ function get_radiation_mode(parsed_args, ::Type{FT}) where {FT}
return if radiation_name == "clearsky"
RRTMGPI.ClearSkyRadiation(
idealized_h2o,
idealized_insolation,
idealized_clouds,
add_isothermal_boundary_layer,
aerosol_radiation,
)
elseif radiation_name == "gray"
RRTMGPI.GrayRadiation(
idealized_h2o,
idealized_insolation,
idealized_clouds,
add_isothermal_boundary_layer,
)
elseif radiation_name == "allsky"
RRTMGPI.AllSkyRadiation(
idealized_h2o,
idealized_insolation,
idealized_clouds,
add_isothermal_boundary_layer,
aerosol_radiation,
)
elseif radiation_name == "allskywithclear"
RRTMGPI.AllSkyRadiationWithClearSkyDiagnostics(
idealized_h2o,
idealized_insolation,
idealized_clouds,
add_isothermal_boundary_layer,
aerosol_radiation,
Expand Down
1 change: 1 addition & 0 deletions src/solver/type_getters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ function get_atmos(config::AtmosConfig, params)
viscous_sponge = get_viscous_sponge_model(parsed_args, params, FT),
rayleigh_sponge = get_rayleigh_sponge_model(parsed_args, params, FT),
sfc_temperature = get_sfc_temperature_form(parsed_args),
insolation = get_insolation_form(parsed_args),
surface_model = get_surface_model(parsed_args),
surface_albedo = get_surface_albedo_model(parsed_args, params, FT),
numerics = get_numerics(parsed_args),
Expand Down
Loading

0 comments on commit a40b55c

Please sign in to comment.