Saturday, January 21, 2023

SWMM 5.2.2 Code for LID Function barrelFluxRates

This code defines a function called "barrelFluxRates" which computes the flux rates for a rain barrel LID. The function takes in a vector of storage levels (x) and a vector of flux rates (f) as inputs and does not return any outputs. The function starts by initializing three variables, "storageDepth", "head" and "maxValue" to 0.0. Then it assigns the value of 0.0 to the SurfaceVolume, SoilVolume, and assigns the value of storageDepth to the StorageVolume. The function then initializes the SurfaceInfil, SurfaceOutflow, and StorageDrain to 0.0.

The function then checks if the drain delay is 0.0 or if the dry time is greater than or equal to the drain delay, if it is, it calculates the head and if the head is greater than 0.0, it calculates the StorageDrain using the getStorageDrainRate function, and limits the StorageDrain to the maxValue which is equal to the head divided by the time step.

The function then limits the StorageInflow to the available storage by calculating the maxValue and comparing it to the SurfaceInflow. The SurfaceInfil is then assigned the value of StorageInflow.

Finally, the function assigns the values to the layer flux rates. The SurfaceInflow minus StorageInflow is assigned to f[SURF], the StorageInflow minus StorageDrain is assigned to f[STOR], and 0.0 is assigned to f[SOIL].

VariableDescription
SurfaceVolumeThe volume of water in the surface layer
SoilVolumeThe volume of water in the soil layer
StorageVolumeThe volume of water in the storage layer
SurfaceInfilThe infiltration rate into the surface layer
SurfaceOutflowThe outflow rate from the surface layer
StorageDrainThe drainage rate from the storage layer
StorageInflowThe inflow rate into the storage layer
SurfaceInflowThe inflow rate into the surface layer
theLidProc->drain.delayThe delay time before drainage begins from the storage layer
theLidUnit->dryTimeThe time since the last rain
theLidProc->drain.offsetThe offset for determining the head for drainage
theLidProc->storage.thicknessThe thickness of the storage layer
TstepThe change in time step

Note that this function is specific for rain barrel LID, and it computes the flux rates based on the storage level and the LID properties.



void barrelFluxRates(double x[], double f[])
//
//  Purpose: computes flux rates for a rain barrel LID.
//  Input:   x = vector of storage levels
//  Output:  f = vector of flux rates
//
{
    double storageDepth = x[STOR];
    double head;
    double maxValue;

    //... assign values to layer volumes
    SurfaceVolume = 0.0;
    SoilVolume = 0.0;
    StorageVolume = storageDepth;

    //... initialize flows
    SurfaceInfil = 0.0;
    SurfaceOutflow = 0.0;
    StorageDrain = 0.0;

    //... compute outflow if time since last rain exceeds drain delay
    //    (dryTime is updated in lid.evalLidUnit at each time step)
    if ( theLidProc->drain.delay == 0.0 ||
        theLidUnit->dryTime >= theLidProc->drain.delay )
    {
        head = storageDepth - theLidProc->drain.offset;
        if ( head > 0.0 )
        {
            StorageDrain = getStorageDrainRate(storageDepth, 0.0, 0.0, 0.0);
            maxValue = (head/Tstep);
            StorageDrain = MIN(StorageDrain, maxValue);
        }
    }

    //... limit inflow to available storage
    StorageInflow = SurfaceInflow;
    maxValue = (theLidProc->storage.thickness - storageDepth) / Tstep +
        StorageDrain;
    StorageInflow = MIN(StorageInflow, maxValue);
    SurfaceInfil = StorageInflow;

    //... assign values to layer flux rates
    f[SURF] = SurfaceInflow - StorageInflow;
    f[STOR] = StorageInflow - StorageDrain;
    f[SOIL] = 0.0;
}

SWMM 5.2.2 Code for LID Function getSurfaceOutflowRate

This code defines a function called "getSurfaceOutflowRate" which calculates the outflow rate from a LID's surface layer. The function takes in a depth of ponded water on the surface layer (in feet) and returns the outflow from the surface layer (in feet per second) as output. The function starts by initializing two variables, "delta" and "outflow", to 0.0. Then, it checks if the depth of ponded water is below the storage depth and if it is, it immediately returns 0.0.

Otherwise, the function calculates the outflow from overland flow Manning equation, which is the product of surface layer's alpha, the fifth root of delta, full width of the LID, and the area of the LID. The function also checks if the outflow is greater than the change in time step and if it is, it limits the outflow to the change in time step.

