Introduction

In the numerical solution of the equations of mathematical physics, discretization and localization are the most important tools for simplifying the problem. We assume that some equations are given that are valid at all points of a given two-dimensional domain. Thus, all points of the domain are connected (interact) with each other by means of these equations.

Discretization assumes that only points from a finite set \(V_n\) interact with each other. We call the points from this finite set \(V_n = \{P_1,P_2,...,P_n\}\) knotes. Discretization results in a matrix \(M_n\) of size \(n\times n\). Any element \(a_{ij}\) of matrix \(M_n\) shows the value of interaction between knotes \(P_i\) and \(P_j\).

Localization assumes that only close knotes interact with each other. Localization requires a strict definition of which pairs of knotes are considered close and which are not. Usually, a list of pairs of close knotes is given. Localization leads to the fact that in the matrix \(M_n\) a large number of elements \(a_{ij}\) vanish, if the pair of knotes \(P_i\) and \(P_j\) is not included in the list of pairs of close knotes.

Consider a graph connecting all pairs of close knotes. In this paper, we consider only planar graphs that form a polygon tessellation. In this case, the pairs of close knotes \(P_i\) and \(P_j\) are called neighbors and denoted by \(P_i\sim P_j\).

Discretization and localization often lead to a system of linear equations with variable coefficients, where the element \(a_{ij}\) of the corresponding matrix is equal to zero if the pair of knotes \(P_i\) and \(P_j\) is not neighboring.

In modern practical problems of mathematical physics, the number of knotes is huge, up to several million. Therefore, the use of direct methods for solving systems of equations (for example, the Gauss method) is practically impossible. For the iterative methods used, the rate of convergence of successive approximations depends on the magnitude of the off-diagonal elements.

The well-known diagonal dominance principle [2] states that the smaller the sum of off-diagonal elements is, the faster the iterative process converges. In the ideal case, when all off-diagonal elements are equal to zero, the system is solved in one iteration.

The present paper shows how it is possible to speed up the rate of convergence of the iterative solution process without changing the position of the grid vertices. A class of matrices is found whose mesh optimization leads to Delaunay triangulation. An example of using the results of the paper in the numerical solution of the magnetic field is given.

Matrices generated by tessellation

Denote by \(int\;D\) the interior of the convex domain D in the plane, and by \(conv(V_n)\) the convex hull of the points \(V_n=\{P_1,P_2,...,P_n\}\). A finite set \(\{D_j\}_{j=1}^m\) of convex polygons is called a tessellation with \(V_n\) vertices if the following conditions are valid:

  1. 1)

    The interiors of polygons are pairwise disjoint: \(int\; D_i\cap int\; D_j =\emptyset\), \(i\ne j\).

  2. 2)

    The set of all vertices of all polygons coincides with \(V_n\).

  3. 3)

    The union of all polygons fills the convex hull of all vertices: \(\bigcup \limits _{j=1}^n D_j=conv(V_n)\).

A tessellation consisting only of triangles is called triangulation.

Fig. 1
figure 1

Polygons \(D_{ij}\) and \(D_{ji}\)

Consider a pair of neighboring knotes \(P_i\sim P_j\). The segment \(P_iP_j\) is a side for two polygons lying in different half-planes with respect to the straight line passing through the points \(P_i\) and \(P_j\). Denote by \(D_{ij}\) the polygon that lies in the left half-plane as viewed from \(P_i\) to \(P_j\). The second polygon will be respectively \(D_{ji}\) (see Fig. 1).

We say that a matrix \(M_n\) is generated by a tessellation \(T=\{D_j\}_{j=1}^m\) with vertices \(V_n\) if its off-diagonal elements \(a_{ij}\), \(i\ne j\) are functions of the polygon \(D_{ij}\): \(a_{ij}=f(D_{ij})\). Matrices generated by tessellation arise in the numerical solution of boundary value problems by the finite element method.

The finite element method

Let D be a convex bounded domain on the plane and \(\mathcal F (\mathcal C)\) be the space of continuous functions on D satisfying some boundary condition \(\mathcal C\) on the boundary \(\partial D\). Consider the following boundary value problem: which function \(F\in \mathcal F (\mathcal C)\) minimizes the given functional \(\Psi (F)\)?

The finite element method assumes that the domain D is divided into polygons (elements) that form a tessellation, denote it by T. Inside each element, the desired function F is assumed to be linear [3]. Thus, the desired solution to the boundary value problem is approximated by a piecewise linear function whose linearity subdomains form the tessellation T.

Let the tessellation T have n internal (non-boundary) knotes \(P_1,P_2,...,P_n\). The piecewise linear approximation of a continuous function F corresponding to the tessellation T is the piecewise linear function \(F_T\) whose values at the knotes \(P_1,P_2,...,P_n\) coincide with the values of the function F: \(F_T(P_k)=F(P_k)\), \(k=1,2,...,n\).

