1 Introduction

The study on heat and mass transfer in porous media widely exists in the development and utilization of environment-friendly geothermal resources, thermal recovery of oil and gas resources, thermal performance of insulation materials, etc. Underground formations are typical porous media, among which the study on coupled heat and mass transfer focuses on the coupling calculation of fluid seepage and heat conduction–convection in porous formation. This coupling effect is mainly reflected in the aspects [1], including the influence of temperature change on fluid viscosity, the influence of temperature on formation porosity, the influence of fluid flow velocity on the strength of heat convection, etc. At present, the numerical simulation methods of coupled mass and heat transfer mainly include finite difference method (FDM) [2], finite element method (FEM) [3], and finite volume method (FVM) [4, 5]. However, these methods are limited by the requirements of geometric regularity of the computational domain and high-quality mesh generation.

The generalized finite difference method (GFDM) is a domain-type meshless method with twenty years. Based on Taylor series expansion of unknown function and weighted least square approximation in a subdomain, the spatial derivatives of unknown function in the governing equation are expressed as the difference scheme of the values of unknown function at nodes in the subdomain, which overcomes the grid dependence of traditional FDM [6, 7]. Up to now, GFDM has been widely used to solve various scientific and engineering problems, including coupled thermoelasticity problem [8,9,10], third- and fourth-order partial differential equations [11], shallow water equations [12], transient heat conduction analysis [13], seismic wave propagation problem [14], stress analysis [15], unsteady Burgers' equations [16, 17], water wave interactions [18], inverse heat source problems [19], nonlinear convection–diffusion equations [20], time-fractional diffusion equation [21], various flow problems [22,23,24]. Gavete et al. [25] reviewed the advantages and disadvantages of GFDM and its applications, analyzed the influence of various factors on the numerical performances of GFDM, and found that the weight function might have little influence on the numerical results. GFDM just uses point clouds for the discretization of the computational domain to realize the effective numerical solution of partial equations, which saves the possible time-consuming and laborious meshing and numerical integration in FEM, FVM, and boundary element method (BEM) [26, 27] for the calculation domains with complex geometry.

This paper focuses on applying GFDM to the modeling of coupled heat and mass transfer problems, which involves not only the diffusion equation about pressure, but also the convection–diffusion equation about temperature. For the convection–diffusion equation, it is often necessary to add upwind weight treatment to the discrete scheme of the convection term. Otherwise, the calculation solution is prone to the situation of inaccurate oscillation. For example, the upstream FEM [28], the upstream FDM [29], and the upstream FVM [30] have been widely used. In meshless methods, currently, modifying the influence domain is generally adopted to realize the upwind effect, including the upwind influence domain [31] of moving the central node position in the upstream direction and the partial influence domain [12, 32, 33] of including the upstream nodes more in the central-node influence domain. For GFDM, Cheng and Liu [32] roughly discussed the upwind effect by constructing a six-point scheme containing more upstream nodes in the influence domain (i.e., the partial influence domain) in GFDM. Li and Fan [12] adopted the partial influence domain to handle the convection-dominated hyperbolic shallow water equations and then used the flux limiter technique to avoid the non-physical wiggles of solutions near discontinuities [33]. However, for porous flow problems, including the coupled calculation of mass and heat transfer in porous media studied in this paper, because the underground velocity field is generally unknown, and the velocity field of reservoir flow may be very complex due to the influence of various geological conditions or source-sink terms caused by drilling wells, it is difficult to obtain a stable upwind effect by modifying the influence domain to ensure good calculation performance. Rao et al. [34] developed an upwind GFDM for two-phase porous flow problems.

Therefore, this paper aims to study the computational performance of the upwind GFDM to heat and mass transfer problem, including the convection-dominated convection–diffusion equation, so as to provide an important reference for constructing a general-purpose numerical simulator for multiphysics coupling porous flow problems based on the upwind GFDM.

The paper is structured as follows. In Sect. 2, the upwind GFDM-based modeling of the single-phase heat and mass transfer problem is given, including the basic physical model in Sect. 2.1, a brief review of GFDM in Sect. 2.2, the upwind GFDM discrete schemes of heat and mass transfer equations in Sect. 2.3, the treatment of boundary conditions in Sect. 2.4, and the application of the upwind GFDM to the meshless solution of the convection–diffusion equation and analysis of the dissipation error in Sect. 2.5. Section 3 gives three numerical examples and a rough error analysis to illustrate the computational performances of the upwind GFDM. The conclusion and future work come in Sect. 4.

2 Methodology

2.1 Governing equations

This paper focuses on the study of single-phase heat and mass transfer in porous media, including diffusion equation about pressure, convection-diffusion equation about temperature, and auxiliary equations of physical quantities affected by pressure and temperature, which are:

  1. (1)

    Mass conservative equation (assuming that the fluid is incompressible)

    $$ - \nabla \cdot \mathop{v}\limits^{\rightharpoonup} + q = \frac{{\partial \phi \left( {p,T} \right)}}{\partial t} $$
    (1)
  2. (2)

    Energy conservative equation

    $$ \beta \nabla \left( {\lambda_{c} \left( {p,T} \right)\nabla T} \right) - \nabla \cdot \left( {\rho_{l} C_{l} T\mathop{v}\limits^{\rightharpoonup} } \right) + q_{h} = \frac{\partial }{\partial t}\left( {\left[ {1 - \phi \left( {p,T} \right)} \right]\rho_{r} C_{r} T + \phi \left( {p,T} \right)\rho_{l} C_{l} T} \right) $$
    (2)
  • (3) Auxiliary equations.

In porous flow, the seepage velocity \(\mathop{v}\limits^{\rightharpoonup} \) in Eq. (1) and Eq. (2) satisfies Darcy's law:

$$ \mathop{v}\limits^{\rightharpoonup} = - \alpha \frac{k}{\mu }\nabla p $$
(3)

Thus, Eq. (1) is rewritten as a form of an approximate pressure diffusion equation:

$$ \alpha \nabla \left( {\frac{k}{\mu }\nabla p} \right) + q = \frac{{\partial \phi \left( {p,T} \right)}}{\partial t} $$
(4)

Equation (2) can be rewritten as:

$$ \beta \nabla \left( {\lambda_{c} \left( {p,T} \right)\nabla T} \right) + \alpha \nabla \left( {\rho_{l} C_{l} T\frac{k}{\mu }\nabla p} \right) + q_{h} = \frac{\partial }{\partial t}\left( {\left[ {1 - \phi \left( {p,T} \right)} \right]\rho_{r} C_{r} T + \phi \left( {p,T} \right)\rho_{l} C_{l} T} \right) $$
(5)

Due to the elastic and thermoelastic properties of reservoir porous media, porosity is affected by both fluid pressure and temperature. The porosity \(\phi \left( {p,T} \right)\), integrated heat conduction coefficient \(\lambda_{c} \left( {p,T} \right)\), and liquid viscosity \(\mu \left( T \right)\) are calculated as

$$ \begin{gathered} \phi \left( {p,T} \right) = \left[ {\phi_{0} + C_{t} \left( {p - p_{0} } \right)} \right]\left[ {1 + \frac{{1 - \phi_{0} }}{{\phi_{0} }}C_{{{\text{Temp}}}} \left( {T - T_{0} } \right)} \right], \hfill \\ \lambda_{c} \left( {p,T} \right) = \phi \left( {p,T} \right)\lambda_{l} + \left( {1 - \phi \left( {p,T} \right)} \right)\lambda_{r} , \hfill \\ \mu \left( T \right) = \mu \left( {T_{0} } \right)e^{{ - \alpha_{T} \left( {T - T_{0} } \right)}} \hfill \\ \end{gathered} $$
(6)

Equations (4) and (5) are differential equations about temperature and pressure, in which the coefficients are jointly affected by pressure and temperature to form a nonlinear equation system.

2.2 A brief review of GFDM

GFDM is a relatively new meshless method based on local Taylor expansion and weighted least squares approximation. In this method, the spatial derivatives are approximated as a difference scheme of the nodal function values within each local node influence domain.

Suppose there are n other nodes in the influence domain of the node \(M_{0} = \left( {x_{0} ,y_{0} } \right)\), which are denoted as \(\left\{ {M_{1} ,M_{2} ,M_{3} , \cdots ,M_{N} } \right\}\) where \(M_{i} = \left( {x_{i} ,y_{i} } \right)\). The Taylor expansion of the unknown function \(u\left( {x,y} \right)\) at \(M_{0}\) can be used to approximate \(\{ u\left( {M_{i} } \right),{\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} i = 1, \cdots n\}\) as:

$$ u\left( {M_{i} } \right) = u\left( {M_{0} } \right) + \Delta x_{i} \left. {\frac{\partial u}{{\partial x}}} \right|_{{M_{0} }} + \Delta y_{i} \left. {\frac{\partial u}{{\partial y}}} \right|_{{M_{0} }} + \frac{1}{2}\left( {\left( {\Delta x_{i} } \right)^{2} \left. {\frac{{\partial^{2} u}}{{\partial x^{2} }}} \right|_{{M_{0} }} + 2\Delta x_{i} \Delta y_{i} \left. {\frac{{\partial^{2} u}}{\partial x\partial y}} \right|_{{M_{0} }} + \left( {\Delta y_{i} } \right)^{2} \left. {\frac{{\partial^{2} u}}{{\partial y^{2} }}} \right|_{{M_{0} }} } \right) + O\left( {r^{3} } \right) $$
(7)

