An energy-conservative DG-FEM approach for solid–liquid phase change

Abstract We present a discontinuous Galerkin method for melting/solidification problems based on the “linearized enthalpy approach,” which is derived from the conservative form of the energy transport equation and does not depend on the use of a so-called mushy zone. We use the symmetric interior penalty method and the Lax–Friedrichs flux to discretize diffusive and convective terms, respectively. Time is discretized with a second-order implicit backward differentiation formula, and two outer iterations with second-order extrapolation predictors are used for the coupling of the momentum and energy. The numerical method was validated with three different benchmark cases, i.e., the one-dimensional Stefan problem, octadecane melting in a square cavity and gallium melting in a rectangular cavity. The performance of the method was quantified based on the L 2 norm error and the number of iterations needed to convergence the energy equation at each time step. For all three validation cases, a mesh convergence rate of approximately O(h) was obtained, which is below the expected accuracy of the numerical method. Only for the gallium melting case, the use of a higher-order method proved to be beneficial. The results from the present numerical campaign demonstrate the promise of the discontinuous Galerkin finite element method for modeling certain solid–liquid phase change problems where large gradients in the flow field are present or the phase change is highly localized, however, further enhancement of the method is needed to fully benefit from the use of a higher-order numerical method when solving solid–liquid phase change problems.

Whilst many different approaches exist to modeling melting and solidification problems (such as transformed grid approach [20,21], the level-set method [22][23][24][25], and the phase field method [26][27][28][29][30][31]), we chose to restrict ourselves to implicit fixed grid approaches.Here, "implicit fixed grid" refers to the solution of the melting/solidification problem on a single fixed domain where the solid-liquid interface is tracked implicitly, i.e., the interface position is inferred from the enthalpy or temperature field at the current time step, instead of being obtained by solving a separate equation.This approach has the advantage of being applicable to a wide range of melting and solidification problems, not requiring mesh deformation, coordinate transformation, or grid generation and not having to calculate interface curvatures, impose boundary conditions at the interface or having to deal with complex thermodynamic derivations.For this reason, the implicit fixed grid approach has been the most popular choice for modeling macroscale phase change phenomena in industrial applications.
The most widely used implicit fixed grid methods are the apparent heat capacity method, which accounts for the latent heat release through a modified form of the heat capacity around the melting point [32][33][34], and the source-based enthalpy approach [35][36][37] where the latent heat release is captured through a source term.The tradeoff between these two methods is speed versus robustness.Whilst the apparent heat capacity method is fast, a naive implementation of the method (such as using too large time steps, a too-small mushy zone or a too-fine mesh without the proper precautions) may lead to an incorrect amount of the latent heat being released, and therefore, a deteriorated solution quality [38].Conversely, the source-based enthalpy approach requires an iterative procedure and may be slow to converge.
To overcome these deficiencies, the "linearized enthalpy approach" (also referred to as "a generalized enthalpy approach" or "an optimum approach") has been developed [39][40][41][42][43].With   thermal expansion coefficient, K -1 k thermal conductivity, W m -1 K l dynamic viscosity, Pa s q density, kg m -3 c p specific heat, J kg -1 K -1 L latent heat of fusion, kJ kg -1  the volumetric enthalpy is linearized around the latest temperature values and the energy equation is iterated until convergence has been reached.Compared to the source-based approach, the "linearized enthalpy approach" requires significantly less nonlinear iterations to converge the energy equation [42].Unlike the apparent heat capacity method or the source-based approach, the "linearized enthalpy approach" used in this work is based on the conservative form of the energy transport equation and the conservation of thermal energy is verified through the imposed convergence criterion.Finally, the "linearized enthalpy approach" does not depend on the use of a so-called "mushy zone," eliminating the energy error arising from the smearing of the latent heat peak.An important drawback of implicit fixed grid methods is their relatively low accuracy in capturing the melting or solidification front.This is mainly due to the difficulty of resolving the discontinuity in the enthalpy and temperature solutions within the cell, leading to a maximum mesh convergence rate of O(h) [44][45][46].Therefore, a very fine mesh may be needed to obtain grid-independent results [20,21,47].To improve the computational efficiency of the implicit fixed grid approach for modeling melting and solidification problems, recent studies have investigated the use of finite elements with adaptive mesh refinement algorithms [48,49], using extended finite element methods [24,50,51] or using discontinuous Galerkin finite element methods (DG-FEM) [52][53][54][55] for solving solid-liquid phase change problems, which is the focus of the present work.
Discontinuous Galerkin methods have gained interest over the last decade as an attractive numerical method for computational fluid dynamics, due to its combination of desired features of both the finite volume (FVM) and finite element (FEM) methods, such as local conservation, the possibility for upwinding, an arbitrarily high order of discretization and high geometric flexibility [56][57][58].In addition, the high locality of the numerical scheme makes the discontinuous Galerkin method efficient for parallelization [58].Recent advances in the applicability of DG-FEM methods to computational fluid dynamics include the simulation of turbulent flow with a high-order discontinuous Galerkin method and RANS or LES turbulence modeling [59][60][61][62][63], the development of discontinuous Galerkin methods for low-Mach number flow [64,65], the simulation of multiphase flows [66,67] and a DG-FEM multiphysics solver for simulating the Molten Salt Fast Reactor [58].When coupled to a melting and solidification model, DG-FEM is expected to offer a more reliable capture of nonlinear phase change phenomena as compared to the finitevolume method [52].Indeed, Schroeder and Lube [53] obtained qualitatively similar results on a mesh that was 14 times coarser as compared to the mesh used in a similar finite volume numerical benchmark study [47].For these reasons, DG-FEM is an attractive numerical method for modeling solid-liquid phase change problems.
The present work introduces the Symmetric Interior Penalty -Discontinuous Galerkin (SIP-DG) discretization of the "linearized enthalpy approach" with the aim of developing an accurate and computationally efficient numerical method for modeling melting and solidification.Previous investigations employing the DG-FEM method to simulate melting and/or solidification problems used the apparent heat capacity method [52,55] or the source-based enthalpy approach [53] for modeling the phase transition.To the best of our knowledge, this is the first time the "linearized enthalpy" approach has been implemented in a DG-FEM framework.An important novelty here is the imposition of thermal energy conservation through the convergence criterion.Furthermore, the present approach is thoroughly validated through comparison against three different benchmark cases (i.e., the one-dimensional Stefan problem, octadecane melting in a square enclosure and gallium melting in a rectangular enclosure).Finally, the performance of the discontinuous Galerkin with "linearized enthalpy approach" method is quantified by calculating and comparing mesh convergence rates for two different element orders.
The rest of this article is organized as follows.Section 2 presents the governing equations and the boundary conditions that close them.Section 3 introduces the semi-discrete variational formulation with the discontinuous Galerkin method.Section 4 describes the temporal discretization scheme, with special attention devoted to the time-integration of the nonlinear energy transport equation and the coupling of the energy and momentum transport equations.The results from the three benchmark cases and accompanying numerical performance metrics are presented in Section 5. Finally, the conclusions and recommendations for future work based on the obtained results are given in Section 6.

