By considering the ability of phase change materials (PCMs) in the storage of energy, the melting of four types PCMs including RT22, RT26, RT35, and RT41 in a heat exchanger is examined in this research. The impact of various shell cross‐sectional configurations on the complete melting time of materials, temperature changes, and liquid fraction throughout the melting process are presented. It is assumed that the main heat transfer fluid in the tube is non‐Newtonian and the tube is filled with a porous medium. The enthalpy porosity manner is applied for simulating the process of phase change and the heat natural convection and conduction cases are discussed. On the basis of the obtained results, the decrease in complete melting time is about 20% compared with the absence of a porous medium in the circular cross‐section configuration. The shell configuration has a noticeable impact on the reduction of the required time for melting. In the square cross‐section configuration, RT22 has the lowest melting time, as well as RT41 has the longest melting time in the inverted triangular cross‐section configuration in which the maximum time difference for RT22 is about 77% less. So, the best cross‐section for the shortest complete melting time is square.