Modeling of wastewater treatment processes with hydrosludge

The pressure for Water Resource Recovery Facilities (WRRF) operators to efficiently treat wastewater is greater than ever because of the water crisis, produced by the climate change effects and more restrictive regulations. Technicians and researchers need to evaluate WRRF performance to ensure maximum efficiency. For this purpose, numerical techniques, such as CFD, have been widely applied to the wastewater sector to model biological reactors and secondary settling tanks with high spatial and temporal accuracy. However, limitations such as complexity and learning curve prevent extending CFD usage among wastewater modeling experts. This paper presents HydroSludge, a framework that provides a series of tools that simplify the implementation of the processes and workflows in a WRRF. This work leverages HydroSludge to preprocess existing data, aid the meshing process, and perform CFD simulations. Its intuitive interface proves itself as an effective tool to increase the efficiency of wastewater treatment.


| INTRODUCTION
In recent years, initiatives related to the protection of natural resources such as water have undergone significant growth worldwide. When it comes to water, the quality of the effluent to be discharged by Water Resource Recovery Facilities (WRRF) is becoming more and more restrictive. It is necessary to maintain the pace of improvement and efficiency of the different processes in WRRF. Notably, biological treatment is one of the most critical tasks in a WRRF (Grady et al. 2011). The biological treatment involves biological reactors and the Secondary Settling Tanks (SST). For this reason, it can represent around 50% of the whole plant's total energy consumption, depending on the configuration and the aeration system used (Ovezea, 2009).
Mathematical modeling and numerical simulation have become essential for most of the physical and biochemical processes in WRRFs. These techniques are adopted as great potential tools during the design, operation, optimization, and process control of a WRRF (Makinia, 2010). The main reason for using models and simulations is to enhance efficiency and save costs on resources exploring the dynamic behavior of the process units under different conditions. Software platforms such as Biowin, GPS-X, WEST, Simba, or SUMO implement different numerical methods and are well accepted in the water sector because they are relatively simple to manage and provide global results quickly. However, their hydrodynamics modeling approach does not account for hydraulic phenomena in real performance: geometry of the tanks, internal elements, gradient of the state variables, and the spatial distribution inside the tanks. Furthermore, they cannot detect mixing problems such as short-circuiting, dead volumes, or stratification/ inhomogeneity, which commonly occur in real tanks and play a vital role in the pollutant removal efficiency (Samstag et al. 2016).
Computational Fluid Dynamics (CFD) represents the most sophisticated mechanism of simulation able to reproduce in detail the fluid behavior and to analyze specific hydraulic troubleshooting in 3D. Concretely, many of the most essential characteristics in wastewater treatment modeling can be included in a CFD, for instance, multi-phase flow, biokinetics, and submodels such as aeration, sedimentation, or non-Newtonian fluids. Despite the notable increase in scientific production related to CFD modeling since its adoption into wastewater treatment (Glover et al. 2006), the main bottleneck to widespread the use of the CFD in this field is the learning curve and the cost of the commercial software license. To address these issues, we have designed, developed, and evaluated a software named HydroSludge. Notice that users should still be aware of which fluid model they need for their simulation.
HydroSludge stems from the necessity of providing a specific simulation software for WRRF management. For this purpose, HydroSludge is presented as an easy-to-use framework for the water sector. With HydroSludge, authors aim to extend the use of CFD technologies among water treatment professionals by reducing the operation's complexity. HydroSludge provides holistic tools for the CFD workflow (data pre-processing, geometry, meshing, solver, and post-processing). Besides, it is designed to leverage parallelism and provide higher performance by leveraging all the underlying resources available on the host computer.
The rest of the paper is structured as follows: Section 2 introduces and describes the methods implemented in HydroSludge. Section 3 provides software details and outlines the modules that compose HydroSludge. Section 4, presents a series of use cases to test and evaluate the platform. Finally, Section 5 contains the conclusions of this research and development.

| METHODS
In this section, the most relevant methods provided by HydroSludge are introduced and detailed. The section is split into two parts. On the one hand, the tools for filtering and checking the input data are described in Section 2.1. On the other hand, the means for building a mesh and performing simulations are detailed in Section 2.2.

