Solving Elliptical Equations in 3D by Means of an Adaptive Refinement in Generalized Finite Differences

We apply a 3D adaptive refinement procedure using meshless generalized finite difference method for solving elliptic partial differential equations.This adaptive refinement, based on an octree structure, allows adding nodes in a regularway in order to obtain smooth transitions with different nodal densities in themodel. For this purpose, we define an error indicator as stop condition of the refinement, a criterion for choosing nodes with the highest errors, and a limit for the number of nodes to be added in each adaptive stage. This kind of equations often appears in engineering problems such as simulation of heat conduction, electrical potential, seepage through porous media, or irrotational flow of fluids. The numerical results show the high accuracy obtained.


Introduction
The generalized finite difference method, hereafter GFDM, is a meshless method that allows the linearization of the partial derivatives in a partial differential equation. Among the first works of the method, the works of Jensen [1], Perrone and Kao [2], Liszka and Orkisz [3], and Orkisz [4] are highlighted. Later, Benito et al. [5] provided explicit formulae of the GFDM and Ureña et al. [6] provided a compact matrix formulation of the method. Gavete et al. [7] reported improvements of the GFDM and comparison with other meshless methods. Various applications and implementations of the GFDM have been developed for solving different inverse problems by Fan et al. [8,9]. Hosseini [10,11] has applied the GFDM for natural frequency analysis of nanocomposite cylinders and for shock-induced two-dimensional coupled non-Fickian diffusion-elasticity analysis.
Clark et al. [12] have investigated the problem of optimizing and adapting a surface mesh with high-order accurate nodal positions using the GFDM. The GFDM has been also used for solving 3D partial differential equations by Izadian et al. [13], Gavete et al. [14], and Hua et al. [15]. The GFDM was also applied for different practical tasks as in Chan et al. [16] for solving two-dimensional nonlinear obstacle problems, in Zhang et al. [17,18] for simulating two-dimensional sloshing phenomena and for propagation of nonlinear water waves, in Mochnacki and Majchrzak [19] for modelling of casting solidification, and in Li and Fan [20] for solving two-dimensional shallow water equations.
In 2D, two adaptive methods have been described in Benito et al. [21][22][23] using a posteriori error indicator. In 3D, an adaptive method has been described in Benito et al. [24]. These adaptive methods add nodes as midpoints between the central node and the furthest nodes in the star or in the barycentre of triangles formed in the star.
Both in 2D and in 3D, Ureña et al. [25] have developed an improved adaptive method based on previous ones and with the ability of moving and removing nodes. This improved adaptive method allows greater reductions of the error using even fewer nodes.
An advantage of increasing few nodes in a domain is to avoid the increasing in the calculation time. However, if the calculation time is not a problem and it is possible to add much more nodes, then it is better to use an adaptive method that places nodes in a more regular way than the improved adaptive method given in [25]. With this in mind, 2 Mathematical Problems in Engineering Gavete et al. [26] developed an adaptive method using a quadtree algorithm in 2D obtaining satisfactory results. The improved adaptive method and the proposed adaptive method using quadtree structure are not incompatible; in fact, they complement each other.
It is more difficult to deal with adaptivity in 3D cases because the appearing of degenerated solutions is possible and it is also necessary to keep the number of nodes that are added in the refinement stages limited.
In this paper, an octree data structure for avoiding the possibility of obtaining degenerated solutions in the adaptive process is shown. Because of the local behaviour of the refinement procedure and after successive refinement iterations, a cloud of nodes with different nodal densities is obtained. The octree split is controlled by an error indicator and a constraint that limit the possibility of adding too many nodes in each refinement stage, in order to obtain smooth transitions between the different nodal densities in the model.
In the developed adaptive algorithm, the following characteristics are included: the use of a background octree structure, a criterion of selection of cells based on the variations of the gradient, an error indicator that works as a stop condition, and a limit for the addition of new nodes in each refinement stage. Moreover, different 3D elliptic partial differentials equations are solved for cases with sharp gradients. A practical application to the electric potential problem with unknown solution is also included.
The remainder of the paper is organized as follows. In Section 2, the GFDM for solving 3D elliptic equations is reviewed. Section 3 describes the use of the octree structure, the error indicator, and the implemented 3D adaptive procedure. Several examples are given in Section 4 where the application of the method to reduce the error is analyzed for different elliptic PDEs including cases with singularities in the solution. Finally, conclusions are given in Section 5.

