Buongiorno's two-phase model was used to study the laminar flow, heat transfer and mass 100transfer of a nanofluid in a porous medium with an irregular, non-uniform octagonal shape. A finite element method was used to study the improvement of the heat transfer rate inside the porous cavity, by equipping the cavity with a heated diamond. at different horizontal positions, as well as different sizes. The left wall of this cavity is maintained at a high temperature, the right wall is subjected to a low temperature, while the other walls are considered to be adiabatic. The aim of this paper is to demonstrate the effect of a heated square inclined at 45° and at different horizontal positions on the evolution of hydrodynamic, thermal and mass profiles. This study takes into account the influence of certain parameters, such as porosity, by assigning the following values to the Darcy number: 10-2, 10-4, and 10-6. In addition, the size of the side of the square is varied between 0.75L, L and 1.25L, where L represents the length of the side of the diamond. The Rayleigh, Lewis and Prandtl numbers are set at 104, 1 and 6.2 respectively, while the thermophoresis, buoyancy and Brownian motion ratios are set at 0.5, 1, 0.5 respectively.