Skip to content
Open
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
28 changes: 26 additions & 2 deletions experiments/ClimaEarth/components/land/climaland_integrated.jl
Original file line number Diff line number Diff line change
Expand Up @@ -389,13 +389,37 @@ Interfacer.get_field(sim::ClimaLandSimulation, ::Val{:area_fraction}) = sim.area
Interfacer.get_field(sim::ClimaLandSimulation, ::Val{:beta}) =
CL.surface_evaporative_scaling(sim.model, sim.integrator.u, sim.integrator.p)
Interfacer.get_field(sim::ClimaLandSimulation, ::Val{:emissivity}) = sim.integrator.p.ϵ_sfc
Interfacer.get_field(sim::ClimaLandSimulation, ::Val{:energy}) = CL.total_energy(sim.integrator.u, sim.integrator.p)
Interfacer.get_field(sim::ClimaLandSimulation, ::Val{:surface_direct_albedo}) =
CL.surface_albedo(sim.model, sim.integrator.u, sim.integrator.p)
Interfacer.get_field(sim::ClimaLandSimulation, ::Val{:surface_diffuse_albedo}) =
CL.surface_albedo(sim.model, sim.integrator.u, sim.integrator.p)
Interfacer.get_field(sim::ClimaLandSimulation, ::Val{:water}) = CL.total_water(sim.integrator.u, sim.integrator.p)
Interfacer.get_field(sim::ClimaLandSimulation, ::Val{:surface_temperature}) = sim.integrator.p.T_sfc
function Interfacer.get_field(sim::ClimaLandSimulation, ::Val{:energy}, level)
surface_field = similar(sim.integrator.p.soil.sfc_scratch)
return sum(
CL.total_energy_per_area!(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to call total_energy_per_area! and then call sum(surface_field) and return that, since CL.total_energy_per_area! returns nothing

since the similar function allocates, is there another surface field we can use?

surface_field,
sim.model,
sim.integrator.u,
sim.integrator.p,
sim.integrator.t,
sim.integrator.p.soil.sfc_scratch,
),
)
end
function Interfacer.get_field(sim::ClimaLandSimulation, ::Val{:water}, level)
surface_field = similar(sim.integrator.p.soil.sfc_scratch)
return sum(
CL.total_liq_water_vol_per_area!(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

likewise here

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and one other thought is that we will need to multiply by density here or somewhere else to get mass

surface_field,
sim.model,
sim.integrator.u,
sim.integrator.p,
sim.integrator.t,
sim.integrator.p.soil.sfc_scratch,
),
)
end

# Update fields stored in land model sub-components
function Interfacer.update_field!(sim::ClimaLandSimulation, ::Val{:area_fraction}, field)
Expand Down
Loading