Let
⊂ R 3 and x ∈ be a domain and a point of such domain and let us consider the following 3D elliptical partial differential equation: with Dirichlet boundary condition where is the unknown function and and are known functions.
Since generalized finite differences method is a meshless method, a discretization of the domain, ⊂ , is performed. Given a star (x 0 ) = {x 0 , x 1 , . . . , x }, the Taylor series is developed for each node in the star and the resulting Taylor series are summed. Then the function given by the sum of the weighted quadratics errors in Taylor series for terms up to second order is defined: where = (x 0 , x ) is the weighting function, 0 = (x 0 ) and = (x ) are the approximations of 0 = (x 0 ) and = (x ), respectively, and is the number of nodes of the star without the central node. In 3D, the vectors D and are In order to minimize the error, the function defined in (3) is minimized and the following system is obtained: where Solving (5) for D , the approximated values of the partial derivatives are obtained and, substituting these values in the original equation (1), the equation of the star is achieved: The numerical values in each inner node are obtained by solving the linear system of equations formed by each equation of the star. For more details about this matrix formulation see [6]. Consistency, Order, and Convergence. In order to obtain the truncation error, Taylor series expansion including higher order derivatives is used and therefore a higher order function * (D ) is obtained. The expression of * (D ) is similar to the one given in (3). If * (D ) is minimized with respect to the partial derivatives down to the second order, the following system is obtained:

Theorem 1. A is a positive definite matrix if and only if the set
Mathematical Problems in Engineering 3 The new term b * * corresponds to the new higher order derivatives incorporated in the Taylor series expansion to extend the function (D ) to * (D ). Then and the truncation error of derivatives is By considering bounded derivatives, the truncation error shows the consistency of the approximation for the equation given in (1). Let 0 = 0 − 0 be the error between the approximate and exact solution at the node x 0 and let us consider (1) for 0 and 0 : Taking into account the fact that it is followed and, appealing to the maximum principle [27], we find that Therefore both the local truncation error TE D and the error are Θ(ℎ 2 , 2 , 2 ) and the numerical solution converges to the exact solution as (ℎ , , ) → (0, 0, 0).
Further details about consistency, order, and convergence are given in [28].
Numerical Convergence. In order to study the rate of convergence numerically, a sequence of uniform discretizations is considered. As in [29], the parameter = +1 / is defined and it was proven that ≈ (ℎ /ℎ +1 ) , where represents the different discretizations, is the rate of convergence, and The considered domain is the unit cube and the considered partial differential equation is the following The considered sequence of discretizations with the same step in the three axes is Table 1 shows the values of , ℎ /ℎ +1 , and . Figure 1 displays the numerical convergence.
As it can be appreciated, the rate of convergence is close to quadratic convergence.

An Adaptive Method Using Octree Algorithm
With the aim of improving the accuracy of the obtained approximation in a particular problem, it is possible to increase the number of nodes in the considered cloud of nodes. Since the GFDM allows using irregular clouds of nodes, the position of the added nodes can be selective and so it is possible to add more nodes in regions with higher errors. An important case of regions with higher errors gives rise when there are sharp variations of the gradient. In those cases, it is important to account for an adaptive algorithm that allows adding nodes as regular as possible. An octree algorithm is a tree data structure based on a cell with eight children. Each cell of an octree represents a cube in the physical space and each child represents an octant of its parent. In the first step, the octree algorithm uses the initial nodes and, hereafter, the process is realized recursively; that is, each cell in turn can be split into eight children that have a higher level than their parent. Figures 2(a) and 2(b) display both the initial structure and the first stage of the refinement.
In spite of the fact that the GFDM is a meshless method and the application of the octree structure requires the computation of a mesh, it is important to note that there is not a loss of applicability in the method as the structure is just needed for the discretization of the domain, but not for the selection of the nodes of the star. Moreover, the use of the octree structure in the adaptive refinement places nodes in a favourable way in order to avoid ill-conditioned stars. Step h As error indicator, we use an algorithm based on the computing of the variations of the gradient between the nodes of an octree cell.
Firstly, the first-order derivatives are calculated by solving (5) and the gradient in each node is calculated as follows: Secondly, for each cell, we calculate the mean value of the absolute variations of the gradient in the nodes of the cell divided by the distances and then this mean value is multiplied by the volume of the cell.
Finally, the criterion of selection of cells is given by where ∈ , is the set of cells formed in the domain, and with = 1, 2, . . . , nas and nas is the number of adaptive stages. As stop condition, we calculate the following error between two successive adaptive stages: where is the solution at the node at the adaptive stage and NI is the number of inner nodes at the adaptive stage .
In order to achieve better results, the following consideration should be taken into account. The refined cells should be less than 15% of the number of cells in the domain in each stage due to the amount of nodes generated by the octree method, 8

Numerical Results
We solve five elliptic problems corresponding to partial differential equations with singularities or sharp variations of the gradients. In addition, we solve a practical case of potential electric where the exact solution is unknown.
In the following examples, we use stars with 16 nodes formed by the octant criterion and we use the potential weighting function where ‖ ⋅ ‖ 2 is the Euclidean norm. The global error is calculated in each stage as follows: where is the solution at the node at the adaptive stage , is the exact solution at the node , and NI is the number of inner nodes at the adaptive stage .
In order to clarify the visualization of the figures, we only show the background octree structure in the boundaries. with exact solution ( , , ) = 1 Note that in (27) there is a singular point in (0,0,0), outside the domain. Figures 3 and 4 show the initial and final discretization of the domain. The initial discretization has 125 nodes; see Table 2. The final discretization has 1776 nodes (8 stages).
The initial global error is 18596% and the final global error is 0.3% after applying the proposed adaptive refinement and Figure 5 shows the successive reductions of the global error in logarithmic scale.

