1 Introduction

Water is directly and indirectly vital to humanity. From drinking water, sanitation and agriculture to building infrastructures, manufacturing and religion, water is shaping our everyday life. Moreover, not only historically “the availability of water … has been considered an essential part of a civilized way of life in different periods” (Vuorinen et al. 2007), but still water scarcity is one of the main problems of humanity, as its lack is considered to accelerate diseases’ spread and to cause millions of deaths every year (Montgomery and Elimelech 2007). Climate change seems to aggravate water scarcity on a global scale.

In this framework, optimal management of water resources, including both the supply and the demand side of the water balance (Rijsberman 2006) is a high priority issue. For this reason, the respective bibliography is quite large. A substantial part of it is dedicated to groundwater resources. The respective problems can be broadly classified in two groups: a) maximization of pumping rate under physical or financial constraints and b) minimization of pumping cost of the total flow rate from a system of wells (probably combined with other cost items). This group includes also aquifer restoration problems, where groundwater pumping cost is the main cost item (Matott et al. 2006; Kontos 2013), and problems of controlling high groundwater levels (Bayer et al. 2009).

Groundwater management optimization problems have many forms; for this reason, many optimization methods (and combinations of them) have been used to address them, ranging from versions of linear and non-linear programming (Theodossiou 2004; Bostan et al. 2016; Mani et al. 2016; Seo et al. 2018) to evolutionary techniques, which have gained popularity in the last decades (Nicklow et al. 2010; Tsai 2010; Ghadimi and Ketabchi 2019) and combinations of them with other techniques (Karterakis et al. 2007; Khadem and Afshar 2015; Alizadeh et al. 2017; Moutsopoulos et al. 2017).

In most cases, and for both classes of problems, groundwater flow simulation is part of the optimization procedure and may determine the difficulty of the respective optimization problem (Singh and Panda 2013). In certain cases, surrogate models are used to alleviate the computational burden, in particular when coastal or karst aquifers are involved (Sreekanth and Datta 2014; Ketabchi and Ataie-Ashtiani 2015; Christelis and Mantoglou 2019).

Analytical solutions for pumping cost minimization problems, are rather few, to our knowledge. Katsifarakis (2008) studied the cost K to pump a given total flow rate QT from any number and layout of wells, up to a predefined constant level. He assumed steady-state flow in confined infinite and semi-infinite aquifers (using the method of images for the latter) and he ignored friction losses in the well pipes. He proved that K is minimized, when hydraulic head levels at all wells are equal to each other, as long as flow is due to the examined system of wells only. Finally, he presented an analytical calculation procedure of the optimal distribution of QT to the individual wells, through solution of a linear system of equations.

Using similar assumptions and the method of images, Katsifarakis and Tselepidou (2009) extended the aforementioned work to aquifers with two zones of different transmissivities and found similar results. Then they took into account regional flow, independent of the operation of the wells. In this more general case, they proved that pumping cost is minimized, when final differences between hydraulic head values at the locations of the wells, resulting from superposition of the regional flow and the operation of the well system, are equal to the half of those, which are due to the regional flow only. Finally, they presented an analytical calculation procedure of the optimal distribution of QT to the individual wells.

Ahlfeld and Laverty (2011), using a matrix formulation, have come up with similar results, even for laterally confined flow fields, assuming that the groundwater flow equation is linear, the boundary conditions are not head-dependent and the response matrix of drawdown to pumping is symmetric. Its coefficients have to be calculated numerically. Moreover, symmetry of the numerical model coefficient matrix is a prerequisite. Their proof holds for transient flows with constant well flow rates, under the same assumptions. Later on, the authors have tested their formulation on a hypothetical problem, which was based on an aquifer with complex hydrogeology and large drawdowns in California, USA (Ahlfeld and Laverty 2015).

Katsifarakis et al. (2018) have extended the results of Katsifarakis and Tselepidou (2009) to transient pumping from a system of wells. The transient flow is superposed with a regional steady-state flow, resulting in different initial hydraulic head values at the locations of the wells. The authors proved that, at any time, the instant pumping cost is minimum, when the observed at that instant differences between hydraulic heads at the wells are equal to the half of the initial ones. Moreover, as well flow rates usually remain constant over the pumping period, they have outlined an approximate calculation of the optimal constant flow rate distribution.

Nikoletos (2020) has extended results of Katsifarakis et al. (2018) to stepwise or intermittent pumping from a system of wells and to alternate pumping from groups of wells.

In this paper we present a new analytical solution for pumping cost minimization. We take into account: a) Hydraulic head level drawdown and initial head levels at the wells, as in existing solutions and b) Friction losses in the pipe network, which connects the pumping wells to a central water tank. This problem is more complicated, since the cost function is a 3rd degree polynomial and there are many local optima, as discussed in the following sections. To our knowledge, no analytical solution has been presented up to now, taking into account both groundwater and pipe flow.

2 Mathematical Formulation of the Problem

2.1 The Objective Function

