Analytical Solutions to Conservative and Non-Conservative Water Quality Constituents in Water Distribution System Storage Tanks

Water storage tanks are one of the primary and most critical components of water distribution systems (WDSs), which aim to manage water supply by maintaining pressure. In addition, storage provides a surplus source of water in case of an emergency. To gain the mentioned advantages, storage tanks are incorporated in most WDSs. Despite these advantages, storage can also pose negative impacts on water quality, thereby affecting water utilities. Water quality problems are a result of longer residency times and inadequate water mixing. This study aimed to construct a model of a tank’s water quantity and quality by formulating and solving governing equations based on inlet/outlet configurations and processes that influence the movement of water and chemical substances inside it. We used a compartment model to characterize the mixing behavior inside a tank. A water quality simulation model with different compartment arrangements was explored for extended filling and draining of storage, which was further validated using a previously published case study.


Introduction
Multiple infrastructures gather, store, treat, and distribute water from a water source to customers with variable demands in a water supply or distribution system. Any water distribution system (WDS) should provide water in sufficient quality and pressure by integrating these infrastructures. Water storage is one of the most prominent and essential components of water supply systems used to manage water supply by ensuring hydraulic reliability through maintaining pressure. Furthermore, this storage can be used as a water source at times of emergency or power outage [1].
Many WDSs in high-water-demand areas use large volume tanks that are positioned, constructed, and operated primarily for structural safety and hydraulic resiliency [2]. However, utilizing them raises water quality concerns, such as poor mixing and lengthening the retention duration (the length of time spent in the water inside the tank before being drafted for use) [3]. An extended retention period causes the water to become older. Due to this, the concentration of disinfectants will not be powerful enough to stop germs from growing in the distribution system. Reduced disinfectant residuals, bacterial growth, nitrification, growth of disinfectant by-products, and the development of aesthetic alterations in water taste, odor, and appearance are the most significant effects on water quality [4]. Such events directly impact water quality, which is in direct opposition to the need for more water. In addition, the breakdown of water quality in storage might impair the overall efficiency of the WDS. Substantial research has been carried out to better understand the phenomena that occur in storage facilities related to water quality. Mixing and aging are two interconnected phenomena that affect water quality [5]. When water enters a storage tank, it may be of

Model Development
In this study, a three-compartment model for conservative material and a twocompartment model for non-conservative material were created using a conceptual picture of the internal reservoir mixing and flow patterns. Discrete volume compartments were used to illustrate these mixing features [16]. In addition, calibration was used to determine the capacity of each compartment. It was assumed that the outflow was always at the bottom, and the inlet could come from any compartment level in both circumstances. The flows were traditional inflow/outflow storage tanks, in which the water volume expands and contracts in response to service demand [11]. For both situations, the following basic assumptions were used to develop the analytical solutions to mixing behavior.
For a given period, the inflow and outflow rates were constant. Even though this is not an actual occurrence in WDSs, it was assumed that the given duration corresponded to the time during which either the inflow or outflow was constant [15,16]. The flow rate between compartments was assumed to be constant. The interchange flow rates between compartments were represented as constant flow rates. In contrast, the flows in and out of the tank's variable bulk volume compartment were modeled as tank inflow and outflow, respectively [15,16]. Consistency was maintained in a compartment with changing bulk volumes. The volume of the bulk volume compartment may change over time depending on the difference between inflow and outflow [11,15,16]. The flow was unidirectional and ran either into or out of the tank or any compartment, but not simultaneously. This assumption remains true for most storage facilities for short periods [15].
Chlorine decay was assumed and related to conceptual transport models that consider the tank an ideal reactor, such as the continuous flow stirred tank reactor (CSTR), consisting of an intensively mixed volume with a uniform concentration distribution, and the plug flow reactor (PFR), where transport is only due to advection in the flow direction and complete transverse mixing [2]. The initial concentrations are simplified so that before interacting with the next compartment, each upstream compartment is permitted to establish a pseudo equilibrium condition at each step. As a result, the concentration transmitted to the next compartment is assumed to be constant. This assumption is valid for a short period of time [15].
For non-conservative species, the boundary concentrations were kept constant for exponential compounds. When factoring out the decay behavior of reactive chemical material, this assumption is a mathematical idea that gives the differential equations the correct form regarding nonhomogeneous boundary conditions. The decaying coefficient is the first-order kinetic reaction rate coefficient, which could be calculated based on the premise mentioned above [15,16].
Using the aforementioned assumptions, the system of equations describing mixing in the tanks for each model was effectively reduced from a set of dependent, linear differential equations with non-constant coefficients to a series of independent, linear differential equations with either constant coefficients or separate terms, where all equations are solvable by direct integration. These assumptions aid in the development of explicit analytical solutions for the given models [15].

Mathematical Solution
The general mass balance equations' formulations and solutions for conservative and non-conservative substance compartment models are provided here. A single decay term describes the degradation of any chemical species in water for decaying compounds.

Conservative Material
The mixing behaviors inside the tank were modeled in this research using a threecompartment model. Three different compartments make up this model, which approximates the spatial distribution of constituent concentrations. Each of the three compartments was represented as a thoroughly mixed volume element, with the flow and dissolved elements passing directly between them [14]. The tanks were traditional inflow/outflow tanks that fill or drain as needed rather than simultaneously. Assuming that each compartment defines the varied mixing behaviors in a separate tank segment, a basic mass balance equation was used to describe the mixing situation in each compartment. The entry point can come from any compartment, while the outlet is located at the bottom. The chemical compound fluoride (conservative species) was thought to be present in the water. Figure 1 depicts the model schematic where the inlet and initial water level were located at the bottom (Compartment A).
For non-conservative species, the boundary concentrations were kept constant for exponential compounds. When factoring out the decay behavior of reactive chemical material, this assumption is a mathematical idea that gives the differential equations the correct form regarding nonhomogeneous boundary conditions. The decaying coefficient is the first-order kinetic reaction rate coefficient, which could be calculated based on the premise mentioned above [15,16].
Using the aforementioned assumptions, the system of equations describing mixing in the tanks for each model was effectively reduced from a set of dependent, linear differential equations with non-constant coefficients to a series of independent, linear differential equations with either constant coefficients or separate terms, where all equations are solvable by direct integration. These assumptions aid in the development of explicit analytical solutions for the given models [15].

