📝 Function Overview
Function Name: horton_getInfil
Purpose: Computes the Horton infiltration for a subcatchment.
Inputs:
infil
: A pointer to a Horton infiltration object.tstep
: Runoff time step in seconds.irate
: Net "rainfall" rate in ft/sec (rainfall + snowmelt + runon - evaporation).depth
: Depth of ponded water in feet.
Output: Returns the infiltration rate in ft/sec.
🕵️ Local Variables
Variable Name | Description | Emoji |
---|---|---|
iter | Iteration counter. | 🔄 |
fa | Water available for infiltration. | 🌊 |
fp | Potential infiltration rate (initialized to 0). | 🌧️ |
Fp , F1 | Cumulative infiltration at start and end of time step. | 💧 |
t1 | Future cumulative time. | ⏰ |
tlim | Limit time for determining flat portion of infiltration curve. | 🛑 |
ex , kt | Intermediate variables for calculations. | 🔢 |
FF , FF1 | Intermediate variables for Newton-Raphson method. | 🔣 |
r | Ratio used for Newton-Raphson method and exponential calculations. | 📊 |
Other variables (f0 , fmin , Fmax , tp , df , kd , kr ) | Derived from infil object and represent various Horton infiltration parameters. | 📈 |
🔄 Logic Breakdown
📌 Initialize Local Variables: Extract and set local variables using values from the Horton infiltration object and other provided constants.
🚫 Special Cases - No or Constant Infiltration: If the difference between initial and minimum infiltration capacities is less than zero, or the decay rate is less than zero, return an infiltration rate of 0.0 (no infiltration). If there's no difference between the two capacities or the decay rate is 0, then return either the initial infiltration capacity or the available water for infiltration, whichever is smaller.
💧 Compute Water Available for Infiltration: Calculate the total water available for infiltration (
fa
) by adding the net rainfall rate to the ponded water depth divided by the time step.🌧️ Water is Available for Infiltration:
- Compute the average infiltration rate over the time step.
- Use various conditions to determine the potential infiltration rate and adjust the future cumulative time
tp
. - If necessary, solve for
tp
using the Newton-Raphson method. - Limit cumulative infiltration to a maximum value
Fmax
.
🌥️ Regeneration of Infiltration Capacity: If the regeneration rate
kr
is positive, then adjust the cumulative timetp
to account for regeneration of the soil's infiltration capacity. Update the cumulative infiltration value based on this regeneration.🎉 Return Value: Update the
tp
value in the Horton infiltration object and return the infiltration rate (fp
).
This code implements the Horton infiltration model which represents how soil infiltration capacity decreases over time as the soil becomes saturated. The model also accounts for the regeneration of infiltration capacity as the soil dries out. The function computes and returns the actual infiltration rate for a given time step based on these principles. The code includes special cases for constant infiltration and uses an iterative Newton-Raphson method to adjust infiltration rates when soil infiltration capacity is limiting.