Introduction

Surface water and especially rivers are the most important sources of human water supply. Unfortunately, pollutants from industrial, agricultural and municipal wastewater could reduce the quality of these important human resources and cause environmental problems. In these circumstances, high water treatment costs usually prevent reaching to the minimum acceptable quality parameters for drinking water or other usages (Farhadian et al. 2015; Khazaee et al. 2015). One of the most important environmental issues is the pollution of surface water that should be measured, simulated and managed separately. Controlling the permissible concentration of contamination for daily water usage requires special tools for water treatment. But, building such facilities has significant costs; therefore, providing a reasonable solution which decreases the expenses is very important (World Meteorological Organization Technical Report 2013). The water pollution sources could be either point sources or nonpoint sources. It should be noted that in many water pollution investigations, different governments used various methods to reduce the harmful effects of pollutants from nonpoint sources. For instance, Quality Assessment of China’s Xiangxi watershed has been investigated for entering sediment and nutrient loads. Many solutions have been proposed to counteract and reduce these destructive effects in earlier studies (Strehmel et al. 2016; Wu et al. 2013). In a study, the pollution of heavy metals and rare elements in the soil, sediments and vegetation samples has been determined at rivers in a region of Africa which is adjacent to the numerous small mines and industrial activities which affect rivers have been investigated and analyzed (Atibu et al. 2018).

Understanding the location and time distribution of pollution is an essential element for accurate predict of pollution damages on the ecology of rivers and coastal areas, as well as create efficient solutions for control of pollution and environmental protection. Various numerical models are powerful tools for solving the equations of pollution transmission in water resources.

The pollution transmission in rivers is expressed by differential equations with partial derivatives of transmission–diffusion. These equations can be solved by analytical methods (Khorashadizadeh et al. 2018). Because of the hydraulic connection among the water resources of the consumer systems, the entire water system is usually studied as an integrated and interconnected pattern. Because of the complexity of large-scale water transfer problems, their dynamism and nonlinearity, the development of the knowledge related to the components of these large-scale systems for a better understanding of the relation between the time and location components of the studied system and using the simulation–optimization model of watersheds resources and consumption along with engineering knowledge of systems is of a great importance. Simulation is a flexible tool with wide application for complex analysis of water resources systems. To simulate, the system should be described from both sides of the design variables and its consuming policies first, and then, it could simulate to determine its performance (Shourian et al. 2008).

