1 Introduction

Multiphase fluid flow is a process with many engineering applications, such as acid gas treatment, contaminant hydrology, and CO2 injection for advanced oil recovery. In many cases, this flow occurs in porous media, where fluids are complexly distributed according to their physicochemical properties. The interaction between the fluids and the porous media can lead to the formation of thin films on the wall, trapping one of the phases due to capillary effects and fluid–rock interaction (O’Brien and Schwartz 2002).

In the oil industry, the oil reservoir is an example of a porous media where the flow of various phases occurs, including oil, other fluids, and contaminants such as CO2 and H2S. During flow, these chemical species cross the interface that separates the fluids in the porous media (Rosa et al. 2006; Coutelieris et al. 2006).

The rheological behaviour of the oil present in the reservoir is a determining factor for good productivity in the oil industry. Heavy crude oil, under normal conditions of temperature and pressure, presents high viscosity due to the high concentration of high molecular weight hydrocarbons, presenting a rheology similar to that of a viscoelastic non-Newtonian fluid. These viscoelastic fluids exhibit a nonlinear relationship between shear stress and strain rate, presenting viscous and elastic behaviour at the same time, and are composed of complex molecules with high molecular weight (Bretas and D’Ávila 2005).

A challenge in non-Newtonian fluid rheology is to develop physically realistic mathematical models that predict the flow behaviour of these fluids in complex geometries. In the literature, the Compressive Continuous Species Transfer (C-CST) method, proposed by Maes and Soulaine (2018), simulates the flow of subsurface fluids, considering the presence of species as contaminants (CO\(_2\) and H\(_{2}\)S, among others) and treating the conditions of mass transfer at the fluid/fluid interface through the VOF (Volume of Fluid) approach. However, this method uses fluids with Newtonian characteristics for the simulations, which can be a limiting aspect in some scenarios.

There are some studies carried out on numerical simulation of multiphase flow in porous media with specific applications in advanced oil recovery, aquifer contamination through non-aqueous liquid phases, CO\(_2\) injection, and sequestration (Tang et al. 2016; Chang et al. 2017; Li et al. 2021). Some works studied the behaviour of multiphase flow, with mass transfer of species at the interface between fluids. At pore scale, an interesting study was carried out by Haroun et al. (2010), who developed a robust formulation, called Continuum Species Transfer (CST), to treat conditions at the fluid/fluid interface in mass transfer using the VOF (Volume of Fluid) approach. In Graveleau et al. (2017), it was proposed to solve flow equations with species transfer between phases using the VOF-CST approach extending the process to flow with a moving contact line, present in the injection of CO\(_2\) in the subsurface. On the other hand, Yang et al. (2017) showed that for flows with Péclet numbers greater than 0.5, the CST method generates numerical instabilities and, therefore, would not be useful for these types of flows, unless there was a mesh refinement, which would increase the computational cost in the simulation. Later, Maes and Soulaine (2018) proposed a new approach to the CST method, called Compressive Continuum Species Transfer (C-CST) in which they introduced an additional compression term in the concentration equation, which resulted in a drastic decrease in instabilities numbers from the original CST method and allowed simulations with high Péclet numbers. However, the mathematical and numerical models proposed in the literature for multiphase flows address, more broadly, flows using Newtonian fluids in the simulations, but for non-Newtonian fluids, research still does not follow this same trend.

Despite the few works present in this area dealing with flows with non-Newtonian fluids, those that we can find address problems of great relevance. In Favero et al. (2010), numerical studies were carried out using the VOF methodology for the flow of viscoelastic fluids with free surface, obtaining good results for the Giesekus rheological model. In Fernandes et al. (2017), a methodology was approached based on a modified version of the both-sides diffusion technique (BSD), proposed by Guénette and Fortin (1995), aiming to increase numerical stability and precision when dealing with complex fluid flows. Shende et al. (2021) carry out pore-scale studies where they developed a computational structure that simulates the flow of non-Newtonian fluids using the shear thickening fluid, the Meter model, and the Phan–Thien–Tanner viscoelastic equation in 2D and 3D heterogeneous porous media. Sánchez-Vargas et al. (2023) used a macroscopic model to describe the flow in a porous medium with generalized Newtonian fluid. Currently, in the literature, there are no numerical results that use the approach of the C-CST method, proposed by Maes and Soulaine (2018) to analyse the behaviour of non-Newtonian fluid introducing the Giesekus constitutive model.

The main objective of this research is to adapt the C-CST (Compressive Continuum Species Transfer) method to simulate flows involving non-Newtonian fluids, focusing on pore-scale behaviour. The study aims to numerically analyse the differences in behaviour between flows with Newtonian and non-Newtonian fluids, specifically in the context of fluid drainage and mass transfer of a chemical component at the interface. To conduct the simulations, the Giesekus rheological model will be used, which is suitable to represent the rheological properties of non-Newtonian fluids, such as oil.

This article is organized as follows. In Sect. 2, we describe the mathematical formulation and the numerical methods that will be used in the implementation of the rheological model in the solver. Then, in Sect. 3, we present the validation of the proposed new solver and the simulation results to show the potential of our new numerical approach to investigate drainage and mass transfer at the interface in a microchannel and in a 2D porous media.

2 Governing Equations and Numerical Method

2.1 Governing Equations

The governing equations were implemented according to GeoChemFoam approach (Maes and Menke 2019), which uses the Volume of Fluid (VOF) methodology (Hirt and Nicols 1981). Therefore, the single-field velocity and pressure are solved by continuity equation

$$ \nabla \cdot {\mathbf{u}} = 0, $$
(1)

and the momentum equation,

$$\begin{aligned} \frac{\partial (\rho \textbf{u})}{\partial t} + \nabla \,{\scriptscriptstyle {\mathop {{}}\limits ^{\bullet }}}\,(\rho \textbf{u}\textbf{u}) = -\nabla p +\nabla \,{\scriptscriptstyle {\mathop {{}}\limits ^{\bullet }}}\,{\varvec{\tau }} + \rho \textbf{g} + \textbf{f}_{\sigma }, \end{aligned}$$
(2)

where \(\textbf{g}\) is the gravity vector, \(\rho \) is the fluid density, \(\textbf{u}\) is the velocity field, p is the pressure, t is the time, \(\textbf{f}_{\sigma }\) is the surface tension force, and \({\varvec{\tau }}\) represents the stress tensor. In this work, we use the iBSD splitting technique (Fernandes et al. 2017; Araújo et al. 2018) and rewrite the stress tensor as follows:

$$\begin{aligned} {\varvec{\tau }} = 2 \eta _{_P} {\varvec{D}} + {\varvec{\tau }}_{_P} - 2 \eta _{_P} {\varvec{D}}, \end{aligned}$$
(3)

where \( {\varvec{D}} = \frac{1}{2}\left( \nabla {\textbf{u}} + \nabla {\textbf{u}}^T \right) \) is the rate of deformation tensor, \(\eta _{_P}\) is the viscosity of the non-Newtonian fluid at low shear rates, and \({\varvec{\tau }}_{_P}\) is the stress tensor, given by a constitutive equation.

Applying the divergence operator to Eq. (3), and using \( \nabla \,{\scriptscriptstyle {\mathop {{}}\limits ^{\bullet }}}\,\nabla {\textbf{u}}^T = 0\), the divergence of \({\varvec{\tau }}\) is now given by