Mathematical Solution
The general mass balance equations' formulations and solutions for conservative and non-conservative substance compartment models are provided here. A single decay term describes the degradation of any chemical species in water for decaying compounds.

Conservative Material
The mixing behaviors inside the tank were modeled in this research using a threecompartment model. Three different compartments make up this model, which approximates the spatial distribution of constituent concentrations. Each of the three compartments was represented as a thoroughly mixed volume element, with the flow and dissolved elements passing directly between them [14]. The tanks were traditional inflow/outflow tanks that fill or drain as needed rather than simultaneously. Assuming that each compartment defines the varied mixing behaviors in a separate tank segment, a basic mass balance equation was used to describe the mixing situation in each compartment. The entry point can come from any compartment, while the outlet is located at the bottom. The chemical compound fluoride (conservative species) was thought to be present in the water. Figure 1 depicts the model schematic where the inlet and initial water level were located at the bottom (Compartment A). The general formulas describing the change of fluoride/chlorine concentration in each compartment are shown in Equations (1) and (2).
or, equivalently, V(t) The general formulas describing the change of fluoride/chlorine concentration in each compartment are shown in Equations (1) and (2).

Inflow Conditions
Each compartment's governing equations were determined by the inlet/outlet configuration and the initial water level in the tank. There were three water input points and three water levels to start with, as shown in Figure 1. When all permutations are taken Water 2021, 13, 3502 5 of 28 into account, there are nine tank configurations. The mass balance was used to create the differential equation in each compartment of the nine layouts. In any compartment, concentration fluctuations occurred when different water concentrations were mixed or when the incoming water had a time-dependent inlet concentration. When the compartment was empty and no additional water was being introduced, the concentration remained at zero. Table 1 contains a summary of all cases at the filling stage. The first column represents the inlet locations, and the first row shows the initial water level. For example, for the first combination, where both the inflow point and the initial water level were in Compartment A, separate differential equations had to be generated for each compartment. In Case 1, the new water arriving was mixed with the old water that was previously present in Compartment A. If the two water concentrations differed, there was a change in concentration in Compartment A. Compartments B and C, on the other hand, contained no concentration because they were both empty in this situation. No additional water entered them during the filling stage of Compartment A.
In Case 2, the intake point was positioned in Compartment A, and the initial water level was located in Compartment B. Because Compartment A was full, there was no change in water volume. However, concentrations fluctuated if the intake and starting concentrations in the compartment were not the same. In Case 3, the newly mixed water from Case 2 entered Compartment B straight from Compartment A. In some instances, the resulting differential equation may be symmetric. Cases 1, 7, and 13 were, for example, identical. Even though the inlet locations were different, the mass balance for Compartment A during the filling stage was the same as long as the water level was in Compartment A. When there was no mixing, the concentration remained constant. In Case 8, both the water level and the entry points were initially in Compartment B. This signifies that Compartment A was a dead zone during the filling stage of Compartment B. Because it received no additional water from the outside, its concentration remained constant over this time. Generally, the steps to find an analytical solution for the concentration as a function of time in any compartment are described in Figure 2.
A brief analytical solution formulation for each compartment for all nine-tank arrangements was detailed during the filling cycle. The output point was closed during this period, and there was no outflow (Q out (t) = 0).  A brief analytical solution formulation for each compartment for all nine-tank arrangements was detailed during the filling cycle. The output point was closed during this period, and there was no outflow (Qout(t) = 0).

Configuration 1: Initial Level of Water and Inlet Point of Compartment A
The tank had three compartments, each with fixed volumes of VA, VB, and VC. Calibration was used to determine the capacity of each compartment. Water at a constant flow rate of Qin(t) and a fluoride concentration of Cin(t) was supposed to enter the tank through Compartment A for specific delta t(Δt). Thus, the tank has an initial water volume given as V0A and an initial fluoride content of C0A. Figure 3 shows a graphical representation of the arrangement.   The tank had three compartments, each with fixed volumes of V A , V B , and V C . Calibration was used to determine the capacity of each compartment. Water at a constant flow rate of Q in (t) and a fluoride concentration of C in (t) was supposed to enter the tank through Compartment A for specific delta t(∆t). Thus, the tank has an initial water volume given as V 0A and an initial fluoride content of C 0A . Figure 3 shows a graphical representation of the arrangement. A brief analytical solution formulation for each compartment for all nine-tank arrangements was detailed during the filling cycle. The output point was closed during this period, and there was no outflow (Qout(t) = 0).