Today, many rivers are exposed to severe pollution around the world. Pollution in rivers is one of the most important issues in the environment. Rivers with a variety of dangerous pollutants have created serious problems with regard to human health and the environment. Therefore, the transmission of pollution in rivers and controlling the contaminants are one of the most important problems. The governing equation of pollution transmission in rivers is one of the most important partial parabolic differential equations derived from the combination of the continuity equation and the first rule of law which has extensive applications in the field of climate and water sciences. In the field of the pollution transmission in rivers, analytical methods are very important. Unlike numerical solutions, analytical solutions show all the effective parameters in the problem explicitly. As a result, determining the impact of each of these parameters will be easier. Analytical solutions estimate the transmission situation precisely, and also they are very useful tools for numerical validation (Batu 2005). The most common method used for the physical treatment of graywater is recognized as filtration (Jawaduddin et al. 2019). In most river models, one-dimensional type of expression is used, so that the geometry of the system is formulated in a linear network of volumetric divisions. The parameters of water quality change longitudinally in the x-axis direction. One-dimensional approaches are also simple way to simulate small and deep lakes, in which they display numerical variations of temperature and other qualitative parameters as a grid that is vertical to the horizontal volumes (Chen 1975). Water quality management in real time is used to determine the safe location polluting loads discharges in the San Joaquin watershed (SJR) (Nigel and Quinn 2005). Many studies have been done in the field of simulating the transfer of pollutants in surface waters by various numerical methods, in which their defects have been resolved after a while (Vazquez 1999; Toro 2001; Paik and Park 2011; Mohtashami et al. 2017). A solution of a differential equation that can be determined with any desired degree of precision in any ideal location and time without changing the structure of the problem is called analytical solution. Many efforts have been done by researchers to find an analytical solution for the pollution equations in surface water, and various methods have been used in which the main difference between them is the type of boundary condition and the time pattern of discharge of pollutants (Chen et al. 2012; Craig and Read 2010). The analytical solutions of differential equations are of interest in many engineering fields, including mass transfer, heat transfer and the dispersion of pollutants in air, soil and water. In analytical methods, unlike numerical methods, there are no limits such as the choosing the time, location and the convergence condition. In addition, numerical methods always have errors, while the analytical methods are precise and they are useful tools for verifying the numerical solution of differential equations (Guerrero et al. 2009). Kim et al. (2011) made a comparison between the numerical and analytical solutions of pollution transmission equation. They also compared the numerical and analytical solution of the transfer–diffusion equation, and for verification purposes, they compared them with the experimental data of past research and concluded that the analytical methods are a fairly reliable tool for assessing simulation and prediction of pollution movement in surface water resources. Singh et al. (2012) investigated the stages and conditions for the transmission and diffusion of pollution in a small waterway. They used a finite difference method in control volume to solve the governing equations of the problem. Also they compared their results to validate with an analytical solution. Khorashadizadeh et al. (2016) used shallow water equations to simulate the transmission of contamination by two-dimensional finite volume methods in a river. Then, they analyzed the results of their research under uncertainties and reduced the uncertainty of the model parameters. Simulation–optimization models could provide optimal water allocation values by considering both quantitative and qualitative conditions. Quantitative and qualitative water resource optimization models, along with simulation models, as well as maximizing the system’s performance, could provide a probabilistic space for decision making to make correct decisions and reduce risk (Delavar et al. 2014). One of the most important aspects of water resources management is the optimal allocation of pollutants in rivers. A simulation–optimization model was used in the distribution model of pollution of the Haraz River in northern Iran. The simulation model was based on the Streeter–Phelps equation for estimating the river BOD density. Also, linear programming technique was used as an optimization tool (Saremi et al. 2010). Schedule analysis is an important tool in modeling and predicting climatic parameters such as precipitation, temperature and hydraulic data (Hamidi et al. 2018). In order to solve the multi-objective problem of allocation of pollution in the Haraz River, the Streeter–Phelps equation was used to simulate the water-soluble oxygen content index at the control points of the Haraz River and the particle optimization algorithm was used as optimization algorithm (Ashtiani et al. 2015). Wen and Lee (1998) presented a multi-purpose neural network optimization model for river quality management and used it for the Tou-Chen River Basin in Taiwan. By using this model, they improved water quality, reduced wastewater treatment costs and allocated allowable contamination in a fair manner. Karamouz et al. (2003) presented an optimization model for water quality management in a river for monthly point contamination using the sequential dynamic genetic algorithm (SDGA). In their research, they minimized the cost of point pollution treatment and the amount of exceeding from the contamination standard. The proposed model for water quality management in Karun River was implemented. The results of the research showed the efficiency of the model and used algorithm.

Zewdie and Bhallamudi (2012) using the multi-objective simulated annealing (AMOSA) algorithm and simulation model managed the quality of tidal river water resources by controlling abandoned discharge rates and reducing or eliminating pollutant contamination levels along the river. They concluded that flood flow plays an important role in improving water quality by increasing the flow volume and increasing the capacity of river dilution. They also reduced the cost of river purification and improved the water quality of the river using this scenario on the Adir River in India. Hernandez and Uddameri (2013) used a decision support system (DSS) based on a remote sensing approach to assess the pollution capability of the Arroyo Colorado River along the US–Mexico border. The main focus of the study was the development of a decision support system for assessing the effects of the biochemical oxygen demand at the river. In this case, the limits raised in the problem were the limitations of the maximum BOD density, the amount of DO in the control points, the minimum contamination release, the minimum allowed drainage from the refinery and the parameters positivity defined in all of the treatment and control points. Liu et al. (2013) used a multi-objective simulation–optimization algorithm using the NSGA-II algorithm to interact between water quality and quantity as well as reducing economic losses. They used the Saint Venant’s equations to simulate a one-dimensional transmission spreading of water pollution. They intended to maximize profits and cost-effectiveness, minimize water shortages and maximize the pollution that is lost in the current. The results showed that the regulation of the entrance resources of the river could not only be used to regulate the flow of the river, but also to investigate the problems and challenges facing the allocation of pollutants. Dehghani Darmian et al. (2018) protected the quality of water resources against uncontrolled pollution. They used dilution current and sequestration techniques, which were first introduced, to manage river quality and achieve good results. Farhadian et al. (2015) examined the capacity to absorb the river and the flow needed to dilute pollutants as an important target of their research. Contamination damage to the environment of a river is a function of pollutants concentration and the duration of contact with water. The optimal amount of river absorption capacity and dilute river flow required to reduce pollution calculated using a nonlinear programming (NLP) and NSGA-II algorithm. The results of their research indicated that river flow size could increase the river’s absorption capacity by up to 80%. Also, by adjusting river flow, the optimal concentration of pollutants and the duration of contamination were obtained.

