Modeling and Optimizing Wastewater Stabilization Ponds for Domestic Wastewater Treatment

In Wastewater Stabilization Ponds (WSPs), baffle walls (BWs) have the dual benefit of reducing area requirements and increasing contaminant removal efficiency up to a certain threshold. However, this advantage is mitigated by the increased demand for construction materials, highlighting the need for optimization. Effectively optimizing WSPs to suit diverse climatic regions can substantially alleviate nationwide wastewater treatment challenges. This study focuses on optimizing WSPs across seven distinct climatic regions in Turkey. In the initial phase, a comprehensive analysis was conducted using design spreadsheets for the WSPs to determine the best configuration based on traditional methodology (TM). The results demonstrated a significant decrease in WSPs area and hydraulic retention time (R T ), validating the effectiveness of BWs provision. However, this approach requires additional time and effort. Subsequently, mathematical modeling (MM) was used to further reduce the time required for the optimization process. Using the interior-point algorithm in MATLAB and the generalized reduced gradient (GRG) algorithm in MS Excel Solver, both algorithms within MM effectively decreased the WSPs area and R T by approximately 10%, while decreasing the required concrete volume by approximately 5% compared with TM. As other algorithms may yield better optimization, they can be investigated by developing specialized software for WSPs.


Introduction
Sustainable management of wastewater is of great importance in today's world with limited water resources, such as in Turkey.This concern is not only crucial for safeguarding the welfare of the population but also helps in maintaining fragile ecosystems [1].Turkey's agricultural sector is a significant user of water resources (73% of the total water budget), thus exerting considerable strain on the country's freshwater supply [2].Consequently, the implementation of effective and economical wastewater treatment is imperative [3].Recycling and utilizing treated wastewater for irrigation have the dual purpose of mitigating water scarcity and fostering agricultural sustainability by providing a reliable and economical water source [4].Turkey faces severe hurdles in updating its wastewater treatment infrastructure owing to a shortage of financial and human resources, and it requires innovative solutions [5].Recent studies have shown that only approximately half of Turkey's wastewater is treated, and the rest is dumped into the environment, threatening aquatic life and ecosystems [6].Turkey should strengthen its wastewater treatment infrastructure to address these issues, especially in rural and peri-urban areas [7].The selection of wastewater treatment systems involves several factors [8].The best system provides high effluent quality and has the lowest implementation, operation, and maintenance costs [9].The Turkish government should encourage natural wastewater treatment methods because they are environmentally friendly and economically viable.This study provides a reliable and economical water source for agriculture by treating domestic wastewater using wastewater stabilization ponds (WSPs) to meet the Turkish class B irrigation standards [2].
In Turkey, numerous aspects of life are affected by climate [10,11].The climate in northern Turkey is mild and rainy, whereas that in the south is hot and dry [12].The country has seven climatic regions that influence natural wastewater treatment processes [13].Wastewater treatment through WSPs is the world's most economical and natural method to treat wastewater [14,15].The design area of the WSPs system is also affected by various climates and is inversely related to temperature [16].Depending on the situation, WSPs treat municipal and industrial wastewater before dumping or sending it to the subsequent treatment stage [17,18].The removal efficacy of WSPs is influenced by climatic conditions, making them most suitable for tropical areas because of their natural composition and reliance on solar energy [19].The only problem with employing WSPs is the enormous area requirement compared to other systems [2,6].Therefore, it is better to establish them in areas that are undeveloped and far from the population for sustainable development [19].WSPs employ baffle walls (BWs) to improve removal efficiency, reduce land requirements, increase hydraulic retention time (RT) and surface area, improve mixing and settling, and remove nutrients [2,6,9,19].BWs reduce landscape requirements, ultimately decreasing the overall demand for construction materials [2,6].Conversely, this benefit is reduced by the enhanced demand for construction materials for BWs, highlighting the necessity for optimization.WSPs are constructed with one or a combination of materials such as concrete, geomembranes, gravel, sand, plastic, and steel [20].There are various flow conditions in WSPs: complete mixing, dispersion, and plug flow.The BWs change the flow conditions of the WSPs from a complete mix to plug flow [21].There are various types of WSPs: aerobic, anaerobic (APs), facultative (FPs), and aerobic maturation ponds (MPs) [22].Moreover, they have different treatment and design characteristics [23].High-quality effluents can be obtained by providing them in series or parallel [24].Wastewater should be transferred from an anaerobic pond to a facultative pond and then to an aerobic maturation pond for optimal treatment [25].Initially, in this study, the best combination of WSPs was selected using traditional methodology (TM), and subsequently, NBWs were optimized for various climatic regions.In this study, mathematical modeling and optimization of WSPs were performed to resolve the problem mentioned above.
Mathematical modeling (MM) can forecast and improve the WSPs performance for various climatic regions [2,6,25].Turkey's wastewater treatment systems are only numerically modeled [27][28][29].Nevertheless, global optimization algorithms, such as the generalized reduced gradient (GRG) and the interior point, have never been employed to model WSPs in various climatic regions of any country [28,29].This study fills this gap by optimizing the WSPs for all climatic regions of Turkey.If the mathematical model is well written, MATLAB and Excel Solver optimization tools have built-in options for employing the algorithms mentioned above [30].They are used increasingly to optimize wastewater treatment systems, including WSPs [6,19,31].These technologies solve complex optimization issues more efficiently than manual techniques [6,32].In another study found in the literature, the authors divided the whole country into 4 regions based on coordinates, did empirical modeling, and used different software [32].However, in this study, Turkey was divided into 7 regions based on the climate.Researchers in Turkey have yet to pay attention to this most economical wastewater treatment method and have only discussed the theoretical aspect [33].Therefore, the mathematical modeling and optimization of WSPs for various climate regions is a much-needed study for Turkey and other countries with similar geographical characteristics and climatic conditions.This study initially assessed the effectiveness of WSPs in various climates across Turkey using TM and various numbers (NBWs) and lengths of baffle walls (LBWs).Subsequently, the mathematical model was created to improve efficiency.The objectives were as follows: (1) to analyze WSPs using traditional methodology (TM); (2) to create a mathematical model for WSPs and optimize their performance in diverse Turkish climates using GRG and interior-point algorithms; (3) to compare the results of (TM) and modeling approaches; and (4) to conduct a sensitivity analysis of the optimization model.The results of this study would be valuable in deciding and designing the best wastewater treatment option for engineers, researchers, and policymakers involved in wastewater treatment worldwide, especially in Turkey.

