skip to main content
Water Quality : Reservoir Water Quality : Solution / Dispatching
Solution / Dispatching
Topics
Beginning of Water Quality Run
The following functionality is executed one time at the beginning of the run. It is called from within beginning of run behavior on the Reservoir object.
Using Layered Methods to Model Temperature  
1. Check for initial epilimnion and hypolimnion temperatures. If not input, then flag an error and exit
2. Check Specific Heat slot for input. If not input, then set to standard value of 4.186 KJ/g C.
3. Check Reservoir Geometry Coefficients for data. If not input, then execute utility method cubicFit.
4. Check Release Elevation, Reservoir Length, Thickness of Epilimnion, and Thickness of Metalimnion for input. If not input, then flag an error and exit.
5. If the Withdrawal Zone Coefficient is not valid, set it to 1.0.
6. Check for Air Temperature, Dewpoint Temperature, and Solar Radiation data. If data is incomplete, then flag error and exit.
7. If Wind Velocity data is incomplete, set is to zero
8. If Thermo Diffusion Coefficient Adjust data is incomplete, then fill values to 1.0.
9. If Diversion, Return Flow, or Inflow are not linked and not valid, set corresponding temperatures to zero.
10. For a Slope Power Reservoir, if Inflow2 is not linked and not valid, set corresponding temperatures to zero.
Using Layered Methods to Model Salinity  
1. Check for initial epilimnion and hypolimnion salt concentrations. If not valid, then flag an error and exit.
2. If Diversion, Return Flow, or Inflow are not linked and not valid, set corresponding salt concentrations to zero.
3. For a Slope Power Reservoir, if Inflow2 is not linked and not valid, set corresponding salt mass to zero.
Using Layered Methods to Model Dissolved Oxygen  
1. check for initial epilimnion and hypolimnion detritus, dissolved organics, ammonia, and dissolved oxygen concentrations. If not input, then flag and error.
2. If Diversion, Return Flow, or Inflow are not linked and not valid, set corresponding detritus, dissolved organics, ammonia, and dissolved oxygen concentrations to zero.
3. Check for data in following slots: Detritus Parameters, Dissolved Organics Parameters, Ammonia Parameters, SOD Parameters, Photosynthesis Parameters, Respiration Parameters. If any data is missing, flag error and exit.
4. For a Slope Power Reservoir, if Inflow2 is not linked and not valid, set Inflow2 detritus, dissolved organics, ammonia, and dissolved oxygen concentrations to zero.
Using Well Mixed Salt Method  
1. Check for initial Reservoir Salt Concentration, initial Bank Storage Salt Concentration, and Dead Storage. If not input, then set to zero.
2. If Hydrologic Inflow Salt Concentration, Return Flow Salt Mass, or Diversion Salt Concentration are not linked and not input, then set to zero.
Using Segmented 2 Layer Method  
1. Check the Agg Series Slots and Table slots to ensure they contain the number of rows or columns which correspond to the number of segments.
2. Check for initial Epilimnion Salt Concentration by Segment, Hypolimnion Salt Concentration by Segment, and initial Bank Storage Salt Concentration. If not input, then set to zero.
3. If Hydrologic Inflow Salt Concentration, Return Flow Salt Mass, or Diversion Salt Concentration are not linked and not input, then set to zero.
4. Check the Segment Parameters Table to ensure all proportions sum to 1.
5. Calculate initial values for Epilimnion Volume by Segment, Hypolimnion Volume by Segment, Bank Storage by Segment and Reservoir Salt Mass.
Modeling TDG  
1. Check for valid values in the slots: Tailwater Bottom Elevation, TDG c1, TDG Entrainment b1, TDG Entrainment b3, TDG Spill b2, TDG Spill and Turbine Release Limits.
2. If the Opt Outflow TDG Tailwater Depth is selected, make sure a valid Tailwater method is selected. See Optimization Total Dissolved Gas for details.
Dispatch Slots
Dispatch slots appear in the dispatch conditions of the Dispatch Methods, link to another object, or both. Thus, the existence of a value in these slots determines when the object dispatches and which Dispatch Method is executed.
Note:  Specific slots depend on the selected constituents.
Layered Methods Dispatch Slots
 
