Skip to content

Commit

Permalink
Replace unicode(delta)h by dh
Browse files Browse the repository at this point in the history
  • Loading branch information
CFBaptista committed Apr 10, 2024
1 parent dcb536f commit 41e30e5
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
18 changes: 9 additions & 9 deletions src/flow.jl
Original file line number Diff line number Diff line change
Expand Up @@ -402,8 +402,8 @@ end
dw::Vector{T} | "m" # Flow width [m]
zi::Vector{T} | "m" # Pseudo-water table depth [m] (top of the saturated zone)
z_exp::Vector{T} | "m" # Depth [m] from soil surface for which exponential decline of kv_0 is valid
exfiltwater::Vector{T} | "m dt-1" # Exfiltration [m dt⁻¹] (groundwater above surface level, saturated excess conditions)
recharge::Vector{T} | "m2 dt-1" # Net recharge to saturated store [m² dt⁻¹]
exfiltwater::Vector{T} | "m dt-1" # Exfiltration [m Δt⁻¹] (groundwater above surface level, saturated excess conditions)
recharge::Vector{T} | "m2 dt-1" # Net recharge to saturated store [m² Δt⁻¹]
ssf::Vector{T} | "m3 d-1" # Subsurface flow [m³ d⁻¹]
ssfin::Vector{T} | "m3 d-1" # Inflow from upstream cells [m³ d⁻¹]
ssfmax::Vector{T} | "m2 d-1" # Maximum subsurface flow [m² d⁻¹]
Expand Down Expand Up @@ -481,7 +481,7 @@ end

@get_units @exchange @grid_type @grid_location @with_kw struct GroundwaterExchange{T}
dt::T | "d" | 0 | "none" | "none" # model time step [d]
exfiltwater::Vector{T} | "m dt-1" # Exfiltration [m dt⁻¹] (groundwater above surface level, saturated excess conditions)
exfiltwater::Vector{T} | "m dt-1" # Exfiltration [m Δt⁻¹] (groundwater above surface level, saturated excess conditions)
zi::Vector{T} | "m" # Pseudo-water table depth [m] (top of the saturated zone)
to_river::Vector{T} | "m3 d-1" # Part of subsurface flow [m³ d⁻¹] that flows to the river
ssf::Vector{T} | "m3 d-1" # Subsurface flow [m³ d⁻¹]
Expand Down Expand Up @@ -1433,8 +1433,8 @@ Compute floodplain flow area based on flow depth `h` and floodplain `depth`, `ar
`width` of a floodplain profile.
"""
function flow_area(width, area, depth, h)
Δh = h - depth # depth at i1
area = area + (width * Δh) # area at i1, width at i2
dh = h - depth # depth at i1
area = area + (width * dh) # area at i1, width at i2
return area
end

Expand All @@ -1445,17 +1445,17 @@ Compute floodplain wetted perimeter based on flow depth `h` and floodplain `dept
wetted perimeter `p` of a floodplain profile.
"""
function wetted_perimeter(p, depth, h)
Δh = h - depth # depth at i1
p = p + (2.0 * Δh) # p at i1
dh = h - depth # depth at i1
p = p + (2.0 * dh) # p at i1
return p
end

"Compute flood depth by interpolating flood volume `flood_volume` using flood depth intervals."
function flood_depth(profile::FloodPlainProfile{T}, flood_volume, dl, i::Int)::T where {T}
i1, i2 = interpolation_indices(flood_volume, @view profile.volume[:, i])
ΔA = (flood_volume - profile.volume[i1, i]) / dl
Δh = ΔA / profile.width[i2, i]
flood_depth = profile.depth[i1] + Δh
dh = ΔA / profile.width[i2, i]
flood_depth = profile.depth[i1] + dh
return flood_depth
end

Expand Down
12 changes: 6 additions & 6 deletions src/reservoir_lake.jl
Original file line number Diff line number Diff line change
Expand Up @@ -530,18 +530,18 @@ function update(lake::Lake, i, inflow, doy, timestepsecs)
else
if diff_wl >= 0.0
if lake.waterlevel[i] > lake.threshold[i]
Δh = lake.waterlevel[i] - lake.threshold[i]
outflow = lake.b[i] * pow(Δh, lake.e[i])
maxflow = (Δh * lake.area[i]) / timestepsecs
dh = lake.waterlevel[i] - lake.threshold[i]
outflow = lake.b[i] * pow(dh, lake.e[i])
maxflow = (dh * lake.area[i]) / timestepsecs
outflow = min(outflow, maxflow)
else
outflow = Float(0)
end
else
if lake.waterlevel[lo] > lake.threshold[i]
Δh = lake.waterlevel[lo] - lake.threshold[i]
outflow = -1.0 * lake.b[i] * pow(Δh, lake.e[i])
maxflow = (Δh * lake.area[lo]) / timestepsecs
dh = lake.waterlevel[lo] - lake.threshold[i]
outflow = -1.0 * lake.b[i] * pow(dh, lake.e[i])
maxflow = (dh * lake.area[lo]) / timestepsecs
outflow = max(outflow, -maxflow)
else
outflow = Float(0)
Expand Down
4 changes: 2 additions & 2 deletions test/run_sbm.jl
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ model = Wflow.initialize_sbm_model(config)

fp = model.lateral.river.floodplain.profile
river = model.lateral.river
Δh = diff(fp.depth)
dh = diff(fp.depth)
Δv = diff(fp.volume[:, 3])
Δa = diff(fp.a[:, 3])

Expand Down Expand Up @@ -335,7 +335,7 @@ river = model.lateral.river
297.8700179533214f0,
463.35655296229805f0,
]
@test Δh .* fp.width[2:end, 3] * river.dl[3] Δv
@test dh .* fp.width[2:end, 3] * river.dl[3] Δv
@test fp.a[:, 3] * river.dl[3] fp.volume[:, 3]
# flood depth from flood volume (8000.0)
flood_vol = 8000.0f0
Expand Down

0 comments on commit 41e30e5

Please sign in to comment.