Skip to content

Commit

Permalink
Add BMI @grid_loc macro to erosion files
Browse files Browse the repository at this point in the history
  • Loading branch information
vers-w committed Nov 26, 2024
1 parent b2ff488 commit 6b62c34
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
6 changes: 3 additions & 3 deletions src/erosion/overland_flow_erosion.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ abstract type AbstractOverlandFlowErosionModel{T} end
struct NoOverlandFlowErosionModel{T} <: AbstractOverlandFlowErosionModel{T} end

## Overland flow structs and functions
@get_units @with_kw struct OverlandFlowErosionVariables{T}
@get_units @grid_loc @with_kw struct OverlandFlowErosionVariables{T}
# Total soil erosion from overland flow
amount::Vector{T} | "t dt-1"
end
Expand All @@ -12,7 +12,7 @@ function OverlandFlowErosionVariables(n; amount::Vector{T} = fill(mv, n)) where
return OverlandFlowErosionVariables{T}(; amount = amount)
end

@get_units @with_kw struct OverlandFlowErosionBC{T}
@get_units @grid_loc @with_kw struct OverlandFlowErosionBC{T}
# Overland flow [m3 s-1]
q::Vector{T}
end
Expand All @@ -22,7 +22,7 @@ function OverlandFlowErosionBC(n; q::Vector{T} = fill(mv, n)) where {T}
end

# ANSWERS specific structs and functions for rainfall erosion
@get_units @with_kw struct OverlandFlowErosionAnswersParameters{T}
@get_units @grid_loc @with_kw struct OverlandFlowErosionAnswersParameters{T}
# Soil erodibility factor
usle_k::Vector{T} | "-"
# Crop management factor
Expand Down
10 changes: 5 additions & 5 deletions src/erosion/rainfall_erosion.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ abstract type AbstractRainfallErosionModel{T} end
struct NoRainfallErosionModel{T} <: AbstractRainfallErosionModel{T} end

## General rainfall erosion functions and structs
@get_units @with_kw struct RainfallErosionModelVariables{T}
@get_units @grid_loc @with_kw struct RainfallErosionModelVariables{T}
# Total soil erosion from rainfall (splash)
amount::Vector{T} | "t dt-1"
end
Expand All @@ -13,7 +13,7 @@ function RainfallErosionModelVariables(n; amount::Vector{T} = fill(mv, n)) where
end

## EUROSEM specific structs and functions for rainfall erosion
@get_units @with_kw struct RainfallErosionEurosemBC{T}
@get_units @grid_loc @with_kw struct RainfallErosionEurosemBC{T}
# precipitation
precipitation::Vector{T} | "mm dt-1"
# Interception
Expand All @@ -35,7 +35,7 @@ function RainfallErosionEurosemBC(
)
end

@get_units @with_kw struct RainfallErosionEurosemParameters{T}
@get_units @grid_loc @with_kw struct RainfallErosionEurosemParameters{T}
# Soil detachability factor
soil_detachability::Vector{T} | "g J-1"
# Exponent EUROSEM
Expand Down Expand Up @@ -156,7 +156,7 @@ function update!(model::RainfallErosionEurosemModel, geometry::LandGeometry, ts)
end

### ANSWERS specific structs and functions for rainfall erosion
@get_units @with_kw struct RainfallErosionAnswersBC{T}
@get_units @grid_loc @with_kw struct RainfallErosionAnswersBC{T}
# precipitation
precipitation::Vector{T} | "mm dt-1"
end
Expand All @@ -165,7 +165,7 @@ function RainfallErosionAnswersBC(n; precipitation::Vector{T} = fill(mv, n)) whe
return RainfallErosionAnswersBC{T}(; precipitation = precipitation)
end

@get_units @with_kw struct RainfallErosionAnswersParameters{T}
@get_units @grid_loc @with_kw struct RainfallErosionAnswersParameters{T}
# Soil erodibility factor
usle_k::Vector{T} | "-"
# Crop management factor
Expand Down
6 changes: 3 additions & 3 deletions src/erosion/river_erosion.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
abstract type AbstractRiverErosionModel{T} end

## Potential direct river erosion structs and functions
@get_units @with_kw struct RiverErosionModelVariables{T}
@get_units @grid_loc @with_kw struct RiverErosionModelVariables{T}
# Potential river bed erosion
bed::Vector{T} | "t dt-1"
# Potential river bank erosion
Expand All @@ -16,7 +16,7 @@ function RiverErosionModelVariables(
return RiverErosionModelVariables{T}(; bed = bed, bank = bank)
end

@get_units @with_kw struct RiverErosionBC{T}
@get_units @grid_loc @with_kw struct RiverErosionBC{T}
# Waterlevel
waterlevel::Vector{T} | "t dt-1"
end
Expand All @@ -26,7 +26,7 @@ function RiverErosionBC(n; waterlevel::Vector{T} = fill(mv, n)) where {T}
end

# Parameters for the Julian Torres river erosion model
@get_units @with_kw struct RiverErosionParameters{T}
@get_units @grid_loc @with_kw struct RiverErosionParameters{T}
# Mean diameter in the river bed/bank
d50::Vector{T} | "mm"
end
Expand Down
6 changes: 3 additions & 3 deletions src/erosion/soil_erosion.jl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
abstract type AbstractSoilErosionModel{T} end

## Total soil erosion and differentiation structs and functions
@get_units @with_kw struct SoilErosionModelVariables{T}
@get_units @grid_loc @with_kw struct SoilErosionModelVariables{T}
# Total soil erosion
amount::Vector{T} | "t dt-1"
# Total clay erosion
Expand Down Expand Up @@ -35,7 +35,7 @@ function SoilErosionModelVariables(
)
end

@get_units @with_kw struct SoilErosionBC{T}
@get_units @grid_loc @with_kw struct SoilErosionBC{T}
# Rainfall erosion
rainfall_erosion::Vector{T} | "t dt-1"
# Overland flow erosion
Expand All @@ -54,7 +54,7 @@ function SoilErosionBC(
end

# Parameters for particle differentiation
@get_units @with_kw struct SoilErosionParameters{T}
@get_units @grid_loc @with_kw struct SoilErosionParameters{T}
# Soil content clay
clay_fraction::Vector{T} | "-"
# Soil content silt
Expand Down

0 comments on commit 6b62c34

Please sign in to comment.