The problem is stated as follows: Minimize the cost Ktot to pump a given total flow rate qtot from any number and layout of wells up to a tank, under steady-state flow conditions. Take into account hydraulic head level drawdown due to pumping and initial head levels at the wells, together with friction losses at the pipe network that connects the wells with the tank.

For convenience, Ktot can be written as:

$$ {K}_{tot}=b\left({K}_{dr}+{K}_{el}+{K}_{trans}\right) $$
(2.1)

where b depends on energy cost.

Kdr accounts for hydraulic head level drawdown due to the operation of the well system and is expressed as:

$$ {K}_{dr}=\sum \limits_{j=1}^n{q}_j\ {s}_j $$
(2.2)

where n is the number of wells, sj the hydraulic head level drawdown at well j and qj its flow rate.

Kel accounts for the difference δj between water level at the tank (in practice an average level could be used) and initial hydraulic head level at each well (δj = ztank - zj). It is given as:

$$ {K}_{el}=\sum \limits_{\mathrm{j}=1}^{\mathrm{n}}{q}_j\ {\updelta}_{\mathrm{j}} $$
(2.3)

Finally, Ktrans accounts for hydraulic head losses at the pipe network and is given as:

$$ {K}_{trans}=\sum \limits_{\mathrm{i}=1}^{\mathrm{n}}{Q}_i\ {hf}_i $$
(2.4)

where Qi is flow rate through pipe i and hfi the respective head loss.

If we consider that b in Eq. 2.1 is constant, namely that pump efficiencies are constant and equal to each other, the objective function K1tot of the minimization problem reduces to:

$$ K{1}_{tot}={K}_{dr}+{K}_{el}+{K}_{trans} $$
(2.5)

2.2 The Groundwater Flow

In order to calculate Kdr we consider steady-state flow in infinite confined aquifers or semi-infinite ones to which the method of images applies (Katsifarakis 2008). Then, sj in Eq. (2.2) is given as:

$$ {s}_j=-\frac{1}{2\pi \mathrm{T}}\sum \limits_{\mathrm{k}=1}^{\mathrm{n}}{q}_k\ln \left(\frac{{\mathrm{r}}_{\mathrm{k},\mathrm{j}}}{\mathrm{R}}\right) $$
(2.6.a)
$$ {s}_j=-\frac{1}{2\pi \mathrm{T}}\sum \limits_{\mathrm{k}=1}^{\mathrm{n}}{q}_k\ln \left(\frac{{\mathrm{r}}_{\mathrm{k}\mathrm{j}}{\overset{\prime }{\mathrm{r}}}_{\mathrm{k}\mathrm{j}}}{{\mathrm{R}}^2}\right) $$
(2.6.b)
$$ {s}_j=-\frac{1}{2\pi \mathrm{T}}\sum \limits_{\mathrm{k}=1}^{\mathrm{n}}{q}_k\ln \left(\frac{{\mathrm{r}}_{\mathrm{k}\mathrm{j}}}{{\overset{\prime }{\mathrm{r}}}_{\mathrm{k}\mathrm{j}}}\right) $$
(2.6.c)

In Eqs (2.6a,b,c) T represents aquifer’s transmissivity, R the radius of influence, rkj the distance between wells j and k, and \( \overset{\overset{\acute{\mkern6mu}}{\kern0.333em }}{r_{kj}} \) the distance between well j and the image of well k. Eq. (2.6a) holds for infinite aquifers, while (2.6b) and (2.6c) for semi-infinite ones, bounded by an impermeable or a constant head boundary, respectively.

2.3 The Pipe Network

To calculate Ktrans we use the Darcy–Weisbach formula for each pipe; according to it, hfi in Eq. (2.4) is given as:

$$ {hf}_i=\frac{8{\mathrm{L}}_{\mathrm{i}}{\mathrm{f}}_{\mathrm{i}}}{{\mathrm{D}}_{\mathrm{i}}^5\mathrm{g}{\pi}^2}{Q}_i^2 $$
(2.7)

where Di is the diameter of pipe i, Li its length and fi the friction coefficient. Then, we can define a constant term ξi for each pipe, given as:

$$ {\upxi}_{\mathrm{i}}=\frac{8\ {\mathrm{f}}_{\mathrm{i}}\ {\mathrm{L}}_{\mathrm{i}}\ }{{\mathrm{D}}_{\mathrm{i}}^5\mathrm{g}\ {\uppi}^2} $$
(2.8)

and hfi can be written as:

$$ {hf}_i={\upxi}_{\mathrm{i}}\ast {Q}_i^2 $$
(2.9)

Moreover, combining Eqs (2.9) and (2.4), we get:

$$ {K}_{trans}=\sum \limits_{\mathrm{i}=1}^{\mathrm{n}}{\upxi}_{\mathrm{i}}\ {Q}_i^3 $$
(2.10)

Regarding the structure of the pipe network, we assume that each pipe connects a well with another or directly with the water tank, namely we allow pipe connections at the locations of the wells only. In the following analysis pipes are named after the corresponding well, namely the pipe starting for well Wa is termed Pa.

