Skip to content

Commit

Permalink
Merge pull request #639 from CliMA/js/landv0100
Browse files Browse the repository at this point in the history
up dependencies (ClimaAtmos v0.21, ClimaLand v0.10)
  • Loading branch information
juliasloan25 authored Feb 29, 2024
2 parents eccfade + 2d52661 commit 399677c
Show file tree
Hide file tree
Showing 7 changed files with 554 additions and 521 deletions.
10 changes: 5 additions & 5 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ TempestRemap_jll = "8573a8c5-1df0-515e-a024-abad257ee284"
Thermodynamics = "b60c26fb-14c3-4610-9d3e-2d17fe7ff00c"

[compat]
CLIMAParameters = "0.8.1"
ClimaAtmos = "0.20"
CLIMAParameters = "0.9"
ClimaAtmos = "0.21"
ClimaComms = "0.5.6"
ClimaCore = "0.11.8"
ClimaCore = "0.12"
ClimaCoreTempestRemap = "0.3"
ClimaLand = "0.8"
ClimaLand = "0.10"
Dates = "1"
DocStringExtensions = "0.8, 0.9"
Insolation = "0.9"
Expand All @@ -41,5 +41,5 @@ StaticArrays = "1"
Statistics = "1"
SurfaceFluxes = "0.9"
TempestRemap_jll = "2"
Thermodynamics = "0.11"
Thermodynamics = "< 0.12.4"
julia = "1.8"
191 changes: 96 additions & 95 deletions experiments/AMIP/Manifest.toml

Large diffs are not rendered by default.

33 changes: 5 additions & 28 deletions experiments/AMIP/components/land/bucket_init.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import ClimaTimeSteppers as CTS
import Thermodynamics as TD
using Dates: DateTime
using ClimaComms: AbstractCommsContext
import CLIMAParameters

import ClimaLand
using ClimaLand.Bucket: BucketModel, BucketModelParameters, AbstractAtmosphericDrivers, AbstractRadiativeDrivers
Expand All @@ -16,7 +17,6 @@ using ClimaLand:
CoupledRadiativeFluxes,
CoupledAtmosphere
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 @@ -38,28 +38,6 @@ name(::BucketSimulation) = "BucketSimulation"

include("./bucket_utils.jl")

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


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 = ClimaLand.initialize_vars(keys, types, domain_names, coords, model_name)
return vars.drivers
end


"""
temp_anomaly_aquaplanet(coord)
Expand Down Expand Up @@ -89,7 +67,6 @@ function bucket_init(
config::String,
albedo_type::String,
land_temperature_anomaly::String,
comms_ctx::AbstractCommsContext,
regrid_dirpath::String;
space,
dt::Float64,
Expand All @@ -106,21 +83,21 @@ function bucket_init(
@assert config == "sphere"
end

earth_param_set = create_lsm_parameters(FT)
earth_param_set = LP.LandParameters(FT)

α_snow = FT(0.8) # snow albedo
if albedo_type == "map_static" # Read in albedo from static data file (default type)
# By default, this uses a file containing bareground albedo without a time component. Snow albedo is specified separately.
albedo = BulkAlbedoStatic{FT}(regrid_dirpath, comms_ctx, α_snow = α_snow)
albedo = BulkAlbedoStatic{FT}(regrid_dirpath, space, α_snow = α_snow)
elseif albedo_type == "map_temporal" # Read in albedo from data file containing data over time
# By default, this uses a file containing linearly-interpolated monthly data of total albedo, generated by CESM2's land model (CLM).
albedo = BulkAlbedoTemporal{FT}(regrid_dirpath, date_ref, t_start, space)
elseif albedo_type == "function" # Use prescribed function of lat/lon for surface albedo
function α_sfc(coordinate_point)
function α_bareground(coordinate_point)
(; lat, long) = coordinate_point
return typeof(lat)(0.38)
end
albedo = BulkAlbedoFunction{FT}(α_snow, α_sfc)
albedo = BulkAlbedoFunction{FT}(α_snow, α_bareground, space)
else
error("invalid albedo type $albedo_type")
end
Expand Down
3 changes: 0 additions & 3 deletions experiments/AMIP/coupler_driver.jl
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,6 @@ if mode_name == "amip"
config_dict["land_domain_type"],
config_dict["land_albedo_type"],
config_dict["land_temperature_anomaly"],
comms_ctx,
REGRID_DIR;
dt = Δt_cpl,
space = boundary_space,
Expand Down Expand Up @@ -356,7 +355,6 @@ elseif mode_name in ("slabplanet", "slabplanet_aqua", "slabplanet_terra")
config_dict["land_domain_type"],
config_dict["land_albedo_type"],
config_dict["land_temperature_anomaly"],
comms_ctx,
REGRID_DIR;
dt = Δt_cpl,
space = boundary_space,
Expand Down Expand Up @@ -402,7 +400,6 @@ elseif mode_name == "slabplanet_eisenman"
config_dict["land_domain_type"],
config_dict["land_albedo_type"],
config_dict["land_temperature_anomaly"],
comms_ctx,
REGRID_DIR;
dt = Δt_cpl,
space = boundary_space,
Expand Down
Loading

0 comments on commit 399677c

Please sign in to comment.