Denote by \(PL(T,\mathcal C)\) the set of piecewise linear continuous functions on D satisfying the boundary condition \(\mathcal {C}\) on the boundary \(\partial D\) and corresponding to the given tessellation T. Our boundary value problem will be replaced by the following one: which function from \(PL(T,\mathcal C)\) minimizes the given functional \(\Psi (F)\)?

We set \(z_k=F_T(P_k)=F(P_k)\). Each function \(F_T\in PL(T,\mathcal C)\) is uniquely determined by the values \(z_1,z_2,...,z_n\) for a fixed tessellation T and the boundary condition \(\mathcal C\). Therefore, the minimization of the functional is reduced to solving the following system of equations:

$$\begin{aligned} \frac{\partial }{\partial z_k} \Psi (F_T(z_1,...,z_n))=0,\quad k=1,2,...,n. \end{aligned}$$
(1)

Observe that in the system of Eq. 1, the unknowns are the values \(z_k\) of the function \(F_T\) at the internal knotes \(P_1,P_2,...,P_n\) of the tessellation T. The number of the unknowns is equal to the number of equations and is equal to the number of internal knotes of the tessellation T.

Delaunay triangulations

Below, we consider only matrices generated by triangulations. A tessellation of triangles \(\{D_j\}_{j=1}^m\) is called a Delaunay triangulation with knotes \(V_n=\{P_i\}_{i=1}^n\) if the following condition is satisfied [4]: for any triangle \(D_j\), no point from \(V_n\) falls inside the circumscribed circle \(K(D_j)\):

$$int\;K(D_j)\cap \{P_i\}_{i=1}^n=\emptyset ,\quad j=1,..., m.$$

By \(\mathcal D (V_n)\), we denote the Delaunay triangulation with the knot system \(V_n\). In [4], it was proved that for any finite set of points \(V_n\), there exists a Delaunay triangulation \(\mathcal D(V_n)\) (not necessarily unique) (see also [1]). Below, we use the following extreme property of Delaunay triangulation.

Proposition 1

[5] Among all triangulations with a given set of vertices, the sum of the cotangents of the interior angles of all triangles is minimal for Delaunay triangulation.

Consider a matrix \(M_n\) generated by a triangulation T with vertices \(V_n=\{P_1,P_2,...,P_n\}\) and a pair of neighboring knotes \(P_i\sim P_j\) of this triangulation. Denote by \(\gamma _{ij}\) the interior angle of the triangle \(D_{ij}\), which lies opposite the side \(P_iP_j\) (see Fig. 1). Assume that the off-diagonal elements \(a_{ij}\), \(i\ne j\) of the matrix \(M_n\) are equal to \(\cot \gamma _{ij}\). We call such matrix a cotangent matrix. It will be shown below that the optimization of cotangent matrices leads to Delaunay triangulation.

Optimal triangulations

Denote by \(\mathcal {T}(V_n)\) the set of all possible triangulations with vertices \(V_n=\{P_1,P_2,...,P_n\}\), by S(M(T)) the sum of the absolute values of the off-diagonal elements \(a_{ij}\), \(i\ne j\) of the matrix M(T) generated by the triangulation T.

Consider two triangulations \(T_1,T_2\in \mathcal {T}(V_n)\). We say that triangulation \(T_1\) is better than triangulation \(T_2\) if \(S(M(T_1))<S(M(T_2))\). Proposition 1 implies the following assertion.

Theorem 1

For cotangent matrices with \(V_n\) vertices, the best triangulation is the Delaunay triangulation \(\mathcal D (V_n)\).

Consider a system of linear equations with the matrix M(T) generated by the triangulation T. We solve this system of equations by the method of successive iterations. According to the principle of diagonal dominance, the higher the rate of convergence of successive approximations is, the better the triangulation is T.

Corollary 1

Among all possible cotangent matrices with \(V_n\) vertices, the rate of convergence of the iterative process is the best for the Delaunay triangulation \(\mathcal D (V_n)\).

Now, consider the matrix \(M_n\), whose off-diagonal elements \(a_{ij}\) have the form \(w(D_{ij})\cot \gamma _{ij}\), where \(w(D_{ij})\) is a function of the triangle \(D_{ij}\). We call such a matrix a weight cotangent matrix with a weight function w(D).

Theorem 2

Let the weight function w(D) have a uniformly bounded density with respect to the Lebesgue measure. For the weight cotangent matrix with vertices \(V_n\) and the weight function w(D), the Delaunay triangulation \(\mathcal D (V_n)\) is optimal in the following sense: if the iterative process for the system of linear equations with matrix \(M(\mathcal D (V_n))\) diverges, then it also diverges for any matrix M(T), \(T\in \mathcal {T}(V_n)\). And vice versa, if the iterative process for a system of linear equations with matrix M(T) for some triangulation \(T\in \mathcal {T}(V_n)\) converges, then it also converges for the matrix \(M(\mathcal D (V_n))\) generated by the Delaunay triangulation.