where \(\vartriangle x_{i} = x_{0} - x_{i}\), \(\Delta y_{i} = y_{0} - y_{i}\).

Denote \(u_{0} = u\left( {M_{0} } \right)\), \(u_{x0} = \left. {\frac{\partial u}{{\partial x}}} \right|_{{M_{0} }}\), \(u_{y0} = \left. {\frac{\partial u}{{\partial y}}} \right|_{{M_{0} }}\), \(u_{xx0} = \left. {\frac{{\partial^{2} u}}{{\partial x^{2} }}} \right|_{{M_{0} }}\), \(u_{xy} = \left. {\frac{{\partial^{2} u}}{\partial x\partial y}} \right|_{{M_{0} }}\), \(u_{yy} = \left. {\frac{{\partial^{2} u}}{{\partial y^{2} }}} \right|_{{M_{0} }}\).

Define weighted error function \(B\left( {{\mathbf{D}}_{u} } \right)\):

$$ B\left( {{\mathbf{D}}_{u} } \right) = \sum\limits_{{j = 1}}^{n} {\left[ {\left( \begin{gathered} u_{0} - u_{j} + \Delta x_{j} u_{{x0}} + \Delta y_{j} u_{{y0}} \hfill \\ + \frac{1}{2}\left( {\Delta x_{j} } \right)^{2} u_{{xx0}} \hfill \\ + \frac{1}{2}\left( {\Delta y_{j} } \right)^{2} u_{{yy0}} + \Delta x_{j} \Delta y_{j} u_{{xy0}} \hfill \\ \end{gathered} \right)\omega _{j} } \right]^{2} } $$
(8)

where \({\mathbf{D}}_{u} = \left( {u_{x0} ,u_{y0} ,u_{xx0} ,u_{yy0} ,u_{xy0} } \right)^{T}\), \(\omega_{j} = \omega \left( {\Delta x_{j} ,\Delta y_{j} } \right)\) is the value of the weight function \(\omega \left( {x,y} \right)\) at \(M_{j}\). Benito et al. [6] and Gavete et al. [25] demonstrated that different types of weight function have little influence on the GFDM calculation results, while the quartic spline function is generally selected as the weight function in Eq. (9).

