Skip to content

Commit

Permalink
ClimaLSM -> ClimaLand
Browse files Browse the repository at this point in the history
  • Loading branch information
juliasloan25 committed Feb 9, 2024
1 parent f788189 commit fce1a4f
Show file tree
Hide file tree
Showing 13 changed files with 52 additions and 52 deletions.
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ ClimaAtmos = "b2c96348-7fb7-4fe0-8da9-78d88439e717"
ClimaComms = "3a4d1b5c-c61d-41fd-a00a-5873ba7a1b0d"
ClimaCore = "d414da3d-4745-48bb-8d80-42e94e092884"
ClimaCoreTempestRemap = "d934ef94-cdd4-4710-83d6-720549644b70"
ClimaLSM = "7884a58f-fab6-4fd0-82bb-ecfedb2d8430"
ClimaLand = "08f4d4ce-cf43-44bb-ad95-9d2d5f413532"
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
DocStringExtensions = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
Insolation = "e98cc03f-d57e-4e3c-b70c-8d51efe9e0d8"
Expand All @@ -29,7 +29,7 @@ ClimaAtmos = "0.20"
ClimaComms = "0.5.6"
ClimaCore = "0.11.8"
ClimaCoreTempestRemap = "0.3"
ClimaLSM = "0.7"
ClimaLand = "0.8"
Dates = "1"
DocStringExtensions = "0.8, 0.9"
Insolation = "0.9"
Expand Down
12 changes: 6 additions & 6 deletions experiments/AMIP/Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

julia_version = "1.10.0"
manifest_format = "2.0"
project_hash = "583d53437ea883f44a3bef71d0af7d6b8d674ee0"
project_hash = "53fcf61882faa366d5cca56412a7ec1571e0a8c7"

[[deps.ADTypes]]
git-tree-sha1 = "41c37aa88889c171f1300ceac1313c06e891d245"
Expand Down Expand Up @@ -309,16 +309,16 @@ uuid = "d934ef94-cdd4-4710-83d6-720549644b70"
version = "0.3.12"

[[deps.ClimaCoupler]]
deps = ["CLIMAParameters", "ClimaAtmos", "ClimaComms", "ClimaCore", "ClimaCoreTempestRemap", "ClimaLSM", "Dates", "DocStringExtensions", "Insolation", "JLD2", "NCDatasets", "Plots", "SciMLBase", "StaticArrays", "Statistics", "SurfaceFluxes", "TempestRemap_jll", "Thermodynamics"]
deps = ["CLIMAParameters", "ClimaAtmos", "ClimaComms", "ClimaCore", "ClimaCoreTempestRemap", "ClimaLand", "Dates", "DocStringExtensions", "Insolation", "JLD2", "NCDatasets", "Plots", "SciMLBase", "StaticArrays", "Statistics", "SurfaceFluxes", "TempestRemap_jll", "Thermodynamics"]
path = "../.."
uuid = "4ade58fe-a8da-486c-bd89-46df092ec0c7"
version = "0.1.0"

[[deps.ClimaLSM]]
[[deps.ClimaLand]]
deps = ["Adapt", "ArtifactWrappers", "CFTime", "CSV", "CUDA", "ClimaComms", "ClimaCore", "ClimaCoreTempestRemap", "DataFrames", "Dates", "DocStringExtensions", "Flux", "HTTP", "IntervalSets", "JLD2", "LinearAlgebra", "NCDatasets", "SciMLBase", "StaticArrays", "StatsBase", "SurfaceFluxes", "Thermodynamics", "cuDNN"]
git-tree-sha1 = "63a82b4c5687899b69a362482e5990fd935bc0a5"
uuid = "7884a58f-fab6-4fd0-82bb-ecfedb2d8430"
version = "0.7.0"
git-tree-sha1 = "77a058f6962d15d3c4f259aa716a2e3e079a2ca8"
uuid = "08f4d4ce-cf43-44bb-ad95-9d2d5f413532"
version = "0.8.0"