Materials and Methods
In this study, three configurations were considered for the analysis (see Figure 1).Configuration 1 consisted of anaerobic ponds (APs), facultative ponds (FPs), and maturation ponds (MPs) in series, whereas Configuration 2 was similar to Configuration 1, but without APs.However, configuration 3 only had FPs.These configurations were analyzed to select the most suitable configuration, providing the minimum area and RT.Facundo's (2012) approach was applied to the basic design of FPs and MPs based on the climatic conditions of each geographical region of Turkey [6,19].However, Marais's method was used to design an anaerobic pond [6].Turkish Class B standards were observed for the intended use of treated wastewater for irrigation [6,19,34].RT values were also obtained from the Turkish standards for WSPs [19].The average temperature and evaporation values during the coldest months in all climatic regions were obtained from the Meteorological Department in Trabzon.The values for all regions mentioned above are shown in Figure 2. The influent from domestic sources contains approximately 10,000,000 MNP/100 mL of fecal coliforms and a BODi = 220 mg/L [6].The other design data was as follows: a constant population of 1200 people and varied wastewater generation rates were used for each community.Four of the seven regions of Turkey, namely the Black Sea, Mediterranean, Eastern Anatolia, and Southeastern Anatolia, had a rate equivalent to 179 LPCD.In contrast, this rate was 151, 166, and 191 in Marmara, the Aegean, and Central Anatolia, respectively.

Figure 1. Combinations of WSPs analyzed Figure 2. Geographical regions of Turkey with their design input data for WSPs
The optimization model was based on the minimum concrete volume required to construct FPs provided within configuration 1.The software determined the optimal values of the variables mentioned above, which yielded the minimum volume of concrete after optimization.The author, recently published an article mentioning the development procedure for a basic mathematical model (see Equation 1).The model was applied to a village using MS Excel Solver, considering the GRG algorithm [19].The author has published another article on developing the mathematical model for two ponds in series: FPs and MPs provided in configuration 1 [6].
where   is Inflow (m 3 /day),   is depth of the pond,  is thickness of concrete slab and walls.
In this study, Turkey's seven different climatic regions (see Figure 2) were analyzed with the help of the GRG and the interior-point algorithms.The constraints for the model are mentioned below in the mathematical model.It is essential to note that there was no need to write separate constraint equations to optimize using MS Excel Solver because these are already in the design spreadsheet.However, to apply the optimization algorithm in MATLAB, it was necessary to write both, the model and constraint equations, (see Equations 2 to 8).The performance of the mathematical optimization model was compared with that of the original system designed by using the TM approach.Figure 3 presents a flowchart of the design, analysis, and optimization of WSPs using TM and MM.X = 3 ×   × (  + 1) 2  (2) (3)

