The gas in galaxy clusters is heated by shock compression through accretion (outer shocks) and mergers (inner shocks). These processes additionally produce turbulence. To analyse the relation between the thermal and turbulent energies of the gas under the influence of non-adiabatic processes, we performed numerical simulations of cosmic structure formation in a box of 152 Mpc comoving size with radiative cooling, UV background, and a subgrid scale model for numerically unresolved turbulence. By smoothing the gas velocities with an adaptive Kalman filter, we are able to estimate bulk flows towards cluster cores. This enables us to infer the velocity dispersion associated with the turbulent fluctuation relative to the bulk flow. For haloes with masses above 1013 M⊙, we find that the turbulent velocity dispersions averaged over the warm-hot intergalactic medium (WHIM) and the intracluster medium (ICM) are approximately given by powers of the mean gas temperatures with exponents around 0.5, corresponding to a roughly linear relation between turbulent and thermal energies and transonic Mach numbers. However, turbulence is only weakly correlated with the halo mass. Since the power-law relation is stiffer for the WHIM, the turbulent Mach number tends to increase with the mean temperature of the WHIM. This can be attributed to enhanced turbulence production relative to dissipation in particularly hot and turbulent clusters.