Skip to content

Commit 00ac654

Browse files
committed
use Bucket cached e_per_area
1 parent 9d8808b commit 00ac654

File tree

2 files changed

+1
-37
lines changed

2 files changed

+1
-37
lines changed

experiments/ClimaEarth/components/land/climaland_bucket.jl

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -42,20 +42,6 @@ struct BucketSimulation{
4242
end
4343
Interfacer.name(::BucketSimulation) = "BucketSimulation"
4444

45-
"""
46-
get_new_cache(p, Y, energy_check)
47-
Returns a new `p` with an updated field to store e_per_area if energy conservation
48-
checks are turned on.
49-
"""
50-
function get_new_cache(p, Y, energy_check)
51-
if energy_check
52-
e_per_area_field = CC.Fields.zeros(axes(Y.bucket.W))
53-
return merge(p, (; e_per_area = e_per_area_field))
54-
else
55-
return p
56-
end
57-
end
58-
5945
"""
6046
bucket_init
6147
@@ -76,7 +62,6 @@ function BucketSimulation(
7662
stepper = CTS.RK4(),
7763
albedo_type::String = "map_static",
7864
land_initial_condition::String = "",
79-
energy_check::Bool = false,
8065
parameter_files = [],
8166
) where {FT, TT <: Union{Float64, ITime}}
8267
α_snow = FT(0.8) # snow albedo
@@ -134,9 +119,6 @@ function BucketSimulation(
134119
# Initial conditions with no moisture
135120
Y, p, coords = CL.initialize(model)
136121

137-
# Add space in the cache for the energy if energy checks are enabled
138-
p = get_new_cache(p, Y, energy_check)
139-
140122
# Get temperature anomaly function
141123
T_functions = Dict("aquaplanet" => temp_anomaly_aquaplanet, "amip" => temp_anomaly_amip)
142124
haskey(T_functions, land_temperature_anomaly) ||
@@ -254,23 +236,7 @@ Interfacer.get_field(sim::BucketSimulation, ::Val{:surface_humidity}) =
254236
CL.surface_specific_humidity(nothing, sim.model, sim.integrator.u, sim.integrator.p, sim.integrator.t)
255237
Interfacer.get_field(sim::BucketSimulation, ::Val{:surface_temperature}) =
256238
CL.surface_temperature(sim.model, sim.integrator.u, sim.integrator.p, sim.integrator.t)
257-
258-
"""
259-
Interfacer.get_field(sim::BucketSimulation, ::Val{:energy})
260-
261-
Extension of Interfacer.get_field that provides the total energy contained in the bucket, including the latent heat due to snow melt.
262-
"""
263-
function Interfacer.get_field(sim::BucketSimulation, ::Val{:energy})
264-
# required by ConservationChecker
265-
e_per_area = sim.integrator.p.e_per_area .= 0
266-
CC.Operators.column_integral_definite!(e_per_area, sim.model.parameters.ρc_soil .* sim.integrator.u.bucket.T)
267-
268-
e_per_area .+=
269-
-LP.LH_f0(sim.model.parameters.earth_param_set) .* LP.ρ_cloud_liq(sim.model.parameters.earth_param_set) .*
270-
sim.integrator.u.bucket.σS
271-
272-
return e_per_area
273-
end
239+
Interfacer.get_field(sim::BucketSimulation, ::Val{:energy}) = sim.integrator.p.bucket.e_per_area
274240

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

experiments/ClimaEarth/setup_run.jl

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,6 @@ function CoupledSimulation(config_dict::AbstractDict)
278278
use_land_diagnostics,
279279
albedo_type = land_albedo_type,
280280
land_initial_condition,
281-
energy_check,
282281
parameter_files,
283282
)
284283
elseif land_model == "integrated"
@@ -341,7 +340,6 @@ function CoupledSimulation(config_dict::AbstractDict)
341340
use_land_diagnostics,
342341
albedo_type = land_albedo_type,
343342
land_initial_condition,
344-
energy_check,
345343
parameter_files,
346344
)
347345

0 commit comments

Comments
 (0)