Skip to content

Commit

Permalink
Merge pull request #2795 from CliMA/zs/albedo_param
Browse files Browse the repository at this point in the history
use parameters for surface albedo
  • Loading branch information
szy21 authored Mar 18, 2024
2 parents ac232d9 + 843e74d commit 923f78d
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 11 deletions.
4 changes: 2 additions & 2 deletions docs/Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -327,9 +327,9 @@ weakdeps = ["Krylov"]

[[deps.ClimaParams]]
deps = ["DocStringExtensions", "TOML", "Test"]
git-tree-sha1 = "ec67949db856e01df4cbf7d6ddafefeda02f93ee"
git-tree-sha1 = "1a3d2455fff201bcf130bbd5a71ac16fc3c21fd1"
uuid = "5c42b081-d73a-476f-9059-fd94b934656c"
version = "0.10.3"
version = "0.10.4"

[[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 @@ -345,9 +345,9 @@ version = "0.7.5"

[[deps.ClimaParams]]
deps = ["DocStringExtensions", "TOML", "Test"]
git-tree-sha1 = "ec67949db856e01df4cbf7d6ddafefeda02f93ee"
git-tree-sha1 = "1a3d2455fff201bcf130bbd5a71ac16fc3c21fd1"
uuid = "5c42b081-d73a-476f-9059-fd94b934656c"
version = "0.10.3"
version = "0.10.4"

[[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 @@ -354,9 +354,9 @@ version = "0.7.5"

[[deps.ClimaParams]]
deps = ["DocStringExtensions", "TOML", "Test"]
git-tree-sha1 = "ec67949db856e01df4cbf7d6ddafefeda02f93ee"
git-tree-sha1 = "1a3d2455fff201bcf130bbd5a71ac16fc3c21fd1"
uuid = "5c42b081-d73a-476f-9059-fd94b934656c"
version = "0.10.3"
version = "0.10.4"

[[deps.ClimaTimeSteppers]]
deps = ["ClimaComms", "Colors", "DataStructures", "DiffEqBase", "DiffEqCallbacks", "KernelAbstractions", "Krylov", "LinearAlgebra", "LinearOperators", "NVTX", "SciMLBase", "StaticArrays"]
Expand Down
2 changes: 1 addition & 1 deletion src/cache/surface_albedo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ struct CouplerAlbedo <: SurfaceAlbedoModel end
A constant surface albedo model. The default value is 0.38. It is used purely for idealized experiments.
"""
Base.@kwdef struct ConstantAlbedo{FT} <: SurfaceAlbedoModel
α::FT = 0.38
α::FT
end

"""
Expand Down
3 changes: 3 additions & 0 deletions src/parameters/Parameters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ Base.@kwdef struct ClimaAtmosParameters{FT, TP, RP, IP, MPP, WP, SFP, TCP} <:
zd_viscous::FT
zd_rayleigh::FT
kappa_2_sponge::FT
# Radiation
idealized_ocean_albedo::FT
water_refractive_index::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 @@ -111,6 +111,8 @@ function create_parameter_set(config::AtmosConfig)
:drag_layer_vertical_extent => :σ_b,
:kappa_2_sponge => :kappa_2_sponge,
:held_suarez_minimum_temperature => :T_min_hs,
:ocean_surface_albedo => :idealized_ocean_albedo,
:water_refractive_index => :water_refractive_index,
)
parameters = CP.get_parameter_values(toml_dict, name_map, "ClimaAtmos")
return CAP.ClimaAtmosParameters{FT, TP, RP, IP, MPP, WP, SFP, TCP}(;
Expand Down
6 changes: 3 additions & 3 deletions src/solver/model_getters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -97,15 +97,15 @@ function get_surface_model(parsed_args)
end
end

function get_surface_albedo_model(parsed_args, ::Type{FT}) where {FT}
function get_surface_albedo_model(parsed_args, params, ::Type{FT}) where {FT}
albedo_name = parsed_args["albedo_model"]
return if albedo_name in ("ConstantAlbedo",)
ConstantAlbedo{FT}()
ConstantAlbedo{FT}(; α = params.idealized_ocean_albedo)
elseif albedo_name in ("RegressionFunctionAlbedo",)
isnothing(parsed_args["rad"]) && error(
"Radiation model not specified, so cannot use RegressionFunctionAlbedo",
)
RegressionFunctionAlbedo{FT}()
RegressionFunctionAlbedo{FT}(; n = params.water_refractive_index)
elseif albedo_name in ("CouplerAlbedo",)
CouplerAlbedo()
else
Expand Down
2 changes: 1 addition & 1 deletion src/solver/type_getters.jl
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ function get_atmos(config::AtmosConfig, params)
rayleigh_sponge = get_rayleigh_sponge_model(parsed_args, params, FT),
sfc_temperature = get_sfc_temperature_form(parsed_args),
surface_model = get_surface_model(parsed_args),
surface_albedo = get_surface_albedo_model(parsed_args, FT),
surface_albedo = get_surface_albedo_model(parsed_args, params, FT),
numerics = get_numerics(parsed_args),
)
@assert !@any_reltype(atmos, (UnionAll, DataType))
Expand Down

0 comments on commit 923f78d

Please sign in to comment.