Hashemi Monfared et al. (2017) considered the contamination density as well as the distance that contamination was in contact with river water as the objective function for water quality management in the river. They used river absorption capacities and diluent flow for river quality management. Afshar and Masoumi (2016) optimized allocation of pollution in Karkheh River using multi-objective multi-particle fragmentation intelligence (MPSO) algorithm, CE-QUAL-W2 simulation and neural network simulation algorithm. The cases considered in the research are optimal allocation of pollution in the river, reduction of pollution elimination costs, observance of fairness between different pollutant units and reduction of the number of violations of dissolved oxygen concentration from standard values in the form of cost-violation.

Indeed, in none of mentioned studies, the simultaneous impact of timetable and location of entering contamination on river pollution management has not been considered in a short time period. In this research, a mathematical model is proposed considering the simultaneous impact of contamination entering timetable and location on river pollution management.

Three goals are considered in the river water quality management program. (1) Pollutant entrance to the river should be in such a way that the related damages get minimized for downstream consumers. (2) All contaminations from point sources of pollution must enter the river within a specified time interval (T). (3) The pollutant concentration must be less than the allowable limit. Eight point sources of contamination production are available at upstream locations of the Gheshlagh River of Iran (x1, x2, x3, …, x8). The water consumer is at the downstream of the river (point A). At a given time interval (T), these contaminating sources enter a certain amount of pollution (m1, m2, m3, …, m8) into the river flow. The main issue of the research is to determine the time distribution and location of contamination from these resources to the river in order to minimize the damages for consumer A. Finally, the problem objective will be optimized by the PSO algorithm, and the timetable and locations of entering pollution are provided for the Gheshlagh River. The rest of the paper is organized as follows: Sect. 1 presents introduction. The materials and methods are described in Sect. 2. The results and discussion are given in Sect. 3. Finally, Sect. 4 presents the conclusions.

Materials and methods

Simulation of contamination advection–dispersion

One-dimensional equation of advection–dispersion for pollution in the river is derived from the mass transfer equation which is one of the most important differential equations with partial derivatives that is widely used in water, soil, gas and environmental Engineering. The equation for the transmission of pollution in surface water is a partial linear differential equation, which have first-order time derivative and second-order spatial derivative (Van Genuchten and Alves 1982). This equation is given as follows:

$$\frac{\partial c}{\partial x} + u\frac{\partial c}{\partial t} = D_{x} \frac{{\partial^{2} c}}{{\partial x^{2} }} \pm {\text{Sources/Sinks}}$$
(1)

where (c) is the amount of contaminant concentration at time t and location x, and its unit is milligrams per liter, x is distance from the source of contamination in terms of (m), and t is the time of pollution in the river in seconds (s). Also, u is the average flow rate (L/t). \(D_{x}\) is called longitudinal diffusion coefficient. In this equation, the effect of sources is also included.

In this paper, contamination entering the river is simulated by an analytical solution. Thus, the contamination levels in the river are determined at different time and locations. The analytical solution of the advection–dispersion equation is given by Eq. 2 (Zheng 1996).

$$c(x,t) = \frac{M}{{A\sqrt {4\pi tD_{x} } }}\exp \left( { - \frac{{(x - (x_{0} + v_{x} t))^{2} }}{{4D_{x} t}}} \right)$$
(2)