Mathematical Model and Constraints Using MATLAB
In addition, a sensitivity analysis performed to evaluate the optimized system's sensitivity to changes in design and operational parameters.The sensitivity analysis helped identify the critical parameters that affect the system's performance.

The Outcome of the TM Approach
The primary analysis of this research showed an increase in   &   that reduces the required area and RT.The effect of   observed between 50% to 90% of the pond length and NBWs from 0-10.There is a lesser reduction in area, volume of concrete and RT while increasing the   .Moreover, during the increase in pollution load, it is observed that pollution must remain within certain limits to meet the Turkish effluent and WSPs design standards.The authors have recently published a detailed research article on the effect of BWs on various pollution loads [9].It was also observed that higher temperatures and   result in a lesser area and lesser RT of WSPs.In contrast, lower temperatures and   result in a smaller area and greater RT of WSPs.Therefore, temperature and   must be considered while designing WSPs to ensure efficiency.Non-compliance with Turkish design standards for WSPs in eastern and central regions has rendered mathematical modeling ineffective for optimizing WSPs.It emphasizes the significance of adhering to design standards when developing WSPs to ensure their efficacy.As mentioned in the Materials and Methods section, three different configurations were analyzed to determine the most suitable configuration for all geographical regions of Turkey.After analysis, Configuration 1 was found to be the best for all climatic regions of Turkey [2].The major effect of variation in   &  s was observed in FPs.This process is lengthy and timeconsuming but highlights the need for mathematical modeling.The authors recently published a detailed research article on the design of WSPs for various climatic regions in Turkey using the TM approach [2].

The Outcome of the MM Approach
Table 1 compares the outcome of the TM and MM approaches.The latter approach involves two different algorithms to compare the variations in components such as RT, NBWs, LBWs, area of WSPs, and volume of concrete.It is crucial to note that the optimization of all three variables was accomplished via a nonlinear programing technique while ensuring compliance with the given restrictions.The reduction and percentage values for RT, area of WSPs, and volume of concrete are also calculated for each component, except for the NBWs and LBWs.This is because both NBWs and LBWs increased from 4-7 and 50%-90%, respectively.The use of 4 BWs in TM has clearly resulted in the fulfillment of permissible thresholds for both fecal coliforms (Nf/No) and organic matter (BOD5).The mathematical modeling approach utilizing the GRG and interior-point algorithms yielded comparable values for the components across all the regions.Based on the established criteria, the numerical value of   expressed in decimal.Consequently, the   were rounded up to the nearest whole number, yielding a final value equal to 7 in five out of seven regions.As shown in Table 1, another variable of interest, namely RT, exhibited a decrease of days from 4.4 to 7, it corresponds to a reduction of 10-12.5 percent in the five regions.The functional plot value of five out of the seven regions using the interior-point algorithm is shown in Figure 4.However, the non-compliance of WSPs in Eastern and Central Anatolia with Turkish design standards made it impossible to optimize these regions using mathematical modeling.Lastly,  s remains unchanged in three out of the five regions that were optimized.In the remaining two regions, the length increased from 0.5 to 0.6.Following this, the remaining design of WSPs was performed by incorporating the optimized values of the variables mentioned above by using traditional methods.The increase in NBWs and LBWs has a substantial effect on the area required for WSPs and, as a result, the quantity of concrete goes down [2,6,18].In the optimized design, a reduction of 625-800 m² was achieved, representing a 10-12.5 percent decrease in area.The significant advantage of reducing land area is noteworthy, particularly while considering the fundamental disadvantage of pond system that requires enormous land.The optimized FPs resulted in a tangible reduction of concrete volume from 3.78-7.73percent, which is comparable to 46.85 cubic meters with the TM.It is worth mentioning that the iterative nature is commonly associated with TM approaches; the interior-point algorithm was employed to ascertain the ideal values for RT,   &  s .Attaining such a high degree of accuracy via the TM, which entails the incorporation of numerous independent variables that would pose significant challenges of complicated nature [2].
In MS Excel solver, it is noticeable that the suggested values for the constraints RT,   &  s were chosen at a higher number compared to the initial determination made by the TM.This action was undertaken to fulfill the system's requirements to establish the maximum thresholds for its functionality.Hence, it recommends for substantially elevated thresholds to enable the system to ascertain the genuine optimal values, while simultaneously adhering to the limitations of the design standards of WSPs.With respect to the dimensions of the BWs, the system determined an optimal length of 0.5 times the total length of the pond in all the regions.The augmentation of the RT leads to an expansion in the dimensions of the ponds which leads to an increase in the volume of concrete.As shown in Table 1 using the GRG algorithm, the volume of concrete decreases after optimization from around 60-90 m 3 in all the regions, which corresponds to a reduction of about 5.7 to 8 percent.The decrease mentioned above has great importance, given the fact that the fundamental obstacle faced by the pond system is the considerable need for land.The solver of the programing system identified the utilization of 7   , which is a higher number compared to the initially chosen (4) using the TM approach.The implementation of this modification greatly improves the eradication of fecal coliforms.Incorporating BWs within a pond boosts hydraulic flow and facilitates the removal of contaminants.The findings presented in this study are consistent with the claims put forth by Qasim and Üçüncü [2,6,19].Moreover, with regard to the elimination of organic matter as measured by biochemical oxygen demand (BOD5), the levels attained in this investigation are significantly lower than the stipulated Turkish irrigation Class B standard thresholds (see Appendix I).Despite the implementation of the mathematical model leading to an increase in organic matter, it is important to note that this increase does not exceed the established regulatory limits (see Appendix I).As discussed above, by employing the MATLAB software, we ascertained that selecting 7 NBWs would yield the most optimal outcome.Numerous researchers have undertaken investigations on WSPs with diverse NBWs and have consistently arrived at the finding that the utilization of BWs augments pathogen eradication and boosts hydraulic flow dynamics inside the pond [2,6,9,19].This paper substantiates the findings derived from the investigations above.The results indicate that the concentration of fecal coliform is also significantly lower than the maximum contaminant limits established by the regulatory standards in Turkey (see Appendix I).To conclude, the results discussed above suggest that the MM methodology has potential advantages over the TM in terms of reduction in RT, area, and concrete usage.A comparison of the optimization outcomes generated by the two algorithms reveals that the interior-point algorithm achieves a marginally smaller reduction in the quantity of concrete and the area of the WSPs than the GRG algorithm.Considering the factors of safety and the above results, the interior point algorithm is a slightly better choice.Temperature and   substantially affect the area, volume of concrete, and RT of WSPs.To ensure the efficacy of WSPs, it is crucial to adhere to design standards when developing their plans, and optimizing WSPs results in improved treatment efficiency and reduced environmental impact.The implementation of optimized WSPs can lead to a significant reduction in the discharge of pollutants into receiving waters.The comparison between both software shows that MATLAB is superior for solving complex optimization problems and providing reliable results.In contrast, the Excel Solver was excellent at quickly solving simple optimization problems.It is essential to consider both the nature of the optimization problem and the available computational resources when deciding the software package to use.

