diff --git a/server/test/sbm_config.toml b/server/test/sbm_config.toml index 8938a5431..0cea267ab 100644 --- a/server/test/sbm_config.toml +++ b/server/test/sbm_config.toml @@ -95,6 +95,15 @@ river_bank_water__elevation = "RiverZ" land_surface_water_flow__manning_n_parameter = "N" land_surface__slope = "Slope" +reservoir_areas__number = "wflow_reservoirareas" +reservoir_locations__number = "wflow_reservoirlocs" +reservoir_surface__area = "ResSimpleArea" +"reservoir_water_demand~required~downstream__volume_flow_rate" = "ResDemand" +reservoir_water_release-below-spillway__max_volume_flow_rate = "ResMaxRelease" +reservoir_water__max_volume = "ResMaxVolume" +"reservoir_water~full-target__volume_fraction" = "ResTargetFullFrac" +"reservoir_water~min-target__volume_fraction" = "ResTargetMinFrac" + # specify the internal IDs of the parameters which vary over time # the external name mapping needs to be below together with the other mappings forcing = [ @@ -115,16 +124,6 @@ netcdf.variable.name = "KsatVer" scale = 1.0 offset = 0.0 -[input.lateral.river.reservoir] -area = "ResSimpleArea" -areas = "wflow_reservoirareas" -demand = "ResDemand" -locs = "wflow_reservoirlocs" -maxrelease = "ResMaxRelease" -maxvolume = "ResMaxVolume" -targetfullfrac = "ResTargetFullFrac" -targetminfrac = "ResTargetMinFrac" - [input.lateral.subsurface] ksathorfrac = "KsatHorFrac" diff --git a/src/routing/reservoir.jl b/src/routing/reservoir.jl index d22a37587..4e5a49383 100644 --- a/src/routing/reservoir.jl +++ b/src/routing/reservoir.jl @@ -16,7 +16,7 @@ function ReservoirParameters(dataset, config, indices_river, n_river_cells, pits reslocs = ncread( dataset, config, - "lateral.river.reservoir.locs"; + "reservoir_locations__number"; optional = false, sel = indices_river, type = Int, @@ -27,7 +27,7 @@ function ReservoirParameters(dataset, config, indices_river, n_river_cells, pits rescoverage_2d = ncread( dataset, config, - "lateral.river.reservoir.areas"; + "reservoir_areas__number"; optional = false, allow_missing = true, ) @@ -60,7 +60,7 @@ function ReservoirParameters(dataset, config, indices_river, n_river_cells, pits resdemand = ncread( dataset, config, - "lateral.river.reservoir.demand"; + "reservoir_water_demand~required~downstream__volume_flow_rate"; optional = false, sel = inds_res, type = Float, @@ -69,7 +69,7 @@ function ReservoirParameters(dataset, config, indices_river, n_river_cells, pits resmaxrelease = ncread( dataset, config, - "lateral.river.reservoir.maxrelease"; + "reservoir_water_release-below-spillway__max_volume_flow_rate"; optional = false, sel = inds_res, type = Float, @@ -78,7 +78,7 @@ function ReservoirParameters(dataset, config, indices_river, n_river_cells, pits resmaxvolume = ncread( dataset, config, - "lateral.river.reservoir.maxvolume"; + "reservoir_water__max_volume"; optional = false, sel = inds_res, type = Float, @@ -87,7 +87,7 @@ function ReservoirParameters(dataset, config, indices_river, n_river_cells, pits resarea = ncread( dataset, config, - "lateral.river.reservoir.area"; + "reservoir_surface__area"; optional = false, sel = inds_res, type = Float, @@ -96,7 +96,7 @@ function ReservoirParameters(dataset, config, indices_river, n_river_cells, pits res_targetfullfrac = ncread( dataset, config, - "lateral.river.reservoir.targetfullfrac"; + "reservoir_water~full-target__volume_fraction"; optional = false, sel = inds_res, type = Float, @@ -105,7 +105,7 @@ function ReservoirParameters(dataset, config, indices_river, n_river_cells, pits res_targetminfrac = ncread( dataset, config, - "lateral.river.reservoir.targetminfrac"; + "reservoir_water~min-target__volume_fraction"; optional = false, sel = inds_res, type = Float, diff --git a/src/routing/surface_local_inertial.jl b/src/routing/surface_local_inertial.jl index 1cd17dac9..2e900fdd6 100644 --- a/src/routing/surface_local_inertial.jl +++ b/src/routing/surface_local_inertial.jl @@ -1127,7 +1127,7 @@ function FloodPlainProfile(dataset, config, indices; river_width, river_length, volume = ncread( dataset, config, - "lateral.river.floodplain.volume"; + "floodplain_water__sum_of_volume-per-depth"; sel = indices, type = Float, dimname = :flood_depth, diff --git a/src/sbm_model.jl b/src/sbm_model.jl index efc697b9a..296c31b0b 100644 --- a/src/sbm_model.jl +++ b/src/sbm_model.jl @@ -18,6 +18,7 @@ function initialize_sbm_model(config::Config) do_reservoirs = get(config.model, "reservoirs", false)::Bool do_lakes = get(config.model, "lakes", false)::Bool do_pits = get(config.model, "pits", false)::Bool + do_subsurface_flow = get(config.model, "kinematic-wave_subsurface", true)::Bool routing_options = ("kinematic-wave", "local-inertial") river_routing = get_options( @@ -131,10 +132,9 @@ function initialize_sbm_model(config::Config) flow_length = map(get_flow_length, ldd, x_length, y_length) flow_width = (x_length .* y_length) ./ flow_length - # check if lateral subsurface flow component is defined for the SBM model, when coupled - # to another groundwater model, this component is not defined in the TOML file. - do_lateral_ssf = haskey(config.input.lateral, "subsurface") - if do_lateral_ssf + # check if lateral subsurface flow is included, when coupled to another groundwater + # model, this component is not defined in the TOML file. + if do_subsurface_flow subsurface_flow = LateralSSF( dataset, config, @@ -259,10 +259,10 @@ function initialize_sbm_model(config::Config) toposort = topological_sort_by_dfs(graph) if land_routing == "kinematic-wave" || river_routing == "kinematic-wave" || - do_lateral_ssf + do_subsurface_flow streamorder = stream_order(graph, toposort) end - if land_routing == "kinematic-wave" || do_lateral_ssf + if land_routing == "kinematic-wave" || do_subsurface_flow toposort = topological_sort_by_dfs(graph) land_pit_inds = findall(x -> x == 5, ldd) min_streamorder_land = get(config.model, "min_streamorder_land", 5) @@ -291,7 +291,7 @@ function initialize_sbm_model(config::Config) if nthreads() > 1 if river_routing == "kinematic-wave" @info "Parallel execution of kinematic wave" min_streamorder_land min_streamorder_river - elseif land_routing == "kinematic-wave" || do_lateral_ssf + elseif land_routing == "kinematic-wave" || do_subsurface_flow @info "Parallel execution of kinematic wave" min_streamorder_land end end diff --git a/src/states.jl b/src/states.jl index cc25adf5a..f2174cb20 100644 --- a/src/states.jl +++ b/src/states.jl @@ -157,8 +157,11 @@ function extract_required_states(config::Config) # Subsurface states if model_type == "sbm_gwf" ssf_states = (:head,) + elseif model_type == "sediment" + ssf_states = nothing else - ssf_states = haskey(config.input.lateral, "subsurface") ? (:ssf,) : nothing + do_subsurface_flow = get(config.model, "kinematic-wave_subsurface", true)::Bool + ssf_states = do_subsurface_flow ? (:ssf,) : nothing end # Land states diff --git a/test/io.jl b/test/io.jl index 885f94312..a905b9a53 100644 --- a/test/io.jl +++ b/test/io.jl @@ -396,7 +396,7 @@ end # Final run to test error handling during simulation tomlpath_error = joinpath(@__DIR__, "sbm_simple-error.toml") - config.input.lateral.river.width = Dict( + config.input.river__width = Dict( "scale" => 0.0, "offset" => 0.0, "netcdf" => Dict("variable" => Dict("name" => "wflow_riverwidth")), diff --git a/test/run_sbm.jl b/test/run_sbm.jl index 37890ffa1..3f60ef77e 100644 --- a/test/run_sbm.jl +++ b/test/run_sbm.jl @@ -314,7 +314,7 @@ config = Wflow.Config(tomlpath) config.model.floodplain_1d = true config.model.river_routing = "local-inertial" config.model.land_routing = "kinematic-wave" -Dict(config.input.lateral.river)["floodplain"] = Dict("volume" => "floodplain_volume") +config.input["floodplain_water__sum_of_volume-per-depth"] = "floodplain_volume" Dict(config.state.lateral.river)["floodplain.variables"] = Dict("q" => "q_floodplain", "h" => "h_floodplain") diff --git a/test/sbm_config.toml b/test/sbm_config.toml index 8938a5431..0cea267ab 100644 --- a/test/sbm_config.toml +++ b/test/sbm_config.toml @@ -95,6 +95,15 @@ river_bank_water__elevation = "RiverZ" land_surface_water_flow__manning_n_parameter = "N" land_surface__slope = "Slope" +reservoir_areas__number = "wflow_reservoirareas" +reservoir_locations__number = "wflow_reservoirlocs" +reservoir_surface__area = "ResSimpleArea" +"reservoir_water_demand~required~downstream__volume_flow_rate" = "ResDemand" +reservoir_water_release-below-spillway__max_volume_flow_rate = "ResMaxRelease" +reservoir_water__max_volume = "ResMaxVolume" +"reservoir_water~full-target__volume_fraction" = "ResTargetFullFrac" +"reservoir_water~min-target__volume_fraction" = "ResTargetMinFrac" + # specify the internal IDs of the parameters which vary over time # the external name mapping needs to be below together with the other mappings forcing = [ @@ -115,16 +124,6 @@ netcdf.variable.name = "KsatVer" scale = 1.0 offset = 0.0 -[input.lateral.river.reservoir] -area = "ResSimpleArea" -areas = "wflow_reservoirareas" -demand = "ResDemand" -locs = "wflow_reservoirlocs" -maxrelease = "ResMaxRelease" -maxvolume = "ResMaxVolume" -targetfullfrac = "ResTargetFullFrac" -targetminfrac = "ResTargetMinFrac" - [input.lateral.subsurface] ksathorfrac = "KsatHorFrac" diff --git a/test/sbm_gw.toml b/test/sbm_gw.toml index 18c32378c..92004aad9 100644 --- a/test/sbm_gw.toml +++ b/test/sbm_gw.toml @@ -88,6 +88,15 @@ river__width = "wflow_riverwidth" land_surface_water_flow__manning_n_parameter = "N" land_surface__slope = "Slope" +reservoir_areas__number = "wflow_reservoirareas" +reservoir_locations__number = "wflow_reservoirlocs" +reservoir_surface__area = "ResSimpleArea" +"reservoir_water_demand~required~downstream__volume_flow_rate" = "ResDemand" +reservoir_water_release-below-spillway__max_volume_flow_rate = "ResMaxRelease" +reservoir_water__max_volume = "ResMaxVolume" +"reservoir_water~full-target__volume_fraction" = "ResTargetFullFrac" +"reservoir_water~min-target__volume_fraction" = "ResTargetMinFrac" + # specify the internal IDs of the parameters which vary over time # the external name mapping needs to be below together with the other mappings forcing = [ @@ -103,22 +112,13 @@ potential_evaporation = "pet" precipitation = "precip" temperature = "temp" -[input.lateral.river.reservoir] -area = "ResSimpleArea" -areas = "wflow_reservoirareas" -demand = "ResDemand" -locs = "wflow_reservoirlocs" -maxrelease = "ResMaxRelease" -maxvolume = "ResMaxVolume" -targetfullfrac = "ResTargetFullFrac" -targetminfrac = "ResTargetMinFrac" - [model] kin_wave_iteration = true masswasting = true reinit = true reservoirs = true snow = true +kinematic-wave_subsurface = false thicknesslayers = [100, 300, 800] type = "sbm" diff --git a/test/sbm_simple.toml b/test/sbm_simple.toml index de4242dde..cd3937210 100644 --- a/test/sbm_simple.toml +++ b/test/sbm_simple.toml @@ -53,6 +53,15 @@ river__width = "wflow_riverwidth" land_surface_water_flow__manning_n_parameter = "N" land_surface__slope = "Slope" +reservoir_areas__number = "wflow_reservoirareas" +reservoir_locations__number = "wflow_reservoirlocs" +reservoir_surface__area = "ResSimpleArea" +"reservoir_water_demand~required~downstream__volume_flow_rate" = "ResDemand" +reservoir_water_release-below-spillway__max_volume_flow_rate = "ResMaxRelease" +reservoir_water__max_volume = "ResMaxVolume" +"reservoir_water~full-target__volume_fraction" = "ResTargetFullFrac" +"reservoir_water~min-target__volume_fraction" = "ResTargetMinFrac" + # specify the internal IDs of the parameters which vary over time # the external name mapping needs to be below together with the other mappings forcing = [ @@ -75,16 +84,6 @@ potential_evaporation = "pet" precipitation = "precip" temperature = "temp" -[input.lateral.river.reservoir] -area = "ResSimpleArea" -areas = "wflow_reservoirareas" -demand = "ResDemand" -locs = "wflow_reservoirlocs" -maxrelease = "ResMaxRelease" -maxvolume = "ResMaxVolume" -targetfullfrac = "ResTargetFullFrac" -targetminfrac = "ResTargetMinFrac" - [input.lateral.subsurface] ksathorfrac = "KsatHorFrac" diff --git a/test/sbm_swf_config.toml b/test/sbm_swf_config.toml index 78524c0e7..c431fdb3c 100644 --- a/test/sbm_swf_config.toml +++ b/test/sbm_swf_config.toml @@ -92,6 +92,15 @@ land_surface_water_flow__manning_n_parameter = "N" land_surface_water_flow__ground_elevation = "FloodplainZ" land_surface__slope = "Slope" +reservoir_areas__number = "wflow_reservoirareas" +reservoir_locations__number = "wflow_reservoirlocs" +reservoir_surface__area = "ResSimpleArea" +"reservoir_water_demand~required~downstream__volume_flow_rate" = "ResDemand" +reservoir_water_release-below-spillway__max_volume_flow_rate = "ResMaxRelease" +reservoir_water__max_volume = "ResMaxVolume" +"reservoir_water~full-target__volume_fraction" = "ResTargetFullFrac" +"reservoir_water~min-target__volume_fraction" = "ResTargetMinFrac" + # specify the internal IDs of the parameters which vary over time # the external name mapping needs to be below together with the other mappings forcing = [ @@ -107,16 +116,6 @@ potential_evaporation = "pet" precipitation = "precip" temperature = "temp" -[input.lateral.river.reservoir] -area = "ResSimpleArea" -areas = "wflow_reservoirareas" -demand = "ResDemand" -locs = "wflow_reservoirlocs" -maxrelease = "ResMaxRelease" -maxvolume = "ResMaxVolume" -targetfullfrac = "ResTargetFullFrac" -targetminfrac = "ResTargetMinFrac" - [input.lateral.subsurface] ksathorfrac = "KsatHorFrac"