in which, c (x, t) is the concentration of pollution along the river at location x and at time t, A is the cross section of the river, vx is the average flow velocity, and \(D_{x}\) is the longitudinal dispersion coefficient of pollution in the river. Also, M is the mass of pollution in kilograms. A lot of researches have been done to calculate the diffusion coefficient (D) (Alizadeh et al. 2017). In this research, Fisher method is used, which is given in Eqs. 3 and 4 (Fischer 1975).

$$D = 0.011\frac{{u^{2} w^{2} }}{hv}$$
(3)

where w is the width of the river (m), h is the depth of water (m), and v is the shear rate (m/s) calculated as follows.

$$v = \sqrt {grs}$$
(4)

where g is the acceleration of gravity (9.81 m/s2), s is the hydraulic gradient of the river (m/m), and R is the river hydraulic slope, which is equal to A/P. [A is the cross-sectional area of the river (m2), and P is the moisture stream (m).] First, the contamination is transmitted through an analytical solution. In order to manage optimally and present a program for controlling pollution in this research, it is necessary to solve the optimization problem.

Optimization model

Optimization is seeking to find possible answers in the response space and uses a repetitive process to find an answer. In real-life situations, the solution space is limited, and a minimum or maximum target function must be found in this range. On the other hand, in real-world issues, the variables of the problem have different constraints that they call the constraints of the problem. The relation between this constraint and the problem variables can be linear or nonlinear. Also, these constraints can be categorized as equal constraints or unequal constraints (Sahab et al. 2013).

Metaheuristic optimization algorithms can provide suitable techniques to solve optimization problems. Most of these algorithms are inspired by natural phenomena. In the last several decades, metaheuristic algorithms are successfully applied to solve engineering optimization problems such as genetic algorithm (Holland 1992), harmony search (Geem et al. 2001), artificial bee colony (ABC) (Karaboga and Basturk 2007), and search and rescue algorithm (SAR) (Shabani et al. 2019).

In 1995, a particle swarm optimization algorithm (PSO) was proposed by an American psychologist named James Kennedy and an electrical engineer named Russell C. Eberhart (Eberhart and Kennedy 1995). They initially sought a kind of computational intelligence based on social relationships and models. Then, they conducted studies on the group’s behavior of humans and animals, and eventually, this algorithm was inspired by the behavior of fish, birds and even humans. By analyzing the patterns of flying birds in search of food, they found two factors influencing flight patterns.

They realized that each bird changed its position according to the personal experience and experiences of the entire community. Birds remember their best position and move through the exchange of information between the bird group members as well as their memory, and the speed of movement changes throughout the search. By continuing this movement pattern, the best source of food has been found and everybody has access to this source (Eberhart and Kennedy 1995).

The PSO algorithm is a population-centric algorithm designed to solve continuous problems. The movement of the population is based on individual experiences and social experiments. The development of this algorithm is an important advance in optimization science (Eberhart and Kennedy 1995).

As stated, there are i source points for pollution production in upstream (x1, x2, x3, …, xi) and a water consumer at the downstream of the example river (point A). Within a given time period (a day with hourly time step), these contaminating sources enter a certain amount of pollution (m1, m2, m3, …, mi) into the river flow. The main issue of this research is how should be the timetable and location of contamination input from these resources so that the degree of damages to consumer A (depending on the type of use) is minimized, while considering the problem limits. The objective function of the problem is defined as the total damage to the consumer at the time interval (T).

The amount of consumer damage in the river at any given time depends on the amount of contaminated water taken by the downstream consumer at any given moment and the degree of it contamination. This equation is given by Eq. 5.

$$f_{t} \propto C_{i,t} W_{A,t}$$
(5)

Therefore, the objective function (F) is the summation of calculated consumer damages and is obtained by contamination from different point sources and consumer consumption at the specified time period. Equation 6 shows the objective function of the research.

$$F = \sum\limits_{t = 1}^{T} {\sum\limits_{i = 1}^{n} {C_{i,t} W_{A,t} } }$$
(6)

where (Ci,t) is the concentration of contamination caused by the source of pollution at the downstream consumer point at the time t. (\(W_{A,t}\)) is the water consumption at the downstream consumer point (A).

To properly solve the problem of optimization, the following should be fully considered:

  • Constraint

  • Penalty function

Constraint

