1 Introduction

This work presents a numerical algorithm for the system of the Navier-Stokes equations coupled with the balance of internal energy

$$\displaystyle \begin{aligned} \rho\left(\dfrac{\partial \mathbf{v}}{\partial t}+\mathbf{v}\cdot\nabla\mathbf{v}\right)=-\nabla p+\dfrac{1}{\mathrm{Re}}\nabla\cdot\left[2\mu\mathbb{D}+\lambda\left(\nabla\cdot\mathbf{v}\right)\mathbb{I}\right]+{\mathbf{f}}_{\mathbf{v}} \end{aligned} $$
(1a)
$$\displaystyle \begin{aligned} \dfrac{\partial \rho}{\partial t}+\nabla \cdot (\rho \mathbf{v})=m \end{aligned} $$
(1b)
$$\displaystyle \begin{aligned} \dfrac{\partial T}{\partial t}+\mathbf{v}\cdot\nabla T=\dfrac{1}{\mathrm{Re}\,\mathrm{Pr}}\nabla\cdot\left(\kappa\nabla T\right)+f_T\,, \end{aligned} $$
(1c)

where \(\mathbf {v}=\left [u, v, w\right ]^{\mathrm {T}}\) is the velocity vector (by setting w = const. = 0 we restrict to 2D problem), p is a variable related to the thermodynamic pressure,Footnote 1 T denotes the temperature, \(\mathbb {D}=\frac {1}{2}\left [\nabla \mathbf {v}+\left (\nabla \mathbf {v}\right )^{\mathrm {T}}\right ]\) is the symmetric part of the rate of strain tensor, constant Re is the Reynolds number and constant Pr is the Prandtl number (for sake of simplicity we set Re = Pr = 1 for the testing on exact solution).

The fluid is expected to be (calorically) perfect,Footnote 2 Newtonian,Footnote 3 whose heat flux obeys the Fourier law.Footnote 4 In system (1), we consider those fluids, which become nonhomogeneous in variable temperature fields due to temperature dependence of its material parameters, namely the density ρ = ρ(T), dynamic viscosity μ = μ(T) and thermal conductivity κ = κ(T).

Instead of (1a), we solve

$$\displaystyle \begin{aligned} \rho\left(\dfrac{\partial \mathbf{v}}{\partial t}+\mathbf{v}\cdot\nabla\mathbf{v}\right)=-\nabla \tilde{p}+\dfrac{1}{\mathrm{Re}}\nabla\cdot\left[2\mu\mathbb{D}-\dfrac{2}{3}\mu\left(\nabla\cdot\mathbf{v}\right)\mathbb{I}\right]+{\mathbf{f}}_{\mathbf{v}}\,, \end{aligned} $$
(2)

where \(\tilde {p}=p-\mu _b\nabla \cdot \mathbf {v}\) is mean or mechanical pressure, while \(\mu _b=\lambda +\frac {2}{3}\mu \) is the bulk viscosity. Equation (2) has the same structure as (1a) while setting \(\lambda =-\frac {2}{3}\mu \) (or equivalently μ b = 0, c.f. Stokes hypothesis), but physical interpretation of pressure changes.

Without loss of generality, solving (2) instead of (1a), we avoid specification of the second viscosity coefficient λ.

The forcing terms f v , f T, may represent action of volumetric forces, e.g. gravity or viscous heating, but m is set zero in most of realistic situations. In case of testing of our algorithm on a given solution [v e, p e, T e]T, we construct the forcing terms such, that Eqs. (2), (1b) and (1c) are satisfied.

Our computational scheme is developed for simulations based on the spectral/hp element approximation in spatial coordinates. We use the polynomial approximations of degree 15 in our tests, what eliminates the numerical error in spatial coordinates and we are getting an overview of error production, which belongs directly to the algorithm/discretisation in time. The high order spatial approximations also naturally include approximations of higher-order derivatives, what is utilized in the scheme.

The previous results from literature are, up to the authors knowledge, restrictions of (1) setting at least one of the material parameters constant, the velocity field to be divergence-free or modelling a stationary flow, see Table 1.

Table 1 Chosen results concerning equation systems with variable material parameters

2 Algorithm

