In the present research, a study has been conducted on a model to investigate magnetohydrodynamic (MHD) heat and mass transfer phenomena. In the geometry of this model, there is a circular cavity with a variable number of obstacles in each step. At each stage, some obstacles are heated, and its effect on fluid flow and heat transfer is investigated. Solving and developing partial differential equations is done using the finite element method. The effects of Rayleigh and Hartmann numbers on flow lines, isotherms, and equivalent concentrations have been investigated, and the output was displayed as contours and graphs. Finally, the Nusselt diagram is displayed. The main purpose of the present study is to evaluate the effect of changes in Rayleigh and Hartmann numbers in different geometries on its behavior. This particular flow configuration was chosen because of the fundamental role of magnetohydrodynamics and its widespread use in engineering, industry, and medicine. The findings of this research show that in almost all investigated geometries, the behavior of streamlines, isotherms, and isothermal concentrations is anti-symmetrical at X = 0.5. Also, with the heating of the upper obstacles, the total Nusselt number decreases, and with the heating of the lower obstacles, the total Nusselt number increases. The behavior of the total Nusselt number against the increase of the thermal radiation parameter is increasing, and as the number of obstacles inside the cavity increases, the total Nusselt number increases.