Skip to content

Commit 1fd5811

Browse files
imreddyTejajuliasloan25
authored andcommitted
Add e_per_area to bucket cache
1 parent 2f3e948 commit 1fd5811

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

src/standalone/Bucket/Bucket.jl

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,7 @@ auxiliary_types(::BucketModel{FT}) where {FT} = (
321321
FT,
322322
FT,
323323
ClimaCore.Geometry.WVector{FT},
324+
FT,
324325
)
325326
auxiliary_vars(::BucketModel) = (
326327
:q_sfc,
@@ -336,6 +337,7 @@ auxiliary_vars(::BucketModel) = (
336337
:snow_melt,
337338
:infiltration,
338339
:top_bc_wvec,
340+
:e_per_area,
339341
)
340342
auxiliary_domain_names(::BucketModel) = (
341343
:surface,
@@ -351,6 +353,7 @@ auxiliary_domain_names(::BucketModel) = (
351353
:surface,
352354
:surface,
353355
:surface,
356+
:surface,
354357
)
355358

356359

@@ -497,6 +500,8 @@ function make_update_aux(model::BucketModel{FT}) where {FT}
497500
model.parameters.W_f,
498501
) # Equation (2) of the text.
499502

503+
# Compute the integrated energy per area
504+
ClimaLand.total_energy_per_area!(p.bucket.e_per_area, model, Y, p, t)
500505
end
501506
return update_aux!
502507
end
@@ -576,6 +581,38 @@ function surface_air_density(
576581
return p.bucket.ρ_sfc
577582
end
578583

584+
"""
585+
586+
ClimaLand.total_energy_per_area!(
587+
surface_field,
588+
model::BucketModel,
589+
Y,
590+
p,
591+
t,
592+
)
593+
594+
A function which updates `surface_field` in place with the value for
595+
the total energy per unit ground area for the `BucketModel`.
596+
"""
597+
function ClimaLand.total_energy_per_area!(
598+
surface_field,
599+
model::BucketModel,
600+
Y,
601+
p,
602+
t,
603+
)
604+
surface_field .= 0
605+
ClimaCore.Operators.column_integral_definite!(
606+
surface_field,
607+
model.parameters.ρc_soil .* Y.bucket.T,
608+
)
609+
610+
surface_field .+=
611+
-LP.LH_f0(model.parameters.earth_param_set) .*
612+
LP.ρ_cloud_liq(model.parameters.earth_param_set) .* Y.bucket.σS
613+
return nothing
614+
end
615+
579616
include("./bucket_parameterizations.jl")
580617

581618
end

0 commit comments

Comments
 (0)