$$\begin{aligned} \nabla \,{\scriptscriptstyle {\mathop {{}}\limits ^{\bullet }}}\,{\varvec{\tau }} = \eta _{_P} \nabla ^{2}{\textbf{u}} + \nabla \,{\scriptscriptstyle {\mathop {{}}\limits ^{\bullet }}}\,{\varvec{\tau }}_{_P} - \eta _{_P} \nabla \,{\scriptscriptstyle {\mathop {{}}\limits ^{\bullet }}}\,{\nabla {\textbf{u}}}. \end{aligned}$$
(4)

In this work, the non-Newtonian stress is given by the Giesekus model:

$$\begin{aligned} {\varvec{\tau }}_{_P} + \lambda {\mathop {{\varvec{\tau }}}\limits ^{\hspace{0.50003pt}\triangledown }}_{_P} + \gamma \frac{\lambda }{\eta _{_P}}({\varvec{\tau }}_{_P}\,{\scriptscriptstyle {\mathop {{}}\limits ^{\bullet }}}\,{\varvec{\tau }}_{_P}) = 2\eta _{_P}{\varvec{D}}, \end{aligned}$$
(5)

where \(\lambda \) is the relaxation time, \(\gamma \) is a parameter of Giesekus model, depending on the fluid (Giesekus 1982), and \( {\mathop {{\varvec{\tau }}}\limits ^{\hspace{0.50003pt}\triangledown }}_{_P}\) is the upper convected derivative applied to the stress tensor:

$$\begin{aligned} {\mathop {{\varvec{\tau }}}\limits ^{\hspace{0.50003pt}\triangledown }}_{_P} = \frac{\partial {\varvec{\tau }}_{_P}}{\partial t} + \nabla \,{\scriptscriptstyle {\mathop {{}}\limits ^{\bullet }}}\,(\textbf{u}{\varvec{\tau }}_{_P}) - (\nabla \textbf{u})^{T}\,{\scriptscriptstyle {\mathop {{}}\limits ^{\bullet }}}\,{\varvec{\tau }}_{_P} - {\varvec{\tau }}_{_P}\,{\scriptscriptstyle {\mathop {{}}\limits ^{\bullet }}}\,\nabla \textbf{u}. \end{aligned}$$
(6)

It is worth mentioning that, although we can use any rheological model, the Giesekus model has the advantage of being a simple model that captures nonlinear behaviours. Furthermore, considering the computational implementation, in the case of \(\lambda = 0\) in Eq. (5), we recover the Newtonian form for the momentum equation (2).

The fluid mobility depends on the relaxation of stresses, represented by the relaxation time \(\lambda \) (Bretas and D’Ávila 2005). The relationship between \(\lambda \) and the time interval t in which the strain or stress was applied is determined by the Deborah number, De:

$$\begin{aligned} \hbox {De} = \frac{\lambda }{t} = \frac{\lambda u}{L}, \end{aligned}$$
(7)

with the characteristic time t given by L/u, where L is a characteristic domain length, and u is the speed of the experiment.

In addition to the equations mentioned previously, in a multiphase system, the species are present in both fluid phases, and this system is described by using an advection–diffusion equation for the concentration \(C_j\) of a dilute species j in each phase i:

$$\begin{aligned} \frac{\partial C_{ji}}{\partial t} + \nabla \,{\scriptscriptstyle {\mathop {{}}\limits ^{\bullet }}}\,(\textbf{u}_iC_{ji}) = \nabla \,{\scriptscriptstyle {\mathop {{}}\limits ^{\bullet }}}\,(D_{ji}\nabla C_{ji}), \end{aligned}$$
(8)

where \(\textbf{u}_i\) is the velocity field of phase i, and \(D_{ji}\) is the molecular diffusivity coefficient derived from Fick’s law (Fick 1855), as studied by Graveleau et al. (2017). Equation (8) is only valid while the chemical species are dilute. It is worth noting that only species j is miscible in both phases; however, the fluids are not miscible with each other.

Finally, considering that the solid is inert, meaning that it does not undergo chemical reactions, the boundary condition for the concentration with respect to the solid will be Graveleau et al. (2017)

$$\begin{aligned} ({\hat{D}}_{j}\nabla C_{j} + \Phi _{j})\,{\scriptscriptstyle {\mathop {{}}\limits ^{\bullet }}}\,\textbf{n}_{s} = 0, \end{aligned}$$
(9)

where \(\Phi _{j}\) is an additional flux CST, and \(\textbf{n}_{s}\) is the normal vector to the surface of the solid.

2.2 Numerical Method

In this section, we will describe the numerical methods used for the numerical implementation of the case to be studied. The governing equations for a multiphase multicomponent transport system will be implemented using the VOF method (Hirt and Nicols 1981), and the concentration equation using the C-CST method presented by Maes and Soulaine (2018).

2.2.1 The VOF Method

In the VOF method, a volume fraction function (or indicator function) of one of the phases, \(\alpha \), is determined by the equation

$$\begin{aligned} \frac{\partial \alpha }{\partial t} + \nabla \,{\scriptscriptstyle {\mathop {{}}\limits ^{\bullet }}}\,\left( \alpha \textbf{u} \right) + \nabla \,{\scriptscriptstyle {\mathop {{}}\limits ^{\bullet }}}\,\left( \alpha \left( 1 - \alpha \right) \textbf{u}_r \right) = 0, \end{aligned}$$
(10)

where \(\textbf{u}\) is the velocity field shared by the two fluids in the entire computational domain, and \(\textbf{u}_r = \textbf{u}_{1}-\textbf{u}_{2}\) is a relative velocity with \(\textbf{u}_{1}\) and \(\textbf{u}_{2}\) being the velocity field of fluids 1 and 2, respectively.

The expression (10) contains a compression term, whose function is to compress the free surface, promoting its better sharpness and thus significantly contributing to a higher resolution of the Berberović et al. (2009) interface.

For numerical implementation, a modified pressure field \(p_{d}\) is defined as Rusche (2002):

$$\begin{aligned} p_d = p - \rho \textbf{g} \,{\scriptscriptstyle {\mathop {{}}\limits ^{\bullet }}}\,\textbf{x}, \end{aligned}$$
(11)

where \(\textbf{x}\) is the position vector. Thus, applying the gradient in the above equation, we can conclude that the momentum conservation equation (2) will be rewritten as follows:

$$\begin{aligned} \frac{\partial (\rho \textbf{u})}{\partial t} + \nabla \,{\scriptscriptstyle {\mathop {{}}\limits ^{\bullet }}}\,(\rho \textbf{u}\textbf{u}) = -\nabla p_d - \textbf{g} \,{\scriptscriptstyle {\mathop {{}}\limits ^{\bullet }}}\,\textbf{x} \nabla \rho +\nabla \,{\scriptscriptstyle {\mathop {{}}\limits ^{\bullet }}}\,{\varvec{\tau }} + \textbf{f}_{\sigma }. \end{aligned}$$
(12)

In addition, the surface tension force, \(\textbf{f}_{\sigma }\), will also have an approximation for numerical implementation, according to the theory developed by Brackbill et al. (2010), who represented it from the gradient of the function indicator as

$$\begin{aligned} \textbf{f}_{\sigma } = \sigma \kappa \nabla \alpha , \end{aligned}$$
(13)

where \(\sigma \) is the interfacial tension, and \(\kappa \) is the mean curvature of the free surface, given by

$$\begin{aligned} \kappa = - \nabla \,{\scriptscriptstyle {\mathop {{}}\limits ^{\bullet }}}\,\left( \dfrac{\nabla \alpha }{\Vert \nabla \alpha \Vert } \right) . \end{aligned}$$
(14)