Flow rate Qa of pipe Pa “carries” the flow rate qa of well Wa, plus the flow rates of all the “upstream” wells, which are connected directly or indirectly to Wa through the pipe network. This way each Qi is the sum of certain well flow rates qj. To express this relationship, we introduce a matrix C, with elements “ci,,j”. If Pi carries water pumped from well Wj, then ci, j = 1, otherwise ci, j = 0. Then, Q values can be calculated from the q ones, using the following matrix:

$$ \left(\begin{array}{c}\begin{array}{c}{Q}_1\\ {}\vdots \\ {}\vdots \end{array}\\ {}\vdots \\ {}{Q}_n\end{array}\right)=\left(\begin{array}{c}\begin{array}{c}\begin{array}{ccc}{\mathrm{c}}_{1,1}& \cdots & {\mathrm{c}}_{1,\mathrm{n}}\\ {}{\mathrm{c}}_{2,1}& \cdots & {\mathrm{c}}_{2,\mathrm{n}}\end{array}\\ {}\vdots \kern0.5em \ddots \kern0.5em \vdots \\ {}\vdots \kern0.5em \ddots \kern0.5em \vdots \end{array}\\ {}\begin{array}{ccc}{\mathrm{c}}_{\mathrm{n},1}& \cdots & {\mathrm{c}}_{\mathrm{n},\mathrm{n}}\end{array}\end{array}\right)\left(\begin{array}{c}\begin{array}{c}{q}_1\\ {}\vdots \\ {}\vdots \end{array}\\ {}\vdots \\ {}{q}_n\end{array}\right) $$
(2.11)

Next, we introduce the notion of the “path” Sj of well flow rate qj: Sj includes all pipes Pi through which water pumped from well Wj flows to the tank. There is only one path for each qj, but a pipe Pi may belong to more than one paths.

Using the previous definitions, we can see that: 1) The elements ci,i that belong to the diagonal of matrix C, are larger than zero, because Qa is at least equal to qa. 2) The matrix is not symmetric. 3) If ci, j = 0,  ∀ i, j & i ≠ j, then every well is directly connected to the water tank and obviously Qi = qj. 4) ci, j = 1 ⟺ Pi ∈ Sj.

2.4 Decision Variables and Constraints

Since Qi can be expressed as sums of qj values, we have chosen the n well flow rates qj as decision variables. They are not independent from each other, though, since they are subject to the following constraint:

$$ \sum \limits_{j=1}^n{q}_j={q}_{tot} $$
(2.12)

We can assume, without loss of generality, that for j ϵ [1, n-1] the respective qj are independent variables, while the flow rate of well n (qn) depends upon all the rest, namely:

$$ {q}_n={q}_{tot}-\sum \limits_{j=1}^{n-1}{q}_j $$
(2.13)

It follows that:

$$ \frac{\partial {q}_j}{\partial {q}_j}=1,\kern0.5em \frac{\partial {q}_n}{\partial {q}_j}=-1\kern1em \forall j\in \left[1,n-1\right] $$
(2.14.a)
$$ \frac{\partial {q}_i}{\partial {q}_j}=0\kern1em \forall i,j\in \left[1,n-1\right]\&\kern0.5em i\ne j $$
(2.14.b)

Additionally, for a solution to be feasible, the following constraints should hold:

$$ {q}_j\ge 0\kern0.5em \forall j\in \left[1,n\right] $$
(2.15)

It results, from constraints (2.12) and (2.15) that:

$$ {q}_j\le {q}_{tot}\kern0.5em \forall j\in \left[1,n\right] $$
(2.16)

It results from Eqs. (2.15) and (2.16) that the feasible region is convex.

Moreover, it results from constraint (2.15) that for feasible solutions all Qi are non-negative.

3 Solution of the Cost Minimization Problem

3.1 Critical Points of the Objective Function

To solve the cost minimization problem, the critical points of the objective function K1tot should be found. Its derivatives with respect to qm, for m = 1 to n-1, should be calculated first. Since K1tot is the sum of Kdr, Kel and Ktrans, the respective calculations can be performed separately for each term.

According to Katsifarakis and Tselepidou (2009), for sj given by any of Eqs. (2.6a,b,c) the derivative of the sum Kdr + Kel with respect to qm is given as:

$$ \frac{\partial \left({K}_{dr}+{K}_{el}\right)}{\partial {q}_M}=2\left({s}_m-{s}_n\right)+\left({\updelta}_{\mathrm{m}}-{\updelta}_{\mathrm{n}}\right)\kern0.5em \forall \mathrm{m}\in \left[1,\mathrm{n}-1\right] $$
(3.1)

The derivative of Ktrans with respect to qm for any m ϵ [1, n-1], can be expressed as:

$$ \frac{\partial {K}_{trans}}{\partial {q}_m}=\sum \limits_{\mathrm{i}=1}^{\mathrm{i}=\mathrm{n}}\frac{\partial \left({\xi}_{\mathrm{i}}{Q}_i^3\right)}{\partial {q}_m}=3\sum \limits_{\mathrm{i}=1}^{\mathrm{i}=\mathrm{n}}{\xi}_{\mathrm{i}}{Q}_i^2\frac{\partial {Q}_i}{\partial {q}_m}=3\sum \limits_{\mathrm{i}=1}^{\mathrm{i}=\mathrm{n}}{hf}_i\frac{\partial {Q}_i}{\partial {q}_j} $$
(3.2)

The derivatives of the pipe flow rates Qi with respect to any well flow rate qm can be calculated using Eqs (2.14a,b). They can take one of the following values: 1, 0 or − 1. Non-zero terms (1 or − 1) may arise along the “paths” of qm and qn only. It results that:

$$ \frac{\partial {K}_{trans}}{\partial {q}_m}=3\left({Hf}_{sm}-{Hf}_{sn}\right)\kern1em \forall \mathrm{m}\in \left[1,\mathrm{n}-1\right] $$
(3.3)

where Hfsm and Hfsn denote the sum of head losses along the paths of qm and of qn, respectively. These paths may include common pipes.

Using Eqs. (3.1) and (3.3) we get:

$$ \frac{\partial K{1}_{tot}}{\partial {q}_m}=2\left({s}_m-{s}_n\right)+3\left({Hf}_{sm}-{Hf}_{sn}\right)+\left({\updelta}_{\mathrm{m}}-{\updelta}_{\mathrm{n}}\right)\kern0.75em \forall \mathrm{m}\in \left[1,..,\mathrm{n}-1\right] $$
(3.4)

Then, the coordinates of the critical points, namely the respective combinations of qm values, can be found by solving a system of n equations and n unknowns. The first n-1 equations have the following form:

$$ 2\left({s}_m-{s}_n\right)+3\left({Hf}_{sm}-{Hf}_{sn}\right)+\left({\delta}_m-{\delta}_n\right)=0 $$
(3.5)

Equation (2.12), expressing the main constraint of the problem, completes the equation system. Equation (2.12) is linear, while all the rest are 2nd degree polynomials. Then, according to the theorem of Bezout, the system has at most 2(n-1) solutions.

3.2 Minimum Feasible Value

To find the type of the critical points, the second derivatives of K1tot should be investigated. Starting from Eq. (3.4) and since all δi are constant, we get, for any m ϵ [1, n-1]:

$$ \frac{\partial^2K{1}_{tot}}{\partial {q}_m^2}=2\ \frac{\partial \left({s}_m-{s}_n\right)}{\partial {q}_m}+3\ \frac{\partial \left({Hf}_{sm}-{Hf}_{sn}\right)}{\partial {q}_m} $$
(3.6)

According to Katsifarakis (2008) the first term of the right-hand side of (3.6) is a positive constant, for sm given by any of Eqs. (2.6a,b,c). Regarding the second term, and starting from Eq. (3.2), we get:

$$ \frac{\partial^2{K}_{trans}}{\partial {q}_m^2}=6\sum \limits_{i=1}^{i=n}{\upxi}_{\mathrm{i}}{Q}_i{\left(\frac{\partial {Q}_i}{\partial {q}_m}\right)}^2 $$
(3.7)

It follows that this term is non-negative, provided that Qi ≥ 0. This condition holds throughout the feasible region. The same result can be reached using a physical argument, in connection with Eq. (3.3): If qm increases (at the expense of qn), then the head loss Hfsm increases or remains constant, while Hfsn decreases or remains constant. They cannot remain constant at the same time, though. Hence, their difference increases with qm and the respective derivative is positive. A similar argument holds for the mixed second derivative of Ktrans with respect to qm, qj for any m, j ϵ [1, n-1]. In this case, though, Hfsm and Hfsn can remain constant at the same time.

Up to now, we have proved that in the feasible region

$$ \frac{\partial^2K{1}_{tot}}{\partial {q}_m^2}\ge 0\kern1em \forall \mathrm{m}\in \left[1,..,\mathrm{n}-1\right] $$
(3.8.a)
$$ \frac{\partial^2K{1}_{tot}}{\partial {q}_m\partial {q}_j}\ge 0\kern1em \forall \mathrm{m},\mathrm{j}\in \left[1,..,\mathrm{n}-1\right]\&\mathrm{m}\ne \mathrm{j} $$
(3.8.b)

It results from Eqs. (3.8a,b) that no local maxima exist in the feasible region. Moreover, if a local minimum exists, it is unique, since existence of more local minima would require existence of local maxima “between” them, as well, since the feasible region is convex.

To investigate whether a minimum exists in the feasible region, we turn to the “extreme” cases. As a first step, we take into account Kdr only, namely we assume that: a) head losses in the pipe network are negligible and b) all δj are equal to each other, namely we can ignore Kel. In this case (Katsifarakis 2008), Kdr is concave with one local minimum only, which is always located inside the feasible region.

The other extreme case is to consider Ktrans only, namely to assume that drawdown at the water source is negligible (e.g. pumping from lakes with constant level). The minimum value at the feasible region may correspond to inflection point on its boundary, which is described as follows:

For any well j not directly connected to the tank, Qj = qj = 0.

If wells j and m are directly connected to the tank, then:

$$ \frac{Q_j}{Q_m}=\frac{q_j}{q_m}={\left(\frac{\upxi_{\mathrm{m}}}{\upxi_{\mathrm{j}}}\right)}^{\raisebox{1ex}{$1$}\!\left/ \!\raisebox{-1ex}{$2$}\right.} $$
(3.9)

Moreover, qj obey the constraint (2.12), namely their sum equals qtot.

If all wells are directly connected to the tank, then all qj = Qj > 0 and the critical point is a local minimum. In any case, Ktrans is concave in the feasible region. It follows from the preceding analysis that in the feasible region the sum of Kdr and Ktrans is concave, with one minimum (or an inflection point in the aforementioned limiting case).

When there is additional flow, resulting in different δj values, Kel should be taken into account. When examined together with Kdr, it may sometimes shift the minimum outside the feasible region, namely to a negative qj value (Katsifarakis and Tselepidou 2009). In such cases the respective well is excluded, and calculations are repeated with the remaining wells. Such a case may arise when minimizing K1tot, too.

4 Solution of the Equation System

The system of the n equations and n unknowns which is described in section 3.1, cannot be solved analytically. It can be easily solved, though, using commercial solvers of equation systems. To facilitate their use, the following matrices are introduced, to express the terms of the equation system:

$$ \left(\begin{array}{c}2\left({s}_1-{s}_n\right)\\ {}2\left({s}_2-{s}_n\right)\\ {}\vdots \\ {}2\left({s}_{n-1}-{s}_n\right)\\ {}{q}_{total}\end{array}\right)=2\left\{\mathrm{A}\right\}\left\{q\right\}=2\left(\begin{array}{c}\begin{array}{c}\begin{array}{ccc}{\mathrm{a}}_{1,1}& \cdots & {\mathrm{a}}_{1,\mathrm{n}}\\ {}{\mathrm{a}}_{2,1}& \cdots & {\mathrm{a}}_{2,\mathrm{n}}\end{array}\\ {}\vdots \kern1.25em \ddots \kern1.25em \vdots \end{array}\\ {}\begin{array}{ccc}{\mathrm{a}}_{\left(\mathrm{n}-1\right),1}& \cdots & {\mathrm{a}}_{\left(\mathrm{n}-1\right),\mathrm{n}}\\ {}\frac{1}{2}& \cdots & \frac{1}{2}\end{array}\end{array}\right)\left(\begin{array}{c}\begin{array}{c}{q}_1\\ {}\vdots \\ {}\vdots \end{array}\\ {}\vdots \\ {}{q}_n\end{array}\right) $$
(4.1)

The last row corresponds to the constraint of Eq. (2.12), whereas the terms of the other n-1 rows depend on the form of Eq. (2.6). Specifically, for infinite aquifers, namely from Eq. (2.6a), and taking into consideration the assumption that two wells do not affect each other if their distance exceeds R, we have:

$$ \mathrm{if}{\mathrm{r}}_{\mathrm{ji}}<\mathrm{R}\&{\mathrm{r}}_{\mathrm{jn}}>\mathrm{R}:{\alpha}_{\mathrm{i},\mathrm{j}}=-\frac{1}{2\pi \mathrm{T}}\ln \left(\frac{{\mathrm{r}}_{\mathrm{ji}}}{\mathrm{R}}\right) $$
(4.2.a)
$$ \mathrm{if}{\mathrm{r}}_{\mathrm{ji}}>\mathrm{R}\&{\mathrm{r}}_{\mathrm{jn}}<\mathrm{R}:{\alpha}_{\mathrm{i},\mathrm{j}}=-\frac{1}{2\pi \mathrm{T}}\ln \left(\frac{\mathrm{R}}{{\mathrm{r}}_{\mathrm{jn}}}\right) $$
(4.2.b)
$$ \mathrm{if}\ {\mathrm{r}}_{\mathrm{ji}},{\mathrm{r}}_{\mathrm{jn}}<\mathrm{R}:\kern0.5em {\alpha}_{\mathrm{i},\mathrm{j}}=-\frac{1}{2\uppi \mathrm{T}}\ln \left(\frac{{\mathrm{r}}_{\mathrm{ji}}}{{\mathrm{r}}_{\mathrm{jn}}}\right) $$
(4.2.c)
$$ \mathrm{if}\ {\mathrm{r}}_{\mathrm{ji}},{\mathrm{r}}_{\mathrm{jn}}>\mathrm{R}:\kern0.5em {\upalpha}_{\mathrm{i},\mathrm{j}}=0 $$
(4.2.d)

The derivative of Ktrans can be expressed with the aid of matrix C, defined in Eq. (2.11). Specifically, the transpose matrix CT is needed, as it is necessary to represent pipe paths using columns and wells using rows. This way we get:

