## Friday, November 10, 2023

### Detailed Overview of `landuse_getExternalBuildup` Function in SWMM5 🌿🔍📊

The `landuse_getExternalBuildup` function in SWMM5 is designed to calculate pollutant buildup due to external loading over a specified time step. Here's a detailed breakdown of its functionality, with added explanations:

#### Function Prototype 📝

• Input:
• `i`: Landuse index.
• `p`: Pollutant index.
• `buildup`: Existing buildup at the start of the time step (measured in mass per unit area).
• `tStep`: Time step duration in seconds.
• Output: Returns the pollutant buildup at the end of the time interval (mass per unit area).
• Purpose: To determine the increase in pollutant buildup due to external sources during a given time step.

#### Process Flow and Computation 🌐🧩

1. Maximum Buildup Determination:

• Retrieves the maximum allowable buildup (`maxBuildup`) for the specific land use and pollutant.
2. Scaling Factor and Time Series Index:

• `sf` (scaling factor): Modifies the rate of buildup based on specific land use characteristics.
• `ts` (time series index): Points to the relevant time series data for buildup rates.
3. Initial Condition Check:

• At the start of the simulation (when `NewRunoffTime` is 0), the function immediately returns zero, indicating no buildup increment.
4. Buildup Rate Calculation:

• If a valid time series index (`ts`) is present, it fetches the buildup rate (in mass/unit/day) from the time series table (`Tseries[ts]`), scaling it with the scaling factor (`sf`).
5. Buildup Computation:

• Calculates the total buildup at the end of the time interval by adding the product of the rate and the time step (converted from seconds to days).
• Ensures that the calculated buildup does not exceed the predefined maximum buildup (`maxBuildup`).
6. Return Value:

• The function returns the computed buildup value, which represents the accumulated pollutant mass per unit area at the end of the time step.

#### Function's Role in SWMM5 🌎🚰

• Integral to modeling the accumulation of pollutants on different land uses over time.
• Helps in understanding the impact of external loading sources on urban runoff quality.
• Crucial for designing and evaluating strategies to mitigate pollutant discharge into stormwater systems.

In summary, the `landuse_getExternalBuildup` function in SWMM5 is vital for accurately predicting pollutant buildup from external sources on various land uses, thereby aiding in the effective management of urban runoff and water quality. 🌿📈🔬🌧️🏙️📊🧪💧🔄🌍📊🔍🌆