Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make RRTMGP inherit float type #2634

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions src/parameterized_tendencies/radiation/RRTMGPInterface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,8 @@ function extrap!(::BestFit, p, T, z, p⁺, T⁺, z⁺, p⁺⁺, T⁺⁺, z⁺⁺
@. p = best_fit_p(T, z, p⁺, T⁺, z⁺, p⁺⁺, T⁺⁺, z⁺⁺)
end
function extrap!(::UseSurfaceTempAtBottom, p, T, p⁺, T⁺, p⁺⁺, T⁺⁺, Tₛ, params)
FT = eltype(p)
cₚ = FT(RRTMGP.Parameters.cp_d(params))
R = FT(RRTMGP.Parameters.R_d(params))
cₚ = RRTMGP.Parameters.cp_d(params)
R = RRTMGP.Parameters.R_d(params)
@. T = Tₛ
@. p = p⁺ * (T / T⁺)^(cₚ / R)
end
Expand All @@ -305,10 +304,9 @@ function extrap!(
Tₛ,
params,
)
FT = eltype(p)
g = FT(RRTMGP.Parameters.grav(params))
cₚ = FT(RRTMGP.Parameters.cp_d(params))
R = FT(RRTMGP.Parameters.R_d(params))
g = RRTMGP.Parameters.grav(params)
cₚ = RRTMGP.Parameters.cp_d(params)
R = RRTMGP.Parameters.R_d(params)
@. T = T⁺ + g / cₚ * (z⁺ - z)
@. p = p⁺ * (T / T⁺)^(cₚ / R)
end
Expand Down Expand Up @@ -382,7 +380,6 @@ array.
- `lookup_tables/cloudysky_lw.nc`
- `lookup_tables/clearsky_sw.nc`
- `lookup_tables/cloudysky_sw.nc`
- `FT`: floating-point number type (performance with `Float32` is questionable)
- `DA`: array type (defaults to `CuArray` when a compatible GPU is available)

# Keyword Arguments
Expand Down Expand Up @@ -482,7 +479,6 @@ array.
function RRTMGPModel(
params::RRTMGP.Parameters.ARP,
data_loader::Function,
::Type{FT},
context;
ncol::Int,
domain_nlay::Int,
Expand All @@ -498,9 +494,10 @@ function RRTMGPModel(
add_isothermal_boundary_layer::Bool = false,
max_threads::Int = 256,
kwargs...,
) where {FT <: AbstractFloat}
)
device = ClimaComms.device(context)
DA = ClimaComms.array_type(device)
FT = typeof(params.grav)
# turn kwargs into a Dict, so that values can be dynamically popped from it
dict = Dict(kwargs)

Expand Down
2 changes: 0 additions & 2 deletions src/parameterized_tendencies/radiation/radiation.jl
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,6 @@ function radiation_model_cache(
radiation_model = RRTMGPI.RRTMGPModel(
rrtmgp_params,
data_loader,
# TODO: pass FT through so that it can be controlled at the top-level
Float64,
context;
ncol = length(Spaces.all_nodes(axes(Spaces.level(Y.c, 1)))),
domain_nlay = Spaces.nlevels(axes(Y.c)),
Expand Down
Loading