| Preliminary study
To provide appropriate input to a CFD simulation, the collected data must follow quality standards. In this regard, HydroSludge facilitates the filtering and checking operations for the input data.

| Filtering
This operation is composed of three independent stages: • Settling The drift flux model (Brennan, 2001) is one of the most popular among SST-CFD studies in the literature. It is commonly used to calculate the two-phase mixture of the mixed liquor. For this reason, HydroSludge provides a tool to calculate the activated sludge solids settling velocity through the experimental batch settlings data. In order to reproduce the settling velocity for clarifiers and fit the constant terms automatically, HydroSludge includes the model of Vesilind (1968)  Dapelo & Bridgeman, 2018), to provide to the user a straightforward mechanism to check the dimensions of the SST and its components, such as scraper or input well. • State Point and Ten Layers Models: One-dimensional models are still useful techniques for a preliminary evaluation (Ekama et al. 1997). Concretely, users can check the SST performance according to 1D models. Accordingly, if the SST working conditions failed at these models, the user may check these conditions before proceeding to the CFD model development.
HydroSludge implements the two most widespread models to reproduce the SST performance. On the one hand, the State Point Model allows the global performance of the operation to be calculated through a mass balance: the mass of solids entering and exiting the tank considering the external recycling rate (Ekama et al. 1997). From this, the optimum design return activated sludge recycle rate, at which SST is in a critically loaded condition corresponding to a stable steady state sludge blanket level, and control strategy are most accurately determined. On the other hand, the Ten Layers Model (Kynch, 1952) shows the distribution of the total suspended solids inside the SST. It allows the sludge blanket height and total suspended solids distribution to be calculated under specific settling velocity conditions.

| Simulation
This section details the differentiating features of HydroSludge for assisting the user in developing a WRRF CFD model with minimum effort.

| Submersible mixers
Submersible mixers, flow boosters, or impellers are a type of equipment commonly found in WRRFs. They enhance mixing, prevent the formation of dead volumes, or just direct the flow in a specific direction. HydroSludge permits to include impellers in the CFD simulations by using the so-called equivalent momentum source . In this approach, the complex impeller geometry is substituted by a cylindrical region that applies a momentum source that mimics the hydrodynamic effects of impellers at a reduced computational cost. Note that including the full impeller geometry would result in a huge increase in the number of nodes to resolve the complex geometry of the blades and their corresponding boundary layers. Furthermore, the rotation of the blades requires highly demanding computational techniques such as deformable meshing or the frozen rotor approach. First, the volumetric momentum source term, S m , is introduced into the RANS equations via the swak4Foam library, being M p the volumetric momentum modulus andû C,i the director vector components in Cartesian coordinates (i = x, y, z) for the impeller axis. The modulus for the volumetric momentum source is given by where D b is the actual diameter of the blades, ρ the fluid density, and V M the volume of the source region. The propelled flow rate, q, can be calculated as In this equation, F o represents the thrust force for the design rotational speed ω o of the propeller. These two parameters are usually included in the technical specifications supplied by propeller manufacturers. In some applications, the actual rotational speed, ω, differs from the design one, so the effective flow rate must be modified accordingly. Second, the application of this term is limited within a cylindrical region, the so-called source region, which surrounds the actual propeller. The axis of this cylindrical region is coincident with the actual propeller axis, its diameter equals the diameter of the blade, and its center is located at the rotation center for the blades. The length of the cylinder can be set at will, but it usually spans about one fifth of the blade diameter to permit an adequate meshing of this region. Figure 1 illustrates the basic geometry for the cylindrical propeller subvolume. The center of the cylinder is given by the coordinates vector r Þand its axis orientation by the unit vectorû C . The radius and axial length of the cylinder are represented by R and L, respectively. To check if a given point P, with coordinates r ! P ¼ x P ,y P , z P ð Þ , is included within the momentum source subvolume, one must verify the following two conditions: (a) The distance between the point and the cylinder axis, d Pu , must be smaller or equal than the radius. This distance can be calculated as (b) Point C and vectorû C define a plane, π C . The distance between this plane and the point P, d Pπ , must be smaller or equal than L/2, being