[[deps.ClimaTimeSteppers]]
deps = ["CUDA", "ClimaComms", "Colors", "DataStructures", "DiffEqBase", "DiffEqCallbacks", "KernelAbstractions", "Krylov", "LinearAlgebra", "LinearOperators", "NVTX", "SciMLBase", "StaticArrays"]
Expand Down
2 changes: 1 addition & 1 deletion experiments/AMIP/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ ClimaCore = "d414da3d-4745-48bb-8d80-42e94e092884"
ClimaCorePlots = "cf7c7e5a-b407-4c48-9047-11a94a308626"
ClimaCoreTempestRemap = "d934ef94-cdd4-4710-83d6-720549644b70"
ClimaCoupler = "4ade58fe-a8da-486c-bd89-46df092ec0c7"
ClimaLSM = "7884a58f-fab6-4fd0-82bb-ecfedb2d8430"
ClimaLand = "08f4d4ce-cf43-44bb-ad95-9d2d5f413532"
ClimaTimeSteppers = "595c0a79-7f3d-439a-bc5a-b232dc3bde79"
CloudMicrophysics = "6a9e3e04-43cd-43ba-94b9-e8782df3c71b"
Colors = "5ae59095-9a9b-59fe-a467-6f913c188581"
Expand Down
2 changes: 1 addition & 1 deletion experiments/AMIP/cli_options.jl
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function argparse_settings()
default = "PrescribedSurface"
"--atmos_config_file"
help = "A yaml file used to set the atmospheric model configuration. If nothing is specified, the default configuration is used."
# ClimaLSM specific
# ClimaLand specific
"--land_albedo_type"
help = "Access land surface albedo information from data file. [`function`, `map_static`, `map_temporal`]"
arg_type = String
Expand Down
24 changes: 12 additions & 12 deletions experiments/AMIP/components/land/bucket_init.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ import Thermodynamics as TD
using Dates: DateTime
using ClimaComms: AbstractCommsContext

import ClimaLSM
using ClimaLSM.Bucket: BucketModel, BucketModelParameters, AbstractAtmosphericDrivers, AbstractRadiativeDrivers
import ClimaLSM.Bucket: BulkAlbedoTemporal, BulkAlbedoStatic, BulkAlbedoFunction
using ClimaLSM:
import ClimaLand
using ClimaLand.Bucket: BucketModel, BucketModelParameters, AbstractAtmosphericDrivers, AbstractRadiativeDrivers
import ClimaLand.Bucket: BulkAlbedoTemporal, BulkAlbedoStatic, BulkAlbedoFunction
using ClimaLand:
make_exp_tendency,
initialize,
make_set_initial_cache,
surface_evaporative_scaling,
CoupledRadiativeFluxes,
CoupledAtmosphere
import ClimaLSM.Parameters as LSMP
include(joinpath(pkgdir(ClimaLSM), "parameters", "create_parameters.jl"))
import ClimaLand.Parameters as LP
include(joinpath(pkgdir(ClimaLand), "parameters", "create_parameters.jl"))

import ClimaCoupler.Interfacer: LandModelSimulation, get_field, update_field!, name
import ClimaCoupler.FieldExchanger: step!, reinit!
Expand All @@ -39,23 +39,23 @@ name(::BucketSimulation) = "BucketSimulation"
include("./bucket_utils.jl")

# TODO remove this function after ClimaLand v0.8.1 update
function ClimaLSM.turbulent_fluxes(atmos::CoupledAtmosphere, model::BucketModel, Y, p, t)
function ClimaLand.turbulent_fluxes(atmos::CoupledAtmosphere, model::BucketModel, Y, p, t)
# coupler has done its thing behind the scenes already
model_name = ClimaLSM.name(model)
model_name = ClimaLand.name(model)
model_cache = getproperty(p, model_name)
return model_cache.turbulent_fluxes
end


