1 Introduction

Pollution transport is one of the most significant problems in environmental engineering and mainly takes place as a result of advection, diffusion, and reactions in rivers. Simulation of such problems is mostly concerned with solving differential equations. Obtaining an analytical solution is not always possible, and therefore numerical methods are mostly used to solve these equations. On the other hand, a comprehensive model which is able to simulate the advection–diffusion process in a river physically, based on a familiar concept such as mass balance, may yield to establishment of a more well-defined scheme rather than those presented by numerical methods, typically. As physical sense can be highlighted in the model, implementing new initial and boundary conditions as well as the other desirable changes in the problem statement can be carried out in a more obvious framework.

Application of mass balance in completely mixed reactors for transport simulation has been used extensively by researchers (Hill and Root 2014; Carberry 2001; Jakobsen 2008; Mann 2009; Salmi et al. 2010; Davis and Davis 2012). Advection–diffusion simulation has been studied using feedforward and back-feed reactors by Chapra (1997). Dispersion effects have been addressed by Metcalf and Eddy (Burton et al. 2014). Effects of chemical reactions in pollutants fate using completely mixed reactors have been investigated by Hessel et al. (2004) and have been employed to indoor air quality simulations by Hayes (1991) and WHO (2015). As far as the authors are concerned, diffusion of pollution by completely mixed reactors has not been simulated using flow rates to/from a reactor in feedforward and back-feed systems.

In this study, it is shown that application of mass balance to a series of reactors transforms the transport equation into a system of linear equations. This transformation is equivalent to application of numerical methods for solving the governing partial differential equation (PDE) of mass transport. Existence of source/sink and reactions has also been formulated. Furthermore, these formulations are verified using several examples and comparing the results with the analytical solution.

2 Methodology and Formulation

2.1 Model Construction

It is assumed that pollution transport in a 1-D river may be simulated by a series of completely mixed reactors. In this model, each reactor is connected to its left and right reactors via pipes. Water storage and reactions take place in these reactors, and driving forces for pollution transport (i.e., diffusion and advection) are provided by implementing pumps.

2.1.1 Diffusion Simulation

Diffusion is a type of random motion where molecular movements to left and right have the same probability. In order to model diffusion in the proposed model, an arbitrary reactor (e.g., reactor i, shown in Fig. 1a) is connected to its adjacent reactors at its left and right (reactors i − 1 and i + 1) by two identical pumps: i, i + 1. Using this concept, transmission of pollution to left and right with the same probability is allowed. This process is applied for all other reactors, as shown in Fig. 1a, to model diffusion process in the whole domain. As pumps start working simultaneously, pollution transports from time 0 onward.

Fig. 1
figure 1

a Simulation of diffusion using completely mixed reactors in series. b Simulation of advection using completely mixed reactors in series. c Simulation of diffusion–advection in a 1-D domain using completely mixed reactors

2.1.2 Advection Simulation

Advection is the transport of pollution by bulk flow in river. In order to model advection (form left to the right part of the system), each reactor is connected to its right reactor via a pipe. The driving force for advection is provided by implementing a pump at downstream (the most right reactor) having a flow rate of QAdv (Fig. 1b). This layout allows the bulk transport of pollution from the left to the right of the system. Pollution concentration in the advective pipes is assumed to vary linearly.

2.1.3 Diffusion–Advection Simulation

By combination of the two mentioned systems, diffusion–advection may be modeled using a series of completely mixed reactors as shown in Fig. 1c.

2.2 Governing Equation

In order to derive the governing partial differential equation of the proposed model, it is assumed that the model consists of infinitely small reactors with a volume of dV. Since pollution varies linearly in the advective pipes, the concentration of pollution in these pipes is assumed to be the average of both their end concentrations. Mass balance equation for an interior reactor i shown in Fig. 2a is written as:

$$\dot{m}_{\text{in}} - \dot{m}_{\text{out}} = \frac{{{\text{d}}m}}{{{\text{d}}t}}.$$
(1)
Fig. 2
figure 2

a An element used for deriving the governing PDE of the model. b Discretized simulation of a 1-D domain using completely mixed reactors for obtaining the discretized governing equation of the model

