Skip to content

Conversation

@juliasloan25
Copy link
Member

@juliasloan25 juliasloan25 commented Mar 21, 2025

Purpose

Update integrated land conservation functions to use the ClimaLand functions introduced in CliMA/ClimaLand.jl#1071. Note that these provide the energy and water per area, so we integrate horizontally via sum. We also convert the volumetric water content to water content.

Since we don't run slabplanet + conservation checks with the integrated land, these functions aren't being exercised, but they may be nice to have in the future.

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

@juliasloan25 juliasloan25 force-pushed the js/conservation branch 3 times, most recently from caeebc2 to 134102c Compare November 6, 2025 23:43
@juliasloan25 juliasloan25 requested a review from kmdeck November 6, 2025 23:44
Copy link
Member

@kmdeck kmdeck left a comment

Choose a reason for hiding this comment

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

This looks right to me! Since sum includes the entire globe (the land domain is the entire surface, not just land), this will include a bunch of ocean points. I think that's OK for checking conservation as long as the fluxes for those points is zero (no change over time, then), but Im not sure they are (maybe coupler needs to multiply them by the land area fraction?)

@juliasloan25
Copy link
Member Author

This looks right to me! Since sum includes the entire globe (the land domain is the entire surface, not just land), this will include a bunch of ocean points. I think that's OK for checking conservation as long as the fluxes for those points is zero (no change over time, then), but Im not sure they are (maybe coupler needs to multiply them by the land area fraction?)

The fluxes from atmosphere to land aren't multiplied by land area fraction - this would give incorrect results if we ever have fractional land fraction (though we don't right now). Maybe instead we could zero out the result of CL.total_energy_per_area where the land fraction is zero. So something like:

function Interfacer.get_field(sim::ClimaLandSimulation, ::Val{:energy})
    CL.total_energy_per_area!
            sim.integrator.p.soil.sfc_scratch,
            sim.model,
            sim.integrator.u,
            sim.integrator.p,
            sim.integrator.t,
     )
    @. sim.integrator.p.soil.sfc_scratch = ifelse(sim.area_fraction == 0, 0, sim.integrator.p.soil.sfc_scratch)
    return sum(sim.integrator.p.soil.sfc_scratch)

and same for water

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants