Skip to content

Commit

Permalink
alphabetize names, standardize symbols for parametric types
Browse files Browse the repository at this point in the history
  • Loading branch information
kmdeck committed Nov 1, 2024
1 parent f3e8648 commit 040974f
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 94 deletions.
73 changes: 36 additions & 37 deletions src/integrated/land.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,61 +2,61 @@ export LandModel
"""
struct LandModel{
FT,
MM <: Soil.Biogeochemistry.SoilCO2Model{FT},
SM <: Soil.EnergyHydrology{FT},
VM <: Canopy.CanopyModel{FT},
CM <: Canopy.CanopyModel{FT},
SnM <: Snow.SnowModel{FT},
SM <: Soil.EnergyHydrology{FT},
MM <: Soil.Biogeochemistry.SoilCO2Model{FT},
} <: AbstractLandModel{FT}
"The soil microbe model to be used"
soilco2::MM
"The soil model to be used"
soil::SM
"The canopy model to be used"
canopy::VM
canopy::CM
"The snow model to be used"
snow::SnM
end
"The soil model to be used"
soil::SM
"The soil microbe model to be used"
soilco2::MM
A concrete type of land model used for simulating systems with
soil, canopy, snow, soilco2.
$(DocStringExtensions.FIELDS)
"""
struct LandModel{
FT,
MM <: Soil.Biogeochemistry.SoilCO2Model{FT},
SM <: Soil.EnergyHydrology{FT},
VM <: Canopy.CanopyModel{FT},
CM <: Canopy.CanopyModel{FT},
SnM <: Snow.SnowModel{FT},
SM <: Soil.EnergyHydrology{FT},
MM <: Soil.Biogeochemistry.SoilCO2Model{FT},
} <: AbstractLandModel{FT}
"The soil microbe model to be used"
soilco2::MM
"The soil model to be used"
soil::SM
"The canopy model to be used"
canopy::VM
canopy::CM
"The snow model to be used"
snow::SnM
"The soil model to be used"
soil::SM
"The soil microbe model to be used"
soilco2::MM
end



"""
LandModel{FT}(;
soilco2_type::Type{MM},
soilco2_args::NamedTuple = (;),
land_args::NamedTuple = (;),
soil_model_type::Type{SM},
soil_args::NamedTuple = (;),
canopy_component_types::NamedTuple = (;),
canopy_component_args::NamedTuple = (;),
canopy_model_args::NamedTuple = (;),
snow_model_type::Type{SnM},
snow_args::NamedTuple = (;),
soil_model_type::Type{SM},
soil_args::NamedTuple = (;),
soilco2_type::Type{MM},
soilco2_args::NamedTuple = (;),
) where {
FT,
SnM <: Snow.SnowModel,
SM <: Soil.EnergyHydrology{FT},
MM <: Soil.Biogeochemistry.SoilCO2Model{FT},
SnM <: Snow.SnowModel{FT}
}
A constructor for the `LandModel`, which takes in the concrete model
Expand All @@ -68,23 +68,22 @@ forward in time, including boundary conditions, source terms, and interaction
terms.
"""
function LandModel{FT}(;
soilco2_type::Type{MM},
soilco2_args::NamedTuple = (;),
land_args::NamedTuple = (;),
soil_model_type::Type{SM},
soil_args::NamedTuple = (;),
canopy_component_types::NamedTuple = (;),
canopy_component_args::NamedTuple = (;),
canopy_model_args::NamedTuple = (;),
snow_model_type::Type{SnM},
soil_model_type::Type{SM},
soil_args::NamedTuple = (;),
snow_args::NamedTuple = (;),
soilco2_type::Type{MM},
soilco2_args::NamedTuple = (;),
) where {
FT,
SnM <: Snow.SnowModel,
SM <: Soil.EnergyHydrology{FT},
MM <: Soil.Biogeochemistry.SoilCO2Model{FT},
SnM <: Snow.SnowModel,
}

(; atmos, radiation, soil_organic_carbon) = land_args
# These should always be set by the constructor.
prognostic_land_components = (:canopy, :snow, :soil, :soilco2)
Expand Down Expand Up @@ -177,7 +176,7 @@ function LandModel{FT}(;
)
soilco2 = soilco2_type(; soilco2_args..., drivers = soilco2_drivers)

