In the framework of a description of melt pool heat transfer under severe accident conditions, we introduce a computational fluid dynamics approach for the phase change based on the phase-field method. The approach is derived using the formalism of irreversible thermodynamics and depends on a phenomenological expression for the free energy of binary eutectic alloys. The free energy is constructed to describe sharp interfaces on sufficiently small length scales and is capable of representing the appearance of mushy layers in a volume-averaged large-scale perspective. In particular, a dynamic calculation procedure for the diffuse interface width is introduced based on free energy minimization. Numerical simulations using this approach are performed and compared with experimental and numerical results from the literature. These comparisons demonstrate that the new model improves numerical simulation results and is able to describe the dynamics of sharp and diffuse interfaces.