2.2.2 The C-CST Method

To use the VOF formulation, the physical properties must be weighted based on the distribution of the volume fraction function. As a result, for concentration, a global variable is introduced from this weighting, given by

$$\begin{aligned} C_{j} = \alpha C_{j,1} + (1-\alpha ) C_{j,2}, \end{aligned}$$
(15)

where \( C_{j,1}\) and \( C_{j,2}\) are the concentrations of a diluted species j in phases 1 and 2.

Haroun et al. (2010) proposed a formulation of the governing equation for the evolution of \(C_{j}\) based on VOF, which was later called the Continuum Species Transfer (CST) method, which calculates the evolution of species concentration in both phases, considering the interfacial effects on the flow. Thus, the equation for the overall concentration is written as follows:

$$\begin{aligned} \frac{\partial C_{j}}{\partial t} + \nabla \,{\scriptscriptstyle {\mathop {{}}\limits ^{\bullet }}}\,(\textbf{F}_j) = \nabla \,{\scriptscriptstyle {\mathop {{}}\limits ^{\bullet }}}\,\textbf{J}_j, \end{aligned}$$
(16)

where

$$\begin{aligned} \textbf{F}_j&= \alpha \ C_{j,1}\textbf{u}_{1} + (1-\alpha ) C_{j,2}\textbf{u}_{2}, \end{aligned}$$
(17)
$$\begin{aligned} \textbf{J}_j&= \alpha \left( D_{j,1}\nabla C_{j,1} \right) + (1- \alpha ) \left( D_{j,2}\nabla C_{j,2} \right) . \end{aligned}$$
(18)

In this phase, the simplification \( \textbf{F}_j = C_j \textbf{u}\) is used for (17), and it can be shown by Deising et al. (2016) that the flux \(\textbf{J}_j\) can be written as follows:

$$\begin{aligned} \textbf{J}_j = {\hat{D}}_{j}\nabla C_{j} + \Phi _{j}, \end{aligned}$$
(19)

with

$$\begin{aligned} {\hat{D}}_{j} = \frac{1}{\frac{\alpha _{1}}{D_{j,1}} + \frac{\alpha _{2}}{D_{j,2}}}, \quad \Phi _{j} = -{\hat{D}}_{j} \frac{1-H_{j}}{\alpha _{1}+H_{j}\alpha _{2}}C_{j}\nabla \alpha _{1}, \end{aligned}$$
(20)

where \(\Phi _{j}\) is an additional flux (CST flux).

Thus, the equation for the global variable used in the standard CST formulation is given by the equation

$$\begin{aligned} \frac{\partial C_{j}}{\partial t} + \nabla \,{\scriptscriptstyle {\mathop {{}}\limits ^{\bullet }}}\,(C_{j}\textbf{u}) = \nabla \,{\scriptscriptstyle {\mathop {{}}\limits ^{\bullet }}}\,({\hat{D}}_{j}\nabla C_{j} + \Phi _{j}). \end{aligned}$$
(21)

The local mass flux \({\dot{m}}_{j}\) (Graveleau 2016) and the total interface mass flux per interfacial area \(\Phi _{j}^{T}\) (Maes and Soulaine 2018) are given, respectively, by

$$\begin{aligned} {\dot{m}}_{j}&= (C_{j}(\textbf{u}-\textbf{w})-{\hat{D}}_{j}\nabla C_{j} - \Phi _{j})\,{\scriptscriptstyle {\mathop {{}}\limits ^{\bullet }}}\,\nabla \alpha _{1}, \end{aligned}$$
(22)
$$\begin{aligned} \Phi _{j}^{T}&= \frac{\int _{A_{12}}{\dot{m}}_{j}dA}{\int _{A_{12}}|\nabla \alpha _{1}|dA}, \end{aligned}$$
(23)

with \(A_{12}\) being the interfacial area.

For multiphase flow, the interface between the fluids and the solid surface forms a contact angle \(\theta \). To establish \(\theta \), apply a normal vector \(n_{\alpha }\) to the fluid/fluid interface on the solid surface, which gives us

$$\begin{aligned} \textbf{n}_{\alpha }=\textbf{n}_{s}\cos {\theta } + \textbf{t}_{s}\sin {\theta }, \end{aligned}$$
(24)

where \(\textbf{n}_{s}\) is the normal vector to the surface of the solid, and \(\textbf{t}_{s}\) is the tangent vector to the solid. The contact angle will depend on the solid surface composition and the fluid properties.

In Graveleau et al. (2017), a boundary condition was developed for the concentration on solid walls in the case of triple contact lines (fluid/fluid/solid), in order to extend the VOF-CST model to the global variable of concentration. This condition is given by

$$\begin{aligned} ({\hat{D}}_{j}\nabla C_{j} + \Phi _{j})\,{\scriptscriptstyle {\mathop {{}}\limits ^{\bullet }}}\,\textbf{n}_{s} = 0. \end{aligned}$$
(25)

Although the CST method using VOF (VOF-CST) is attractive for subsurface simulations with a moving contact line, Yang et al. (2017) showed that when the flow regime has convection dominating over diffusion near the interface, the method generates numerical errors. These regimes are described by the Péclet number (Pe), which is defined as follows:

$$\begin{aligned} \hbox {Pe}_{j} = \frac{LU}{D_{j,w}}, \end{aligned}$$
(26)

with L and U being, respectively, a reference length and velocity, and \(D_{j,w}\) is the diffusion coefficient of the species in the wetting phase. This dimensionless number gives us the convection rate by the diffusion rate, where for \(\hbox {Pe}_{j}>1\), the system has a dominant convection regime, and for \(\hbox {Pe}_{j}<1\), the diffusion regime is dominant.

Maes and Soulaine (2018) proposed a new approach to the CST method in order to obtain more accurate results for a wide range of Péclet numbers, considering an additional compression term in the convective flow, present in the second term on the left side of the Equity (21). This new approach was named Compressive Continuous Species Transfer (C-CST), providing results with greater accuracy than the CST method for flows with high Péclet numbers.

The new convection flux considered was obtained directly, introducing into the convective flux the identities \(\textbf{u}_{1}=\textbf{u}+(1-\alpha ) \textbf{u}_{r}\) e \(\textbf{u}_{2}=\textbf{u}-\alpha \textbf{u}_{r}\), obtaining

$$\begin{aligned} \textbf{F}_{j} = C_{j}\textbf{u} + (C_{j,1}-C_{j,2})\alpha (1-\alpha ) \textbf{u}_{r}, \end{aligned}$$
(27)

with \(\textbf{F}_{j}\) representing the convective flux in the method. The first term of Eq. (27) comes from the advective flux of the CST method, and the second part of Eq. (27) represents the additional term in the convective flux.

The conditions at the interface impose a continuous conservation of mass on both sides, as described by Graveleau (2016), where at the interface between the fluids, there is a continuity of mass fluxes and chemical potentials, in which these potentials are described by a partition relation coming from Henry’s law, stating that the concentration in the liquid phase is proportional to the partial pressure in the gas phase. Therefore, the boundary conditions at the interface will be given by