args = (soilco2, soil, canopy, snow)
args = (canopy, snow, soil, soilco2)
return LandModel{FT, typeof.(args)...}(args...)
end

Expand Down Expand Up @@ -248,13 +247,13 @@ lsm_aux_domain_names(m::LandModel) = (

"""
make_update_boundary_fluxes(
land::LandModel{FT, MM, SM, RM, SnM},
land::LandModel{FT, CM, SnM, SM, MM},
) where {
FT,
CM <: Canopy.CanopyModel{FT},
SnM <: Snow.SnowModel{FT},
SM <: Soil.EnergyHydrology{FT},
MM <: Soil.Biogeochemistry.SoilCO2Model{FT},
SM <: Soil.RichardsModel{FT},
RM <: Canopy.CanopyModel{FT}
SnM <: Snow.SnowModel{FT}
}
A method which makes a function; the returned function
Expand All @@ -266,13 +265,13 @@ This function is called each ode function evaluation, prior to the tendency func
evaluation.
"""
function make_update_boundary_fluxes(
land::LandModel{FT, MM, SM, RM, SnM},
land::LandModel{FT, CM, SnM, SM, MM},
) where {
FT,
MM <: Soil.Biogeochemistry.SoilCO2Model{FT},
SM <: Soil.EnergyHydrology{FT},
RM <: Canopy.CanopyModel{FT},
CM <: Canopy.CanopyModel{FT},
SnM <: Snow.SnowModel{FT},
SM <: Soil.EnergyHydrology{FT},
MM <: Soil.Biogeochemistry.SoilCO2Model{FT},
}
update_soil_bf! = make_update_boundary_fluxes(land.soil)
update_soilco2_bf! = make_update_boundary_fluxes(land.soilco2)
Expand Down
71 changes: 33 additions & 38 deletions src/integrated/soil_canopy_model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,49 +2,48 @@ export SoilCanopyModel
"""
struct SoilCanopyModel{
FT,
MM <: Soil.Biogeochemistry.SoilCO2Model{FT},
SM <: Soil.EnergyHydrology{FT},
VM <: Canopy.CanopyModel{FT},
SM <: Soil.EnergyHydrology{FT},
MM <: Soil.Biogeochemistry.SoilCO2Model{FT},
} <: AbstractLandModel{FT}
"The soil microbe model to be used"
soilco2::MM
"The soil model to be used"
soil::SM
"The canopy model to be used"
canopy::VM
end
"The soil model to be used"
soil::SM
"The soil microbe model to be used"
soilco2::MM
A concrete type of land model used for simulating systems with a
canopy and a soil component.
$(DocStringExtensions.FIELDS)
"""
struct SoilCanopyModel{
FT,
MM <: Soil.Biogeochemistry.SoilCO2Model{FT},
CM <: Canopy.CanopyModel{FT},
SM <: Soil.EnergyHydrology{FT},
VM <: Canopy.CanopyModel{FT},
MM <: Soil.Biogeochemistry.SoilCO2Model{FT},
} <: AbstractLandModel{FT}
"The soil microbe model to be used"
soilco2::MM
"The canopy model to be used"
canopy::CM
"The soil model to be used"
soil::SM
"The canopy model to be used"
canopy::VM
"The soil microbe model to be used"
soilco2::MM
end



"""
SoilCanopyModel{FT}(;
soilco2_type::Type{MM},
soilco2_args::NamedTuple = (;),
land_args::NamedTuple = (;),
soil_model_type::Type{SM},
soil_args::NamedTuple = (;),
canopy_component_types::NamedTuple = (;),
canopy_component_args::NamedTuple = (;),
canopy_model_args::NamedTuple = (;),
) where {
land_args::NamedTuple = (;),
canopy_component_types::NamedTuple = (;),
canopy_component_args::NamedTuple = (;),
canopy_model_args::NamedTuple = (;),
soil_model_type::Type{SM},
soil_args::NamedTuple = (;),
soilco2_type::Type{MM},
soilco2_args::NamedTuple = (;),
) where {
FT,
SM <: Soil.EnergyHydrology{FT},
MM <: Soil.Biogeochemistry.SoilCO2Model{FT},
Expand All @@ -59,14 +58,14 @@ forward in time, including boundary conditions, source terms, and interaction
terms.
"""
function SoilCanopyModel{FT}(;
soilco2_type::Type{MM},
soilco2_args::NamedTuple = (;),
land_args::NamedTuple = (;),
soil_model_type::Type{SM},
soil_args::NamedTuple = (;),
canopy_component_types::NamedTuple = (;),
canopy_component_args::NamedTuple = (;),
canopy_model_args::NamedTuple = (;),
soil_model_type::Type{SM},
soil_args::NamedTuple = (;),
soilco2_type::Type{MM},
soilco2_args::NamedTuple = (;),
) where {
FT,
SM <: Soil.EnergyHydrology{FT},
Expand Down Expand Up @@ -151,12 +150,8 @@ function SoilCanopyModel{FT}(;
atmos,
)
soilco2 = soilco2_type(; soilco2_args..., drivers = soilco2_drivers)

return SoilCanopyModel{FT, typeof(soilco2), typeof(soil), typeof(canopy)}(
soilco2,
soil,
canopy,
)
args = (canopy, soil, soilco2)
return SoilCanopyModel{FT, typeof(args)...}(args...)
end

"""
Expand Down Expand Up @@ -214,12 +209,12 @@ lsm_aux_domain_names(m::SoilCanopyModel) = (

"""
make_update_boundary_fluxes(
land::SoilCanopyModel{FT, MM, SM, RM},
land::SoilCanopyModel{FT, CM, SM, MM}
) where {
FT,
MM <: Soil.Biogeochemistry.SoilCO2Model{FT},
CM <: Canopy.CanopyModel{FT}
SM <: Soil.RichardsModel{FT},
RM <: Canopy.CanopyModel{FT}
MM <: Soil.Biogeochemistry.SoilCO2Model{FT},
}
A method which makes a function; the returned function
Expand All @@ -231,12 +226,12 @@ This function is called each ode function evaluation, prior to the tendency func
evaluation.
"""
function make_update_boundary_fluxes(
land::SoilCanopyModel{FT, MM, SM, RM},
land::SoilCanopyModel{FT, CM, SM, MM},
) where {
FT,
MM <: Soil.Biogeochemistry.SoilCO2Model{FT},
CM <: Canopy.CanopyModel{FT},
SM <: Soil.EnergyHydrology{FT},
RM <: Canopy.CanopyModel{FT},
MM <: Soil.Biogeochemistry.SoilCO2Model{FT},
}
update_soil_bf! = make_update_boundary_fluxes(land.soil)
update_soilco2_bf! = make_update_boundary_fluxes(land.soilco2)
Expand Down
15 changes: 8 additions & 7 deletions src/integrated/soil_energy_hydrology_biogeochemistry.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,29 @@ export LandSoilBiogeochemistry, PrognosticMet
"""
struct LandSoilBiogeochemistry{
FT,
SEH <: Soil.EnergyHydrology{FT},
SB <: Soil.Biogeochemistry.SoilCO2Model{FT},
SM <: Soil.EnergyHydrology{FT},
MM <: Soil.Biogeochemistry.SoilCO2Model{FT},
} <: AbstractLandModel{FT}
A concrete type of land model used for simulating systems with a
soil energy, hydrology, and biogeochemistry component.
$(DocStringExtensions.FIELDS)"""
struct LandSoilBiogeochemistry{
FT,
SEH <: Soil.Soil.EnergyHydrology{FT},
SB <: Soil.Biogeochemistry.SoilCO2Model{FT},
SM <: Soil.Soil.EnergyHydrology{FT},
MM <: Soil.Biogeochemistry.SoilCO2Model{FT},
} <: AbstractLandModel{FT}
"The soil model"
soil::SEH
soil::SM
"The biochemistry model"
soilco2::SB
soilco2::MM
end

"""
LandSoilBiogeochemistry{FT}(;
land_args::NamedTuple,
soil_args::NamedTuple = (;),
biogeochemistry_args::NamedTuple = (;),
soilco2_args::NamedTuple = (;),
) where {FT}
A constructor for the `LandSoilBiogeochemistry` model, which takes in
the required arguments for each component, constructs those models,
Expand Down
Loading

0 comments on commit 040974f

Please sign in to comment.