$$ 3\left(\begin{array}{c}{Hf}_{s1}-{Hf}_{sn}\\ {}{Hf}_{s2}-{Hf}_{sn}\\ {}\vdots \\ {}{Hf}_{sn}-{Hf}_{sn}\end{array}\right)=3\ \left({\left(\begin{array}{c}\begin{array}{c}\begin{array}{ccc}{\mathrm{c}}_{1,1}& \cdots & {\mathrm{c}}_{1,\mathrm{n}}\\ {}{\mathrm{c}}_{2,1}& \cdots & {\mathrm{c}}_{2,\mathrm{n}}\end{array}\\ {}\vdots \kern0.5em \ddots \kern0.5em \vdots \end{array}\\ {}\begin{array}{ccc}{\mathrm{c}}_{\mathrm{n},1}& \cdots & {\mathrm{c}}_{\mathrm{n},\mathrm{n}}\end{array}\end{array}\right)}^{\mathrm{T}}-{\left(\begin{array}{c}\begin{array}{c}\begin{array}{ccc}{\mathrm{c}}_{1,\mathrm{n}}& \cdots & {\mathrm{c}}_{1,\mathrm{n}}\\ {}{\mathrm{c}}_{2,\mathrm{n}}& \cdots & {\mathrm{c}}_{2,\mathrm{n}}\end{array}\\ {}\begin{array}{ccc}\vdots & \ddots & \vdots \end{array}\end{array}\\ {}\begin{array}{ccc}{\mathrm{c}}_{\mathrm{n},\mathrm{n}}& \cdots & {\mathrm{c}}_{\mathrm{n},\mathrm{n}}\end{array}\end{array}\right)}^{\mathrm{T}}\right)\left(\begin{array}{ccc}{\upxi}_1& \cdots & 0\\ {}\vdots & \ddots & \vdots \\ {}0& \cdots & {\upxi}_{\mathrm{n}}\end{array}\right)\ \left(\begin{array}{c}\begin{array}{c}{Q}_1^2\\ {}\vdots \\ {}\vdots \end{array}\\ {}{Q}_n^2\end{array}\right) $$
(4.3)

Finally, constant terms like δj and qtot are moved to the right-hand side of the matrix equation. This way we derive Eqs. (4.4a,b), or in extended form, Eqs (4.5a,b). Equation (4.4a) represents the system of equations that needs to be solved to minimize the total cost, while (4.4b) needs to be used to connect the pipe flow rates (Q) with the well flow rates (q). We anticipate to get up to 2(n-1) solutions, one of them in the feasible region.

$$ 2\left\{\mathrm{A}\right\}\left\{q\right\}-3\left\{{\mathrm{C}}_{\mathrm{i}-\mathrm{n}}^{\mathrm{T}}\right\}\left\{\upxi \right\}\left\{{Q}^2\right\}=\left\{\Delta \updelta, {\mathrm{q}}_{\mathrm{t}}\right\} $$
(4.4a)
$$ \left\{Q\right\}=\left\{\mathrm{C}\right\}\left\{q\right\} $$
(4.4b)
$$ 2\left(\begin{array}{c}\begin{array}{c}\begin{array}{ccc}{\mathrm{a}}_{1,1}& \cdots & {\mathrm{a}}_{1,\mathrm{n}}\\ {}{\mathrm{a}}_{2,1}& \cdots & {\mathrm{a}}_{2,\mathrm{n}}\end{array}\\ {}\vdots \kern0.5em \ddots \kern0.5em \vdots \end{array}\\ {}\begin{array}{ccc}{\mathrm{a}}_{\left(\mathrm{n}-1\right),1}& \cdots & {\mathrm{a}}_{\left(\mathrm{n}-1\right),\mathrm{n}}\\ {}\frac{1}{2}& \cdots & \frac{1}{2}\end{array}\end{array}\right)\left(\begin{array}{c}\begin{array}{c}{q}_1\\ {}\vdots \\ {}\vdots \end{array}\\ {}\vdots \\ {}{q}_n\end{array}\right)+3{\left(\begin{array}{c}\begin{array}{c}\begin{array}{ccc}{\mathrm{c}}_{1,1}-{\mathrm{c}}_{1,\mathrm{n}}& \cdots & {\mathrm{c}}_{1,\mathrm{n}}-{\mathrm{c}}_{1,\mathrm{n}}\\ {}{\mathrm{c}}_{2,1}-{\mathrm{c}}_{2,\mathrm{n}}& \cdots & {\mathrm{c}}_{2,\mathrm{n}}-{\mathrm{c}}_{2,\mathrm{n}}\end{array}\\ {}\begin{array}{ccc}\vdots & \ddots & \vdots \end{array}\end{array}\\ {}\begin{array}{ccc}{\mathrm{c}}_{\mathrm{n},1}-{\mathrm{c}}_{\mathrm{n},\mathrm{n}}& \cdots & {\mathrm{c}}_{\mathrm{n},\mathrm{n}}-{\mathrm{c}}_{\mathrm{n},\mathrm{n}}\end{array}\end{array}\right)}^{\mathrm{T}}\left(\begin{array}{ccc}{\upxi}_1& \cdots & 0\\ {}\vdots & \ddots & \vdots \\ {}0& \cdots & {\upxi}_{\mathrm{n}}\end{array}\right)\ \left(\begin{array}{c}\begin{array}{c}{Q}_1^2\\ {}\vdots \\ {}\vdots \end{array}\\ {}{Q}_n^2\end{array}\right)=\left(\begin{array}{c}\begin{array}{c}\begin{array}{c}{\Delta \updelta}_{1,\mathrm{n}}\\ {}\vdots \\ {}\vdots \end{array}\\ {}{\Delta \updelta}_{\left(\mathrm{n}-1\right),\mathrm{n}}\end{array}\\ {}{\mathrm{q}}_{\mathrm{total}}\end{array}\right) $$
(4.5a)
$$ \left(\begin{array}{c}\begin{array}{c}{Q}_1\\ {}\vdots \\ {}\vdots \end{array}\\ {}\vdots \\ {}{Q}_n\end{array}\right)=\left(\begin{array}{c}\begin{array}{c}\begin{array}{ccc}{\mathrm{c}}_{1,1}& \cdots & {\mathrm{c}}_{1,\mathrm{n}}\\ {}{\mathrm{c}}_{2,1}& \cdots & {\mathrm{c}}_{2,\mathrm{n}}\end{array}\\ {}\vdots \kern0.5em \ddots \kern0.5em \vdots \\ {}\begin{array}{ccc}\vdots & \ddots & \vdots \end{array}\end{array}\\ {}\begin{array}{ccc}{\mathrm{c}}_{\mathrm{n},1}& \cdots & {\mathrm{c}}_{\mathrm{n},\mathrm{n}}\end{array}\end{array}\right)\left(\begin{array}{c}\begin{array}{c}{q}_1\\ {}\vdots \\ {}\vdots \end{array}\\ {}\vdots \\ {}{q}_n\end{array}\right) $$
(4.5b)