$$\begin{aligned}&\textbf{n}_{12}\,{\scriptscriptstyle {\mathop {{}}\limits ^{\bullet }}}\,(C_{1,j}(\textbf{u}_1 - \textbf{w}) - D_{1,j}\nabla C_{1,j}) = \textbf{n}_{12}\,{\scriptscriptstyle {\mathop {{}}\limits ^{\bullet }}}\,(C_{2,j}(\textbf{u}_2 - \textbf{w}) - D_{2,j}\nabla C_{2,j}), \end{aligned}$$
(28)
$$\begin{aligned}&C_{1,j}=H_j C_{2,j}, \end{aligned}$$
(29)

where \(\textbf{n}_{12}\) is the normal to the interface, \(\textbf{w}\) is the velocity at the interface, and \(H_j\) is the partition coefficient of Henry’s law. While this condition is not satisfied, mass transfer between phases will occur until reaching thermodynamic equilibrium. Considering that the solid is inert, that is, it does not undergo chemical reactions, the boundary condition for the concentration in relation to the solid will be

$$\begin{aligned} \textbf{n}_s \,{\scriptscriptstyle {\mathop {{}}\limits ^{\bullet }}}\,\nabla C_{i,j} = 0, \quad \text {with} \quad i=1,2, \end{aligned}$$
(30)

with i representing the fluid phases of the media.

From Henry’s law (29) and global concentration (15), the convective flux can be rewritten as follows:

$$\begin{aligned} \textbf{F}_{j} = C_{j}\textbf{u} + \frac{(1-H_{j})C_{j}}{\alpha +H_{j}(1-\alpha )}\alpha (1-\alpha ) \textbf{u}_{r}. \end{aligned}$$
(31)

This species convection described in (31) is consistent with the transport equation (10). From this, the concentration equation for the C-CST method will be written as follows:

$$\begin{aligned} \frac{\partial C_{j}}{\partial t} + \nabla \,{\scriptscriptstyle {\mathop {{}}\limits ^{\bullet }}}\,(C_{j}\textbf{u}) = -\nabla \,{\scriptscriptstyle {\mathop {{}}\limits ^{\bullet }}}\,\Big ( \frac{(1-H_{j})C_{j}}{\alpha +H_{j}(1-\alpha )}\alpha (1-\alpha ) \textbf{u}_{r}\Big ) + \nabla \,{\scriptscriptstyle {\mathop {{}}\limits ^{\bullet }}}\,({\hat{D}}_{j}\nabla C_{j}+\Phi _{j}). \end{aligned}$$
(32)

Maes and Soulaine (2018) showed that the C-CST formulation is more accurate than the standard CST due to the flexibility of the C-CST method in modelling problems that are dominated by convection and diffusion without the need to change the model or numerical scheme, which can be used as a problem for a wide range of Péclet numbers.

2.2.3 Numerical Procedure

The starting point for entering the non-Newtonian model is an OpenFOAM solver called interFoam. Its use is related to problems that have free surface flows. This solver uses the VOF methodology together with the numerical scheme MULES (Multidimensional Universal Limiter for Explicit Solution) (Marquez Damian 2013), for the solution of the indicator function equation (10). The interFoam is already implemented in the source code that we will use here, the GeoChemFoam (Maes and Menke 2019). Among the various solvers in this package are interTransportFoam, which Maes and Soulaine (2018) used to simulate the C-CST method and thus obtain results for simulations with multiphase flows involving mass transfer at the fluid/fluid interface. Into this solver that we will insert the Giesekus constitutive model.

The viscoInterTransportFoam was built based on interTransporFoam with modifications in the codes createFields and UEqn, in order to insert the libraries related to the Giesekus model. The procedure used to implement the constitutive model in the original code is summarized in the following steps:

  1. 1.

    The constitutive model is implemented in the file CreateFields.H, declaring an object of type viscoelasticModel, in which the constitutive model is present, as done by Favero (2009). This object function is to exchange information between the main function and the constitutive model Giesekus function.

  2. 2.

    Inside this object, there is a member function called divTau, defined in the file UEqn.H, in which the momentum conservation equation is introduced, in which the function visco.divTau(alpha1, U) contains all the parcels it relates the viscous and elastic terms of stress.

  3. 3.

    Finally, the final solver will be described in the file viscoInterTransportFoam.C. This file contains the calculation sequence according to the PISO algorithm (Pressure Implicit Splitting Operator).

The procedure for solving the PISO algorithm is described by the following steps:

  1. 1.

    Initially, we considered the known fields at time \(t_n\) as the pressure \(p^n = p(\textbf{x},t_n)\), the velocity \(\textbf{u}^{n} = \textbf{u}(\textbf{x}, t_n)\), the stress \({\varvec{\tau }}^{n} = {\varvec{\tau }}(\textbf{x}, t_n)\), the concentration \(C^{n} = C(\textbf{x},t_n)\), and the indicator function \(\alpha ^{n} = \alpha (\textbf{x},t_n)\).

  2. 2.

    The conservation of momentum equation below is solved,

    $$\begin{aligned} \underbrace{ \frac{\partial (\rho \textbf{u})}{\partial t} + \nabla \,{\scriptscriptstyle {\mathop {{}}\limits ^{\bullet }}}\,(\rho \textbf{u}\textbf{u}) - \eta _0 \nabla ^{2}\textbf{u} }_{\text {implicit}} = \underbrace{ -\nabla p_d - \textbf{g} \,{\scriptscriptstyle {\mathop {{}}\limits ^{\bullet }}}\,\textbf{x} \nabla \rho +\nabla \,{\scriptscriptstyle {\mathop {{}}\limits ^{\bullet }}}\,{\varvec{\tau }} - \eta _0 \nabla \,{\scriptscriptstyle {\mathop {{}}\limits ^{\bullet }}}\,\left( \nabla \textbf{u} \right) + \textbf{f}_{\sigma } }_{\text {explicit}}, \end{aligned}$$
    (33)

    obtaining a field \(\textbf{u}^*\).

  3. 3.

    With the new velocity values \(\textbf{u}^*\), the new pressure field \(p^*\) is calculated. The pressure equation can be solved more than once in each step.

  4. 4.

    The need for pressure correction is checked. Then, the calculation of the stress tensor \(\tau \) is performed, using the constitutive equation (5).

  5. 5.

    If the PISO converges, the indicator function equation and the concentration equation are solved. Then, the calculation is finished, and new values for the fields are stored in time \(t_{n+1}\). Thus, the calculation returns to step 1, and a new calculation starts for a new time step until the maximum simulation time is reached, and the calculations are finished.

In all simulations, the initial conditions for velocity, pressure, and stress are zero fields. A constant velocity is imposed on the inlet, and at the solid–liquid interface, the no-slip condition is adopted for velocity and zero gradient for pressure and stress. On the outlet, the pressure is zero, and for other fields, the zero gradient condition is adopted.

Inside the code of the viscoInterTransportFoam.C file, the stress calculation was added by calling the visco.correct() function after the pressure calculation. This function is responsible for solving the constitutive equation and for updating the stress values to be used in the momentum conservation equation. The function returns the solution of the Giesekus constitutive model, solving the stress equation 5.

Therefore, from this new numerical formulation, we build the solver viscoInterTransportFoam to solve a system with non-Newtonian fluid. Our proposed solver was implemented in GeoChemFoam making the changes described here. The simulations that we will show here were performed using a branch of OpenFOAM, foam-extend 4.0, and the post-processing visualized in the Paraview software.

3 Validation and Results

We will carry out a comparative numerical analysis between the drainage behaviour of Newtonian and non-Newtonian viscoelastic fluids in a 2D microchannel and in a 2D porous media with different porosities. Through this study, we will investigate the differences observed in the flows and the influence of using a rheological model on the transport of a chemical component in the interface formed between the fluid phases.