Our approach is inspired by the velocity-correction scheme with the high order pressure boundary condition (HOPBC) proposed for the incompressible Navier-Stokes equations in [7]. The constant property case, [7], is widely used for its efficiency and was already extended to problems with variable viscosity in [6]. Its modification was used also to the incompressible Navier-Stokes-Fourier system with temperature dependent viscosity and thermal conductivity in [10]. Efficiency of the approach comes from the implicit-explicit (IMEX) formulation, which allows decoupling of the system.

The main contribution of the present work, which is a continuation of [10], is in extension to the problems with temperature dependent density. However, the velocity divergence cannot be further neglected in the momentum balance, what is the substantial difference from the previously discussed models and algorithms.

2.1 Decoupled System

We use the IMEX scheme in which the Backward difference formula (BDF) of order Q approximates the temporal derivative and a consistent extrapolation is applied to chosen terms (\(\mathcal {N}\))

(3)

In (3), u is the searched solution, \(\mathcal {L}\) denotes the terms solved implicitly, which we expect to be constant in time. Subscript n + 1 (or operator in square brackets with subscript) denotes evaluation at time t n+1 = t 0 + (n + 1) Δt, where Δt is the discrete time step. Coefficients \(\{\alpha _q\}_{q=0}^{Q-1}\), \(\{\beta _q\}_{q=0}^{Q-1}\) and γ for particular Q can be found, e.g., in [10]. Henceforward, we use ‘∗’ in the superscript to denote extrapolation, \(\mathcal {N}^*\equiv \left [\mathcal {N}\right ]^*:=\sum _{q=0}^{Q-1}\beta _q\mathcal {N}_{n-q}\).

The extrapolated terms are evaluated using data from previous time steps, \(\{\mathcal {N}_{n-q}\}_{q=0}^{Q-1}\) and \(\{u_{n-q}\}_{q=0}^{Q-1}\), what allows separate/decoupled solution of the (generalized) Navier-Stokes equations (2)–(1b) and the non-linear energy equation (1c).

Solution during one time step may be summarized to the scheme

  1. 1.

    Update μ, κ, ρ, ∇⋅v, and HOPBC using already known values \(\{{\mathbf {v}}_{n-q}\}_{q=0}^{Q-1}\), \(\{T_{n-q}\}_{q=0}^{Q-1}\).

  2. 2.

    Solve the system of momentum and mass balance

    1. (a)

      Solve the pressure-Poisson equation for \(\tilde {p}_{n+1}\)

    2. (b)

      Solve velocity-correction for v n+1

  3. 3.

    Solve the non-linear advection-diffusion problem for T n+1.

2.2 Balance of Momentum and Mass

The scheme decouples solution of the Navier-Stokes system (2)–(1b) to the pressure-Poisson equation and an elliptic equation for velocity. The equation for pressure is derived as a projection to the irrotational space by application of the divergence operator to (2)

$$\displaystyle \begin{aligned} \begin{aligned} \nabla^2 p=&\dfrac{\gamma}{\Delta t}\left(\left[\dfrac{\partial \rho}{\partial t}\right]^{**}-m_{n+1}\right)-\dfrac{1}{\mathrm{Re}}\left[\nabla \mu\cdot(\nabla\times\nabla\times\mathbf{v})\right]^*\\ &+\nabla\cdot\left\lbrace\dfrac{1}{\Delta t}\rho^*\hat{\mathbf{v}}\right. +\dfrac{1}{\mathrm{Re}}\left[\nabla\mu\cdot\left(\nabla\mathbf{v} +(\nabla\mathbf{v})^{\mathrm{T}}\right)\right]^*\\ &\quad \quad \quad \left.+\dfrac{1}{\mathrm{Re}}\left(-\dfrac{2}{3}[\nabla\mu]^*[\nabla\cdot\mathbf{v}]_{n+1}+\dfrac{4}{3}\mu^*\nabla[\nabla\cdot\mathbf{v}]_{n+1}\right)+{\mathbf{f}}_{n+1}\right\rbrace \end{aligned}\,, \end{aligned} $$
(4)