Sensitivity Analysis
The significance of the sensitivity analysis carried out in this study lies in its ability to provide insight into the influence of different factors on the performance and efficiency of WSPs.Due to the nonlinearity exhibited by the objective function, it is imperative to analyze the impact of variations in key variables on the whole system.The forthcoming part presents the principal discoveries and results of the sensitivity analysis.One of the key findings derived from the sensitivity analysis is the significant impact of RT on the performance of WSPs.As the value of RT increases, the model exhibits a heightened sensitivity towards the factors at play, with a particular emphasis on the volume of concrete involved.This finding is consistent with empirical observations in the actual world, where an increase in the length of the RT is associated with a corresponding increase in the needed area and volume of concrete for the construction of WSPs [2,6,19].From a practical point of view, it can be judged that the effectiveness of design and planning of WSPs should take into account the desired RT in order to enhance the efficiency and maximum utilization of the resources.As the RT of the FPs increases, the concrete volume of the model also increases.Thus, the model matches reality because increasing the variables raises the WSPs area and concrete volume for construction.To test sensitivity, the major parameters were varied by 15% [19].
The most sensitive factors were identified using a tornado graph (Figures 5 to 7).The sensitivity analysis of the concrete volume is shown in Figure 5. WSPs inflow (Qi) is the greatest bar.The larger the Qi, the greater the design area of WSPs and the volume of concrete required.The second critical factor that determines the size of the WSPs system is RT.Moreover, the investigation also encompassed an examination of the NBWs and their respective lengths (LBWs) as variables of significance.The results of the study suggest that these parameters have a comparatively limited influence on the quantity of concrete needed.This implies that alterations in the NBWs and LBWs may have an insignificant impact on the concrete volume required for the construction of WSPs.Nevertheless, it is crucial to understand that these characteristics do have an impact on various elements of the performance of WSPs, including hydraulic efficiency and the dispersion of pollutants.A direct relationship was seen between increase in fecal coliform concentration and the reduction in removal efficiency.This observation underscores the importance of effectivity in controlling the quality of influent in order to achieve optimal treatment performance.Moreover, the study demonstrated that the Qi rate had a negligible impact on the elimination of fecal coliforms.While the function of this factor in the hydraulic performance of the system is significant, the research suggests that its effect on the removal of fecal coliforms is negligible.In Figure 6, fecal coliform removal is depicted as the lowest when the Tavg values are decreased.RT is the second most important parameter; the removal decreases in proportion to the decreasing value of RT.An increase in the concentration of fecal coliforms results in a reduction in the removal efficiency.  have a beneficial effect on the removal efficiency up to a specific limit, i.e., 8   .The significance of temperature (Tavg) in the elimination of fecal coliforms from pond effluent is shown by the sensitivity analysis.The drop in Tavg levels is associated with reduction in fecal coliform clearance efficiency.The discovery above highlights the significance of taking into account temperature variations while designing and operating WSPs.The importance of oxygen-generating capability of algae plays a pivotal role in biological treatment mechanism in WSPs, demonstrates its utmost efficiency within a certain temperature range spanning from 4 to 37 degrees Celsius [6,19].Beyond this specific range, the effectiveness of organic matter removal diminishes.Therefore, the implementation of temperature management within the optimal range can greatly enhance the overall efficacy of WSPs, particularly in regions characterized by substantial temperature variations.Moreover, the results indicate that the design of WSPs should include the ability to accommodate fluctuations in fecal coliform concentration and influent rates.Although some elements may not possess the same level of influence as others, they still play a key role in ensuring consistent treatment performance.Finally, Qi does not affect fecal coliform elimination.Effluent BOD Figure 7 shows that the influent BOD and Tavg are the most sensitive parameters for biological oxygen demand in pond effluent.Low temperatures increase the effluent organic matter concentration.The oxygen-producing activity of algae is efficient between 37 and 4 °C; however, the temperature range limits organic matter removal efficiency [6,19].In RT: the bar demonstrates that organic matter concentration shortens RT.The sensitivity analysis responded more to concept-specific factor modifications.The practical implications and design considerations of a particular subject are crucial aspects to be taken into account in academic research and development.These factors have significant implications for the real-world application and implementation of a given concept or design.By carefully considering the practical implications, the sensitivity analysis provides useful insight for the design and operation of WSPs in practical terms.The regulation of temperature, particularly within the ideal range for the activity of algae, has the potential to augment the elimination of fecal coliforms and organic waste.This phenomenon holds particular significance in geographical areas characterized by a wide range of climatic variables.Furthermore, this analysis highlights the significance of design standards and guidelines since going away from these standards may result in the ineffectiveness of mathematical modeling and optimization in non-specific areas.
To summarize, the sensitivity analysis presents a full comprehension of the variables that impact the performance of WSPs.By taking into account these research findings, researchers, engineers, and policymakers can make better decisions during the process of selecting the best wastewater treatment method for different regions of Turkey and around the world.