VariableDescription
deltaThe difference between the depth of ponded water and the thickness of the surface layer
outflowThe outflow rate from the surface layer
theLidProc->surface.thicknessThe thickness of the surface layer
theLidProc->surface.alphaThe alpha value used in the overland flow Manning equation
theLidUnit->fullWidthThe full width of the LID
theLidUnit->areaThe area of the LID
TstepThe change in time step

Note that this function should not be applied to swales or rain barrels.



double getSurfaceOutflowRate(double depth)
//
//  Purpose: computes outflow rate from a LID's surface layer.
//  Input:   depth = depth of ponded water on surface layer (ft)
//  Output:  returns outflow from surface layer (ft/s)
//
//  Note: this function should not be applied to swales or rain barrels.
//
{
    double delta;
    double outflow;

    //... no outflow if ponded depth below storage depth
    delta = depth - theLidProc->surface.thickness;
    if ( delta < 0.0 ) return 0.0;

    //... compute outflow from overland flow Manning equation
    outflow = theLidProc->surface.alpha * pow(delta, 5.0/3.0) *
              theLidUnit->fullWidth / theLidUnit->area;
    outflow = MIN(outflow, delta / Tstep);
    return outflow;
}

MSDOS Batch Commands

 You can use the "dir" command in MS-DOS to find all the files in a folder ending in ".inp" and its subfolders. The syntax for this command is as follows:

dir /s /b /o:n <folder_path>\*.inp
  • The "/s" option tells the command to search for files in all subfolders of the specified folder.
  • The "/b" option tells the command to display the list of files in a bare format (without any additional information such as file size or date modified).
  • The "/o:n" option tells the command to sort the list of files by name in ascending order.
  • Replace <folder_path> with the path of the folder that you want to search.

For example, to search for all files with the extension ".inp" in the folder "C:\Examples" and its subfolders, you would use the following command:

dir /s /b /o:n C:\Examples\*.inp

This will display a list of all files in the specified folder and its subfolders that end with the ".inp" extension and the output will be sorted by name.

SWMM 5.2.2 Code for LID Function getPavementPermRate

This code defines a function called "getPavementPermRate" which calculates the reduced permeability of a pavement layer due to clogging. The function does not take in any inputs and returns the reduced permeability of the pavement layer (in feet per second) as output. The function starts by initializing three variables "permReduction", "clogFactor" and "regenDays".

VariableDescription
permReductionThe permeability reduction due to clogging
clogFactorThe clogging factor of the pavement layer
regenDaysThe number of days it takes to regenerate the permeability of the pavement layer

The function then checks if clogFactor is greater than 0.0, if it is, it proceeds to check if regenDays is greater than 0.0. If regenDays is greater than 0.0, the function checks if OldRunoffTime is greater than or equal to the next regeneration day, if it is, the function reduces the total volume treated by the degree of regeneration and updates the next day that regeneration occurs.

Lastly, the function calculates the permeability reduction factor and limits it to 1.0. It then returns the effective pavement permeability by multiplying the pavement's kSat value by (1-permReduction).



double getPavementPermRate()
//
//  Purpose: computes reduced permeability of a pavement layer due to
//           clogging.
//  Input:   none
//  Output:  returns the reduced permeability of the pavement layer (ft/s).
//
{
    double permReduction = 0.0;
    double clogFactor= theLidProc->pavement.clogFactor;
    double regenDays = theLidProc->pavement.regenDays;

    // ... find permeability reduction due to clogging     
    if ( clogFactor > 0.0 )
    {
        // ... see if permeability regeneration has occurred
        //     (regeneration is assumed to reduce the total
        //      volumetric loading that the pavement has received)
        if ( regenDays > 0.0 )
        {
            if ( OldRunoffTime / 1000.0 / SECperDAY >= theLidUnit->nextRegenDay )
            {
                // ... reduce total volume treated by degree of regeneration
                theLidUnit->volTreated *= 
                    (1.0 - theLidProc->pavement.regenDegree);

                // ... update next day that regenration occurs
                theLidUnit->nextRegenDay += regenDays;
            }
        }

        // ... find permeabiity reduction factor
        permReduction = theLidUnit->volTreated / clogFactor;
        permReduction = MIN(permReduction, 1.0);
    }

    // ... return the effective pavement permeability
    return theLidProc->pavement.kSat * (1.0 - permReduction);
}