Proof

Let us have an inhomogeneous system of linear equations \(AX=B\), where A is the weight cotangent matrix, X is the column of unknowns, B is the column of free terms. Denote by \(X_i^{(k)}\) the k-th approximation to the unknown \(X_i\), \(i=1,2,...,n\). It is calculated using the recursive relation

$$\begin{aligned} X_i^{(k+1)}=\frac{B_i}{a_{ii}}-\sum _{j\ne i}\frac{a_{ij}}{a_{ii}} X_j^{(k)} . \end{aligned}$$
(2)

The discrepancy \(\epsilon _i^{(k)}\) is the difference between two successive approximations:

$$\epsilon _i^{(k)}=X_i^{(k+1)}-X_i^{(k)}$$

For discrepancy, we have a similar system of equations, but already homogeneous:

$$\epsilon _i^{(k)}=-\sum _{j\ne i}\frac{a_{ij}}{a_{ii}}\epsilon _j^{(k-1)},\quad i=1,2,...,n.$$

The iterative process Eq. 2 converges if the total discrepancy \(\sum \limits _{i=1}^n|\epsilon _i^{(k)}|\) tends to zero as \(k\rightarrow \infty\). Therefore, the total discrepancy for the weight cotangent matrix can be majorized by the total discrepancy for the cotangent matrix with weight \(w(D)\equiv 1\). But for the latter, the assertion of the theorem is valid by virtue of Theorem 1. Theorem 2 is proved.

Example

Let us give an example of a boundary value problem, in the solution of which by the finite element method, there arise weight cotangent matrices. Consider the following functional

$$\begin{aligned} \Psi (F)=\underset{D}{\iint }\left[ \frac{1}{\mu }\left( \frac{\partial F(x,y)}{\partial x}\right) ^2+\frac{1}{\mu }\left( \frac{\partial F(x,y)}{\partial y}\right) ^2-J(x,y)F(x,y)\right] dxdy, \end{aligned}$$
(3)

where \(\mu (x,y)\) and J(xy) are given smooth functions. Note that, according to Euler’s variational formula, finding the extremum of the functional Eq. 3 is equivalent to solving the following differential equation:

$$\begin{aligned} \frac{\partial }{\partial x} \left( \frac{2}{\mu }\frac{\partial F}{\partial x}\right) + \frac{\partial }{\partial y} \left( \frac{2}{\mu }\frac{\partial F}{\partial y}\right) -J=0. \end{aligned}$$
(4)

Let us assume that an electric current flows perpendicular to a given planar domain D. This current generates an electromagnetic field with a vector magnetic potential \(\vec {F}\). Taking the plane on which the domain D lies as the coordinate plane, we obtain that the two components of the vector \(\vec {F}\) are equal to zero. Then, the electromagnetic field expends energy \(\Psi (F)\), determined by the formula Eq. 3, where F(xy) is the third component of the vector \(\vec {F}\), J(xy) is the current density at the point (xy), and \(\mu\) is the magnetic permeability of the medium [6].

Maxwell’s classical law states that the electromagnetic field propagates in such a way that energy loss is minimal. Thus, the problem of determining the electromagnetic potential F(xy) is reduced to minimizing the functional Eq. 3 and therefore to solving the system of Eq. 1.

Theorem 3

The matrix of the system of Eq. 1 for the functional Eq. 3 is a weight cotangent matrix.

Proof

The piecewise linear approximation \(F_T\) to the continuous function F, which corresponds to the triangulation T, is uniquely determined by the values \(z_1,z_2,...,z_n\) and has the form

$$\begin{aligned} F_T(x,y)=\sum _{t\in T}I_t{(x,y)}\sum _{P_i\in V(t)}\beta _i^t(x,y)z_i, \end{aligned}$$
(5)

where the indicator function \(I_t(x,y)\) is equal to 1 if \((x,y)\in t\) and is equal to zero otherwise; V(t) is the set of vertices of the triangle t, and \(\beta _i^t(x,y)\) is a linear interpolation function equal to 1 at the vertex \(P_i\) and zero at the other two vertices t. Since the area D is divided into non-intersecting triangles, we have \(D=\sum \limits _{t\in T}t\). Therefore,