3.1 Validation

To validate the solver, we simulated the multiphase flow in a 2D microchannel of size 800\(\mu \)m \(\times \) 100\(\mu \)m, as shown in Fig. 1, comparing the results with the original GeoChemFoam code for the drainage of a Newtonian fluid through air carrying a miscible component that diffuses through the interface between the fluids. A subdomain \(\Omega \) is defined to analyse the results in order to avoid effects of boundary conditions in the microchannel.

Fig. 1
figure 1

Dimensions of the 2D microchannel in the drainage of a fluid, forming a thin-film deposition on the domain wall

3.1.1 Comparison with Analytical Solution

For a Newtonian fluid, the analytical solution of the fully developed velocity profile in a channel between parallel plates is given by a parabola, whose equation is Bird et al. (2007)

$$\begin{aligned} u(y) = \left( - \dfrac{6{\bar{u}}}{L^2} \right) (y-L)y, \end{aligned}$$
(34)

where L is the channel height, and \({\bar{u}}\) is the average inlet velocity.

In the following experiments, the microchannel is filled with ethanol, and air is injected at a velocity of \(U= {0.4}\,{\mathrm{m/s}}\) with the fixed pressure on the right side of the microchannel (\( p=0\)). The fluid properties are: for air \(\rho _{1}=\) \({1}\,\mathrm{kb/m}^{3}\) and \(\mu _{1}=\) \({18}\,{\upmu }\,\, \textrm{Pas}\), and for ethanol \(\rho _{2}= {789}\,\mathrm{kg/m}^{3}\) and \(\mu _2= {1.2}\,\textrm{mPa}\,\textrm{s}\). The interfacial tension is \(\sigma = {20}\,\mathrm{mN/m}\). The liquid phase is the wetting phase, and the microchannel contours contain contact angle \(\theta =\) \({20}^\circ \). The mesh used contains \(200\times 40\) cells, non-uniformly distributed so that \(\delta y_{\textrm{min}}= 0.6 \times 10^{-6}\,\textrm{m}\), taken adjacent to the walls.

The velocity profile is measured at the centre of the microchannel at \(x= 4\times 10^{-4}\,\textrm{m}\) and \(t= 5\times 10^{-4}\,\textrm{s}\), time in which the air has not yet reached this point, and the liquid is already fully developed. The comparison with the analytical solution is shown in Fig. 2, and the excellent agreement with the analytical solution is evident, thus showing that the modification of the solver with the introduction of the Giesekus rheological model manages to reproduce the Newtonian result for this case.

Fig. 2
figure 2

Comparison for the component \(u_x\) of the velocity field in a channel between parallel plates

Now, it will be verified if the modification of the original solver interTransportFoam, from the introduction of the Giesekus rheological model, resulting in the solver viscoInterTransportFoam, can reproduce the results of draining a Newtonian fluid obtained with GeoChemFoam.

In this experiment, the gas phase carries a component A of concentration \(C= {1}\,\mathrm{kg/m}^{3}\), and initially, the liquid phase does not contain any concentration of this component. The diffusivity of the component in the gas and liquid phases is \(D_{A,g}=D_{A,l}= {2\times 10^{-7}}\,\textrm{m}^{2}\mathrm{/s}\), and the Henry coefficient is \( H=0.1\).

We simulate the drainage of ethanol through air and the evolution of the A component through the interface formed between the fluids, as shown in Fig. 3a and b.

Fig. 3
figure 3

Validation: a drainage of a Newtonian fluid in a microchannel and b evolution of the concentration of a component at the interface between the fluids in the microchannel

We can qualitatively observe, through Fig. 3a and b, that the drainage of the Newtonian fluid using the two solvers for the same simulation presents the same air advance time inside the microchannel when draining the ethanol. In Fig. 3b, we note that as air is injected into the microchannel, the component diffuses into the ethanol close to the interface between the fluids.

In the Newtonian fluid drainage, there is the formation of stable thin films deposited on the walls of the microchannel. The thickness of these thin films is estimated from a relation, known as semi-empirical Taylor’s law, proposed by Aussilous and Quéré (2000), which relates the thickness of the thin film h and the radius of the microchannel R with the capillarity number Ca, as shown by Eq. 35.

$$\begin{aligned} \frac{h}{R}=\frac{1.34\hbox {Ca}^{2/3}}{1 + 3.35\hbox {Ca}^{2/3}}. \end{aligned}$$
(35)

The capillarity number, Ca, is given by \(Ca = \mu _w U/ \sigma \), with \(\mu _w\) being the viscosity of the wetting phase, in which for this simulation, \(\hbox {Ca}= {2.4 \times 10^{-2}}\). For the 35, we have \(h_{\textrm{empirical}}= {4.35}\,{\upmu }\textrm{m}\). To find the thickness of the thin film in the microchannel, we consider the domain \(\Omega \) (1). The simulation with interTransportFoam resulted in a thin film of \(h= {4.71}\,{\upmu }\textrm{m}\), while viscoInterTransportFoam resulted in \(h=\) \({4.70}\,{\upmu }\textrm{m}\), with a relative error of \(0.21\%\), which shows good agreement between the viscoelastic solver and the Newtonian solver. In both cases, the comparison with \(h_{\textrm{empirical}}\) showed a relative error of the order of \(8\%\). Other numerical experiments, such as a close-wall mesh refinement study, may lead to more accurate results, but due to the limitation of the time step required for numerical stability, these studies have not yet been performed.

After draining the ethanol from the microchannel, we can analyse the residual saturation, \(S_r\). Figure 4 shows the residual saturation of ethanol over time. Again, we observed good agreement between the numerical results. In this case, interTransportFoam obtained saturation \(S_{r (itf)} = 9.93\%\) while viscoInterTransportFoam obtained \(S_{r (vitf)} = 9.90\%\), resulting in a relative error of \(0.25\%\).

Fig. 4
figure 4

Validation: residual ethanol saturation in the microchannel

In Fig. 5, we present a result comparison of the component concentration in each phase and the mass flux per interfacial area and the difference of concentrations in the subdomain \(\Omega \). In both cases, viscoInterTransportFoam shows excellent numerical agreement with the original results.

Fig. 5
figure 5

Validation: a component concentration in each phase and b total mass flux per interfacial area and concentration difference. Data measured in the subdomain \(\Omega \) in the microchannel

The component propagates through the air by convection and diffusion until it reaches the \(\Omega \) region around 0.3 ms, where the component crosses the interface and accumulates in the thin film until thermodynamic equilibrium is satisfied with equality between the concentration of the component in the air and in the liquid phase. In the slope of the concentration curve in Fig. 5a, we note the same component concentration variation rate in the phases using both solvers for the simulation. On the other hand, we can also quantify the component mass transfer between the fluids through the total mass flux per interfacial area graph and the difference in concentrations over time (Fig. 5b). We note that the two curves are strongly related because most models based on the use of a representative elemental volume (REV) for mass transfer use a non-local equilibrium formulation, which assumes the average flow of mass transfer across an interface fluid/fluid as a linear driving force (Soulaine et al. 2011). We also observed a similar behaviour between the curves in the simulations with both solvers. These curves can be related through a mass transfer coefficient, k, from a linear function given by

$$\begin{aligned} F_{Af} = k(HC_{g} - C_{l}), \end{aligned}$$
(36)

