  Thermal contact is the archetype of non-equilibrium processes driven by
constant non-equilibrium constraints when the latter are enforced by reservoirs
exchanging conserved microscopic quantities. At a mesoscopic scale only the
energies of the macroscopic bodies are accessible together with the
configurations of the contact system. We consider a class of models where the
contact system, as well as macroscopic bodies, have a finite number of possible
configurations. The global system with only discrete degrees of freedom has no
microscopic Hamiltonian dynamics, but it is shown that, if the microscopic
dynamics is assumed to be deterministic and ergodic and to conserve energy
according to some specific pattern, and if the mesoscopic evolution of the
global system is approximated by a Markov process as closely as possible, then
the mesoscopic transition rates obey three constraints. In the limit where
macroscopic bodies can be considered as reservoirs at thermodynamic equilibrium
(but with different intensive parameters) the mesoscopic transition rates turn
into transition rates for the contact system and the third constraint becomes
local detailed balance ; the latter is generically expressed in terms of the
microscopic exchange entropy variation, namely the opposite of the variation of
the thermodynamic entropy of the reservoir involved in a given microscopic jump
of the contact system configuration. For a finite-time evolution after contact
has been switched on we derive a fluctuation relation for the joint probability
of the heat amounts received from the various reservoirs. The generalization to
systems exchanging energy, volume and matter with several reservoirs, with a
possible conservative external force acting on the contact system, is given
explicitly.