Configuration 1: Initial Level of Water and Inlet Point of Compartment A
The tank had three compartments, each with fixed volumes of VA, VB, and VC. Calibration was used to determine the capacity of each compartment. Water at a constant flow rate of Qin(t) and a fluoride concentration of Cin(t) was supposed to enter the tank through Compartment A for specific delta t(Δt). Thus, the tank has an initial water volume given as V0A and an initial fluoride content of C0A. Figure 3 shows a graphical representation of the arrangement.    .
Since there is only filling, Q out (t) = 0.
Combining Equations (5) and (6), The solution for Equation (7), assuming that Q in (t) = Q in , is given as Compartments B and C have no concentration because they were both empty in this condition, and no more water was entering them during Compartment A's filling stage.
Configuration 2: Initial Level of Water in Compartment B and Inlet of Compartment A Initially, Compartment A was full (V A = V 0A ). The water level in Compartment B had a volume of V 0B and a concentration of C 0B . Water entered Compartment A at a constant flow rate, Q in (t), and an inlet concentration of C in (t). Then, it flowed into Compartment B at the same rate as before, with a new fluoride concentration, (8), formed by mixing in Compartment A. Figure 3b shows a graphical representation.
Case 2: Compartment A (Figure 3b). In this instance, Compartment A was initially full. Water flowed into and out of the compartment at the same rate Q in (t). The volume remained constant during the filling stage.
Combining Equations (9) and (10), The analytical solution of Equation (11), assuming that Q in (t) = Q in , is given as Case 3: Compartment B (Figure 3b). Water entered Compartment B from Compartment A, with the same flow, Q in (t), and a concentration provided by the analytical solution in (12) . The water level in Compartment B had a volume of V 0B and a concentration of C 0B. A graphical representation is given in Figure 3b.
Water 2021, 13, 3502 8 of 28 Combining Equations (13) and (14), The analytical solution of Equation (15), assuming that Q in (t) = Q in , is Configuration 3: Initial Level of Water in Compartment C and Inlet of Compartment A The tank had three compartments, each with fixed volumes of V A , V B , and V C , respectively. The initial water level in Compartment C had a volume of V 0C and a concentration of C 0C . Water was assumed to enter Compartment A with a constant flow rate, Q in (t), and a fluoride concentration of C in (t) and flowed into Compartment B and Compartment C with the same flow rate, Q in (t). A graphical representation is shown in Figure 3c.
Case 4: Compartment A (Figure 3c). This case was the same situation as Case 2; Compartment A was full, and water entered Compartment A. The only difference was that the water level was initially in Compartment C, which did not affect the mixing mechanism in Compartment A. The mass balance equations and solution were the same. The analytical solution was given in (12), ). Case 5: Compartment B (Figure 3c). Both Compartments A and B were initially full (V A = V 0A , V B = V 0B ). The volume of water in Compartments A and B remained constant during the filling stage of Compartment C. The water level in Compartment C had a volume of V 0C and a concentration of C 0C . New water flowed into Compartment A with a C in (t) inlet concentration and Q in (t) flow. It flowed to Compartment B with a new chlorine concentration, given in (12), and to Compartment C with a new chlorine concentration (16), formed by mixing in Compartment B, all at the same flow rate (Qin(t)). Figure 3c depicts a graphical representation of the layout.
Combining Equations (17) and (18) The analytical solution of Equation (19), assuming that Q in (t) = Q in , is Case 6: Compartment C (Figure 3c). Initially, the water level was in Compartment C with a volume of V 0C and a concentration of C 0C. Then, water flowed to Compartment C from Compartment B at a constant flow rate of Q in (t) and the fluoride concentration given in (20). A graphical representation is shown in Figure 3c.
Combining Equations (21) and (22), The analytical solution for Equation (23), assuming that Q in (t) = Q in , is

Configuration 4: Initial Level of Water in Compartment A and Inlet of Compartment B
The tank was divided into three compartments with fixed volumes of V A , V B , and V C . Water was assumed to enter the tank with a constant flow rate of Q in (t) and fluoride concentration of C in (t) from Compartment B. Thus, the tank had an initial water volume of V 0A in Compartment A, with an initial fluoride concentration of C 0A . A graphical representation is provided in Figure 4a.

Case 7: Compartment A (Figure 4a).
This case was almost the same situation as Case 1, the only difference being that water with a flow rate of Qin(t) and an inlet concentration of Cin(t) entered Compartment A from Compartment B. The analytical solution for Compartment A in Equation (8) is provided by the following: Configuration 5: Initial Level of Water in Compartment B and Inlet of Compartment B The tank was divided into three compartments with fixed volumes of VA, VB, and VC. Initially, the water level was in Compartment B with a volume of V0B and a concentration of C0B. Water entered Compartment B with a constant flow of Qin(t) and a fluoride concentration of Cin(t), as shown in Figure 4b.
During the filling stage of Compartment B, Compartment A was a dead zone. It did not interact with new water that came from outside through Compartment B. Therefore,

Case 7: Compartment A (Figure 4a).
This case was almost the same situation as Case 1, the only difference being that water with a flow rate of Q in (t) and an inlet concentration of C in (t) entered Compartment A from Compartment B. The analytical solution for Compartment A in Equation (8) is provided by the following: Configuration 5: Initial Level of Water in Compartment B and Inlet of Compartment B The tank was divided into three compartments with fixed volumes of V A , V B , and V C . Initially, the water level was in Compartment B with a volume of V 0B and a concentration of C 0B. Water entered Compartment B with a constant flow of Q in (t) and a fluoride concentration of C in (t), as shown in Figure 4b.
During the filling stage of Compartment B, Compartment A was a dead zone. It did not interact with new water that came from outside through Compartment B. Therefore, the concentration remained constant for Compartment A.
Initially, the water level in Compartment B had a volume of V 0B and a concentration of C 0B . Water entered Compartment B with a constant flow rate of Q in (t) and a fluoride concentration of C in (t), as shown in Figure 4b.
Combining Equations (26) and (27), The analytical solution of Equation (28), assuming that Q in (t) = Q in , is Configuration 6: Initial Level of Water in Compartment C and Inlet of Compartment B The tank was divided into three compartments with fixed volumes of V A , V B , and V C . Initially, the water level was in Compartment C with a volume of V 0C and a concentration of C 0C. Then, water was assumed to enter Compartment B with a constant flow rate of Q in (t) and a fluoride concentration of C in (t), and left with the same flow, Q in (t).
Case 10: Compartment A (Figure 4c). There was no mixing since no water entered Compartment A. Therefore, during the filling phase, the concentration remained the same as C 0A .
Case 11: Compartment B (Figure 4c). In this instance, Compartment B was initially full. Water flowed into and out of the compartment at the same rate, Q in (t). The volume remained constant during the filling stage.
Combining Equations (30) and (31), The analytical solution of Equation (32), assuming that Q in (t) = Q in , is Case 12: Compartment C (Figure 4c). Initially, the water level was in Compartment C with a volume of V 0C and a concentration of C 0C. Water entered Compartment B with at a constant flow rate of Q in (t) and an inlet fluoride concentration of C in (t). It flowed with the same flow rate, Q in (t), and a con-centration of the analytical solution (33) into Compartment C. A graphical representation is given in Figure 4c.

Configuration 7: Initial Level of Water in Compartment A and Inlet of Compartment C
The tank was divided into three compartments with fixed volumes of V A , V B , and V C . Water was assumed to enter the tank with a constant flow rate of Q in (t) and a chlorine concentration of C in (t) from Compartment C. Thus, the tank had an initial water volume of V 0A in Compartment A with an initial fluoride concentration of C 0A . A graphical representation is given in Figure 5a.   A (Figure 5a). This case was similar to Cases 1 and 7. Thus, the analytical solution of Compartment A is Equation (8).

