Skip to content

Commit

Permalink
Rename area to cell_area for river network
Browse files Browse the repository at this point in the history
As if refers to the grid cell area and not the river area.
  • Loading branch information
vers-w committed Nov 27, 2024
1 parent e6f1bbc commit 3de7665
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/demand/water_demand.jl
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ get_demand_gross(model::NonPaddy) = model.variables.demand_gross
get_demand_gross(model::NoIrrigationNonPaddy) = 0.0

"""
update_demand_gross!(Model::NonPaddy, soil::SbmSoilModel)
update_demand_gross!(model::NonPaddy, soil::SbmSoilModel)
Update gross water demand `demand_gross` of the non-paddy irrigation model for a single
timestep.
Expand Down Expand Up @@ -396,7 +396,7 @@ function update_demand_gross!(model::Paddy)
return nothing
end

update_demand_gross!(paddy::NoIrrigationPaddy) = nothing
update_demand_gross!(model::NoIrrigationPaddy) = nothing

"Struct to store water demand model variables"
@get_units @grid_loc @with_kw struct DemandVariables{T}
Expand Down Expand Up @@ -696,7 +696,7 @@ function surface_water_allocation_area!(model::AllocationLand, demand, river, ne
for j in inds_river[i]
act_surfacewater_abst_vol[j] += frac_abstract_sw * available_surfacewater[j]
act_surfacewater_abst[j] =
(act_surfacewater_abst_vol[j] / network.river.area[j]) * 1000.0
(act_surfacewater_abst_vol[j] / network.river.cell_area[j]) * 1000.0
end

# water allocated to each land cell.
Expand Down
6 changes: 3 additions & 3 deletions src/flow.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2081,7 +2081,7 @@ timestep.
function update_lateral_inflow!(
model::AbstractRiverFlowModel,
external_models::NamedTuple,
river_area,
river_cell_area,
land_area,
river_indices,
dt,
Expand All @@ -2094,7 +2094,7 @@ function update_lateral_inflow!(
get_flux_to_river(subsurface)[river_indices] .+
land.variables.to_river[river_indices] .+
(net_runoff_river[river_indices] .* land_area[river_indices] .* 0.001) ./ dt .+
(get_nonirrigation_returnflow(allocation) .* 0.001 .* river_area) ./ dt
(get_nonirrigation_returnflow(allocation) .* 0.001 .* river_cell_area) ./ dt
)
return nothing
end
Expand Down Expand Up @@ -2225,7 +2225,7 @@ function surface_routing!(model)
update_lateral_inflow!(
river,
(; allocation = river.allocation, runoff, land, subsurface),
network.river.area,
network.river.cell_area,
network.land.area,
network.river.land_indices,
dt,
Expand Down
4 changes: 2 additions & 2 deletions src/sbm_gwf_model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ function initialize_sbm_gwf_model(config::Config)
order = toposort_river,
# water allocation areas
allocation_area_indices = river_allocation_area_inds,
area = x_length[inds_land_map2river] .* y_length[inds_land_map2river],
cell_area = x_length[inds_land_map2river] .* y_length[inds_land_map2river],
)
elseif river_routing == "local-inertial"
river = (
Expand All @@ -472,7 +472,7 @@ function initialize_sbm_gwf_model(config::Config)
links_at_node = adjacent_links_at_node(graph_river, nodes_at_link),
# water allocation areas
allocation_area_indices = river_allocation_area_inds,
area = x_length[inds_land_map2river] .* y_length[inds_land_map2river],
cell_area = x_length[inds_land_map2river] .* y_length[inds_land_map2river],
)
end

Expand Down
4 changes: 2 additions & 2 deletions src/sbm_model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ function initialize_sbm_model(config::Config)
order = toposort_river,
# water allocation areas
allocation_area_indices = river_allocation_area_inds,
area = x_length[inds_land_map2river] .* y_length[inds_land_map2river],
cell_area = x_length[inds_land_map2river] .* y_length[inds_land_map2river],
)
elseif river_routing == "local-inertial"
river = (
Expand All @@ -403,7 +403,7 @@ function initialize_sbm_model(config::Config)
links_at_node = adjacent_links_at_node(graph_river, nodes_at_link),
# water allocation areas
allocation_area_indices = river_allocation_area_inds,
area = x_length[inds_land_map2river] .* y_length[inds_land_map2river],
cell_area = x_length[inds_land_map2river] .* y_length[inds_land_map2river],
)
end

Expand Down

0 comments on commit 3de7665

Please sign in to comment.