SWMM 5.2.2 Code for LID Function getStorageExfilRate

 This code defines a function called "getStorageExfilRate" which calculates the exfiltration rate (infiltration rate) of water from a storage zone into the native soil beneath a "LID" (low impact development). The function takes in the depth of the water storage zone (in feet) and returns the infiltration rate (in feet per second) as output. The function starts by initializing two variables, "infil" and "clogFactor", to 0.0. Then, it checks if the storage zone's "kSat" value is 0.0, and if it is, it immediately returns 0.0. If not, it checks if "MaxNativeInfil" is 0.0, and if it is, it also immediately returns 0.0. Next, the function calculates a reduction factor for clogging, and limits the infiltration rate by any groundwater-imposed limits. Finally, the function returns the minimum value of the infiltration rate or the MaxNativeInfil.

double getStorageExfilRate() // // Purpose: computes exfiltration rate from storage zone into // native soil beneath a LID. // Input: depth = depth of water storage zone (ft) // Output: returns infiltration rate (ft/s) // { double infil = 0.0; double clogFactor = 0.0; if ( theLidProc->storage.kSat == 0.0 ) return 0.0; if ( MaxNativeInfil == 0.0 ) return 0.0; //... reduction due to clogging clogFactor = theLidProc->storage.clogFactor; if ( clogFactor > 0.0 ) { clogFactor = theLidUnit->waterBalance.inflow / clogFactor; clogFactor = MIN(clogFactor, 1.0); } //... infiltration rate = storage Ksat reduced by any clogging infil = theLidProc->storage.kSat * (1.0 - clogFactor); //... limit infiltration rate by any groundwater-imposed limit return MIN(infil, MaxNativeInfil);

SWMM 5.2.2 Code for LID Function getSoilPercRate

 This code defines a function called "getSoilPercRate" that takes in a single input, "theta", which represents the moisture content (fraction). The function then calculates the percolation rate of water through a LID's soil layer and returns this value as output (in units of ft/s). The function first checks if the soil moisture is less than or equal to the field capacity, and if so, the function returns 0.0 (no percolation). If the soil moisture exceeds the field capacity, the function calculates the percolation rate as the unsaturated hydraulic conductivity and returns this value.


double getSoilPercRate(double theta) // // Purpose: computes percolation rate of water through a LID's soil layer. // Input: theta = moisture content (fraction) // Output: returns percolation rate within soil layer (ft/s) // { double delta; // moisture deficit // ... no percolation if soil moisture <= field capacity if ( theta <= theLidProc->soil.fieldCap ) return 0.0; // ... perc rate = unsaturated hydraulic conductivity delta = theLidProc->soil.porosity - theta; return theLidProc->soil.kSat * exp(-delta * theLidProc->soil.kSlope);

ICM SWMM sw_2d_boundary_line Variable Names for SQL and Ruby Scripts

      The file "opwrowobjectlayoutswmm.xml" is a data file used by the Integrated Urban Water Management Model (ICM) software. The ICM software is used toVV simulate and analyze the performance of stormwater management systems, including the design and operation of stormwater collection and conveyance systems.

The file "opwrowobjectlayoutswmm.xml" contains variable names specific to the SWMM (Storm Water Management Model) conduit feature in the ICM software. These variable names are used in SQL and Ruby scripts, which are programming languages used to manipulate and analyze the data generated by the ICM software.

These variable names are used to represent the different attributes of a sw_2d_boundary_line within the ICM software and the SQL and Ruby scripts allow users to access and manipulate that data in a variety of ways.


<table name="sw_2d_boundary_line">
<group name="Boundary definition">
line_id
line_type
<field menu="sw_head_unit_discharge">head_unit_discharge_id
length
bed_load_boundary
suspended_load_boundary
</group>
<group import_group="gen_prop"/>
<group import_group="user_prop"/>
</table>
<table name="sw_head_unit_discharge">
<group name="Head unit flow definition">
head_unit_discharge_id
head_unit_discharge_description
HUDP_table
</group>
<group import_group="gen_prop"/>
<group import_group="user_prop"/>

Table 1: sw_2d_boundary_line

  • Group 1: Boundary definition
    • line_id
    • line_type
    • head_unit_discharge_id (from menu "sw_head_unit_discharge")
    • length
    • bed_load_boundary
    • suspended_load_boundary
  • Group 2: Imports group "gen_prop"
  • Group 3: Imports group "user_prop"

Table 2: sw_head_unit_discharge

  • Group 1: Head unit flow definition
    • head_unit_discharge_id
    • head_unit_discharge_description
    • HUDP_table
  • Group 2: Imports group "gen_prop"
  • Group 3: Imports group "user_prop"

InfoSWMM: A 2030 AI-Assisted Study Guide

  InfoSWMM: A 2030 AI-Assisted Study Guide delete   InfoSWMM: A 2030 AI-Assisted Study Guide A comprehensive study guide for someone in 2030...