Configuration 8: Initial Level of Water in Compartment B and Inlet of Compartment C
The tank was divided into three compartments with fixed volumes of V A , V B , and V C . Water entered the tank with a constant flow rate of Q in (t) and chlorine concentration of C in (t) from Compartment C. The tank had an initial water volume of V 0B in Compartment B with an initial fluoride concentration of C 0B . A graphical representation is shown in Figure 5b.
Since there was no mixing of the concentration in Compartment A, it remained the same as C 0A .
Case 15: Compartment B (Figure 5b). This case was almost the same as Case 9. The only difference was that A water with flow C in (t) and Q in (t) enters Compartment B from Compartment C. The analytical solution Water 2021, 13, 3502 12 of 28 Configuration 9: Initial Level of Water in Compartment C and Inlet of Compartment C The tank was divided into three compartments with fixed volumes of V A , V B , and V C . Water was assumed to enter the tank with a constant flow rate of Q in (t) and chlorine concentration of C in (t) from Compartment C. The tank had an initial water volume of V 0C in Compartment C with an initial chlorine concentration of C 0C . A graphical representation is shown in Figure 5c.
Case 16: Compartment A (Figure 5c). Since no water flowed into Compartment A, there was no mixing, and the concentration remained constant.
Case 17: Compartment B (Figure 5c). There was no mixing because no water went into Compartment B during this filling stage. Therefore, the concentration remained constant, at C 0B .
Combining Equations (38) and (39), The analytical solution of Equation (40), assuming that Q in (t) = Q in , is The analytical solutions discovered are summarized in Table 2. It replaces the case numbers in Table 1 with an equation number giving the analytical answer for the specific situation. Table 2. Summary of the analytical solution during the filling stage.

Outflow Conditions
The outlet was located at the bottom of the tank, and the starting water level could come from any of the three compartments. As a result, there were three possible configurations. Unless water with a different concentration flowed from the top compartment, the concentration of any compartment remained constant during the draining process. For example, in Compartment A of the first design depicted in Figure 6a, when the outlet was opened, the water simply flowed without mixing. Therefore, the concentration did not change. Table 3 shows the lists of cases for outflow conditions.

partment C
The tank was divided into three compartments with fixed volumes of VA, VB, and VC. Water was assumed to leave from the tank with a constant flow rate of Qout(t) from Compartment A. Thus, the tank had an initial water volume of V0C in Compartment C with an initial chlorine concentration of C0C. Water flowed with the same Qout(t) to Compartments A and B. A graphical representation is shown in Figure 6c.   The tank was divided into three compartments with fixed volumes of V A , V B , and V C . Water was assumed to flow out from the tank with a constant flow rate of Q out (t) from Compartment A. Thus, the tank had an initial water volume of V 0A in Compartment A with an initial chlorine concentration of C 0A . A graphical representation is shown in Figure 6a.
Because there was no water mixing, the water concentration remained constant at C 0A during the draining stage.

Configuration 2: Outlet Point of Compartment A and Initial Level of the Water in Compartment B
The tank was divided into three compartments with fixed volumes of V A , V B , and V C . Water was assumed to flow out from the tank with a constant flow rate of Q out (t) from Compartment A. The tank had an initial water volume of V 0B in Compartment B with an initial chlorine concentration of C 0B . Water flowed with the same Q out (t) as in Compartment A. A graphical representation is shown in Figure 6b.
Case 2: Compartment B (Figure 6b). The water simply flowed without any mixing. The concentration remained constant for Compartment B as C 0B .
The tank had an initial water volume of V 0B in Compartment B with an initial chlorine concentration of C 0B . During Compartment B's draining stage, the volume of Compartment A remained constant since it was full. Water was assumed to enter Compartment A from Compartment B, with a constant flow rate of Q out (t) with a concentration of C 0B , and flow out of the tank with the same flow rate, Q out (t). A graphical representation is shown in Figure 6b. Combining Equations (41) and (42), The analytical solution of Equation (43), assuming that Q out (t) = Q out , is Configuration 3: Outlet Point in Compartment A and Initial Level of the Water in Compartment C The tank was divided into three compartments with fixed volumes of V A , V B , and V C . Water was assumed to leave from the tank with a constant flow rate of Q out (t) from Compartment A. Thus, the tank had an initial water volume of V 0C in Compartment C with an initial chlorine concentration of C 0C . Water flowed with the same Q out (t) to Compartments A and B. A graphical representation is shown in Figure 6c.
Water from Compartment C exited without mixing during a specific delta t. As a result, the concentration remained the same as C 0C . Water with a concentration of C 0c flowed into Compartment B during this period.
In Compartment C, the tank had an initial water volume of V 0C with an initial chlorine concentration of C 0B . Because Compartment B was filled, the volume of Compartment B remained constant during the draining step of Compartment C. Water with a concentration of C 0C was assumed to enter Compartment B from Compartment C of the tank at a constant flow rate of Q out (t).
Combining Equations (45) and (46) The analytical solution of Equation (47), assuming that Q out (t) = Q out , is A (Figure 6c). The tank had an initial water volume of V 0c in Compartment C with an initial chlorine concentration of C 0C . Water was assumed to enter Compartment B from Compartment C of the tank with a constant flow rate of Q out (t) and concentration of C 0c at this specific delta T. Water with the same flow but a concentration of (C B (t) = C C (t) + exp − Q out (t) V B (C 0B −C C (t ))) entered Compartment A. Because Compartment A was filled, the volume of Compartment B remained constant during the draining step of Compartment C. A graphical representation is shown in Figure 5c:

Case 5: Compartment
Combining Equations (49) and (50), The analytical solution of Equation (51), assuming that Q out (t) = Q out , is  Table 3 with an equation number giving the analytical answer for the specific situation. Table 4. Summary of the analytical solutions during the draining stage.

