Skip to content

Commit

Permalink
Merge pull request #3156 from CliMA/zs/lookup_aerosol
Browse files Browse the repository at this point in the history
add lookup table for aerosols
  • Loading branch information
szy21 authored Jul 2, 2024
2 parents e2ea2ca + 4ec78d3 commit bd2750b
Showing 1 changed file with 34 additions and 1 deletion.
35 changes: 34 additions & 1 deletion src/parameterized_tendencies/radiation/RRTMGPInterface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,16 @@ function RRTMGPModel(
end
lookups = (; lookups..., lookup_lw_cld)
end
if radiation_mode.aerosol_radiation
local lookup_lw_aero
data_loader(joinpath("rrtmgp-aerosols-merra-lw.nc")) do ds
lookup_lw_aero =
RRTMGP.LookUpTables.LookUpAerosolMerra(ds, FT, DA)
end
else
lookup_lw_aero = nothing
end
lookups = (; lookups..., lookup_lw_aero)
end

src_lw = RRTMGP.Sources.source_func_longwave(
Expand Down Expand Up @@ -582,6 +592,17 @@ function RRTMGPModel(
end
lookups = (; lookups..., lookup_sw_cld)
end

if radiation_mode.aerosol_radiation
local lookup_sw_aero
data_loader(joinpath("rrtmgp-aerosols-merra-sw.nc")) do ds
lookup_sw_aero =
RRTMGP.LookUpTables.LookUpAerosolMerra(ds, FT, DA)
end
else
lookup_sw_aero = nothing
end
lookups = (; lookups..., lookup_sw_aero)
end

src_sw =
Expand Down Expand Up @@ -787,7 +808,7 @@ function RRTMGPModel(
end

if radiation_mode.aerosol_radiation
aero_type = DA{FT}(undef, nlay, ncol)
aero_type = DA{Int}(undef, nlay, ncol)
name = "center_aerosol_type"
set_and_save!(aero_type, name, t..., dict)
aero_size = DA{FT}(undef, nlay, ncol)
Expand Down Expand Up @@ -1129,13 +1150,16 @@ NVTX.@annotate update_lw_fluxes!(::ClearSkyRadiation, model) =
model.lw_solver,
model.as,
model.lookups.lookup_lw,
nothing,
model.lookups.lookup_lw_aero,
)
NVTX.@annotate update_lw_fluxes!(::AllSkyRadiation, model) =
RRTMGP.RTESolver.solve_lw!(
model.lw_solver,
model.as,
model.lookups.lookup_lw,
model.lookups.lookup_lw_cld,
model.lookups.lookup_lw_aero,
)
NVTX.@annotate function update_lw_fluxes!(
::AllSkyRadiationWithClearSkyDiagnostics,
Expand All @@ -1145,6 +1169,8 @@ NVTX.@annotate function update_lw_fluxes!(
model.lw_solver,
model.as,
model.lookups.lookup_lw,
nothing,
model.lookups.lookup_lw_aero,
)
parent(model.face_clear_lw_flux_up) .= parent(model.face_lw_flux_up)
parent(model.face_clear_lw_flux_dn) .= parent(model.face_lw_flux_dn)
Expand All @@ -1154,6 +1180,7 @@ NVTX.@annotate function update_lw_fluxes!(
model.as,
model.lookups.lookup_lw,
model.lookups.lookup_lw_cld,
model.lookups.lookup_lw_aero,
)
end

Expand All @@ -1164,13 +1191,16 @@ NVTX.@annotate update_sw_fluxes!(::ClearSkyRadiation, model) =
model.sw_solver,
model.as,
model.lookups.lookup_sw,
nothing,
model.lookups.lookup_sw_aero,
)
NVTX.@annotate update_sw_fluxes!(::AllSkyRadiation, model) =
RRTMGP.RTESolver.solve_sw!(
model.sw_solver,
model.as,
model.lookups.lookup_sw,
model.lookups.lookup_sw_cld,
model.lookups.lookup_sw_aero,
)
NVTX.@annotate function update_sw_fluxes!(
::AllSkyRadiationWithClearSkyDiagnostics,
Expand All @@ -1180,6 +1210,8 @@ NVTX.@annotate function update_sw_fluxes!(
model.sw_solver,
model.as,
model.lookups.lookup_sw,
nothing,
model.lookups.lookup_sw_aero,
)
parent(model.face_clear_sw_flux_up) .= parent(model.face_sw_flux_up)
parent(model.face_clear_sw_flux_dn) .= parent(model.face_sw_flux_dn)
Expand All @@ -1191,6 +1223,7 @@ NVTX.@annotate function update_sw_fluxes!(
model.as,
model.lookups.lookup_sw,
model.lookups.lookup_sw_cld,
model.lookups.lookup_sw_aero,
)
end

Expand Down

0 comments on commit bd2750b

Please sign in to comment.