Skip to content

Commit

Permalink
Add update_field for emissivity in AtmosModelSim
Browse files Browse the repository at this point in the history
Add emissivity to update_field in the Interfacer,
and add a method definition for it in climaatmos.jl
All 16 bands are set to the same values.
  • Loading branch information
imreddyTeja committed Feb 25, 2025
1 parent 91c6974 commit 854a22d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion experiments/ClimaEarth/components/atmosphere/climaatmos.jl
Original file line number Diff line number Diff line change
Expand Up @@ -232,10 +232,15 @@ function Interfacer.update_field!(atmos_sim::ClimaAtmosSimulation, ::Val{:co2},
@warn("Gray radiation model initialized, skipping CO2 update", maxlog = 1)
return
else
atmos_sim.integrator.p.radiation.rrtmgp_model.volume_mixing_ratio_co2 .= Statistics.mean(parent(field))
atmos_sim.integrator.p.radiation.rrtmgp_model.surface_emissivity .= Statistics.mean(parent(field))
end
end
# extensions required by the Interfacer
function Interfacer.update_field!(sim::ClimaAtmosSimulation, ::Val{:emissivity}, field)
# sets all 16 bands (rows) to the same values
sim.integrator.p.radiation.rrtmgp_model.direct_sw_surface_albedo .=
reshape(CC.Fields.field2array(field), 1, length(parent(field)))
end
function Interfacer.update_field!(sim::ClimaAtmosSimulation, ::Val{:surface_direct_albedo}, field)
sim.integrator.p.radiation.rrtmgp_model.direct_sw_surface_albedo .=
reshape(CC.Fields.field2array(field), 1, length(parent(field)))
Expand Down
1 change: 1 addition & 0 deletions src/Interfacer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ update_field!(
sim::AtmosModelSimulation,
val::Union{
Val{:co2},
Val{:emissivity},
Val{:surface_direct_albedo},
Val{:surface_diffuse_albedo},
Val{:surface_temperature},
Expand Down

0 comments on commit 854a22d

Please sign in to comment.