Non-Conservative Material
The mixing behaviors inside the tank were depicted using a two-compartment model. The tanks were classic inflow/outflow tanks, which are filled or drained according to need rather than simultaneously. The entrance can come from any compartment, and the outlet is at the bottom. It was assumed that the material was non-conservative and had a first-order decay constant of k. The general formulas, which describe the change in the concentration of chlorine are as follows: or, equivalently, Inflow Conditions Using the same analysis as before, the entrance point and the initial water level could be in any of the two compartments for the filling stage. Accordingly, there were four configurations. Table 5 lists all the cases for the inflow stages. The tank was divided into three compartments with fixed volumes of V A and V B . Water was assumed to enter the tank with a constant flow rate of Q in (t) and chlorine concentration of C in (t). Thus, the tank had an initial water volume of V 0A in Compartment A with an initial chlorine concentration of C 0A with a decay constant K. Figure 7a shows a graphical representation.  A (Figure 7a).

Case 1: Compartment
Combining Equations (57) and (58), The analytical solution of Equation (59), assuming that Qin(t) = Qin, is Configuration 2: Initial Level of Water in Compartment B, and the Inlet of Compartment A The tank was divided into two compartments with fixed volumes of VA and VB. Water was assumed to enter the tank with a constant flow rate of Qin(t) and chlorine concentration of Cin(t). The tank had an initial water volume of V0B in Compartment B with an initial chlorine concentration of C0B with a decay constant K. Compartment A was full. Figure 7b shows a graphical representation.

Case 1: Compartment
Combining Equations (57) and (58), The analytical solution of Equation (59), assuming that Q in (t) = Q in , is Configuration 2: Initial Level of Water in Compartment B, and the Inlet of Compartment A The tank was divided into two compartments with fixed volumes of V A and V B . Water was assumed to enter the tank with a constant flow rate of Q in (t) and chlorine concentration of C in (t) . The tank had an initial water volume of V 0B in Compartment B with an initial chlorine concentration of C 0B with a decay constant K. Compartment A was full. Figure 7b shows a graphical representation.
Combining Equations (61) and (62), The analytical solution of Equation (63), assuming that Q in (t) = Q in , is Case 3: Compartment B (Figure 7b). Initially, the water level in Compartment B had a volume of V 0B and a concentration of C 0B. Water was assumed to enter Compartment A with a constant flow rate of Q in (t) and chlorine concentration of C in (t), which has a decay constant K and leaves with the same flow, Q in (t), and a concentration of the analytical solution of Equation (48) into Compartment B. A graphical representation is provided in Figure 7b.
Combining Equations (65) and (66), The analytical solution of Equation (67), assuming that Q in (t) = Q in , is

Configuration 3: Initial Level of Water in Compartment A and the Inlet of Compartment B
The tank was divided into two compartments with fixed volumes of V A and V B . Water was assumed to enter the tank with a constant flow rate of Q in (t) and chlorine concentration of C in (t) from Compartment B. The tank had an initial water volume of V 0A in Compartment A with an initial chlorine concentration of C 0A with a decay constant K. Figure 8a shows a graphical representation.

Case 3: Compartment B (Figure 7b).
Initially, the water level in Compartment B had a volume of V0B and a concentration of C0B. Water was assumed to enter Compartment A with a constant flow rate of Qin(t) and chlorine concentration of Cin(t), which has a decay constant K and leaves with the same flow, Qin(t), and a concentration of the analytical solution of Equation (48) into Compartment B. A graphical representation is provided in Figure 7b.

Configuration 3: Initial Level of Water in Compartment A and the Inlet of Compartment B
The tank was divided into two compartments with fixed volumes of VA and VB. Water was assumed to enter the tank with a constant flow rate of Qin(t) and chlorine concentration of Cin(t) from Compartment B. The tank had an initial water volume of V0A in Compartment A with an initial chlorine concentration of C0A with a decay constant K. Figure  8a shows a graphical representation.   A (Figure 8a).

Case 4: Compartment
This was almost the same as Case 1, with the only difference being the water inlet location. The analytical solution is given in Equation (60).

Configuration 4: Initial Level of Water in Compartment B and the Inlet of Compartment B
The tank was divided into two compartments with fixed volumes of V A and V B . Water was assumed to enter the tank with a constant flow rate of Q in (t) and chlorine concentration of C in (t) from Compartment B. Thus, the tank had an initial water volume of V 0B in Compartment B with an initial chlorine concentration of C 0B with a decay constant K. A graphical representation is shown in Figure 8b.
Case 5: Compartment A (Figure 8b). The water in the compartment is not interacting with any new water that comes from outside during the filling stage.
Combining Equations (69) and (70), The solution of Equation (71) is C A (t) = C 0A exp(−kt). Case 6: Compartment B (Figure 8b). Initially, the water level was in Compartment B with a volume of V 0B and concentration of C 0B with a decay constant K. water was assumed to enter Compartment B with a constant flow rate of Q in (t) and chlorine concentration of C in (t) as shown in Figure 8b: Combining Equations (72) and (73), The analytical solution of Equation (74), assuming that Q in (t) = Q in , is Table 6 refers the summary of the analytical solutions.

Outflow Condition
The draining procedure was also subjected to the same scrutiny as the conservative procedure. Suppose there is no mixing in the compartment when the outlet is opened; unlike the conservative ones, the concentration changes due to the decay constant. There are two configurations that can be achieved by changing the initial water level. Table 7 shows the list of the cases. The tank was divided into two compartments with fixed volumes of V A and V B . Water was assumed to leave from the tank with a constant flow rate of Q out (t) from Compartment A. The tank had an initial water volume of V 0A in Compartment A with an initial chlorine concentration of C 0B and a decay constant K. Water flows with the same Q out (t) as Compartment A. A graphical representation is shown in Figure 9a.

Outflow Condition
The draining procedure was also subjected to the same scrutiny as the conservati procedure. Suppose there is no mixing in the compartment when the outlet is opene unlike the conservative ones, the concentration changes due to the decay constant. The are two configurations that can be achieved by changing the initial water level. Table shows the list of the cases. The tank was divided into two compartments with fixed volumes of VA and VB. W ter was assumed to leave from the tank with a constant flow rate of Qout(t) from Compa ment A. The tank had an initial water volume of V0A in Compartment A with an init chlorine concentration of C0B and a decay constant K. Water flows with the same Qout(t) Compartment A. A graphical representation is shown in Figure 9a.  A (Figure 9a).