| Surface selection and meshing
HydroSludge provides a user interface to select and determine surfaces and boundaries from CAD geometries. The surfaces and boundaries are sets of faces that users directly define in the geometry. These objects are populated to the meshing tool and ultimately to the CFD simulation. These surfaces are automatically defined in the meshing process to proceed to their fitting and refinement. This geometry-to-mesh tool is one of the cornerstones of the HydroSludge effort to facilitate the work to F I G U R E 1 Coordinate system of the momentum source volumetric region its users. Once the surfaces and boundaries are named and configured, HydroSlduge divides the meshing into four stages: • Blocking: cube-shaped hexahedral mesh generation around the imported geometry. Hexahedral cells can be adjusted in size to achieve more or less mesh refinement. A finer mesh implies more accurate results but also a higher computation time in both meshing and simulation processes. • Sculpting: refinement of cells, vertices, and edges. This operation, employing an iterative process, divides the cells into hexahedrons. At this point, a first hexahedral approximation of the geometry is ready. • Snapping: projection of cells vertices on the surface of the geometry to removing areas with sharp edges. In other words, smoothing pronounced edges in the geometry.
• Layering: addition of extra layers for refining and improving the quality of the hexahedral mesh, especially on the outer faces of the geometry. HydroSludge adds a user-defined number of layers with an expansion ratio in the declared surfaces.
Finally, the OpenFOAM checkMesh tool is also included in HydroSludge, allowing users to know the quality of the meshes. This tool returns, as a result, the total number of cells, points, and hexahedrons of a mesh, as well as the quality of the mesh in terms of aspect ratio and skewness metrics.
pimpleFoam Large timestep transient solver for incompressible turbulent single-phase flow: This solver is based on the PIM-PLE algorithm which is a combination of pressure implicit split operator (PISO), used in transient problems, and semi-implicit method for pressure-linked equations (SIMPLE), used in steady-state simulations. These iterative algorithms solve equations for velocity and pressure.
driftFluxFoam Relative motion between two incompressible phases solver: This solver is mainly used in SSTs which have a continuous phase and a solid dispersed phase. Transient analysis can be performed, introducing a dynamic influent flow to calculate the evolution of the Sludge Blanket Height (SBH) and the Sludge Concentration Distribution (SCD) within the SST.

ASM1Foam
Biochemical behavior model after obtaining the hydrodynamic results: ASM1 (Henze et al. 1999) model is included in HydroSludge through an extension of OpenFOAM solver scalarTransportFoam. At this solver, the state variables are introduced as k scalars with the turbulent transport equation: being ϕ k the concentration of the k scalar, U the fluid velocity, D T the molecular diffusion coefficient divided by the fluid density, ν t the kinematic viscosity, Sch the Schmidt Number, and S k the source term for k state variable of the biological model.

| SOFTWARE FEATURES
This section thoroughly depicts the software design, library dependencies, and implementation details to tackle the previously presented methods. The section ends with a description of the usage modes provided by HydroSludge.

| Implementation
HydroSludge core is written in C++ and is empowered by the following widely used open source libraries with highly active communities 1,2,3 : • Qt widget toolkit 4 for the GUI (Graphical User Interface). • OpenCascade Technology (OCCT) software development platform 5 for 3D computer-aided design (CAD). • Visualization Toolkit (VTK) software system 6 for 3D computer graphics and visualization.
Furthermore, HydroSludge includes a virtualized subsystem that leverages Docker for executing OpenFoam operations. Docker uses an operating system (OS) level virtualization through packages named containers.
Within these containers, a user can deploy customized instances of an OS with the necessary dependencies. This container runs with complete independence and in isolation on the host OS. In this regard, HydroSludge installation binaries include a Docker image with the software packages required in order to provide the necessary tools to perform all the operations brought to the users by the GUI. Concretely, The container released with HydroSludge is based on Ubuntu 7 18.04 LTS and satisfies the dependencies for running the following software, also packed in the image: • OpenFoam 8 v19.06 • Swak4Foam 9 • MPICH 10 3.3.2 Summarizing, Figure 2 lists the libraries leveraged by HydroSludge and depicts the virtualized environment for running the simulations.
HydroSludge GUI modular design is represented in Figure 3.
In the figure, five modules can be appreciated. They are described in the following.