with \(F_{Af}\) being the mass flux per interfacial area, and k is the mass transfer coefficient. This coefficient is obtained from the graph of mass flux per interfacial area given as a function of concentration difference, as shown in Fig. 6.

Fig. 6
figure 6

Validation: evolution of the total mass flux per interfacial area as a function of the concentration difference with linear approximation to obtain k in the microchannel

As the concentration difference decreases, the mass transfer rate also decreases, due to the mass transfer reaching equilibrium after a certain simulation time (\(t={1.3}\,\textrm{m}\,\textrm{s}\)). A linear relationship between the mass flux and the difference in concentrations in the last simulation times is performed, and from this relationship, the mass transfer coefficient of the component between the phases is extracted using Eq. 36. The simulation with both solvers showed similar behaviour between the curves and the mass transfer coefficients obtained were \(k_{itf}= {1.752\times 10^{-2}}\) and \(k_{vitf}= {1.749\times 10^{-2}}\), with relative error of \(0.17\%\).

The same simulation is performed for various values of the diffusion coefficient in order to show the dependence of the mass transfer coefficient k on the Péclet number (Pe). Figure 7 plots the values of k for Péclet numbers ranging from 1 to \(10^{3}\).

Fig. 7
figure 7

Validation: mass transfer coefficient k as a function of the Péclet number Pe in the microchannel

We observe that the mass transfer coefficient has a linear dependence with the Péclet number. Comparing the values of k with both solvers shows a relative error of \(0.5\%\).

3.2 Results

3.2.1 Numerical Analysis of the Flow in a 2D Microchannel

After performing the validation of the proposed solver comparing with the simulation of the original solver, we verified that the obtained results were similar, presenting low relative errors. From this, we will then carry out drainage simulations, now using non-Newtonian fluids in the same domain as the previous 2D microchannel. The non-Newtonian characteristic of the fluid is measured using the Deborah number, De (see Eq. 7). The variation of De was obtained with the variation of the relaxation times, \(\lambda \). So the Deborah numbers used are \(\hbox {De}=0.1\) with \(\lambda _{\hbox {De}=0.1}= {2.5\times 10^{-3}}\,\textrm{s}\), \(\hbox {De}=0.2\) with \( \lambda _{\hbox {De}=0.2}= {5\times 10^{-3}}\,\textrm{s}\), and \(\hbox {De}=0.3\) with \(\lambda _{\hbox {De}=0.3} = 7.5\times 10^{- 3}s\). The mobility factor for the fluids is: \(\gamma _{1}=0\) and \(\gamma _{2}=0.15\) for both non-Newtonian fluids.

The obtained results were the drainage of non-Newtonian fluids through the air and the evolution of a component A through the interface formed between the fluids in the region \(\Omega \) of the microchannel, as shown in Figs. 8 and 9. These results are compared with the Newtonian fluid drainage simulation.

Fig. 8
figure 8

Drainage of Newtonian and non-Newtonian fluids with different Deborah numbers in the microchannel

Fig. 9
figure 9

Concentration evolution in time \(t= {0.001}\,\textrm{s}\) in the drainage of Newtonian and non-Newtonian fluids with different Deborah numbers in the subdomain \(\Omega \) in the microchannel

It is observed in Fig. 8 that as the air is being injected, the presence of stable thin films occurs on the microchannel walls. We note that the greater the Deborah number of the fluid, the greater the relaxation time, and the smaller the thickness of this thin film. This effect can be more clearly observed in the component concentration evolution in the subdomain \(\Omega \) in the microchannel, as shown in Fig. 9.

The capillary number for this simulation is \(\hbox {Ca}= {2.4\times 10^{-2}}\). By Eq. (35), we have that, for the Newtonian fluid, \(h_{\textrm{empirical}}= {4.35}\,{\upmu }\textrm{m}\). In simulations with non-Newtonian fluids, we find \(h_{\hbox {De}=0.1}= {3.36}\,{\upmu }\textrm{m}\), \(h_{\hbox {De}=0.2}={1.90} \,{\upmu }\textrm{m}\), and \(h_{\hbox {De}=0.3}= {1.14}\,{\upmu }\textrm{m}\). The semi-empirical equation 35 was acquired by Aussilous and Quéré (2000) using Newtonian fluids; however, the behaviour of the thin-film deposition for non-Newtonian fluids does not occur in the same way. As far as we know, this relation is valid for Newtonian fluids, not being found results that confirm its validity for non-Newtonian viscoelastic fluids.

On the other hand, in Fig. 8, we observed that in the drainage of non-Newtonian fluids, the injected air takes longer to drain the fluid and cross the other side of the domain. The slow flow is a characteristic of the material, where the non-Newtonian fluid has a longer relaxation time to flow, causing the fluid to perform slower molecular movements until it reaches its equilibrium form again.

After the fluids are drained, we can quantify the residual saturation of each non-Newtonian fluid, as shown in Fig. 10. We noticed a reduction in the residual saturation of each fluid with the increase in its viscoelastic characteristic, with \(S_{r(\hbox {De}=0.1)}=7.17\%\), \(S_{r(\hbox {De}=0.2)} =4.19\%\), and \(S_{r(\hbox {De}=0.3)}=2.63\%\).

Fig. 10
figure 10

Evolution of fluid saturation with time in the microchannel

The component concentration graph in each phase is shown in Fig. 11a together with the total mass flux per interfacial area and the concentration difference in the subdomain \(\Omega \) (Fig. 11b).

Fig. 11
figure 11

a Component concentration in each phase and b total mass flux per interfacial area and concentration difference in subdomain \(\Omega \) in the microchannel

In Fig. 11a, the component propagates through the air by convection and diffusion until it reaches the \(\Omega \) region in \({0.3}\,\textrm{ms}\). In the slope of the concentration curve, we noticed a variation in the component concentration decreasing for the fluids with the highest Deborah number, resulting in the delay of the thermodynamic equilibrium between the phases.

However, we can also quantify the mass transfer of the component between fluids. The total mass flux per interfacial area and the concentration difference are plotted against time in Fig. 11b. In the initial times, the air has not yet reached the central \(\Omega \) region in the microchannel, where the concentrations in the graph are equal to zero (axis in red). When the air reaches the central area of the microchannel at \(t=\) \({0.3}\,\textrm{ms}\), we observe a similar behaviour between the curves. An increase in concentration in the gaseous phase occurs until reaching a point where the mass transfer from air to liquid reaches equilibrium. Similar to the one seen in Sect. 3, the two curves are strongly correlated, and a mass transfer coefficient k can be stipulated from the linear function given by Eq. 36. We obtain k by the mass flux per interfacial area graph given as a function of the difference in concentration, as shown in Fig. 12.

Fig. 12
figure 12

Evolution of the total mass flux per interfacial area as a function of the concentration difference with linear approximation to obtain k in the microchannel

For viscoelastic non-Newtonian fluids, the component mass transfer between the fluids is smaller compared to the Newtonian fluid, where for the fluid with \(\hbox {De}=0.1\), \(\hbox {De}=0.2\), and \(\hbox {De}=0.3 \), we have \(k_{\hbox {De}=0.1}= {1.37\times 10^{-2}}\,\textrm{ms}\), \(k_{\hbox {De}=0.2}= {0.98\times 10^{-2}}\,{ \mathrm ms}\), and \(k_{\hbox {De}=0.3}= {0.78\times 10^{-2}}\,\textrm{ms}\), while for the Newtonian fluid, we have \(k_{Newt}= { 1.74\times 10^{-2}}\,\textrm{ms}\).