Configuration 2: Initial Level of Water in Compartment B and the Outlet of Compartment A
The tank was divided into two compartments with fixed volumes of V A and V B . Water was assumed to leave from the tank at a constant flow rate of Q out (t) from Compartment A. The tank had an initial water volume of V 0B in Compartment B with an initial chlorine concentration of C 0B, and a decay constant K. Water flows with the same Q out (t) to Compartment A. A graphical representation is shown in Figure 9b.

Case 2: Compartment
Water was assumed to leave from the tank with a constant flow rate of Q out (t) from Compartment A. The tank had an initial water volume of V 0B in Compartment B with an initial chlorine concentration of C 0B, and a decay constant K. Water flows with the same Q out (t) and a concentration of C 0B exp(−kt) to Compartment A. During this time, Compartment A was full. Figure 6b gives a graphical representation.

Example Application
For both the filling and draining stages, full analytical solutions were developed, taking into account all the combinations and arrangements for both conservative and non-conservative materials. A simulation can be run to calculate the volume and concentration at any time in a specified compartment by providing all of the necessary input variables. A user enters the following as inputs: − The fixed volumes of Compartments A, B, C; a calibration was used to choose the volume of each compartment. − The delta t and total simulation time T. − The inlet points. − The initial levels and volumes of water and the initial concentrations. − The inflow Q in (t) with its C in (t) and outflow Q out (t) for different delta t (during total time T).
Using the appropriate equation, concentrations were calculated at any time for each compartment. In addition, the results were validated by comparing them with numerical results.
The following are assumed to be true for the flow.
− Constant for specific delta t. − It can be either filling (Q out = 0) or draining (Q in = 0) at any time. − It was given for the total simulation time T.
When it was filling (Q in > 0), there was a C in (t) (inlet concentration). A sample of theoretical data and field data from [11] were taken to test the model for both conservative and non-conservative constituents.

Conservative Material
A tank was divided into three compartments and had volumes of 500 m 3 , 400 m 3 , and 600 m 3 , starting from the bottom. The simulation was carried out for a total of 10 h, with delta t (∆t) being 1 h. The flow at each hour is given in Table 9. Two arrangements (initial levels of water concentrations) are presented in Figure 10. The delta t and total simulation time T. − The inlet points. − The initial levels and volumes of water and the initial concentrations. − The inflow Qin(t) with its Cin(t) and outflow Qout(t) for different delta t (during total time T). Using the appropriate equation, concentrations were calculated at any time for each compartment. In addition, the results were validated by comparing them with numerical results.
The following are assumed to be true for the flow.

Constant for specific delta t. −
It can be either filling (Qout = 0) or draining (Qin = 0) at any time. − It was given for the total simulation time T.
When it was filling (Qin >0), there was a Cin(t) (inlet concentration). A sample of theoretical data and field data from [11] were taken to test the model for both conservative and non-conservative constituents.

Conservative Material
A tank was divided into three compartments and had volumes of 500 m 3 , 400 m 3 , and 600m 3 , starting from the bottom. The simulation was carried out for a total of 10 h, with delta t (Δt) being 1 h. The flow at each hour is given in Table 9. Two arrangements (initial levels of water concentrations) are presented in Figure 10.

Result and Discussion
Using the appropriate equations, the volumes and concentrations were calculated at each time step. The volume and concentration graphs are presented as follows. Figure 11 shows the volume of each compartment as a function of time. In (a), at first, Compartment A contained 50 m 3 of water. It rose when there was inflow and fell when there was outflow, according to the flow tables. Water flowed into Compartment B when

Result and Discussion
Using the appropriate equations, the volumes and concentrations were calculated at each time step. The volume and concentration graphs are presented as follows. Figure 11 shows the volume of each compartment as a function of time. In (a), at first, Compartment A contained 50 m 3 of water. It rose when there was inflow and fell when there was outflow, according to the flow tables. Water flowed into Compartment B when it exceeded its capacity volume of 500 m 3 , increasing the volume of Compartment B. The water level did not reach Compartment C in this flow example. As a result, the volume of Compartment C was nil. (b) Initially, Compartment A contained 500 m 3 of water (maximum capacity), while Compartment B had 50 m 3 of water. The volume in Compartment A remained constant according to the flow tables, while the volume in Compartment B increased when there was inflow and reduced when there was outflow. Water flowed into Compartment C when it exceeded its capacity volume of 300 m 3 , increasing the volume of Compartment C.   Figure 12 shows the fluoride concentration as a function of time. Because the material was conservative, the concentration inside each compartment rose or fell with time to approach the inlet concentration in both arrangements. Compartment A had a 35 mg/L concentration in (a). It lowered over time since it was more than the inlet concentration (25 mg/L). Because there was no water in Compartments B and C, the concentrations were zero. When water entered Compartment B, the concentration instantly rose and gradually approached the input concentration until it reached zero, when the water level returned to Compartment A. The water level did not reach Compartment C in these specific situations. As a result, the concentration always stayed zero. For the second configuration (b), Compartments A and B had 35 mg/L concentrations at first. Because the entrance came from Compartment B, in the first hour of filling, mixing occurred only in Compartment B. As a result, although Compartment B's concentration decreased to approach the inflow concentration, Compartment A's concentration remained unchanged. Whenever Compartment B was draining, water with a certain concentration flowed into Compartment A. The concentration in Compartment A lowered to maintain equilibrium.  Figure 12 shows the fluoride concentration as a function of time. Because the material was conservative, the concentration inside each compartment rose or fell with time to approach the inlet concentration in both arrangements. Compartment A had a 35 mg/L concentration in (a). It lowered over time since it was more than the inlet concentration (25 mg/L). Because there was no water in Compartments B and C, the concentrations were zero. When water entered Compartment B, the concentration instantly rose and gradually approached the input concentration until it reached zero, when the water level returned to Compartment A. The water level did not reach Compartment C in these specific situations. As a result, the concentration always stayed zero. For the second configuration (b), Compartments A and B had 35 mg/L concentrations at first. Because the entrance came from Compartment B, in the first hour of filling, mixing occurred only in Compartment B. As a result, although Compartment B's concentration decreased to approach the inflow concentration, Compartment A's concentration remained unchanged. Whenever Compartment B was draining, water with a certain concentration flowed into Compartment A. The concentration in Compartment A lowered to maintain equilibrium. Since the water level reached Compartment C in the fourth hour, the concentration of the water increased rapidly.