where we applied (1b), identities ∇×∇×v = ∇∇⋅v −∇2 v and ∇⋅∇×≡ 0, v∂t was substituted by BDF and \(\hat {\mathbf {v}}=\sum _{q=0}^{Q-1}\alpha _q{\mathbf {v}}_{n-q}-\Delta t\left [\mathbf {v}\cdot \nabla \mathbf {v}\right ]^*\). The temporal derivative of the density, which is extrapolated in (4), is approximated by Q-th order BDF

$$\displaystyle \begin{aligned} \left[\dfrac{\partial \rho}{\partial t}\right]_{n}\approx \dfrac{\gamma\rho_{n}-\sum_{q=0}^{Q-1}\alpha_q\rho_{n-1-q}}{\Delta t}\,. \end{aligned} $$
(5)

We denote the extrapolation of the derivative approximation by superscript ‘∗∗’. Note, that we have to specify the initial value \(\left [\frac {\partial \rho }{\partial t}\right ]_0\) or both ρ 0, ρ −1 to initialise the scheme of the lowest order Q = 1.

Our model assumes, that the density is entirely determined by the temperature distribution. Then, the divergence of velocity, whose forward estimate, \(\left [\nabla \cdot \mathbf {v}\right ]_{n+1}\), is required in (4), follows from (1b)

$$\displaystyle \begin{aligned} \left[\nabla\cdot\mathbf{v}\right]_{n+1}\approx\dfrac{1}{\rho^*}\left\lbrace m_{n+1}-\left[\mathbf{v}\cdot\nabla\rho\right]^*-\left[\dfrac{\partial \rho}{\partial t}\right]^{**}\right\rbrace\,. \end{aligned} $$
(6)

The forward estimate of velocity divergence is the crucial step in the proposed scheme.

HOPBC is the natural boundary condition for (4). It is derived as projection of the momentum equation (2) to the direction of normal n to the domain boundary  Ω

$$\displaystyle \begin{aligned} \begin{aligned} \dfrac{\partial \tilde{p}}{\partial \mathbf{n}}=\mathbf{n}\cdot&\left\lbrace-\rho^*\left[\dfrac{\partial \mathbf{v}}{\partial t}\right]^{**}+\left[-\rho\mathbf{v}\cdot\nabla\mathbf{v}+\dfrac{1}{\mathrm{Re}}\left(-\mu\nabla\times\nabla\times\mathbf{v}+\nabla\mu\cdot\left[\nabla\mathbf{v} +(\nabla\mathbf{v})^{\mathrm{T}}\right]\right)\right]^*\right.\\ &\qquad \quad \;\:\:\left.+\dfrac{1}{\mathrm{Re}}\left(-\dfrac{2}{3}\left[\nabla\mu\right]^*\left[\nabla\cdot\mathbf{v}\right]_{n+1}+\dfrac{4}{3}\mu^*\nabla\left[\nabla\cdot\mathbf{v}\right]_{n+1}\right)+{\mathbf{f}}_{n+1}\right\rbrace \end{aligned} \end{aligned} $$
(7)

The forward estimate of velocity divergence follows from (6) again. Similarly to (4), we approximate the acceleration term \(\frac {\partial \mathbf {v}}{\partial t}\) by the BDF of Q-th order, whose initialisation requires value \(\left [\frac {\partial \mathbf {v}}{\partial t}\right ]_0\) or both the values v 0 and v −1. The problem of initialisation of \(\left [\frac {\partial \mathbf {v}}{\partial t}\right ]^{**}\) and \(\left [\frac {\partial \rho }{\partial t}\right ]^{**}\) is circumvented in many realistic simulations, which begin from a constant fields.

The solution of (4) gives estimate/prediction of \(\tilde {p}_{n+1}\) and we can solve (2) as an elliptic problem for v n+1. However, in the case of temperature dependent viscosity and density, the algebraic system derived for operators with variable coefficients has time dependent matrices, whose direct solution is inefficient. To preserve efficiency of the scheme, we split such operators to the time independent part, which is solved implicitly using a direct method and a variable part, which is extrapolated together with the non-linear terms. We introduce material properties in form

$$\displaystyle \begin{aligned} \mu=\mu(T)=\bar{\mu}+\mu_i,\quad \kappa=\kappa(T)=\bar{\kappa}+\kappa_i\,,\quad \dfrac{1}{\rho(T)}=\overline{\left(\dfrac{1}{\rho}\right)}+\left(\dfrac{1}{\rho}\right)_i \end{aligned} $$
(8)

