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].
Variable | Description |
---|---|
SurfaceVolume | The volume of water in the surface layer |
SoilVolume | The volume of water in the soil layer |
StorageVolume | The volume of water in the storage layer |
SurfaceInfil | The infiltration rate into the surface layer |
SurfaceOutflow | The outflow rate from the surface layer |
StorageDrain | The drainage rate from the storage layer |
StorageInflow | The inflow rate into the storage layer |
SurfaceInflow | The inflow rate into the surface layer |
theLidProc->drain.delay | The delay time before drainage begins from the storage layer |
theLidUnit->dryTime | The time since the last rain |
theLidProc->drain.offset | The offset for determining the head for drainage |
theLidProc->storage.thickness | The thickness of the storage layer |
Tstep | The 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.