Skip to content
Merged
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ ClimaCoupler.jl Release Notes

### ClimaCoupler features

#### Remove bucket `get_new_cache` PR[#1437](https://github.com/CliMA/ClimaCoupler.jl/pull/1437)

As of ClimaLand v0.16.2, total energy and and water are always stored in the bucket cache.
This PR removes the `get_new_cache`, which allocated space for the energy field,
and instead accesses the cached fields directly.

#### Add option for integrated land spun up IC. PR[#1318](https://github.com/CliMA/ClimaCoupler.jl/pull/1318)

Adds a boolean flag `land_spun_up_ic` that allows the user to request reading integrated land
Expand Down
2 changes: 1 addition & 1 deletion experiments/ClimaEarth/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ ClimaAnalysis = "0.5.10"
ClimaAtmos = "0.27, 0.28, 0.29, 0.30, 0.31"
ClimaCalibrate = "0.1"
ClimaDiagnostics = "0.2.6"
ClimaLand = "0.17"
ClimaLand = "0.17.1"
ClimaOcean = "0.7"
ClimaParams = "0.10"
ClimaTimeSteppers = "0.7, 0.8"
Expand Down
44 changes: 12 additions & 32 deletions experiments/ClimaEarth/components/land/climaland_bucket.jl
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,6 @@ struct BucketSimulation{M <: CL.Bucket.BucketModel, I <: SciMLBase.AbstractODEIn
output_writer::OW
end

"""
get_new_cache(p, Y, energy_check)
Returns a new `p` with an updated field to store e_per_area if energy conservation
checks are turned on.
"""
function get_new_cache(p, Y, energy_check)
if energy_check
e_per_area_field = CC.Fields.zeros(axes(Y.bucket.W))
return merge(p, (; e_per_area = e_per_area_field))
else
return p
end
end

"""
bucket_init

Expand Down Expand Up @@ -140,9 +126,6 @@ function BucketSimulation(
# Initial conditions with no moisture
Y, p, coords = CL.initialize(model)

# Add space in the cache for the energy if energy checks are enabled
p = get_new_cache(p, Y, energy_check)

# Get temperature anomaly function
T_functions = Dict("aquaplanet" => temp_anomaly_aquaplanet, "amip" => temp_anomaly_amip)
haskey(T_functions, land_temperature_anomaly) ||
Expand Down Expand Up @@ -262,29 +245,26 @@ Interfacer.get_field(sim::BucketSimulation, ::Val{:surface_temperature}) =
"""
Interfacer.get_field(sim::BucketSimulation, ::Val{:energy})

Extension of Interfacer.get_field that provides the total energy contained in the bucket, including the latent heat due to snow melt.
"""
function Interfacer.get_field(sim::BucketSimulation, ::Val{:energy})
# required by ConservationChecker
e_per_area = sim.integrator.p.e_per_area .= 0
CC.Operators.column_integral_definite!(e_per_area, sim.model.parameters.ρc_soil .* sim.integrator.u.bucket.T)

e_per_area .+=
-LP.LH_f0(sim.model.parameters.earth_param_set) .* LP.ρ_cloud_liq(sim.model.parameters.earth_param_set) .*
sim.integrator.u.bucket.σS
Extension of Interfacer.get_field that provides the total energy contained in the bucket,
computed from the temperature of the bucket and also including the latent heat of fusion
of frozen water in the snow.

return e_per_area
end
This method is required by the ConservationChecker to check energy conservation.
"""
Interfacer.get_field(sim::BucketSimulation, ::Val{:energy}) = sim.integrator.p.bucket.total_energy

"""
Interfacer.get_field(sim::BucketSimulation, ::Val{:water})

Extension of Interfacer.get_field that provides the total water contained in the bucket, including the liquid water in snow.
Extension of Interfacer.get_field that provides the total water contained in the bucket.
The total water contained in the bucket is the sum of the subsurface water storage `W`,
the snow water equivalent `σS`, and surface water content `Ws`.

This method is required by the ConservationChecker to check water conservation.
"""
function Interfacer.get_field(sim::BucketSimulation, ::Val{:water})
ρ_cloud_liq = CL.LP.ρ_cloud_liq(sim.model.parameters.earth_param_set)
return
@. (sim.integrator.u.bucket.σS + sim.integrator.u.bucket.W + sim.integrator.u.bucket.Ws) * ρ_cloud_liq # kg water / m2
return sim.integrator.p.bucket.total_water .* ρ_cloud_liq # kg water / m2
end

function Interfacer.update_field!(sim::BucketSimulation, ::Val{:air_density}, field)
Expand Down
Loading