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

Add boundary fluxes terms to the soil jacobian when running with prescribed atmos #1011

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

kmdeck
Copy link
Member

@kmdeck kmdeck commented Feb 5, 2025

Purpose

Adds infrastructure for adding d(boundary flux)/dY to the Jacobian for the soil model when Atmos-Driven fluxes are used.

Currently sets the contributions to zero, no change in simulations are expected. I turned on the "run benchmarks" to see if there is any impact.

To-do

Content

Adds space to the cache for dLHFdT, dSHFdT, dGHFdT. Currently only the last one is updated/nonzero. The other two are set to zero

These terms will then be used in dFlux/dT dT/d rho e. We allocated space for those in the cache, but they are currently set to zero.

These terms are then added into the jacobian for the soil model.


  • I have read and checked the items on the review checklist.

topBC_op_water = topBC_op_heat
end
# Add term from top boundary condition before applying divergence
# Note: need to pass 3D field on faces to `topBC_op`. Interpolating `K` to faces
Copy link
Member Author

Choose a reason for hiding this comment

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

When you wrote "this is inefficient", why is that?

Copy link
Member Author

Choose a reason for hiding this comment

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

@juliasloan25 do you recall what this was about?

@kmdeck kmdeck mentioned this pull request Feb 5, 2025
1 task
@kmdeck kmdeck changed the title Kd/jacobian boundary flux atmos driven Add boundary fluxes terms to the soil jacobian when running with prescribed atmos Feb 5, 2025
@kmdeck kmdeck requested a review from juliasloan25 February 5, 2025 20:57
ρc = p.soil.sub_sfc_scratch
@. ρc =
volumetric_heat_capacity(p.soil.θ_l, Y.soil.θ_i, ρc_ds, earth_param_set)
ρc_sfc = ClimaLand.Domains.top_center_to_surface(ρc)
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 this is allocating - is there another scratch space we could use?

Copy link
Member Author

Choose a reason for hiding this comment

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

oh! I think top_center_to_surface is OK - because it is just pulling out a view of the field.

ρc = p.soil.sub_sfc_scratch
@. ρc =
volumetric_heat_capacity(p.soil.θ_l, Y.soil.θ_i, ρc_ds, earth_param_set)
ρc_sfc = ClimaLand.Domains.top_center_to_surface(ρc)
Copy link
Member

Choose a reason for hiding this comment

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

same comment as above w.r.t. allocations

src/integrated/soil_snow_model.jl Show resolved Hide resolved
src/standalone/Soil/boundary_conditions.jl Outdated Show resolved Hide resolved
@kmdeck kmdeck marked this pull request as ready for review February 6, 2025 00:02
@kmdeck kmdeck added Run benchmarks Add this label to run benchmarks on clima and removed Run long runs labels Feb 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Run benchmarks Add this label to run benchmarks on clima
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants