This study presents numerical simulations on double-diffusive flow of a nanofluid in two cavities connected with four vertical gates. Novel shape of an outer square shape mounted on a square cavity by four gates was used. Heterogeneous porous media and Al2O3-water nanofluid are filled in an inner cavity. Outer rectangle shape is filled with a nanofluid only, and its left walls carry high temperature Th and high concentration Ch. +e right walls of a rectangle shape carry low temperature Tc and low concentration Cc and the other walls are adiabatic. An incompressible smoothed particle hydrodynamics (ISPH) method is applied for solving the governing equations of velocities, temperature, and concentration. Results are introduced for the effects of a buoyancy ratio (−2 ≤ N ≤ 2), Darcy parameter (10− 3 ≤ Da ≤ 10− 5), solid volume fraction (0 ≤ ϕ ≤ 0.05), and porous levels. Main results are indicated in which the buoyancy ratio parameter adjusts the directions of double-diffusive convection flow in an outer shape and inner cavity. Adding more concentration of nanoparticles reduces the flow speed and maximum of the velocity field. Due to the presence of a porous medium layer in an inner cavity, the Darcy parameter has slight changes inside the rectangle shape.