Non-Conservative Material
A tank was divided into two compartments and had volumes of 500 m 3 and 650 m 3 , starting from the bottom. The simulation was carried out for a total of 10 h, with delta t (Δt) at 1 h. The flow rate at each hour is provided in Table 9. The decay constant K was taken as 0.5. Two arrangements (initial levels of water and initial concentrations) are presented in Figure 13.

Results and Discussion
Using the appropriate equations, the volume and concentrations were calculated at each time step. The volume and concentration graphs are presented as follows. Figure 14 shows  Since the water level reached Compartment C in the fourth hour, the concentration of the water increased rapidly.

Non-Conservative Material
A tank was divided into two compartments and had volumes of 500 m 3 and 650 m 3 , starting from the bottom. The simulation was carried out for a total of 10 h, with delta t (∆t) at 1 h. The flow rate at each hour is provided in Table 9. The decay constant K was taken as 0.5. Two arrangements (initial levels of water and initial concentrations) are presented in Figure 13. Since the water level reached Compartment C in the fourth hour, the concentration of the water increased rapidly.

Non-Conservative Material
A tank was divided into two compartments and had volumes of 500 m 3 and 650 m 3 , starting from the bottom. The simulation was carried out for a total of 10 h, with delta t (Δt) at 1 h. The flow rate at each hour is provided in Table 9. The decay constant K was taken as 0.5. Two arrangements (initial levels of water and initial concentrations) are presented in Figure 13.

Results and Discussion
Using the appropriate equations, the volume and concentrations were calculated at each time step. The volume and concentration graphs are presented as follows. Figure 14 shows

Results and Discussion
Using the appropriate equations, the volume and concentrations were calculated at each time step. The volume and concentration graphs are presented as follows. Figure 14 shows  Figure 15 illustrates the graph of concentration as a function of time. (a) Unlike the conservative material, the concentration changed not only because of mixing, but also as a result of the effect of decay constant K. Initially, the concentration in Compartment A was 20 mg/L. The concentration inside the tank began to rise, approaching the higher inlet concentration of 25mg/L. However, because of the decay constant K, it instantly began to decline. If new water entered the tank with an inlet concentration that was higher than the concentration inside the tank, the concentration rose to maintain equilibrium. This may be seen in the graphs for the second, fourth, seventh, and ninth hours. (b) Initially, the concentrations in Compartments A and B were the same at 20 mg/L. Due to the decaying constant and the full initial volume, it began to decline instantly in Compartment A. In Compartment B, the concentration rose at first due to the higher input concentration but then fell due to the decaying constant. If new water entered the tank with an inlet concentration that was higher than the concentration inside the tank, the concentration rose to maintain equilibrium. This can be seen in the graph for Compartment B in the second, fourth, seventh, and ninth hours, and Compartment A in the first, fifth, and eighth hours. The decay constant prevented a full equilibrium like that of the conservative material. For all non-conservative materials, if the decay constant value k approached zero, the graph resembles that of a conservative material.   Figure 15 illustrates the graph of concentration as a function of time. (a) Unlike the conservative material, the concentration changed not only because of mixing, but also as a result of the effect of decay constant K. Initially, the concentration in Compartment A was 20 mg/L. The concentration inside the tank began to rise, approaching the higher inlet concentration of 25mg/L. However, because of the decay constant K, it instantly began to decline. If new water entered the tank with an inlet concentration that was higher than the concentration inside the tank, the concentration rose to maintain equilibrium. This may be seen in the graphs for the second, fourth, seventh, and ninth hours. (b) Initially, the concentrations in Compartments A and B were the same at 20 mg/L. Due to the decaying constant and the full initial volume, it began to decline instantly in Compartment A. In Compartment B, the concentration rose at first due to the higher input concentration but then fell due to the decaying constant. If new water entered the tank with an inlet concentration that was higher than the concentration inside the tank, the concentration rose to maintain equilibrium. This can be seen in the graph for Compartment B in the second, fourth, seventh, and ninth hours, and Compartment A in the first, fifth, and eighth hours. The decay constant prevented a full equilibrium like that of the conservative material. For all non-conservative materials, if the decay constant value k approached zero, the graph resembles that of a conservative material.  Figure 15 illustrates the graph of concentration as a function of time. (a) Unlike the conservative material, the concentration changed not only because of mixing, but also as a result of the effect of decay constant K. Initially, the concentration in Compartment A was 20 mg/L. The concentration inside the tank began to rise, approaching the higher inlet concentration of 25mg/L. However, because of the decay constant K, it instantly began to decline. If new water entered the tank with an inlet concentration that was higher than the concentration inside the tank, the concentration rose to maintain equilibrium. This may be seen in the graphs for the second, fourth, seventh, and ninth hours. (b) Initially, the concentrations in Compartments A and B were the same at 20 mg/L. Due to the decaying constant and the full initial volume, it began to decline instantly in Compartment A. In Compartment B, the concentration rose at first due to the higher input concentration but then fell due to the decaying constant. If new water entered the tank with an inlet concentration that was higher than the concentration inside the tank, the concentration rose to maintain equilibrium. This can be seen in the graph for Compartment B in the second, fourth, seventh, and ninth hours, and Compartment A in the first, fifth, and eighth hours. The decay constant prevented a full equilibrium like that of the conservative material. For all non-conservative materials, if the decay constant value k approached zero, the graph resembles that of a conservative material.  The above answers were discovered using analytical methods, and the results were validated by comparing them to numerical finite difference methods. Once the differential equations were developed, rather than solving them analytically, a numerical finite difference method was applied to generate the concentration at each time step using the previous values for both arrangements given in Figures 10a and 13a. Figure 16 shows the numerical solution.
Water 2021, 13, x FOR PEER REVIEW 26 of 29 The above answers were discovered using analytical methods, and the results were validated by comparing them to numerical finite difference methods. Once the differential equations were developed, rather than solving them analytically, a numerical finite difference method was applied to generate the concentration at each time step using the previous values for both arrangements given in Figures 10a and 13a. Figure 16 shows the numerical solution. The numerical and analytical results for each compartment are nearly identical. Furthermore, if they are plotted on the same graph, they overlap. This is because analytical solutions are the exact solutions derived from a differential equation with a constant coefficient and are separable rather than approximation solutions.

