Skip to content

Commit

Permalink
limit temperature for radiation
Browse files Browse the repository at this point in the history
  • Loading branch information
szy21 committed Jun 21, 2024
1 parent 35a0822 commit 18be0b1
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 7 deletions.
4 changes: 2 additions & 2 deletions docs/Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -332,9 +332,9 @@ version = "0.2.2"

[[deps.ClimaParams]]
deps = ["DocStringExtensions", "TOML", "Test"]
git-tree-sha1 = "8da1dc4aa297847cf74c51168cab1995e5631eeb"
git-tree-sha1 = "0b5afc75bd3aa7c30d76c2d33b8361f961e86237"
uuid = "5c42b081-d73a-476f-9059-fd94b934656c"
version = "0.10.7"
version = "0.10.8"

[[deps.ClimaTimeSteppers]]
deps = ["ClimaComms", "Colors", "DataStructures", "DiffEqBase", "DiffEqCallbacks", "KernelAbstractions", "Krylov", "LinearAlgebra", "LinearOperators", "NVTX", "SciMLBase", "StaticArrays"]
Expand Down
4 changes: 2 additions & 2 deletions examples/Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -384,9 +384,9 @@ version = "0.2.2"

[[deps.ClimaParams]]
deps = ["DocStringExtensions", "TOML", "Test"]
git-tree-sha1 = "8da1dc4aa297847cf74c51168cab1995e5631eeb"
git-tree-sha1 = "0b5afc75bd3aa7c30d76c2d33b8361f961e86237"
uuid = "5c42b081-d73a-476f-9059-fd94b934656c"
version = "0.10.7"
version = "0.10.8"

[[deps.ClimaTimeSteppers]]
deps = ["ClimaComms", "Colors", "DataStructures", "DiffEqBase", "DiffEqCallbacks", "KernelAbstractions", "Krylov", "LinearAlgebra", "LinearOperators", "NVTX", "SciMLBase", "StaticArrays"]
Expand Down
4 changes: 2 additions & 2 deletions perf/Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -395,9 +395,9 @@ version = "0.2.2"

[[deps.ClimaParams]]
deps = ["DocStringExtensions", "TOML", "Test"]
git-tree-sha1 = "8da1dc4aa297847cf74c51168cab1995e5631eeb"
git-tree-sha1 = "0b5afc75bd3aa7c30d76c2d33b8361f961e86237"
uuid = "5c42b081-d73a-476f-9059-fd94b934656c"
version = "0.10.7"
version = "0.10.8"

[[deps.ClimaTimeSteppers]]
deps = ["ClimaComms", "Colors", "DataStructures", "DiffEqBase", "DiffEqCallbacks", "KernelAbstractions", "Krylov", "LinearAlgebra", "LinearOperators", "NVTX", "SciMLBase", "StaticArrays"]
Expand Down
6 changes: 5 additions & 1 deletion src/callbacks/callbacks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ NVTX.@annotate function rrtmgp_model_callback!(integrator)

FT = Spaces.undertype(axes(Y.c))
thermo_params = CAP.thermodynamics_params(params)
T_min = CAP.optics_lookup_temperature_min(params)
T_max = CAP.optics_lookup_temperature_max(params)

sfc_ts = sfc_conditions.ts
sfc_T =
Expand All @@ -79,7 +81,9 @@ NVTX.@annotate function rrtmgp_model_callback!(integrator)
ᶜp = Fields.array2field(radiation_model.center_pressure, axes(Y.c))
ᶜT = Fields.array2field(radiation_model.center_temperature, axes(Y.c))
@. ᶜp = TD.air_pressure(thermo_params, ᶜts)
@. ᶜT = TD.air_temperature(thermo_params, ᶜts)
# TODO: add these to parameters
@. ᶜT =
min(max(TD.air_temperature(thermo_params, ᶜts), FT(T_min)), FT(T_max))

if !(radiation_model.radiation_mode isa RRTMGPI.GrayRadiation)
ᶜvmr_h2o = Fields.array2field(
Expand Down
2 changes: 2 additions & 0 deletions src/parameters/Parameters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ Base.@kwdef struct ClimaAtmosParameters{
# Radiation
idealized_ocean_albedo::FT
water_refractive_index::FT
optics_lookup_temperature_min::FT
optics_lookup_temperature_max::FT
end

Base.eltype(::ClimaAtmosParameters{FT}) where {FT} = FT
Expand Down
2 changes: 2 additions & 0 deletions src/parameters/create_parameters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ function create_parameter_set(config::AtmosConfig)
:held_suarez_minimum_temperature => :T_min_hs,
:ocean_surface_albedo => :idealized_ocean_albedo,
:water_refractive_index => :water_refractive_index,
:optics_lookup_temperature_min => :optics_lookup_temperature_min,
:optics_lookup_temperature_max => :optics_lookup_temperature_max,
)
parameters = CP.get_parameter_values(toml_dict, name_map, "ClimaAtmos")
return CAP.ClimaAtmosParameters{FT, TP, RP, IP, MPC, MPP, WP, SFP, TCP}(;
Expand Down

0 comments on commit 18be0b1

Please sign in to comment.