This code is a function called "greenRoofFluxRates" that calculates flux rates from the layers of a green roof. It takes in two input arrays, "x" and "f", which represent the vector of storage levels and the vector of flux rates, respectively. The function uses several intermediate variables, including "availVolume" and "maxRate". It also makes use of several properties of the green roof, such as "soilThickness", "storageThickness", "soilPorosity", "storageVoidFrac", "soilFieldCap", and "soilWiltPoint".
The code first retrieves the moisture levels from the input vector "x" and converts them to volumes. It then calculates the ET rates, soil layer perc rate, and storage (drain mat) outflow rate. The code also checks for the case where the unit is full and limits the rates accordingly. The Surface infil is adjusted so that the soil porosity is not exceeded. The code also finds the surface outflow rate and computes overall layer flux rates.
A table of the variables used in this function and their descriptions is as follows:
Variable Name | Description |
---|---|
x[SURF], x[SOIL], x[STOR] | Input vector of storage levels |
f[SURF], f[SOIL], f[STOR] | Output vector of flux rates |
surfaceDepth | Moisture level variable for the surface layer |
soilTheta | Moisture level variable for the soil layer |
storageDepth | Moisture level variable for the storage layer |
availVolume | Intermediate variable for available volume |
maxRate | Intermediate variable for maximum rate |
soilThickness | Property of the soil layer representing its thickness |
storageThickness | Property of the storage layer representing its thickness |
soilPorosity | Property of the soil layer representing its porosity |
Variable Name | Description |
---|---|
storageVoidFrac | Property of the storage layer representing its void fraction |
soilFieldCap | Property of the soil layer representing its field capacity |
soilWiltPoint | Property of the soil layer representing its wilting point |
SurfaceVolume | Volume of the surface layer |
SoilVolume | Volume of the soil layer |
StorageVolume | Volume of the storage layer |
SurfaceInflow | Inflow rate to the surface layer |
SurfaceEvap | Evaporation rate from the surface layer |
SoilPerc | Percolation rate out of the soil layer |
SoilEvap | Evaporation rate from the soil layer |
StorageExfil | Exfiltration rate out of the storage layer |
StorageDrain | Drain flow rate out of the storage layer |
SurfaceInfil | Infiltration rate into the soil layer |
SurfaceOutflow | Outflow rate from the surface layer |
The code uses several helper functions:
- getEvapRates(SurfaceVolume, 0.0, availVolume, StorageVolume, 1.0) : to calculate evaporation rate
- getSoilPercRate(soilTheta) : to calculate soil percolation rate
- getDrainMatOutflow(storageDepth) : to calculate storage (drain mat) outflow rate
- getSurfaceOutflowRate(surfaceDepth) : to calculate surface outflow rate
The final output of the function is the overall flux rate for each of the three layers: surface, soil, and storage.