diff --git a/docs/src/changelog.md b/docs/src/changelog.md index 27121405a..2b19ed33d 100644 --- a/docs/src/changelog.md +++ b/docs/src/changelog.md @@ -98,6 +98,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 routing](@ref) for a short description. - Local inertial routing to `sbm_gwf` model type. - Water demand and allocation computations for model types `sbm` and `sbm_gwf`. +- Support direct output of melt from snow and glaciers. ## v0.7.3 - 2024-01-12 diff --git a/docs/src/model_docs/params_vertical.md b/docs/src/model_docs/params_vertical.md index 12e52bcd6..d4853bfcf 100644 --- a/docs/src/model_docs/params_vertical.md +++ b/docs/src/model_docs/params_vertical.md @@ -135,7 +135,9 @@ profile `kv` is used and `z_layered` is required as input. | `actleakage` | actual leakage from saturated store | mm Δt``^{-1}`` | - | | `snow` | snow storage | mm | - | | `snowwater` | liquid water content in the snow pack | mm | - | -| `rainfallplusmelt` | snowmelt + precipitation as rainfall | mm Δt``^{-1}`` | - | +| `snowmelt` | melt from now | mm Δt``^{-1}`` | - | +| `glaciermelt` | melt from glaciers | mm Δt``^{-1}`` | - | +| `rainfallplusmelt` | snowmelt (and glaciers) + precipitation as rainfall | mm Δt``^{-1}`` | - | | `tsoil` | top soil temperature | ᵒC | - | | **`leaf_area_index`** | leaf area index | m``^2`` m``{-2}`` | - | | `waterlevel_land` | water level land | mm | - | diff --git a/server/test/client.jl b/server/test/client.jl index 36e6b5dc5..0c36e9ba0 100644 --- a/server/test/client.jl +++ b/server/test/client.jl @@ -32,8 +32,8 @@ end @testset "model information functions" begin @test request((fn = "get_component_name",)) == Dict("component_name" => "sbm") - @test request((fn = "get_input_item_count",)) == Dict("input_item_count" => 207) - @test request((fn = "get_output_item_count",)) == Dict("output_item_count" => 207) + @test request((fn = "get_input_item_count",)) == Dict("input_item_count" => 209) + @test request((fn = "get_output_item_count",)) == Dict("output_item_count" => 209) to_check = [ "vertical.nlayers", "vertical.theta_r", diff --git a/src/sbm.jl b/src/sbm.jl index 60bfc6f24..3055d77a6 100644 --- a/src/sbm.jl +++ b/src/sbm.jl @@ -195,6 +195,10 @@ snow::Vector{T} | "mm" # Liquid water content in the snow pack [mm] snowwater::Vector{T} | "mm" + # Snow melt [mm] + snowmelt::Vector{T} | "mm" + # Glacier melt [mm] + glaciermelt::Vector{T} | "mm" # Snow melt + precipitation as rainfall [mm] rainfallplusmelt::Vector{T} | "mm" # Threshold temperature for snowfall above glacier [ᵒC] @@ -737,6 +741,8 @@ function initialize_sbm(nc, config, riverfrac, inds) cf_soil = cf_soil, snow = zeros(Float, n), snowwater = zeros(Float, n), + snowmelt = fill(mv, n), + glaciermelt = fill(mv, n), rainfallplusmelt = fill(mv, n), tsoil = fill(Float(10.0), n), # glacier parameters @@ -844,6 +850,7 @@ function update_until_snow(sbm::SBM, config) if modelsnow sbm.snow[i] = snow sbm.snowwater[i] = snowwater + sbm.snowmelt[i] = snowmelt sbm.tsoil[i] = tsoil sbm.rainfallplusmelt[i] = rainfallplusmelt end @@ -1207,6 +1214,7 @@ function update_until_recharge(sbm::SBM, config) if modelsnow if modelglacier sbm.snow[i] = snow + sbm.glaciermelt[i] = glaciermelt sbm.glacierstore[i] = glacierstore end end diff --git a/test/bmi.jl b/test/bmi.jl index ba0f3751b..2d43dae52 100644 --- a/test/bmi.jl +++ b/test/bmi.jl @@ -20,8 +20,8 @@ tomlpath = joinpath(@__DIR__, "sbm_config.toml") @testset "model information functions" begin @test BMI.get_component_name(model) == "sbm" - @test BMI.get_input_item_count(model) == 207 - @test BMI.get_output_item_count(model) == 207 + @test BMI.get_input_item_count(model) == 209 + @test BMI.get_output_item_count(model) == 209 to_check = [ "vertical.nlayers", "vertical.theta_r",