function ClimaLSM.initialize_drivers(a::CoupledAtmosphere{FT}, coords) where {FT}
function ClimaLand.initialize_drivers(a::CoupledAtmosphere{FT}, coords) where {FT}
keys = (:P_liq, :P_snow)
types = ([FT for k in keys]...,)
domain_names = ([:surface for k in keys]...,)
model_name = :drivers
# intialize_vars packages the variables as a named tuple,
# as part of a named tuple with `model_name` as the key.
# Here we just want the variable named tuple itself
vars = ClimaLSM.initialize_vars(keys, types, domain_names, coords, model_name)
vars = ClimaLand.initialize_vars(keys, types, domain_names, coords, model_name)
return vars.drivers
end

Expand Down Expand Up @@ -139,7 +139,7 @@ function bucket_init(
n_vertical_elements = 7
# Note that this does not take into account topography of the surface, which is OK for this land model.
# But it must be taken into account when computing surface fluxes, for Δz.
domain = make_lsm_domain(space, (-d_soil, FT(0.0)), n_vertical_elements)
domain = make_land_domain(space, (-d_soil, FT(0.0)), n_vertical_elements)
args = (params, CoupledAtmosphere{FT}(), CoupledRadiativeFluxes{FT}(), domain)
model = BucketModel{FT, typeof.(args)...}(args...)

Expand All @@ -166,7 +166,7 @@ function bucket_init(

exp_tendency! = make_exp_tendency(model)
ode_algo = CTS.ExplicitAlgorithm(stepper)
bucket_ode_function = CTS.ClimaODEFunction(T_exp! = exp_tendency!, dss! = ClimaLSM.dss!)
bucket_ode_function = CTS.ClimaODEFunction(T_exp! = exp_tendency!, dss! = ClimaLand.dss!)
prob = ODEProblem(bucket_ode_function, Y, tspan, p)
integrator = init(prob, ode_algo; dt = dt, saveat = saveat, adaptive = false)

Expand Down
36 changes: 18 additions & 18 deletions experiments/AMIP/components/land/bucket_utils.jl
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
"""
make_lsm_domain(
make_land_domain(
atmos_boundary_space::ClimaCore.Spaces.SpectralElementSpace2D,
zlim::Tuple{FT, FT},
nelements_vert::Int,) where {FT}
Creates the LSM Domain from the horizontal space of the atmosphere, and information
Creates the land model domain from the horizontal space of the atmosphere, and information
about the number of elements and extent of the vertical domain.
"""
function make_lsm_domain(
function make_land_domain(
atmos_boundary_space::ClimaCore.Spaces.SpectralElementSpace2D,
zlim::Tuple{FT, FT},
nelements_vert::Int,
Expand All @@ -32,39 +32,39 @@ function make_lsm_domain(
subsurface_space = ClimaCore.Spaces.ExtrudedFiniteDifferenceSpace(atmos_boundary_space, vert_center_space)
space = (; surface = atmos_boundary_space, subsurface = subsurface_space)

return ClimaLSM.Domains.SphericalShell{FT}(radius, depth, nothing, nelements, npolynomial, space)
return ClimaLand.Domains.SphericalShell{FT}(radius, depth, nothing, nelements, npolynomial, space)
end

# extensions required by Interfacer
get_field(sim::BucketSimulation, ::Val{:surface_temperature}) =
ClimaLSM.surface_temperature(sim.model, sim.integrator.u, sim.integrator.p, sim.integrator.t)
ClimaLand.surface_temperature(sim.model, sim.integrator.u, sim.integrator.p, sim.integrator.t)
get_field(sim::BucketSimulation, ::Val{:surface_humidity}) =
ClimaLSM.surface_specific_humidity(sim.model, sim.integrator.u, sim.integrator.p, sim.integrator.t)
ClimaLand.surface_specific_humidity(sim.model, sim.integrator.u, sim.integrator.p, sim.integrator.t)
get_field(sim::BucketSimulation, ::Val{:roughness_momentum}) = sim.model.parameters.z_0m
get_field(sim::BucketSimulation, ::Val{:roughness_buoyancy}) = sim.model.parameters.z_0b
get_field(sim::BucketSimulation, ::Val{:beta}) =
ClimaLSM.surface_evaporative_scaling(sim.model, sim.integrator.u, sim.integrator.p)
ClimaLand.surface_evaporative_scaling(sim.model, sim.integrator.u, sim.integrator.p)
get_field(sim::BucketSimulation, ::Val{:albedo}) =
ClimaLSM.surface_albedo(sim.model, sim.integrator.u, sim.integrator.p)
ClimaLand.surface_albedo(sim.model, sim.integrator.u, sim.integrator.p)
get_field(sim::BucketSimulation, ::Val{:area_fraction}) = sim.area_fraction
get_field(sim::BucketSimulation, ::Val{:air_density}) = sim.integrator.p.bucket.ρ_sfc

function update_field!(sim::BucketSimulation, ::Val{:turbulent_energy_flux}, field)
parent(sim.integrator.p.bucket.turbulent_fluxes.shf) .= parent(field)
end
function update_field!(sim::BucketSimulation, ::Val{:turbulent_moisture_flux}, field)
ρ_liq = (LSMP.ρ_cloud_liq(sim.model.parameters.earth_param_set))
ρ_liq = (LP.ρ_cloud_liq(sim.model.parameters.earth_param_set))
parent(sim.integrator.p.bucket.turbulent_fluxes.vapor_flux) .= parent(field ./ ρ_liq) # TODO: account for sublimation
end
function update_field!(sim::BucketSimulation, ::Val{:radiative_energy_flux}, field)
parent(sim.integrator.p.bucket.R_n) .= parent(field)
end
function update_field!(sim::BucketSimulation, ::Val{:liquid_precipitation}, field)
ρ_liq = (LSMP.ρ_cloud_liq(sim.model.parameters.earth_param_set))
ρ_liq = (LP.ρ_cloud_liq(sim.model.parameters.earth_param_set))
parent(sim.integrator.p.drivers.P_liq) .= parent(field ./ ρ_liq)
end
function update_field!(sim::BucketSimulation, ::Val{:snow_precipitation}, field)
ρ_ice = (LSMP.ρ_cloud_ice(sim.model.parameters.earth_param_set))
ρ_ice = (LP.ρ_cloud_ice(sim.model.parameters.earth_param_set))
parent(sim.integrator.p.drivers.P_snow) .= parent(field ./ ρ_ice)
end

Expand All @@ -81,7 +81,7 @@ function update_turbulent_fluxes_point!(sim::BucketSimulation, fields::NamedTupl
(; F_turb_energy, F_turb_moisture) = fields
sim.integrator.p.bucket.turbulent_fluxes.shf[colidx] .= F_turb_energy
sim.integrator.p.bucket.turbulent_fluxes.vapor_flux[colidx] .=
F_turb_moisture ./ LSMP.ρ_cloud_liq(sim.model.parameters.earth_param_set)
F_turb_moisture ./ LP.ρ_cloud_liq(sim.model.parameters.earth_param_set)
return nothing
end

Expand Down Expand Up @@ -126,8 +126,8 @@ function get_field(bucket_sim::BucketSimulation, ::Val{:energy})
end

e_per_area .+=
-LSMP.LH_f0(bucket_sim.model.parameters.earth_param_set) .*
LSMP.ρ_cloud_liq(bucket_sim.model.parameters.earth_param_set) .* bucket_sim.integrator.u.bucket.σS
-LP.LH_f0(bucket_sim.model.parameters.earth_param_set) .*
LP.ρ_cloud_liq(bucket_sim.model.parameters.earth_param_set) .* bucket_sim.integrator.u.bucket.σS
return e_per_area
end

Expand All @@ -137,7 +137,7 @@ end
Extension of Interfacer.get_field that provides the total water contained in the bucket, including the liquid water in snow.
"""
function get_field(bucket_sim::BucketSimulation, ::Val{:water})
ρ_cloud_liq = ClimaLSM.LSMP.ρ_cloud_liq(bucket_sim.model.parameters.earth_param_set)
ρ_cloud_liq = ClimaLand.LP.ρ_cloud_liq(bucket_sim.model.parameters.earth_param_set)
return
@. (bucket_sim.integrator.u.bucket.σS + bucket_sim.integrator.u.bucket.W + bucket_sim.integrator.u.bucket.Ws) *
ρ_cloud_liq # kg water / m2
Expand All @@ -149,18 +149,18 @@ Returns the surface temperature of the earth, computed from the state u.
"""
function get_land_temp_from_state(land_sim, u)
# required by viz_explorer.jl
return ClimaLSM.surface_temperature(land_sim.model, u, land_sim.integrator.p, land_sim.integrator.t)
return ClimaLand.surface_temperature(land_sim.model, u, land_sim.integrator.p, land_sim.integrator.t)
end

"""
dss_state!(sim::BucketSimulation)
Perform DSS on the state of a component simulation, intended to be used
before the initial step of a run. This method acts on bucket land simulations.
The `dss!` function of ClimaLSM must be called because it uses either the 2D
The `dss!` function of ClimaLand must be called because it uses either the 2D
or 3D dss buffer stored in the cache depending on space of each variable in
`sim.integrator.u`.
"""
function dss_state!(sim::BucketSimulation)
ClimaLSM.dss!(sim.integrator.u, sim.integrator.p, sim.integrator.t)
ClimaLand.dss!(sim.integrator.u, sim.integrator.p, sim.integrator.t)
end
2 changes: 1 addition & 1 deletion experiments/AMIP/coupler_driver.jl
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ SIC and assuming a 2m thickness of the ice.
In the `SlabPlanet` mode, all ocean and sea ice are dynamical models, namely thermal slabs, with different parameters.
### Land
If evolving, use `ClimaLSM.jl`'s bucket model.
If evolving, use `ClimaLand.jl`'s bucket model.
=#

@info mode_name
Expand Down
2 changes: 1 addition & 1 deletion experiments/ClimaCore/sea_breeze/land_rhs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ function lnd_init(; xmin = -1000, xmax = 1000, helem = 20, npoly = 0)
end

# ## Coupled Land Wrappers
## Land Simulation - later to live in ClimaLSM
## Land Simulation - later to live in ClimaLand
struct LandSim <: AbstractLandSim
integrator::Any
end
Expand Down
12 changes: 6 additions & 6 deletions perf/Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

julia_version = "1.10.0"
manifest_format = "2.0"
project_hash = "b48c593fa4849aac2901b07964ac17f6692837ed"
project_hash = "d466c6535d5038b5212a6962924c2af1f22f20c7"

[[deps.ADTypes]]
git-tree-sha1 = "41c37aa88889c171f1300ceac1313c06e891d245"
Expand Down Expand Up @@ -309,16 +309,16 @@ uuid = "d934ef94-cdd4-4710-83d6-720549644b70"
version = "0.3.12"

[[deps.ClimaCoupler]]
deps = ["CLIMAParameters", "ClimaAtmos", "ClimaComms", "ClimaCore", "ClimaCoreTempestRemap", "ClimaLSM", "Dates", "DocStringExtensions", "Insolation", "JLD2", "NCDatasets", "Plots", "SciMLBase", "StaticArrays", "Statistics", "SurfaceFluxes", "TempestRemap_jll", "Thermodynamics"]
deps = ["CLIMAParameters", "ClimaAtmos", "ClimaComms", "ClimaCore", "ClimaCoreTempestRemap", "ClimaLand", "Dates", "DocStringExtensions", "Insolation", "JLD2", "NCDatasets", "Plots", "SciMLBase", "StaticArrays", "Statistics", "SurfaceFluxes", "TempestRemap_jll", "Thermodynamics"]
path = ".."
uuid = "4ade58fe-a8da-486c-bd89-46df092ec0c7"
version = "0.1.0"

[[deps.ClimaLSM]]
[[deps.ClimaLand]]
deps = ["Adapt", "ArtifactWrappers", "CFTime", "CSV", "CUDA", "ClimaComms", "ClimaCore", "ClimaCoreTempestRemap", "DataFrames", "Dates", "DocStringExtensions", "Flux", "HTTP", "IntervalSets", "JLD2", "LinearAlgebra", "NCDatasets", "SciMLBase", "StaticArrays", "StatsBase", "SurfaceFluxes", "Thermodynamics", "cuDNN"]
git-tree-sha1 = "63a82b4c5687899b69a362482e5990fd935bc0a5"
uuid = "7884a58f-fab6-4fd0-82bb-ecfedb2d8430"
version = "0.7.0"
git-tree-sha1 = "77a058f6962d15d3c4f259aa716a2e3e079a2ca8"
uuid = "08f4d4ce-cf43-44bb-ad95-9d2d5f413532"
version = "0.8.0"

[[deps.ClimaTimeSteppers]]
deps = ["CUDA", "ClimaComms", "Colors", "DataStructures", "DiffEqBase", "DiffEqCallbacks", "KernelAbstractions", "Krylov", "LinearAlgebra", "LinearOperators", "NVTX", "SciMLBase", "StaticArrays"]
Expand Down
2 changes: 1 addition & 1 deletion perf/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ ClimaCore = "d414da3d-4745-48bb-8d80-42e94e092884"
ClimaCorePlots = "cf7c7e5a-b407-4c48-9047-11a94a308626"
ClimaCoreTempestRemap = "d934ef94-cdd4-4710-83d6-720549644b70"
ClimaCoupler = "4ade58fe-a8da-486c-bd89-46df092ec0c7"
ClimaLSM = "7884a58f-fab6-4fd0-82bb-ecfedb2d8430"
ClimaLand = "08f4d4ce-cf43-44bb-ad95-9d2d5f413532"
ClimaTimeSteppers = "595c0a79-7f3d-439a-bc5a-b232dc3bde79"
CloudMicrophysics = "6a9e3e04-43cd-43ba-94b9-e8782df3c71b"
Colors = "5ae59095-9a9b-59fe-a467-6f913c188581"
Expand Down
2 changes: 1 addition & 1 deletion src/ConservationChecker.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ using Dates
using JLD2
using Plots
using ClimaAtmos: RRTMGPI
using ClimaLSM
using ClimaLand
using ClimaCoupler.Utilities: swap_space!
import ClimaCoupler: Interfacer

Expand Down
2 changes: 1 addition & 1 deletion test/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ClimaComms = "3a4d1b5c-c61d-41fd-a00a-5873ba7a1b0d"
ClimaCore = "d414da3d-4745-48bb-8d80-42e94e092884"
ClimaCorePlots = "cf7c7e5a-b407-4c48-9047-11a94a308626"
ClimaCoupler = "4ade58fe-a8da-486c-bd89-46df092ec0c7"
ClimaLSM = "7884a58f-fab6-4fd0-82bb-ecfedb2d8430"
ClimaLand = "08f4d4ce-cf43-44bb-ad95-9d2d5f413532"
ClimaTimeSteppers = "595c0a79-7f3d-439a-bc5a-b232dc3bde79"
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
Downloads = "f43a241f-c20a-4ad4-852c-f6b1247861c6"
Expand Down
2 changes: 1 addition & 1 deletion test/conservation_checker_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ using ClimaCoupler.ConservationChecker:
EnergyConservationCheck, WaterConservationCheck, check_conservation!, plot_global_conservation
using ClimaCore: ClimaCore, Geometry, Meshes, Domains, Topologies, Spaces, Fields, InputOutput
import ClimaCore.InputOutput: read_field
using ClimaLSM
using ClimaLand
using ClimaComms
using Test
using NCDatasets
Expand Down

0 comments on commit fce1a4f

Please sign in to comment.