Showing posts with label SWMM5 Function Name: horton_getInfil Overview. Show all posts
Showing posts with label SWMM5 Function Name: horton_getInfil Overview. Show all posts

Sunday, October 22, 2023

SWMM5 Function Name: horton_getInfil Overview

 

📝 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 NameDescriptionEmoji
iterIteration counter.🔄
faWater available for infiltration.🌊
fpPotential infiltration rate (initialized to 0).🌧️
Fp, F1Cumulative infiltration at start and end of time step.💧
t1Future cumulative time.
tlimLimit time for determining flat portion of infiltration curve.🛑
ex, ktIntermediate variables for calculations.🔢
FF, FF1Intermediate variables for Newton-Raphson method.🔣
rRatio 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

  1. 📌 Initialize Local Variables: Extract and set local variables using values from the Horton infiltration object and other provided constants.

  2. 🚫 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.

  3. 💧 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.

  4. 🌧️ 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.
  5. 🌥️ Regeneration of Infiltration Capacity: If the regeneration rate kr is positive, then adjust the cumulative time tp to account for regeneration of the soil's infiltration capacity. Update the cumulative infiltration value based on this regeneration.

  6. 🎉 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.

AI Rivers of Wisdom about ICM SWMM

Here's the text "Rivers of Wisdom" formatted with one sentence per line: [Verse 1] 🌊 Beneath the ancient oak, where shadows p...