A possible explanation for this decrease in the mass transfer coefficients is in relation to the non-Newtonian characteristics of the fluid. As we increase the Deborah number, the viscoelastic characteristics of the fluid also increase. This increase in viscoelasticity is directly related to the increase in molar mass. The increase in viscoelastic characteristics and molar mass of non-Newtonian fluids may be related to the entanglement of molecular chains. In viscoelastic systems, such as some non-Newtonian fluids, molecular chains can intertwine and form a tangled structure that contributes to the viscoelasticity of the fluid, resulting in complex flow behaviour and increased resistance to flow (Ramli et al. 2022). As the Deborah number increases, the molecular chains have more time to entangle, in which they interact with each other, making it more difficult for the contaminant mass transfer at the fluid/fluid interface. This occurs because the entanglement of molecular chains creates a network that restricts molecular diffusion and decreases the efficiency of mass transfer.

However, we can also show a dependence of the mass transfer coefficient k on the Péclet number \(\hbox {Pe}\). We performed simulations with the Newtonian fluid and the non-Newtonian fluid with \(\hbox {De} = 0.2\) for different values of the diffusion coefficient, resulting in Péclet numbers ranging from \(10^{1}\) to \(10^{3}\), as shown in Fig. 13. We note that k has a linear dependence with \(\hbox {Pe}\), and for non-Newtonian fluids, mass transfer decreases its efficiency, as previously stated, presenting smaller values of k compared to the Newtonian fluid.

Fig. 13
figure 13

Mass transfer coefficient k as a function of the Péclet number \(\hbox {Pe}\) in the microchannel

Another point of interest to be considered in the numerical analysis of non-Newtonian fluids is the study of the behaviour of stresses resulting from the introduction of the rheological model in the governing equations. For flow between parallel plates, for example, we saw in Sect. 3 that the velocity profile for a Newtonian fluid is a parabola. When we introduce viscoelasticity, through the Deborah number, the profile changes and moves away from the known parabolic profile. Figure 14 shows the profiles of the velocity component \(u_x\) in the middle of the channel, similarly to the one performed in Sect. 3, but now includes the profile for different Deborah numbers.

Fig. 14
figure 14

Difference between velocity profiles for different Deborah numbers

We can observe that the increase in \(\hbox {De}\) provokes a decrease in the maximum value of the velocity in its profile. As a consequence of these changes, the shear rates at each point in the cross-section also change. In this specific case, the rate at each point is given by

$$\begin{aligned} {\dot{\gamma }} = \dfrac{\hbox {d} u_x}{\hbox {d}y}. \end{aligned}$$
(37)

By observing the profiles close to the contour, it can be seen that the increase in the Deborah number results in a high shear rate, leading, in principle, to a local reduction in viscosity, since Bretas and D’Ávila (2005)

$$\begin{aligned} \eta ({\dot{\gamma }}) = \dfrac{\tau _{xy}}{{\dot{\gamma }}}. \end{aligned}$$
(38)

The shear stresses, \(\tau _{xy}\), also show a similar behaviour close to the boundary. However, in this case, the stress decreases with the increase in the Deborah number. These results are shown in Figs. 15, 16, and 17.

Fig. 15
figure 15

Shear stress \(\tau _{xy}\) taken in the region \(\Omega \) at \(y = 10^{-6}\)m, at time \(t=5\times 10^{-4}s\). On the right, we see the position of the interface for each Deborah number

Fig. 16
figure 16

Shear stress \(\tau _{xy}\) taken in the region \(\Omega \), at \(y = 10^{-6}\)m, at time \(t=12.6\times 10^{-4}s\). On the right, we see the position of the interface for each Deborah number

Fig. 17
figure 17

Shear stress \(\tau _{xy}\) taken in region \(\Omega \), at \(y = 10^{-6}\)m, at time \(t=15.6\times 10^{-4}s\). On the right, we see the position of the interface for each Deborah number

These figures show the profile of \(\tau _{xy}\) at a height \(y=10^{-6}\text {m}\) from the lower wall, in the \(\Omega \) domain. We note that the stresses have higher values for fluids with lower Deborah numbers. After the fluid is drained, in the thin-film region, the stresses present a mixed behaviour, as shown in Fig. 17. Non-Newtonian fluids exhibit complex flow behaviour. We could infer that this behaviour influences the height of the thin film, which would justify the non-validity of Taylor’s semi-empirical law 35 for non-Newtonian fluids. However, further investigations are needed for further conclusions.

3.2.2 Numerical Analysis of Flow in a 2D Complex Porous Media

In this simulation, we propose to investigate the phenomenon of mass transfer at pore-scale multiphase flow in a 2D complex porous media. The results of numerical simulations of the drainage efficiency of non-Newtonian fluids by water will be presented, which will be analysed along with the mass transfer of a component at the interface. A comparison of these results will be made with drainage and mass transfer using a Newtonian fluid.

The drainage of a Newtonian and non-Newtonian fluid in the domain is simulated through the injection of water, with it carrying a component that diffuses through the interface between the fluids during the flow. The fluids used were water (a Newtonian fluid) and three non-Newtonian fluids, characterized by different values of \(\hbox {De}\). The fluid properties are for water \(\rho _{1}=\) \({1000}\,\mathrm{kg/m}^{3}\) and \(\mu _{1}= {1}\,\textrm{mPa}\,\textrm{s}\) and for the non-Newtonian fluids \(\rho _{2}={840}\,\mathrm{kg/m}^{3}\) and \(\eta _0={6.5}\,\textrm{mPa}\,\textrm{s}\). The Deborah numbers used for non-Newtonian fluids are \(\hbox {De} = 0.1\) with \(\lambda _{\hbox {De}=0.1}=\) \(1.5\times 10^{-4}\,\textrm{s}\) and \(\hbox {De} = 0.2\) with \(\lambda _{\hbox {De}=0.2}=\) \(3\times 10^{-4}\,\textrm{s}\). The mobility factor for the fluids is \(\gamma _{1}=0\) for the Newtonian fluid and \(\gamma _{2}=0.15\) for both non-Newtonian fluids. Water is the non-wetting phase with contact angle \(\theta ={135}^\circ \). The porous media to be used is shown in Fig. 18. The mesh was generated using snappyHexMesh from OpenFOAM, from a rectangular region of \({1}\,\textrm{mm}\times {0.5}\,\textrm{mm}\), with the computational mesh containing \(500\times 250\) cells, totalling 62,165 cells. The average pore diameter of the media is \(L=\) \({15}\,{\upmu } \textrm{m}\), and the porosity is \(50\%\).

Fig. 18
figure 18

Porous media geometry with \(50\%\) porosity

Initially, the porous media is filled with liquid, and water is injected at a velocity \(U= {0.01}\,\mathrm{m/s}\), where only water carries a concentration of the component. The porous media has an average pore diameter of \(L= {10}\,{\upmu }\textrm{m}\). The concentration of a component A in water is \(C={1}\,\mathrm{kg/m}^{3}\), the diffusivity of the component in both phases is \(D_{A,1}=D_ {A,2}= 10^{-9}\,\textrm{m}^{2}/\textrm{s}\), and the Henry coefficient \(H=0.5\).

We first performed the simulation with water draining a Newtonian fluid in the media, and then, we considered the drainage of non-Newtonian fluids varying their viscoelastic properties by the Deborah number, \(\hbox {De}\), from the relaxation time of the fluid, \(\lambda \). Figure 19 shows the results of drainage in the porous media, and Fig. 20 shows the evolution of the component concentration between phases.