where \(\bar {\mu }\) and \(\bar {\kappa }\) are time-independent, while μ i = μ i(x, t) and κ i = κ i(x, t). The variable density ρ = ρ(T) acts in our scheme as an inverse value, c.f. (10), so the splitting is done accordingly.

To demonstrate the splitting, we consider the second order operator with variable viscosity and density

$$\displaystyle \begin{aligned} \dfrac{1}{\rho(T)}\nabla\cdot\left[\mu(T)\left(\nabla \mathbf{v}\right)^{\mathrm{T}}\right]&=\overline{\left(\dfrac{1}{\rho}\right)}\nabla\cdot\left[\bar{\mu}\left(\nabla \mathbf{v}\right)^{\mathrm{T}}\right] +\left(\dfrac{1}{\rho}\right)_i\nabla\cdot\left[\bar{\mu}\left(\nabla \mathbf{v}\right)^{\mathrm{T}}\right]\\ &\quad +\dfrac{1}{\rho}\nabla\cdot\left[\mu_i\left(\nabla \mathbf{v}\right)^{\mathrm{T}}\right]\,. \end{aligned} $$
(9)

Only the term with time independent operator \(\overline {\left (\frac {1}{\rho }\right )}\nabla \cdot \left [\bar {\mu }\left (\nabla \mathbf {v}\right )^{\mathrm {T}}\right ]\) is solved implicitly, while we apply extrapolation to terms containing variable parameters \(\left (\frac {1}{\rho }\right )_i\) and μ i. This approach is valid for \(\bar {\mu }=\bar {\mu }(\mathbf {x})\), \(\bar {\kappa }=\bar {\kappa }(\mathbf {x})\), resp. \(\overline {\left (\frac {1}{\rho }\right )}=\overline {\left (\frac {1}{\rho }\right )}(\mathbf {x})\), but if \(\bar {\mu }\) is constant in space, the constant operator simplifies to \(\overline {\left (\frac {\mu }{\rho }\right )}\nabla ^2 \mathbf {v}\) (resp. ∇2 v if the properties are normalized to \(\bar {\mu }=\bar {\kappa }=\bar {\rho }=1\), what is the case of (1), the balance equations in form independent of physical units).

The final form of the equation for velocity becomes

$$\displaystyle \begin{aligned} \begin{aligned} \nabla^2{\mathbf{v}}_{n+1}-\dfrac{\gamma}{\Delta t}\dfrac{\bar{\rho}}{\bar{\mu}}&\mathrm{Re}{\mathbf{v}}_{n+1}=\\ &\dfrac{\bar{\rho}}{\bar{\mu}}\left\lbrace-\mathrm{Re}\dfrac{\gamma}{\Delta t}\hat{\mathbf{v}}+\dfrac{1}{\rho^*}\left[\mathrm{Re}(\nabla \tilde{p}_{n+1}-{\mathbf{f}}_{n+1})-\left[\nabla\mu\cdot[\nabla\mathbf{v}+(\nabla\mathbf{v})^{\mathrm{T}}]\right]^*\right.\right.\\ &\qquad \qquad \qquad \qquad \quad +\left.\left.\dfrac{2}{3}[\nabla\mu]^*[\nabla\cdot\mathbf{v}]_{n+1}-\dfrac{1}{3}\mu^*\nabla[\nabla\cdot\mathbf{v}]_{n+1}\right]\right\rbrace \\&-\left(\nabla[\nabla\cdot\mathbf{v}]_{n+1}-[\nabla\times\nabla\times\mathbf{v}]^*\right)\left[\dfrac{\bar{\rho}}{\bar{\mu}}\left(\dfrac{1}{\rho^*}\right)_i\mu^*+\dfrac{1}{\bar{\mu}}\mu^*_i\right] \end{aligned}\,. \end{aligned} $$
(10)

2.3 Balance of Energy

The energy equation with temperature dependent thermal conductivity is strongly non-linear. We split the diffusion operator to the time independent and the variable part, following the technique shown for the velocity-correction (10). We set \(\bar {\kappa }=1\) for simplicity and the discretized energy equation (1c) gets form

