Skip to content

Commit 855d703

Browse files
imreddyTejajuliasloan25
authored andcommitted
store total energy and water in bucket cache
1 parent ee56822 commit 855d703

File tree

1 file changed

+85
-0
lines changed

1 file changed

+85
-0
lines changed

src/standalone/Bucket/Bucket.jl

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,6 +321,8 @@ auxiliary_types(::BucketModel{FT}) where {FT} = (
321321
FT,
322322
FT,
323323
ClimaCore.Geometry.WVector{FT},
324+
FT,
325+
FT,
324326
)
325327
auxiliary_vars(::BucketModel) = (
326328
:q_sfc,
@@ -336,6 +338,8 @@ auxiliary_vars(::BucketModel) = (
336338
:snow_melt,
337339
:infiltration,
338340
:top_bc_wvec,
341+
:total_energy,
342+
:total_water,
339343
)
340344
auxiliary_domain_names(::BucketModel) = (
341345
:surface,
@@ -351,6 +355,8 @@ auxiliary_domain_names(::BucketModel) = (
351355
:surface,
352356
:surface,
353357
:surface,
358+
:surface,
359+
:surface,
354360
)
355361

356362

@@ -497,6 +503,15 @@ function make_update_aux(model::BucketModel{FT}) where {FT}
497503
model.parameters.W_f,
498504
) # Equation (2) of the text.
499505

506+
# Compute the integrated energy and water per area
507+
ClimaLand.total_energy_per_area!(p.bucket.total_energy, model, Y, p, t)
508+
ClimaLand.total_liq_water_vol_per_area!(
509+
p.bucket.total_water,
510+
model,
511+
Y,
512+
p,
513+
t,
514+
)
500515
end
501516
return update_aux!
502517
end
@@ -576,6 +591,76 @@ function surface_air_density(
576591
return p.bucket.ρ_sfc
577592
end
578593

594+
"""
595+
596+
ClimaLand.total_energy_per_area!(
597+
surface_field,
598+
model::BucketModel,
599+
Y,
600+
p,
601+
t,
602+
)
603+
604+
A function which updates `surface_field` in place with the value for
605+
the total energy per unit ground area for the `BucketModel`.
606+
607+
The ground of the bucket model has temperature `Y.bucket.T`, with
608+
volumetric specific heat approximated with the parameter `ρc_soil`.
609+
Additional energy is present due to the latent heat of fusion of
610+
frozen water, in the form of snow. We also add in this energy (below).
611+
We do not model or account for the sensible energy of snow (`ρ_snow T_snow`),
612+
as this is much smaller.
613+
"""
614+
function ClimaLand.total_energy_per_area!(
615+
surface_field,
616+
model::BucketModel,
617+
Y,
618+
p,
619+
t,
620+
)
621+
surface_field .= 0
622+
# Sensible energy of the soil
623+
ClimaCore.Operators.column_integral_definite!(
624+
surface_field,
625+
model.parameters.ρc_soil .* Y.bucket.T,
626+
)
627+
628+
# Latent heat of fusion of frozen water in the snow
629+
surface_field .+=
630+
-LP.LH_f0(model.parameters.earth_param_set) .*
631+
LP.ρ_cloud_liq(model.parameters.earth_param_set) .* Y.bucket.σS
632+
return nothing
633+
end
634+
635+
"""
636+
637+
ClimaLand.total_liq_water_vol_per_area!(
638+
surface_field,
639+
model::BucketModel,
640+
Y,
641+
p,
642+
t,
643+
)
644+
645+
A function which updates `surface_field` in place with the value for
646+
the total water per unit ground area for the `BucketModel`, in kg m⁻².
647+
648+
The total water contained in the bucket is the sum of the
649+
subsurface water storage `W`, the snow water equivalent `σS` and
650+
surface water content `Ws`, times the density of liquid water `ρ_cloud_liq`.
651+
"""
652+
function ClimaLand.total_liq_water_vol_per_area!(
653+
surface_field,
654+
model::BucketModel,
655+
Y,
656+
p,
657+
t,
658+
)
659+
ρ_cloud_liq = LP.ρ_cloud_liq(model.parameters.earth_param_set)
660+
@. surface_field = (Y.bucket.σS + Y.bucket.W + Y.bucket.Ws) * ρ_cloud_liq
661+
return nothing
662+
end
663+
579664
include("./bucket_parameterizations.jl")
580665

581666
end

0 commit comments

Comments
 (0)