Skip to content
Open
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
1 change: 1 addition & 0 deletions .buildkite/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ steps:
- "julia --project=experiments/ClimaEarth/ -e 'using Pkg; Pkg.develop(path=\".\")'"
- "julia --project=experiments/ClimaEarth/ -e 'using Pkg; Pkg.instantiate(;verbose=true)'"
- "julia --project=experiments/ClimaEarth/ -e 'using Pkg; Pkg.add(\"MPI\"); Pkg.add(\"CUDA\");'"
- "julia --project=experiments/ClimaEarth/ -e 'using Pkg; Pkg.add(Pkg.PackageSpec(;name=\"ClimaLand\", rev=\"tr/add-energy_per_area-bucket\"))'"
- "julia --project=experiments/ClimaEarth/ -e 'using Pkg; Pkg.precompile()'"
Comment on lines +46 to 47
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Non-deterministic package install may override the manifest

Pkg.add(Pkg.PackageSpec(;name="ClimaLand", rev="tr/add-energy_per_area-bucket"))
re-pulls the current branch tip every run and can mismatch the commit hashed in
Manifest-v1.11.toml, defeating reproducible CI.

If the intent is to stay on the commit already in the manifest, this line can be removed entirely.
If you really need a refresh, pin the exact commit hash instead of the branch:

- Pkg.add(Pkg.PackageSpec(;name="ClimaLand", rev="tr/add-energy_per_area-bucket"))
+ Pkg.add(Pkg.PackageSpec(;name="ClimaLand", rev="d5ba1073aa5c015f6d25ee9ace265d63ac421197"))

- "julia --project=experiments/ClimaEarth/ -e 'using Pkg; Pkg.status()'"

Expand Down
6 changes: 4 additions & 2 deletions experiments/ClimaEarth/Manifest-v1.11.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

julia_version = "1.11.4"
manifest_format = "2.0"
project_hash = "b128b4b3c921eda6ebd10795a43db24e86ebb375"
project_hash = "a6b727ee8a2506c47fabb82909c682490f07c2f7"

[[deps.ADTypes]]
git-tree-sha1 = "e2478490447631aedba0823d4d7a80b2cc8cdb32"
Expand Down Expand Up @@ -348,7 +348,9 @@ version = "0.2.13"

[[deps.ClimaLand]]
deps = ["ClimaComms", "ClimaCore", "ClimaDiagnostics", "ClimaUtilities", "Dates", "DocStringExtensions", "Insolation", "Interpolations", "LazyArtifacts", "LinearAlgebra", "NCDatasets", "SciMLBase", "StaticArrays", "SurfaceFluxes", "Thermodynamics"]
git-tree-sha1 = "08d08423e0a955180d3eea39c340b81603a00585"
git-tree-sha1 = "d5ba1073aa5c015f6d25ee9ace265d63ac421197"
repo-rev = "tr/add-energy_per_area-bucket"
repo-url = "https://github.com/CliMA/ClimaLand.jl.git"
uuid = "08f4d4ce-cf43-44bb-ad95-9d2d5f413532"
version = "0.15.14"

Expand Down
36 changes: 1 addition & 35 deletions experiments/ClimaEarth/components/land/climaland_bucket.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,6 @@ struct BucketSimulation{
end
Interfacer.name(::BucketSimulation) = "BucketSimulation"

"""
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 All @@ -76,7 +62,6 @@ function BucketSimulation(
stepper = CTS.RK4(),
albedo_type::String = "map_static",
land_initial_condition::String = "",
energy_check::Bool = false,
parameter_files = [],
) where {FT, TT <: Union{Float64, ITime}}
α_snow = FT(0.8) # snow albedo
Expand Down Expand Up @@ -134,9 +119,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 @@ -254,23 +236,7 @@ Interfacer.get_field(sim::BucketSimulation, ::Val{:surface_humidity}) =
CL.surface_specific_humidity(nothing, sim.model, sim.integrator.u, sim.integrator.p, sim.integrator.t)
Interfacer.get_field(sim::BucketSimulation, ::Val{:surface_temperature}) =
CL.surface_temperature(sim.model, sim.integrator.u, sim.integrator.p, sim.integrator.t)

"""
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

return e_per_area
end
Interfacer.get_field(sim::BucketSimulation, ::Val{:energy}) = sim.integrator.p.e_per_area

"""
Interfacer.get_field(sim::BucketSimulation, ::Val{:water})
Expand Down
2 changes: 0 additions & 2 deletions experiments/ClimaEarth/setup_run.jl
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,6 @@ function CoupledSimulation(config_dict::AbstractDict)
use_land_diagnostics,
albedo_type = land_albedo_type,
land_initial_condition,
energy_check,
parameter_files,
)
elseif land_model == "integrated"
Expand Down Expand Up @@ -341,7 +340,6 @@ function CoupledSimulation(config_dict::AbstractDict)
use_land_diagnostics,
albedo_type = land_albedo_type,
land_initial_condition,
energy_check,
parameter_files,
)

Expand Down