An application of metal foams to improve the thermal energy transport in organic phase change materials such as paraffins, waxes and fatty acids is one of the most optimal ways to enhance the effective thermal conductivity of these materials. The possibilities of using metal foams can be improved with the combination of layers of different structural topology and thermophysical properties, which allows directing and distributing heat more uniformly throughout the volume. In this paper, computational research on convective thermal energy transfer and melting processes in a two-dimensional cavity including a porous copper medium saturated with a phase change material and heated by a volumetric heat source, is carried out. The results are received employing the finite difference technique, and the main equations are formulated within the framework of the local-equilibrium Darcy-Brinkman approach. The obtained data have allowed to conclude that the location of a foam layer with lower porosity allows more intensive heat dissipation, showing lower source temperatures; however, the best effect has been shown by vertical layers, with a gradient that creates uneven heating, which in turn results in the appearance of an extensive circulation zone and intensive heat removal from the local source.