Substituting QC for yields:

$$\dot{m}^{\text{D}}_{\text{in}} = Q_{\text{D}} \left( {C - \frac{\partial C}{\partial x}{\text{d}}x + \frac{1}{2}\frac{{\partial^{2} C}}{{\partial x^{2} }}{\text{d}}x^{2} } \right) + Q_{\text{D}} \left( {C + \frac{\partial C}{\partial x}{\text{d}}x + \frac{1}{2}\frac{{\partial^{2} C}}{{\partial x^{2} }}{\text{d}}x^{2} } \right)$$
(2)
$$\dot{m}^{\text{D}}_{\text{out}} = 2Q_{\text{D}} C$$
(3)
$$\dot{m}^{\text{Adv}}_{\text{in}} = Q_{\text{A}} \left( {\bar{C}_{\text{Left}} } \right)$$
(4)
$$\dot{m}^{\text{Adv}}_{\text{out}} = Q_{\text{A}} \left( {\bar{C}_{\text{Right}} } \right).$$
(5)

Simplification of the above equations results in:

$$\begin{aligned} & Q_{\text{D}} \left( {C - \frac{\partial C}{\partial x}{\text{d}}x + \frac{1}{2}\frac{{\partial^{2} C}}{{\partial x^{2} }}{\text{d}}x^{2} } \right) - 2Q_{\text{D}} C + Q_{\text{D}} \left( {C + \frac{\partial C}{\partial x}{\text{d}}x + \frac{1}{2}\frac{{\partial^{2} C}}{{\partial x^{2} }}{\text{d}}x^{2} } \right) + \\ & Q_{\text{A}} \left( {\bar{C}_{\text{Left}} } \right) - Q_{\text{A}} \left( {\bar{C}_{\text{Right}} } \right) = \frac{\partial C}{\partial t}{\text{d}}V \to \\ & Q_{\text{D}} \left( {C - \frac{\partial C}{\partial x}{\text{d}}x + \frac{1}{2}\frac{{\partial^{2} C}}{{\partial x^{2} }}{\text{d}}x^{2} } \right) - 2Q_{\text{D}} C + Q_{\text{D}} \left( {C + \frac{\partial C}{\partial x}{\text{d}}x + \frac{1}{2}\frac{{\partial^{2} C}}{{\partial x^{2} }}{\text{d}}x^{2} } \right) + \\ & Q_{\text{A}} \left( {C - \frac{1}{2}\frac{\partial C}{\partial x}{\text{d}}x + \frac{1}{4}\frac{{\partial^{2} C}}{{\partial x^{2} }}{\text{d}}x^{2} } \right) - Q_{\text{A}} \left( {C + \frac{1}{2}\frac{\partial C}{\partial x}{\text{d}}x + \frac{1}{4}\frac{{\partial^{2} C}}{{\partial x^{2} }}{\text{d}}x^{2} } \right) = \frac{\partial C}{\partial t}{\text{d}}V \\ \end{aligned}$$
(6)

Simplification of Eq. (6) results in:

$$\left( {\frac{{Q_{\text{D}} {\text{d}}x^{2} }}{{{\text{d}}V}}} \right)\frac{{\partial^{2} C}}{{\partial x^{2} }} - \left( {\frac{{Q_{\text{A}} {\text{d}}x}}{{{\text{d}}V}}} \right)\frac{\partial C}{\partial x} = \frac{\partial C}{\partial t}{\text{d}}V$$
(7)

which shows that the governing equation for the proposed model is identical to the diffusion advection equation.

2.3 Discretization of the Governing Equation

In order to solve Eq. (7), one may use numerical methods to discretize this equation both spatially and temporally. In this research, however, a new procedure is followed for spatially discretizing Eq. (7). Writing mass balance equation for an arbitrary reactor (i), shown in Fig. 2b, yields:

$$Q_{\text{Diff}} C_{i - 1} - Q_{\text{Diff}} 2C_{i} + Q_{\text{Diff}} C_{i + 1} + Q_{\text{Adv}} \left( {\frac{{C_{i - 1} + C_{i} }}{2}} \right) - Q_{\text{Adv}} \left( {\frac{{C_{i} + C_{i + 1} }}{2}} \right) = \frac{{\partial C_{i} }}{\partial t}V_{i} .$$
(8)

Simplification of Eq. (8) yields:

$$\frac{{Q_{\text{Diff}} }}{{V_{i} }}\left( {C_{i - 1} - 2C_{i} + C_{i + 1} } \right) - \frac{{Q_{\text{Adv}} }}{{V_{i} }}\left( {\frac{{C_{i + 1} - C_{i - 1} }}{2}} \right) = \frac{{{\text{d}}C_{i} }}{{{\text{d}}t}}.$$
(9)

Application of Eq. (9) to all interior nodes yields a system of linear first-order differential equations which leads to closure when considering the boundary nodes. The time derivative in Eq. (9) and similar equations may be evaluated using forward, backward or Crank–Nicolson finite difference schemes.

2.4 Boundary Nodes

In order to write mass balance equation for boundary reactors, two types of boundaries are investigated in this research: infinite source and impermeable boundary.

  • Infinite source: when a boundary is an infinite source such as lakes, concentration in this boundary is specified and constant over time (Fig. 3a).

    Fig. 3
    figure 3

    a Simulation of an infinite source (Dirichlet boundary condition) using the proposed model. b Simulation of an impermeable boundary conditions by the proposed model

    In order to model this boundary, the reactor at that boundary is considered to have an infinite volume with a constant concentration. Inflow and outflow to and from this reactor do not change its volume nor its concentration. Application of mass balance to this reactor yields:

    $$\frac{{Q_{\text{Diff}} }}{{V_{1} }}\left( { - C_{1} + C_{2} } \right) - \frac{{Q_{\text{Adv}} }}{{V_{1} }}\left( {\frac{{C_{1} + C_{2} }}{2}} \right) = \frac{{{\text{d}}C_{i} }}{{{\text{d}}t}}$$
    (10)

    As the volume of the boundary reactor approaches infinity, the left-hand side of the above equation becomes zero, reflecting the fact that the concentration of the reactor remains constant over time.

  • Impermeable boundary implies the existence of an impermeable barrier at the end of a river, such as a rock. Flow and pollution flux are zero across this boundary, and as a result there would be no advection in the domain. To model this boundary using complete mix reactors, the reactor at this boundary (reactor 1) is not connected to any exterior reactor, as shown in Fig. 3b, resulting in no outward flux conditions.

    Application of mass balance for the considered reactor results:

    $$\frac{{Q_{\text{Diff}} }}{{V_{1} }}\left( { - C_{1} + C_{2} } \right) - \frac{{Q_{\text{Adv}} }}{{V_{1} }}\left( {\frac{{C_{1} + C_{2} }}{2}} \right) = \frac{{{\text{d}}C_{i} }}{{{\text{d}}t}}.$$
    (11)

2.5 Forcing Function

This term is called source/sink in environmental modeling and may be a point source/sink or a distributed source/sink term. These terms imply any external pollution recharge or discharge to or from a reactor. In order to model a point source/sink, mass balance is simply written for that reactor (e.g., reactor i). For a distributed source/sink, the forcing function is integrated over the midpoint of the pipe i − 1, i to the midpoint of pipe i, i + 1 and then replaced as a point source exerted on reactor i.

$$Q_{\text{Diff}} C_{i - 1} - Q_{\text{Diff}} 2C_{i} + Q_{\text{Diff}} C_{i + 1} + Q_{\text{Adv}} \left( {\frac{{C_{i - 1} + C_{i} }}{2}} \right) - Q_{\text{Adv}} \left( {\frac{{C_{i} + C_{i + 1} }}{2}} \right) \pm S_{i} = \frac{{\partial C_{i} }}{\partial t}V_{i}$$
(12)
$$\frac{{Q_{\text{Diff}} }}{{V_{i} }}\left( {C_{i - 1} - 2C_{i} + C_{i + 1} } \right) + \frac{{Q_{\text{Adv}} }}{{V_{i} }}\left( {\frac{{C_{i + 1} - C_{i - 1} }}{2}} \right) \pm \frac{{S_{i} }}{{V_{i} }} = \frac{{{\text{d}}C_{i} }}{{{\text{d}}t}}.$$
(13)