$$\displaystyle \begin{aligned} \nabla^2 T_{n+1}-\dfrac{\gamma \mbox{Re Pr}}{\Delta t}T_{n+1}=\mathrm{RePr}\left(-\dfrac{\hat{T}}{\Delta t}-{f_T}_{n+1}\right)-\left[\nabla\cdot\kappa_i\nabla T\right]^*\,, \end{aligned} $$
(11)

where \(\hat {T}=\sum _{q=0}^{Q-1}\alpha _q T_{n-q}-\Delta t\left [\mathbf {v}\cdot \nabla T\right ]^*\). Operator \(\left (\nabla ^2-\frac {\gamma \mbox{Re Pr}}{\Delta t}\right )\) is time independent and allow inversion using a direct method, what results in good performance in computations on long time intervals.

3 Temporal Convergence on Manufactured Solution and Application

Our convergence tests are based on the method of manufactured solutions, alternative to estimates of numerical analysis on simplified system. This approach lacks generality, because we always restrict to particular data and some representative of the solution space, but we get rough convergence estimate for unrestricted equation system (1), while proving also the correctness of method implementation.

As an exact solution, we take a smooth functions \({\mathbf {v}}_e: \Omega \times (0:T)\rightarrow \mathbb {R}^n\), \(\tilde {p}_e:\Omega \times (0:T)\rightarrow \mathbb {R}\), \(T_e:\Omega \times (0:T)\rightarrow \mathbb {R}\)

$$\displaystyle \begin{aligned} \left(\begin{array}{c} {\mathbf{v}}_e\\ \tilde{p}_e\\ T_e \end{array}\right)=\left(\begin{array}{c} u_e\\ v_e\\ \tilde{p}_e\\ T_e \end{array}\right)=\left(\begin{array}{c} 2\,\mathrm{cos}(\pi x)\, \mathrm{cos}(\pi y)\, \mathrm{sin} (t)\\ \mathrm{sin}(\pi x)\, \mathrm{sin}(\pi y)\,\mathrm{sin}(t)\\ 2\,\mathrm{sin}(\pi x)\,\mathrm{sin}(\pi y)\,\mathrm{cos}(t)\\ \mathrm{sin(x)}\mathrm{sin}(y) \mathrm{cos}(t) \end{array}\right) \end{aligned} $$
(12)

and derive the forcing terms f v, m and f T such, that Eqs. (2), (1b), (1c) are fulfilled (in all cases we set Re = Pr = 1). Divergence of velocity in (12) is ∇⋅v e = −πsin(πx)cos(πy)sin(t), variable in both the spatial and temporal coordinates and with amplitude comparable with the solution itself. We choose a computational domain Ω = [0:2] × [0.5:2.5] consisting of two elements Ω = [0:1] × [0.5:2.5] ∪ [1:2] × [0.5:2.5]. Extent of Ω and form of the exact solution, is inspired by [3], where the velocity-correction scheme of [7] was tested on a similar, manufactured solution.

The incompressible Navier-Stokes equations define the pressure up to a constant value and only the boundary condition for velocity is needed. In this sense, we set the Dirichlet boundary condition for velocity on whole  Ω. However, the pressure-Poisson equation (4) requires setting a boundary condition as a consequence of the decoupling. We set HOPBC (7) at  Ω and solve the fully Neumann problem, which defines the solution up to a constant value, which we set by fixing the solution to zero in one of the grid points. The boundary condition for pressure is an artificial element of the computational scheme and its existence is related to the splitting error. The boundary condition for energy equation (11) is of Dirichlet type for whole  Ω.

We present the first and second order schemes in time in the convergence tests. The technique is applicable to higher-order schemes as well. A multi step schemes use data from multiple time steps, what complicates its initialisation. We apply the first order BDF method for initialisation of the second order scheme. The first order scheme needs data of only one backward time step, but the time step must be appropriately shortened.

As mentioned already, the acceleration in HOPBC (7) and the term \(\frac {\partial \rho }{\partial t}\) in (4) require an initial value or one other backward value for proper initialisation also in case of the first order scheme, what is in contradiction to standard initial conditions for system (1), which require only the initial values. However, setting the correct values for calculation of the first time step is crucial for the final accuracy of the solution.

