This document presents the mathematical modeling of heat transfer and phase change in three dimensions using the finite element method. It begins with the governing equations - the continuity, Navier-Stokes, and heat equations along with the Stefan free boundary condition. It then derives the variational formulation and discretizes the equations using finite elements. The nonlinear system is solved using Newton's method to find the numerical solution for temperature, velocity, and the moving solid-liquid interface over time.