Fig. 19
figure 19

Drainage of one Newtonian fluid and two non-Newtonian fluids with \(\hbox {De}=0.1\) and \(\hbox {De} = 0.2\)

Fig. 20
figure 20

Evolution of the component concentration A in a Newtonian fluid and in non-Newtonian fluids with \(\hbox {De}=0.1\) and \(\hbox {De} = 0.2\)

We noticed in Fig. 19 that the non-Newtonian fluid with \(\hbox {De} = 0.2\) presents greater resistance to being drained compared to the other fluids, in which the water manages to cross the media in \(t= {0.06}\,\textrm{s}\) in the drainage of the Newtonian and non-Newtonian fluid with \(\hbox {De} = 0.1\), while in the drainage of the fluid with \(\hbox {De} = 0.2\), the water crosses the media only in \(t=\) \({0.07}\,\textrm{s}\).

After the fluids are drained, we quantify the residual saturation of each fluid, as shown in Fig. 21. At the end of drainage, the fluids showed residual saturation of \(S_{r(Newt)}=21.87\%\), \(S_{r(\hbox {De} = 0.1}=23.94\%\), and \(S_{r (\hbox {De} = 0.2}=26.94\%\). Newtonian fluids have lower resistance to flow in porous media due to their constant viscosity and ability to obey Darcy’s law. These characteristics allow these fluids to flow smoothly, more uniform, and predictable through the pores, resulting in a lower resistance to flow. On the other hand, non-Newtonian fluids have a more complex and less predictable rheological behaviour in a porous media.

Fig. 21
figure 21

Evolution of fluid saturation with time in porous media

We noticed that, for the microchannel in the previous simulation, the residual fluid saturation in the media was decreasing to the extent to which we considered a non-Newtonian fluid with a longer relaxation time and, consequently, with a greater Deborah number. The microchannel is a well-defined structure, where the flow path is one-dimensional; however, the porous media presents a more complex structure, with heterogeneity and spatial variability in terms of pore size, pore distribution, and connectivity, making the flow of the fluids present different paths. In Fig. 22, it is possible to notice the preferential paths that the fluids take when entering the porous media through the streamlines. Non-Newtonian fluids, in the presence of pores and more complex structures in a porous media, may present variations in the strain rate in different parts of the media, indicating non-uniform flow and with different flow resistances. We show this by analysing the stress variations along the flow, taking three different regions of pore throats in the media (Figs. 23 and 24).

Fig. 22
figure 22

Preferred paths for each fluid inlet

Fig. 23
figure 23

Regions of the porous media where the shear stress \(\tau _{xy}\) will be measured

Fig. 24
figure 24

Shear stress \(\tau _{xy}\) taken in regions 1, 2, and 3 of the porous media of \(50\%\) porosity, close to the wall of each pore throat, at time \(t= {0.01}\,\textrm{s}\)

It is possible to observe in Fig. 24 the variations that the stress presents in each region of the pore throat taken in the porous media. We note that the stress is not uniform throughout the flow of non-Newtonian fluids.

However, by analysing the component concentration evolution in the media (Fig. 20), we can carry out a more complete analysis of a component diffusivity in the fluids through the graphs of the component concentration in both phases, the graph of the mass flux per interfacial area and the difference in concentrations (Fig. 25a and b)

Fig. 25
figure 25

a Component concentration in each phase and b total mass flux per interfacial area with the difference in concentration in the porous media

It is observed in Fig. 25a that the component diffusivity in non-Newtonian fluids (red axis) occurs more slowly compared to the Newtonian fluid.

This is because the entanglement of molecular chains creates a network that restricts molecular diffusion and decreases the efficiency of mass transfer. We observed this effect in the simulation of drainage of non-Newtonian fluids in a microchannel; however, in the porous media, the non-Newtonian fluid presents a more complex behaviour due to the porous structure, as previously mentioned. The viscoelastic and rheological properties of the non-Newtonian fluid, together with the entanglement of molecules and interactions with the pore structure, can affect mass transfer, resulting in different mass transfer coefficients compared to Newtonian fluid. This is shown in Fig. 26 through the linear approximation using Eq. 36 at the last simulation times.

Fig. 26
figure 26

Linear approximation with the mass transfer coefficients of each fluid in the porous media

The Newtonian fluid shows a \(k_{\textrm{newt}}= 3.32\times 10^{-5}\,\mathrm{m/s}\) relatively smaller than the mass transfer coefficient of the non-Newtonian fluid with \(\hbox {De}=0.1\), with \(k_{\hbox {De}=0.1}= 3.61\times 10^{-5}\,\mathrm{m/s}\). The non-Newtonian fluid with \(\hbox {De}=0.2\) shows a \(k_{\hbox {De}=0.2}= 3.13\times 10^{-5}\,\mathrm{m/s}\), smaller than the other simulated fluids.

Performing a comparison of k of the Newtonian and non-Newtonian fluid with \(\hbox {De} = 0.2\) for different values of the diffusion coefficient, we show the dependence of k with the Péclet number \(\hbox {Pe}\) (Fig. 27). A similar behaviour to the previous porous media is observed, in which the mass transfer coefficient assumes larger values as the Péclet number increases.

Fig. 27
figure 27

Mass transfer coefficient k as a function of Péclet number \(\hbox {Pe}\) in porous media

4 Conclusion

In this work, the properties of multiphase flow at pore scale were studied with the implementation of viscoelastic non-Newtonian fluid. Numerical analyses were conducted to investigate the flow behaviour and the mass transfer between the present phases.

It was observed that drainage of non-Newtonian fluid in a microchannel exhibited slowness due to longer relaxation times, resulting in higher Deborah numbers. This occurs because the non-Newtonian fluid has a longer relaxation time to flow, due to slower molecular movements until it reaches its equilibrium. However, it was noted that, despite the slow flow, the residual saturation decreased for non-Newtonian fluids with higher Deborah numbers, which demonstrates greater efficiency in draining the fluid from the microchannel. On the other hand, the diffusivity of the component between the phases was slow in non-Newtonian fluids due to the viscoelastic characteristics of these fluids. The molecular chains of these fluids can intertwine, forming a tangled structure that restricts molecular diffusion, thus decreasing the efficiency of mass transfer.

The novelty of the proposed method proposed in this paper is the analysis of shear rates at each point in the domain, which demonstrated that increasing the Deborah number results in high shear rates, leading to a local reduction in viscosity. The shear stress graphs showed a decrease in stress values for fluids with higher Deborah numbers.

When considering the complex porous media in the simulation, two porous media with different porosities were analysed. The fluid drainage behaviour was different from the microchannel, due to the more complex structure of the porous media, with variations in pore size and distribution, which led the fluid to take different paths. These preferred paths resulted in different velocities and shear rates, showing a shear thinning behaviour of the non-Newtonian fluid. The component diffusivity in non-Newtonian fluids was slower compared to Newtonian fluids, due to the rheological and viscoelastic properties of these fluids, along with the entanglement of molecules and their interactions with the pore structure.

In conclusion, this work demonstrated the possibility of carrying out simulations of multiphase flows with the presence of a component, taking into account the viscoelastic characteristics of non-Newtonian fluids by introducing the Giesekus rheological model. Future studies intend to adapt other models to the solver and expand its application for comparisons with empirical studies involving viscoelastic fluids in industrial applications.