5 Application Examples

The procedure of calculating the optimal distribution of qtot to n wells connected to a central tank is illustrated through the following examples.

5.1 Example 1

In this example a simple well layout is examined (Fig. 1): 3 wells are pumping from an infinite aquifer, with T = 0.025 m2/s. The hydraulic head surface is initially horizontal, namely all δi are equal. Moreover, qtot = 0.1 m3/s, R = 3000 m, r0 = 0.2 m for all wells, Li = 500 m D1 = 0.5 m, D2 = D3 = 0.3 m and fi = 0.03 for all pipes. The initial choice of fi can be checked ex post, based on the obtained pipe flow rates. In case of significant discrepancies, the calculation procedure can be repeated, using updated fi values.

Fig. 1
figure 1

Layout of the pipe network connecting the 3 wells to the tank (Example 1)

It results that: ξ1 = 39.70, ξ2 = ξ3 = 510.55 while

$$ A=\left(\begin{array}{ccc}49.81& 2.21& -49.81\\ {}0& 52.02& -52.02\\ {}\frac{1}{2}& \frac{1}{2}& \frac{1}{2}\end{array}\right) $$

Regarding matrix C, pipe 1 is included in every flow path S1, S2, S3. For this reason, all the elements of the first row will be equal to 1. Following the same line of thought P2 ∈ S2 and P3 ∈ S3. This way we have S1 = {P1}, S2 = {P1,P2}, S3 = {P1,P3}. Another way of approaching the same matrix is observing that: Q1 = q1 + q2 + q3, Q2 = q2, Q3 = q3. Therefore:

$$ C=\left(\begin{array}{ccc}1& 1& 1\\ {}0& 1& 0\\ {}0& 0& 1\end{array}\right) $$
$$ {C}_{i-n}^T={\left(\begin{array}{ccc}1-1& 1-1& 1-1\\ {}0-0& 1-0& 0-0\\ {}0-1& 0-1& 1-1\end{array}\right)}^T={\left(\begin{array}{ccc}0& 0& 0\\ {}0& 1& 0\\ {}-1& -1& 0\end{array}\right)}^T=\left(\begin{array}{ccc}0& 0& -1\\ {}0& 1& -1\\ {}0& 0& 0\end{array}\right) $$

Finally this set of data is inserted in Wolfram Mathematica as shown in Fig. 2, to solve the system of Eq. (4.5a) so that 2Δs + 3Δhf = 0 for the first (n-1) wells and qtot = q1 + q2 + q3:

Fig. 2
figure 2

Inserting the matrices in Wolfram Mathematica. Command “Solve” is used to obtain the results

The qi values for the only feasible solution (q > 0) are the following: q1 = 0.041 m3/s, q2 = 0.029 m3/s, q3 = 0.029 m3/s. The flow rate q1 is substantially larger than the other two, due to the cost term Ktrans, while q2 = q3 due to symmetry. If we ignore friction losses in the pipe network, we get: q1 = 0.032 m3/s, q2 = q3 = 0.034 m3/s.