Example 2.
Let us consider the following Poisson problem: with exact solution Note that in (29) there is a singular point in (0, 0, 0), outside the domain. Figures 6 and 7 show the initial and final discretization of the domain. The initial discretization has 125 nodes and is generated as follows: The final discretization has 608 nodes (8 stages). The initial global error is 69% and the final global error is 0.7% after applying the proposed adaptive refinement and Figure 8 shows the successive reductions of the global error in logarithmic scale.

Example 3.
Let us consider the problem governed by the following partial differential equation: The final discretization has 863 nodes (7 stages). The initial global error is 78% and the final global error is 0.7% after applying the proposed adaptive refinement and Figure 11 shows the successive reductions of the global error in logarithmic scale.

Example 4.
Let us consider the problem governed by the following partial differential equation: with exact solution and ( , , ) is the function obtained by applying left hand side in (34) to the exact function. Figures 12 and 13 show the initial and final discretization of the domain. The initial discretization has 125 nodes; see Table 3. The final discretization has 1449 nodes (7 stages). The initial global error is 188418% and the final global error is 0.15% after applying the proposed adaptive refinement and Figure 14 shows the successive reductions of the global error in logarithmic scale.

Example 5.
Let us consider the problem governed by the partial differential equation (34) and with exact solution (35) in a different domain. Figures 15 and 16 show the initial and final discretization of the domain. The initial discretization has 125 nodes and is generated as follows: The final discretization has 3629 nodes (8 stages). The initial global error is 188935% and the final global error is 3% after applying the proposed adaptive refinement and Figure 17 shows the successive reductions of the global error in logarithmic scale.
The initial global errors in the examples are too high because we have generated starting clouds of few nodes to show the extreme conditions of the solutions involved. As it can be seen, the refinement gets large reductions of the global error in a few stages.
The efficiency of the algorithm adding progressively new nodes shows the reduction in the solution error. The refinement procedure creates new nodes in the neighborhood of areas with higher gradients; furthermore these nodes have a more balanced distribution and it is not necessary further constraints to control ill-conditioned stars. Moreover, as the number of new nodes is limited in each adaptive stage, the transition between areas with different density of nodes is smooth.
The method can be also applied to the case of Neumann boundary conditions. In this case the procedure described in [14] for the treatment of Neumann boundary conditions can be used. 4.6. Example 6. Electric fields are used for designing high voltage equipment. In these cases, it is necessary to know the distribution of the electrical potential. In electrical power distribution, a busbar is a metallic strip for local high current         Figures 18 and 19 show the initial and final discretization of the domain. The initial discretization has 125 nodes and the final discretization has 399 nodes (8 refinement stages).
In the octree refinement, the new interior nodes of each stage are incorporated in the next adaptive stages as nodes with unknown potential. As the exact error is unknown, the results obtained in the last adaptive step have been considered as the best approximation to the solution; then formula (25) has been used to compute the global error approximation in the initial and successive adaptive stages by comparing the obtained values with that best approximation. The initial Mathematical Problems in Engineering 13 Figure 19: Final discretization of the domain. global error approximation obtained by using (25) is 29.09% and the final global error approximation is 1.91%. Note that the global error (23) between two successive adaptive stages has been also used as stop condition of the refinement procedure with limit 2% in this case. Figure 20 shows the successive reductions of the global error approximation in logarithmic scale.

Conclusions
A fully automatic 3D adaptive refinement procedure using GFDM for solving elliptic equations has been developed and implemented. An octree background structure has been used to guide the refinement of the clouds of nodes.
An error indicator has been used as a stop condition. This indicator is based on the differences between the gradients of the nodes in the same cell. In each adaptive stage, the number of new nodes is limited in order to obtain smooth transition areas between regions with different gradients. The efficiency of the algorithm is shown by means of the progressive decrease of the error. It is important to note that this adaptive method allows considering a coarse starting cloud of nodes and making it finer in several stages. This allows having a more suitable cloud of nodes adapted to the considered problem.
Simulation of heat conduction, electric potential, seepage through porous media, and irrotational flow of fluids are some problems where it is necessary to solve elliptical partial differential equations. The adaptive procedure refines the regions with high gradients and obtains very accurate results in different types of domain. All has been shown in the considered examples which is why the proposed refinement procedure will help to improve future applications of the GFDM for solving three-dimensional problems in complex domains.

Conflicts of Interest
The authors declare that they have no conflicts of interest.