$$\frac{\partial }{\partial z_i} \Psi (F)=\sum _{t\in T}\iint \limits _t\left[ \frac{2}{\mu }\;\frac{\partial F(x,y)}{\partial x} \frac{\partial }{\partial z_i}\frac{\partial F(x,y)}{\partial x}+\right.$$
$$\left. +\frac{2}{\mu }\;\frac{\partial F(x,y)}{\partial y}\frac{\partial }{\partial z_i}\frac{\partial F(x,y)}{\partial y}+ \frac{\partial }{\partial z_i}J\;F(x,y)\right] dxdy.$$

Using the representation Eq. 5, we get

$$\frac{\partial }{\partial z_i} \Psi (F_T)=\sum _{t\in T}\sum _{P_j\in V(t)} \iint \limits _t\left[ \frac{2}{\mu }\;\frac{\partial }{\partial x}\beta _j^t(x,y)z_j \frac{\partial \beta _i^t(x,y)}{\partial x}+\right.$$
$$\left. +\frac{2}{\mu }\;\frac{\partial }{\partial y}\beta _j^t(x,y)z_j \frac{\partial \beta _i^t(x,y)}{\partial y}+J\;\beta _i^t(x,y)\right] dxdy.$$

Consider a pair of neighboring knotes \(P_i\) and \(P_j\). The segment \(P_iP_j\) is common for triangles \(D_{ij}\) and \(D_{ji}\). Due to the fact that only the triangles \(D_{ij}\) and \(D_{ji}\) simultaneously contain both the knot \(P_i\) and the knot \(P_j\) (which means that only they depend on both \(z_i\) and \(z_j\)), we get

$$\frac{\partial }{\partial z_i}\frac{\partial }{\partial z_j} \Psi (F_T)=\frac{2}{\mu (D_{ij})} \iint \limits _{ D_{ij}}\left[ \frac{\partial \beta _j^{ D_{ij}}(x,y)}{\partial x} \frac{\partial \beta _i^{ D_{ij}}(x,y)}{\partial x}+ \frac{\partial \beta _j^{ D_{ij}}}{\partial y} \frac{\partial \beta _i^{ D_{ij}}}{\partial y}\right] dxdy+$$
$$\begin{aligned} +\frac{2}{\mu (D_{ji})}\iint \limits _{ D_{ji}}\left[ \frac{\partial \beta _j^{ D_{ji}}(x,y)}{\partial x} \frac{\partial \beta _i^{ D_{ji}}(x,y)}{\partial x}+ \frac{\partial \beta _j^{ D_{ji}}(x,y)}{\partial y} \frac{\partial \beta _i^{ D_{ji}}(x,y)}{\partial y}\right] dxdy. \end{aligned}$$
(6)

Let triangle \(D_{ij}\) have vertices \(P_i\), \(P_j\) and \(P_h\) (see Fig. 1). Linear interpolation function \(\beta _i^{ D_{ij}}(x,y)\) has the form

$$\beta _i^{ D_{ij}}(x,y)=\frac{(x-x_j)(y_h-y_j)-(y-y_j)(x_h-x_j)}{(x_i-x_j)(y_h-y_j)-(y_i-y_j)(x_h-x_j)},$$

where \((x_i,y_i)\), \((x_j,y_j)\) and \((x_h,y_h)\) are Cartesian coordinates of the corresponding vertices. We have

$$\begin{aligned} \frac{\partial \beta _j^{D_{ij}}(x,y)}{\partial x} \frac{\partial \beta _i^{D_{ij}}(x,y)}{\partial x}=\frac{(y_h-y_j)(y_i-y_h)}{[(x_i-x_j)(y_h-y_j)-(y_i-y_j)(x_h-x_j)]^2}. \end{aligned}$$
(7)

Observe that for the area \(|D_{ij}|\) of triangle \(D_{ij}\), we have

$$2|D_{ij}|=|(x_i-x_j)(y_h-y_j)-(y_i-y_j)(x_h-x_j)|.$$

Therefore,

$$\iint \limits _{ D_{ij}}\left[ \frac{\partial \beta _j^{ D_{ij}}}{\partial x} \frac{\partial \beta _i^{ D_{ij}}}{\partial x}+\frac{\partial \beta _j^{ D_{ij}}}{\partial y} \frac{\partial \beta _i^{ D_{ij}}}{\partial y})\right] dxdy=$$
$$=c_1(D_{ij})\frac{\left[ (y_h-y_j)(y_i-y_h)+(x_h-x_j)(x_i-x_h)\right] }{|D_{ij}|}.$$

It remains to note that the numerator is equal to a scalar product of two vectors, which is proportional to the cosine of the angle \(\gamma _{ij}\), and the denominator is proportional to the sine of the same angle.

Similarly, we can prove that in Eq. 6, the value of the integral over the triangle \(D_{ji}\) is proportional to cotangent of the angle \(\gamma _{ji}\). Theorem 3 is proved.

A good example of a numerical solution to the problem of minimizing functional Eq. 3 using a Delaunay mesh is given in [5].