5.2 Example 2

In this example, 6 wells, which pump from an infinite aquifer with T = 0.0025 m2/s, are connected to a tank through a pipe network, shown in Fig. 3. The coordinates of the wells are presented in Table 1 and they are the same with those used by Katsifarakis (2008), for comparison purposes. A tank is added, with coordinates (x0, y0) = (0,0). The total flow rate that should be pumped is qtot = 0.5 m3/s. Finally, diameter of all wells is ro = 0.2 m and the radius of influence of the system of wells is chosen as R = 3000 m. Moreover, we consider that two “extra” wells we1 and we2, with coordinates (xe1, ye1) = (500,500) and (xe2, ye2) = (800,300) respectively, pump independently from the same aquifer, resulting in different initial hydraulic head levels (and different δi values) at the 6 wells of the examined system. Regarding the pipe network, the friction coefficient in the pipe network is taken equal to 0.03.

Fig. 3
figure 3

Layout of the wells and the tank (Example 2)

Table 1 Well coordinates (Katsifarakis 2008)

To tackle this problem, R Studio is used. Specifically, packages “sp”, “rgeos” and “gdistance” (van Etten 2017) are used, so that anyone using the code can project the wells onto a real map, get the distances and project the pipes. Packages “tmap” (Tennekes 2018) and “tmaptools” are used to plot Fig. 3. Package “nleqslv” (Dennis and Schnabel 1996) is used to solve the equations and finally “ggplot2” (Gómez-Rubio 2017) is used to produce the diagram of Fig. 4.

Fig. 4
figure 4

Optimal pumping rates of wells 1 and 6, with respect to pipe diameter D

Our aim is to investigate the effect of: a) the relative magnitude of si and hfi and b) differences in δi values, on the optimal qi distribution. We use the diameter of pipes as a parameter; to facilitate comparisons, we assume that all network pipes have the same diameter.

In the following, three cases (A, B, C) are discussed. The respective optimal qi distributions appear in Table 2, together with the two limiting cases LC1 and LC2. In LC1, friction losses in the pipe network are neglected, as in Katsifarakis (2008). In LC2, we take into account friction losses in the pipe network only, as discussed in Section 3 of this paper.

Table 2 Optimal well flow rates for all cases (in l/s)

In case A, a large pipe diameter is used (D = 2 m) for all pipes, rendering the contribution of friction losses very small, compared to the hydraulic head level drawdowns si at the wells. Moreover, the flow rates of we1 and we2 are set to 0, namely all δi are equal to each other and can be neglected. The results for the pumping rates are shown in Table 2. They are practically identical to those of case LC1 and lead to equal si values at the wells.

In cases B and C the pipe diameter is D = 0.4 m. In case B the flow rates of the extra wells we1 and we2 are zero, while in case C qe1 = 0.1 m3/s and qe2 = 0.4 m3/s, resulting in different δi values. Results appear again in Table 2.

Comparing results of Case B with those of case A, we see that differences are smaller than 2.5%, with the exception of the flow rate of w3, which is close to the tank and is directly connected to it.

Comparing results of case C with those of case B, we see that the flow rates of the wells w4 and w5 are substantially smaller, for the following reason: These wells are closer than the others to the “extra” well we2; consequently, δ4 and δ5 are larger than the others in case C.

Finally, to illustrate the effect of the relevant magnitude of si and hfi, we have produced Fig. 4. It displays the change of optimal flow rates of wells w1 and w6 (the closest and the more distant from the tank) with respect to the diameter of the pipe network.

6 Conclusions

In this paper, we have investigated the minimization of the total cost to pump a given flow rate qtot from any number n of wells up to a central water tank, taking into account friction losses in the pipe network. Regarding the groundwater flow, we have considered steady state flow in infinite or semi-infinite aquifers, to which the method of images applies. Additional regional groundwater flow can be taken into account, too. Regarding the pipe network that carries water from the wells to the central tank, it can include junctions at the locations of the wells only.

Splitting the objective function K1tot, which is proportional to the total pumping cost, in 3 terms, we have derived a new analytical expression (Eq. 3.5) that holds at the critical points of the cost function. Qualitatively, it states that hydraulic head level drawdowns si in the aquifer should be smaller at pumping wells that require higher hydraulic head Hfsi to overcome friction losses in the pipe network.

Then, based on the aforementioned formula, we have produced a system of n equations and n unknowns, to calculate the sets of well flow rates that correspond to the critical points of the total cost function. The n-1 equations are 2nd degree polynomials, described by Eq. (3.5). The remaining equation is linear, expressing that the sum of well flow rates must be equal to qtot. The solution of the system can be achieved by means of commercial solvers.

While the maximum number of solutions is 2(n-1), we have concluded that there is only one feasible solution, that minimizes K1tot. This solution can be quite different from the analytical solution, obtained by neglecting the head losses in the pipe network, as indicated in the illustrative examples. Generally, that analytical solution tends to underestimate the flow rates of wells, which are directly connected to the tank.