| Data analysis
This module implements two methods for processing the input data described in Section 2.1.
The first method, "outliers-removal," scans the input data selecting small subsets of n elements. The algorithm continues with the calculation of the mean and standard deviation for the subset data. Then, every element in the subset is compared to the subset mean and replaced by it if the element lies outside the 1.96 standard deviation range.
The second method, "moving-average," scans every element in the dataset and replaces it with the mean value of the n closest neighbors.
Leveraging VTK versatility, users are capable of preparing the data, configuring, and visualizing a series of charts included for this purpose. In this regard, HydroSludge makes use of the VTK filtering methods for reshaping and fitting the inflow. Likewise, it also provides adjustment mechanisms for calculating the rheological properties necessary for the afterward simulation. 7 https://ubuntu.com/containers 8 https://openfoam.com 9 https://openfoamwiki.net/index.php/Contrib/swak4Foam 10 https://www.mpich.org F I G U R E 2 Overview of third-party software integration in HydroSludge F I G U R E 3 HydroSludge modules and operations 3.1.2 | CAD HydroSludge explores an imported STEP-File 11 with the shape of the object to mesh. Leveraging OCCT, each face is identified and labeled in its center of mass. In this regard, a user is enabled to select faces and group them to determine areas. These areas are crucial to define boundary conditions in further steps. Furthermore, at this point, areas are devised as patch or wall depending on their role in the simulation. Surfaces are automatically meshed following the user's guidelines of areas and specifications.
The linking process between the geometry and the mesh is the creation of a series of .stl files corresponding to the surfaces and boundaries defined by the user. In this process, the initial mesh is built from the associated shapes of the geometry concerning their correctly triangulated parts. This operation is based on the OCCT method: RetrieveMesh. The .stl files provide OpenFOAM the flexibility of applying mesh refinement methods to a specific boundary. This underlying operation is crucial for a satisfactory and productive user experience. For this reason, HydroSludge acts as a black box where users are only responsible to determine the level of refinement in each surface via a series of input fields in the GUI.

| Mesh
CFD simulations rely on meshes. OpenFOAM provides tools for defining and refining a mesh, which is a sequential process that HydroSludge handles. For this purpose, a critical aspect is that OpenFOAM needs to load the geometry in a supported format, such as STL, 12 which describe an unstructured triangulated surface by unit normal and vertices in a 3D Cartesian system. For this reason, the HydroSludge meshing process internally includes the tailoring of STL files ready for OpenFOAM. As previously introduced (see Section 2.2), OpenFOAM meshing involves a series of iterative steps so that HydroSludge provides an interface divided into four stages: (i) blocking, (ii) sculpting, (iii) snapping, and (iv) layering.
HydroSludge, in the first stage, leverages the OpenFOAM command blockMesh in order to perform the blocking. This command reads the configuration from the dictionary file blockMeshDict. In this operation, OpenFOAM registers surfaces' names and types previously defined by the user from the geometry faces.
Once the initial mesh has been generated with blockMesh, OpenFOAM provides the command snappyHexMesh in order to perform the remaining stages. snappyHexMesh reads the execution parameters from snappyHexMeshDict file, which depending on its configuration can process the sculpting, the snapping, or the layering. However, the user will remain agnostic to the OpenFOAM technical details.
The sequential nature of the meshing process allows the user to refine each stage or come back to a previous stage until reaching a satisfactory result. Finally, users can check the mesh quality by clicking a button that executes the OpenFOAM command checkMesh. During the whole process, HydroSludge leverages the VTK library to visualize the results in a viewer.
HydroSludge also provides an Advanced Control option to further fine-tune the meshing parameters. This feature enables the direct edition of the OpenFOAM configuration file. Advanced users, with high experience in modeling, may make the most of this option to increase the quality of the resultant mesh.

| CFD
Once the mesh is ready, the CFD module assists the user to configure the solver parameters (importing them from the data analysis stage, if needed). Furthermore, the boundaries defined in the geometry are presented accordingly to the selected solver characteristics. Depending on the solver or equipment included in the case, HydroSludge handles internally the necessary files (i.e., fvOptions, fvSchemes, fvSolution, and transportProperties). Finally, the rest of the control simulation parameters are also configured.
HydroSludge leverages OpenFOAM MPI multiprocess capabilities to accelerate the simulation in multicore environments. Concretely, HydroSludge decomposes the domain in a given number of processes (up to the number of CPUs assigned to Docker) and defines a processor topology by editing the OpenFOAM file decomposeParDict and running the command decomposePar. Notice that parallel executions are also available for the meshing process.