• Canal Flow Ammonia Conc
• Outflow Dissolved Oxygen Mass
• Canal Flow Detritus Conc
• Outflow Heat
• Canal Flow Dissolved Organics Conc
• Outflow Salt Mass
• Canal Flow Dissolved Oxygen Conc
• Pump Storage Inflow Ammonia
• Canal Flow Salt Conc
• Pump Storage Inflow Detritus
• Canal Flow Temp
• Pump Storage Inflow Dissolved Oxygen
• Diversion Ammonia Conc
• Pump Storage Inflow Organics
• Diversion Detritus Conc
• Pump Storage Inflow Salt
• Diversion Dissolved Organics Conc
• Pump Storage Inflow Temp
• Diversion Dissolved Oxygen Conc
• Pump Storage Outflow Ammonia
• Diversion Salt Concentration
• Pump Storage Outflow Detritus
• Diversion Temp
• Pump Storage Outflow Dissolved Oxygen
• Inflow Ammonia Mass
• Pump Storage Outflow Organics
• Inflow Detritus Mass
• Pump Storage Outflow Salt
• Inflow Dissolved Organics Mass
• Pump Storage Outflow Temp
• Inflow Dissolved Oxygen Mass
• Return Flow Ammonia Conc
• Inflow Heat
• Return Flow Detritus Conc
• Inflow Salt Mass
• Return Flow Dissolved Organics Conc
• Outflow Ammonia Mass
• Return Flow Dissolved Oxygen Conc
• Outflow Detritus Mass
• Return Flow Salt Conc
• Outflow Dissolved Organics Mass
• Return Flow Temp
Well Mixed Salt Method Dispatch Slots
• Diversion Salt Concentration
• Outflow Salt Concentration
• Hydrologic Inflow Salt Conc
• Outflow Salt Mass
• Inflow Salt Concentration
• Reservoir Salt Concentration
• Inflow Salt Mass
• Return Flow Salt Mass
Segmented 2 Layer Salt, Dispatch Slots
• Diversion Salt Concentration
• Outflow Salt Concentration
• Hydrologic Inflow Salt Conc
• Outflow Salt Mass
• Inflow Salt Concentration
• Return Flow Salt Concentration
• Inflow Salt Mass
TDG Method Dispatch Slots
• Inflow TDG Concentration
• Outflow TDG Concentration
• Spill TDG Concentration
• Delta Inflow
• Delta Outflow
• Delta Outflow TDG Concentration
• Delta Inflow TDG Concentration
Dispatch Methods
The controller for water quality currently has a dispatch method for each constituent and solution approach combination. They assume the mass balance has already solved and therefore mass balance slots are also required slots.
The following water quality dispatch methods exist on all reservoirs. In order for the method to be executed for each timestep, both the known and unknown slot lists must be satisfied. Each dispatch method represents a possible combination of constituent and solution approach choices made at the global level.
* Solve 2 Layer Temperature
This dispatch method is available for the Layered Temp method.
Required Known Slots
• Diversion
• Outflow
• Hydrologic Inflow
• Return Flow
• Inflow
• Storage
• Inflow Heat
Required Unknown Slots
• Outflow Heat
Method Details  
This method calls the following utility methods:
* Solve 2 Layer Salt
This dispatch method is available for the Layered Salt method.
Required Known Slots
• Diversion
• Outflow
• Hydrologic Inflow
• Return Flow
• Inflow
• Storage
• Inflow Salt Concentration
Required Unknown Slots
• Inflow Salt Mass
• Outflow Salt Mass
• Outflow Salt Concentration
Method Details  
This method calls the following utility methods:
* Solve 2 Layer Temp and Salt
This dispatch method is available for the Layered Temp and Salt method.
Required Known Slots
• Diversion
• Inflow Salt Mass
• Hydrologic Inflow
• Outflow
• Inflow
• Return Flow
• Inflow Heat
• Storage
Required Unknown Slots
• Outflow Heat
• Outflow Salt Mass
Method Details  
This method calls the following utility methods:
* Solve 2 Layer Temp and DO
This dispatch method is available for the Layered Temp and DO method.
Required Known Slots
• Diversion
• Inflow Dissolved Oxygen Mass
• Hydrologic Inflow
• Inflow Heat
• Inflow
• Outflow
• Inflow Ammonia Mass
• Return Flow
• Inflow Detritus Mass
• Storage
• Inflow Dissolved Organics Mass
Required Unknown Slots
• Outflow Ammonia Mass
• Outflow Dissolved Oxygen Mass
• Outflow Detritus Mass,
• Outflow Heat
• Outflow Dissolved Organics Mass
Method Details  
This method calls the following utility methods:
* Solve 2 Layer Temp Salt and DO
This dispatch method is available for the Layered Temp Salt and DO method.
Required Known Slots
• Diversion
• Inflow Dissolved Oxygen Mass
• Hydrologic Inflow
• Inflow Heat
• Inflow
• Inflow Salt Mass
• Inflow Ammonia Mass
• Outflow
• Inflow Detritus Mass
• Return Flow
• Inflow Dissolved Organics Mass
• Storage
Required Unknown Slots
• Outflow Ammonia Mass
• Outflow Dissolved Oxygen Mass
• Outflow Detritus Mass,
• Outflow Heat
• Outflow Dissolved Organics Mass
• Outflow Salt Mass
Method Details  
This method calls the following utility methods:
* Solve Segmented 2 Layer Salt
This dispatch method is available for the Segmented 2 Layer Salt method.
Required Known Slots
• Storage
• Inflow
• Outflow
• Inflow Salt Concentration
Required Unknown Slots
• Outflow Salt Concentration
• Outflow Salt Mass
Method Details  
This method calls the following utility method:
* Solve Weight Factor Salt Given In
This dispatch method is available for the Well Mixed Salt method when the Weighting Factor Salt method is selected from the WQ Reservoir Routing category. It solves for Outflow Salt Concentration given Inflow Salt Concentration.
Required Known Slots
• Inflow
• Outflow
• Inflow Salt Concentration
• Storage
Required Unknown Slots
• Outflow Salt Concentration
• Reservoir Salt Concentration
Method Details  
First, the massBalanceSaltInit utility function is called to set up local variables and verify that there are the necessary data (see massBalanceSaltInit). Next, the getAvgSaltConcIn function is called to determine the weighted average inflowSaltConcentration (see getAvgSaltConcIn).
If Storage is not valid or the reservoir’s previous and current storage are less than or equal to 5.0 acre-feet, set the Reservoir Salt Concentration equal to the Previous Reservoir Concentration and Outflow Salt Concentration to Inflow Salt Concentration then exit the method.
Next, calculate the local variable storSum as follows:
(14.7)    
Calculate the weightingFactor:
(14.8)    
StorSum is then recalculated as follows:
(14.9)    
If storSum is equal to 0.0 then set Reservoir Salt Concentration equal to Previous Reservoir Salt Concentration. Otherwise, Reservoir Salt Concentration equals Outflow Salt Concentration.
(14.10)    
The Previous Reservoir Salt Concentration is set one time step forward to put the reservoir on the queue for the next time step. The Reservoir Outflow Salt Concentration is calculated as follows:
(14.11)    
Finally, Inflow Salt Mass, Outflow Salt Mass, Diversion Salt Mass and Hydrologic Inflow Salt Mass are set by multiplying their respective volumes and concentrations.
* Solve Weight Factor Salt Given Out
This dispatch method is available for the Well Mixed Salt method when the Weighting Factor Salt method is selected from the WQ Reservoir Routing category. It solves for Inflow Salt Concentration given Outflow Salt Concentration.
Required Known Slots
• Inflow
• Outflow Salt Concentration
• Outflow
• Storage
Required Unknown Slots
• Inflow Salt Concentration
• Reservoir Salt Concentration
Method Details  
First, the massBalanceSaltInit utility function is called to set up local variables and verify that there are the necessary data. See massBalanceSaltInit for details.
If Storage is not valid or the reservoir’s previous and current storage are less than or equal to 5.0 Acre-feet, set the Reservoir Salt Concentration equal to the Previous Reservoir Concentration and Inflow Salt Concentration to Outflow Salt Concentration then exit the method.
Next, calculate the local variable storSum as follows:
(14.12)    
Calculate the weightingFactor:
(14.13)    
StorSum is then recalculated as follows:
(14.14)    
If storSum is equal to 0.0 then set Reservoir Salt Concentration equal to Previous Reservoir Salt Concentration. Otherwise, Reservoir Salt Concentration equals Outflow Salt Concentration.
(14.15)    
The Previous Reservoir Salt Concentration is set one time step forward to put the reservoir on the queue for the next time step. The Reservoir Inflow Salt Concentration is calculated as follows:
(14.16)    
Finally, Inflow Salt Mass, Outflow Salt Mass, Diversion Salt Mass and Hydrologic Inflow Salt Mass are set by multiplying their respective volumes and concentrations.
* Solve Pred-Corr Salt Given In
This dispatch method is available for the Well Mixed Salt method when the Predictor-Corrector Salt method is selected from the WQ Reservoir Routing category. It solves for Outflow Salt Concentration given Inflow Salt Concentration.
Required Known Slots
• Inflow
• Outflow
• Inflow Salt Concentration
• Storage
Required Unknown Slots
• Outflow Salt Concentration
• Reservoir Salt Concentration
Method Details  
First, the massBalanceSaltInit utility function is called to set up local variables and verify that there are the necessary data (see massBalanceSaltInit). Next, the getAvgSaltConcIn function is called to determine the weighted average inflowSaltConcentration (see getAvgSaltConcIn).
Next, the local variable storSum is calculated as Storage plus Dead Storage.
(14.17)    
If storSum is equal to 0.0 then set Reservoir Salt Concentration equal to ‑1.0 (the Reservoir Salt Concentration is recalculated in Equation 14.23. Otherwise, solve for the predictor (in units of salt mass):
(14.18)    
The local variable intermediateReservoirSaltConc is computed as follows:
(14.19)    
Solve for the corrector (in units of salt mass):
(14.20)    
The local variable slope is the average of the predictor and the corrector
(14.21)    
The Reservoir Salt Concentration is calculated as follows:
(14.22)    
If the calculated Reservoir Salt Concentration is negative (that is, the calculation failed to find a valid concentration because there is very little storage in the reservoir) or if storage and previous storage are less than or equal to 5.0 acre-feet, the Reservoir Salt Concentration is reset to the weighted average of the salt concentrations of the inflows.
(14.23)    
The Previous Reservoir Salt Concentration is set one time step forward to put reservoir on the queue for the next time step. Finally, the Outflow Salt Concentration is set equal to the Reservoir Salt Concentration and Inflow Salt Mass, Outflow Salt Mass, Diversion Salt Mass and Hydrologic Inflow Salt Mass are set by multiplying their respective volumes and concentrations.
* Solve Pred-Corr Salt Given Out
This dispatch method is available for the Well Mixed Salt when the Predictor-Corrector Salt method is selected from the WQ Reservoir Routing category. It solves for Inflow Salt Concentration given Outflow Salt Concentration.
Required Known Slots
• Inflow
• Outflow Salt Concentration
• Outflow
• Storage
Required Unknown Slots
• Inflow Salt Concentration
• Reservoir Salt Concentration
Method Details  
First, the massBalanceSaltInit utility function is called to set up local variables and verify that there are the necessary data. See massBalanceSaltInit.
Next, calculate the local variable storSum as Storage plus Dead Storage.
(14.24)    
If Storage is not valid or the reservoir’s previous and current storage are less than or equal to 5.0 Acre-feet, set the Reservoir Salt Concentration equal to the Previous Reservoir Concentration and Inflow Salt Concentration to Outflow Salt Concentration then exit the method.
If storSum is equal to 0.0 then set Reservoir Salt Concentration equal to Previous Reservoir Salt Concentration. Otherwise, Reservoir Salt Concentration equals Outflow Salt Concentration.
(14.25)    
The Previous Reservoir Salt Concentration is set one time step forward to put the reservoir on the queue for the next time step. If inVol equals zero then inflowSaltConc is set equal to zero, otherwise the Reservoir Inflow Salt Concentration is calculated as follows:
(14.26)    
Finally, Inflow Salt Mass, Outflow Salt Mass, Diversion Salt Mass and Hydrologic Inflow Salt Mass are set by multiplying their respective volumes and concentrations.
* Solve Reservoir TDG Outflow
This dispatch method computes the physical and optimization slots based on the actual slot values.
Required Known Slots
• Regulated Spill
• Tailwater Elevation
• Turbine Release
• Inflow TDG Concentration
Required Unknown Slots
• Spill TDG Concentration
• Outflow TDG Concentration
Method Details  
This method executes the Outflow TDG using the Tailwater Depth method, and then executes the selected method in the Optimization Total Dissolved Gas. See Total Dissolved Gas Methodology for details on these methods.
Revised: 12/01/2020