This study describes a two-dimensional numerical investigation of the flow and heat transfer around inverted D-shaped cylinders. The effects of thermal buoyancy force over the bluff bodies are considered numerically based on the flow field around circular and semi-circular cylinders. The operating Richardson numbers (Ri) are 0, 0.5, 1, and 1.5 with a Reynolds number (Re) of 100. Five cylinders with a length -to -diameter ratio of L* = (L/D) = 0.5, 0.6, 0.7 0.8, 0.9 are selected to investigate the effect of L* on energy harvesting. The functional dependence of drag coefficient, lift coefficient, resultant force coefficient, dimensionless maximum vibration amplitude, and output power is analyzed and studied. To validate the present study, some of the results are compared with other numerical and experimental investigations, and reasonable agreement is obtained. The results show that in the absence of buoyancy force, the history of the contours, and streamlines are periodic, and vortices created at the back of the body detach similarly from either side of the body; however, this behavior is not seen for other values of the Richardson numbers. Moreover, when the temperature contours are examined, a higher heat transfer is observed when a higher value of the Richardson is prescribed. Finally, the analysis shows that the output power of the bluff bodies under the condition of Ri =1.5 increases by 7.02, 10.4, 15.6, 21.2, and 25.4 as the L* increases, and the maximum extracted power is 26.2 at L* = 1 in relation to not applying buoyancy.