Governing equations
We consider the energy and the momentum transport equations in conservative form and use the volumetric enthalpy as the main variable.As such, the energy transport equation is written as where H is the volumetric enthalpy, u is the velocity, k is the thermal conductivity, and T is the temperature.
The energy transport equation contains two unknowns, the volumetric enthalpy in the accumulation and the convection terms and the temperature in the diffusion term, coupled through the enthalpy-temperature relationship.For most heat transfer problems, the enthalpy-temperature relationship is smooth and the temperature gradient in the diffusion term may be expressed in terms of the enthalpy (rT ¼ 1 qc p rH) with q being the density and c p the specific heat capacity, hereby eliminating the temperature as the unknown and resulting in a linear energy transport equation that may be solved by standard solution methods.However, for solid-liquid phase change problems, the enthalpy-temperature relationship is nonsmooth resulting in a nonlinear energy transport equation.For this reason, dedicated numerical methods are needed for modeling solid-liquid phase change.
Figure 1 depicts the enthalpy-temperature relationship for isothermal solid-liquid phase change.For temperatures below the melting point (T < T m ), the enthalpy temperature derivative is equal to dH dT ¼ q s c p, s : For temperatures above the melting point (T > T m ), the enthalpy temperature derivative is equal to dH dT ¼ q l c p, l : Here, the subscripts "s" and "l" refer to the solid and liquid Here, q is the density, c p is the specific heat capacity, L is the latent heat and the subscripts "l" and "s" refer to the liquid and the solid phases, respectively.
phase, respectively.At the melting point, the volumetric enthalpy has a jump discontinuity with a magnitude of q l L where L is the latent heat and q l L is the energy required for a unit volume of solid at the melting temperature to be transformed into liquid.Assuming constant thermophysical properties in each phase, and neglecting the volume expansion effect as a consequence of the difference in densities between the solid and the liquid, the enthalpy-temperature relationship is written as a piece-wise continuous function: Following the recommendation of Ref. [68], who experienced numerical instabilities when using the convection of the total enthalpy coupled to their implementation of the "linearized enthalpy approach," we use a "sensible enthalpy only" formulation for the convection term.Theory predicts that for isothermal solid-liquid phase change, under the condition that no solid-settling occurs and possible volume expansion effects due to different solid and liquid densities are neglected, the velocity at the solid-liquid interface is equal to zero, and therefore, the convection of the latent heat is also equal to zero [37].In practice, however, the finite element approximation of the volumetric enthalpy by piece-wise continuous functions will lead to an inevitable smearing of the latent heat peak within an element and the convection of the latent heat will no longer be zero after the finite element discretization.This "false numerical convection of latent heat" may result in poor convergence and deteriorated quality of results.Following the rational of the source-based approach [37], the convection of the total enthalpy is split into a sensible and a latent heat contribution: r Á ðuH tot Þ ¼ r Á ðuH sens Þ þ r Á ðuaLÞ: Here, a is the liquid fraction (not to be confused with the thermal diffusivity), defined as Since the latent heat contribution is considered equal to zero, only the sensible contribution remains.The sensible contribution is expressed in terms of the temperature: r Á ðuH sens Þ ¼ q l c p, l r Á ðuTÞ: The "sensible enthalpy only" formulation of the energy transport equation is thus written as For the momentum equation, we consider incompressible flow and a Newtonian fluid with constant viscosity, and use the Boussinesq approximation to model the effect of buoyancy.The Darcy source term approach is used to enforce the no-slip condition at the solid-liquid interface position.This approach is most commonly used and has demonstrated better performance compared to other approaches such as the switch-off and variable viscosity techniques [12,36].The momentum equation, thus, reads The large parameter C > 0 in the Darcy source term is responsible for the attenuation of the velocity in the solid phase.b > 0 is a small parameter to prevent division by zero when the liquid fraction a becomes equal to zero.
Finally, the continuity equation for incompressible flow reads To close the system of coupled volumetric enthalpy transport and momentum transport equations, a set of boundary conditions and initial conditions are supplied.In the present work, the boundary @X is decomposed into two pairwise disjoint sets C D and C N such that @X ¼ C D [ C N : On the Dirichlet boundary C D the temperature is given, i.e., T ¼ T D , whereas on the Neumann boundary C N the heat flux is specified, i.e., krT Á n ¼ q: Here, n is the outward unit normal vector of @X: The no-slip condition u ¼ 0 is imposed on the entire boundary @X: Initially, the temperature in the whole domain X is known, and the fluid is at rest, i.e., u ¼ 0 and p ¼ 0 at t ¼ 0.

Spatial discretization
This section describes the spatial discretization of the volumetric enthalpy and the mass flux transport equations with the discontinuous Galerkin finite element method.First, we introduce the basic definitions required for writing the variational formulation.Let X be the computational domain and C ¼ C D [ C N its boundary.The domain is meshed into a set of nonoverlapping elements T h , with F i , F D , and F N being the set of interior, Dirichlet and Neumann boundary faces, respectively.For each element T 2 T h we assign a set of faces F T , and for each face F we assign a set of neighboring elements T F h : All faces F 2 F i [ F D [ F N are assigned a unit normal vector n F , which has an arbitrary but fixed direction for all interior faces and coincides with the unit outward normal vector n for the boundary faces.
We use a hierarchical set of orthogonal modal basis functions (normalized Legendre polynomials to be specific) to approximate the unknown variables on T h : The solution space within each element is the span of all polynomials up to an order P and is written as where / is a generic unknown variable and / h represents its FEM approximation.The basis functions are continuous within each element, but discontinuous at the interface between two neighboring elements.As such, the trace of / h on the interior faces F i is not unique, and we need to define the average and the jump operator, these are Here, for any point r on an interior face F 2 F i , the function traces / þ h and / À h are defined as

Variational formulation
The semi-discrete variational formulation of the coupled system of transport equations is obtained by replacing the mass flux, pressure, volumetric enthalpy, and temperature with their DG-FEM approximations (m h , p h , H h , T h ), by multiplying Eqs. ( 4)-( 6) with the test functions v h 2 V d h, m , q h 2 V h, p , and w h 2 V h, T, H , respectively, and subsequently integrating over the whole domain.Note that the superscript d denotes the dimensionality of the vector space to which the DG-FEM approximation of the mass flux belongs.To close the system of equations, the enthalpy-temperature coupling needs to be included.With these considerations, the semi-discrete variational formulation reads By solving the variational formulation of the coupled system of transport equations, the numerical mass-flux m h , the pressure p h , the volumetric enthalpy H h , and the temperature T h are obtained.As opposed to the source-based enthalpy approach employed by Ref. [53], the present variational formulation follows directly from the conservative form of the transport equations.In addition, the present formulation does not depend on the use of an artificial smearing of the latent heat peak through the introduction of a so-called mushy-zone, and directly preserves the enthalpy-temperature coupling through inclusion in the system of equations.The nonlinear coupling between the enthalpy and the temperature does not allow for a straightforward solution of the discretized energy transport equation.Therefore, we chose an iterative solution method for the energy equation, based on the work of Refs.[39,40,42].The iterative solution of the energy equation is described in more detail in Subsection 4.1.
In the present work, a mixed-order discretization for the mass-flux and the enthalpy, temperature, and pressure was used (i.e., P p, H, T ¼ P m À 1).The mixed-order formulation for the massflux and pressure (i.e., P p, T ¼ P m À 1) is inf-sup stable and therefore no pressure stabilization terms are needed in the discretized continuity equation [58,69] as opposed to using an equalorder formulation.In addition, it has been shown that the solution space of a transported scalar quantity (in the present work, the enthalpy and the temperature) must be a subset of the solution space of the pressure [58,65].The reason is that the continuity equation is weighted by the pressure basis functions (see Eq. ( 9)), and therefore, the convective discretization in the scalar transport equation can only be consistent up to order P p : For this reason, we selected P H, T ¼ P p ), resulting in the final mixed-order formulation P p, H, T ¼ P m À 1: We will now specify the convection, diffusion, divergence, and source term operators in the discretized momentum and continuity equations.The treatment of the convection and diffusion operators in the energy equation proceeds along the same lines.The treatment of the time-operator will be described in detail in Section 4.

Convective term
The discretization of the convective term is given by where H F is the numerical flux function defined on an internal face F 2 F i : In this work, the Lax-Friedrichs flux is used [70]: where a F is evaluated point-wise at face F through with K ¼ 2 for the momentum equation and K ¼ 1 for the energy equation.

Diffusive term
Following [58,65], we discretize the diffusive term using the Symmetric Interior Penalty (SIP) method.We limit ourselves to laminar incompressible flow and consider a Newtonian fluid with constant viscosity.For this reason, we present the standard SIP bilinear form instead of the generalization outlined in Ref. [65]: An optimum value of the penalty parameter is calculated through [71] g where cardðF T Þ represents the number of faces of element T and E P, T is a factor which takes into account the polynomial order of the finite element basis and test functions and the type of elements used: , for simplices: L T is a length scale defined as where jTj j j leb indicates the Lebesgue measure of the element, and jFj j j leb indicates the Lebesgue measure of the face, respectively.Finally, f ¼ 2 for boundary faces, and f ¼ 1 for internal faces.For the SIP discretization of the diffusive term in the energy equation, we substitute k for l q and substitute T h for m h :

Continuity terms
The discretized continuity equation consists of the following discrete divergence operator and right-hand side term [72,73]:

Source terms
The momentum equation contains two source terms, i.e., the Darcy source term responsible for the attenuation of the velocity at the solid-liquid interface and the Boussinesq approximation responsible for modeling natural convection.The Darcy source term is imposed implicitly through the bilinear operator a source ðm h , v h Þ : For the liquid fraction, a finite element approximation of the same order as the mass flux is used.To obtain the finite element approximation of the liquid fraction, the liquid fraction is calculated from the temperature at each quadrature point (see Eq. ( 3)), and the values at the quadrature points are subsequently projected onto the finite element basis.
The Boussinesq approximated is imposed explicitly through the linear right-hand side term l source ðv h , T h Þ :

Temporal discretization and numerical solution procedure
In this work, implicit time-stepping is performed using the backward differentiation formulae (BDF) [62,64,73].The time derivatives for a generic unknown quantity / and for a constant time step Dt is therefore written as where M is the order of the BDF scheme.In the present work, the second-order BDF scheme is used, with c 0 ¼ 3=2, c 1 ¼ À2, and c 2 ¼ 1=2: Special treatment is used for the temporal discretization and time-integration of the enthalpy transport equation, as is explained in Subsection 4.1.
The coupled momentum and continuity equations are solved in a segregated way using a pressure correction method (see Subsection 4.2).The full solution algorithm, including the coupling between the energy, momentum, and continuity equations, is described in Subsection 4.3.

Iterative solution of energy equation
Applying BDF2 time-integration (and assuming a constant time step), the discretized energy accumulation term is written as Inserting the discretized energy accumulation term into the variational formulation of the energy equation results in the following form: This equation is highly nonlinear in the unknown H nþ1 h , due to the discontinuous nature of the enthalpy-temperature relationship (see Eq. ( 2)) and therefore cannot be solved in a straightforward manner.Building on the work of Refs.[39,40,42], we expand the unknown H nþ1 h around the temperature: where the superscript i þ 1 refers to the new iteration, and i þ 1=2 refers to an intermediate value between two iterations.Inserting the expansion into the discretized energy equation yields the "linearized" discretized energy equation: The linearized discretized energy equation contains only the intermediate temperature as the unknown variable.Solving the linearized energy equation for the intermediate temperature may be seen as a single step in a Newton iteration.The remaining challenge is now to define a suitable approximation of the enthalpy-temperature derivative, which is undefined at the melting point.
In this work, we use the following formulation: where x is an overrelaxation factor (1.5 was used in the present work) with the sole purpose of speeding up the convergence.Upon convergence, the linearization term ð dH dT j nþ1, i ðT nþ1, iþ1=2 À T nþ1, i ÞÞ approaches zero.Therefore, for a strict enough convergence criterion, the exact form of the enthalpy-temperature derivative has a negligible effect on the result of the numerical solution, and the use of the current approximation is justified [40].Finally, we would like to mention that instead of updating the thermal conductivity at each iteration according to the latest position of the solid-liquid interface, the thermal conductivity at the newest time step is estimated using extrapolation from the previous two time steps (see Subsection 4.3) and is, therefore, kept constant during the nonlinear enthalpy-temperature iterations.
The iterative solution procedure is described by the following steps: (1) Initialize the enthalpy at the new time step H nþ1, i using the extrapolation from the previous time steps (see Eq. ( 38)).( 2) Solve the discretized linearized energy transport equation (Eq.( 27)) to obtain the solution for the intermediate temperature T nþ1, iþ1=2 h : (3) Update the volumetric enthalpy at the quadrature points applying the Taylor linearization: (4) At the quadrature points, calculate the temperature from the updated enthalpy values through the enthalpy-temperature relationship (see Eq. ( 2)): (5) Calculate the solution coefficients of the enthalpy and temperature at the latest iteration, by projecting the values at the quadrature points onto the finite element basis for each element: where wj qp are the quadrature weights and M is the mass matrix.(6) Check whether the convergence criterion (see Eq. ( 32)) is satisfied.If not, return to step 2. If yes, move to the solution of the momentum equation (see Figure 2).
Through our approach, the energy equation is solved in conservative form through a series of nonlinear enthalpy-temperature iterations, within a prescribed tolerance.The advantages of our approach for solving melting and/or solidification problems as opposed to the apparent heat capacity method or the source-based enthalpy approach are an inherent conservation of thermal energy, no dependency on use of a so-called mushy zone for smearing the latent heat peak, and a comparatively fast convergence of the energy equation per time step.

Convergence criterion
To ensure the final solution of the linearized energy transport equation corresponds to the solution of the original energy transport equation (see Eq. ( 4)), a suitable convergence criterion is defined: This convergence criterion depends on two parts.The second part is the L 2 norm of the temperature difference between the current and the previous iteration.The justification for this part of the convergence criterion is that upon convergence, the linearization term should be equal to zero (see Eq. ( 26)).In other words, the L 2 norm of the temperature difference between the current and the previous iteration should be minimized.The first part of the convergence criterion may be considered an energy conservation check.This is done by inserting the solution vectors into the original discretized energy equation (i.e., prior to linearization, see Eq. ( 9)) and selecting the zeroth-order polynomial v h ¼ 1 as test function.Therefore, all terms containing the gradients and/or jumps of the test-function are equal to zero (except for the jumps at the boundaries) and the residual may be defined as: The residual is thus a measure of the energy loss or gain after each iteration, which is a measure of how far the solution to the linearized equation is from satisfying thermal energy conservation.The residual is scaled with the total thermal energy in the system to represent a relative error.

Pressure correction method
The coupled continuity and momentum equations are solved in a segregated way, applying the following pressure correction scheme [58,65,73]: (1) Obtain a predictor for the mass flux m by solving the linear system which corresponds to the semi-discrete form (see Eq. ( 9)) Here, M is the mass matrix, N contains the implicit parts of the discrete convection and diffusion terms, D is the discrete divergence operator and f collects all the explicit terms (i.e., explicit terms from the discretization of the time derivative, boundary conditions, and source terms).The convective term is linearized by replacing the convective field u nþ1 with the predictor m nþ1, Ã q l : (2) Solve a Poisson equation to obtain the pressure-difference at the new time step where b p represents the fully discrete right-hand side of the continuity equation (see Eq. ( 20)).Subsequently, the pressure may be updated, (3) Correct the mass flux, such that it satisfies the discrete continuity equation

Full solution algorithm
The full set of discretized transport equations is solved using a one-way coupling method between the energy and the momentum equation.The algorithm to find the solution vectors m nþ1 , p nþ1 , H nþ1 , and T nþ1 at a new time step n þ 1 consists of the following steps (also see Figure 2).
1. Obtain predictors for the temperature T, enthalpy H, mass flux m, pressure p, liquid fraction a, and thermal conductivity k, using a second-order extrapolation from previous time steps: 2. Solve the discretized energy equation through a series of Newton iterations until convergence is achieved, as described in Subsection 4.1.3. Solve the coupled momentum and continuity equations using the pressure correction method described in Subsection 4.2.4. Repeat steps 3 and 4 for a number of n outer iterations.In this work, 2 outer iterations were deemed sufficient based on a sensitivity analysis.

Implementation and numerical solution
The DG-FEM formulation of the linearized enthalpy approach for simulating melting and solidification heat transfer problems was validated with three different test cases: the 1D Stefan problem, octadecane melting in a square enclosure [5] and gallium melting in a rectangular enclosure [1].The linearized enthalpy approach was implemented in the in-house DG-FEM based computational fluid dynamics solver DGFlows.A hierarchical set of orthogonal modal basis functions (normalized Legendre polynomials to be specific) was used and all integrals were evaluated with a Gaussian quadrature set with polynomial accuracy of 3P m À 1 [74,75].The meshes were generated with the open-source software tool Gmsh [76].METIS [77] is used to partition the mesh, and the MPI-based software library PETSc [78] is used to assemble and solve all linear systems with iterative Krylov methods.The pressure-Poisson system is solved with the conjugate gradient method and a block jacobi preconditioner, where the submatrix within each MPI process is preconditioned with an incomplete Cholesky decomposition.The linear systems for the linearized enthalpy and momentum equations are solved with GMRES, with a block Jacobi preconditioner and successive over-relaxation for the submatrix within each MPI process.To reduce the required computational time, the pressure matrix and its preconditioner are only assembled and computed once (since the pressure matrix is the same at each time step [58]), and the Krylov solvers are initialized with the solution predictors (see Section 4) to speed up the convergence.

Case 1: 1D Stefan problem
The one-dimensional Stefan problem was chosen for the first test case because the absence of convection and the presence of an analytical solution enabled a step-wise validation of the proposed numerical method, as well as a quantitative evaluation of the error in the numerical solution.We, thus, consider a one-dimensional rod of length l ¼ 0:05 m, with a temperature of Tðx, t ¼ 0Þ ¼ 278 K: At t > 0, the temperature at the left side is suddenly lowered below the [79] for the implementation of the solution of the 1D Stefan problem with the discontinuous Galerkin method and the linearized enthalpy approach in an inhouse Fortran code.The raw data of the 1D Stefan problem is included in a Zenodo repository [80].
melting temperature: Tð0, tÞ ¼ 268 K < T m and the right side is described by a homogeneous Neumann boundary condition, @T @x j t, L ¼ 0: The phase change material matches the thermophysical properties of water (see Table 1).The same density is used for the solid and the liquid phases, to avoid any issues regarding volume expansion and mass conservation.
The entire problem is described by one pair of heat conduction equations, i.e., one heat conduction equation for the solid phase and one for the liquid phase [35]: @T l @t ¼ a l @ 2 T l @x 2 , 0 x < sðtÞ @T s @t ¼ a s @ 2 T s @x 2 , x !sðtÞ: The displacement of the solid-liquid interface in time is described by the following two conditions, where "s" represents the solid-liquid interface: The analytical solution to the 1D Stefan problem is well known and given by Voller and Cross [35] sðtÞ where k is the solution to the following transcendental equation: The analytical solution for the temperature is given by Figure 3 shows the numerical versus the analytical solution, for both the temperature field and the solid-liquid interface position.128 equally sized linear elements and BDF2 time-integration with a time step of Dt ¼ 0:1s were used.The tolerance was set to tol ¼ 10 À6 : The numerical solid-liquid interface position was found based on H num ¼ q s c p, s T m þ 0:5q l L: For the temperature field, excellent agreement with the analytical results was observed and it is nearly impossible to distinguish the numerical and analytical solutions by eye.Conversely, although the overall agreement with the analytical solution is good, the numerical solution for the solid-liquid interface position "jumps" in time.This is due to the numerical solid-liquid interface being localized at one of the element edges, until the enthalpy has jumped past the latent heat peak.The "timejumping" of the numerical solid-liquid interface position is therefore inherent to the discontinuous Galerkin finite element discretization.
In Figure 4, the L 2 norm of the error versus the number of elements is depicted.Here, the normalized temperatures are used, i.e., T Ã ¼ T H ÀT c with T c ¼ 268 K and T H ¼ 278 K: The errors continue to decrease with an increasing amount of elements and approach very small values, indicating that the numerical solution converges to the analytical solution.For both the linear and the quadratic elements, approximately linear (OðhÞ) convergence rates were achieved.Note that the elements are only discontinuous at the element edges: within each element, a continuous finite element approximation is used.Since the solid-liquid interface is most of the time located somewhere within an element, we believe the suboptimal linear convergence rate is a consequence of the use of continuous polynomials for approximating the discontinuities in the enthalpy and temperature fields at the interface.Also recall the "trapping" of the solid-liquid interface position at the element edges, until both nodal enthalpy values have moved past the latent heat peak.The current results are in line with theoretical predictions that the optimal convergence rate for a Stefan problem with a finite element method and implicit tracking of the solid-liquid interface is O(h) [44].Possibly, a faster mesh convergence could be obtained using adaptive mesh refinement in the vicinity of the solid-liquid interface [49] or an extended finite element method [24].

Case 2: Melting of octadecane in a square container
For the second benchmark case, we consider a square cavity of dimensions H Â W ¼ 40 mm Â 40 mm, filled with n-octadecane as the phase-change material (PCM).At the initial temperature of T 0 ¼ 298:15 K, the entire PCM is solid.At t ¼ 0, the left wall is suddenly heated to T H ¼ 308:15 K: The right wall is kept constant at T C ¼ 298:15 K and the rest of the walls are adiabatic.
The thermophysical properties of n-octadecane are given in Table 2.We chose this particular benchmark case for the following two reasons: (1) The availability of recent experimental measurements, with relatively well described boundary conditions, including PIV measurements of the flowfield [5].(2) The availability of a recent numerical investigation with a linearized enthalpy approach and the finite volume method (FVM) [42], to compare the performance of the present method against.
Figure 5 depicts the absolute velocity contours at, respectively, 1 and 2 h after the onset of melting as measured experimentally using PIV (top two images) and numerically (bottom two images).Qualitatively, a good agreement was observed between the experimental data and the simulation results.The onset of the natural circulation loop, as seen in the PIV results, is well captured by the numerical method.As a consequence of the natural convection flow, the heat transfer to the solid-liquid interface is enhanced and the rate of melting is accelerated.
Figure 6 shows the results from a mesh convergence analysis, for both the solid-liquid interface position and the temperature plotted on the line y ¼ 0 mm through the center of the domain.All meshes consist of equally sized quadrilateral elements.Two different hierarchical sets of orthogonal basis functions were used, respectively, P ¼ f2, 1, 1, 1g and P ¼ f3, 2, 2, 2g for the mass flux, pressure, enthalpy, and temperature.Both sets of polynomial orders displayed visually Qualitative comparison between experimental campaign (top) and numerical campaign (bottom).Numerical campaign performed with "linearized enthalpy approach" coupled to a SIP-DG numerical method.200 Â 200 P ¼ f2, 1, 1, 1g elements were used.Time-integration was performed with the BDF2 finite difference scheme and Dt ¼ 0:25 s: The raw data of the octadecane melting case is included in a Zenodo repository [80].
To provide insight on the mesh convergence rates, Table 3 depicts the average number of inner iterations, the total liquid fraction, and the L 2 -norms of errors in the temperature, enthalpy and the absolute velocity (see Eq. ( 44)).Quantitative mesh convergence studies for solid-liquid phase change problems are rare and to the best of our knowledge this is the first time such a study has been performed for the solution of solid-liquid phase change problems with a discontinuous Galerkin method.The number of inner iterations do not grow excessively with an increasing mesh-size,  BDF2 time-integration with a time step of Dt ¼ 0:5 s was used for a total simulation time of 3600 s.The raw data of the octadecane melting case is included in a Zenodo repository [80].
although for the finest meshes of 400 Â 400 elements a relatively large number of iterations was needed to obtain convergence.This was probably a consequence of keeping the time step constant at Dt ¼ 0:5, for the higher mesh resolutions a smaller time step could be more suitable.The differences in the total liquid fraction are small, even between the finest and the coarsest mesh, which can possibly be attributed to the good energy conservation properties of the current numerical method.
For the L 2 norms, the normalized quantities were used, i.e., T Ã ¼ TÀT C T H ÀT c with T c ¼ 298:15 K and T H ¼ 308:15 K and juj Ã ¼ juj maxðjujÞ : Since now we do not have an analytical solution to compare to, the numerical solution for the finest mesh (i.e., 400 Â 400 and P ¼ f3, 2, 2, 2g) was used as the reference solution.For both the P ¼ f2, 1, 1, 1g and the P ¼ f3, 2, 2, 2g meshes, the L 2 error norms for the first 3 meshes (less than 100 Â 100 elements) appeared to decrease slowly (less than O(h)), whilst the error decreased with a rate close to O(h) from the 100 Â 100 elements mesh onwards.
Overall, these numerical results indicate that also for a two-dimensional melting problem with fluid flow, the present DG-FEM linearized enthalpy approach suffers from suboptimal mesh convergence.This conclusion is in line with theoretical predictions [44] and our observations from the 1D Stefan problem.However, we should note that since the mesh of 400 Â 400 with P ¼ f3, 2, 2, 2g was used as the reference solution, the calculated errors might not correspond to the "true" errors of the numerical solution.
Figure 7 depicts the interface position after, respectively, 1 h, 2 h, 3 h, and 4 h of simulation time.Based on the results from the mesh convergence, we selected the 200 Â 200 P ¼ f2, 1, 1, 1g mesh for the final simulations.We believe this choice of mesh was a good compromise between accuracy and computational affordability.The time step was set to Dt ¼ 0:25s based on a time step sensitivity analysis (see Ref. [80]).A good agreement with both the previous numerical campaign [42] and the experimental results [5] was observed.Compared to the experimental campaign, the numerical results predict a faster melting rate (although the shape of the melting fronts are very similar and a better agreement with the experimental results was obtained as compared to the reference simulations of Faden et al. [42]).We believe the main reasons for the over-prediction of the melting rate are: (1) The simulations are performed in two dimensions, whereas the experimental domain is a cubical cavity.Ignoring the effect of the walls in the third dimension leads to an over-estimation of the melting rate, of which the severity depends on the dimensions of the problem and the Prandtl number of the phase change material [81].For high Prandtl materials such as octadecane, the over-estimation of the melting rate in a 2D simulation is less serious then for low Prandtl materials.(2) Even though the experimental setup was thermally insulated, some heat losses to the environment were still present during the experimental campaign [5].However, fully adiabatic walls were assumed in the numerical simulations.(3) The present numerical campaign uses the Boussinesq approximation and does not consider the expansion of the octadecane during melting.It has been shown that the use of a constant density model will lead to an over-prediction of the melting rate, as opposed to the use of a variable density model [82].

Case 3: Melting of gallium in a rectangular container
For the third benchmark case, we consider Gallium melting in a rectangular cavity of dimensions H Â W ¼ 63:5 mm Â 88:9 mm: At the initial temperature of T 0 ¼ 301:3 K, the entire PCM is solid.At t ¼ 0, the left wall is suddenly heated to T H ¼ 311 K: The right wall is kept constant at T C ¼ 301:3 K and the rest of the walls are adiabatic.The thermophysical properties of gallium are given in Table 4. Similar to the melting of n-octadecane in a square enclosure, this benchmark features the melting of a PCM in a natural convection flowfield.However, there are several reasons to include this additional benchmark: (1) The different thermophysical properties of Gallium and the different aspect ratio of this enclosure lead to significantly different behavior of the flowfield and the evolution of the melting front.Therefore, the gallium melting in a rectangular enclosure case contributes to further validation of the "linearized enthalpy approach" with SIP-DG method.(2) For the 2D numerical case, multicellular flow is observed, possibly due to the onset of the Rayleigh-Benard instability (this was not the case in 3D simulations of the gallium melting problem, leading to an overall different outcome [83]).The number of vortices present in the multicellular flow depends on the resolution of the mesh and the accuracy of the numerical schemes [47].
(3) The Gallium melting in a rectangular enclosure by Gau and Viskanta [1], later repeated by CampBell and Coster and Ben David et al. using nonintrusive experimental methods in the form of x-ray radioscopy and ultrasound doppler velocimetry, respectively [2,3], is one of the classic melting and solidification experiments and is often used for numerical validation purposes.Examples are the validation of the source-based enthalpy approach [37], the grid refinement study performed by Hannoun et al. to find the correct 2D numerical solution [47] and the validation of the FEM and DG-FEM source-based enthalpy methods developed by Belhamadia et al. [84] and Schroeder and Lube [53].
Figure 8 shows the results from a mesh convergence analysis for the absolute velocity plotted on the line y ¼ 31:75 mm through the center of the domain.All meshes consist of equally sized quadrilateral elements.Compared to the octadecane melting case, the difference in results between the P ¼ f3, 2, 2, 2g and the P ¼ f2, 1, 1, 1g polynomial sets is more significant.Possibly, the multicellular flow patterns, which are a particular feature of the 2D Gallium melting case, are better captured with a higher-order finite element basis function for the mass flux and the pressure.Indeed, also Hannoun et al. observed differences in results when using a second order as opposed to a first-order finite volume upwind scheme for the convection term [47].One can see that for both the P ¼ f3, 2, 2, 2g and the P ¼ f2, 1, 1, 1g basis function sets, the results for the 280 Â 200 and the 560 Â 400 meshes appear qualitatively similar, although no full mesh convergence was achieved.Relevant quantities from the mesh convergence analysis are given in Table 5 (i.e., the average number of inner iterations, the total liquid fraction, and the L 2 -norms of errors in the temperature, enthalpy and the absolute velocity).Similar to the octadecane melting case, the differences in total liquid fraction between the different meshes are small.Up to a mesh size of 280 Â 200 elements, the number of inner iterations do not grow excessively with an increasing mesh size.However, for the mesh size of 560 Â 400 elements, a large number of inner iterations was needed to converge the energy equation, especially for the P ¼ f3, 2, 2, 2g basis function set.
It is expected that the use of a smaller time step will speed up the convergence of the nonlinear enthalpy-temperature iterations for the finer meshes.Regarding the L 2 error norms, similar errors are observed for the first three mesh sizes with respect to the finest mesh of 560 Â 400 elements with both the P ¼ f2, 1, 1, 1g and the P ¼ f3, 2, 2, 2g basis function sets.We believe this is due to the inability of the coarse meshes to properly resolve the multicellular flow, leading to an  BDF2 time-integration with a time step of Dt ¼ 0:025 was used and the total simulation time was 85 s.The raw data of the gallium melting case is included in a Zenodo repository [79].
incorrect prediction of the number of vortices.With respect to the 140 Â 100 mesh, the 280 Â 200 mesh presents a significant decrease in error.From the current numerical results, it is difficult to deduct the mesh convergence rate.However, based on the observations from the 1D Stefan problem and the octadecane melting in a rectangular enclosure case, we expect the mesh convergence to be around O(h). Figure 9 depicts the contour plots of the absolute velocity at various time steps.The right image shows the results obtained with the present numerical campaign, the left image depicts the reference solution of Hannoun et al. [47].Amongst the different meshes, we selected the 280 Â 200 mesh for our final simulations with a time step of Dt ¼ 0:025s: Contrary to the octadecane melting case, the P ¼ f3, 2, 2, 2g basis function set was used because the results with the 280 Â 200 mesh (in particular the number of vortices) remained stable for different time step sizes as opposed to the P ¼ f2, 1, 1, 1g basis function set (as can be seen in the time step refinement included in the numerical data repository [80]).As mentioned earlier, we belief the resolution of the multicellular flow patterns benefits from the use of a higher-order finite element basis function set.The results obtained with the current numerical campaign and the results from the reference solution appear to be almost identical, despite differences in the modeling approach ("linearized enthalpy approach" versus "source-based enthalpy approach") and the numerical method (DG vs. FVM).The mesh resolution is equal to 0.3175 mm, similar to the mesh resolution of 0.4 mm used for the grid-converged simulations of Schroeder and Lube who also used a DG-FEM method for modeling solid-liquid phase change with quadratic elements for the velocity and the temperature [53].Like-wise, qualitatively similar results were obtained with a significantly coarser grid as compared to the reference simulations of Hannoun et al. [47], where a 840 Â 600 uniform grid was used.Overall, the results from the Gallium melting case indicate the potential benefit of using discontinuous Galerkin methods for modeling melting/solidification problems, especially those where large gradients in the flowfield are present, as an alternative to the conventionally used finite volume method.
The results from the mesh refinement studies performed for the 1D Stefan, octadecane melting and gallium melting cases indicate that the proposed DG-FEM method is able to solve solidliquid phase change problems with an accuracy of around O(h).Therefore, in the vicinity of the solid-liquid interface, a lower-order method with refined mesh might be preferable.As the results from the gallium case show, regions with strong gradients in the velocity field could still benefit from a higher-order discontinuous Galerkin method.Most likely, the same would apply to areas of interest far away from the solid-liquid interface (for instance in problems where the phase change is highly localized), although this was not investigated in the present article.Combining  [47], the right image shows the results from the current numerical campaign.280 Â 200 P ¼ f3, 2, 2, 2g elements were used.Time-integration was performed using the BDF2 finite difference scheme and Dt ¼ 0:025 s: The raw data of the gallium melting case is included in a Zenodo repository [80].
the current DG-FEM "linearized enthalpy approach" method with adaptive grid refinement (see for instance Belhamadia et al. [49]) could be the next step toward the development of more accurate and computationally efficient numerical methods for solving solid-liquid phase change problems.Another interesting approach could be the use of an extended finite element basis (such as proposed by Chessa et al. [24]) which provides a better treatment of discontinuous solutions within the element as opposed to the classical polynomial finite element basis functions.

Conclusion and recommendations
This work presents a novel method for the numerical solution of solid-liquid phase change problems, where the "linearized enthalpy approach" was coupled to a discontinuous Galerkin framework.Compared to the apparent heat capacity method and the source-based approach, the "linearized enthalpy approach" has the advantages of being inherently thermal energy conservative, having a comparatively fast convergence of the energy equation for each time step, and not depending on the use of a so-called mushy zone.DG-FEM was selected for its attractive features, i.e., local conservativity, the possibility for upwinding, an arbitrarily high order of accuracy, high parallelization efficiency and high geometric flexibility.In particular, DG-FEM has the potential of offering a higher spatial resolution as compared to the finite-volume method, resulting in a more accurate and computationally efficient numerical method.The present numerical method was validated with the one-dimensional Stefan problem and the two-dimensional melting of octadecane in a square cavity and melting of gallium in a rectangular cavity cases.For the one-dimensional Stefan problem, the numerical method converged to the analytical solution and for both the octadecane and gallium melting cases, a good agreement between the current numerical campaign and the experimental and numerical reference solutions was observed.Comparatively few iterations were needed to solve the energy equation at each time step and the number of iterations appeared to scale well with an increasing time step.For both the one-dimensional Stefan problem and the 2D octadecane melting in a square cavity cases, approximately linear (O(h)) convergence rates were observed regardless of the element order.This suboptimal mesh convergence rate was a consequence of the deteriorated solution quality in the vicinity of the solid-liquid interface, due to the discontinuous enthalpy and temperature solutions when undergoing phase change.Only for the gallium melting in a rectangular cavity case an increase in performance from increasing the polynomial order of the finite element basis could be observed.As the results from the Gallium case show, mainly solid-liquid phase change problems with strong gradients in the flowfield can benefit from the present higher-order DG method.Probably, the same applies to problems with regions of interest far away from the solid-liquid interface.To take full advantage of the arbitrarily high order of accuracy of the DG-FEM numerical method, we recommend combining the current approach with adaptive grid refinement or an extended finite element basis as a next step toward the development of more accurate and computationally efficient numerical methods for modeling melting and solidification.

Figure 1 .
Figure 1.Enthalpy temperature relationship, for isothermal solid-liquid phase change.Here, q is the density, c p is the specific heat capacity, L is the latent heat and the subscripts "l" and "s" refer to the liquid and the solid phases, respectively.

Figure 2 .
Figure 2. Flowchart of the solution algorithm, including the nonlinear temperature-enthalpy iterations and the coupling of the energy and the momentum equations.

Figure 3 .
Figure 3. (a) Temperature field at 100, 250, 500, and 1000 s.(b) Solid-liquid interface position.Numerical vs. analytical solution for a 1D Stefan problem, with 128 linear elements, and a time step of Dt ¼ 0:1 s with BDF2 time-integration.tol ¼ 10 À6 : See Ref.[79] for the implementation of the solution of the 1D Stefan problem with the discontinuous Galerkin method and the linearized enthalpy approach in an inhouse Fortran code.The raw data of the 1D Stefan problem is included in a Zenodo repository[80].

Figure 4 .
Figure 4. Mesh convergence rate based on the L 2 norm of the error in the temperature field.The total time was 250 s and the time step was Dt ¼ 0:1 s: The raw data of the 1D Stefan problem is included in a Zenodo repository [80].

Figure 5 .
Figure 5. Absolute velocity contours for melting of n-octadecane in a square enclosure, at, respectively, 3600 s and 7200 s.Qualitative comparison between experimental campaign (top) and numerical campaign (bottom).Numerical campaign performed with "linearized enthalpy approach" coupled to a SIP-DG numerical method.200 Â 200 P ¼ f2, 1, 1, 1g elements were used.Time-integration was performed with the BDF2 finite difference scheme and Dt ¼ 0:25 s: The raw data of the octadecane melting case is included in a Zenodo repository[80].

Figure 8 .
Figure 8. Mesh convergence study based on the absolute velocity at the line y ¼ 31:75 mm: Two sets of finite element polynomial orders are selected, these are P ¼ f2, 1, 1, 1g and P ¼ f3, 2, 2, 2g for mass flux, pressure and enthalpy, temperature, respectively.BDF2 time-stepping with Dt ¼ 0:025 s was used for a total simulation time of 85 s.The raw data of the gallium melting case is included in a Zenodo repository [80].(a) Absolute velocity, p1p2p1 (b) Absolute velocity, p2p3p2.

Figure 9 .
Figure 9. Absolute velocity contours for melting of gallium in a square enclosure, at, respectively, 20, 32, 36, 42, 85, 155, and 280 s.Left image shows the results as obtained by the numerical benchmark of Hannoun et al.[47], the right image shows the results from the current numerical campaign.280 Â 200 P ¼ f3, 2, 2, 2g elements were used.Time-integration was performed using the BDF2 finite difference scheme and Dt ¼ 0:025 s: The raw data of the gallium melting case is included in a Zenodo repository[80].
this approach,

Table 1 .
Thermophysical properties used in the one-dimensional Stefan problem (corresponding to the thermophysical properties of water).

Table 3 .
Relevant quantities from the mesh convergence analysis for the octadecane melting in a square cavity case.

Table 5 .
Relevant quantities from mesh convergence analysis for the gallium melting in a rectangular container case.