| Post-processing
A series of predefined operations are included for the post-processing stage. HydroSludge provides tools for defining planes, creating isovolumes, contouring surfaces, and plot probe lines through the object. This set of operations are based on VTK methods; besides, they have been tailored to the most common WRRF operator necessities and present a reduced configuration complexity.
Every single OpenFOAM utility (either launched with MPI or not) via the command docker run via the Windows PowerShell. HydroSludge enables real-time visualization of the simulation results using the VTK library. In this regard, HydroSludge reads on-the-fly the timesteps and provides a series of simplified tools for scientific visualization of structures. Notice that these features are also compatible with parallel execution. In this case, HydroSludge internally performs the reconstruction operation for each new solved timestep with the OpenFOAM command reconstructPar, completely transparent to the user.

| Usability
HydroSludge design principles arose from the need to provide useful and efficient management from a facility technician to the manager of the WRRF. In this regard, it is not mandatory to make comprehensive use of all the features provided by HydroSludge. Instead, HydroSludge allows flexible usage by providing different entry and output points. Figure 3, apart from the modules priorly described (blue boxes), also depicts HydroSludge input points (white files), data dependencies among modules (blue arrows), and intermediate or final results (gray arrows pointing to "Results").
Although HydroSludge is conceived as a single tool, its modular design allows it to use it as a toolbox of connected components. For this purpose, HydroSludge also includes independent procedures that lead to different types of results. Figure 3 depicts with primary-colored squares the three operations that can be independently performed.
1. Users are capable of conducting a preliminary study through the Data analysis module (yellow square). Left to right, Figure 3 shows this first module, which independently can obtain results, and it expects a series of .csv files with data of the flow and the settling performance. Particularly, this module provides tools for exploring the appropriateness of the characteristics of the SST physical design, the transient inflow data, the settling models, the rheology of the target case, and, finally, how the influent and the external recycling flow rates affect the SST performance. These methods are thoroughly described in Section 2.1. 2. HydroSludge can be used as a standalone tool for generating a mesh from CAD geometries. The red square in Figure 3 highlights the modules involved in the meshing operation. By importing a step geometry in the CAD module, users are provided with the necessary instruments to create and refine a mesh in the MESH module. 3. From a holistic point of view, HydroSludge comprehends a complete CFD simulation. The blue square in Figure 3 groups the necessary modules for configuring and running a simulation (CFD module) and its visualization (Post-processing module). Furthermore, optionally, Data analysis module can also take part in the simulation process.

| RESULTS
In this section, two study cases are presented and developed. The study of these cases serves as a proof of concept and correct operation of HydroSludge.

| Study of a secondary settling tank
The full-scale SST is 18.5 m in diameter and 5 m in height. With more detail, Figure 4 depicts the exact dimensions of the studied SST. The figure also indicates the location of the inlet, which is the influent flow of activated sludge, and the two outlet flows, one for clarified water, and the other for the external recycling.

| Data analysis
The study of this case starts with a preliminary study leveraging the tools included in the data analysis module (see Section 2.1).

Filtering
With the Settling tool, users calibrate the settling model parameters. For this purpose, first, experimental data of the batch settling test are introduced importing a .csv file or manually. Next, the linear equation is fitted to the linear part of the experimental settling curve for each activated sludge concentration. When all linear curves are fit to the experimental results, HydroSludge calculates the settling model parameters (see Figure 5a). This procedure is not mandatory so that, in this case, the settling model is introduced manually. The Inflow tool allows users to obtain a smooth transient flow from monitored transient influent flows. First, a .csv file with the evolution data of the flow through the time is imported. Users are provided with a series of tools to apply filters, such as moving averages or outlier removal (see Figure 5b). The filtered transient flow can be used at the CFD simulation afterward and exported.
Finally, the Rheology tool saves the rheological model selected for this case and transfers the configuration to the CFD module, if needed.

