~ ~ ~ PURPOSE ~ ~ ~ this subroutine performs in-stream nutrient transformations and water quality calculations
calculate flow duration ht3 is incoming concentration calculate temperature in stream Stefan and Preudhomme. 1993. Stream temperature estimation from air temperature. Water Res. Bull. p. 27-45 SWAT manual equation 2.3.13 benthic sources/losses in mg
ht3 = concentration of incoming nutrients interpolate rating curve using peak rate calculate effective concentration of available nitrogen QUAL2E equation III-15 calculate saturation concentration for dissolved oxygen QUAL2E section 3.6.1 equation III-29 end initialize concentrations
O2 impact calculations calculate nitrification rate correction factor for low oxygen QUAL2E equation III-21 end O2 impact calculations
algal growth calculate chlorophyll-a concentration at end of day QUAL2E equation III-1 calculate light extinction coefficient (algal self shading) QUAL2E equation III-12 calculate algal growth limitation factors for nitrogen and phosphorus QUAL2E equations III-13 & III-14 calculate daylight average, photosynthetically active, light intensity QUAL2E equation III-8 Light Averaging Option # 2 calculate growth attenuation factor for light, based on daylight average light intensity QUAL2E equation III-7b calculcate local algal growth rate multiplicative QUAL2E equation III-3a limiting nutrient QUAL2E equation III-3b harmonic mean QUAL2E equation III-3c calculate algal biomass concentration at end of day (phytoplanktonic algae) QUAL2E equation III-2 calculate fraction of algal nitrogen uptake from ammonia pool QUAL2E equation III-18 calculate chlorophyll-a concentration at end of day QUAL2E equation III-1 end algal growth
oxygen calculations calculate carbonaceous biological oxygen demand at end of day QUAL2E section 3.5 equation III-26 adjust rk1 to m-term and BOD & O2 mass availability
calculate corresponding m-term nitrogen calculations calculate organic N concentration at end of day QUAL2E section 3.3.1 equation III-16 calculate dissolved oxygen concentration if reach at end of day QUAL2E section 3.6 equation III-28
end oxygen calculations
calculate ammonia nitrogen concentration at end of day QUAL2E section 3.3.2 equation III-17 calculate concentration of nitrite at end of day QUAL2E section 3.3.3 equation III-19 calculate nitrate concentration at end of day QUAL2E section 3.3.4 equation III-20 end nitrogen calculations
phosphorus calculations calculate organic phosphorus concentration at end of day QUAL2E section 3.3.6 equation III-24 calculate dissolved phosphorus concentration at end of day QUAL2E section 3.4.2 equation III-25
calculate dissolved phosphorus concentration at end of day QUAL2E section 3.4.2 equation III-25 end phosphorus calculations
convert back from concentration to mass for routing all water quality variables set to zero when no flow