Natural convection produced by a non-uniform internal heat source is studied numerically. Our investigation is limited to a two-dimensional enclosure with an aspect ratio equal to two. The energy source is Joule dissipation produced by an electric potential applied through two electrodes corresponding to a fraction of the vertical walls. The system of conservative equations of mass, momentum, energy and electric potential is solved assuming the Boussinesq approximation with a discontinuous Galerkin finite element method integrated over time. Three parameters are involved in the problem: the Rayleigh number $Ra$, the Prandtl number $Pr$ and the electrode length $L_{e}$ normalized by the enclosure height. The numerical method has been validated in a case where electrodes have the same length as the vertical walls, leading to a uniform source term. The threshold of convection is established above a critical Rayleigh number, $Ra_{cr}=1702$. Due to asymmetric boundary conditions on thermal field, the onset of convection is characterized by a transcritical bifurcation. Reduction of the size of the electrodes (from bottom up) leads to disappearance of the convection threshold. As soon as the electrode length is smaller than the cavity height, convection occurs even for small Rayleigh numbers below the critical value determined previously. At moderate Rayleigh number, the flow structure is mainly composed of a left clockwise rotation cell and a right anticlockwise rotation cell symmetrically spreading around the vertical middle axis of the enclosure. Numerical simulations have been performed for a specific $L_{e}=2/3$ with $Ra\in [1;10^{5}]$ and $Pr\in [1;10^{3}]$. Four kinds of flow solutions are established, characterized by a two-cell symmetric steady-state structure with down-flow in the middle of the cavity for the first one. A first instability occurs for which a critical Rayleigh number depends strongly on the Prandtl number when $Pr<3$. The flow structure becomes asymmetric with only one steady-state cell. A second instability occurs above a second critical Rayleigh number that is quasiconstant when $Pr>10$. The flow above the second critical Rayleigh number becomes periodic in time, showing that the onset of unsteadiness is similar to the Hopf bifurcation. When $Pr<3$, a fourth steady-state solution is established when the Rayleigh number is larger than the second critical value, characterized by a steady-state structure with up-flow in the middle of the cavity.