$$ \omega_{j} = \left\{ {\begin{array}{*{20}l} {1 - 6\left( {\frac{{r_{j} }}{{r_{m} }}} \right)^{2} + 8\left( {\frac{{r_{j} }}{{r_{m} }}} \right)^{3} - 3\left( {\frac{{r_{j} }}{{r_{m} }}} \right)^{4} \quad } \hfill & {r_{j} \le r_{m} } \hfill \\ {0\quad } \hfill & {r_{j} > r_{m} } \hfill \\ \end{array} } \right. $$
(9)

where \(r_{j}\) is the Euclidean distance from the \(M_{j}\) to \(M_{0}\) and \(r_{m}\) is the radius of the influence domain of \(M_{0}\).

The weighted error function \(B\left( {{\mathbf{D}}_{u} } \right)\) is minimized; at this time, the partial derivatives of \(B\left( {{\mathbf{D}}_{u} } \right)\) to each component of \(B\left( {{\mathbf{D}}_{u} } \right)\) are required equal to zero, and they are

$$ \frac{{\partial B\left( {{\mathbf{D}}_{u} } \right)}}{{\partial u_{x0} }} = 0,\,\frac{{\partial B\left( {{\mathbf{D}}_{u} } \right)}}{{\partial u_{y0} }} = 0,\,\frac{{\partial B\left( {{\mathbf{D}}_{u} } \right)}}{{\partial u_{xx0} }} = 0,\,\frac{{\partial B\left( {{\mathbf{D}}_{u} } \right)}}{{\partial u_{yy0} }} = 0,\,\frac{{\partial B\left( {{\mathbf{D}}_{u} } \right)}}{{\partial u_{xy0} }}\, = \,0 $$
(10)

Eq. (10) are sorted into linear equations as follows:

$$ {\mathbf{AD}}_{u} = {\mathbf{b}} $$
(11)

where \({\mathbf{A}} = {\mathbf{L}}^{T} {\mathbf{\omega L}}\), \({\mathbf{b}} = {\mathbf{L}}^{T} {\mathbf{\omega U}}\), \({\mathbf{L}} = \left( {{\mathbf{L}}_{1}^{T} ,{\mathbf{L}}_{2}^{T} , \cdots ,{\mathbf{L}}_{n}^{T} } \right)^{T}\), \({\mathbf{L}}_{i} = \left( {\Delta x_{i} ,\Delta y_{i} ,\frac{{\Delta x_{i}^{2} }}{2},\frac{{\Delta y_{i}^{2} }}{2},\Delta x_{i} \Delta y_{i} } \right)\), \({{\varvec{\upomega}}} = {\text{diag}}\left( {\omega_{1}^{2} ,\omega_{2}^{2} , \cdots ,\omega_{n}^{2} } \right)\),\({\mathbf{U}} = \left( {u_{1} - u_{0} ,u_{2} - u_{0} , \cdots ,u_{n} - u_{0} } \right)^{T}\).

Then, \({\mathbf{D}}_{u}\) can be solved as:

$$ {\mathbf{D}}_{u} = \left( {u_{x0} ,u_{y0} ,u_{xx0} ,u_{yy0} ,u_{xy0} } \right)^{T} = {\mathbf{A}}^{ - 1} {\mathbf{b}} = {\mathbf{A}}^{ - 1} {\mathbf{L}}^{T} {\mathbf{\omega U}} = {\mathbf{MU}} $$
(12)

where \({\mathbf{M}} = {\mathbf{A}}^{ - 1} {\mathbf{L}}^{T} {{\varvec{\upomega}}}\)

For the convenience of notation, the elements of the matrix \({\mathbf{M}}\) are denoted as \(m_{ij}\), and the generalized difference approximation schemes of the spatial derivatives at \(M_{0}\) are obtained as:

$$ \frac{\partial u}{{\partial x}} = \sum\limits_{j = 1}^{n} {m_{1j} \left( {u_{j} - u_{0} } \right)} ,\,\frac{\partial u}{{\partial y}} = \sum\limits_{j = 1}^{n} {m_{2j} \left( {u_{j} - u_{0} } \right)} ,\,\frac{{\partial^{2} u}}{{\partial x^{2} }} = \sum\limits_{j = 1}^{n} {m_{3j} \left( {u_{j} - u_{0} } \right)} ,\,\frac{{\partial^{2} u}}{{\partial y^{2} }} = \sum\limits_{j = 1}^{n} {m_{4j} \left( {u_{j} - u_{0} } \right)} ,\,\frac{{\partial^{2} u}}{\partial x\partial y} = \sum\limits_{j = 1}^{n} {m_{5j} \left( {u_{j} - u_{0} } \right)} $$
(13)

As seen in Eq. (13), GFDM is flexible to obtain the difference expressions of spatial derivatives at the considered node only according to the coordinates of the nodes within the influence domain of the considered node. In fact, there can be no concept of the node influence domain, because it is only necessary to determine which nodes participate in the construction of the generalized finite difference expressions of spatial derivatives at the considered node, and the introduction of the node influence domain is just to determine the selection of these nodes more conveniently.

Therefore, the numerical discretization of partial differential equations can be realized when only using a point cloud to discretize the computational domain. This is the most significant advantage of meshless GFDM compared with mesh-based FEM and FVM.

Milewski [35] and Rao et al. [34] point out that the point cloud discretization in the computational domain has much less topological information than the mesh discretization in the computational domain, for example, on the basis of the point cloud, the mesh also needs to determine which two points are connected to an edge, which points form a mesh and the order of the vertices of the mesh, and so on. When generating a mesh, the lengths of the edges of a mesh do not vary so much that the vertex angles of the mesh do not vary so much to ensure the quality of the mesh generation. Therefore, when discretizing a computational domain, the topological constraints on the mesh generation are much greater than those on the generation of the point cloud, which makes the generation of the point cloud theoretically much less difficult than the mesh division.

Rao et al. [34] take a circular domain as an example and point out that when the point cloud is used to discretize the computing domain, the method of equally dividing the radius and argument can be quickly used to form a concentric point cloud, and the workload of meshing the computing domain is obviously larger than that of generating the concentric point cloud. Even if the mesh is constructed on the basis of this point cloud, it is difficult to give a criterion for which nodes in the point cloud form the mesh to determine the high-quality mesh generation. This shows that the discretization of point cloud to calculation domain can be more arbitrary and simpler than gridding the calculation domain, which is precisely because the generation of the point cloud is limited by little topology.

In terms of point cloud generation methods for calculation domains, Milewski [35] showed that Liszka-type node generators, which were proposed by Liszka [31], can be used to generate point clouds that can be adequately adapted to irregular computational domains. Michel et al. [23] applied a meshfree advancing front technique [32] to generate the initial point cloud. Löhner and Onate [37] developed an algorithm to construct boundary-conforming, isotropic clouds of points with variable density in space, which is more efficient than mesh-generation methods to adaptively discretize the computational domain. Rao et al. [38] gave an algorithm for point cloud generation for computational domains with complex geometrical entities in lower one dimension, such as complex fracture networks in fractured reservoirs, showing that point cloud discretization of computational domains can effectively solve the gridding challenge of matching grids for fracture intersections and narrow computational domains between fractures, avoiding the problem of generating very fine grids in these locally narrow areas due to the length of each side of the grid being required to differ significantly. Moreover, the algorithm for generating grid nodes in the grid division method can also be used directly to generate point clouds of the computational domain; for example, Cartesian collocation points or mesh vertices of the triangulation can be used as point clouds of the computational domain. Overall, the generation of point clouds is less difficult than mesh division, and the generation methods are more diverse and easier to carry out an adaptive analysis. The above analysis demonstrates the advantages of meshless methods such as GFDM over mesh-based numerical methods in terms of computational domain discretization, and this was an important original motivation for the rapid development of meshless methods in the 1990s.

2.3 Upwind GFDM based discrete schemes

After the calculation domain has been discretized by a point cloud, the nodes in the point cloud are denoted as node i, \(i = 1,2,3, \cdots ,n_{t}\), in which \(n_{t}\) is the total number of nodes. Define the set composed of the sequence numbers of the nodes in the influence domain of node i except the node i itself (i.e., the nodes participating in the construction of the generalized difference operator of node i except the node i itself) as the index set of node i, which is denoted as \(\Lambda_{i}\). If the influence domain of node i contains ni nodes except node i, then \(\Lambda_{i}\) has ni elements. The nodes in \(\Lambda_{i}\) and the node i itself together form the local point cloud of node i.

For node i, according to Eq. (13) in GFDM, it is obtained that:

$$ \frac{{\partial^{2} p}}{{\partial x^{2} }}\, = \,\sum\limits_{{j \in \Lambda_{i} }} {m_{3j}^{i} \left( {p_{j} - p_{i} } \right)} ,\,\frac{{\partial^{2} p}}{{\partial y^{2} }}\, = \,\sum\limits_{{j \in \Lambda_{i} }} {m_{4j}^{i} \left( {p_{j} - p_{i} } \right)} $$
(14)

where the superscript i of \(m_{3j}^{i}\) indicates that node i is the considered node.

Then, the pressure diffusion term is approximated as follows:

$$ \nabla \cdot \left( {\nabla p} \right)\, = \,\frac{{\partial^{2} p}}{{\partial x^{2} }} + \frac{{\partial^{2} p}}{{\partial y^{2} }} \approx \sum\limits_{{j \in \Lambda_{i} }} {\left[ {\left( {m_{3j}^{i} + m_{4j}^{i} } \right)\left( {p_{j} - p_{i} } \right)} \right]} $$
(15)

For the actual underground formation, permeability k is often difficult to express as an explicit function about coordinates, but only knows the permeability values at some nodes; therefore, it is difficult for us to take k as a function and extract it from the diffusion term. Therefore, this paper uses the harmonic average scheme of the nodal permeability values to calculate the permeability between node i and node j, and the arithmetic average scheme of the nodal viscosity values is used to characterize the fluid viscosity between node i and node j, which are commonly used in FDM/FVM-based reservoir simulator (i.e., the numerical simulator about porous flow problems) [38,39,40,41]. The treatments of the heterogeneity of physical parameters are beneficial to the easier application of GFDM in practical porous flow problems, because it is generally difficult to obtain the function expression of physical parameters with good smoothness in practical problems, especially the related physical parameters of underground reservoirs. The numerical examples in Sect. 3.2 will prove that such treatment can achieve sufficient calculation accuracy. Therefore, it is obtained that:

$$ \nabla \cdot \left( {\frac{k}{\mu \left( T \right)}\nabla p} \right)\, = \,\sum\limits_{{j \in \Lambda_{i} }} {\left[ {\frac{{k_{ij} }}{{\mu_{ij} }}\left( {m_{3j}^{i} + m_{4j}^{i} } \right)\left( {p_{j} - p_{i} } \right)} \right]} $$
(16)

where \(k_{ij} = \frac{{2k_{i} k_{j} }}{{k_{i} + k_{j} }}\), \(\mu_{ij} = \frac{{\mu \left( {T_{i} } \right) + \mu \left( {T_{j} } \right)}}{2}\).

For the heat convection–diffusion equation, the heat conduction term in Eq. (2) can adopt a discrete scheme similar to Eq. (15) and obtain:

$$ \nabla \left( {\lambda_{c} \left( {p,T} \right)\nabla T} \right) = \sum\limits_{{j \in \Lambda_{i} }} {\left[ {\lambda_{c,ij} \left( {m_{3j}^{i} + m_{4j}^{i} } \right)\left( {T_{j} - T_{i} } \right)} \right]} $$
(17)

where \(\lambda_{c,ij} = \frac{{2\lambda_{c,i} \lambda_{c,j} }}{{\lambda_{c,i} + \lambda_{c,j} }}\), \(\lambda_{c,i} = \lambda_{c} \left( {p_{i} ,T_{i} } \right)\), \(\lambda_{c,j} = \lambda_{c} \left( {p_{j} ,T_{j} } \right)\).

For the heat convection term in Eq. (2), because the convection term has asymmetry, its discretization needs to take the upwind scheme. In a meshless method, the upstream effect is generally constructed by modifying the influence domain; however, this method is not conducive to taking a stable upwind effect with a complex flow field and the construction of a general framework; therefore, this paper aims to construct the upstream scheme in GFDM for porous flow problems without modifying the influence domain.

In the porous flow problem, the velocity in porous media satisfies Darcy's law in Eq. (3), then in the porous flow problem, the heat convection term \(- \rho_{l} C_{l} \nabla \cdot \left( {\mathop{v}\limits^{\rightharpoonup} T} \right)\) (it should be \(- \nabla \cdot \left( {\rho_{l} C_{l} \mathop{v}\limits^{\rightharpoonup} T} \right)\), but considering that \(\rho_{l}\) and \(C_{l}\) can be regarded as constant, so for the convenience of discussion and analysis, we move them to the outside of the Hamiltonian) in Eq. (2) can be rewritten as Eq. (18) in Eq. (5).

$$ - \rho_{l} C_{l} \nabla \cdot \left( {T\mathop{v}\limits^{\rightharpoonup} } \right) = \alpha \rho_{l} C_{l} \nabla \left( {T\frac{k}{\mu }\nabla p} \right) $$
(18)

Thus obtain a second-order derivative form similar to the diffusion term. The FDM/FVM-based reservoir simulator generally uses the first-order single-point upwind (SPU) scheme to discretize the convection term. Taking the FDM as an example, if the difference scheme of pressure diffusion term \(\nabla \left( {\frac{k}{\mu }\nabla p} \right)\) is:

$$ \nabla \left( {\frac{k}{\mu }\nabla p} \right) = \sum\limits_{j} {D_{ij} \left( {p_{j} - p_{i} } \right)} $$
(19)

where \(D_{ij}\) is the coefficient in the FDM-based difference expression.

Then \(D_{ij} \left( {p_{j} - p_{i} } \right)\) nearly denote (not rigorously) the seepage velocity (information) of the fluid between grid i and grid j, and the difference scheme of convection term \(\alpha \rho_{l} C_{l} \nabla \left( {T\frac{k}{\mu }\nabla p} \right)\) is discretized as:

$$ \alpha \rho_{l} C_{l} \nabla \left( {T\frac{k}{\mu }\nabla p} \right) = \alpha \rho_{l} C_{l} \sum\limits_{j} {T_{ij} D_{ij} \left( {p_{j} - p_{i} } \right)} $$
(20)

where if node i is the upstream of node j, that is, if \(p_{i} > p_{j}\), the SPU scheme obtains \(T_{ij} = T_{i}\), otherwise, \(T_{ij} = T_{j}\), then,

$$ \alpha \rho_{l} C_{l} T_{ij} D_{ij} \left( {p_{j} - p_{i} } \right) = \alpha \rho_{l} C_{l} T_{i} D_{ij} \left( {p_{j} - p_{i} } \right) $$
(21)

roughly represents the heat loss in grid i caused by the flow of upstream grid i to downstream grid j. It can be seen that for the convection term in the porous flow problem controlled by the pressure gradient, the difference expression of the pressure diffusion term in Eq. (19) can be obtained first, which contains the seepage velocity information between the central grid and the adjacent grid, and then the SPU scheme is adopted for the physical quantities related to convection transfer (such as the temperature T in the thermal convection term) to realize the discretization of the convection term.

The SPU scheme in FDM/FVM-based reservoir simulator provides a great inspiration for the discretization of the convection term when the meshless method is applied to the porous flow problems, because it is simple to obtain the difference scheme of the pressure diffusion term by using the meshless method, and it seems that the SPU scheme in Eq. (21) can also be directly applied to the meshless difference scheme by replacing the pressure of grid i and grid j with the pressure of node i and node j. The work done in this paper is to verify whether the SPG scheme in GFDM can achieve good calculation performance for mass and heat transfer in porous media, so as to form an upwind GFDM used for porous flow problems which can achieve a stable upwind effect.

Therefore, the SPU scheme is directly introduced to GFDM to form an upwind GFDM. Inspired by this idea, because the difference scheme of pressure diffusion term \(\nabla \left( {\frac{k}{\mu }\nabla p} \right)\) in GFDM is Eq. (16), the discrete scheme in Eq. (22) of the heat convection term with the upwind scheme of temperature in Eq. (23) is adopted. In Sect. 2.5, we will demonstrate that when dealing with the one-dimensional constant-coefficient heat convection–diffusion equation, the discretization of the heat convection term by the upwind GFDM can be reduced to the discretization of the convection term by FDM with first-order upwind scheme. The computational performance of the upwind GFDM will be verified and analyzed by numerical examples in Sect. 3.

$$ \nabla \left( {\rho C_{l} T\frac{k}{\mu }\nabla p} \right)\, = \,\sum\limits_{{j \in \Lambda_{i} }} {\left[ {\rho C_{l} T_{ij} \frac{{k_{ij} }}{{\mu_{ij} }}\left( {m_{3j}^{i} + m_{4j}^{i} } \right)\left( {p_{j} - p_{i} } \right)} \right]} $$
(22)
$$ T_{ij} \,{ = }\,\left\{ {\begin{array}{*{20}l} {T_{j} } \quad {{\text{if}} \quad p_{j} \ge p_{i} } \\ {T}_i \quad {{\text{if}} \quad p_{j} < p_{i} } \\ \end{array} } \right. $$
(23)

For the convection term expressed by the first-order spatial derivative in the hyperbolic shallow water equation, if it can be rewritten into the form expressed by the second-order spatial derivative similar to the diffusion term in porous-media seepage mechanics, it may also be solved by the upwind GFDM given in this paper. If not, the developed upwind GFDM may not be applicable to the high-performance solution of the shallow water equation. However, this method should be suitable for solving various flow problems in porous media, which is also the original motivation of this paper, and its good performance in hyperbolic two-phase flow in porous media has been confirmed [34].

Then, a simple sequential coupled scheme is adopted, that is, based on the temperature values of n time steps, implicitly calculate the pressure values of n + 1 time step, and then calculate the temperature values of n + 1 time step.

Therefore, the discrete scheme of the right side of the pressure equation is as follows:

$$ \frac{{\partial \phi \left( {p,T} \right)}}{\partial t}\, = \,\frac{{\partial \phi \left( {p,T^{n} } \right)}}{\partial t}\, = \,\left[ {1 + \frac{{1 - \phi_{0} }}{{\phi_{0} }}C_{{{\text{Temp}}}} \left( {T^{n} - T_{0} } \right)} \right]C_{t} \frac{\partial p}{{\partial t}}\, = \,\left[ {1 + \frac{{1 - \phi_{0} }}{{\phi_{0} }}C_{{{\text{Temp}}}} \left( {T^{n} - T_{0} } \right)} \right]C_{t} \frac{{p^{n + 1} - p^{n} }}{\Delta t} $$
(24)

where \(\Delta t\) is the time interval between the n time step and the n + 1 time step.

Then the discrete scheme of Eq. (4) is obtained as follows:

$$ \alpha \sum\limits_{{j \in \Lambda_{i} }} {\frac{{k_{ij} }}{{\mu_{ij} }}\left[ {\left( {m_{3j}^{i} + m_{4j}^{i} } \right)\left( {p_{j}^{n + 1} - p_{i}^{n + 1} } \right)} \right]} + q_{i}^{n + 1} = \left[ {1{ + }\frac{{1 - \phi_{0} }}{{\phi_{0} }}C_{{{\text{Temp}}}} \left( {T_{i}^{n} - T_{0} } \right)} \right]C_{t} \frac{{p_{i}^{n + 1} - p_{i}^{n} }}{\Delta t} $$
(25)

When the source or sink term is zero, the linear equation is sorted as follows:

$$ \begin{aligned} & \alpha \sum\limits_{{j \in \Lambda _{i} }} {\frac{{k_{{ij}} }}{{\mu _{{ij}} ^{n} }}} \left( {m_{{3j}}^{i} + m_{{4j}}^{i} } \right)p_{j} ^{{n + 1}} \\ & \quad - \left( {\alpha \sum\limits_{{j \in \Lambda _{i} }} {\frac{{k_{{ij}} }}{{\mu _{{ij}} ^{n} }}\left( {m_{{3j}}^{i} + m_{{4j}}^{i} } \right)} + \frac{1}{{\Delta t}}\left[ {1{\text{ + }}\frac{{1 - \phi _{0} }}{{\phi _{0} }}C_{{{\text{Temp}}}} \left( {T_{i} ^{n} - T_{0} } \right)} \right]} \right)C_{t} p_{i} ^{{n + 1}} \\ & \quad + q_{i} ^{{n + 1}} = - \frac{1}{{\Delta t}}\left[ {1{\text{ + }}\frac{{1 - \phi _{0} }}{{\phi _{0} }}C_{{{\text{Temp}}}} \left( {T_{i} ^{n} - T_{0} } \right)} \right]C_{t} p_{i} ^{n} \\ \end{aligned} $$
(26)

where \(\mu_{ij}^{n} = \frac{{\mu \left( {T_{i}^{n} } \right) + \mu \left( {T_{j}^{n} } \right)}}{2}\).

By synthesizing the discrete pressure diffusion equation at each node, combined with the boundary condition (the treatments of boundary condition will be illustrated in Sect. 2.4), global linear equations can be obtained to solve nodal pressure values at n + 1 time step. Then, the discrete equations of Eq. (5) about temperature distribution are obtained:

$$ \begin{aligned} & \beta \sum\limits_{{j \in \Lambda _{i} }} {\left[ {\lambda _{{c,ij}} \left( {p^{{n + 1}} ,T^{n} } \right)\left( {m_{{3j}}^{i} + m_{{4j}}^{i} } \right)\left( {T_{j} ^{{n + 1}} - T_{i} ^{{n + 1}} } \right)} \right]} \\ & \quad + \alpha \sum\limits_{{j \in \Lambda _{i} }} {\left[ {\rho _{l} C_{l} T_{{ij}} ^{{n + 1}} \frac{{k_{{ij}} }}{{\mu _{{ij}} ^{n} }}\left( {m_{{3j}}^{i} + m_{{4j}}^{i} } \right)\left( {p_{j} ^{{n + 1}} - p_{i} ^{{n + 1}} } \right)} \right]} \\ & \quad + q_{H} ^{{n + 1}} = \frac{{\left[ {\left( {1 - \phi _{i} ^{{n + 1}} } \right)\rho _{r} C_{r} + \phi _{i} ^{{n + 1}} \rho _{l} C_{l} } \right]T_{i} ^{{n + 1}} - \left[ {\left( {1 - \phi _{i} ^{n} } \right)\rho _{r} C_{r} + \phi _{i} ^{n} \rho _{l} C_{l} } \right]T_{i} ^{n} }}{{\Delta t}} \\ \end{aligned} $$
(27)

where \(\phi_{i}^{n + 1} = \phi \left( {p_{i}^{n + 1} ,T_{i}^{n} } \right)\), \(\phi_{i}^{n} = \phi \left( {p_{i}^{n} ,T_{i}^{n} } \right)\), \(\mu_{ij}^{n} = \frac{{\mu \left( {T_{i}^{n} } \right) + \mu \left( {T_{j}^{n} } \right)}}{2}\), \(T_{ij} { = }\left\{ \begin{gathered} T_{j} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} if{\kern 1pt} p_{j} \ge {\kern 1pt} p_{i} \hfill \\ T_{i} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} {\kern 1pt} if{\kern 1pt} p_{j} < p_{i} \hfill \\ \end{gathered} \right.\).

Due to the sequential coupling scheme, the time step will be relatively small. Therefore, in the actual calculation, \(T_{ij}^{n + 1}\) in the discretization of the convection term in Eq. (27) can also be taken as \(T_{ij}^{n}\).

2.4 Treatment of boundary conditions

As can be seen in Sect. 2.2, GFDM employs node coordinate information in the node influence domain in conjunction with Taylor expansion to obtain the generalized difference operator that minimizes the weighted truncation errors of Taylor expansion, i.e., the weighted least square method commonly used to obtain the spatial derivatives of unknown functions in various meshless methods. As a result, the quality of the node distribution participating in the construction of the generalized finite difference expression of spatial derivatives at the considered node significantly affects the accuracy of the generalized finite difference approximation.

Because there are no other nodes outside the boundary, if no virtual nodes are added, the node distribution quality in the boundary-node influence domain will be low, i.e., the center of gravity of the local point cloud of the boundary node will deviate greatly from the location of the considered boundary node. The accuracy of the generalized finite difference approximation in Eq. (13) will be reduced at this point. As a result, in GFDM, some studies [34, 35] have identified that a virtual node can be introduced outside the boundary where the boundary node is located to increase the node-distribution quality, and as a result, improve the accuracy of generalized finite difference expressions.

As shown in Fig. 1a, for the boundary node (marked in red solid points), the nodes (marked in black solid points) in the influence domain (marked in gray area) of the boundary node are all on one side of the tangent line (denoted by the red dotted line) at this boundary node, so the GFDM approximation accuracy of spatial derivatives at this boundary node by using these nodes is low, resulting in low overall calculation accuracy. Therefore, the calculation accuracy of the meshless method is sensitive to derivative boundary conditions (such as Neuman boundary condition and Rudin boundary condition). As shown in Fig. 1b, the accuracy of generalized finite difference operators at the non-corner boundary node meeting derivative boundary conditions is improved by adding the blue virtual node on the other side of the tangent to make the center of gravity of the local point cloud near to the considered boundary node. That is to say, the index set of the boundary node will be extended by the added virtual nodes.

Fig. 1
figure 1

Sketch of adding virtual nodes for boundary nodes with derivative boundary conditions

For the corner boundary node with derivative boundary conditions where there is no tangent, the adding of the virtual nodes needs to be divided into two cases:

Case 1: This case is that the corner node is the intersection of two boundaries, that is, the corner node has two boundary conditions. In this case, the two boundary conditions are generally: (I) a first-type boundary condition and a derivative boundary condition; (II) two derivative boundary conditions; for the corner node at this case, the number of added virtual nodes will be equal to the number of derivative boundary conditions of the corner node, and the direction of adding virtual nodes is the normal direction of the boundary on the side where the corner has derivative boundary conditions. As shown in Fig. 1c, the left boundary of the red corner node is a derivative boundary condition, and the right boundary is the first-type boundary condition, so you only need to add a blue virtual point along the normal direction of the left boundary. This type of boundary node exists in the numerical examples in Sect. 3, and the method of adding virtual nodes shown in the point cloud discrete diagrams of the corresponding calculation domains is the processing method described here. As shown in Fig. 1d, the left and right boundaries of the red corner node are two different derivative boundary conditions, so two blue virtual nodes shall be added along the normal direction of the left and right boundaries, respectively. The discrete schemes of the two derivative boundary conditions at the boundary node are the equations of the two virtual nodes, respectively, ensuring that the global equations are closed.

Case 2: This case is that the boundaries on both sides of the corner node are the same boundary and share the same derivative boundary condition. In this case, the virtual node is added to the angular bisector of the included angle at the corner. As shown in Fig. 1e, the red corner node is on a boundary, and then the blue virtual node is added to the angular bisector represented by the dotted line. However, this case should be rare, because derivative boundary conditions generally contain normal derivatives, but there is no normal vector at the corner node.

Next, this section takes pressure calculation as an example to illustrate the specific processing details of the derivative boundary conditions.

Assume that there are n1 internal nodes in the computing domain, n2 nodes meeting Dirichlet boundary conditions, and n3 nodes meeting derivative boundary conditions. For the convenience of depiction, assume here that the expressions of the Dirichlet boundary condition and the derivative boundary condition are:

$$ p\left| {_{A} } \right. = p_{1} ,\,\left( {hp + l\frac{\partial p}{{\partial x}}} \right)\left| {_{B} } \right. = q $$
(28)

where A and B are the nodes that meet the boundary conditions of the first type and the derivative type respectively, h, l, and q are coefficients.

For node A that meets the Dirichlet boundary condition, if the sequence number of the node A in all nodes is a, the equation corresponding to the boundary condition is:

$$ p_{a}^{n + 1} = p_{1} $$
(29)

For node B that meets derivative boundary conditions, set the serial number of node B in all nodes is b, and add the virtual node corresponding to node B, denoted as node C, because each derivative boundary condition node needs to add a corresponding virtual node (of course, if it is a virtual point shown in Fig. 1d, two virtual nodes need to be added accordingly. For the convenience of discussion, it is assumed that there is no such virtual node here), the number of nodes in the entire computing domain is n1 + n2 + n3 + n3, if the serial number of the virtual node C in all nodes is c, the equation at node B is no longer the equation corresponding to the boundary condition, but Eq. (30) which is the same as Eq. (25) of an inner node, and the equation corresponding to the boundary condition is used as the equation corresponding to virtual node C. They are:

The discrete equation at node B is

$$ \alpha \sum\limits_{{j \in \Lambda_{b} }} {\left[ {\frac{{k_{bj} }}{{\mu_{bj} }}\left( {m_{3j}^{b} + m_{4j}^{b} } \right)\left( {p_{j}^{n + 1} - p_{b}^{n + 1} } \right)} \right]} + q_{b}^{n + 1} = \left[ {1 - \frac{{1 - \phi_{0} }}{{\phi_{0} }}C_{{{\text{Temp}}}} \left( {T_{b}^{n} - T_{0} } \right)} \right]C_{t} \frac{{p_{b}^{n + 1} - p_{b}^{n} }}{\Delta t} $$
(30)

The discrete equation at node C is

$$ \left( {hp + l\frac{\partial p}{{\partial x}}} \right)\left| {_{B} } \right. = hp_{b} + l\sum\limits_{{j \in \Lambda_{b} }} {m_{1j} p_{j} } = q $$
(31)

where \(n_{b}\) is the number of nodes in the influence domain of node B and j is the serial number of a node in the influence domain of node B. Since virtual node C is in the influence domain of node B, \(c \in \Lambda_{b}\) holds.

Finally, the linear equations composed of n1 + n2 + n3 + n3 equations can be obtained in the entire computational domain, including n1 Eq. (25), n2 Eq. (29), n3 Eq. (30), and n3 Eq. (31), thus solving the linear equations in a closed manner to obtain the pressure values of all nodes (including n1 inner nodes, n2 + n3 boundary nodes, and n3 virtual nodes) at n + 1 time step. Combined with Eq. (27) and boundary conditions about temperature (using the same treatment of boundary conditions in this section), calculate the temperature values of all nodes at the n + 1 time step. Then continue to solve the pressure and temperature distributions at n + 2 time step.

2.5 Application in the convection-diffusion equation and analysis of the dissipation error

Different from the diffusion equation, an asymmetric convection term exists in the convection–diffusion equation. When the convection effect is relatively strong, theoretically, it is necessary to use the upwind treatment to discretize the convection term to eliminate the oscillation of the solution caused by the asymmetry of the convection term. As described in the Introduction section, at present, the partial influence domain or the upwind influence domain is mostly used in meshless methods to handle convection-dominated problems. However, due to the possible complexity and changes of the underground flow field, it may be difficult to obtain a stable upwind solution and a general-purpose numerical framework by modifying the influence domain. The upwind GFDM developed in this paper attempts to give a new upwind processing method in the meshless framework. This section will first introduce how to apply the upwind GFDM to conduct a meshless solution of the convection–diffusion equation in theory and then take the one-dimensional constant-coefficient convection–diffusion equation as an example to illustrate that the discretization of the upwind GFDM for the thermal convection term can be degenerated to the discretization of the convection term by FDM with first-order upwind scheme.

The numerical examples in Sects. 3.1, 3.2, and 3.3 demonstrate that the upwind GFDM can realize the effective meshless calculation of single-phase heat and mass transfer problems. Therefore, by constructing a heat and mass transfer problem equivalent to the studied convection-diffusion equation and solving it via the upwind GFDM, the stable meshless solution of the convection-diffusion equation can be obtained.

Assuming that the flow velocity field \({\mathbf{V}} = \left( {v_{x} ,v_{y} } \right)\) has been calculated, if it is a steady velocity field, the temperature distribution of the flow field is characterized by the following convection-diffusion equation:

$$ \frac{\partial }{\partial x}\left( {\lambda_{x} \frac{\partial T}{{\partial x}}} \right) + \frac{\partial }{\partial y}\left( {\lambda_{y} \frac{\partial T}{{\partial y}}} \right) - v_{x} \frac{\partial T}{{\partial x}} - v_{y} \frac{\partial T}{{\partial y}} = 0 $$
(32)

where \(\lambda_{x}\) and \(\lambda_{y}\) are heat conduction coefficients in x and y directions and \(C\) is the heat capacity.

If it is an unsteady velocity field, the temperature profile of the flow field meets Eq. (33), which is the general form of the convection-diffusion equation.

$$ \frac{\partial }{\partial x}\left( {\lambda_{x} \frac{\partial T}{{\partial x}}} \right) + \frac{\partial }{\partial y}\left( {\lambda_{y} \frac{\partial T}{{\partial y}}} \right) - v_{x} \frac{\partial T}{{\partial x}} - v_{y} \frac{\partial T}{{\partial y}} = C\frac{\partial T}{{\partial t}} $$
(33)

Extend the convection term in Eq. (33) to a second-order derivative term with pressure, that is:

$$ - v_{x} \frac{\partial T}{{\partial x}} - v_{y} \frac{\partial T}{{\partial y}}\, = \, - \frac{{\partial Tv_{x} }}{\partial x} - \frac{{\partial Tv_{y} }}{\partial y}\, = \,\nabla \cdot \left( {T\frac{k}{\mu }\nabla p} \right) $$
(34)

Thus, the convection–diffusion equation in Eq. (34) is extended to the heat and mass transfer coupling problem governed by Eq. (35) and Eq. (36).

$$ \frac{\partial }{\partial x}\left( {\lambda_{x} \frac{\partial T}{{\partial x}}} \right) + \frac{\partial }{\partial y}\left( {\lambda_{y} \frac{\partial T}{{\partial y}}} \right) + \nabla \cdot \left( {T\frac{k}{\mu }\nabla p} \right) = C\frac{\partial T}{{\partial t}} $$
(35)
$$ - \frac{k}{\mu }\nabla p = \left( {v_{x} ,v_{y} } \right) $$
(36)

Therefore, when node i is the considered node, the discrete scheme of the convection term can adopt the same discrete scheme as Eq. (22), that is:

$$ - v_{x} \frac{\partial T}{{\partial x}} - v_{y} \frac{\partial T}{{\partial y}} = \nabla \cdot \left( {T\frac{k}{\mu }\nabla p} \right) = \sum\limits_{{j \in \Lambda_{i} }} {\left[ {T_{ij} \frac{{k_{ij} }}{{\mu_{ij} }}\left( {m_{3j} + m_{4j} } \right)\left( {p_{j} - p_{i} } \right)} \right]} $$
(37)

The nodal temperature values can be calculated by using the sequential coupling or fully-implicit solution of Eqs. (35) and (36), that is, the convection-diffusion equation in Eq. (34) is solved by the upwind GFDM, and the good accuracy and convergence will be illustrated in the numerical example in Sect. 3.1.

Next, assuming we are studying a 1D problem with a constant flow velocity in the x-direction, the flow direction is positive along the x-axis, i.e.,\(v_{x} > 0\), \(v_{y} = 0\) and homogeneous physical parameters, like the numerical example in Sect. 3.1. A Cartesian point cloud is used to discretize the rectangular domain. Figure 2 shows the local point cloud of node 0 in the Cartesian point cloud, i.e., \(\Lambda_{0} = \left\{ {1,2,3,4,5,6,7,8} \right\}\). May as well suppose \(\Delta x = \Delta y\), \(r_{m} = 1.6\Delta x\), then

$$ - v_{x} \frac{\partial T}{{\partial x}} - v_{y} \frac{\partial T}{{\partial y}} = - v_{x} \frac{\partial T}{{\partial x}} $$
(38)
Fig. 2
figure 2

a brief sketch of a local point cloud in the influence domain of node 0

\(T_{01} = T_{05} = T_{07} = T_{1} = T_{5} = T_{7}\), \(T_{02} = T_{06} = T_{08} = T_{2} = T_{6} = T_{8}\), \(T_{0} = T_{3} = T_{4}\).

where \(v_{x}\) is a constant.

\(p_{1} = p_{5} = p_{7}\), \(p_{2} = p_{6} = p_{8}\), \(p_{0} = p_{3} = p_{4}\),

$$ - \left( {p_{1} - p_{0} } \right) = - \left( {p_{5} - p_{0} } \right) = - \left( {p_{7} - p_{0} } \right) = \left( {p_{2} - p_{0} } \right) = \left( {p_{6} - p_{0} } \right) = \left( {p_{8} - p_{0} } \right) $$
(39)

And

$$ v_{x} = - \frac{k}{\mu }\frac{{p_{1} - p_{0} }}{\Delta x} = - \frac{k}{\mu }\frac{{p_{5} - p_{0} }}{\Delta x} = - \frac{k}{\mu }\frac{{p_{7} - p_{0} }}{\Delta x} = \frac{k}{\mu }\frac{{p_{2} - p_{0} }}{\Delta x} = \frac{k}{\mu }\frac{{p_{6} - p_{0} }}{\Delta x} = \frac{k}{\mu }\frac{{p_{8} - p_{0} }}{\Delta x} $$
(40)

By introducing Eq. (38), Eq. (39), and Eq. (40) into Eq. (37), we can obtain:

$$ \begin{aligned} & - v_{x} \frac{\partial T}{{\partial x}} - v_{y} \frac{\partial T}{{\partial y}} = \nabla \cdot \left( {T\frac{k}{\mu }\nabla p} \right)\\ & \quad = \sum\limits_{{j \in \Lambda_{i} }} {\left[ {T_{ij} \frac{{k_{ij} }}{{\mu_{ij} }}\left( {m_{3j} + m_{4j} } \right)\left( {p_{j} - p_{i} } \right)} \right]} \hfill \\ & \quad = \frac{k}{\mu }T_{1} \left[ {\left( {m_{31} + m_{41} } \right) + \left( {m_{35} + m_{45} } \right) + \left( {m_{37} + m_{47} } \right)} \right]\left( {p_{1} - p_{0} } \right) \hfill \\ &\quad - \frac{k}{\mu }T_{2} \left[ {\left( {m_{32} + m_{42} } \right) + \left( {m_{36} + m_{46} } \right) + \left( {m_{38} + m_{48} } \right)} \right]\left( {p_{0} - p_{2} } \right) \hfill \\ \end{aligned} $$
(41)

According to Eq. (12), it can be calculated that:

$$ \begin{gathered} \left( {m_{31} ,m_{32} ,m_{33} ,m_{34} ,m_{35} ,m_{36} ,m_{37} ,m_{38} } \right) = \hfill \\ \left( \begin{gathered} \frac{{9.6308 \times 10^{ - 1} }}{{\Delta x^{2} }},\frac{{9.6308 \times 10^{ - 1} }}{{\Delta x^{2} }}, - \frac{{3.6917 \times 10^{ - 2} }}{{\Delta x^{2} }}, - \frac{{3.6917 \times 10^{ - 2} }}{{\Delta x^{2} }}, \hfill \\ \frac{{1.8459 \times 10^{ - 2} }}{{\Delta x^{2} }},\frac{{1.8459 \times 10^{ - 2} }}{{\Delta x^{2} }},\frac{{1.8459 \times 10^{ - 2} }}{{\Delta x^{2} }},\frac{{1.8459 \times 10^{ - 2} }}{{\Delta x^{2} }} \hfill \\ \end{gathered} \right) \hfill \\ \end{gathered} $$
(42)

Then,

$$ \left[ {\left( {m_{31} + m_{41} } \right) + \left( {m_{35} + m_{45} } \right) + \left( {m_{37} + m_{47} } \right)} \right] = \left[ {\left( {m_{32} + m_{42} } \right) + \left( {m_{36} + m_{46} } \right) + \left( {m_{38} + m_{48} } \right)} \right] = \frac{1}{{\Delta x^{2} }} $$
(43)

Bring Eq. (43) into Eq. (41), it is obtained that:

$$ - v_{x} \frac{\partial T}{{\partial x}} - v_{y} \frac{\partial T}{{\partial y}} = \frac{k}{\mu }T_{1} \frac{{\left( {p_{1} - p_{0} } \right)}}{{\Delta x^{2} }} - \frac{k}{\mu }T_{0} \frac{{\left( {p_{0} - p_{2} } \right)}}{{\Delta x^{2} }} = - v_{x} \frac{{T_{0} - T_{1} }}{\Delta x} $$
(44)

It can be seen that the discrete scheme of the thermal convection term in Eq. (44) derived from the upwind GFDM is exactly the first-order upwind scheme of the convection term in the traditional FDM, which suggests that the upwind GFDM developed in this paper can be regarded as an extension of the traditional upwind FDM in the meshless framework.

Next, we can also analyze the dissipation error of the upwind GFDM and its property. When rm = 1.6▵x the point cloud is as described in Fig. 2(a). As mentioned earlier, the discrete scheme of the convection term is the first-order upwind scheme in Eq. (44) According to Taylor expansion, it is obtained that:

$$T _1=T_0-\Delta x \frac{\partial T} {\partial x} |_0 + \frac{\Delta x^{2}} 2 \frac{\partial ^{2}T}{\partial x^{2}}|_0 + O(\Delta x ^{3})$$
(45)

Then, it is obtained that

$$-v_x \frac{\partial T}{\partial x}|_0 = -v_x \frac{T_o - T_1}{\Delta x} -v_x \frac{\Delta x} 2 \frac{\partial^{2} T}{\partial x^{2}}|_0 + O (\Delta x^{2})$$
(46)

Thus, the dissipation error of Eq. (44) exists and is:

$$\left| err _1\,\right| = \frac{\Delta x}2 \left| v_x \frac {\partial ^{2}T}{\partial x^{2}}|_0 \,\right| $$
(47)

As shown in Fig. 2(b), when rm increases to 2.9▵x without specific calculation, it is expected to obtain a generalized difference expression similar to Eq. (44) that is,

$$\left(-v_x \frac{\partial T}{\partial x} -v_y \frac{\partial T}{\partial x} \,\right)|_0 =-v_x \left[ a \frac {T_0-T_1}{\Delta x} +(1-a) \frac {T_0-T_9}{2 \Delta x}\,\right]$$
(48)

where 0 < a <1.

According to Taylor expansion, it is obtained that:

$$ T_9 = {{T} _0} - 2\Delta x \frac{\partial T}{{\partial x}}\left| \right. _0+\,2\Delta x^2 \frac{\partial ^{2}T}{{\partial x^{2}}}\left| \right. _0 + O(\Delta x^{3})$$
(49)

Then it can be obtained that the dissipation error of Eq. (48) becomes:

$$\left| err_2\right|= \left|av_x\frac{\Delta x}2 \frac{\partial ^{2}T}{\partial x^{2}}|_0 +(1-a)v_x\Delta x\frac{\partial^{2} T}{\partial x^{2}}|_0\,\right|=\left| v_x \frac{\Delta x}2 \frac{\partial^{2} T}{\partial x^{2}}|_0 +(1-a)v_x \frac{\Delta x}2 \frac{\partial^{2} T}{\partial x^{2}}|_0\,\right|=\left|err_1\right| + (1-a) \left| v_x \frac{\Delta x}2 \frac{\partial ^{2}T}{\partial x^{2}}|_0\,\right| > \left| err_1\right|$$
(50)

Similarly, as the radius of the influence domain continues to increase, the dissipation error will continue to increase. The numerical examples in Section 3 will also verify this result.

3 Numerical examples

In this section, three numerical examples are designed to test the computational performance and roughly conduct the analysis of error sources of the upwind GFDM, which verify that the method can realize effective calculation of the coupling heat and mass transfer problems.

3.1 A case with a rectangular formation and basic error analysis

In this example, a regular rectangular domain ([0, 300 m] × [0, 100 m]) in Fig. 3a is selected. The values of relevant physical parameters are shown in Table 1. The compressibility coefficient, thermal expansion coefficient, and viscosity-temperature coefficient are all 0. The upper and lower boundaries are closed, and the left and right boundaries have constant pressure and temperature. Equations (51) and (52) show the specific equations of the physical problem and boundary conditions, thus constructing a stable flow field independent of temperature distribution, to analyze the computational performance of the upwind GFDM to the convection-dominated heat transfer.

$$ \text T_1 = {\text{T} _0} - \Delta x \frac{\partial T}{{\partial x}}\left| \right. _0+\,\frac{\Delta x^{2}}{{2}} \frac{\partial ^{2}T}{{\partial x^{2}}}\left| \right. _0 + O(\Delta x^{3})$$
(51)
$$ -v_x\frac{\partial T}{{\partial x}}\left| \right.\,_0 = -v_x\,\frac{\text{T}_0-\text{T}_1}{\Delta x}-v_x \frac{\Delta x}2\frac{\partial ^{2}T}{\partial ^{2}x}\left| \right.\,_0 +O(\Delta x^{2})$$
(52)
Fig. 3
figure 3

Sketches of the calculation domain and the point cloud

Table 1 Values of physical properties of the numerical case

The analytical solution of Eq. (45) about pressure is: \(p = 25 - {x \mathord{\left/ {\vphantom {x {20}}} \right. \kern-\nulldelimiterspace} {20}}\).

$$ \,\left| err_1\right|\, =\frac{\Delta x}2 \,\left| v_x\frac{\partial ^{2}T}{\partial x^{2}}|_0\right|\, $$
(53)
$$\left(-v_x \frac{\partial T}{\partial x} -v_y \frac{\partial T}{\partial x} \,\right)|_0 =-v_x \left[ a \frac {T_0-T_1}{\Delta x} +(1-a) \frac {T_0-T_9}{2 \Delta x}\,\right]$$
(54)

Since Eq. (54) is essentially a 1D heat convection–diffusion problem, this section compares the calculation results of the upwind GFDM, 1D upwind FDM, the reference solution from fine-mesh upwind FDM to test the computational performance of the upwind GFDM and conduct error analysis.

First, the Cartesian point clouds when \(\Delta x = \Delta y = 5m\) and \(\Delta x = \Delta y = 2m\) shown in Fig. 3b and c is used to discretize the rectangular domain. Suppose the radius of the node influence domain as \(1.6\Delta x\), \(2.6\Delta x\), \(3.6\Delta x\), \(4.6\Delta x\), \(5.6\Delta x\), \(6.6\Delta x\). Taking the time step \(\Delta t = 0.5d\), the comparisons of the upwind GFDM results, FDM results, and reference results when \(\Delta x = 5m\) and \(\Delta x = 2m\) are shown in Fig. 4. Figure 5 shows some calculated pressure and temperature distributions when \(\Delta x = 5m\), \(\Delta x = 2m\), and different multiples of the radius of the node influence domain to the node spacing. Figure 6 shows the L2 relative error versus the multiple of the radius of node influence domain to node spacing when \(\Delta x = 2m\) and \(\Delta x = 5m\). Figure 7 shows the L2 relative error of GFDM and traditional FDM versus the node spacing when \(\Delta x = 5m\), \(r_{m} = 1.6\Delta x\), and \(r_{m} = 3.6\Delta x\).

Fig. 4
figure 4

Comparison of calculation results at section y = 50 m from the upwind GFDM and the upwind FDM when \(\Delta x = 2m\) and \(\Delta x = 5m\)

Fig. 5
figure 5

Comparisons of calculated pressure and temperature profiles by the upwind GFDM and the upwind FDM

Fig. 6
figure 6

L2 relative error vs. the multiple of the radius of node influence domain to node spacing when \(\Delta x = 2m\) and \(\Delta x = 5m\)

Fig. 7
figure 7

L2 relative error vs. node spacing when \(\Delta x = 5m\), \(r_{m} = 1.6\Delta x\), and \(r_{m} = 3.6\Delta x\)

As seen in Fig. 5h and i, the temperature transfer leading edge in the GFDM calculation results gradually becomes curved with the increase in the radius of the influence domain. As seen in Fig. 4, Fig. 5h, i and Fig. 7, when \(r_{m} = 1.6\Delta x\), the calculation results, calculation accuracy, and convergence of GFDM are almost consistent with those of FDM. As seen in Figs. 4 and 6, with the increase in the radius of the node influence domain, the range of temperature transfer leading edge in GFDM calculation results becomes larger, and the corresponding calculation error becomes larger. However, even when \(r_{m}\) is large and equal to \(3.6\Delta x\), Fig. 7 shows that the upwind GFDM has good convergence. When the node spacing is 1 m, the calculation error of the upwind GFDM with \(r_{m} = 3.6\Delta x\) is almost the same as that of the upwind GFDM with \(r_{m} = 1.6\Delta x\). These comparisons show that the upwind GFDM has good computational performance.

We analyze that the error sources of the upwind GFDM calculation results are mainly reflected in the following two points:

Type I error: In the study of two-phase flow in porous media based on the upwind GFDM, Rao et al. [34] pointed out that the quality of node distribution in the node influence domain (which can also be understood as the deviation degree between the center of gravity of local point cloud in the node influence domain and the node) has a great impact on the approximation accuracy of generalized difference expressions about spatial derivatives, and the larger the radius of the influence domain, the more uneven the node distribution in the influence domain of boundary nodes and nodes close to the boundary, that is, the more the center of gravity of the node in the influence domain of the boundary node deviates from the boundary node, the lower the approximation accuracy of generalized difference expressions of spatial derivatives at boundary nodes and nodes close to the boundary. The result of this type of error reflected in this example is to bend the temperature leading edge that should be a straight line in Fig. 5 h and i. For specific details, readers can refer to Rao et al. [34].

this type of error is the dissipation error analyzed in Sect. 2.5. We know that the dissipation error will widen the leading edge in theory. Taking Fig. 8a of Cartesian collocation as an example, when the radius of the influence domain of node 1 is greater than twice the node spacing, the approximation of heat convection between node 1 and node 3 in the discrete scheme of heat convection term in. Eq. (55) is:

$$ \text T_9 = {\text{T} _0} - 2\Delta x \frac{\partial T}{{\partial x}}\left| \right. _0+\,2\Delta x \frac{\partial ^{2}T}{{\partial x^{2}}}\left| \right. _0 + O(\Delta x^{3})$$
(55)
Fig. 8
figure 8

sketches of some cases for the analysis of type II error

Although node 1 is also upstream of node 3, node 2 is closer upstream from node 3. Heat convection is transmitted through fluid flow. The real fluid flow is from node 1 to node 2 and then from node 2 to node 3. Therefore, since the temperature of node 1 is less than that of node 2, taking node 1 as the upstream temperature in the convection terms of node 1 and node 3 in Eq. (55) accelerates the decline of temperature at node 3. When the most leading edge of the thermal convection reaches node 1, due to the mass transfer between node 1 and node 3, the temperature at node 3 will decrease no matter how small the next time step is, resulting in the range of the temperature leading edge being larger than the actual range. As shown in Figs. 4 and 5, the range of the temperature transfer front increases with the increase in the node influence domain. Under the Cartesian point cloud shown in Fig. 6 and the non-Cartesian point cloud shown in Sects. 3.2 and 3.3, the L2 relative error increases with the increase in the radius of the node influence domain, which verifies our analysis of the existence of type II error (i.e. the dissipation error). Imagine a more extreme case. As shown in Fig. 8b, if the influence domain of the left-boundary node 4 includes node 5 near the right boundary, the temperature of node 5 will decrease even if the next time step is much small, which is unphysical. The existence of type II error indicates that the radius of the influence domain cannot be set too large when applying the upwind GFDM.

3.2 A case with a polygonal heterogeneous formation

To verify the computational performance of the upwind GFDM when the formation physical parameter is heterogeneous and the domain boundary is irregular, as shown in Fig. 9a, the example in this section constructs a heterogeneous formation permeability distribution characterized by Eq. (50) and a polygonal calculation domain. Equations (51) and (52) show the boundary conditions and initial conditions regarding pressure and temperature, respectively. The left boundary and the right boundary are Dirichlet boundary conditions, and the upper and lower boundaries are closed. The values of relevant physical parameters are shown in Table 2.

Fig. 9
figure 9

Sketches of geometric characterizations of the calculation domain

Table 2 Values of physical properties of the numerical case

Figure 9 shows the fine triangular mesh for FEM, rough triangular mesh for FEM, and the point cloud for GFDM calculation. In this example, the FEM solution based on the fine triangular mesh shown in Fig. 9b is used as the reference solution, and the FEM solution based on the rough triangular mesh in Fig. 9c and the upwind GFDM solution based on the point cloud in Fig. 9d are calculated, respectively. In addition, in the calculation process of the upwind GFDM, since boundaries \(\Gamma_{3}\) and \(\Gamma_{4}\) are the second type of boundary conditions, as described in Sect. 2.4, Fig. 9(d) adds a blue virtual node 6 m perpendicular to the boundary direction at each blue boundary node to handle the derivative boundary conditions.

$$ \begin{aligned} & \left| err_2=\,\right| \left|av_x\frac{\Delta x}2 \frac{\partial ^{2}T}{\partial x^{2}}|_0 +(1-a)v_x\Delta x\frac{\partial^{2} T}{\partial x^{2}}|_0\,\right| \\ &\quad =\left| v_x \frac{\Delta x}2 \frac{\partial^{2} T}{\partial x^{2}}|_0 +(1-a) v_x \frac{\Delta x}2 \frac{\partial^{2} T}{\partial x^{2}}|_0\,\right| \\ &\quad =\left|err_`\,\right| + (1-a) \left| v_x \frac{\Delta x}2 \frac{\partial ^{2}T}{\partial x^{2}}|_0\,\right| >\left| err_1\,\right| \end{aligned} $$
(56)
$$\begin{aligned} p\left| {_{{\Gamma_{1} }} } \right. & = 15\,{\text{MPa}},\,p\left| {_{{\Gamma_{2} }} } \right. = 10\,{\text{MPa}},\,p_{0} = 10\,{\text{MPa}},\,\frac{\partial p}{{\partial y}}\left| {_{{\Gamma_{3} }} } \right.\\ & = 0\,{\text{MPa}}/m,\,\frac{\partial p}{{\partial y}}\left| {_{{\Gamma_{4} }} } \right. = 0\,{\text{MPa}}/m \end{aligned} $$
(57)
$$ T\left| {_{{\Gamma_{1} }} } \right. = 40\,^\circ {\text{C,}}\,T\left| {_{{\Gamma_{2} }} } \right. = 60\,^\circ {\text{C}},\,T_{0} = 60\,^\circ {\text{C}},\frac{\partial T}{{\partial y}}\left| {_{{\Gamma_{3} }} } \right. = 0\,^\circ {\text{C}}/m,\,\frac{\partial T}{{\partial y}}\left| {_{{\Gamma_{4} }} } \right. = 0\,^\circ {\text{C}}/m $$
(58)

Figure 10 shows the FEM results and the calculated pressure and oil saturation distribution at different influence domain radii (including 15, 40, and 65 m). Figure 11 compares the L2 relative errors under different influence domain radii. As seen in Figa. 10 and 11, (i) for calculated pressure profiles, when \(r_{m} \le 30m\), the L2 error of the upwind GFDM is lower than that of FEM. (ii) for calculated temperature profiles, the larger the influence domain radius is, the larger the type II error is, and the lower the calculation accuracy of temperature is. But when \(r_{m} = 15m\), the calculation result of the upwind GFDM for temperature distribution is very close to that of FEM, and the relative error of the upwind GFDM for temperature calculation is 0.612%, which is just slightly larger than 0.460% of FEM. It is demonstrated that the upwind GFDM can realize the coupling calculation of mass and heat transfer in the heterogeneous formation, and the calculation error is mainly reflected in the convection-dominated temperature profiles which verifies the error analysis in Sect. 3.1. It also explains that the treatment of the heterogeneity of physical parameters in Eq. (15) is reasonable, which facilitates the practical application of the upwind GFDM in real complex problems.

Fig. 10
figure 10

Comparisons of calculated pressure and temperature profiles by different methods

Fig. 11
figure 11

L2 relative error versus node spacing in example 3

3.3 A case with a complex-boundary formation

As shown in Fig. 12a, the example in this section constructs a more complex calculation domain boundary, in which the blue line segments represent the upper boundary and the lower boundary, respectively. Except that the reservoir permeability becomes 1000 mD, other physical parameters and boundary conditions are the same as those in Sect. 3.2. Figure 12b shows the extremely high-density triangular mesh used to obtain the FEM reference solution. Figure 12 c, d, e and f show two different-density triangular meshes for FEM calculation and two different-density point clouds for GFDM calculation, respectively. Since the numerical examples and error analysis in Sects. 3.1 and 3.2 have demonstrated that the increase in the radius of the influence domain will reduce the calculation accuracy of temperature profiles, when the upwind GFDM calculation is based on the two point clouds in Fig. 12e and f, because the average node spacings in the two point clouds are 12 and 6 m, respectively, the radius of the node influence domain is taken as 18 and 9 m, respectively. Figures 13 and 14 compare the pressure and temperature distributions at the 40th and 100th days calculated by FEM and upwind GFDM under different-density meshes/point clouds, as well as the reference solutions based on a high-density triangular mesh. Table 3 lists the L2 relative errors of FEM results and upwind GFDM results. It can be seen that when using relatively rough triangulation #1 and point cloud #1, the calculation error of upwind GFDM results for pressure distribution is slightly greater than that of FEM results. The calculation error of the upwind GFDM for temperature distribution at 100 days is nearly twice that of FEM. When using relatively fine triangulation #2 and point cloud #2, the calculation error of upwind GFDM for pressure distribution has rapidly decreased to only half of that of FEM, and the calculation error of temperature has become very close to that of FEM. The comparisons of the calculation errors for pressure profiles in this section and Sect. 3.2 jointly indicate that the upwind GFDM can handle the pressure diffusion equation more effectively than FEM in a certain radius of the node influence domain and realize higher-accuracy pressure calculation. Overall, the results in this section show that the upwind GFDM can realize the effective calculation of mass and heat transfer in the calculation domain with complex geometry and implies the good convergence analyzed in Sect. 3.1.

Fig. 12
figure 12

sketches of the calculation domain, triangulations, and point clouds

Fig. 13
figure 13

Comparisons of calculated pressure and temperature profiles at the 40th day by reference solution, FEM, and the upwind GFDM

Fig. 14
figure 14

Comparisons of calculated pressure and temperature profiles at the 100th day by reference solution, FEM, and the upwind GFDM

Table 3 L2 relative errors of FEM results and upwind GFDM results

4 Conclusions and future work

This paper presents an upwind GFDM for heat and mass transfer coupled problems in porous formation. Throughout the whole paper, several key conclusions can be obtained as follows:

(i) This method discretizes the calculation domain by a point cloud rather than the mesh division, due to the topological constraints on the mesh generation being much greater than those on the generation of the point cloud, compared with mesh-based methods, this method can discretize the calculation domain with complex geometry more easily.

(ii) The single-point upstream (SPU) scheme commonly used in FDM/FVM-based reservoir simulators is directly introduced to GFDM to form an upwind GFDM. This method is shown able to conduct a meshless solution of the convection-diffusion equation. In addition, taking the 1D constant-coefficient convection–diffusion equation as an example, it is proved that the discretization of the upwind GFDM for the heat convection term can be degenerated to the discretization of the convection term by FDM with the first-order upwind scheme, which might indicate the upwind GFDM can be regarded as a meshless extension of the first-order upwind FDM.

(iii) Numerical examples illustrate that the upwind GFDM can realize effective meshless calculation for heat and mass transfer problems in porous media and obtain a solution of the convection–diffusion equation with a stable upwind effect.

(iv) The upwind GFDM can achieve similar calculation accuracy of temperature profiles but a higher accuracy of pressure profiles compared with the mesh-based methods when the radius of the node influence domain is small and has good convergence.

(v) This paper analyzes two error sources of the upwind GFDM, and the results of the error analysis and numerical examples both show that the increase in the radius of the node influence domain will increase the calculation error.

The point cloud generation technique for complex 3D computational domains and the computational performance of the upwind GFDM in 3D cases, which we think is possible with significant work in the future. On the other hand, due to the parallel nature of the calculation of the generalized difference operator at each node in the GFDM, the use of parallel computing to form an efficient upwind GFDM-based simulator is an important future work to promote the theoretical research to practice.