  In this paper we propose a novel thermodynamically compatible finite volume
scheme for the numerical solution of the equations of magnetohydrodynamics
(MHD) in one and two space dimensions. As shown by Godunov in 1972, the MHD
system can be written as overdetermined symmetric hyperbolic and
thermodynamically compatible (SHTC) system. More precisely, the MHD equations
are symmetric hyperbolic in the sense of Friedrichs and satisfy the first and
second principles of thermodynamics. In a more recent work on SHTC systems,
\cite{Rom1998}, the entropy density is a primary evolution variable, and total
energy conservation can be shown to be a \textit{consequence} that is obtained
after a judicious linear combination of all other evolution equations. The
objective of this paper is to mimic the SHTC framework also on the discrete
level by directly discretizing the \textit{entropy inequality}, instead of the
total energy conservation law, while total energy conservation is obtained via
an appropriate linear combination as a \textit{consequence} of the
thermodynamically compatible discretization of all other evolution equations.
As such, the proposed finite volume scheme satisfies a discrete cell entropy
inequality \textit{by construction} and can be proven to be nonlinearly stable
in the energy norm due to the discrete energy conservation. In multiple space
dimensions the divergence-free condition of the magnetic field is taken into
account via a new thermodynamically compatible generalized Lagrangian
multiplier (GLM) divergence cleaning approach. The fundamental properties of
the scheme proposed in this paper are mathematically rigorously proven. The new
method is applied to some standard MHD benchmark problems in one and two space
dimensions, obtaining good results in all cases.
