skip to main content
Reservoir Water Quality
Water Quality
Reservoir Water Quality
The description of water quality for all reservoirs is contained in this section. There are no fundamental differences in the water quality methods between the Storage, Level Power, Slope Power, and Pumped Storage Reservoirs. Slope Power Reservoirs differ from the others slightly because they account for concentrations transported by an additional side flow, Inflow 2.
The current implementation of the reservoir water quality model allows the user to model the following:
• Salinity with a simple well-mixed approach or layered approach.
• Temperature along with any combination of dissolved oxygen and salinity with a layered approach.
• TDG Outflow Concentration based on the Tailwater Depth.
The algorithms employed are explicit, which allows for ease of implementation and eliminates the need to iterate between objects or between water quality and water quantity calculations (which would be necessary if evaporation was based on heat flux).
Slots
Following is a description of each of the slots for the various constituents. They are organized by water quality constituents: Temperature Slots, Salinity Slots, and Dissolved Oxygen Slots. The appropriate slots are instantiated when the user selects a Reservoir Water Quality method.
Note:  TDG-related slots are included in the TDG section; see “Outflow TDG using Tailwater Depth”.
Temperature Slots
The following slots are instantiated if temperature is one of the constituents.
Reservoir Bottom Elevation
Type: Table Slot
Units: Length
Description: 1X1 table slot representing the elevation (above some common datum) of the bottom of the reservoir at the dam
Information: Used to calculate a mean depth at the dam.
Thickness of Epilimnion
Type: Table Slot
Units: Length
Description: 1X1 table slot representing the thickness of the epilimnion layer
I/O: Must be input by user.
Thickness of Metalimnion
Type: Table Slot
Units: Length
Description: 1X1 table slot representing the thickness of the metalimnion layer (also known as the thermocline)
I/O: Must be input by user.
Elevation of Thermocline
Type: Series Slot
Units: Length
Description: elevation of the thermocline.
Information: Pool Elevation minus the Epilimnion Thickness
I/O: Output only
Inflow to Epilimnion
Type: Series Slot
Units: Flow
Description: inflow contribution to the epilimnion layer
Information: Inflow to Hypolimnion + Inflow to Epilimnion = Inflow.
I/O: Output only
Outflow from Epilimnion
Type: Series Slot
Units: Flow
Description: portion of release coming from the epilimnion
I/O: Output only
Epilimnion Volume
Type: Series Slot
Units: Volume
Description: amount of water in the epilimnion
I/O: Output only
Inflow to Hypolimnion
Type: Series Slot
Units: Flow
Description: inflow contribution to the hypolimnion layer
Information: Hypolimnion inflow + epilimnion inflow = inflow.
I/O: Output only
Outflow from Hypolimnion
Type: Series Slot
Units: Flow
Description: portion of release coming from the hypolimnion
I/O: Output only
Hypolimnion Volume
Type: Series Slot
Units: Volume
Description: amount of water in the hypolimnion
Information: Output only
I/O: Not Linkable
Thermocline Diffusion Coefficient
Type: Series Slot
Units: AreaPerTime
Description: diffusion rate through thermocline
I/O: Output only
Thermocline Diffusion Coefficient Adjustment
Type: Series Slot
Units: NoUnits
Description: scaling factor used to adjust diffusion depending on the Julian date
I/O: This slot is equal to 1.0 if not user input.
Surface Area
Type: Series Slot
Units: Area
Description: The surface area of the reservoir
I/O: Output only
Elevation Area Table
Type: Table
Units: Length vs Area
Description: A table relating pool elevation to surface area
I/O: Required Input
Inflow Heat
Type: Multi Slot
Units: Heat
Description: holds the values of inflow heat for each inflow to the reservoir
I/O: Input, set by a rule, output or propagated via a link
Outflow Heat
Type: Series Slot
Units: Heat
Description: temperature of releases from the reservoir
I/O: Output only
Temperature
Type: Agg Series Slot
Units: Temperature
Description: contains the inflow temperature, outflow temperature, total inflow temperature, hydrologic inflow temperature, epilimnion temperature, and hypolimnion temperature.
I/O: Most values of this slot are calculated; however, hydrologic inflow temperature may be input and initial epilimnion and hypolimnion temperatures must be input.
Diversion Temp
Type: Series Slot
Units: Temperature
Description: temperature of Diversion.
I/O: Input, set by a rule, output or propagated via a link
Return Flow Temp
Type: Series Slot
Units: Temperature
Description: temperature of Return Flow.
I/O: Input, set by a rule, output or propagated via a link
Canal Flow Temp
Type: Series Slot
Units: Temperature
Description: temperature of Canal Flow.
I/O: Input, set by a rule, output or propagated via a link
Pump Storage Inflow Temp
Type: Series Slot
Units: Temperature
Description: temperature of inflow from Pumped Storage Reservoir.
I/O: Input, set by a rule, output or propagated via a link
Pump Storage Outflow Temp
Type: Series Slot
Units: Temperature
Description: temperature of outflow to Pumped Storage Reservoir.
I/O: Input, set by a rule, output or propagated via a link
Specific Heat of Water
Type: Table Slot
Units: SpecificHeat
Description: specific heat of water. Used for heat / temperature conversions.
I/O: Input or defaults to standard value
Heat of Evaporation
Type: Series Slot
Units: EnergyFlux
Description: heat used in evaporation during the timestep
Information: Calculated by the calcHe function.
I/O:  
Surface Heat Flux
Type: Series Slot
Units: EnergyFlux
Description: total gain or loss from evaporation, incoming solar, convection, back radiation, etc. at the reservoir surface
Information: Output only
I/O: Not Linkable
Air Temperature
Type: Series Slot
Units: Temperature
Description: air temperature at the reservoir surface
I/O: Input only
Dewpoint Temperature
Type: Series Slot
Units: Temperature
Description: dewpoint temperature at the reservoir surface
I/O: Input only
Incoming Solar Radiation
Type: Series Slot
Units: HeatFlux
Description: incoming solar radiation received by the reservoir
I/O: Input only
Wind Velocity
Type: Series Slot
Units: Velocity
Description: wind velocity at reservoir surface
I/O: This slot is assumed to be zero if not a user input.
Salinity Slots
Well-mixed Salt Slots
The following water quality slots are instantiated.
Inflow Salt Concentration
Type: Multi Slot
Units: Concentration
Description: holds the values of inflow salinity for each inflow to the reservoir
Information: Because this slot is a multi-slot, more than one link can be created to this slot which will add columns to the slot. The first column is the sum of the other columns but does not represent the inflow concentration. The dispatch methods do a weighted average to determine the weighted concentration, but this is not displayed in the slot.
I/O: Input, set by a rule, output or propagated via a link
Inflow Salt Mass
Type: Multi Slot
Units: Mass
Description: holds the values of inflow salinity for each inflow to the reservoir
I/O: Output only
Hydrologic Inflow Salt Conc
Type: Series Slot
Units: Concentration
Description: salt concentration of hydrologic inflows.
I/O: Input, set by a rule, output or propagated via a link
Hydrologic Inflow Salt Mass
Type: Series Slot
Units: MASS
Description: holds the values of inflow salinity for each hydrologic inflow to the reservoir
I/O: Output only
Diversion Salt Concentration
Type: Series Slot
Units: Concentration
Description: salt concentration of Diversion.
I/O: Input, set by a rule, output or propagated via a link
Diversion Salt Mass
Type: Series Slot
Units: Mass
Description: The mass values of salt that is diverted from the reservoir
I/O: Output only
Return Flow Salt Mass
Type: Multi Slot
Units: Mass
Description: The mass values of salt in each return flow to the reservoir.
I/O: Input, set by a rule, output or propagated via a link
Return Flow Salt Conc
Type: Series Slot
Units: Concentration
Description: The salt concentration for the return flow to the reservoir.
I/O: Output only
Outflow Salt Concentration
Type: Series Slot
Units: Concentration
Description: salinity of releases from the reservoir
I/O: Input, set by a rule, output or propagated via a link
Outflow Salt Mass
Type: Series Slot
Units: Mass
Description: salt mass in releases from the reservoir
I/O: Output only
Reservoir Salt Concentration
Type: Series Slot
Units: Concentration
Description: salt concentration of reservoir
Information: If not input at the initial timestep, this will default to zero.
I/O: Output only
Reservoir Salt Mass
Type: Series Slot
Units: Mass
Description: Mass of salt in the reservoir
Information:
I/O: Output only
Dead Storage
Type: Table Slot
Units: Volume
Description: dead storage volume.
I/O: Input, if not valid at initial timestep, this will default to zero.
Layered salt slots
The following slots are added for the Layered Salt, Layered Temp and Salt, and Layered Temp Salt and DO.
Inflow Salt Mass
Type: Multi Slot
Units: Mass
Description: holds the values of inflow salinity for each inflow to the reservoir
I/O: Input, rules, output, or propagated via a link
Inflow Salt Concentration
Type: Multi Slot
Units: Concentration
Description: holds the values of inflow salinity for each inflow to the reservoir
Information: Because this slot is a multi-slot, more than one link can be created to this slot which will add columns to the slot. The first column is the sum of the other columns but does not correctly represent the inflow concentration. The dispatch methods do a weighted average to determine the weighted concentration, but this is not displayed in the slot.
I/O: Input, rules, output, or propagated via a link.
Outflow Salt Mass
Type: Series Slot
Units: Mass
Description: salt mass in releases from the reservoir
I/O: Output only
Outflow Salt Concentration
Type: Series Slot
Units: Concentration
Description: holds the values of outflow salinity from the reservoir
I/O: Output
Salt Concentrations
Type: Agg Series Slot
Units: Concentration
Description: contains the inflow salt concentration, outflow salt concentration, total inflow salt concentration, hydrologic inflow salt concentration, epilimnion salt concentration, and hypolimnion salt concentration.
I/O: Most values of this slot are calculated; however, hydrologic inflow salt concentration may be input and initial epilimnion and hypolimnion salt concentrations must be input.
Diversion Salt Concentration
Type: Series Slot
Units: Concentration
Description: salt concentration of Diversion.
I/O: Input, rules, output, or propagated via a link
Return Flow Salt Conc
Type: Multi Slot
Units: Concentration
Description: salt concentration of Return Flow.
Information: When there are multiple links to this slot, the subslots will be shown. The first column is the sum column, which is not relevant as these are concentrations not mass.
I/O: Input, rules, output, or propagated via a link
Canal Flow Salt Conc
Type: Series Slot
Units: Concentration
Description: salt concentration of Canal Flow.
I/O: Input, rules, output, or propagated via a link
Pump Storage Inflow Salt
Type: Series Slot
Units: Concentration
Description: salt concentration of inflow from Pumped Storage Reservoir.
I/O: Input, rules, or propagated via a link
Pump Storage Outflow Salt
Type: Series Slot
Units: Concentration
Description: salt concentration of outflow to Pumped Storage Reservoir.
I/O: Input, rules, or propagated via a link
Inflow2 Salt Concentration
Type: Series Slot
Units: Concentration
Description: holds the values of Inflow 2 salinity to the reservoir
Information: This slot is on a Sloped Power Reservoir only.
I/O: Input, propagated, or set by a rule.
Inflow2 Salt Mass
Type: Series Slot
Units: Mass
Description: holds the values of Inflow 2 salt mass entering the reservoir
Information: This slot is on a Sloped Power Reservoir only.
I/O: Output only
Segmented 2 Layer Salt slots
The following slots are added for the Segmented 2 Layer Salt method.
Flow and Volume Slots
Epilimnion Inflow By Segment
Type: Agg Series Slot
Units: Flow
Description: Flow into the epilimnion for each reservoir segment.
Information: There is one column for each reservoir segment. The model must be initialized to update the number of segments in this aggregate series slot.
I/O: Output only
Hypolimnion Inflow By Segment
Type: Agg Series Slot
Units: Flow
Description: Flow into hypolimnion for each reservoir segment.
Information: There is one column for each reservoir segment. The model must be initialized to update the number of segments in this aggregate series slot.
I/O: Output only
Epilimnion Outflow By Segment
Type: Agg Series Slot
Units: Flow
Description: Flow out of the epilimnion for each reservoir segment.
Information: There is one column for each reservoir segment. The model must be initialized to update the number of segments in this aggregate series slot.
I/O: Output only
Hypolimnion Outflow By Segment
Type: Agg Series Slot
Units: Flow
Description: Flow out of hypolimnion for each reservoir segment.
Information: There is one column for each reservoir segment. The model must be initialized to update the number of segments in this aggregate series slot.
I/O: Output only
Epilimnion Volume By Segment
Type: Agg Series Slot
Units: Volume
Description: Volume in the epilimnion for each reservoir segment.
Information: There is one column for each reservoir segment. The model must be initialized to update the number of segments in this aggregate series slot.
I/O: Output only
Hypolimnion Volume By Segment
Type: Agg Series Slot
Units: Volume
Description: Volume in the hypolimnion for each reservoir segment.
Information: There is one column for each reservoir segment. The model must be initialized to update the number of segments in this aggregate series slot.
I/O: Output only
Vertical Flow By Segment
Type: Agg Series Slot
Units: Flow
Description: Flow from the epilimnion to hypolimnion in the reservoir.
Information: There is one column for each reservoir segment. The model must be initialized to update the number of segments in this aggregate series slot.
I/O: Output Only
Bank Storage By Segment
Type: Agg Series Slot
Units: Volume
Description: Volume in the bank storage for each reservoir segment.
Information: There is one column for each reservoir segment. The model must be initialized to update the number of segments in this aggregate series slot.
I/O: Output only
Diversion By Segment
Type: Agg Series Slot
Units: Flow
Description: Diversions from each reservoir segment.
Information: There is one column for each reservoir segment. The model must be initialized to update the number of segments in this aggregate series slot.
I/O: Output only
Return Flow By Segment
Type: Agg Series Slot
Units: Flow
Description: Return flow to each reservoir segment.
Information: There is one column for each reservoir segment. The model must be initialized to update the number of segments in this aggregate series slot.
I/O: Output only
Hydrologic Inflow By Segment
Type: Agg Series Slot
Units: Flow
Description: Hydrologic inflows to each reservoir segment.
Information: There is one column for each reservoir segment. The model must be initialized to update the number of segments in this aggregate series slot.
I/O: Output only
Evaporation By Segment
Type: Agg Series Slot
Units: Volume
Description: Volume of evaporation from each reservoir segment.
Information: There is one column for each reservoir segment. The model must be initialized to update the number of segments in this aggregate series slot.
I/O: Output only
Precipitation By Segment
Type: Agg Series Slot
Units: Volume
Description: Volume of precipitation into each reservoir segment.
Information: There is one column for each reservoir segment. The model must be initialized to update the number of segments in this aggregate series slot.
I/O: Output only
Salt Concentration and Mass Slots
Inflow Salt Mass
Type: Series Slot
Units: Mass
Description: Mass of salt entering the reservoir in the inflow.
Information:  
I/O: Input or Output
Inflow Salt Concentration
Type: Series Slot
Units: Concentration
Description: Salt concentration entering in the inflow.
Information:  
I/O: Input or Output
Outflow Salt Mass
Type: Series Slot
Units: Mass
Description: Mass of salt leaving the reservoir in the outflow.
Information:  
I/O: Output only
Outflow Salt Concentration
Type: Series Slot
Units: Concentration
Description: Salt concentration leaving the reservoir.
Information:  
I/O: Output only
Diversion Salt Mass
Type: Series Slot
Units: Mass
Description: Mass leaving the reservoir in diversions.
Information:  
I/O: Output only
Diversion Salt Concentration
Type: Series Slot
Units: Concentration
Description: Salt concentration in the diversions from the reservoir.
Information:  
I/O: Output only
Return Flow Salt Mass
Type: Series Slot
Units: Mass
Description: Mass entering the reservoir in return flows.
Information:  
I/O: Output only
Return Flow Salt Concentration
Type: Series Slot
Units: Concentration
Description: Salt concentration reentering the reservoir in the return flow.
Information:  
I/O: Output only
Hydrologic inflow Salt Mass
Type: Series Slot
Units: Mass
Description: Mass entering the reservoir in hydrologic inflows.
Information:  
I/O: Output only
Hydrologic Inflow Salt Concentration
Type: Series Slot
Units: Concentration
Description: Salt concentration entering the reservoir in the hydrologic inflows.
Information:  
I/O: Input or output
Bank Storage Salt Concentration
Type: Series Slot
Units: Concentration
Description: Salt concentration in the bank storage.
Information:  
I/O: Output only
Epilimnion Salt Concentration By Segment
Type: Agg Series Slot
Units: Concentration
Description: The salt concentration in the epilimnion of each segment.
Information: One column for each segment. The model must be initialized to update the number of segments in this aggregate series slot.
I/O: Output only
Epilimnion Salt Mass By Segment
Type: Agg Series Slot
Units: Mass
Description: The salt mass in the epilimnion of each segment.
Information: One column for each segment. The model must be initialized to update the number of segments in this aggregate series slot.
I/O: Output only
Hypolimnion Salt Concentration By Segment
Type: Agg Series Slot
Units: Concentration
Description: The salt concentration in the hypolimnion of each segment.
Information: One column for each segment. The model must be initialized to update the number of segments in this aggregate series slot.
I/O: Output only
Hypolimnion Salt Mass By Segment
Type: Agg Series Slot
Units: Mass
Description: The salt mass in the hypolimnion of each segment.
Information: One column for each segment. The model must be initialized to update the number of segments in this aggregate series slot.
I/O: Output only
Reservoir Salt Mass
Type: Series Slot
Units: Mass
Description: The salt mass in the entire volume of the reservoir.
Information:  
I/O: Output only
Method Parameter Slots
Thermocline Elevation
Type: Scalar
Units: Length
Description: The elevation where the hypolimnion and epilimnion are separated. This elevation is constant.
Information:  
I/O: Input only
Thermocline Thickness
Type: Series with periodic input
Units: Length
Description: The thickness of the thermocline; used to calculate diffusion between the epilimnion and hypolimnion.
Information:  
I/O: Input only
Thermocline Diffusivity
Type: Series with periodic input
Units: Area per time
Description: The diffusivity of the thermocline; used to calculate the diffusion of salt across the thermocline.
Information:  
I/O: Input only
Number of Segments
Type: Scalar
Units: None
Description: This slot specifies the total number of segments, N, in the reservoir.
Information: This slot is used to update other Agg Series and Table slots with the correct number of segments. The model must be initialized to update the number of segments in the other slots slot.
I/O: Input only
Segment Parameter Table
Type: Table Slot
Units: None
Description: This slot holds segment parameters, including the Segment Bank Storage Proportion, the Segment Diversion Proportion, the Segment Return Flow Proportion, and the Segment Hydrologic Inflow Proportion.
Information: There will be 4 columns: Segment Bank Storage Proportion, Segment Diversion Proportion, Segment Return Flow Proportion, and Segment Hydrologic Inflow Proportion. The values in each column must add to 1.
I/O: Input only
Dead Storage
Type: Table
Units: Volume
Description: The reservoir volume not accessible to outflow from the reservoir, and therefore not included in the Elevation Volume Table. This volume will be included in concentration and interior flow calculations for the reservoir.
Information: There is a row for each segment.
I/O: Input only
Elevation Volume Table By Segment
Type: Table Slot
Units: Length, Volume
Description: The Elevation Volume table for each segment will be input by the user. All the Elevation Volume Segment tables should add up to the reservoir Elevation Volume table plus the dead storage. The Dead Storage should not be added into the Elevation Storage Segment Table.
Information: The first column will be elevation. The second will be the first segment, and each additional column added to the table will be for any additional segments.
I/O: Input only
Elevation Area Table By Segment
Type: Table Slot
Units: Length, Area
Description: The Elevation Area table for each segment will be input by the user. All the Elevation Area Segment tables should add up to the reservoir Elevation Surface Area table.
Information: The first column will be elevation. The second will be the first segment, and each additional column added to the table will be for any additional segments.
I/O: Input only
Dissolved Oxygen Slots
The following slots are instantiated for the Layered Temp and DO and Layered Temp Salt and DO.
Inflow Detritus Mass
Type: Multi Slot
Units: Mass
Description: holds the values of inflow detritus for each inflow to the reservoir
I/O: Typically a Required Known when simulating DO. Input, rules, or propagated via a link.
Outflow Detritus Mass
Type: Series Slot
Units: Mass
Description: detritus mass in releases from the reservoir
I/O: Output only
Detritus Concentrations
Type: Agg Series Slot
Units: Concentration
Description: contains the inflow detritus concentration, outflow detritus concentration, total inflow detritus concentration, hydrologic inflow detritus concentration, epilimnion detritus concentration, and hypolimnion detritus concentration.
I/O: Most values of this slot are calculated; however, hydrologic inflow detritus concentration may be input and initial epilimnion and hypolimnion detritus concentrations must be input.
Inflow Dissolved Organics Mass
Type: Multi Slot
Units: Mass
Description: holds the values of inflow dissolved oxygen for each inflow to the reservoir
I/O: Input, rules, or propagated via a link
Outflow Dissolved Organics Mass
Type: Series Slot
Units: Mass
Description: dissolved oxygen mass in releases from the reservoir
I/O: Output only
Inflow Dissolved Oxygen Mass
Type: Multi Slot
Units: Mass
Description: holds the values of inflow dissolved oxygen for each inflow to the reservoir
I/O: Input, rules, or propagated via a link
Diversion Detritus Conc
Type: Series Slot
Units: Concentration
Description: detritus concentration of Diversion.
I/O: Input, rules, or propagated via a link
Return Flow Detritus Conc
Type: Series Slot
Units: Concentration
Description: detritus concentration of Return Flow.
I/O: Input, rules, output, or propagated via a link
Canal Flow Detritus Conc
Type: Series Slot
Units: Concentration
Description: detritus concentration of Canal Flow.
I/O: Input, rules, or propagated via a link
Pump Storage Inflow Detritus
Type: Series Slot
Units: Concentration
Description: detritus concentration of inflow from Pumped Storage Reservoir.
I/O: Input, rules, or propagated via a link
Pump Storage Outflow Detritus
Type: Series Slot
Units: Concentration
Description: detritus concentration of outflow to Pumped Storage Reservoir.
I/O: Input, rules, or propagated via a link
Dissolved Organics Concentrations
Type: Agg Series Slot
Units: Concentration
Description: contains the inflow dissolved organics concentration, outflow dissolved organics concentration, total inflow dissolved organics concentration, hydrologic inflow dissolved organics concentration, epilimnion dissolved organics concentration, and hypolimnion dissolved organics concentration.
I/O: Most values of this slot are calculated; however, hydrologic inflow dissolved organics concentration may be input and initial epilimnion and hypolimnion dissolved organics concentrations must be input.
Diversion Dissolved Organics Conc
Type: Series Slot
Units: Concentration
Description: dissolved organics concentration of Diversion.
I/O: Input, rules, or propagated via a link
Return Flow Dissolved Organics Conc
Type: Series Slot
Units: Concentration
Description: dissolved organics concentration of Return Flow.
I/O: Input, rules, or propagated via a link
Canal Flow Dissolved Organics Conc
Type: Series Slot
Units: Concentration
Description: dissolved organics concentration of Canal Flow.
I/O: Input, rules, or propagated via a link
Pump Storage Inflow Organics
Type: Series Slot
Units: Concentration
Description: dissolved organics concentration of inflow from Pumped Storage Reservoir.
I/O: Input, rules, or propagated via a link
Pump Storage Outflow Organics
Type: Series Slot
Units: Concentration
Description: dissolved organics concentration of outflow to Pumped Storage Reservoir.
I/O: Input, rules, or propagated via a link
Inflow Ammonia Mass
Type: Multi Slot
Units: Mass
Description: holds the values of inflow ammonia for each inflow to the reservoir
I/O: Typically a Required Known when simulating DO; Input, rules, or propagated via a link
Outflow Ammonia Mass
Type: Series Slot
Units: Mass
Description: ammonia mass in releases from the reservoir
I/O: Output only
Ammonia Concentrations
Type: Agg Series Slot
Units: Concentration
Description: contains the inflow detritus concentration, outflow detritus concentration, total inflow detritus concentration, hydrologic inflow detritus concentration, epilimnion detritus concentration, and hypolimnion detritus concentration.
I/O: Most values of this slot are calculated; however, hydrologic inflow detritus concentration may be input and initial epilimnion and hypolimnion detritus concentrations must be input.
Diversion Ammonia Conc
Type: Series Slot
Units: Concentration
Description: detritus concentration of Diversion.
I/O: Input, rules, or propagated via a link
Return Flow Ammonia Conc
Type: Series Slot
Units: Concentration
Description: detritus concentration of Return Flow.
I/O: Input, rules, or propagated via a link
Canal Flow Ammonia Conc
Type: Series Slot
Units: Concentration
Description: detritus concentration of Canal Flow.
I/O: Input, rules, or propagated via a link
Pump Storage Inflow Ammonia
Type: Series Slot
Units: Concentration
Description: detritus concentration of inflow from Pumped Storage Reservoir.
I/O: Input, rules, or propagated via a link
Pump Storage Outflow Ammonia
Type: Series Slot
Units: Concentration
Description: detritus concentration of outflow to Pumped Storage Reservoir.
I/O: Input, rules, or propagated via a link
Outflow Dissolved Oxygen Mass
Type: Series Slot
Units: Mass
Description: dissolved oxygen mass in releases from the reservoir
I/O: Output only
Dissolved Oxygen Concentrations
Type: Agg Series Slot
Units: Concentration
Description: contains the inflow dissolved oxygen concentration, outflow dissolved oxygen concentration, total inflow dissolved oxygen concentration, hydrologic inflow dissolved oxygen concentration, epilimnion dissolved oxygen concentration, and hypolimnion dissolved oxygen concentration.
I/O: Most values of this slot are calculated; however, hydrologic inflow dissolved oxygen concentration may be input and initial epilimnion and hypolimnion dissolved oxygen concentrations must be input.
Diversion Dissolved Oxygen Conc
Type: Series Slot
Units: Concentration
Description: dissolved oxygen concentration of Diversion.
I/O: Input, rules, or propagated via a link
Return Flow Dissolved Oxygen Conc
Type: Series Slot
Units: Concentration
Description: dissolved oxygen concentration of Return Flow.
I/O: Input, rules, or propagated via a link
Canal Flow Dissolved Oxygen Conc
Type: Series Slot
Units: Concentration
Description: dissolved oxygen concentration of Canal Flow.
I/O: Input, rules, or propagated via a link
Pump Storage Inflow Dissolved Oxygen
Type: Series Slot
Units: Concentration
Description: dissolved oxygen concentration of inflow from Pumped Storage Reservoir.
I/O: Input, rules, or propagated via a link
Pump Storage Outflow Dissolved Oxygen
Type: Series Slot
Units: Concentration
Description: dissolved oxygen concentration of outflow to Pumped Storage Reservoir.
I/O: Input, rules, or propagated via a link
Detritus Parameters
Type: Table Slot
Units: Various
Description: Parameter data for detritus calculations.
Information: Contains the maximum detritus decay rate (KmaxDet [1/T]), a detritus settling rate (Kset [L/T]), an oxygen stoichiometric coefficient for detritus (rDet [M/M]), and S-curve temperature correction data (K1, K2 [1/T], and T1, T2 [degC]).
I/O: Input only
Ammonia Parameters
Type: Table Slot
Units: Various
Description: Parameter data for ammonia calculations.
Information: Contains the maximum ammonia decay rate (KmaxAmm [1/T]), an oxygen stoichiometric coefficient for ammonia (rAmm [M/M]), and S-curve temperature correction data (K1, K2 [1/T], T1, T2 [degC]).
I/O: Input only
Dissolved Organics Parameters
Type: Table Slot
Units: Various
Description: Parameter data for dissolved organics calculations.
Information: Contains the maximum dissolved organics decay rate (KmaxOrg [1/T]), an oxygen stoichiometric coefficient for dissolved organics (rOrg [M/M]), and S-curve temperature correction data (K1, K2 [1/T], T1, T2 [degC]).
I/O: Input only
SOD Parameters
Type: Table Slot
Units: Various
Description: Contains parameter data for sediment oxygen demand calculations.
Information: Contains the maximum sediment oxygen demand (KmaxSOD [M/L2 T]), a calibration coefficient for sediment oxygen demand (fSOD [None]), and S-curve temperature correction data (K1, K2 [1/T], T1, T2 [degC]).
I/O: Input only
Photosynthesis Parameters
Type: Table Slot
Units: Various
Description: Contains parameter data for photosynthesis calculations.
Information: Contains the maximum photosynthesis rate at 20 degrees C (Pmax20 [M/L2 T]), a temperature correction coefficient for Pmax20 (thetaP [None]), a calibration coefficient for respiration (fPhoto [None]), maximum possible solar radiation (Emax [kcal/L2 T]), fraction of solar radiation absorbed at surface (beta [None]), and the extinction coefficient for solar radiation (eta [1/L]).
I/O: Input only
Respiration Parameters
Type: Table Slot
Units: Various
Description: Contains parameter data for respiration calculations.
Information: Contains the maximum respiration rate at 20 degrees C (KmaxResp [M/L3 T]), a temperature correction coefficient for KmaxResp (thetaR [None]), a calibration coefficient for respiration (fResp [None]), and double S-curve temperature correction data (K1, K2, K3, K4 [1/T], T1, T2, T3, T4 [degC]).
I/O: Input only
User Methods
Reservoir Water Quality
Methods in this category are used to select the constituent and approach.
* None
No water quality solution is performed. No slots are added.
* Layered Salt
The layered salt slots are added (see “Layered salt slots”). The Solve 2 Layer Salt dispatch method is made available.
* Layered Temp
All of the temperature slots are added. The Solve 2 Layer Temperature dispatch method is made available.
* Layered Temp and Salt
All of the temperature and the layered salt slots are added (see “Layered salt slots”). This method makes the Solve 2 Layer Temp and Salt dispatch method available.
* Layered Temp and DO
All of the temperature and DO slots are added. This method makes the Solve 2 Layer Temp and DO dispatch method available.
* Layered Temp Salt and DO
All of the temperature and DO slots are added. The layered salt slots are also added (see “Layered salt slots”). This method makes the Solve 2 Layer Temp Salt and DO dispatch method available.
* Well Mixed Salt
The well-mixed salt slots are added (see “Well-mixed Salt Slots”). This method makes the Solve Weight Factor Salt and Solve Pred-Corr Salt sets of dispatch methods available.
* Segmented 2 Layer Salt
The segmented salt slots are added (see “Segmented 2 Layer Salt slots”). This method makes the Solve Segmented 2 Layer Salt dispatch method available.
* Outflow TDG using Tailwater Depth
This method models the spill, turbine release and mixed outflow TDG concentration based on the depth of the tailwater. See “Total Dissolved Gas Methodology” for details on the method and all the slots.
WQ Distribute Inflow
This category of methods is only applicable to the layered methods. These methods define how the incoming water from the Inflow and side flows (e.g., canal flow, hydrologic inflow, etc.) is distributed into the reservoir. For example, it may be a function of density, temperature, etc., and may be “allocated” into one or more of the reservoir layers.
* None
This is the default method and is not a valid method for calculation. An error is flagged if this method executes. This method does not instantiate any water quality slots.
* By Temperature
No slots are explicitly instantiated by this method but the following slots are used as a part of the calculation.
Slots with Required Known Data
• Total Inflows
• Temperature
This method requires a current total inflow temperature, a previous epilimnion temperature, and a previous hypolimnion temperature, all are columns of the Temperature Agg Series Slot.
Slots with Output Data
• Inflow to Epilimnion
• Inflow to Hypolimnion
Method Details
The method, distributeInflowbyTemp, compares the average total inflow temperature and distributes the total inflow based on a simple linear weighting scheme. In general, if the temperature is between the temperatures of the epilimnion and hypolimnion, the total inflow is split by a linear ratio of the total inflow temperature to the temperature difference between the two layers. If the total inflow temperature is greater or less than both layer’s temperatures, the total inflow is totally allocated to the layer with the more similar temperature.
The following is more detail on the algorithm. Only one of the following options will be selected by the algorithm
• If previous epilimnion and hypolimnion temperatures are very close (within 0.1C) distribute the total inflow to each layer based on previous layer volumes.
• If the Total Inflow Temperature is greater than the previous epilimnion temperature, distribute all of the Total Inflow to the top layer, the epilimnion.
• If Total Inflow Temperature is less than the previous hypolimnion temp, distribute all of the Total Inflow to the bottom layer, the hypolimnion.
• If Total Inflow Temperature is between the previous epilimnion and hypolimnion temperatures, distribute the Total Inflow using a weighted ratio based on previous layer temperatures and the current Total Inflow Temperature.
* Specify Distribution
No slots are explicitly instantiated by this method, but the following slots are used as a part of the calculation:
• Total Inflows
• Inflow to Hypolimnion
• Inflow to Epilimnion
The method distributes the Total Inflow based on the values in either the Inflow to Hypolimnion or Epilimnion slots. One or the other of these must be specified but not both or an error will occur.
* Specify Fraction
This method allows you to distribute the inflows using a series of fractions. The following slot is added by this method.
Inflow to Hypolimnion Fraction
Type: Series with Periodic Input
Units: Fraction
Description: The fraction of the total inflow that enters the Hypolimnion
Information: The value must be specified and the value must be between 0 and 1, inclusive.
I/O: Required via input or Rules
The distribution is computed as follows:
(14.1)    Inflow to Hypolimnion = Inflow to Hypolimnion Fraction * Total Inflows
(14.2)    Inflow to Epilimnion = Total Inflows - Inflow to Hypolimnion;
WQ Distribute Outflow
This category of methods is only applicable to the layered methods. These methods allow the user to model the physical character of the outlet works of the reservoir. This is crucial for accurate tracking of release temperatures, DO levels, etc.
* None
This is the default method and is not a valid method for calculation. An error is flagged if this method executes. This method does not instantiate any water quality slots.
* Zone of Influence
No slots are explicitly instantiated by this method but the following slots are used as a part of the calculation.
Reservoir Length
Type: Table Slot
Units: Length
Description: 1X1 table slot representing the length of the reservoir
I/O: Required Input
Reservoir Bottom Elevation
Type: Table Slot
Units: Length
Description: 1X1 table slot representing the elevation (above some common datum) of the bottom of the reservoir at the dam
Information: Used to calculate a mean depth at the dam.
Release Elevation
Type: Table Slot
Units: Length
Description: 1X1 table slot representing the elevation (above some common datum) of the outlet works.
I/O: Required Input
Thickness of Epilimnion
Type: Table Slot
Units: Length
Description: 1X1 table slot representing the thickness of the epilimnion layer
I/O: Must be input by user.
Reservoir Geometry Coefficients
Type: Table Slot
Units: NoUnits
Description: table of coefficients which represent the a1, a2, a3, a4 coefficients.
I/O: If not input, they are generated by the function cubicFit.
Withdrawal Zone Coefficient
Type: Table Slot
Units: NoUnits
Description: 1x1 table of a single coefficient to represent cone of influence around outlet works.
I/O: If not input, it is set to 1.0.
Slots with Required Known Data
• Outflow
• Reservoir Length
• Reservoir Bottom Elevation
• Thickness of Epilimnion
• Release Elevation
• Withdrawal Zone Coefficient
• Reservoir Geometry Coefficients Table
Slots with Output Data
• Outflow from Epilimnion
• Outflow from Hypolimnion
Method Details
The method, Zone of Influence, uses a cubic function (user input coefficients or calculated from the elevation-volume table), the magnitude of the outflow, and the release elevation to define a “zone of influence” from which the outflow is taken. The fraction of total outflow attributed to the epilimnion and hypolimnion is reflected by the values set in the Outflow from Hypolimnion and Outflow from Epilimnion slots.
* Specify Outflow Fraction
This method allows you to distribute the outflows using a series of fractions with a periodic input. The following slot is added by this method.
Outflow from Hypolimnion Fraction
Type: Series with Periodic Input
Units: Fraction
Description: The fraction of the total outflow that leaves the Hypolimnion
Information: The value must be specified and the value must be between 0 and 1, inclusive.
I/O: Required via input or Rules
The distribution is computed as follows:
(14.3)    Outflow from Hypolimnion = Outflow from Hypolimnion Fraction * Total Outflows
(14.4)    Outflow from Epilimnion = Total Inflows - Outflow from Hypolimnion;
Surface Heat Flux
These methods represent the flux of heat across the reservoir surface. It is used as a heat source or sink for the upper layer(s) of the reservoir model.
* None
This is the default method, and is not a valid method for calculation. An error is flagged if this method is executed.
* Energy Balance
The flux method determines the flux from incoming solar radiation, incoming longwave radiation, outgoing radiation from the reservoir, outgoing heat due to conduction, and outgoing heat due to evaporation.
Slots with Required Input Data
• Air Temperature
• Temperature
• Dewpoint Temperature
• Wind Velocity
• Incoming Solar Radiation
This method requires a current epilimnion temperature which is a column of the Temperature Agg Series Slot.
Slots with Output Data
• Heat of Evaporation
• Surface Heat Flux
Method Details
The method calculates the surface flux as follows (each variable represents a utility method described below):
(14.5)    
Bank Storage Salt
If the reservoir considers bank storage and has either the “Input Bank Storage” or “CRSS Bank Storage” user method selected, salinity in the bank storage can be considered. The Bank Storage Salt category becomes visible with the following two method options.
* None
This default method does not consider salinity of bank storage water.
* Bank Storage Salt
If the Bank Storage Salt method is selected in the Bank Storage Salt category, the following water quality slot is instantiated.
Bank Storage Salt Concentration
Type: Series Slot
Units: Concentration
Description: salt concentration of bank storage water.
Information: If the initial timestep’s value is not known, it defaults to the Reservoir Salt Concentration at the initial timestep
I/O: Output only
Method Details
If this method is selected, the dispatch method will consider the salt concentration of the bank storage flows as follows:
If the flow is from the bank to the reservoir (Delta Bank Storage is negative), then the in-bound salt mass is calculated from the Delta Bank Storage and the previous Bank Storage Salt Concentration. Bank Storage Salt Concentration is the set to the previous timestep’s value. There is no out-bound salt mass.
If the flow is from the reservoir to the bank (Delta Bank Storage is positive), then the Bank Storage Salt Concentration is a weighted average of the incoming water and the existing bank storage, as follows:
(14.6)    
WQ Reservoir Routing
The WQ Reservoir Routing category is used to specify how salinity routes through a reservoir. It is available for Well Mixed Salt. Two methods exist, the default Predictor-Corrector Salt and the Weighting Factors Salt method. The method currently in RiverWare uses a weighting factor to release salt over multiple time steps in a manner that prevents numerical instability, which occurs when reservoir storage is small in relation to the salt routed through the reservoir over a single time step
* Predictor-Corrector Salt
The Predictor-Corrector Salt method uses a Huen numerical method to compute reservoir salinity concentration that treats reservoirs as “true” fully mixed systems. This method requires that the reservoir salinity and reservoir outflow salinity are the same for a given timestep.
Method Details
This method is used to limit the available dispatch methods. When this method is selected, the available dispatch methods are:
* Weighting Factor Salt
The Weighting Factor Salt method uses a weighting factor to release salt over multiple time steps in a manner that prevents numerical instability, which occurs when reservoir storage is small in relation to the salt routed through the reservoir over a single time step.
Weighting Factor
Type: Series Slot
Units: No Units
Description: This slot holds the weighting factor as calculated by the dispatch method.
I/O: Output Only
Method Details
This method is used to limit the available dispatch methods. When this method is selected, the available dispatch methods are as follows:
Optimization Total Dissolved Gas
This category is only shown if the Outflow TDG Tailwater Depth method is selected in the Reservoir Water Quality category. It contains two methods, the default no-action None method and the Opt Outflow TDG Tailwater Depth method.
* None
This method does not do any computations.
* Opt Outflow TDG Tailwater Depth
The Opt Outflow TDG Tailwater Depth method is the optimization component of TDG modeling. See “Optimization Total Dissolved Gas category” for details on the method and all the slots associated with it.
Solution / Dispatching
Beginning of Water Quality Run
The function 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.
• If using layered methods
– If modeling 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.
– If modeling 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.
– If modeling 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 Inflow 2 detritus, dissolved organics, ammonia, and dissolved oxygen concentrations to zero.
• If 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.
• If 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.
• If 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 category” for details.
Dispatch Slots
Dispatch slots either appear in the dispatch conditions of the Dispatch Methods, or they are linked 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.
The following water quality slots are dispatch slots for the Layered methods (depending on the selected constituents):
 
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
If using Well Mixed Salt. the dispatch slots are as follows:
• 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
If using Segmented 2 Layer Salt, the dispatch slots are as follows:
• Diversion Salt Concentration
• Outflow Salt Concentration
• Hydrologic Inflow Salt Conc
• Outflow Salt Mass
• Inflow Salt Concentration
• Return Flow Salt Concentration
• Inflow Salt Mass
If using TDG method, the dispatch slots are as follows:
• 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 (i.e. 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
This dispatch method executes the Outflow TDG using Tailwater Depth method and then the selected method in the Optimization Total Dissolved Gas. See “Total Dissolved Gas Methodology” for details on these methods.
Utility Methods
Utility Methods are methods (or subroutines / functions) which do not belong to a user-selectable method type. For example, there is a utility method which calculates the surface area of the reservoir (see calcSurfaceArea), and one which fits a cubic function to a set of elevation - volume data (cubicFit). Each of the utility methods outlined below is used by one or more of the user-selected method types above.
Note:  Some of these methods set slots directly, while others return values but do not set slots explicitly.
* AdjKAmm
The function, AdjKAmm, returns a unit-less ammonia decay correction factor based on reservoir temperature and S-curve data. Inputs include an ammonia decay rate, and the corresponding temperature. Gamma is calculated with two rates and two temperatures by the function calcGamma (see calcGamma). Current layer temperature is passed in through the variable temp.
(14.27)    
AdjKAmm should return a value between 0.0 and 1.0.
Slots with Required Known Data
• Ammonia Parameters
* AdjKDet
The function, AdjKDet, returns a unit-less detritus decay correction factor based on reservoir temperature and S-curve data. Inputs include a detritus decay rate, and the corresponding temperature. Gamma is calculated with two rates and two temperatures by the calcGamma function (see calcGamma). Current layer temperature is passed in through the variable T.
(14.28)    
T1 is the value in the Detritus Parameter, Temp 1 column. AdjKDet returns a value between 0.0 and 1.0.
Slots with Required Known Data
• Detritus Parameters
* AdjKOrg
The function, AdjKOrg, returns a unit-less dissolved organics decay correction factor based on reservoir temperature and S-curve data. Inputs include a dissolved organics decay rate, and the corresponding temperature. Gamma is calculated with two rates and two temperatures by the calcGamma function (see calcGamma). Current layer temperature is passed in through the variable temp.
(14.29)    
AdjKOrg should return a value between 0.0 and 1.0.
Slots with Required Data
• Dissolved Organics Parameters
* AdjKResp
The function, AdjKResp, returns a respiration rate correction factor based on reservoir temperature and data from a double S-curve. Inputs include four respiration rates (K1, K2, K3, K4), and the corresponding temperatures (T1, T2, T3, T4). Gamma1 and gamm2 are calculated with two rates and two temperatures by the calcGamma function (see calcGamma). Current layer temperature is passed in through the variable temp. This general function is used to calculate the temperature adjustment factor, AdjK.
(14.30)    
Slots with Required Known Data
• Respiration Parameters
* AdjKSOD
The function, AdjKSOD, returns a unit-less sediment oxygen demand correction factor based on reservoir temperature and S-curve data. Inputs include a sediment oxygen demand, and the corresponding temperature. Gamma is calculated with two rates and two temperatures by the calcGamma function (see calcGamma). Current layer temperature is passed in through the variable temp.
(14.31)    
AdjKSOD should return a value between 0.0 and 1.0.
Slots with Required Known Data
• SOD Parameters
* calcAmmonia
The method, calcAmmonia, calculates the ammonia balance for the epilimnion and the hypolimnion, based on explicit one-step method.
Slots with Required Known Data
• Ammonia Concentrations
• Outflow from Epilimnion
• Epilimnion Volume
• Outflow from Hypolimnion
• Hypolimnion Volume
• Thermocline Diffusion Coefficient
• Inflow to Epilimnion
• Thickness of Epilimnion
• Inflow to Hypolimnion
• Thickness of Metalimnion
This method requires a previous epilimnion ammonia concentration and a previous hypolimnion ammonia concentration; both are columns on the Ammonia Concentration Agg Series Slot.
Slots with Output Data
• Ammonia Concentrations
This method sets epilimnion ammonia concentration and hypolimnion ammonia concentration; both are columns on the Ammonia Concentration Agg Series Slot.
Method Details
The epilimnion dissolved organics concentration is calculated as follows:
(14.32)    
The hypolimnion ammonia concentration is calculated as follows:
(14.33)    
where
This concentration is then adjusted by accounting for ammonia decay. The amount of ammonia decay is used in other functions.These adjustments will be made within a timestep during which the layer volume will be remain constant. Therefore, it is possible to calculate these sources and sinks in terms of concentration instead of mass.
(14.34)    
(14.35)    
and
(14.36)    
(14.37)    
where
It then adjusts the layer ammonia concentrations to account for movement of the thermocline during the timestep.
* calcDetritus
The method, calcDetritus, calculates the detritus balance for the epilimnion and the hypolimnion, based on explicit one-step method.
Slots with Required Known Data
• Detritus Concentrations
• Outflow from Epilimnion
• Epilimnion Volume
• Outflow from Hypolimnion
• Hypolimnion Volume
• Thermocline Diffusion Coefficient
• Inflow to Epilimnion
• Thickness of Epilimnion
• Inflow to Hypolimnion
• Thickness of Metalimnion
This method requires a previous epilimnion detritus concentration and a previous hypolimnion detritus concentration; both are columns on the Detritus Concentrations Agg Series Slot.
Slots with Output Data
• Detritus Concentrations
This method sets epilimnion and hypolimnion detritus concentrations; which is a column on the Detritus Concentrations Agg Series Slot.
Method Details
The epilimnion detritus concentration is calculated as follows:
(14.38)    
and, the hypolimnion detritus concentration is calculated as follows:
(14.39)    
where
This concentration is then adjusted by accounting for detritus decay and settling. The amount of detritus decay is passed out of the function. These adjustments will be made within a timestep during which the layer volume will be remain constant. Therefore, it is possible to calculate these sources and sinks in terms of concentration instead of mass.
(14.40)    
(14.41)    
(14.42)    
and
(14.43)    
(14.44)    
(14.45)    
where
It then adjusts the layer detritus concentrations to account for movement of the thermocline during the timestep.
* calcDO
The method, calcDO, calculates the dissolved oxygen balance for the epilimnion and the hypolimnion, based on explicit one-step method.
Slots with Required Known Data
• Dissolved Oxygen Concentrations
• Outflow from Epilimnion
• Epilimnion Volume
• Outflow from Hypolimnion
• Hypolimnion Volume
• Thermocline Diffusion Coefficient
• Inflow to Epilimnion
• Thickness of Epilimnion
• Inflow to Hypolimnion
• Thickness of Metalimnion
This method requires a previous epilimnion dissolved oxygen concentration and a previous hypolimnion dissolved oxygen concentration, both are columns on the Dissolved Oxygen Concentrations Agg Series Slot.
Slots with Output Data
• Dissolved Oxygen Concentrations
This method sets the epilimnion dissolved oxygen concentration and hypolimnion dissolved oxygen concentration, both are columns on the Dissolved Oxygen Concentrations Agg Series Slot.
Method Details
The epilimnion dissolved oxygen concentration is calculated as follows:
(14.46)    
and, the hypolimnion dissolved oxygen concentration is calculated as follows:
(14.47)    
where
This concentration is then adjusted by accounting for photosynthesis, re-aeration, respiration, sediment oxygen demand, and consumption from detritus, dissolved organics, and ammonia decay. These adjustments will be made within a timestep during which the layer volume will be remain constant. Therefore, it is possible to calculate these sources and sinks in terms of concentration instead of mass.
(14.48)    
(14.49)    
where
It then adjusts the layer dissolved oxygen concentrations to account for movement of the thermocline during the timestep.
* calcGamma
The calcGamma function returns a unit-less parameter used to calculate temperature correction factors for sediment oxygen demand, respiration, ammonia decay, dissolved organics decay, and detritus decay. Inputs include two rates (k1, k2), and the corresponding temperatures (t1, t2). Gamma is calculated with the following function:
(14.50)    
* calcHar
The function, CalcHar, returns Har (J/(m^2*day), the surface heat flux due to incoming solar radiation, using the following equation (Thomann and Mueller, 1987)
Slots with Required Known Data
• Air Temperature
• Dewpoint Temperature
Method Details
(14.51)    
where
Ta is user input through the Air Temperature slot, and air vapor pressure is returned by the getAirVaporPressure method (see below). The variable, A, is set as follows: if Air Temperature is less than 20(C), A = 0.65, else, A = 0.70.
* calcHbr
The function, calcHbr, returns Hbr (J/(m^2*day), the longwave radiation emitted by the reservoir, using the Stefan-Boltzmann law for a (nearly perfect) black-body emitter.
Slots with Required Known Data
• Temperature
This method requires a previous epilimnion temperature, which is a column on the Temperature Agg Series Slot.
Method Details
(14.52)    
where
The values of the Stefan-Boltzmann constant and emissivity are static variables. Ts is the value of the epilimnion temperature from the previous timestep (epilimnionTemp(‑1)).
* calcHc
The function, calcHc, returns Hc (J/(m^2*day), the heat flux at the reservoir surface due to conduction.
Slots with Required Known Data
• Air Temperature
• Wind Velocity
• Temperature
This method requires a previous epilimnion temperature, which is a column on the Temperature Agg Series Slot.
Method Details
The form of the equation is:
(14.53)    
where:
getWindEffect is a utility method (see below) and 41860 is the conversion rate from cal/cm2 to J/m2.
* calcHe
The function, calcHe, returns He (J/(m^2*day)), the heat flux at the surface due to evaporative heat loss.
Slots with Required Known Data
• Dewpoint Temperature
• Wind Velocity
• Temperature
This method requires a previous epilimnion temperature, which is a column on the Temperature Agg Series Slot.
Slots with Output Data
• Heat of Evaporation
Method Details
The form of the equation is:
(14.54)    
where
getWindEffect is a utility method and 41860 is the conversion rate from cal/cm2 to J/m2. The function returns He and sets the Heat of Evaporation slot equal to He / 41860.
* calcHeat
The method, calcHeat, calculates the new Temperature for both the epilimnion and hypolimnion based on a backwards-time numerical method.
Slots with Required Known Data
• Epilimnion Volume
• Specific Heat of Water
• Hypolimnion Volume
• Surface Heat Flux
• Inflow to Epilimnion
• Temperature
• Inflow to Hypolimnion
• Thermocline Diffusion Coefficient
• Outflow from Epilimnion
• Thickness of Epilimnion
• Outflow from Hypolimnion
• Thickness of Metalimnion
This method requires a previous epilimnion temperature and a previous hypolimnion temperature; both are columns on the Temperature Agg Series Slot.
Slots with Output Data
• Temperature
This method sets current epilimnion temperature and current hypolimnion temperature; both are columns on the Temperature Agg Series Slot.
Method Details
First, the method calls the selected method in the Surface Heat Flux category to calculate surface flux. The epilimnion temperatures is calculated as follows:
(14.55)    
and, the hypolimnion temperatures is calculated as follows:
(14.56)    
where
It then adjusts the layer temperatures to account for movement of the thermocline during the timestep and sets the slots.
* calcInflowAmmConc
The method, calcInflowAmmConc, calculates the inflow ammonia concentration and total inflow ammonia concentration by doing a weighted average of the inflow and side flow ammonia concentrations. If Canal Flow, Flow FROM Pumped Storage, or Flow TO Pumped Storage are not linked, the associated ammonia contribution is equal to zero.
Slots with Required Known Data
• Ammonia Concentrations
• Hydrologic Inflow
• Canal Flow
• Inflow
• Canal Flow Ammonia Conc
• Inflow Ammonia Mass
• Diversion
• Pump Storage Inflow Ammonia
• Diversion Ammonia Conc
• Pump Storage Outflow Ammonia
• Flow FROM Pumped Storage
• Return Flow
• Flow TO Pumped Storage
• Return Flow Ammonia Conc
This method requires hydrologic inflow ammonia concentration, a column on the Ammonia Concentrations Agg Series Slot.
Slots with Output Data
• Ammonia Concentrations
This method sets inflow ammonia concentration and total inflow ammonia concentration, both are column on the Ammonia Concentrations Agg Series Slot. It uses a similar calculations as calcInflowTemp but sums ammonia mass instead of heat.
* calcInflowDetConc
The method, calcInflowDetConc, calculates the inflow detritus concentration and total inflow detritus concentration by doing a weighted average of the inflow and side flow detritus concentrations. If Canal Flow, Flow FROM Pumped Storage, or Flow TO Pumped Storage are not linked, the associated detritus contribution is equal to zero.
Slots with Required Known Data
• Canal Flow
• Hydrologic Inflow
• Canal Flow Detritus Conc
• Inflow
• Detritus Concentrations
• Inflow Detritus Mass
• Diversion
• Pump Storage Inflow Detritus
• Diversion Detritus Conc
• Pump Storage Outflow Detritus
• Flow FROM Pumped Storage
• Return Flow
• Flow TO Pumped Storage
• Return Flow Detritus Conc
Slots with Output Data
• Detritus Concentrations
It uses a similar calculations as calcInflowTemp but sums detritus mass instead of heat.
* calcInflowDOConc
The method, calcInflowDOConc, calculates the inflow dissolved oxygen concentration and total inflow dissolved oxygen concentration by doing a weighted average of the inflow and side flow dissolved oxygen concentrations. If Canal Flow, Flow FROM Pumped Storage, or Flow TO Pumped Storage are not linked, the associated dissolved oxygen contribution is equal to zero.
Slots with Required Known Data
• Canal Flow
• Hydrologic Inflow
• Canal Flow Dissolved Oxygen Conc
• Inflow
• Dissolved Oxygen Concentrations
• Inflow Dissolved Oxygen Mass
• Diversion
• Pump Storage Inflow Dissolved Oxygen
• Diversion Dissolved Oxygen Conc
• Pump Storage Outflow Dissolved Oxygen
• Flow FROM Pumped Storage
• Return Flow
• Flow TO Pumped Storage
• Return Flow Dissolved Oxygen Conc
This method requires hydrologic inflow dissolved oxygen concentration, a column on the Dissolved Oxygen Concentrations Agg Series Slot.
Slots with Output Data
• Dissolved Oxygen Concentrations
This method sets inflow dissolved oxygen concentration and total inflow dissolved oxygen concentration, both are column on the Dissolved Oxygen Concentrations Agg Series Slot.
It uses a similar calculations as calcInflowTemp but sums dissolved oxygen mass instead of heat.
* calcInflowOrgConc
The method, calcInflowOrgConc, calculates the inflow dissolved organics concentration and total inflow dissolved organics concentration by doing a weighted average of the inflow and side flow dissolved organics concentrations. If Canal Flow, Flow FROM Pumped Storage, or Flow TO Pumped Storage are not linked, the associated dissolved organics contribution is equal to zero.
Slots with Required Known Data
• Canal Flow
• Hydrologic Inflow
• Canal Flow Dissolved Organics Conc
• Inflow
• Dissolved Organics Concentrations
• Inflow Dissolved Organics Mass
• Diversion
• Pump Storage Inflow Organics
• Diversion Dissolved Organics Conc
• Pump Storage Outflow Organics
• Flow FROM Pumped Storage
• Return Flow
• Flow TO Pumped Storage
• Return Flow Dissolved Organics Conc
Slots with Output Data
• Dissolved Organics Concentrations
It uses a similar calculations as calcInflowTemp but sums dissolved organics mass instead of heat.
* calcInflowSaltConc
The method, calcInflowSaltConc, calculates the inflow salt concentration and total inflow salt concentration by doing a weighted average of the inflow and side flow salt concentrations. If Canal Flow, Flow FROM Pumped Storage, or Flow TO Pumped Storage are not linked, the associated salt contribution is equal to zero.
Slots with Required Known Data
• Canal Flow
• Inflow
• Canal Flow Salt Conc
• Inflow Salt Mass
• Diversion
• Pump Storage Inflow Salt
• Diversion Salt Concentration
• Pump Storage Outflow Salt
• Flow FROM Pumped Storage
• Return Flow
• Flow TO Pumped Storage
• Return Flow Salt Conc
• Hydrologic Inflow
• Salt Concentrations
This method requires hydrologic inflow salt concentration, one of the columns on the Salt Concentrations Agg Series Slot
Slots with Output Data
• Salt Concentrations
This method sets inflow salt concentration and total inflow salt concentration, both are columns on the Salt Concentrations Agg Series Slot. It uses a similar calculations as calcInflowTemp but sums salt mass instead of heat.
* calcInflowTemp
This method sets the inflow temperature and total inflow temperature, both columns on the Temperature Agg Series Slot.
Slots with Required Known Data
• Canal Flow
• Inflow Heat
• Canal Flow Temp
• Pump Storage Inflow Temp
• Diversion
• Pump Storage Outflow Temp
• Diversion Temp
• Return Flow
• Flow FROM Pumped Storage
• Return Flow Temp
• Flow TO Pumped Storage
• Specific Heat of Water
• Hydrologic Inflow
• Temperature
• Inflow
This method requires a hydrologic inflow temperature, a column on the Temperature Agg Series Slot.
Slots with Output Data
• Temperature
Method Details
The method, calcInflowTemp, calculates the inflow temperature and total inflow temperature by doing a weighted average of the inflow and side flow temperatures, i.e. the method sums the heat coming in. The following inflows are considered: Inflow, Hydrologic Inflow Net, Canal Flow, Flow TO Pumped Storage, Flow FROM Pumped Storage, Diversion, and Return Flow. If Canal Flow, Flow FROM Pumped Storage, or Flow TO Pumped Storage are not linked, the associated heat contribution is equal to zero.
The heat associated with each component is calculated as follows:
(14.57)    
The method then sums the heat as follows:
(14.58)    
And then sets the Inflow Temp and Total Inflow columns on the Temperature slot.
* calcLayerVolumes
The method, calcLayerVolumes, calculates the volume of both the epilimnion and hypolimnion.
Slots with Required Known Data
• Inflow to Hypolimnion
• Storage
• Outflow from Hypolimnion (current and previous)
Slots with Output Data
• Epilimnion Volume
• Hypolimnion Volume
Method Details
Epilimnion and hypolimnion volumes are calculated as follows:
(14.59)    
(14.60)    
These values are later adjusted in AdjKDet after calculating thermocline movement during the timestep (see AdjKDet).
* calcOrganics
This method, calcOrganics, calculates the dissolved organics balance for the epilimnion and the hypolimnion, based on explicit one-step method.
Slots with Required Known Data
• Dissolved Organics Concentrations
• Outflow from Epilimnion
• Epilimnion Volume
• Outflow from Hypolimnion
• Hypolimnion Volume
• Thermocline Diffusion Coefficient
• Inflow to Epilimnion
• Thickness of Epilimnion
• Inflow to Hypolimnion
• Thickness of Metalimnion
This method requires a previous epilimnion dissolved organics concentration and a previous hypolimnion dissolved organics concentration; both are columns on the Dissolved Organics Concentrations Agg Series Slot.
Slots with Output Data
• Dissolved Organics Concentrations
Method Details
This method sets epilimnion dissolved organics concentration and hypolimnion dissolved organics concentration; both are columns on the Dissolved Organics Concentrations Agg Series Slot.
The epilimnion dissolved organics concentration is calculated as follows:
(14.61)    
and, the hypolimnion dissolved organics concentration is calculated as follows:
(14.62)    
where
This concentration is then adjusted by accounting for dissolved organics decay. The amount of dissolved organics decay is passed out of the function. These adjustments will be made within a timestep during which the layer volume will be remain constant. Therefore, it is possible to calculate these sources and sinks in terms of concentration instead of mass.
(14.63)    
(14.64)    
and
(14.65)    
(14.66)    
where
It then adjusts the layer dissolved organics concentrations to account for movement of the thermocline during the timestep.
* calcOutflowAmmConc
The method, calcOutflowDetConc, calculates the outflow ammonia concentration and outflow ammonia mass given the epilimnion and hypolimnion outflows, the total outflow, and the epilimnion and hypolimnion concentrations at (t‑1).
Note:  As described in the Note in the AdjKDet topic (see AdjKDet), this is an explicit solution. The slot Outflow Ammonia Concentration is set by this method, as the weighted average of the epilimnion and Hypolimnion Outflow and ammonia concentrations.
Slots with Required Known Data
• Ammonia Concentrations
• Outflow from Epilimnion
• Outflow
• Outflow from Hypolimnion
This method requires a previous epilimnion ammonia concentration and a previous hypolimnion ammonia concentration; both are columns on the Ammonia Concentrations Agg Series Slot.
Slots with Output Data
• Ammonia Concentrations
This method sets the outflow ammonia concentration which is a column on the Ammonia Concentrations Agg Series Slot.
• Outflow Ammonia Mass
* calcOutflowDetConc
The method, calcOutflowDetConc, calculates the outflow detritus concentration and outflow detritus mass given the epilimnion and hypolimnion outflows, the total outflow, and the epilimnion and hypolimnion concentrations at (t‑1).
Note:  As described in the Note in the AdjKDet topic (see AdjKDet), this is an explicit solution. The slot Outflow Detritus Concentration is set by this method, as the weighted average of the epilimnion and hypolimnion outflows and detritus concentrations.
Slots with Required Known Data
• Detritus Concentrations
• Outflow from Epilimnion
• Outflow
• Outflow from Hypolimnion
This method requires a previous epilimnion detritus concentration and a previous hypolimnion detritus concentration; both are columns on the Detritus Concentrations Agg Series Slot.
Slots with Output Data
• Detritus Concentrations
This method sets the outflow detritus concentration, which is a column on the Detritus Concentrations Agg Series Slot.
• Outflow Detritus Mass
* calcOutflowDOConc
The method, calcOutfloOrgConc, calculates the outflow dissolved oxygen concentration and outflow dissolved oxygen mass given the epilimnion and hypolimnion outflows, the total outflow, and the epilimnion and hypolimnion concentrations at (t‑1).
Note:  As described in the Note in the AdjKDet topic (see AdjKDet), this is an explicit solution. The slot Outflow Detritus Concentration is set by this method, as the weighted average of the epilimnion and hypolimnion outflows and dissolved oxygen concentrations.
Slots with Required Known Data
• Dissolved Oxygen Concentrations
• Outflow from Epilimnion
• Outflow
• Outflow from Hypolimnion
This method requires a previous epilimnion dissolved oxygen concentration and a previous hypolimnion dissolved oxygen concentration; both are columns on the Dissolved Oxygen Concentrations Agg Series Slot.
Slots with Output Data
• Dissolved Oxygen Concentrations
• Outflow Dissolved Oxygen Mass
This method sets the outflow dissolved oxygen concentration; which is a column on the Dissolved Oxygen Concentrations Agg Series Slot.
* calcOutflowOrgConc
The method, calcOutfloOrgConc, calculates the outflow dissolved organics concentration and outflow dissolved organics mass given the epilimnion and hypolimnion outflows, the total outflow, and the epilimnion and hypolimnion concentrations at (t‑1).
Note:  As described in the AdjKDet topic (see AdjKDet), this is an explicit solution. The slot Outflow Detritus Concentration is set by this method, as the weighted average of the epilimnion and hypolimnion outflows and dissolved organics concentrations.
Slots with Required Known Data
• Dissolved Organics Concentrations
• Outflow from Epilimnion
• Outflow
• Outflow from Hypolimnion
This method requires a previous epilimnion dissolved organics concentration and a previous hypolimnion dissolved organics concentration; both are columns on the Detritus Organics Concentrations Agg Series Slot.
Slots with Output Data
• Dissolved Organics Concentrations
This method sets the outflow dissolved organics concentration which is a column on the Detritus Concentrations Agg Series Slot.
• Outflow Dissolved Organics Mass
* calcOutflowSaltConc
The method, calcOutflowSaltConc, calculates the outflow salt concentration and outflow salt mass given the epilimnion and hypolimnion outflows, the total outflow, and the epilimnion and hypolimnion concentrations at (t‑1).
Note:  As described in the Note in the AdjKDet topic (see AdjKDet), this is an explicit solution. The slot Outflow Salt Concentration is set by this method, as the weighted average of the epilimnion and hypolimnion outflows and salt concentrations.
Slots with Required Known Data
• Outflow
• Outflow from Hypolimnion
• Outflow from Epilimnion
• Salt Concentrations
This method requires a previous epilimnion salt concentration and a previous hypolimnion salt concentration; both are columns on the Salt Concentrations Agg Series Slot.
Slots with Output Data
• Salt Concentrations
This method sets the outflow salt concentration which is a column on the Salt Concentration Agg Series Slot.
• Outflow Salt Mass
* calcOutflowTemp
The method, calcOutflowTemp, calculates the outflow temperature and outflow heat given the Outflow from Epilimnion, Outflow from Hypolimnion, the total outflow, and the epilimnion and hypolimnion temperatures at (t‑1).
Note:  As described in the Note in the AdjKDet topic (see AdjKDet), this is an explicit solution. The slot Outflow Temperature is set by this method, as the weighted average of the epilimnion and hypolimnion outflows and temperatures.
Slots with Required Known Data
• Outflow
• Outflow from Hypolimnion
• Outflow from Epilimnion
• Temperature
This method requires a previous epilimnion temperature and a previous hypolimnion temperature, both are columns on the Temperature Agg Series Slot.
Slots with Output Data
• Outflow Heat
• Temperature
This method sets the outflow temperature, which is column on the Temperature Agg Series Slot.
* calcSalt
The method, calcSalt, calculates the salt balance for the epilimnion and the hypolimnion, based on explicit one-step method. Slots with Required Known Data
• Epilimnion Volume
• Outflow from Hypolimnion
• Hypolimnion Volume
• Salt Concentrations
• Inflow to Epilimnion
• Thermocline Diffusion Coefficient
• Inflow to Hypolimnion
• Thickness of Epilimnion
• Outflow from Epilimnion
• Thickness of Metalimnion
This method requires previous epilimnion and hypolimnion salt concentrations; both are columns on the Salt Concentrations Agg Series Slot.
Slots with Output Data
• Salt Concentrations
This method sets epilimnion and hypolimnion salt concentrations; both are columns on the Salt Concentrations Agg Series Slot.
Method Details
The epilimnion salt concentration is calculated as follows:
(14.67)    
and, the hypolimnion salt concentration is calculated as follows:
(14.68)    
where
It then adjusts the layer salt concentrations to account for movement of the thermocline during the timestep and sets the slots.
* calcSurfaceArea
The calcSurfaceArea function returns surface area for a an elevation, based on an approximation of a very small incremental change in the elevation (0.1m) of the reservoir related to the corresponding change in the reservoir volume.
(14.69)    
This function is only used if the Elevation Area Table is not in used because an evaporation method has not been selected.
Slots with Required Known Data
• Elevation Volume Table
* checkSideFlowConcDO
The checkSideFlowConcDO function checks detritus, ammonia, dissolved organics, and dissolved oxygen concentrations associated with side flows and sets them if appropriate. diversion concentrations, negative canal flow concentrations, and pumped storage outflow concentrations are set to previous epilimnion concentrations. If return flow concentrations, positive canal flow concentrations, or pumped storage inflow concentrations are not valid, the method is exited so that the other object can solve first and propagate a concentration across the link.
* checkSideFlowConcSalt
The checkSideFlowConcSalt function checks salt concentrations associated with side flows and sets them if appropriate. Diversion Salt Concentration, negative Canal Flow Salt Concentration, and Pumped Storage Outflow Salt Concentration are set to previous epilimnion salt concentration. If Return Flow Salt Concentration, positive Canal Flow Salt Concentration, or Pumped Storage Inflow Salt Concentration are not valid, the method is exited so that the other object can solve first and propagate a concentration across the link.
* checkSideFlowTemp
The checkSideFlowTemp function checks temperatures associated with side flows and sets them if appropriate. Diversion Temperature, negative Canal Flow Temperature, and Pumped Storage Outflow Temperature are set to previous epilimnion temperature. If Return Flow Temperature, positive Canal Flow Temperature, or Pumped Storage Inflow Temperature are not valid, the method is exited so that the other object can solve first and propagate a temperature across the link.
* cubicFit
The cubicFit method calculates a cubic fit to the elevation - storage relationship of a reservoir given an elevation volume table. It is currently used by the calcOutflowDistribution method which applies the coefficients in determining a withdrawal cone at the reservoir outlet works.
Slots with Required Known Data
• Elevation Volume Table
Slots with Output Data
• Reservoir Geometry Coefficients Table
Method Details
This method uses a Gauss-Jordan method for fitting cubic function to Elevation Volume table values and places results in Reservoir Geometry Coefficients Table slots.
* deltaDOChem
The function, deltaDOChem, returns doChem [g/m3], the amount of dissolved oxygen loss due to detritus, dissolved organics, and ammonia decay during the timestep.
Slots with Required Known Data
• Detritus Parameters
This method requires an oxygen stoichiometric coefficient for detritus (rDet [M/M]).
• Ammonia Parameters
This method requires an oxygen stoichiometric coefficient for ammonia (rAmm [M/M]).
• Dissolved Organics Parameters
This method requires an oxygen stoichiometric coefficient for dissolved organics (rOrg [M/M]).
The values detritusDecay, dissolvedOrganicsDecay, and ammoniaDecay are passed in from the calling function, calcDO and represent the values for either the epilimnion or hypolimnion.
Method Details
The value, doChem is calculated as follows:
(14.70)    
* deltaDOPhoto
The function, deltaDOPhoto, returns doPhoto [g/m3], the amount of dissolved oxygen gained due photosynthesis during the timestep.
Slots with Required Known Data
• Elevation of Thermocline
• Reservoir Bottom Elevation
• Photosynthesis Parameters
• Thickness of Epilimnion
• Pool Elevation
Method Details
Temperature is the layer’s temperature and is passed in to the method. The depthFromSurface is calculated based on Pool Elevation, Elevation of Thermocline, and Thickness of Epilimnion.
The method returns the following values:
(14.71)    
where
(14.72)    
and
(14.73)    
* deltaDOReaeration
The function, deltaDOReaeration, returns doReaer [g/m3], the amount of dissolved oxygen gained due to re-aeration during the timestep.
Slots with Required Known Data
• Salt Concentrations
• Wind Velocity
• Thickness of Epilimnion
Method Details
The method returns the following:
(14.74)    
where Kreaer is the surface transfer coefficient
(14.75)    
and Cs is the saturation concentration of dissolved oxygen.
(14.76)    
Temperature of the layer is passed in through layerTemp. If salinity is modeled, the reduced saturation concentration of dissolved oxygen is calculated with the following equation:
(14.77)    
where Css is the new saturation concentration, and S is the salinity concentration in ppt.
* deltaDORespiration
The function, deltaDORespiration, returns doResp [g/m3], the amount of dissolved oxygen loss due to macrophyte respiration the timestep.
Slots with Required Known Data
• Respiration Parameters
Method Details
The method returns doResp which is calculated as follows:
(14.78)    
where KmaxResp is the maximum sediment oxygen demand, AdjKResp is a function that calculates a scaling factor to adjust the maximum SOD for the current temperature based on a double S-curve. Factor is a unit-less adjustment ratio for KmaxResp set in calcDO, fResp is an additional calibration knob for sediment oxygen demand. Temperature of the layer is passed into the method.
* deltaDOSOD
The function, deltaDOSOD, returns doSOD [g/m3], the amount of dissolved oxygen loss due sediment oxygen demand during the timestep.
Slots with Required Known Data
• Epilimnion Volume
• SOD Parameters
• Hypolimnion Volume
Method Details
The method returns doSOD, which is calculated using the following equation:
(14.79)    
where KSODMax is the maximum sediment oxygen demand, AdjKSOD is a function that calculates a scaling factor to adjust the maximum SOD for the current temperature based on an S-curve. Factor is a unit-less adjustment ratio for KSODMax set in calcDO, FSOD is an additional calibration knob for sediment oxygen demand. For the hypolimnion, the sediment area is the area of the thermocline. For the epilimnion, the sediment area is the surface area minus the thermocline area.
* getAirVaporPressure
Returns Air Vapor Pressure, the vapor pressure of the air mass overlying the reservoir.
(14.80)    
where
Slots with Required Known Data
• Dewpoint Temperature
* getAvgSaltConcIn
Slots with Required Known Data
• Inflow
• Inflow Salt Concentration
The method, getAvgSaltConcIn, returns a weighted average inflow salt concentration for cases where the Inflow Salt Concentration and Inflow have multiple columns of the multi-slot. The Inflow and Inflow Salt Concentration multi-slots must have the same number of columns.
* getEpilimnionDensity
The function, getEpilimnionDensity, returns Epilimnion Water Density.
Slots with Required Known Data
• Temperature
This method requires a current or previous epilimnion temperature, a column on the Temperature Agg Series Slot.
Method Details
The value of density for the epilimnion based on the following polynomial relationship with temperature:
(14.81)    
If this value evaluates to a density greater than 1x106 g/m3, the method returns 1x106 g/m3.
* getSurfaceVaporPressure
The function getSurfaceVaporPressure, returns Surface Vapor Pressure, the vapor pressure at the surface of the reservoir:
(14.82)    
where
Slots with Required Known Data
• Temperature
This method requires a previous epilimnion temperature, a column on the Temperature Agg Series Slot.
* getWindEffect
Returns Coefficient of Wind Effect, the effect of wind on the surface heat flux equations.
(14.83)    
where
Slots with Required Known Data
• Wind Velocity
* massBalanceSaltInit
This method first checks if Diversion is not valid or equal to 0.0 and if Diversion Salt Concentration is not valid, Diversion Salt Concentration is set equal to 0.0.
Otherwise, if Diversion is valid or not equal to 0.0. Then, if Diversion Salt Concentration is not valid and Previous Reservoir Salt Concentration is valid set Diversion Salt Concentration equal to the Previous Reservoir Salt Concentration.
Next, the method checks is if Return Flow Salt Mass is linked to any object but not valid. If so, the dispatch method exits successfully and control is returned back to the dispatch controller. The object will go back on the queue if Return Flow Salt Mass gets a value.
If Hydrologic Inflow is not valid or it equals 0.0 and Hydrologic Inflow Salt Concentration is not valid, Hydrologic Inflow Salt Concentration is set equal to 0.0. Otherwise, if Hydrologic Inflow is valid or not equal to 0.0, set Hydrologic Inflow Salt Concentration to 0.0 only if it is not valid.
Next, execute the selected Bank Storage Salt method. If no method is selected, set Inbound Bank Storage Salt Mass and Outbound Bank Storage equal to 0.0.
The method checks if Inflow is valid and if it is not equal to 0.0, it sets inflowVol from the inflow rate times the current time step length. Otherwise, inflowVol is set equal to 0.0.
Otherwise, if Hydrologic Inflow, Return Flow, and Diversion are valid, set their local volume variable and set the local variable returnFlowSaltMass to the Return Flow Salt Mass slot. If they are not valid set each to 0.0 along with returnFlowSaltMass.
Then, the function returns to the calling dispatch method to continue with the method.
* setThermoclineDiffusionCoefficient
The method, setThermoclineDiffusionCoefficient, calculates a diffusion coefficient for the thermocline calculations.
Slots with Required Known Data
• Pool Elevation
• Thermocline Diffusion Coefficient Adjustment
• Reservoir Bottom Elevation
Slots with Output Data
• Thermocline Diffusion Coefficient
Method Details
Typically, this function is called only if the user has NOT supplied a coefficient of their own. The value is set by the following equation:
(14.84)    
where
* WQ_2_Layer
WQ_2_Layer is the utility method that executes the layered model. It models fluxes of constituents into and out of a reservoir hypolimnion and epilimnion. The general structure is shown in the following figure.
Figure 14.1  Schematic of two-layer water quality reservoir structure
Note:  The current WQ_2_Layer model uses a purely explicit approach to solving the reservoir’s water quality balances. That is, all calculations are based (where applicable) on information from the previous timestep. Thus outflow salt concentration is purely a function of the current outflow and the concentrations at the end of the previous timestep (i.e., hypolimnion Salt Concentrations(‑1)). This approach eliminates the need for an iterative or simultaneous type of solution, and for larger reservoirs running relatively small timesteps does not compromise the validity of the solution
Slots with Required Known Data (depending on constituents)
• Inflow
• Inflow Heat
• Inflow Ammonia Mass
• Inflow Salt Concentration
• Inflow Detritus Mass
• Inflow Salt Mass
• Inflow Dissolved Organics Mass
• Outflow
• Inflow Dissolved Oxygen Mass
• Storage
Slots with Output Data (depending on constituents)
• Ammonia Concentrations
• Outflow Dissolved Organics Mass
• Detritus Concentrations
• Outflow Dissolved Oxygen Mass
• Dissolved Organics Concentrations
• Outflow Heat
• Dissolved Oxygen Concentrations
• Outflow Salt Mass
• Outflow Ammonia Mass
• Salt Concentrations
• Outflow Detritus Mass
• Temperature
Method Details
The methods associated with this structure are outlined below. The methods are “nested”; that is, many methods rely on sub-methods for pieces of their functionality. For example, the default CalcSurfaceFlux user method relies on output from the calcHar, calcHbr, calcHc, and calcHe utility methods. Description below depict the nested nature of the temperature and salt solver in the water quality controller. The sequence of functions represents the order of execution, and the offset represents the nesting of the methods within “parent” methods. The WQ_2_Layer method does the following in order:
Verify that there is a valid previous Hypolimnion Volume and that it does not equal zero. If there is not use the previous pool elevation to calculate the previous Hypolimnion volume using the Epilimnion Thickness. Verify there is a valid previous Epilimnion Volume and Thermocline Elevation. If not, calculate these using the Hypolimnion Volume and Epilimnion Thickness.
Next determine the surface area of the reservoir and surface area of the thermocline using the Elevation Area table (if valid) or the calcSurfaceArea function.
• If modeling temperature, call calcInflowTemp.
• If modeling salinity, call calcInflowSaltConc.
• If modeling dissolved oxygen, call calcInflowDOConc, calcInflowDetConc, calcInflowOrgConc, and calcInflowAmmConc.
Execute the selected DistributeInflowCategory and DistributeOutflowCategory method.
Calculate the outflow concentration for each constituent. This can be done now since the modeling scheme is explicit. If Outflow is zero, set the Outflow Concentration of each constituent to zero.
• If modeling temperature calcOutflowTemp
• If modeling salinity, calcOutflowSaltConc
Call calcLayerVolumes to determine the volume in each layer.
Find the change in volume between layers due to thermocline movement during timestep. Determine the new HypolimnionVolumne and Epilimnion Volume due to this movement.
Determine the final concentration of the constituent in the reservoir:
• If modeling temperature, calcHeat
• If modeling salinity, calcSalt
• If modeling dissolved oxygen, calcDetritus, calcOrganics, calcDO, calcDO
* WQ_Segmented_2_Layer
WQ_Segmented_2_Layer is the utility method that executes the segmented 2 layered model. Salt is modeled as it flows through each segment in both the epilimnion and hypolimnion. The general structure is shown in the following figure. The reservoir object has N longitudinal segments and two vertical layers, the epilimnion and hypolimnion. Segment 1 represents the segment where water flows into the reservoir; Segment n represents zero or more interior segments, and Segment N represents the outflow segment. The number of longitudinal segments and the sizes are specified by the user.
When first configuring the method, the user should set the Number of Segments slot and initialize a run. The run will error, but RiverWare will update the Agg Series and Table slots with the correct number of segments. Then, the user can add necessary data to these slots.
In this approach, the thickness of the hypolimnion layer is constant and the elevation of the thermocline is constant, unless the pool elevation drops below the thermocline elevation. Each mass balance component except Evaporation will have an equivalent salt concentration and salt mass component. On the Reservoir object, the Change in Bank Storage and Vertical Flow from Hypolimnion to Epilimnion can be either negative or positive. The salt concentration entering the reservoir comes from a linked slot or is specified (input or rules).
The water mass balance is calculated by existing quantity Dispatch Methods. Once the water quality methods dispatch, this method will calculate a flow balance inside the reservoir now accounting for the layers and segments. The inflow flowing into the hypolimnion and epilimnion and outflow flowing from the hypolimnion and epilimnion is specified with a periodic or series fractional relationship. The salinity balance can then be calculated using the flow balance and a diffusion term to transport salt between the hypolimnion and epilimnion. Concentration in each segment, layer, in the bank storage, diversions, return flow and outflow are calculated each timestep.
Figure 14.2   
Note:  The current WQ_Segmented_2_Layer model uses a purely explicit approach to solving the reservoir’s water quality balances.
Slots with Required Known Data
• Inflow
• Inflow Salt Concentration
• Outflow
• Inflow Salt Concentration
• Storage
• Number of Segments
• Segment Parameters Table
• Dead Storage by Segment
• Elevation Volume Table by Segment
• Elevation Area Table by Segment
• Thermocline Elevation
• Thermocline Diffusivity
• Thermocline Thickness
Slots with Output Data (depending on constituents)
• Outflow Salt Concentration
• Outflow Salt Mass
• Epilimnion Salt Conc by Segment
• Epilimnion Salt Mass by Segment
• Hypolimnion Salt Conc by Segment
• Hypolimnion Salt Mass by Segment
• Inflow to Hypolimnion
• Outflow from Hypolimnion
• Inflow to Epilimnion
• Outflow from Epilimnion
• Epilimnion Volume by Segment
• Hypolimnion Volume by Segment
• Epilimnion Inflow by Segment
• Epilimnion Outflow By Segment
• Hypolimnion Outflow by Segment
• Hypolimnion Inflow by Segment
• Vertical Flow
• Bank Storage by Segment
• Diversion by Segment
• Return Flow by Segment
• Hydrologic Inflow by Segment
• Evaporation by Segment
• Precipitation by Segment
Method Details
Following is a conceptual overview of the computation to determine storage, salt concentration, and flow in, out, and between each segment and layer. Once the water balance is calculated by existing RiverWare functions, these steps can be completed. Each step will check if the pool elevation is below the thermocline elevation. When the pool elevation is above the thermocline, the reservoir is composed of two layers, the epilimnion and hypolimnion. If the pool elevation is below than the thermocline elevation, there will only be one layer in the reservoir, the hypolimnion. All inflows and outflows will enter and leave the hypolimnion. There will be no vertical flows, and the evaporation and bank storage will affect the hypolimnion, not the epilimnion.
Following are the conceptual steps taken in a run. These computations are described in detail in the following sections.
1. Determine the layer and segment volumes based on the water elevation.
2. Determine the inflow into each layer and outflow from each layer using the specified fraction.
3. Compute the evaporation from each segment and precipitation entering each segment using the Elevation Area Table by Segment.
4. Compute the vertical flow by taking the difference between the outflow and inflow.
5. Compute the proportion of bank storage, return flow, diversions, and hydrologic inflow entering and leaving each segment by using values in the Segment Parameters Table.
6. Compute the inflow for each epilimnion segment by adding together segment outflows, change in storage, vertical flow, evaporation and subtracting the change in bank storage.
7. Compute the inflow for each hypolimnion segment by subtracting the vertical flow from the segment outflow.
The water balance is complete. The following steps describe computations for salinity.
1. Compute the salt concentration in the bank storage.
2. Compute the salt mass and concentration in the epilimnion and hypolimnion for each segment and layer using the flows calculated from the water balance and an additional diffusion term.
3. Compute the outflow salt mass and concentration. Outflow salt concentration is based on current concentration.
4. Compute total reservoir salt mass.
The following sections describe these steps in detail.
Determine Storage in each Segment and Layer
The storage in each layer and segment is determined at the current timestep using the pool elevation (PE), thermocline elevation (TE), and Elevation Volume Table by Segment. The dead storage is added into the hypolimnion volume.
For each segment n,
(14.85)    
(14.86)    
Compute Inflow to each Layer and Outflow from each Layer
The inflow to the hypolimnion and epilimnion and outflow from the hypolimnion and epilimnion are calculated through the WQ Distribute Outflow and WQ Distribute Inflow methods. The methods calculate flow distribution between the two layers for reservoir inflow and outflow.
Compute Evaporation and Precipitation From Each Segment
The evaporation leaving each segment and the precipitation entering each segment is based on the proportion of total surface area in each segment. The proportion of total surface area in each segment is calculated using the Elevation Area Table by Segment. The following equations calculate the evaporation and precipitation in each segment, n.
(14.87)    
(14.88)    
Compute Bank Storage, Hydrologic Inflow, Diversion, and Return Flow for Each Segment
The bank storage, hydrologic inflow, diversion, and return flow entering or leaving each segment is calculated using the Segment Parameters Table. The proportions for each flow component are constant. The following equations calculates the bank storage, hydrologic inflow, diversion, and return flow affecting each segment.
(14.89)    
(14.90)    
(14.91)    
(14.92)    
Compute Vertical Flow From Hypolimnion to Epilimnion
The vertical flow is the difference between the hypolimnion inflow and outflow. The vertical flow moves excess water enter the hypolimnion to the epilimnion to keep the hypolimnion at a constant volume. The vertical flow only occurs in the segment closest to the dam, since there is no physical mechanism for vertical flow in other segments. If the pool elevation is below the thermocline, there is no vertical flow. From the conditions described above, the vertical flow is computed as follows:
If PE(t) > Thermocline Elev AND PE(t‑1) > Thermocline Elev
(14.93)    
(14.94)    
Else
(14.95)    
Check Inflow and Outflow Layer
The inflow and outflow layer of the reservoir is computed above in WQ Distribute Outflow and WQ Distribute Inflow. The inflow and outflow layer must be checked to ensure water can flow in or out of the epilimnion. All inflows and outflows only enter and leave the hypolimnion if the pool elevation is below the thermocline. If the spillways are in use, the flow through the spillways must be removed from the correct layer. Unregulated and regulated spill outflows from the epilimnion, and bypass outflows from the hypolimnion. The inflows and outflows are checked and reset as follows:
If spill(t) < 0
(14.96)    
(14.97)    
If PE(t) < Thermocline Elev
(14.98)    
(14.99)    
(14.100)    
(14.101)    
If PE(t) > Thermocline Elev AND PE(t‑1) < Thermocline Elev
(14.102)    
(14.103)    
(14.104)    
(14.105)    
Compute Epilimnion Inflows and Outflows
The epilimnion inflows and outflows for each segment are computed using the water balance calculated by existing RiverWare functions. The water balance calculates outflow using the inflow, volume, vertical flow, evaporation, precipitation, hydrologic inflow, diversion, return flow and bank storage. If the pool elevation (PE) is below the thermocline elevation (TE), there will be no water in the epilimnion. The epilimnion inflows and outflows for each segment are computed as follows:
If PE(t) < Thermocline Elev
(14.106)    
(14.107)    
Else (normal scenario)
(14.108)    
(14.109)    
(14.110)    
(14.111)    (check mass balance)
Compute Hypolimnion Inflows and Outflows
The hypolimnion inflows and outflows for each segment are calculated using a vertical flow and outflow, unless the pool elevation is below the thermocline. When the pool elevation is below the thermocline, the hypolimnion inflows and outflows are calculated similar to the epilimnion inflows and outflows. The hypolimnion inflows and outflows for each segment are computed as follows:
If PE(t) & PE(t‑1) > Thermocline Elev
(14.112)    
(14.113)    
(14.114)    when n=N
(14.115)    
(14.116)    (check mass balance)
If PE(t) < Thermocline Elev & PE(t‑1) > Thermocline Elev
(14.117)    
(14.118)    
(14.119)    
(14.120)    (check mass balance)
If PE(t) & PE(t‑1) < Thermocline Elev
(14.121)    
(14.122)    
(14.123)    
(14.124)    (check mass balance)
If PE(t) > Thermocline Elev & PE(t‑1) < Thermocline Elev
(14.125)    
(14.126)    
(14.127)    
(14.128)    (check mass balance)
The water mass balance is complete after this step. All the inflows, outflows, changes in storage and vertical flows are now known. The salinity mass balance can be calculated with the above information.
Compute Bank Storage Salinity
The bank storage salinity is computed using the previous bank storage salinity and the salinity entering or leaving the bank. When water is entering the bank, salinity mass coming in with the water from the epilimnion affects the concentration in the bank. When water is leaving the bank and entering the reservoir, the salinity mass leaving the bank is added to the epilimnion.
The bank storage salt mass is computed as follows:
If Change in Bank Storage(t) < 0
(14.129)    
If PE(t) > Thermocline Elev & Change in Bank Storage(t) > 0
(14.130)    
If PE(t) < Thermocline Elev & Change in Bank Storage(t) > 0
(14.131)    
The bank storage salt concentration is computed as follows:
(14.132)    
Compute Epilimnion and Hypolimnion Salinity
The epilimnion and hypolimnion salt mass and concentration for each segment are computed from a mass balance on salinity. Water and salinity can flow in or out of the bank storage, up or down vertically between the epilimnion and hypolimnion through diffusion and vertical flow, and in and out of each longitudinal segment. The following equations account for the different flow directions of salinity in the mass balance.
The variables VerticalFlowConc and BSFlowConc must be known before calculating the salinity mass. If an intermediate concentration is computed in the concentration calculations, it will replace the epilimnion or hypolimnion concentrations for the VerticalFlowConc and BSFlowConc variables.
If Vertical Flow(t) > 0
(14.133)    
Else
(14.134)    
If Change in Bank Storage(t) < 0
(14.135)    
If Change in Bank Storage(t) > 0 AND
PE(t) & PE(t‑1) > Thermocline Elev
(14.136)    
Else
(14.137)    
Once the VerticalFlowConc and BSFlowCon variables are known, the salt mass and concentration are calculated based on the pool elevation and thermocline elevation:
If PE(t) < Thermocline Elev & PE(t‑1) > Thermocline Elev
(14.138)    
(14.139)    
(14.140)    for n=1
(14.141)    
(14.142)    
(14.143)    
If PE(t) < Thermocline Elevation & PE(t‑1) < Thermocline Elev
(14.144)    
(14.145)    for n=1
(14.146)    
(14.147)    
(14.148)    
If PE(t) > Thermocline Elevation & PE(t‑1) > Thermocline Elev
(14.149)    
(14.150)    
(14.151)    for n=1
(14.152)    for n=1
(14.153)    
(14.154)    
Compute Outflow Salinity
The outflow salt mass and concentration is calculated based on the outflow volume, and the epilimnion and hypolimnion concentration in segment N. The following equations calculated the outflow salinity:
(14.155)    
(14.156)    
Compute Total Reservoir Salt Mass
The reservoir salt mass is calculated based on the concentration and volume in each segment. The following equations calculated the reservoir salt mass:
(14.157)    
The Segmented Two-layer Salt Reservoir method is complete. The outflow concentration and mass can then be transfered across a link, and water quality in downstream objects can be solved.
Notes for Segmented Two-layer Salt Method
The following parameters can be altered to calibrate the salinity model:
• The number of segments.
• The inflow or outflow distribution fraction of the epilimnion and hypolimnion.
• The Elevation Storage Table by Segment. Try to make the volume in each segment relatively equal.
• The diffusion terms. Change the thermocline thickness and diffusivity.
• Segment proportions for the following flows: diversion, return flow, hydrologic inflows, bank storage.
Total Dissolved Gas Methodology
Total Dissolved Gas Modeling consists of two components, A simulation method that computes the TDG concentrations in the reservoir. It also computes partial derivatives that are used in subsequent optimization runs. Within Optimization, constraints are generated and the user can write policy to limit the change in deltas. This section describes the mathematical formulation and the specifics of the methods, but does not outline how to use this approach. That is beyond the scope of this document. Contact CADSWES for more information.
Note:  TDG concentration is typically reported as the TDG saturation percentage. So a TDG of 115 is 115% of saturation. Some literature uses a decimal, 1.15, some use a percentage 115%. As a result, in RiverWare, all TDG concentrations use the FRACTION unit type. Then the user can choose to see values in either of the two user units: decimal or percent.
The following sections describe these new methods.
* Outflow TDG using Tailwater Depth
The method is only available if one of the “Regulated...” spill methods is selected. It is not available for the None method, Monthly Spill or Unregulated Spill methods
Slots Specific to This Method
Entrained Flow
Type: Series
Units: FLOW
Description: Entrained Flow is the portion of the Turbine Release that has air from the spillways entrained in it. In the tailrace, there are surface deflectors that attempt to move the spill horizontally and keep it from plunging into the tailrace. These deflectors attract water from the turbine release due to the increased velocity. This portion of the turbine release is then entrained with air from the spillways and has the TDG concentration of the spill. This value is nonnegative.
Information: This slot is computed based on the equation .
I/O: Output only.
Inflow TDG Concentration
Type: Series
Units: Fraction
Description: This slot contains the inflow TDG concentration
I/O: Output or required input
Outflow TDG Concentration
Type: Series
Units: Fraction
Description: This slot shows the resulting Outflow TDG Concentration. The values can then be compared to the values in the Outflow TDG Concentration Estimate. Once the TDG solution has converged the values in this slot should be equal to the values in the Outflow TDG Concentration Estimate slot at all time steps (within a tolerance)
Spill TDG Concentration
Type: Series
Units: Fraction
Description: This slot shows the resulting Spill TDG Concentration.
Tailwater Bottom Elevation
Type: Scalar
Units: Length
Description: The elevation at the bottom of the tailrace.
Information: The value in this slot is used in the TDGS computation to get the depth of tailwater.
I/O: Required Input
TDG c1
Type: Scalar
Units: Fraction
Description: This scalar slot contains the constant in the TDG equation when Spill is zero.
I/O: Required Input
TDG Entrainment b1
Type: Scalar
Units: None
Description: The value in this scalar slot represents the fraction of Spill which can be entrained. A portion of the Turbine Release up to this amount will have the same TDG concentration as the Spill.
I/O: Required Input
TDG Entrainment b3
Type: Scalar
Units: Flow
Description: The value in this scalar slot represents the constant of Spill which can be entrained. A portion of the Turbine Release up to this amount will have the same TDG concentration as the Spill.
I/O: Required Input
TDG Spill b2
Type: Scalar
Units: PerLengthTime
Description: This scalar slot contains the coefficient in the Spill TDG Concentration equation.
Note:  This unit type may need to be added.
I/O: Required Input
Turbine Release TDG Concentration
Type: Series
Units: Fraction
Description: This slot shows the resulting Turbine TDG Concentration. This is sometimes called the forebay concentration or the reservoir concentration.
Spill and Turbine Release Limit
Type: Scalar
Units: Flow
Description: Lower bound for which spill and turbine release will be treated the same as higher flows. Below this flow limit, the computations will be modified.
I/O: Required Input
Method Details
The method is executed by the two water quality dispatch methods:
First, some notation:
TDGS = Spill TDG Concentration
TDGT = Turbine Release TDG Concentration, concentration just above the dam.
TDGO = Outflow TDG Concentration
TDGI = Inflow TDG Concentration (linked to upstream reservoir’s TDGO
Qsm = Spill and Turbine Release Limit (calculations are changed for small flows)
Compute the TDGs:
TW is Tailwater Elevation.
TW0 is the elevation at the bottom of the tailrace, a project constant (scalar length).
is the density of water, a global constant. (internal, 999.7kg/m3)
g is the gravitation constant. (internal, 9.81m/s^2)
patm is the atmospheric pressure. (internal, 101325kg/(m*s)^2)
b2 is a project constant, TDG Entrainment b2, (1 / Length-Time).
Get the TDGT. This is the same as the TDGI which may be linked to an upstream reach that lags the TDG concentration by some number of timesteps.
Compute the Entrained Flow, QE:
QS = Spill
QT = Turbine Release
b1, TDG Entrainment b1, and b3, TDG Entrainment b3, are scalar constants for each project.
The final computation is to compute the TDGO. This is the mixed outflow concentration which could also be called the tailwater concentration.
If QT + QS = 0
c1 is a constant for each reservoir in fraction units.
Else
To provide continuity with the concentration when outflow is zero, the concentration is adjusted when outflow is small.
If c1 >= 0
Else If QS < Qsm
End If
Optimization Total Dissolved Gas category
This category will be added when the Outflow TDG using Tailwater Depth method described above is selected.
This category contains two methods.
* None
This is the default, no-action method.
* Opt Outflow TDG Tailwater Depth
This is the optimization component of TDG modeling. See also the simulation model described above. This method instantiates the slots and then sets up the data necessary for the Optimization problem. The defining constraints are also described below.
Slots Specific to this Method
Outflow TDG Concentration
Type: Series
Units: Fraction
Description: This slot represents the optimization variable for Outflow TDG Concentration.
Information:  
I/O: Set by a rule
Outflow TDG Concentration Estimate
Type: Series
Units: Fraction
Information: The total dissolved gas calculations in Optimization require a pre-run estimate of Outflow TDG Concentration at each time step. These values are entered in this series slot, usually by a DMI.
I/O: In the equations, this slot uses the notation: TDGO*
Spill Estimate
Type: Series
Units: FLOW
Description: The total dissolved gas calculations in Optimization require a pre-run estimate of Spill at each time step. These values are entered in this series slot, usually by a DMI.
Information: In the equations, this slot uses the notation: QS*
I/O: Input by the user or through a DMI
Spill TDG Concentration
Type: Series
Units: Fraction
Description: This slot represents the optimization variable for Spill TDG Concentration.
Information:  
I/O: Set by a rule
Tailwater Elevation Estimate
Type: Series
Units: Length
Description: This slot operates the same as the Spill Estimate slot but for Tailwater.
Information:  
I/O: Input by the user or through a DMI
Turbine Release Estimate
Type: Series
Units: Flow
Description: This slot operates the same as the Spill Estimate slot but for Turbine Release.
Information: QT*
I/O: Input by the user or through a DMI
Turbine Release TDG Concentration
Type: Series
Units: Fraction
Description: This series slot is an optimization variable defined based on the lag from the Inflow TDG Concentration.
Information:  
Turbine Release TDG Concentration Estimate
Type: Series
Units: Fraction
Description: This slot operates the same as the Spill Estimate slot but for Turbine Release TDG Concentration.
Information: This value must be input if you wish to write policy constraints on the Turbine Release TDG Concentration.
dSlot1 dSlot2 Partial Derivative Slots
The following is a list of all of the partial derivative slots. All of the slots are individual series slots that contain the values computed in the simulation portion and are used as input values in the next optimization solution. The name is formed by the partial of Slot 1 with respect to the partial of slot 2: dSlot1 dSlot2. The slot names have no spaces and use underscores where appropriate.
Type: Series Slot
Information: Table 14.1 shows the information stored in each column.
I/O: Input (for use in optimization) or Output (computed by WQ methods)
Table 14.1  TDG Partial Derivatives - Slot Description
Slot Name
Units
Comment and Equation
dTDG_Outflow
dTDG_Spill
None
Partial derivative of Outflow TDG Concentration with respect to Spill TDG Concentration
dTDG_Outflow
dTDG_TurbineRelease
None
Partial derivative of Outflow TDG Concentration with respect to Turbine Release TDG Concentration.
dTDG_Outflow
dSpill
Fraction PerFlow
Partial derivative of Outflow TDG Concentration with respect to Spill.
dTDG_Outflow
dTurbineRelease
Fraction PerFlow
Partial derivative of Outflow TDG Concentration with respect to Turbine Release.
dTDG_Outflow
dEntrainedFlow
Fraction PerFlow
Partial derivative of Outflow TDG Concentration with respect to Entrained Flow.
dTDG_Outflow
dOutflow
Fraction
PerFlow
Partial derivative of Outflow TDG Concentration with respect to Outflow.
dTDG_Spill
dTailwater
Fraction
PerLength
Partial derivative of Spill TDG Concentration with respect to Tailwater. This is only needed if patm is a series slot. If not, this reduces to a constant.
dTailwater
dTailwaterBaseValue
None
Partial derivative of Tailwater with respect to Tailwater Base Value. Computed based on the selected Tailwater method.
dTailwater
dTailwaterPrevBaseValue
None
Partial derivative of Tailwater with respect to Tailwater Base Value at the previous timestep. Computed based on the selected Tailwater method.
dTailwater
dOutflow
Length
PerFlow
Partial derivative of Tailwater with respect to Outflow. Computed based on the selected Tailwater method.
dPoolElevation
dStorage
Length
PerVolume
Partial derivative of Pool Elevation with respect to Storage. This value is computed by finding the slope of the Elevation Volume table for the current Pool Elevation/Storage.
dEntrainedFlow
dSpill
None
Partial derivative of Entrained Flow with respect to Spill.
dEntrainedFlow
dTurbineRelease
None
Partial derivative of Entrained Flow with respect to Turbine Release.
Delta Entrained Flow
Type: Series
Units: Flow
Description: This slot is an optimization variable.
I/O: Output Only
Delta Inflow
Type: Series
Units: Flow
Description: This series slot is an Optimization Variable.
I/O: Output Only
Delta Outflow
Type: Series
Units: Flow
Information: This series slot is an Optimization Variable.
Delta Outflow TDG Conc
Type: Series
Units: Fraction
Description: This series slot is an Optimization Variable.
Delta Pool Elevation
Type: Series
Units: Length
Information: This series slot is an Optimization Variable.
Delta Storage
Type: Series
Units: Volume
Information: This series slot is an Optimization Variable.
Delta Spill TDG Conc
Type: Series
Units: Fraction
Information: This series slot is an Optimization Variable.
Delta Tailwater
Type: Series
Units: Length
Information: This series slot is an Optimization Variable.
Delta Tailwater Base Value
Type: Series
Units: Length
Description: This series slot is an Optimization Variable.
Delta Turbine Release TDG Conc
Type: Series
Units: Fraction
Description:  
Information: This series slot is an Optimization Variable.
Delta Turbine Release
Type: Series
Units: Fraction
Description:  
Information: This series slot is an Optimization Variable.
Method Details
This method is called by the water quality dispatch method and computes the partial derivatives and Taylor expansion equations that will be used in the optimization formulation. This step will only occur when the optimization method is selected, but will occur during water quality dispatching in the simulation runs. In this section, we describe the mathematical formulation, but not the order in which they are computed.
To discuss the partial derivatives, we must write the full mathematical representation. In the following description, we show the equations and note where each one is computed, either in the simulation method (Sim Calc or Sim Input) or as a defined variable in the optimization (Defined Variable). That is, within the WQ dispatching the partial derivatives are computed. Then within the Opt Begin Run, variables are defined, as necessary,
Introduce the following variable to track the difference from the estimated value:
Slot: Outflow TDG Concentration- Defined Variable
TDGO* is the slot Outflow TDG Concentration Estimate - Sim Input
TDGO is the slot Delta Outflow TDG Concentration - Defined Variable
Slot: Delta Spill- Defined Variable
QS is the slot Spill - Defined Variable
QS* is the slot Spill Estimate - Sim Input
Slot: Delta Turbine Release - Defined Variable
QT is the slot Turbine Release - Defined Variable
QT* is the slot Turbine Release Estimate - Sim Input
To write constraints on the Turbine Release TDG Conc, then also track the difference between the estimated concentration and the computed:
Slot: Turbine Release TDG Concentration- Defined Variable
TDGO* is the slot Turbine Release TDG Concentration Estimate - Sim Input
TDGO is the slot Delta Turbine Release TDG Concentration - Defined Variable
The first-order Taylor series approximation is:
TDGO is the slot Delta Outflow TDG Concentration - Defined Variable
The partial derivatives are defined as follows. All of these derivatives are calculated for each timestep and therefore are based on the values computed during the previous rulebased simulation (which used the estimated values, QS*, QT*, etc...).
Slot: dTDG_Outflow dTDG_Spill - Sim Calc
Slot: dTDG_Outflow dTDG_TurbineRelease - Sim Calc
Slot: dTDG_Outflow dSpill - Sim Calc
Slot: dTDG_Outflow dTurbineRelease - Sim Calc
Slot: dTDG_Outflow dEntrainedFlow - Sim Calc
Slot: dTDG_Outflow dOutflow - Sim Calc
QO = Delta Outflow = Delta Turbine Release + Delta Spill
For low flow conditions, QS and QT < Qsm, alternative partial derivatives are used to improve convergence. The partial derivatives are set based on the ratio = QE / QT. If QT = 0 then ratio = 0.
If TDGT is input, then TDGT = 0. TDGI is the Delta Inflow TDG Concentration, which is linked to an upstream object’s TDGO slot. The slot Delta Turbine Release TDG Conc is a Defined Variable.
Slot: Delta Entrained Flow - Defined Variable
The partials in this equation depend on the condition of Entrained Flow and Turbine Release.
If QE = QT and QT > 0 (using estimated values)
Else
If b3 >= 0 or QE > 0
Else
Next, introduce the variable for the Delta Spill concentration:
Slot: Delta Spill TDG Conc - Defined Variable
Slot: dTDG_Spill dTailwater - Sim Calc
To complete the Taylor series expansion:
Slot: Delta Tailwater - Defined Variable
The tailwater partials are based on the selected Tailwater method. The Tailwater is then based on the selected Tailwater Method
• Tailwater Base Value Method
Slot: dTailwater dTailwaterBaseValue - Sim Calc
Slot: dTailwater dTailwaterPrevBaseValue - Sim Calc
Slot: dTailwater dOutflow - Sim Calc
• Base Value Plus Lookup Method
Slot: dTailwater dTailwaterBaseValue - Sim Calc
Slot: dTailwater dTailwaterPrevBaseValue - Sim Calc
Slot: dTailwater dOutflow - Sim Calc
• Stage Flow Method
Slot: dTailwater dTailwaterBaseValue - Sim Calc
Slot: dTailwater dTailwaterPrevBaseValue - Sim Calc
Slot: dTailwater dOutflow - Sim Calc
• Coefficients Table method
Slot: dTailwater dTailwaterBaseValue - Sim Calc
Slot: dTailwater dTailwaterPrevBaseValue - Sim Calc
Slot: dTailwater dOutflow - Sim Calc
If the tailwater base value is input, the partial derivatives are zero. If tailwater base value is set equal to downstream pool elevation then
Res. TWBV = Downstream(Res). PE, Slot: Delta Tailwater Base Value - Defined Variable
This will require a link, which will create an automatic constraint. The Taylor series equation for pool elevation (aka forebay elevation) depends on reservoir storage.
Slot: Delta Pool Elevation - Defined Variable
The partial derivative can be calculated from an elevation-volume table. The dPoolElevation dStorage value is stored in a slot.
Storage is defined by the continuity or mass balance equation:
Slot: Delta Storage - Defined Variable
The partial derivative is the length of a time step in the model, dStorage dOutflow. It will initially be implemented as a constant. If a given St is not a variable then St = 0. For example, S is typically known at the beginning of a model run.
If inflow is equal to an upstream outflow from a reservoir, reach, or confluence then
Res. QI = UpstreamObj. QO
Otherwise inflow is an input and as for all inputs, QI = 0
TDGI is the Inflow TDG Concentration, which is linked to an upstream object’s TDGO slot.
 
Revised: 06/03/2019