Finally, we trace appropriate norms of difference between the exact and computed solutions on a set of computations with time steps \(\Delta t=\Delta \tilde {t}/2^n, \Delta \tilde {t}=0.2, n=0, \ldots , 9\) for t ∈ [0: 1].

We use the power laws for approximation of dependence of material parameters on temperature

$$\displaystyle \begin{aligned} \begin{aligned} \mu(T)=(\alpha_m T+1.0)^{\beta_m}\,,\quad \ \kappa(T)=(\alpha_k T+1.0)^{\beta_k}\,,\quad \rho(T)=(\alpha_r T+1.0)^{\beta_r}\,. \end{aligned} \end{aligned} $$
(13)

The temporal convergence of the above scheme for α m = α k = α r = 0.1 , β m = β k = β r = 2 is shown in Fig. 1.

Fig. 1
figure 1

The temporal convergence for the Navier-Stokes-Fourier system with temperature dependent material properties. The number of steps in BDF Q = 1 or Q = 2, is denoted by subscripts I1 and I2. The label “Errors” refers to \(||a-a_e||{ }_{L_\infty }\), where a is the computed function and a e the exact value from (12), at t = 1

Fig. 2
figure 2

Frequency of the vortex shedding (Strouhal no. “St”) as dependent on the normalized wall temperature \(T_W^*\) in the flow around heated cylinder (Re ≈ 121.2). Comparison of the data from [10] (ρ = const.) “const.”, the present scheme with Q = 1 “ρ(T)”, experimental data of [15] “exp.” and empirical formula “emp.”[8]

A detail view of error production, Fig. 3, shows, that the dominant error production arises at the grid point, which was used to set the unknown constant for the Neumann problem.

The scheme was successfully applied in a 2D simulation of flow around the heated cylinder and the results were compared with experimental data [15], where the dependence of the vortex shedding frequency (Strouhal number St) on the wall temperature of the cylinder, T W, was observed. Figure 2 shows the substantial difference in results between the model neglecting the thermal expansion, [10], and the present one (Figs. 3 and 4).

Fig. 3
figure 3

Test on manufactured solution: difference v_err = v e − v at the final time t = 1 for computation with Q = 2, Δt = 0.2∕27, c.f. Fig. 1. Polynomial approximation of degree 15

Fig. 4
figure 4

Computed field of divergence, div(v) = ∇⋅v, caused by the thermal expansion in the flow around heated cylinder (Re = 121.2, T WT  = 1.494), c.f. Fig. 2

4 Conclusion

The numerical scheme proposed for the Navier-Stokes-Fourier system with variable parameters allows to solve the highly complex mathematical model, which has an impact to understanding the processes connected with the heat exchange, transport and energy storage in fluids.

The computational scheme for a fluid flows influenced by temperature as modelled by system (2), (1b), (1c) was developed and tested. The scheme was primarily constructed for spatial discretisations based on spectral/hp finite elements and presented results were obtained after implementation to the Nektar++ framework [2], modified version 3.3.

We did not impose restrictions to the type of functional dependency of the material parameters on temperature. Graph of error convergence in L norm, Fig. 1, results from testing on a manufactured solution and shows a good convergence properties of the scheme, what is promising for applications.

Considered model neglects compressibility in the sense of direct dependence of density on pressure, but the velocity field is not divergence free as a consequence of the thermal expansion. A forward estimate of velocity divergence is needed in the proposed scheme and its successful approximation is one of the main contributions presented in this work. For these reasons, the scheme is unique among numerical schemes based on the finite element approximations in space.

Proposed scheme is an extension of the efficient semi-implicit solver for Incompressible Navier-Stokes system [7] and it is suitable for a fast and highly accurate simulations of problems on long time intervals. The present results inspire implementation of high order BDF schemes and extension of the solver to 3 spatial coordinates.

Derivation of the scheme includes a number of sub-steps, whose detail description is beyond the scope of this article and will be published separately, together with extension of the scheme for energy equation with variable density and further testing of performance as dependent on various physical parameters in the equations.

Also the results from application of the scheme to computations of a physically realistic problem and comparison of its results with experimental data exhibit a good coincidence and will be presented with detail description in a separate article.