2.6 Reaction

This implies any mass generation or loss due to reactions depending on the concentration. The most common example is retardation pollution. Assuming a mass decay rate of kCn, mass balance equation for reactor i is written as:

$$Q_{\text{Diff}} C_{i - 1} - Q_{\text{Diff}} 2C_{i} + Q_{\text{Diff}} C_{i + 1} + Q_{\text{Adv}} \left( {\frac{{C_{i - 1} + C_{i} }}{2}} \right) - Q_{\text{Adv}} \left( {\frac{{C_{i} + C_{i + 1} }}{2}} \right) - kC_{i}^{n} V_{i} = \frac{{\partial C_{i} }}{\partial t}V_{i}$$
(14)
$$\frac{{Q_{\text{Diff}} }}{{V_{i} }}\left( {C_{i - 1} - 2C_{i} + C_{i + 1} } \right) + \frac{{Q_{\text{Adv}} }}{{V_{i} }}\left( {\frac{{C_{i + 1} - C_{i - 1} }}{2}} \right) - kC_{i}^{n} = \frac{{{\text{d}}C_{i} }}{{{\text{d}}t}},$$
(15)

where k is the decay rate and n is an exponent indicating the order of reaction.

3 Examples and Results

In order to illustrate how the proposed model may be employed for solving pollution transport and also to show its capabilities, several diffusion advection examples are solved.

3.1

In this example, at first advection diffusion in a domain with homogeneous Dirichlet boundary conditions and a point source at the center are considered:

$$\begin{aligned} & \frac{\partial C}{\partial t} = D\frac{{\partial^{2} C}}{{\partial x^{2} }} - u\frac{\partial C}{\partial x} + \delta \left( {x - 5} \right)\delta \left( t \right) \\ & C\left( {0,t} \right) = 0;\quad C\left( {10,t} \right) = 0;\quad C\left( {x,0} \right) = 0. \\ \end{aligned}$$

Simulation of this example using the proposed model is illustrated in Fig. 4.

Fig. 4
figure 4

Simulation of example 1 using completely mixed reactors

In order to solve this example, the problem is discretized using 11 reactors (9 interior reactors and 2 boundary reactors). The reactors are assumed to have a unit volume, V = 1, and ∆x is considered to be 1. Application of Eqs. (9), (10), and (13) to interior reactors, boundary reactors, and the reactor with the source term, respectively, results:

$$Q_{\text{Diff}} \left( {C_{i - 1} - 2C_{i} + C_{i + 1} } \right) - Q_{\text{Adv}} \left( {\frac{{C_{i + 1} - C_{i - 1} }}{2}} \right) = \frac{{{\text{d}}C_{i} }}{{{\text{d}}t}}\quad \quad i = 2{\text{ to }}10$$
(16)
$$\begin{array}{*{20}l} {\frac{{Q_{\text{Diff}} }}{{V_{1} }}\left( { - C_{1} + C_{2} } \right) - \frac{{Q_{\text{Adv}} }}{{V_{1} }}\left( {\frac{{C_{1} + C_{2} }}{2}} \right) = \frac{{{\text{d}}C_{1} }}{{{\text{d}}t}}} \hfill \\ {\frac{{Q_{\text{Diff}} }}{{V_{11} }}\left( { - C_{11} + C_{10} } \right) - \frac{{Q_{\text{Adv}} }}{{V_{11} }}\left( {\frac{{C_{10} + C_{11} }}{2}} \right) = \frac{{{\text{d}}C_{11} }}{{{\text{d}}t}}} \hfill \\ \end{array} \quad \quad {\text{Boundary reactors}}$$
(17)
$$Q_{\text{Diff}} \left( {C_{5} - 2C_{6} + C_{7} } \right) + Q_{\text{Adv}} \left( {\frac{{C_{7} - C_{5} }}{2}} \right) + 1 = \frac{{{\text{d}}C_{6} }}{{{\text{d}}t}}\quad \quad {\text{Source reactor}} .$$
(18)

