1 Introduction

Steady-state diffusion problems that arise in various engineering and physical fields, such as fluid flow in porous media or heat conduction problems, are modeled by an elliptic partial differential equation with diffusion coefficients that can be represented by heterogeneous, possibly discontinuous, anisotropic full tensors. These problems can be challenging for traditional numerical methods, such as the classical Two Point Flux Approximation (TPFA) Finite Volume Method (FVM), which is monotone [1], but it is not even convergent for general full tensor diffusion coefficients or general non k-orthogonal meshes [2,3,4]; the Galerkin Finite Element Method (GFEM) [5, 6], the Mixed-Finite Element Method (MFEM) [7, 8] or even the more robust linear Multipoint Flux Approximation (MPFA) [2,3,4] methods which are, in general, convergent, but can violate the Discrete Maximum Principle (DMP), giving birth to spurious oscillations for the scalar variable and erroneous fluxes for more pathological problems with strong anisotropy ratios or extremely distorted meshes [1, 9].

The efforts to overcome these limitations are not recent. The DMP compliance for finite elements approximations was addressed by Ciarlet and Raviart [10], Korotov et al. [11] and Burman and Ern [12]. Le Potier [13] presented a 2D non-linear FVM satisfying the maximum principle and Cancès et al. [14] presented a non-linear technique to correct a general FVM in order to respect the DMP. Pal and Edwards [15, 16] proposed flux-splitting strategies to improve the monotonicity and impose DMP for FVM. Chen et al. [17] have proposed their MPFA with enriched stencil (MPFA-E), in order to mitigate, but not necessarily eliminate, spurious oscillations. Kuzmin et al. [18] presented a nonlinear constrained finite element scheme, in which they perform an algebraic matrix splitting followed by a slope limiting to impose DMP. Other finite volume formulations using two-steps strategies, as those presented by Su et al. [19] and Zhao et al. [20] also presents good results in terms of honoring the DMP.

However, some of these methods do not have some desirable properties such as, for example, the capability to reproduce exactly piecewise linear solutions (Linearity Preserving—LP) or local conservation [21, 22]. One of the formulations that is locally conservative and LP is the MPFA that uses the so called diamond stencil (MPFA-D) [23,24,25,26]. However, the MPFA-D, in its original form, is not monotone and does not respect the DMP, since the weighting of the vertices unknowns does not necessarily form a convex combination. The idea of the present work is to modify the original MPFA-D to avoid spurious oscillations on solving steady-state diffusion problems keeping it locally conservative and LP. It is possible to modify the weighting strategy in order to get a monotone scheme [27, 28], but it could unmake the linearity preserving in this case. On the other hand, the way we perform the modification stems from the fact that the MPFA-D flux expression can be naturally split into two parts: the TFPA flux portion and the flux portion associated with the cross-diffusion terms (CDT). This flux splitting [15, 16, 29], separating the TPFA part as the “spurious oscillations-free” part, is followed by a CDT flux limiting [18]. Our method aims to limit the CDT flux whenever it is necessary, in order to obtain monotone solutions, but keeping the modified MPFA-D as a locally conservative method and still capable of reproducing piecewise linear solutions, handling arbitrary (even discontinuous [30]) anisotropic diffusion tensors and achieving second order of accuracy on the scalar field and first order on its gradient.

In Sect. 2, we present the mathematical formulation, in Sect. 3, we present the discrete flux equations of the recently developed linear MPFA-D for 3D [26], followed by our new non-linear method designed to satisfy the DMP, i.e.: the Multipoint Flux Approximation with a Diamond Stencil and a Non-Linear Defect Correction (MPFA-DNL). In Sect. 4, aiming to appraise the accuracy and robustness of our new MPFA-DNL, we present the solution of some 3D benchmark problems found in literature. In this paper, we restrict ourselves to unstructured tetrahedral meshes, even though, in principle, there is no restriction to extend our method to general polyhedral control volumes.

2 Mathematical formulation

The steady-state diffusion problem in 3D can be described by [26]:

$$ \vec{\nabla } \cdot {\vec{\mathcal{F}}} = {\mathcal{Q}}(\vec{x}),\quad {\text{with}}\;{\vec{\mathcal{F}}} = - {\mathbf{K}}\left( {\vec{x}} \right)\nabla u \;{\text{in}}\;\vec{x} = \left( {x,y,z} \right) \in \Omega \subset {\mathbb{R}}^{3} $$
(1)

in which \({\vec{\mathcal{F}}}\) represents the diffusive flux, u is the scalar or potential variable, \({\mathcal{Q}}\left( {\vec{x}} \right)\) is the source term and \(K\left( {\vec{x}} \right)\) is the diffusion tensor that satisfies the ellipticity condition [31, 32] and that can be written, in Cartesian coordinates, as:

$$ {\mathbf{K}}\left( {\vec{x}} \right) = \left[ {\begin{array}{*{20}c} {\kappa_{xx} } & {\kappa_{xy} } & {\kappa_{xz} } \\ {\kappa_{yx} } & {\kappa_{yy} } & {\kappa_{yz} } \\ {\kappa_{zx} } & {\kappa_{zy} } & {\kappa_{zz} } \\ \end{array} } \right] $$
(2)

Moreover, appropriate boundary conditions can be defined by:

$$ \left\{ {\begin{array}{*{20}l} {u = g_{D} } \hfill & {{\text{on}}\;\Gamma_{D} } \hfill \\ {{\vec{\mathcal{F}}} \cdot \vec{n} = g_{N} } \hfill & {{\text{on}}\;\Gamma_{N} } \hfill \\ \end{array} } \right. $$
(3)

where the scalar functions \(g_{D}\) (prescribed values for u) and \(g_{N}\) (prescribed fluxes) are, respectively, defined on \(\Gamma_{D}\) (Dirichlet) and \(\Gamma_{N}\) (Neumann) boundaries, with \(\partial \Omega = \Gamma_{D} \cap \Gamma_{N}\) and \(\Gamma_{D} \cap \Gamma_{N} = \emptyset\), and \(\vec{n}\) is the unitary outward normal vector.

3 Numerical Formulation

In this section, from de the recently developed MPFA-D in 3D, we present our new MPFA-DNL, which includes a nonlinear defect correction strategy to the original MPFA-D formulation in order to satisfy the Discrete Maximum Principle (DMP) for unstructured tetrahedral meshes and general diffusion tensors.

Given a computational domain \({\Omega }\) with boundary \({\Gamma }\), we discretize it by a set of non-overlapping control-volumes \(\hat{L}\). By integrating Eq. (1) and applying the Gauss’s Divergence Theorem over the control-volume \(\hat{L}\) (with boundary \(\Gamma_{{\hat{L}}}\) and volume \({\Omega }_{{\hat{L}}}\)), we have:

$$ \mathop \int \limits_{{\Gamma_{{\hat{L}}} }} {\vec{\mathcal{F}}} \cdot \vec{n}\partial \Gamma_{{\hat{L}}} = \int \limits_{{\Omega_{{\hat{L}}} }} {\mathcal{Q}}\partial \Omega_{{\hat{L}}} $$
(4)

By using the mean value theorem, we can write:

(5)

where \({\bar{\mathcal{Q}}}_{{\hat{L}}}\) is the mean source term in \(\hat{L}\) and is a face belonging to the set \(\Gamma_{{\hat{L}}}\). In Eq. (5) different approximations for the flux expression \({\vec{\mathcal{F}}} \cdot \vec{N}\) produce different finite volume approximations [2,3,4, 17, 23, 33].

3.1 The Multipoint Flux Approximation using the Diamond Stencil

We start from the formulation presented by Lira Filho et al. [26], which is applicable to diffusion problems on 3D tetrahedral meshes, in which the unique flux expression through a face, considering the configuration shown in Fig. 1, is given by:

$$ {\vec{\mathcal{F}}} \cdot \vec{N} = - {\mathfrak{K}}\left| {\vec{N}} \right|\left[ {\left( {u_{{\hat{R}}} - u_{{\hat{L}}} } \right) - \frac{1}{2}{\mathfrak{D}}_{JK} \left( {u_{J} - u_{I} } \right) + \frac{1}{2}{\mathfrak{D}}_{JI} \left( {u_{J} - u_{K} } \right)} \right] $$
(6)
Fig. 1
figure 1

Face IJK shared by the tetrahedrons \(\hat{\user2{L}}\) and \(\hat{\user2{R}}\)

with:

$$ {\mathfrak{K}} = \frac{{K_{{\hat{R}}}^{n} K_{{\hat{L}}}^{n} }}{{h_{{\hat{L}}} K_{{\hat{R}}}^{n} + h_{{\hat{R}}} K_{{\hat{L}}}^{n} }} $$
(7)

and:

$$ {\mathfrak{D}}_{{\fancyscript{i}},{\fancyscript{j}}} = \frac{{\vec{\tau }_{{\fancyscript{i}},{\fancyscript{j}}} ,\overrightarrow {{\hat{L}\hat{R}}} }}{{\left| {\vec{N}} \right|^{2} }} - \frac{1}{{\left| {\vec{N}} \right|}}\left( {h_{{\hat{L}}} \frac{{K_{{\hat{L}}}^{t,{\fancyscript{i}},{\fancyscript{j}}} }}{{K_{{\hat{L}}}^{n} }} + h_{{\hat{R}}} \frac{{K_{{\hat{R}}}^{t,{\fancyscript{i}},{\fancyscript{j}}} }}{{K_{{\hat{R}}}^{n} }}} \right);{\fancyscript{i}},{\fancyscript{j}} = I,J,K $$
(8)

where:

$$ \vec{\tau }_{{\fancyscript{i}},{\fancyscript{j}}} = \vec{N} \times \overrightarrow {{\fancyscript{i}},{\fancyscript{j}}} ; K_{\fancyscript{k}}^{n} = \frac{{\vec{N}^{T} K_{\fancyscript{k}} \vec{N}}}{{\left| {\vec{N}} \right|^{2} }}; K_{\fancyscript{k}}^{t,{\fancyscript{i}},{\fancyscript{j}}} = \frac{{\vec{N}^{T} K_{k} \vec{\tau }_{{\fancyscript{i}},{\fancyscript{j}}} }}{{\left| {\vec{N}} \right|^{2} }};\fancyscript{k} = L,R;{\fancyscript{i}},{\fancyscript{j}} = I,J,K $$
(9)

In this formulation, the auxiliary vertex unknowns (\(u_{I}\), \(u_{J}\), \(u_{K}\)) must be interpolated as a weighting of the values of u at the cells sharing the respective node (I, J or K. We use the linearity-preserving interpolation strategy presented by Lira Filho et al. [26].

It is clear, according to Eq. (6), that \({\vec{\mathcal{F}}} \cdot \vec{N}\). can be split in two parts:

$$ {\vec{\mathcal{F}}} \cdot \vec{N} = \left( {{\vec{\mathcal{F}}} \cdot \vec{N}} \right)_{TPFA} + \left( {{\vec{\mathcal{F}}} \cdot \vec{N}} \right)_{CDT} $$
(10)

with:

$$ \left( {{\vec{\mathcal{F}}} \cdot \vec{N}} \right)_{TPFA} = - {\mathfrak{K}}\left| {\vec{N}} \right|\left( {u_{{\hat{R}}} - u_{{\hat{L}}} } \right) $$
(11)
$$ \left( {{\vec{\mathcal{F}}} \cdot \vec{N}} \right)_{CDT} = - {\mathfrak{K}}\left| {\vec{N}} \right|\left[ { - \frac{1}{2}{\mathfrak{D}}_{JK} \left( {u_{J} - u_{I} } \right) + \frac{1}{2}{\mathfrak{D}}_{JI} \left( {u_{J} - u_{K} } \right)} \right] $$
(12)

where \(\left( {{\vec{\mathcal{F}}} \cdot \vec{N}} \right)_{TPFA}\) is the TPFA flux contribution and \(\left( {{\vec{\mathcal{F}}} \cdot \vec{N}} \right)_{CDT}\) is the flux contribution from the CDT, provided by the nodal interpolation.

Computing Eq. (5) for all the \(\fancyscript{n}\) control-volumes in \({\Omega }\), we obtain the global system of equations \({\varvec{Au}} = {\varvec{b}}\). The solution of this system can be obtained iteratively by the Gauss–Seidel method:

$$ {\varvec{u}}^{t + 1} = \left( {{\varvec{D}} + {\varvec{L}}} \right)^{ - 1} \left\{ {{\varvec{b}} - {\varvec{Uu}}^{t} } \right\} $$
(13)

where t is the iteration step and D is the diagonal matrix of A, U is the upper triangular part of A, L is the lower triangular part of A, so that A = L + D + U. Naturally, A is a \(n \times n\) matrix, in which the \(L\)-th line corresponds to \(\mathop \sum \limits_{{\overline{k} \in \Gamma_{{\hat{L}}} }} \left. {{\vec{\mathcal{F}}} \cdot \vec{N}} \right|_{{\overline{k}}}\). If we split the fluxes according to Eq. (10), we can write the global system of equations as:

$$ \left[ {{\varvec{A}}_{TPFA} + {\varvec{A}}_{CDT} } \right]{\varvec{u}} = \left[ {{\varvec{b}}_{TPFA} + {\varvec{b}}_{CDT} } \right] $$
(14)

in which the L-th line of \({\varvec{A}}_{{{\varvec{TPFA}}}}\) corresponds to \(\mathop \sum \limits_{{\overline{k} \in \Gamma_{{\hat{L}}} }} \left. {\left( {{\vec{\mathcal{F}}} \cdot \vec{N}} \right)_{TPFA} } \right|_{{\overline{k}}}\) and the L-th line of \(A_{CDT}\) corresponds to \(\mathop \sum \limits_{{\overline{k} \in \Gamma_{{\hat{L}}} }} \left. {\left( {{\vec{\mathcal{F}}} \cdot \vec{N}} \right)_{CDT} } \right|_{{\overline{k}}}\), according to Eqs. (11) and (12). The expression shown in Eq. (14) is the regular MPFA-D global system under the described splitting. The solution of Eq. (14) can still be obtained iteratively by the Gauss–Seidel method, but in the following form:

$$ \varvec{u}^{t + 1} = \left( {\varvec{D}_{\varvec{TPFA}} + \varvec{D}_{\varvec{CDT}} + \varvec{L}_{\varvec{TPFA}} + \varvec{L}_{\varvec{CDT}} } \right)^{ - 1} \left\{ {\varvec{b}_{\varvec{TPFA}} + \varvec{b}_{\varvec{CDT}} - \left[ {\varvec{U}_{\varvec{TPFA}} + \varvec{U}_{\varvec{CDT}} } \right]u^{t} } \right\} $$
(15)

3.2 The Non-Linear Defect Correction

In this section, we present the Non-Linear Defect Correction strategy that we have devised to avoid the spurious oscillations that can arise with the use of the original linear MPFA-D method. After each iteration on Eq. (13), aiming to guarantee monotonicity through a local DMP imposition, we need to verify the compliance of the following restriction [16]:

$$ {\varvec{u}}_{\min }^{t} - \delta \le {\varvec{u}}^{t + 1} \le {\varvec{u}}_{\max }^{t} + \delta $$
(16)

with the above inequality being an entry-by-entry comparison, where \({\varvec{u}}_{\max }^{t}\) and \({\varvec{u}}_{\min }^{t}\) are the vectors containing, respectively, the maximum and the minimum scalar values in the extended stencil of each cell after the t-th iteration and \(\delta\) is a pre-established tolerance. The extended stencil of a cell includes the cell itself and all the neighboring cells sharing vertices with it. Two important exceptions to the application of Eq. (16) are when the evaluated cell has the maximum source term or the minimum sink term in the extended stencil or when it has Neumann boundary faces in which \(g_{N} \ne 0\). In these cases, the restriction in Eq. (16) is simply skipped [16]. If the restriction shown in Eq. (16) is violated by the approximation, we need to modify the system shown in Eq. (15) in order to impose the DMP. As the potential source of spurious oscillations in the MPFA-D are the fluxes associated to the CDT, we modify it as follows:

$$ {\varvec{u}}^{t + 1} = \left( {{\varvec{D}}_{{{\varvec{TPFA}}}} + \Upsilon {\varvec{D}}_{{{\varvec{CDT}}}} + {\varvec{L}}_{{{\varvec{TPFA}}}} + \Upsilon {\varvec{L}}_{{{\varvec{CDT}}}} } \right)^{ - 1} \left\{ {{\varvec{b}}_{{{\varvec{TPFA}}}} + \Upsilon {\varvec{b}}_{{{\varvec{CDT}}}} - \left[ {{\varvec{U}}_{{{\varvec{TPFA}}}} + \Upsilon {\varvec{U}}_{{{\varvec{CDT}}}} } \right]{\varvec{u}}^{t} } \right\} $$
(17)

where \({{\varvec{\Upsilon}}}\) is a diagonal matrix, with entries \(0 \le \Upsilon_{ii} \le 1\), used to weight the CDT contributions. Note that with \({{\varvec{\Upsilon}}} = {\varvec{I}}\) (the identity matrix), we get back to Eq. (15), i.e., the iterative version of the original MPFA-D, on the other hand, if \({{\varvec{\Upsilon}}} = {\varvec{0}}\), we get the iterative version of the TPFA formulation. Rearranging the expression above, we get:

$$ {\varvec{u}}^{t + 1} = \left( {{\varvec{D}}_{{{\varvec{TPFA}}}} + {\varvec{L}}_{{{\varvec{TPFA}}}} + {{\varvec{\Upsilon}}}{\varvec{D}}_{{{\varvec{CDT}}}} + {{\varvec{\Upsilon}}}{\varvec{L}}_{{{\varvec{CDT}}}} } \right)^{ - 1} \left[ {{\varvec{b}}_{{{\varvec{TPFA}}}} - {\varvec{U}}_{{{\varvec{TPFA}}}} {\varvec{u}}^{t} + {{\varvec{\Upsilon}}}{\varvec{b}}_{{{\varvec{CDT}}}} - {{\varvec{\Upsilon}}}{\varvec{U}}_{{{\varvec{CDT}}}} {\varvec{u}}^{t} } \right] $$
(18)

Replacing Eq. (18) in Eq. (16) and disregarding the tolerance \(\delta\) for now, we have the two following inequalities sets:

$$ \left\{ {\begin{array}{*{20}c} {\left( {{\varvec{D}}_{{{\varvec{TPFA}}}} + {\varvec{L}}_{{{\varvec{TPFA}}}} + {{\varvec{\Upsilon}}}{\varvec{D}}_{{{\varvec{CDT}}}} + {{\varvec{\Upsilon}}}{\varvec{L}}_{{{\varvec{CDT}}}} } \right)^{ - 1} \left[ {{\varvec{b}}_{{{\varvec{TPFA}}}} - {\varvec{U}}_{{{\varvec{TPFA}}}} {\varvec{u}}^{t} + {{\varvec{\Upsilon}}}{\varvec{b}}_{{{\varvec{CDT}}}} - {{\varvec{\Upsilon}}}{\varvec{U}}_{{{\varvec{CDT}}}} {\varvec{u}}^{t} } \right] \le {\mathbf{\mathfrak{u}}}_{{{\varvec{max}}}}^{t} } \\ {\left( {{\varvec{D}}_{{{\varvec{TPFA}}}} + {\varvec{L}}_{{{\varvec{TPFA}}}} + {{\varvec{\Upsilon}}}{\varvec{D}}_{{{\varvec{CDT}}}} + {{\varvec{\Upsilon}}}{\varvec{L}}_{{{\varvec{CDT}}}} } \right)^{ - 1} \left[ {{\varvec{b}}_{{{\varvec{TPFA}}}} - {\varvec{U}}_{{{\varvec{TPFA}}}} {\varvec{u}}^{t} + {{\varvec{\Upsilon}}}{\varvec{b}}_{{{\varvec{CDT}}}} - {{\varvec{\Upsilon}}}{\varvec{U}}_{{{\varvec{CDT}}}} {\varvec{u}}^{t} } \right] \ge {\mathbf{\mathfrak{u}}}_{{{\varvec{min}}}}^{t} } \\ \end{array} } \right. $$
(19)

Rearranging the system, we have:

$$ \left\{ {\begin{array}{*{20}c} {{\fancyscript{{y}}}_{\max } + \varvec{\Upsilon} {\fancyscript{{x}}}_{{{\text{max}}}} \ge 0} \\ {{\fancyscript{{y}}}_{\min } + \varvec{\Upsilon} {\fancyscript{{x}}}_{\min } \le 0} \\ \end{array} } \right. $$
(20)

where:

$$ \begin{gathered} \fancyscript{x}_{\max } = U_{CDT} u^{t} + D_{CDT} {\mathfrak{u}}_{\max }^{t} + L_{CDT} {\mathfrak{u}}_{\max }^{t} - b_{CDT} \hfill \\ \fancyscript{y}_{\max } = U_{TPFA} u^{t} + D_{TPFA} {\mathfrak{u}}_{\max }^{t} + L_{TPFA} {\mathfrak{u}}_{\max }^{t} - b_{TPFA} \hfill \\ \fancyscript{x}_{\min } = U_{CDT} u^{t} + D_{CDT} {\mathfrak{u}}_{\min }^{t} + L_{CDT} {\mathfrak{u}}_{\min }^{t} - b_{CDT} \hfill \\ \fancyscript{y}_{\min } = U_{TPFA} u^{t} + D_{TPFA} {\mathfrak{u}}_{\min }^{t} + L_{TPFA} {\mathfrak{u}}_{\min }^{t} - b_{TPFA} \hfill \\ \end{gathered} $$
(21)

Therefore, we can determine valid intervals (\(Y_{\max }^{i}\) and \(Y_{\min }^{i}\)) for the values of \(\Upsilon_{ii}\). Possible solutions to inequalities in Eq. (20) are given by:

$$ Y_{\max }^{i} = \left\{ {\begin{array}{*{20}l} {if \fancyscript{x}_{\max }^{i} > 0 \to \left[ {\left. { - \frac{{\fancyscript{y}_{\max }^{i} }}{{\fancyscript{y}_{\max }^{i} }},\infty } \right)} \right.} \hfill \\ {if \fancyscript{x}_{\max }^{i} < 0 \to \left. {\left( { - \infty , - \frac{{\fancyscript{y}_{\max }^{i} }}{{\fancyscript{y}_{\max }^{i} }}} \right.} \right]} \hfill \\ {if \fancyscript{x}_{\max }^{i} = 0 \to \left[ {0,1} \right]} \hfill \\ \end{array} } \right. $$
(22)

and:

$$ Y_{\min }^{i} = \left\{ {\begin{array}{*{20}l} {if \fancyscript{x}_{\min }^{i} > 0 \to \left. {\left( { - \infty , - \frac{{\fancyscript{y}_{\min }^{i} }}{{\fancyscript{x}_{\min }^{i} }}} \right.} \right]} \hfill \\ {if \fancyscript{x}_{\min }^{i} < 0 \to \left[ {\left. { - \frac{{\fancyscript{y}_{\min }^{i} }}{{\fancyscript{x}_{\min }^{i} }},\infty } \right)} \right.} \hfill \\ {if \fancyscript{x}_{\min }^{i} = 0 \to \left[ {0,1} \right]} \hfill \\ \end{array} } \right. $$
(23)

Therefore, we can define \(Y^{i}\) as:

$$ Y^{i} = \left\{ {\begin{array}{*{20}l} {if\quad {\varvec{u}}_{i}^{t + 1} \le {\mathbf{\mathfrak{u}}}_{\min ,i}^{t} \to Y_{\min }^{i} \cap \left[ {0,1} \right]} \hfill \\ {if\quad {\varvec{u}}_{i}^{t + 1} \ge {\mathbf{\mathfrak{u}}}_{\max ,i}^{t} \to Y_{\max }^{i} \cap \left[ {0,1} \right]} \hfill \\ {else \to Y_{\max }^{i} \cap Y_{\min }^{i} \cap \left[ {0,1} \right]} \hfill \\ \end{array} } \right. $$
(24)

If \(Y^{i} = \emptyset\), we just adopt \(Y^{i} = \left[ {0,1} \right]\), but not before taking an additional step. Consider that \({\mathbb{V}}\) is the set of violating DMP cells, if the \(\hat{i} \in {\mathbb{V}}\) and \(Y^{i} = \emptyset\), we include in \({\mathbb{V}}\) all the cells in the extended stencil of \(\hat{i}\), so we can try to fix it through modifying its neighbors.

Note that, multiplying \({{\varvec{\Upsilon}}}{\varvec{A}}_{{{\varvec{CDT}}}}\), which means to multiply the i-th line of \({\varvec{A}}_{{{\varvec{CDT}}}}\) by \({\Upsilon }_{ii}\), would be the same thing that multiply each face flux of the cell \(\hat{i}\) by \({\Upsilon }_{ii}\). This would violate the mass conservation. Considering a face \(\overline{k}\) shared by two cells \(\hat{R}\) and \(\hat{L}\), as shown in Fig. 1, then the CDT flux through \(\overline{k}\) is present in both L-th and R-th lines of \({\varvec{A}}_{{{\varvec{CDT}}}}\). This way, through \({{\varvec{\Upsilon}}}{\varvec{A}}_{{{\varvec{CDT}}}}\), the CDT flux through \(\overline{k}\) would be multiplied by \({\Upsilon }_{LL}\) in the flux balance of \(\hat{L}\) and by \({\Upsilon }_{RR}\) in the flux balance of \(\hat{R}\). This would obviously destroy the flux continuity on \(\overline{k}\). Therefore, it is necessary to determine a unique value \(\alpha\) as the weighting factor to the cross-diffusion flux on each cell face as:

$$ \alpha_{{\overline{k}}} \in F^{k} = Y^{L} \cap Y^{R} $$
(25)

On the other hand, if \(F^{k} = \emptyset\), we perform a different procedure, in which we need to verify if there is any DMP violation at \(\hat{L}\) or \(\hat{R}\). If the DMP violation occurs only at \(\hat{L}\), then \(F^{k} = Y^{L}\). Analogously, if there is a DMP violation only at \(\hat{R}\), then \(F^{k} = Y^{R}\). However, if there is a DMP violation at both \(\hat{L}\) and \(\hat{R}\), we simply use \(F^{k} = \left\{ {0.5\left[ {\min \left( {Y^{i} } \right) + \min \left( {Y^{j} } \right)} \right],0.5\left[ {\max \left( {Y^{i} } \right) + \max \left( {Y^{j} } \right)} \right]} \right\}\). For the case where there is no DMP violation, \(F^{k} = \left[ {0,1} \right]\). Then the unique value of \(\alpha_{{\overline{k}}}\) is defined as:

$$ \alpha_{{\overline{k}}} = \left\{ {\begin{array}{*{20}l} {if \max \left( {F^{k} } \right) < 1 \to \max \left( {F^{k} } \right)} \hfill \\ {if \max \left( {F^{k} } \right) = 1 \to 0.5\left[ {\min \left( {F^{k} } \right) + \max \left( {F^{k} } \right)} \right]} \hfill \\ \end{array} } \right. $$
(26)

Thus, we can see that as we have defined \({\mathbb{V}}\) as a set of cells violating DMP, we need to define a set of faces \({\mathbb{F}}\) whose CDT flux will be modified to avoid spurious solutions. This set will consist of all the faces comprising the cells in \({\mathbb{V}}\). Then, to formally guarantee flux continuity through a face \(\overline{k} \in {\mathbb{F}}\), \({\varvec{A}}_{{{\varvec{CDT}}}}\) must be corrected as follows:

$$ \left\{ {\begin{array}{*{20}c} {{\varvec{A}}_{{{\varvec{CDT}}}}^{{\hat{L}}} = {\varvec{A}}_{{{\varvec{CDT}}}}^{{\hat{L}}} + \left( {\alpha_{{\overline{k}}} - 1} \right)\left[ {\left. {\left( {{\vec{\mathcal{F}}} \cdot \vec{N}} \right)_{CDT} } \right|_{{\overline{k} \in {\mathbb{F}}}} } \right]} \\ {{\varvec{A}}_{{{\varvec{CDT}}}}^{{\hat{R}}} = {\varvec{A}}_{{{\varvec{CDT}}}}^{{\hat{R}}} - \left( {\alpha_{{\overline{k}}} - 1} \right)\left[ {\left. {\left( {{\vec{\mathcal{F}}} \cdot \vec{N}} \right)_{CDT} } \right|_{{\overline{k} \in {\mathbb{F}}}} } \right]} \\ \end{array} } \right. $$
(27)

Evidently, \({\varvec{D}}_{{{\varvec{CDT}}}}\), \({\varvec{U}}_{{{\varvec{CDT}}}}\), \({\varvec{L}}_{{{\varvec{CDT}}}}\) and \({\varvec{b}}_{{{\varvec{CDT}}}}\) will be modified accordingly, because of the modification of \({\varvec{A}}_{{{\varvec{CDT}}}}\). Since we compute \(\alpha_{{\overline{k}}}\) explicitly, face by face in \({\mathbb{F}}\), these modifications may give rise to some undesirable side effects in other cells in terms of DMP violation. Therefore, the process described by Eqs. (21)–(27) is repeated, as shown in the algorithm in Fig. 2, until the condition in Eq. (16) is fulfilled. As it is well known that the classic linear TPFA method is a monotone formulation [34], we note that such a condition will be necessarily satisfied, at least in the extreme case in which \(\Upsilon = 0\) and the CDT terms vanish. Thus, since we ensure the DMP in each iteration, the converged solution will undoubtedly satisfy the DMP. In the present paper we consider the solution converged when the iteration residue at the t-th iteration is \({\mathfrak{r}}_{t} < 10^{ - 3} {\mathfrak{r}}_{1}\), where \({\mathfrak{r}}_{1}\) is the first iteration residue, calculated from the initial guess \(u^{0}\). Beyond this, we adopted \(\delta = 10^{ - 6}\).

Fig. 2
figure 2

The MPFA-DNL algorithm

4 Results

In this section, we show the effectiveness of our non-linear formulation (MPFA-DNL) for the solution of some benchmark problems found in literature. Considering that the exact solution is given by \({{\mathbb{U}}}\) and the approximate solution is represented by u, we can define the relative \(\ell^{2}\) norm of error for the scalar unknown u [26, 35] as:

$$ \ell_{u}^{2} = \sqrt {\frac{{\mathop \sum \nolimits_{i = 1}^{n} \left( {{\mathbb{U}}_{i} - u_{i} } \right)^{2} {\Omega }_{i} }}{{\mathop \sum \nolimits_{i = 1}^{n} {\mathbb{U}}_{i}^{2} {\Omega }_{i} }}} $$
(28)

and for its gradient \(\nabla u\) as:

$$ \ell_{\nabla u}^{2} = \sqrt {\frac{{\mathop \sum \nolimits_{i = 1}^{n} \left| {\nabla {\mathbb{U}}_{i} - \nabla u_{i} } \right|^{2} \Omega_{i} }}{{\mathop \sum \nolimits_{i = 1}^{n} \left| {\nabla {\mathbb{U}}_{i} } \right|^{2} \Omega_{i} }}} $$
(29)

for which the numerical convergence rate is given by [35]:

$$ q_{{\mathfrak{z}}} = - 3\frac{{\log \left( {\frac{{\ell_{{{\mathfrak{z}},m}}^{2} }}{{\ell_{{{\mathfrak{z}},m - 1}}^{2} }}} \right)}}{{\log \left( {\frac{{\fancyscript{n}_{m} }}{{\fancyscript{n}_{m - 1} }}} \right)}} $$
(30)

for two successive meshesFootnote 1 (\(m - 1\) and m), with \(m > 1\) and \({\mathfrak{z}} = u, \nabla u\). Furthermore, n is the total number of degrees of freedom of a mesh. We can also define the undershoot and overshoot norm of the error as [36]:

$$ \varepsilon_{m} = \sqrt {\mathop \sum \limits_{i = 1}^{n} \left[ {\max^{2} \left( {0,u_{i} - {\mathbb{U}}_{\max } } \right) + \max^{2} \left( {0,{\mathbb{U}}_{\min } - u_{i} } \right)} \right] \Omega_{i} } $$
(31)

where \({\mathbb{U}}_{\max }\) and \({\mathbb{U}}_{{{\text{min}}}}\) are, respectively, the maximum and the minimum values for the solution defined by the boundary.

4.1 Heterogeneous Diagonal-Anisotropic Media

We have manufactured this example to show that the MPFA-DNL corrects the DMP violation without degrading the numerical convergence rates of the MPFA-D. This problem has an analytic solution over the domain \(\Omega = \left[ {0,1} \right]^{3}\), that implies in a non-homogeneous Dirichlet boundary condition on \(\Gamma_{D}\), defined as:

$$ u\left( {x,y,z} \right) = x\left( {1 - x} \right)y\left( {1 - y} \right)z\left( {1 - z} \right) $$
(32)

with an anisotropic diffusion tensor given by:

$$ \textbf{K}= \left[ {\begin{array}{*{20}c} {x + 1} & 0 & 0 \\ 0 & {y + 1} & 0 \\ 0 & 0 & {10\left( {z + 1} \right)} \\ \end{array} } \right] $$
(33)

and with a source term computed from using the definitions given by Eq. (32) and (33) in Eq. (1). In Tables 1 and 2, we can see the comparison between some results obtained with the MPFA-DNL and with the MPFA-D in its original (non-iterative) version. Table 1 shows how the MPFA-DNL is successful at avoiding the undershoots observed when we use the MPFA-D, what is reinforced by the norm \(\varepsilon_{m}\).

Table 1 Results for the test 4.1—heterogeneous diagonal-anisotropic media
Table 2 Results for the test 4.1—heterogeneous diagonal-anisotropic media

Table 2 and Fig. 3, show that, despite the modifications performed by the non-linear defect correction approach on the original MPFA-D matrix, aiming to avoid the DMP violation, the convergence rates of our the MPFA-DNL method are not degraded. In fact, for certain meshes the errors were slightly smaller for the MPFA-DNL when compared to the original linear MPFA-D method.

Fig. 3
figure 3

The mesh convergence graphs for the test 4.1–Heterogeneous Diagonal-Anisotropic Media: on the scalar variable (left) and on its gradient (right)

4.2 Anisotropic Hollow Domain

Now, we consider the problem proposed by Danilov and Vassilevski [37]. In this problem, we consider a cubic domain \({\Omega } = \left[ {0,1} \right]^{3}\) with a central cubic hole \({\Omega }_{h} = \left[ {0.4,0.6} \right]^{3}\). At the external boundary \(\partial {\Omega }\), the scalar variable is set as \(u_{e} = 0\) and, at the internal edge \(\partial {\Omega }_{h}\), the scalar variable is set as \(u_{i} = 2\).

The anisotropic diffusion tensor is defined as:

$$ \textbf{K} = R_{z}^{T} R_{y}^{T} R_{x}^{T} \left[ {\begin{array}{*{20}c} {100} & 0 & 0 \\ 0 & {10} & 0 \\ 0 & 0 & 1 \\ \end{array} } \right]R_{x} R_{y} R_{z} $$
(34)

where:

$$ R_{x} = \left[ {\begin{array}{*{20}c} 1 & 0 & 0 \\ 0 & {\cos \theta } & { - \sin \theta } \\ 0 & {\sin \theta } & {\cos \theta } \\ \end{array} } \right]; R_{y} = \left[ {\begin{array}{*{20}c} {\cos \beta } & 0 & {\sin \beta } \\ 0 & 1 & 0 \\ { - \sin \beta } & 0 & {\cos \beta } \\ \end{array} } \right]; R_{z} = \left[ {\begin{array}{*{20}c} {\cos \delta } & { - \sin \delta } & 0 \\ {\sin \delta } & {\cos \delta } & 0 \\ 0 & 0 & 1 \\ \end{array} } \right] $$
(35)

with \(\theta = \pi /3\), \(\beta = \pi /4\) and \(\delta = \pi /6\). Results for both, the linear MPFA-D and the MPFA-DNL are shown in Table 3. In this table, we can see that the MPFA-D violates the DMP for all the tested meshes. On the other hand, the MPFA-DNL keeps the solution within the limits defined by the boundary conditions. In Fig. 4, we can see the scalar variable field at \(y=0.5\). As it can be seen, the MPFA-DNL clearly produces a smooth solution without spurious oscillations even for this test case in which we have a highly anisotropic diffusion tensor while the linear MPFA-D produces solutions with both, under and overshoots for almost all meshes used.

Table 3 Results for the test 4.2—anisotropic hollow domain
Fig. 4
figure 4

Scalar variable field on the mesh with 17,544 tetrahedra, at \({\varvec{y}} = 0.5\), for test 4.2–Anisotropic Hollow Domain. a Solution with the linear MPFA-D method. b Solution with the new MPFA-DNL. The black regions within the domain indicate overshoots for the scalar variable and the white regions indicate undershoots for the scalar variable

4.3 Two-Halves Anisotropic Hollow Domain

Finally, in the last example, we have devised a 3D example based on the 2D one from Queiroz et al. [36]. In this problem, we consider a cubic domain \(\Omega ={\left[\mathrm{0,1}\right]}^{3}\) with a central cubic hole \({\Omega }_{h}={\left[\mathrm{0.4,0.6}\right]}^{3}\). At the external boundary, \(\partial\Omega \), the scalar variable is set as \({u}_{e}=0\) and at the internal edge, \(\partial {\Omega }_{h}\), the scalar variable is set as \({u}_{i}=2\). The heterogeneous, discontinuous and anisotropic diffusion tensors are defined as:

$$ \textbf{K}_{1} = R_{z}^{T} R_{y}^{T} R_{x}^{T} \left[ {\begin{array}{*{20}c} {100} & 0 & 0 \\ 0 & {10} & 0 \\ 0 & 0 & 1 \\ \end{array} } \right]R_{x} R_{y} R_{z} \quad \forall x \le 0.5 $$
(36)

where:

$$ R_{x} = \left[ {\begin{array}{*{20}c} 1 & 0 & 0 \\ 0 & {\cos \theta } & { - \sin \theta } \\ 0 & {\sin \theta } & {\cos \theta } \\ \end{array} } \right]; R_{y} = \left[ {\begin{array}{*{20}c} {\cos \beta } & 0 & {\sin \beta } \\ 0 & 1 & 0 \\ { - \sin \beta } & 0 & {\cos \beta } \\ \end{array} } \right]; R_{z} = \left[ {\begin{array}{*{20}c} {\cos \delta } & { - \sin \delta } & 0 \\ {\sin \delta } & {\cos \delta } & 0 \\ 0 & 0 & 1 \\ \end{array} } \right] $$
(37)

with \(\theta = \pi /3\), \(\beta = \pi /4\) and \(\delta = \pi /6\) and:

$$ K_{2} = \left[ {\begin{array}{*{20}l} {\xi \mathbb{X}^{2} + \mathbb{Y}^{2} + \mathbb{Z}^{2} } \hfill & { - \left( {1 - \xi } \right)\mathbb{XY}} \hfill & { - \left( {1 - \xi } \right)\mathbb{XZ}} \hfill \\ { - \left( {1 - \xi } \right)\mathbb{XY}} \hfill & {\mathbb{X}^{2} + \xi \mathbb{Y}^{2} + \mathbb{Z}^{2} } \hfill & { - \left( {1 - \xi } \right)\mathbb{YZ}} \hfill \\ { - \left( {1 - \xi } \right)\mathbb{XZ}} \hfill & { - \left( {1 - \xi } \right)\mathbb{YZ}} \hfill & {\mathbb{X}^{2} + \mathbb{Y}^{2} + \xi \mathbb{Z}^{2} } \hfill \\ \end{array} } \right]\quad \forall x > 0.5 $$
(38)

where \(\xi = 1000\), \({\mathbb{X}} = x + \xi^{ - 1}\), \({\mathbb{Y}} = y + \xi^{ - 1}\), \({\mathbb{Z}} = z + \xi^{ - 1}\). In Table 4 we present the under and overshoot norms of error for the linear MPFA-D and our new MPFA-DNL. In this table, we can see that, again, the linear version of MPFA-D violates the DMP, returning completely non-physical solutions with strong spurious oscillations for all tested meshes. On the other hand, the MPFA-DNL, even for this highly anisotropic and discontinuous diffusion tensor, keeps the solution between the maximum and the minimum physical bounds for all tested meshes. In Fig. 5, we present the scalar variable field at \(y=0.5\) for the mesh with 15,376 control volumes and again we see that the MPFA-DNL produces a smooth solution without spurious oscillations even for this test case in which we have a highly anisotropic and heterogeneous diffusion tensor while the linear MPFA-D produces solutions with both, strong under and overshoots for all meshes used.

Table 4 Results for the test 4.3—two-halves anisotropic hollow domain
Fig. 5
figure 5

Scalar variable field on the mesh with 15,376 tetrahedra, at \(y = 0.5\), for test 4.3—Two-Halves Anisotropic Hollow Domain. a Solution with the linear MPFA-D method. b Solution with the new MPFA-DNL. The black regions within the domain indicate overshoots for the scalar variable and the white regions indicate undershoots for the scalar variable

5 Conclusions

In this paper, we have presented the new MPFA-DNL method, which is a modified nonlinear version of the original linear MPFA-D method of Lira Filho et al. [26]. Our new method was designed to avoid the violation of the Discrete Maximum Principle (DMP) that may occur in MPFA-D solutions, since it is not a monotone scheme, particularly for highly heterogeneous and anisotropic diffusion tensors or distorted meshes. We have modified the original linear MPFA-D through of a flux splitting strategy [15, 16] that splits the flux in a Two-Point Flux Approximation (TPFA) flux contribution and the Cross Diffusion Terms (CDT). Since the latter part is the potential source of spurious oscillations in the scalar field, we perform a flux limiting [18] on the CDT part. These modifications gave us a method which is capable to satisfy the Discrete Maximum Principle eliminating spurious oscillations for the scalar field, even for highly heterogeneous and arbitrary anisotropic diffusion tensors, without harming the convergence rates of the original MPFA-D. Thus, our method is still capable to achieve second order of accuracy on the scalar field and first order on its gradient. In this paper, we restrict ourselves to unstructured tetrahedral meshes, even though, in principle, there is no restriction to extend the method to other polyhedral control volumes.