Skip to content

Commit

Permalink
Remaining suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Bart de Koning <[email protected]>
  • Loading branch information
vers-w and SouthEndMusic authored Oct 28, 2024
1 parent 91604d6 commit cc30210
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 19 deletions.
6 changes: 3 additions & 3 deletions src/forcing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ function AtmosphericForcing(
temperature::Vector{T} = fill(mv, n),
) where {T}
return AtmosphericForcing{T}(;
precipitation = precipitation,
potential_evaporation = potential_evaporation,
temperature = temperature,
precipitation,
potential_evaporation,
temperature,
)
end
7 changes: 3 additions & 4 deletions src/horizontal_process.jl
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,11 @@ function ssf_celerity(zi, slope, theta_e, kh_profile::KhExponentialConstant, i)
(; z_exp) = kh_profile
(; kh_0, f) = kh_profile.exponential
Cn_const = (kh_0[i] * exp(-f[i] * z_exp[i]) * slope) / theta_e
if zi < z_exp[i]
Cn = (kh_0[i] * exp(-f[i] * zi) * slope) / theta_e + Cn_const
return if zi < z_exp[i]
(kh_0[i] * exp(-f[i] * zi) * slope) / theta_e + Cn_const
else
Cn = Cn_const
Cn_const
end
return Cn
end

"""
Expand Down
8 changes: 4 additions & 4 deletions src/sbm_gwf_model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,10 @@ function initialize_sbm_gwf_model(config::Config)
if do_water_demand
areas = unique(lsm.allocation.parameters.areas)
for a in areas
area_index = findall(x -> x == a, lsm.allocation.parameters.areas)
area_index = findall(==(a), lsm.allocation.parameters.areas)
push!(inds_allocation_areas, area_index)
area_riv_index =
findall(x -> x == a, lsm.allocation.parameters.areas[index_river])
findall(==(a), lsm.allocation.parameters.areas[index_river])
push!(inds_riv_allocation_areas, area_riv_index)
end
end
Expand Down Expand Up @@ -346,8 +346,8 @@ function initialize_sbm_gwf_model(config::Config)
end

gwf = GroundwaterFlow{Float}(;
aquifer = aquifer,
connectivity = connectivity,
aquifer,
connectivity,
constanthead = constant_head,
boundaries = aquifer_boundaries,
)
Expand Down
4 changes: 2 additions & 2 deletions src/sbm_model.jl
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,8 @@ function initialize_sbm_model(config::Config)
khfrac = khfrac,
zi = ssf_zi,
soilthickness = ssf_soilthickness,
theta_s = theta_s,
theta_r = theta_r,
theta_s,
theta_r,
dt = dt / basetimestep,
slope = landslope,
dl = dl,
Expand Down
11 changes: 5 additions & 6 deletions src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -701,13 +701,12 @@ function hydraulic_conductivity_at_depth(p::KvLayered, kvfrac, z, i, n)
end

function hydraulic_conductivity_at_depth(p::KvLayeredExponential, kvfrac, z, i, n)
if z < p.z_layered[i]
kv_z = kvfrac[i][n] * p.kv[i][n]
return if z < p.z_layered[i]
kvfrac[i][n] * p.kv[i][n]
else
n = p.nlayers_kv[i]
kv_z = kvfrac[i][n] * p.kv[i][n] * exp(-p.f[i] * (z - p.z_layered[i]))
kvfrac[i][n] * p.kv[i][n] * exp(-p.f[i] * (z - p.z_layered[i]))
end
return kv_z
end

"""
Expand All @@ -732,7 +731,7 @@ function kh_layered_profile!(
for i in eachindex(kh)
m = nlayers[i]

if (soilthickness[i] - zi[i]) > 0.0
if soilthickness[i] > zi[i]
transmissivity = 0.0
_sumlayers = @view sumlayers[i][2:end]
n = max(n_unsatlayers[i], 1)
Expand Down Expand Up @@ -768,7 +767,7 @@ function kh_layered_profile!(
for i in eachindex(kh)
m = nlayers[i]

if (soilthickness[i] - zi[i]) > 0.0
if soilthickness[i] > zi[i]
transmissivity = 0.0
n = max(n_unsatlayers[i], 1)
if zi[i] >= z_layered[i]
Expand Down

0 comments on commit cc30210

Please sign in to comment.