|
| 1 | +# https://github.com/Deltares/hydromt_wflow/blob/main/hydromt_wflow/workflows/ptf.py |
| 2 | +export θsat_toth, θres_rawls_brakensiek, pore_size_index_brakensiek |
| 3 | +export kv_brakensiek, kv_cosby, b_cosby, psi_sat_cosby |
| 4 | +export campbell_from_ptf |
| 5 | + |
| 6 | +const _MM_DAY_TO_CM_H = 1.0 / 240.0 # 1 mm day-1 = 1/240 cm h-1 |
| 7 | + |
| 8 | +""" |
| 9 | + θsat_toth(ph, bd, clay, silt) → θ_sat [m³/m³] |
| 10 | +
|
| 11 | +Saturated water content. Tóth et al. (2015), Eur. J. Soil Sci. 66, 226–238. |
| 12 | +Inputs: pH [-], bulk density [g cm⁻³], clay [%], silt [%]. |
| 13 | +""" |
| 14 | +@inline function θsat_toth(ph::T, bd::T, clay::T, silt::T) where {T<:Real} |
| 15 | + (0.5653 |
| 16 | + - 0.07918 * bd^2 |
| 17 | + + 0.001671 * ph^2 |
| 18 | + + 5.438e-4 * clay |
| 19 | + + 0.001065 * silt |
| 20 | + + 0.06836 |
| 21 | + - 1.382e-5 * clay * ph^2 |
| 22 | + - 1.270e-5 * silt * clay |
| 23 | + - 4.784e-4 * bd^2 * ph^2 |
| 24 | + - 2.836e-4 * silt * bd^2 |
| 25 | + + 4.158e-4 * clay * bd^2 |
| 26 | + - 0.01686 * bd^2 |
| 27 | + - 3.541e-4 * silt |
| 28 | + - 3.152e-4 * ph^2) |
| 29 | +end |
| 30 | + |
| 31 | +""" |
| 32 | + θres_rawls_brakensiek(sand, clay, θsat) → θ_res [m³/m³] |
| 33 | +
|
| 34 | +Residual water content. Rawls & Brakensiek (1989). |
| 35 | +Inputs: sand [%], clay [%], θ_sat [m³/m³]. |
| 36 | +""" |
| 37 | +@inline function θres_rawls_brakensiek(sand::T, clay::T, θsat::T) where {T<:Real} |
| 38 | + (-0.0182482 |
| 39 | + + 8.7269e-4 * sand |
| 40 | + + 5.13488e-3 * clay |
| 41 | + + 0.02939286 * θsat |
| 42 | + - 1.5395e-4 * clay^2 |
| 43 | + - 1.0827e-3 * sand * θsat |
| 44 | + - 1.8233e-4 * clay^2 * θsat^2 |
| 45 | + + 3.0703e-4 * clay^2 * θsat |
| 46 | + - 2.3584e-3 * θsat^2 * clay) |
| 47 | +end |
| 48 | + |
| 49 | +""" |
| 50 | + pore_size_index_brakensiek(sand, θsat, clay) → λ [-] |
| 51 | +
|
| 52 | +Brooks-Corey pore-size distribution index. Rawls & Brakensiek (1989). |
| 53 | +Campbell b = 1/λ. |
| 54 | +Inputs: sand [%], θ_sat [m³/m³], clay [%]. |
| 55 | +""" |
| 56 | +@inline function pore_size_index_brakensiek(sand::T, θsat::T, clay::T) where {T<:Real} |
| 57 | + exp(-0.7842831 |
| 58 | + + 0.0177544 * sand |
| 59 | + - 1.062498 * θsat |
| 60 | + - 5.304e-5 * sand^2 |
| 61 | + - 2.73493e-3 * clay^2 |
| 62 | + + 1.11134946 * θsat^2 |
| 63 | + - 0.03088295 * sand * θsat |
| 64 | + + 2.6587e-4 * sand^2 * θsat^2 |
| 65 | + - 6.10522e-3 * clay^2 * θsat^2 |
| 66 | + - 2.35e-6 * sand^2 * clay |
| 67 | + + 7.98746e-3 * clay^2 * θsat |
| 68 | + - 6.74491e-3 * θsat^2 * clay) |
| 69 | +end |
| 70 | + |
| 71 | + |
| 72 | +""" |
| 73 | + kv_brakensiek(θsat, clay, sand) → Ksat [cm h⁻¹] |
| 74 | +
|
| 75 | +Saturated hydraulic conductivity. Brakensiek et al. (1984). |
| 76 | +Inputs: θ_sat [m³/m³], clay [%], sand [%]. |
| 77 | +""" |
| 78 | +@inline function kv_brakensiek(θsat::T, clay::T, sand::T) where {T<:Real} |
| 79 | + kv_mm_day = exp(19.52348 * θsat |
| 80 | + - 8.96847 |
| 81 | + - 0.028212 * clay |
| 82 | + + 1.8107e-4 * sand^2 |
| 83 | + - 9.4125e-3 * clay^2 |
| 84 | + - 8.395215 * θsat^2 |
| 85 | + + 0.077718 * sand * θsat |
| 86 | + - 2.98e-3 * sand^2 * θsat^2 |
| 87 | + - 0.019492 * clay^2 * θsat^2 |
| 88 | + + 1.73e-5 * sand^2 * clay |
| 89 | + + 0.02733 * clay^2 * θsat |
| 90 | + + 1.434e-3 * sand^2 * θsat |
| 91 | + - 3.5e-6 * clay^2 * sand) * 2.78e-6 * 1_000 * 3_600 * 24 |
| 92 | + kv_mm_day * _MM_DAY_TO_CM_H |
| 93 | +end |
| 94 | + |
| 95 | + |
| 96 | +""" |
| 97 | + kv_cosby(sand, clay) → Ksat [cm h⁻¹] |
| 98 | +
|
| 99 | +Saturated hydraulic conductivity. Cosby et al. (1984), Water Resour. Res. 20(6), 682–690. |
| 100 | +Inputs: sand [%], clay [%]. |
| 101 | +""" |
| 102 | +@inline function kv_cosby(sand::T, clay::T) where {T<:Real} |
| 103 | + kv_mm_day = 60.96 * 10.0^(-0.6 + 0.0126 * sand - 0.0064 * clay) * 10.0 |
| 104 | + kv_mm_day * _MM_DAY_TO_CM_H |
| 105 | +end |
| 106 | + |
| 107 | + |
| 108 | +""" |
| 109 | + b_cosby(clay, sand) → b [-] |
| 110 | +
|
| 111 | +Campbell shape parameter b. Cosby et al. (1984). |
| 112 | +Inputs: clay [%], sand [%]. |
| 113 | +""" |
| 114 | +@inline b_cosby(clay::T, sand::T) where {T<:Real} = 3.10 + 0.157 * clay - 0.003 * sand |
| 115 | + |
| 116 | + |
| 117 | +""" |
| 118 | + psi_sat_cosby(sand) → ψ_sat [cm] |
| 119 | +
|
| 120 | +Air-entry matric potential at saturation. Cosby et al. (1984). Returns negative value. |
| 121 | +Inputs: sand [%]. |
| 122 | +""" |
| 123 | +@inline psi_sat_cosby(sand::T) where {T<:Real} = -10.1 * 10.0^(1.88 - 0.0131 * sand) |
| 124 | + |
| 125 | + |
| 126 | +""" |
| 127 | + campbell_from_ptf(clay, silt, sand, bd, ph; ksat_method=:brakensiek) → Campbell{Float64} |
| 128 | +
|
| 129 | +Build Campbell hydraulic parameters from soil texture attributes using pedotransfer functions. |
| 130 | +- θ_sat : Tóth et al. (2015) |
| 131 | +- b : 1 / pore_size_index, Rawls & Brakensiek (1989) |
| 132 | +- ψ_sat : Cosby et al. (1984) |
| 133 | +- Ksat : Brakensiek et al. (1984) or Cosby et al. (1984) |
| 134 | +
|
| 135 | +Inputs: clay [%], silt [%], sand [%], bd [g cm⁻³], ph [-]. |
| 136 | +`ksat_method`: `:brakensiek` (default) or `:cosby`. |
| 137 | +""" |
| 138 | +function campbell_from_ptf(clay::Real, silt::Real, sand::Real, bd::Real, ph::Real; |
| 139 | + ksat_method::Symbol=:brakensiek) |
| 140 | + clay, silt, sand, bd, ph = promote(Float64(clay), Float64(silt), Float64(sand), |
| 141 | + Float64(bd), Float64(ph)) |
| 142 | + θ_sat = θsat_toth(ph, bd, clay, silt) |
| 143 | + λ = pore_size_index_brakensiek(sand, θ_sat, clay) |
| 144 | + b = 1.0 / λ |
| 145 | + ψ_sat = psi_sat_cosby(sand) |
| 146 | + Ksat = if ksat_method === :brakensiek |
| 147 | + kv_brakensiek(θ_sat, clay, sand) |
| 148 | + elseif ksat_method === :cosby |
| 149 | + kv_cosby(sand, clay) |
| 150 | + else |
| 151 | + error("Unknown ksat_method: $ksat_method. Use :brakensiek or :cosby.") |
| 152 | + end |
| 153 | + Campbell{Float64}(; θ_sat, ψ_sat, Ksat, b) |
| 154 | +end |
0 commit comments