In Eq. (3), V1 and V11 are assumed to have an infinite volume. For numerical purposes, their volume is assumed to be 1000. Application of the above equations results in a first-order system of linear differential equations. Using forward finite difference over time with a time step of ∆t = 0.01 s, the solutions may be obtained. The results for D = 1 m2/s and u = 0.0, 1.0, and 2.0 m/s are shown in Fig. 5.

Fig. 5
figure 5

Concentration plot versus time for the diffusion–advection problem in example 1 using the proposed model. D = 1 m2/s, u = 0 and 1.0 m/s

It is observed that the results are in good agreement with the analytical solution. The plot shows that in the absence of advection the distribution of concentration is symmetric, indicating that there is a symmetric diffusion. The plot also shows that as time increases the concentration through the entire domain dampens. The plot also depicts that in case of advection, concentration is deviated to the right as the result of velocity.

As the 2nd part of this example, it is assumed that the pollution decays by a first-order reaction and a reaction constant of 0.1 s−1, n = 1, k = 0.1 s−1. Application of Eq. (15) for interior, boundary, and central reactors yields:

$$Q_{\text{Diff}} \left( {C_{i - 1} - 2C_{i} + C_{i + 1} } \right) - Q_{\text{Adv}} \left( {\frac{{C_{i + 1} - C_{i - 1} }}{2}} \right) - kC_{i} = \frac{{{\text{d}}C_{i} }}{{{\text{d}}t}}\quad \quad i = 2{\text{ to }}10,i \ne 6$$
(19)
$$\begin{array}{*{20}l} {\frac{{Q_{\text{Diff}} }}{{V_{1} }}\left( { - C_{1} + C_{2} } \right) - \frac{{Q_{\text{Adv}} }}{{V_{1} }}\left( {\frac{{C_{1} + C_{2} }}{2}} \right) - kC_{i} = \frac{{{\text{d}}C_{1} }}{{{\text{d}}t}}} \hfill \\ {\frac{{Q_{\text{Diff}} }}{{V_{11} }}\left( { - C_{11} + C_{10} } \right) - \frac{{Q_{\text{Adv}} }}{{V_{11} }}\left( {\frac{{C_{10} + C_{11} }}{2}} \right) - kC_{11} = \frac{{{\text{d}}C_{11} }}{{{\text{d}}t}}} \hfill \\ \end{array} \quad \quad {\text{Boundary reactors}}$$
(20)
$$\frac{{Q_{\text{Diff}} }}{{V_{6} }}\left( {C_{5} - 2C_{6} + C_{7} } \right) + \frac{{Q_{\text{Adv}} }}{{V_{6} }}\left( {\frac{{C_{7} - C_{5} }}{2}} \right) + \frac{1}{{V_{6} }} - kC_{i} = \frac{{{\text{d}}C_{6} }}{{{\text{d}}t}}\quad \quad {\text{Source reactor}} .$$
(21)

The results for D = 1 m2/s, u = 1 m/s and values of 0.1 and 0.5 s−1 for k are shown in Fig. 6 and show the capability of the model for considering reactions in diffusion advection problems. The root-mean-square error (RMSE) over the entire domain for this example (for the two parts) at different times is reported in Table 1. The results justify employing completely mixed reactors for advection diffusion simulation.

Fig. 6
figure 6

Concentration plot versus time using the proposed model for simulating diffusion advection problem with D = 1 m2/s, u = 1 m/s and a linear retardation term and decay coefficient of k = 0.01, 0.1, and 0.5 s−1

Table 1 RMSEs obtained for specified values of decay coefficient rate at different velocities times using the proposed model

It is seen that when the retardation term increases, the concentration of pollution decreases throughout the entire domain.

3.2

The second problem considers an advection diffusion problem with a first-order decay reaction, a non-homogeneous boundary condition at the left end, and a homogeneous boundary condition at the other end. Since the pollution decays, the left boundary condition does not remain constant over time:

