Skip to content

Commit

Permalink
Rename variables in initialization of sbm and sbm_gwf
Browse files Browse the repository at this point in the history
Model components river flow, overland flow and groundwater flow.
  • Loading branch information
vers-w committed Nov 26, 2024
1 parent 2b10fa0 commit 986c9b1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 19 deletions.
29 changes: 16 additions & 13 deletions src/sbm_gwf_model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ function initialize_sbm_gwf_model(config::Config)
end

if land_routing == "kinematic-wave"
olf = SurfaceFlowLand(
overland_flow = SurfaceFlowLand(
dataset,
config,
indices;
Expand All @@ -169,7 +169,7 @@ function initialize_sbm_gwf_model(config::Config)
)
elseif land_routing == "local-inertial"
inds_river_map2land = reverse_inds_river[indices] # not filtered (with zeros)
olf, staggered_indices = ShallowWaterLand(
overland_flow, staggered_indices = ShallowWaterLand(
dataset,
config,
indices;
Expand All @@ -193,7 +193,7 @@ function initialize_sbm_gwf_model(config::Config)
minimum(river_width) > 0 || error("river width must be positive on river cells")

if river_routing == "kinematic-wave"
rf = SurfaceFlowRiver(
river_flow = SurfaceFlowRiver(
dataset,
config,
inds_river;
Expand All @@ -203,7 +203,7 @@ function initialize_sbm_gwf_model(config::Config)
lake = lake,
)
elseif river_routing == "local-inertial"
rf, nodes_at_link = ShallowWaterRiver(
river_flow, nodes_at_link = ShallowWaterRiver(
dataset,
config,
inds_river;
Expand Down Expand Up @@ -294,7 +294,7 @@ function initialize_sbm_gwf_model(config::Config)
drain = ()
end

gwf = GroundwaterFlow{Float}(;
groundwater_flow = GroundwaterFlow{Float}(;
aquifer,
connectivity,
constanthead = constant_head,
Expand All @@ -304,14 +304,17 @@ function initialize_sbm_gwf_model(config::Config)
# map GroundwaterFlow and its boundaries
if do_drains
subsurface_map = (
flow = gwf,
recharge = gwf.boundaries[1],
river = gwf.boundaries[2],
drain = gwf.boundaries[3],
flow = groundwater_flow,
recharge = groundwater_flow.boundaries[1],
river = groundwater_flow.boundaries[2],
drain = groundwater_flow.boundaries[3],
)
else
subsurface_map =
(flow = gwf, recharge = gwf.boundaries[1], river = gwf.boundaries[2])
subsurface_map = (
flow = groundwater_flow,
recharge = groundwater_flow.boundaries[1],
river = groundwater_flow.boundaries[2],
)
end

# setup subdomains for the land and river kinematic wave domain, if nthreads = 1
Expand Down Expand Up @@ -348,7 +351,7 @@ function initialize_sbm_gwf_model(config::Config)

modelmap = (
vertical = land_hydrology,
lateral = (subsurface = subsurface_map, land = olf, river = rf),
lateral = (subsurface = subsurface_map, land = overland_flow, river = river_flow),
)
indices_reverse = (
land = reverse_indices,
Expand Down Expand Up @@ -476,7 +479,7 @@ function initialize_sbm_gwf_model(config::Config)
model = Model(
config,
(; land, river, reservoir = reservoir_network, lake = lake_network, drain),
(subsurface = subsurface_map, land = olf, river = rf),
(subsurface = subsurface_map, land = overland_flow, river = river_flow),
land_hydrology,
clock,
reader,
Expand Down
12 changes: 6 additions & 6 deletions src/sbm_model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ function initialize_sbm_model(config::Config)
end

if land_routing == "kinematic-wave"
olf = SurfaceFlowLand(
overland_flow = SurfaceFlowLand(
dataset,
config,
indices;
Expand All @@ -204,7 +204,7 @@ function initialize_sbm_model(config::Config)
)
elseif land_routing == "local-inertial"
inds_river_map2land = reverse_inds_river[indices] # not filtered (with zeros)
olf, staggered_indices = ShallowWaterLand(
overland_flow, staggered_indices = ShallowWaterLand(
dataset,
config,
indices;
Expand All @@ -226,7 +226,7 @@ function initialize_sbm_model(config::Config)
minimum(river_length) > 0 || error("river length must be positive on river cells")
minimum(river_width) > 0 || error("river width must be positive on river cells")
if river_routing == "kinematic-wave"
rf = SurfaceFlowRiver(
river_flow = SurfaceFlowRiver(
dataset,
config,
inds_river;
Expand All @@ -236,7 +236,7 @@ function initialize_sbm_model(config::Config)
lake = lake,
)
elseif river_routing == "local-inertial"
rf, nodes_at_link = ShallowWaterRiver(
river_flow, nodes_at_link = ShallowWaterRiver(
dataset,
config,
inds_river;
Expand Down Expand Up @@ -300,7 +300,7 @@ function initialize_sbm_model(config::Config)

modelmap = (
vertical = land_hydrology,
lateral = (subsurface = subsurface_flow, land = olf, river = rf),
lateral = (subsurface = subsurface_flow, land = overland_flow, river = river_flow),
)
indices_reverse = (
land = reverse_indices,
Expand Down Expand Up @@ -410,7 +410,7 @@ function initialize_sbm_model(config::Config)
model = Model(
config,
(; land, river, reservoir = reservoir_network, lake = lake_network),
(subsurface = subsurface_flow, land = olf, river = rf),
(subsurface = subsurface_flow, land = overland_flow, river = river_flow),
land_hydrology,
clock,
reader,
Expand Down

0 comments on commit 986c9b1

Please sign in to comment.