Showing posts with label SWMM 5.2.2 Code for LID Function getEvapRates. Show all posts
Showing posts with label SWMM 5.2.2 Code for LID Function getEvapRates. Show all posts

Sunday, January 15, 2023

SWMM 5.2.2 Code for LID Function getEvapRates

This code is for calculating evaporation rates for a low impact development (LID) unit, specifically for the surface layer, pavement, soil, and storage layer. It takes in the volumes/areas of water in each layer (surfaceVol, paveVol, soilVol, and storageVol) as well as the fraction of the surface layer that is pervious (pervFrac) as inputs. It also uses a global variable EvapRate. The function first calculates the available evaporation rate and then calculates the evaporation rate for each layer using the MIN and MAX functions to ensure the evaporation rate does not exceed the available evaporation rate or the volume of water in the layer. The evaporation rate for the surface layer is multiplied by the fraction of the surface layer that is pervious. If the SurfaceInfil variable is greater than zero, the evaporation rates for the pavement, soil, and storage layers are set to zero. The code also uses Tstep variable to convert the rate to total volume over the current time step. The output of this function is updating the member variable SurfaceEvap, PaveEvap, SoilEvap, and StorageEvap and doesn't return any value.

void getEvapRates(double surfaceVol, double paveVol, double soilVol,
    double storageVol, double pervFrac)
//
//  Purpose: computes surface, pavement, soil, and storage evaporation rates.
//  Input:   surfaceVol = volume/area of ponded water on surface layer (ft)
//           paveVol    = volume/area of water in pavement pores (ft)
//           soilVol    = volume/area of water in soil (or pavement) pores (ft)
//           storageVol = volume/area of water in storage layer (ft)
//           pervFrac   = fraction of surface layer that is pervious
//  Output:  none
//
{
    double availEvap;

    //... surface evaporation flux
    availEvap = EvapRate;
    SurfaceEvap = MIN(availEvap, surfaceVol/Tstep);
    SurfaceEvap = MAX(0.0, SurfaceEvap);
    availEvap = MAX(0.0, (availEvap - SurfaceEvap));
    availEvap *= pervFrac;

    //... no subsurface evap if water is infiltrating
    if ( SurfaceInfil > 0.0 )
    {
        PaveEvap = 0.0;
        SoilEvap = 0.0;
        StorageEvap = 0.0;
    }
    else
    {
        //... pavement evaporation flux
        PaveEvap = MIN(availEvap, paveVol / Tstep);
        availEvap = MAX(0.0, (availEvap - PaveEvap));

        //... soil evaporation flux
        SoilEvap = MIN(availEvap, soilVol / Tstep);
        availEvap = MAX(0.0, (availEvap - SoilEvap));

        //... storage evaporation flux
        StorageEvap = MIN(availEvap, storageVol / Tstep);
    }
}

}

GitHub code and Markdown (MD) files Leveraging

 To better achieve your goal of leveraging your GitHub code and Markdown (MD) files for your WordPress blog or LinkedIn articles, consider t...