Skip to content

Commit

Permalink
stubs for structs/types/methods
Browse files Browse the repository at this point in the history
  • Loading branch information
odunbar committed Nov 1, 2024
1 parent 3d3885d commit c00fb82
Show file tree
Hide file tree
Showing 6 changed files with 100 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/ClimaRivers.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
module ClimaRivers

greet() = print("Hello World!")
#using deps:
using LinearAlgebra,
Distributions,
Statistics,
Random,
DocStringExtensions

# includes
include("Environments.jl")
include("States.jl")
include("RiverModels.jl")
include("Routing.jl")
end # module ClimaRivers
16 changes: 16 additions & 0 deletions src/Environments.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Contains the structs that define the static and dynamic environment that configures/forces the river model.

struct StaticEnvironment
# static data objects
end
struct DynamicEnvironment
# timeseries objects
# date/time - index map
end
struct Environment{SE <: StaticEnvironment, DE <: DynamicEnvironment}
static_env::SE
dyn_env::DE
graph::Dict # river graph?
end
# get_static(env, :name)
# get_dynamic(env, :name, time=date/time)
28 changes: 28 additions & 0 deletions src/MizurouteV1.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Contains the Mizuroute model
struct MizurouteHillslopeV1{FT <: AbstractFloat} <: AbstractHillslopeModel
"Shape factor, a (adjusted)"
shape::FT
"Timescale factor, θ [day]"
timescale::FT
end

function MizurouteHillslope{FT}() where {FT <: AbstractFloat}
shape = FT(1.5)
timescale = FT(1.0)
return MizurouteHillslope(shape,timescale)
end


struct MizurouteChannelV1{FT <: AbstractFloat} <: AbstractChannelModel
"Wave velocity, C [m/day]"
wave_velocity::FT
"Diffusivity, D [m²/day] (adjusted)"
diffusivity::FT
end

function MizurouteChannel{FT}() where {FT <: AbstractFloat}
wave_velocity = FT(1.5 * 86400)
diffusivity = FT(8000 * 86400 )
return MizurouteHillslope(wave_velocity, diffusivity)
end

19 changes: 19 additions & 0 deletions src/RiverModels.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Contains the abstract river model types, structs and methods


#general model level
abstract type AbstractRiverModel end

# hillslope-channel model
abstract type AbstractHillslopeModel end
abstract type AbstractChannelModel end

struct HillslopeChannelRiverModel{HS <: AbstractHillslopeModel, CH <: AbstractChannelModel} <: RiverModel
hillslope_model::HS
channel_model::CH
end

# Specific hillslope-channel models loaded here:
include("MizurouteV1.jl")


16 changes: 16 additions & 0 deletions src/Routing.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# general methods for routing rivers

# methods
function calculate_streamflow!(
river_state::RS,
river_model::RM,
environment::E,
) where {
RS <:RiverState,
RM <: AbstractRiverModel,
E <: Environment,
}
# ...most general stub
end


10 changes: 10 additions & 0 deletions src/States.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Contains the structs that are evolved by the river model, and methods to instantiate them

struct RiverState{AM <: AbstractMatrix}
hillslope::AM # instantaneous
channel::AM # instantaneous
graph::Dict # river graph copy?
end

# initialize method
# initialize_state(river_model::HCRM) where {HCRM <: HillslopChannelRiverModel} end

0 comments on commit c00fb82

Please sign in to comment.