The paper presents an approach of numerical modelling of alloy solidification in permanent mold and transient heat transport between the casting and the mold in two-dimensional space. The gap of time-dependent width called "air gap", filled with heat conducting gaseous medium is included in the model. The coefficient of thermal conductivity of the gas filling the space between the casting and the mold is small enough to introduce significant thermal resistance into the heat transport process. The mathematical model of heat transport is based on the partial differential equation of heat conduction written independently for the solidifying region and the mold. Appropriate solidification model based on the latent heat of solidification is also included in the mathematical description. These equations are supplemented by appropriate initial and boundary conditions. The formation process of air gap depends on the thermal deformations of the mold and the casting. The numerical model is based on the finite element method (FEM) with independent spatial discretization of interacting regions. It results in multi-mesh problem because the considered regions are disconnected.