Checking
With the Design tool, users check if the dimensions of the SST agree with bibliography design requirements.
HydroSludge indicates with a check-mark or a warning sign whether the dimension is acceptable (see Figure 6a). More information can be obtained clicking on the information button in order to get a dialog with recommended design information and their reference.
All in all, the filters and the previous check can be used by the state point model and the 10 layers model to test whether the activated sludge from the biological reactor settles at the SST. This tool is presented with three areas (see Figure 6b). The first area, found at the top, is a hydraulic diagram of the secondary treatment of a WRRF with a bioreactor and an SST. The second area at the bottom corresponds to the 1D models to represent the SST performance.
The models are configured using the data introduced, such as the diameter and area of the SST, the influent and recirculated flow (Qi and Qr, respectively), number of settling tanks, overflow velocity (VA), and the activated sludge concentration (TSS). According to those parameters, HydroSludge calculates the underflow and overflow lines and the Ten Layers Model. The State Point of the WRRF is the underflow-overflow intersection. In this regard, the user can modify and explore the limits of its State Point depending on the given parameters. Thus, the boundary conditions can be checked before proceeding with the CFD model.

| Boundaries definition
HydroSludge assists the complete operation from the geometry to the mesh and its refinements, as previously stated. Thus, the first step for the construction of the CFD model in HydroSludge is to import a geometry with the CAD module. For this purpose, utilizing a .step file users will have the geometry faces at their disposal. Following this, users can declare the mesh surfaces and their roles in the simulation. For instance, the SST presented below illustrates the power of this meshing tool. Table 1 depicts an example of how faces are grouped into surfaces, and these, in turn, are labeled with a name and identified as patch or wall according to its boundary type (see Figure 7 and Table 1). Non-grouped faces are added to the Default surface and identified as wall automatically.  Thereupon, the mesh is ready to be generated in the Mesh module. At this stage, users have access to the Base, Sculpt, Snap, and Layers meshing tools to refine the areas or surfaces of their most interest. When the mesh is ready, it is time to configure the simulation parameters to start with the calculations of the CFD model (see Section 2.2.3). This configuration is done at the CFD module.

| Evaluation
The evaluation of the developed model in this study case is performed using driftFluxFoam solver. The simulations start with a pre-initialized state that defines the sludge layer inside the SST. Accordingly, the user specifies the height and concentration of the sludge at the initial time of the simulation.
The last step before launch the simulation is to provide the control configuration parameters such as the number of time-steps, writing interval, or time steepness, which are defined at this stage.
Furthermore, the parallel execution of the case can be enabled. For this purpose, the desired quantity of CPUs involved in the simulation, as well as, the processes topology, have to be introduced during the control configuration.
The results obtained by Hydrosludge are comparable to the ones calculated in a commercial CFD platform such as ANSYS. 13 To illustrate this, Figure 8 and Figure 9 depict the sludge concentration at a vertical plane of this study case obtained with HydroSludge and ANSYS 19.2. While Figure 8 illustrates the initial timesteps of the simulation, Figure 9 shows the results obtained when a more steady state is reached. Both simulations show a similar sludge height blanket and similar influent flow behavior. Additionally, both simulations showed a similar sludge concentration distribution with the presence of settled solid particles at the bottom of the clarifier being evacuated through the recirculation outlet by gravity.

| Study of an anoxic reactor
The second study case is a full-scale anoxic reactor from a Modified Ludzack-Ettinger biological reactor, which was extensively analyzed in (Climent et al. 2018). Particularly, this case considers two influent flows, the influent wastewater flow, and the internal recirculation flow; the outflow; and two submersible mixers. 13 https://www.ansys.com/products/fluids F I G U R E 8 Sludge concentration inside the clarifier at the initial timesteps of the simulation