In constraint optimization problems, in addition to seeking to optimize the value of one or multi-objective functions, the proposed problem responses must satisfy a series of constraints. In this study, two types of constraints have been used:

  • Equal constraint

  • Unequal constraint

Equal constraint

All pollutants from point sources must enter the river. Therefore, the mass of input pollution by point sources at the time interval (T) is an equal constraint of the problem (see Eq. 7).

$$\sum\limits_{i = 1}^{n} {\sum\limits_{t = 1}^{T} {m_{i,t} } = M_{i} }$$
(7)

where (Mi (is the total amount of contamination of the source (i) that must enter the river at the time interval (T). Also, (mi,t) is the amount of entered contamination by (i)th source at time (t).

Unequal constraint

The mean unallowable contamination at the time interval (T) along the length of the river is the Unequal constraint of the problem. (Bt) is the limit value for the unallowable contamination across the length of the river. The unequal constraint is presented by Eq. 8.

$$\sum\limits_{i = 1}^{n} {C_{i,t} \le B_{t} }$$
(8)

Penalty function

There are several methods for constraint optimization problems, one of which is using penalty function. This method is the most popular technique in optimization. In this way, the possibility of violating the constraints of the problem is given to the proposed responses, but each response, depending on its degree of violation, must pay its fines. This penalty is implemented in the form of worsening the response quality by manipulating the value of the objective function. For example, in minimization problems, the penalty function increases the amount of target function and worsens the response. There are several methods for defining the penalty function, but a series of general principles should be considered in designing this fine mechanism (Shojaeefard et al. 2012).

In this research, the penalty function (P) is proportional to the violation of unallowable contamination in the river and the full entry of the pollution into the river is defined as Eq. 9. In this case, α and β are the penalty coefficients of the problem that will be set as needed in order to penalize the objective function in case of violation of the problem constraints. In order to impose penalty on the problem, the penalty function is multiplied by the objective function of the problem. Depending on the effect of the penalty function on solving the optimization problem, the multiplication can be replaced with total summation or the penalty coefficients can be changed.

$$P = \alpha \cdot \left( {\sum\limits_{t = 1}^{T} {\sum\limits_{i = 1}^{n} {C_{i,t} } } - B_{t} } \right) + \beta \cdot \left( {\sum\limits_{t = 1}^{T} {\sum\limits_{i = 1}^{n} {\left| {\left. {m_{i,t} - M_{i} } \right|} \right.} } } \right)$$
(9)

Case study

Gheshlagh River is one of the most important rivers in western Iran, located in Kurdistan province. Gheshlagh is the main river of the Sirvan catchment area and plays an important role in supplying water demands of the region and the province. Since 2000, the Iranian Department of Environment (DoE) and the Iranian Ministry of Energy have paid special attention to pollution control in the Gheshlagh River basin (Saadatpour et al. 2019). In Fig. 1, the position of the catchment area of the Gheshlagh River is shown.

Fig. 1
figure 1

The position of the catchment area of the Gheshlagh River (Asheghmoala et al. 2014)

Due to the passage of the river from the proximity of Sanandaj, it is exposed to various sources of contaminants along its path after the Vahdat dam to the confluence with the Gavehroud River. As a result, river water quality has fallen sharply. In Fig. 2, the elevation and longitudinal position of the Gheshlagh River, point sources and monitoring stations are indicated (Saadatpour et al. 2019).

Fig. 2
figure 2

Geometric location of pollutant sources and monitoring stations along the Gheshlagh River

River flow fluctuates during different seasons. The sharp decrease of river water, especially in hot months of the year, is due to the shortage of precipitations, the cessation of snow storms and the high water withdrawal along the river, causing the river pollution to increase, and the river’s self-purification capacity is sharply reduced. Contamination sources can pollute the rivers by direct discharge of sewage, wastewater and solid waste. The most important of these pollutants are urban pollution sources, sewage generated from domestic, commercial and municipal runoffs. In Gheshlagh River, urban pollution includes Sanandaj urban sewage as well as sewage of villages and settlements that are on the path of the Gheshlagh or its branches that cause pollution. Industrial pollutants include industrial wastewater located at the margin of the river and wastewater from the sewage network of industrial towns of Sanandaj, No. 1 and 3, and Brazan, which flows directly into the river.

Also, sewage from workshops and industries in cities and residential areas can also be added. Geometric data, hydrology and quality data of Gheshlagh River are collected in summer and used in qualitative modeling. After studying and determining the slope of the channel floor, the width of the floor, the slope of the walls and the roughness coefficient of different sections, the river is converted to 9 sections and is implemented in the modeling, as summarized in Table 1. In Table 2, point sources of pollution are shown along the Gheshlagh River (Khoshkam et al. 2017).

Table 1 Hydraulic properties of the Gheshlagh River range (Asheghmoala et al. 2014)
Table 2 Point pollutant sources along the Gheshlagh River (Khoshkam et al. 2017)

Model formulation and optimization method

The simulation of flow, advection and dispersion of pollution in the river has been studied by numerous researchers using numerical and analytical methods (Arnold et al. 1990; Singh et al. 2012; Kumar et al. 2009; Yadav et al. 2010). In this research, simulation of the advection and dispersion of the pollution in the river was carried out using MATLAB software with an analytical solution based on Eq. 2. Then, contamination values were obtained in different parts of the river. In the following, the optimization problem presented in the study is investigated and implemented in order to control and manage the pollution with consideration of its constraints. The main objective of this research is to provide a comprehensive program that determines the time distribution and location of inputs to the river in order to minimize damage to the consumer, depending on the circumstances of the problem. In the following, the optimization problem defined by the PSO algorithm is solved in MATLAB software, and the time schedule and spatial planning for entering the pollution are presented and then analyzed.

The steps in the PSO algorithm in this study are as follows: In the first stage, the primary population is created and initial setting of the velocity and location vectors of each particle is done. (At initial setting, the particle velocity is a zero vector and location is a random one.) In the next step, the value of each particle is evaluated. Then, the best personal and social status of each particle is updated. After that, the particle speed is updated using Eq. 10 (Eberhart et al. 2001).

$$v_{i} (k + 1) = \omega \times v_{i} (k) + c_{1} \times r_{1} \times ({\text{pbest}}_{i} - x_{i} (k)) + c_{2} \times r_{2} \times ({\text{gbest}} - x_{i} (k))$$
(10)

Also, the position of each particle in the algorithm is updated using Eq. 11 (Eberhart et al. 2001).

$$x_{i} (k + 1) = x_{i} (k) + v_{i} (k + 1)$$
(11)

in which k determines the step number, vi, velocity of each particle in each dimension, w, inertia weight, i, particle, c1, c2, constants, r1, r2, random numbers, pbest, best position of each particle, gbest, best position of swarm, and xi, current position of each particle in each dimension.

Providing an optimal and practical scheduling and for entering the pollution is the main objective of the research, which shows the distribution of the contamination entry to the Gheshlagh River at different hours of the day.

In Fig. 3, flowchart model is provided. According to this flowchart, after definition of PSO parameters, random values of solutions (locations and schedule of factory pollution discharge) are produced in the ranges of the allowable variables. Then, value of objective function (the consumer damage) and equal and unequal constraints (masses of input pollutions and mean unallowable contamination along the length of the river) are calculated for each random solution. Afterward, the penalty functions are computed for each solution (particle) and pbest and gbest are updated. Finally, new solutions are generated by Eqs. (10) and (11). These steps are repeated until some stopping condition is met.

Fig. 3
figure 3

Flowchart of the proposed model

Results and discussion

Table 1 is used to determine the timetable of the entry for contamination sources into the river from pollutant point sources (8 sources), so that the damage is minimized for downstream consumer, where the distance between point sources of pollutant from the downstream (xi) and the pollution entered from each of the point sources are specified. In order to find the best location for the contamination entering to the river in order to minimize damage to the consumer, (xi) is selected as the problem variable and the best values for the entry point from these eight sources are obtained. An analytical solution method is used to study the advection and dispersion of pollutant point sources at different time and locations of the Gheshlagh River. The constraints are defined with respect to the objective function and the given initial information. The optimization problems for two dominant different scenarios were solved by the PSO algorithm in MATLAB software. Then, a timetable for contamination entry and locations of them to the Gheshlagh River are presented.

The population size and maximum number of iterations for PSO algorithm were set to 200 and 500, respectively. The PSO algorithm was independently executed 10 times for each scenario. Inertia weight was selected by the final value of 0.9. The effects of different values of other parameters of PSO algorithm (C1 and C2) on the objective function for the first scenario are presented in Table 3. Usually in the PSO algorithm, the summation of the parameters C1 (cognitive coefficient) and C2 (social component coefficients) must be less than or equal to 4.

Table 3 The effect of C1 and C2 values on the value of the objective function

As shown in Table 3, the value of 2 for both parameters C1 and C2 has the best performance for the objective function, which is equal to 48.45. Also, these values of C1 and C2 are used for the second scenario. The obtained results for two considered scenarios are presented as follows.

First scenario implementation

In the first scenario, the water consumption in the downstream of the Gheshlagh River by the consumer is zero in some hours (early and late hours). Therefore, water consumption is not carried out continuously throughout the day. In Table 4, water consumption by the downstream consumer of the Gheshlagh River is presented at daily hours under the first scenario.

Table 4 Water consumption by the downstream consumer of the Gheshlagh River is presented at day hours under the first scenario

Time schedule for river pollution under the first scenario

In this scenario, the allocation of pollution load from eight polluting point sources with the goal of minimizing damages to the downstream consumer, taking into account the amount of consumption at night (for some hours equal to zero), and the total contamination from these eight sources were carried out throughout the day.

Due to the fact that the scheduling of contamination entry is for 24 h, there are 8 × 24 decision variables for scheduling that correspond to the amount of contamination entry from eight pollution point sources at different hours of a 24-h period. These variables are obtained by the PSO algorithm.

In Fig. 4, the mass of pollution enters to the river uniformly (without river quality management planning) and the optimal values obtained from the pollution load under the first scenario at various hours of the day are given from eight-point sources of contamination in the Gheshlagh River, separated by source of pollution.

Fig. 4
figure 4

Mass pollution entrance from source pollution in the first scenario. a Nanleh wastewater. b Industrial park. c Sanandaj livestock slaughter. d Fajr concrete foundation. e Treatment plant outflow. f Asphalt and grain recycling and production. g Creek landfill leachate. h Poultry slaughter

As shown in Fig. 4, the highest and lowest optimized amounts of mass contamination from all the sources are demonstrated in this figure. As shown in Fig. 4, the highest optimized amount of mass contamination is from source A at 3 and 21, source B at 7 and 12 h, source C at 9 and 23, source D at 7 and 9 h, source E at 22 and 23 h, source F for 14 and 21 h, source G at 2 and 12 h and source H at 5 and 13. The exact optimized obtained values from these sources are given in Table 5.

Table 5 Optimum entry of river pollution under the first scenario

As shown in Table 5, the lowest and highest amounts of mass contamination from 8 pollutants are in 4–5 and 22–23 h period, respectively, with the amount of 302.42 and 1863.3 kg. Due to the model, from all sources of pollutants in some hours, the amount of pollution mass entering the river was zero. In this scenario, among 192 decisions variable [the timetable of pollution sources (8 × 24)], 22 number of them equals to zero.

The location of the river pollution entry under the first scenario

The location of the contamination resources in the Gheshlagh River is shown in Table 2. After implementation of this model, an appropriate place for entering contamination is obtained from these resources under the first scenario. Table 6 shows the optimal distance of pollution entrance.

Table 6 Optimum distances obtained for pollution entry of contaminated sources under the first scenario

In the first scenario, the location of resources No. 1, 7 and 8 has the greatest impact on the objective function of the research, because the optimal values obtained for the location of pollutant resources are the longest distances from the main location of pollution resources in the Gheshlagh River. These distances for resources 1, 7 and 8 are 3.8, 2.5 and 1.33 km, respectively. For other resources, this distance is less. So they can be considered.

Second scenario implementation

In the second scenario, water harvesting on the downstream of the Gheshlagh River is performed by the consumer at all hours of the day, and water consumption is not zero at any time of day. Table 7 shows harvesting water by the downstream user of the Gheshlagh River at different hours of the day, under the second scenario.

Table 7 Water consumption by the downstream consumer of the Gheshlagh is presented under the second scenario

Time schedule for river pollution under the second scenario

In the second scenario, while allocation of pollution load from eight points of pollutant sources is quite similar to the first scenario, the difference is that downstream consumption is according to Table 7 at all hours of the day. Also the parameters of the optimization algorithm are similar to the first scenario.

In Fig. 5, the mass of pollution enters to the river uniformly and the optimal obtained values from the entering pollution load under the second scenario at different hours are given from eight-point pollution source in the Gheshlagh River. After executing the program in the second scenario, the decision variable, which is the same hourly entering mass contamination from any of the point sources, is obtained for the Gheshlagh River.

Fig. 5
figure 5

Mass pollution entrance from source pollution in the second scenario. a Nanleh wastewater. b Industrial park. c Sanandaj livestock slaughter. d Fajr concrete foundation. e Treatment plant outflow. f Asphalt and grain recycling and production. g Creek landfill leachate. h Poultry slaughter

As shown in Fig. 5, the highest optimized mass contamination from source A is at 3–4 and 1–2 h period. For the rest of contamination sources, the highest and lowest amount of pollution is determined in Fig. 4. The exact optimum values obtained from these sources are given in Table 8.

Table 8 Optimum entering mass contamination under the second scenario

As shown in Table 8, the lowest totals entering mass contaminations from 8 pollutant sources at 11–12 and 0–1 h period are 450.59 kg and 507.38 kg, respectively. Also, the highest total entering mass contamination from 8 pollutants at 19–20 and 9–10 h period was, respectively, 1546.09 kg and 1282.5 kg. In addition, from all pollution sources during a whole day, the amount of entering mass contamination is zero. For the second scenario, 17 of the decision variable were zero. The reason for the more distribution of pollution in comparison with the first scenario is the continuous water consumption in this scenario by downstream consumers.

The location of the river pollution entry under the second scenario

The location of the contamination resources in the Gheshlagh River is shown in Table 2. After implementation of this model, an appropriate place for entering contamination from these resources under the second scenario is obtained to the Gheshlagh River, as shown in Table 9.

Table 9 Optimum distances obtained for pollution entry of contaminated sources under the second scenario

In the second scenario, there are more differences between the optimized values for pollution entry location and the main location of contamination resources. The maximum distance from source 1 is 3.8 km and source 2 is 1.8 km. In other sources, this distance is less.

The value of objective function for the first scenario in the optimal condition is obtained around 48 kg; however in the condition that the contamination enters to the river uniformly (without river quality management planning), this value is equal to 3513 kg. In the second scenarios, these values are 84 kg and 3674 kg, respectively. The results show that quality management reduced significantly the consumer’s damage of downstream.

According to the results, the location of pollution entry influences on the pollution concentration at the consumer position, and the best location of pollution discharge could be found by optimization. Also if the contaminations were discharged uniformly, the amount of pollution concentration would be exceeded from allowable limits in certain times. Therefore, performing a program as the pollution discharging management is essential. Due to the complexity of pollution behavior modeling at downstream, performing a time management program would not be possible without optimization methods. Also according to Figs. 4 and 5, the timetable of contamination discharge is quite related to the consumption mod at the downstream and could not provide a contamination discharge program while ignoring the consumption mod.

Conclusion

In this research, river quality management is considered with the aim of reducing damage to the consumer. The essential tool for this purpose is providing an optimum timetable and spatial planning for the entrance of river pollution so that damage to the consumer is minimized. Also, all pollutants enter the river from eight source points and the pollutant concentration does not exceed the allowable limit. Two different water consumption scenarios with 8 pollution sources of Gheshlagh River are considered as a case study. Unlike the second scenario, in the first scenario, consumer water consumption was zero at some hours of the day. The optimal values of 200 decision variables (192 decision variables are corresponding to the mass of contamination entering at different hours of the day and 8 decision variables are corresponding to the location of contamination entering to the river) are obtained by PSO algorithm. The achieved results show that for each of two scenarios the concentration does not exceed the allowable limit for all period of time; however without river quality management planning, in some period of time the concentration exceeds the allowable limits. The obtained results also indicate that the values of consumption pollution at a day for the first scenario, with and without river quality management, are 48 kg and 3513 kg, respectively. These values for the second scenarios are 84 kg and 3674 kg, respectively. Hence, the river quality management decreases remarkably the consumer’s damage.