$$\begin{aligned} & \frac{\partial C}{\partial t} = D\frac{{\partial^{2} C}}{{\partial x^{2} }} - u\frac{\partial C}{\partial x} - kC \\ & C\left( {0,t} \right) = 1e^{ - kt} ;\quad C\left( {10,t} \right) = 0;\quad C\left( {x,0} \right) = 0. \\ \end{aligned}$$

In order to solve this problem, the same procedures described in the previous example are followed for all reactors except for the left one. This problem is shown in Fig. 7.

Fig. 7
figure 7

Discretization of the second example using the proposed model

Since the concentration in the left boundary reactor decays linearly with time, mass balance application to this reactor results in:

$$\frac{{Q_{\text{Diff}} }}{{V_{1} }}\left( { - C_{1} + C_{2} } \right) - \frac{{Q_{\text{Adv}} }}{{V_{1} }}\left( {\frac{{C_{1} + C_{2} }}{2}} \right) - kC_{1} = \frac{{{\text{d}}C_{1} }}{{{\text{d}}t}}$$
(22)

where V1 is considered to be 1000 times Vi. The results of solving this problem using the proposed model are shown in Fig. 8 and given in Table 2.

Fig. 8
figure 8

Concentration plot versus time using the proposed model for simulating diffusion advection problem with a linear retardation term and decay coefficient of k = 0, 0.1, and 1 s−1

Table 2 RMSEs obtained by employing the proposed model to example 2

The plot shows that as time increases from 0 to 3, concentration is pushed to the right side because of the velocity. It also indicates that as the retardation term increases, due to the degradation of the pollution, the concentration decreases.

As in the previous example, the results verify the application of the proposed model as a numerical method for modeling transport processes.

3.3

The third example considers diffusion problem in a domain where the right boundary condition is an impermeable boundary. Because of the no flux condition, no advection may be present. This problem is stated as:

$$\begin{aligned} & \frac{\partial C}{\partial t} = D\frac{{\partial^{2} C}}{{\partial x^{2} }} - kC \\ & C\left( {0,t} \right) = 1e^{ - kt} ;\quad \frac{{\partial C\left( {10,t} \right)}}{\partial x} = 0;\quad C\left( {x,0} \right) = 0. \\ \end{aligned}$$

This simulation of this example is shown in Fig. 9.

Fig. 9
figure 9

Discretization of the third example using the proposed model

The procedure for solving this problem is the same as the two previous problems except for the rightmost reactor which models the no flux boundary condition. As is shown in Fig. 3b, the reactor in the right side of the boundary is only connected to the reactor at its left, imitating the no flux boundary condition. Formulation of all reactors is the same as in the previous problems except for the rightmost reactor which is:

$$\frac{{Q_{\text{Diff}} }}{{V_{11} }}\left( { - C_{11} + C_{10} } \right) - kC_{11} = \frac{{{\text{d}}C_{11} }}{{{\text{d}}t}}.$$
(23)

The results of solving this problem are shown in Fig. 10 and given in Table 3.

Fig. 10
figure 10

Concentration plot versus time using the proposed model for simulating diffusion advection problem with a linear retardation term and decay coefficient of k = 0, 0.1, and 1

Table 3 RMSEs obtained for the 3rd example using the proposed model

This graph again shows the effects of retardation term on the reduction in concentration in the domain.

4 Conclusion

In this research, it was shown how to simulate diffusion advection transport with a retardation and a source/sink term using a series of completely mixed reactors in a 1-D domain such as rivers. By application of mass balance for each reactor, a system of first-order linear differential equations with respect to time was obtained. The system which was a spatially discretized form of the PDE governing pollution transport may then be solved to obtain the results of such simulations. In order to show the capabilities of the proposed model, three different examples were solved and root-mean-square errors were obtained. The results of the three examples showed that the solution obtained by the proposed model is in a good agreement with the analytical solutions. It can be confirmed that pollution transport in a 1-D domain including a retardation and/or a sink/source can be modeled using the proposed scheme accurately, along with a high degree of flexibility in imposing different conditions with more aspects of physical sense.