Skip to content

Commit

Permalink
Address review comment
Browse files Browse the repository at this point in the history
Rewrite without explicit loop.
  • Loading branch information
vers-w committed Oct 28, 2024
1 parent 0e06992 commit 6612822
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -831,13 +831,8 @@ function initialize_lateralssf!(model::LateralSSF, kh_profile::KhExponential)
(; kh_0, f) = kh_profile
(; ssf, ssfmax, zi, slope, soilthickness, dw) = model

for i in eachindex(ssf)
ssfmax[i] = ((kh_0[i] * slope[i]) / f[i]) * (1.0 - exp(-f[i] * soilthickness[i]))
ssf[i] =
((kh_0[i] * slope[i]) / f[i]) *
(exp(-f[i] * zi[i]) - exp(-f[i] * soilthickness[i])) *
dw[i]
end
@. ssfmax = ((kh_0 * slope) / f) * (1.0 - exp(-f * soilthickness))
@. ssf = ((kh_0 * slope) / f) * (exp(-f * zi) - exp(-f * soilthickness)) * dw
end

function initialize_lateralssf!(model::LateralSSF, kh_profile::KhExponentialConstant)
Expand Down

0 comments on commit 6612822

Please sign in to comment.