Conclusions
 An increase in the number of BWs decreases the area, retention time, and volume of concrete for WSPs than their length.The area of WSPs and volume of concrete were also lower in high-temperature regions.
 Sensitivity analysis of a mathematical model is an important part of knowing the behavior of the various parameters involved.
 Non-compliance with Turkish irrigation class B standards in East and Central Anatolia rendered mathematical modeling ineffective for optimizing the WSPs.
 WSPs and effluent standards adopted by Turkey differ from international standards.They are relatively loose in some parameters and very tight in others.Therefore, they should be revised based on the literature and experimentation.
 MATLAB is superior for solving complex optimization problems and providing reliable results.In contrast, the Excel Solver is quick at solving simple optimization problems.It is recommended to consider the factors mentioned above while selecting the software for optimization problems.
 Based on the findings derived from this investigation, future works are recommended in various directions for researchers in Turkey and other countries having similar geographical and climatic conditions: design of specialized software to perform analysis using the TM and MM approaches, applying other algorithms in the literature, analyzing other configurations of WSPs that are not included in this study, comparing results with realtime data, applying design processes given by other scientists in the field, use of other optimization software, 3D modeling, CFD modeling, etc.

Nf
The quantity of fecal coliforms presents in a given sample, measured in the most probable number (MPN) per 100 milliliters.

No
The numerical value of fecal coliform concentration is expressed in the most probable number (MPN) per 100 milliliters.

Figure 3 .
Figure 3. Flowchart for the design, analysis, and optimization of WSPs (Designed by the Authors)

a)Figure 4 .
Figure 4. MATLAB optimization function plot of five out of seven regions

Figure 5 .
Figure 5. Tornado graph for the volume of concrete