| Equipments
HydroSludge provides a tool for easily including equipment, such as mixers into the CFD model (see Section 2.2.1), so that two submersible mixers are inserted into the reactor. The new equipment can be configured with the following options: identification; center point; vertical inclination; azimuth inclination; radius size; and full width. Figure 10a showcases both created mixers inserted into the structure before meshing.
Once the surfaces, boundaries, and equipment are defined, it is time to proceed to the meshing procedure and the refinement of the resultant mesh, if needed. Figure 10b contains the representation of the mesh with refinement at the submersible mixers.
OpenFOAM solver pimpleFoam is selected for the simulation of the hydrodynamics taking place inside the anoxic reactor. The configuration mechanism is similar to the previous study case, but each solver has its intrinsic parameters which HydroSludge is responsible to present to the user. Concretely, this solver only needs the configuration of the rheological model and the flow rate (or velocity) for each inlet or outlet boundary. PimpleFoam sets water as the default Newtonian model. Since this case counts with submersible mixers, their simulation features have to be defined. Specifically, HydroSludge expects the Manufacturer Coefficient and Power for each impeller. Usually, manufacturer coefficients are provided in clean water tests; hence, it may be modified to match CFD results with real data measured in process water, as it is done in Climent et al. ((2018), (2019)).
Finally, apart from the configuration of the simulation control, the execution can be parallelized (see Section 4.1.3). At the end of this step, the model will count with the hydrodynamic solution, which can be leveraged to apply transport equations for models such as the biological one described in the next section.

| Biological model
To apply the biological model implemented in the solver ASM1Foam (see Section 2.2.3), a time-step of the previous hydrodynamic solution has to be chosen. In this regard, the transport equation of the biological model will be applied to the selected time, and all the data related to the mesh or submersible mixers are F I G U R E 1 1 Post-processing result examples F I G U R E 1 2 Velocity profile results at three different (a) location A, (b) location B, and (c) location C inside the Anoxic reactor; in black the measured data at the WRRF, in blue the results obtained by CFD, and in red the results obtained by Hydrosludge automatically shifted to this stage. If HydroSludge does not detect hydrodynamic results, ASM1Foam cannot be calculated.
Next, the kinetic stoichiometric parameters of the ASM1 model must be defined. By default, HydroSludge loads the values established in Henze et al. (1999). Additionally, the concentrations of all ASM1 state variables are set for every inflow boundary, as well as the initial conditions of the reactor. After initialization, the case is ready to be simulated.

| Post-processing
As soon as the CFD simulation yields results, users can explore them interactively. For instance, Figure 11a shows three planes coloring "Sno" variable for the timestep ' 1,1601.1 that corresponds to the second ' 193.4 of the transient simulation. Another example of the tools that HydroSludge provides is a probe line, which is deployed inside the domain to study the behavior of a given variable. Figure 11 depicts "Snh" distribution along a line in the Z dimension. Furthermore, the viewer and graph can also show the evolution in time of the variable thank to the media commands for playing the sequence.
Lastly, in order to validate experimental data collected at the WRRF, Figure 12 depicts the velocity profiles at three different locations obtained with Hydrosludge and ANSYS 19.2. The results obtained by Hydrosludge showed a similar adjustment to the data measured at the WRRF.

| CONCLUSIONS
This paper describes, implements, and evaluates a set of tools for the specific case of the study and analysis of wastewater treatment processes. The toolbox methods are included in a software platform, named HydroSludge, to facilitate the evaluation and simulation of secondary clarifiers and conventional activated sludge processes in a WRRF. Future work places HydroSludge in the cloud as a web application instead of as a desktop application as new research developments indicate Costa-Maj o et al. (2021). HydroSludge is also opened to be extended with other type of mixers such as aerators, vertical shaft, or floating surfaces. Likewise, other ASM-like models can be incorporated in further versions.
HydroSludge is a complementary WRRF modeling tool to Biowin, GPS-X, and so forth. Users may continue using plant-wide modeling to reproduce the entire operation of the facility.
HydroSludge is based on one of the most widespread and leading CFD simulation software, OpenFOAM. However, HydroSludge prevents the user from getting involved in a complex process of configuring an extensive list of files, bringing a more wizard-like and intuitive usage. This feature makes HydroSludge an ideal tool for wastewater treatment industry users with low knowledge of CFD. Furthermore, HydroSludge includes the nomenclatures and procedures names used in the water sector.
ACKNOWLEDGEMENT This work was supported by project RTC-2016-4560-7 from MINECO. Researcher S. Iserte was supported by the postdoctoral fellowship APOSTD/2020/026 from GVA and ESF. Authors want to thank the anonymous reviewers whose suggestions significantly improved the quality of this manuscript.