Simulation codes for galaxy formation and evolution take on board as many physical processes as possible beyond the standard gravitational and hydrodynamical physics. Most of this extra physics takes place below the resolution level of the simulations and is added in a sub-grid fashion. However, these sub-grid processes affect the macroscopic hydrodynamical properties of the gas and thus couple to the on-grid physics that is explicitly integrated during the simulation. In this paper, we focus on the link between partial ionization and the hydrodynamical equations. We show that the energy stored in ions and free electrons constitutes a potential energy term which breaks the linear dependence of the internal energy on temperature. Correctly taking into account ionization hence requires modifying both the equation of state and the energy-temperature relation. We implemented these changes in the cosmological simulation code Gadget2. As an example of the effects of these changes, we study the propagation of Sedov-Taylor shock waves through an ionizing medium. This serves as a proxy for the absorption of supernova feedback energy by the interstellar medium. Depending on the density and temperature of the surrounding gas, we find that up to 50% of the feedback energy is spent ionizing the gas rather than heating it. Thus, it can be expected that properly taking into account ionization effects in galaxy evolution simulations will drastically reduce the effects of thermal feedback. To the best of our knowledge, this potential energy term is not used in current simulations of galaxy formation and evolution.