Field Example
To test the model, empirical data was taken from the previous study conducted by [11]. The obtained field data was a part of a large-scale field investigation conducted in [4]. The concentrations of the tracers were measured at the inlet and outlet of the tank. The research was carried out in the Cherry Hill Brushy Plains service area, which is virtually exclusively residential, with single-family homes and apartment/condominium units. The Cherry Hill pump station pumps water from the Saltonstall system into the service area. The Brushy Plains tank provides storage inside the Cherry Hill Brushy Plains service region. The pumps' operation is dictated by the water level in the Brushy Plains tank, which has a volume of 3790 m 3 . The pumps are configured to activate when the water height in the tank lowers to 17.0 m, and to turn off when the elevation reaches 19.7 m in typical conditions. The fluoride feed was shut off at the Saltonstall plant, which supplies the system to record the fluoride residual.
The study in [11] used a three-compartment model, with the bottom and top compartments presumed to be dead zones. Only in the middle did the volume shift. This was relaxed on this model by allowing every compartment to change its volume according to the flow. After regressing the calculated outcomes against the observed data from the effluent data and calculating the relevant R-squares, the 30-40-30 arrangement was discovered to be the best fit [11]. 3030 m 3 of water was initially present in the tank. The fluoride content (conservative species) was 0.95 mg/L at the start. The flows were time dependent.
To fit into the model developed, an average was taken. The input variables were applied to the model developed. Figure 17 shows the calculated fluoride residuals with respect to time. A comparison was made with the field results found in the same study in Figure 18. The red dots in Figure 18 present some of the results found from the field measurements. The numerical and analytical results for each compartment are nearly identical. Furthermore, if they are plotted on the same graph, they overlap. This is because analytical solutions are the exact solutions derived from a differential equation with a constant coefficient and are separable rather than approximation solutions.

Field Example
To test the model, empirical data was taken from the previous study conducted by [11]. The obtained field data was a part of a large-scale field investigation conducted in [4]. The concentrations of the tracers were measured at the inlet and outlet of the tank. The research was carried out in the Cherry Hill Brushy Plains service area, which is virtually exclusively residential, with single-family homes and apartment/condominium units. The Cherry Hill pump station pumps water from the Saltonstall system into the service area. The Brushy Plains tank provides storage inside the Cherry Hill Brushy Plains service region. The pumps' operation is dictated by the water level in the Brushy Plains tank, which has a volume of 3790 m 3 . The pumps are configured to activate when the water height in the tank lowers to 17.0 m, and to turn off when the elevation reaches 19.7 m in typical conditions. The fluoride feed was shut off at the Saltonstall plant, which supplies the system to record the fluoride residual.
The study in [11] used a three-compartment model, with the bottom and top compartments presumed to be dead zones. Only in the middle did the volume shift. This was relaxed on this model by allowing every compartment to change its volume according to the flow. After regressing the calculated outcomes against the observed data from the effluent data and calculating the relevant R-squares, the 30-40-30 arrangement was discovered to be the best fit [11]. 3030 m 3 of water was initially present in the tank. The fluoride content (conservative species) was 0.95 mg/L at the start. The flows were time dependent. To fit into the model developed, an average was taken. The input variables were applied to the model developed. Figure 17 shows the calculated fluoride residuals with respect to time. A comparison was made with the field results found in the same study in Figure 18. The red dots in Figure 18 present some of the results found from the field measurements.  The good fit of the model-generated data to the field-measured data for fluoride supports the use of the compartment models to approximate tank mixing hydrodynamics. More field data and measurements are needed for more confirmation.

Conclusions
For anticipating system reactions and pollutant migration and fate, mathematical modeling is a useful tool. However, the majority of published model results are based on the assumption of complete and immediate material mixing. The physical processes that describe the complicated internal mixing and flow interchange characteristics that occur within distribution storage facilities have largely been overlooked.   The good fit of the model-generated data to the field-measured data for fluoride supports the use of the compartment models to approximate tank mixing hydrodynamics. More field data and measurements are needed for more confirmation.

Conclusions
For anticipating system reactions and pollutant migration and fate, mathematical modeling is a useful tool. However, the majority of published model results are based on the assumption of complete and immediate material mixing. The physical processes that describe the complicated internal mixing and flow interchange characteristics that occur within distribution storage facilities have largely been overlooked. The good fit of the model-generated data to the field-measured data for fluoride supports the use of the compartment models to approximate tank mixing hydrodynamics. More field data and measurements are needed for more confirmation.

Conclusions
For anticipating system reactions and pollutant migration and fate, mathematical modeling is a useful tool. However, the majority of published model results are based on the assumption of complete and immediate material mixing. The physical processes that describe the complicated internal mixing and flow interchange characteristics that occur within distribution storage facilities have largely been overlooked.
This study presented a compartment model to characterize mixing behavior inside the tanks. A governing equation was formulated that was dependent on the inlet point and the level of water. The differential equations were solved through the analytical method, and their validity was compared with the results of the numerical solutions. The flows were traditional inflow/outflow methods where only one of them happens for specific delta t. Four example applications with two different arrangements were reviewed to apply the solutions. The solutions fit with the physical assumptions that the concentration inside the tanks either decreases or increases to approach the concentration that comes; it increased when the concentration inside the tank was less than the concentration that was coming and vice versa. Concentration changes happened either because of mixing water with two different concentrations or if there was a time-dependent inlet concentration. The analytical solutions were compared to numerical results and no differences were found; this is because the differential equation is solvable, and an exact solution can be found without approximation. This model can be incorporated into the optimization problem. Field data was applied to the model and there was a good fit between the results of the model and the field measurements.
The substances for the non-conservative material assumed in this paper were used in only two compartments, which identifies the potential future direction of this work. Further study can be done on a decaying material by adding compartment numbers. The model developed here can be incorporated into multi-objective optimization problems in water distribution system-related problems, such as the least costly design, operation, water age, and others.