The Shulhan Aruch (Siman 326) brings the Halacha that on Shabbat it is prohibited to bathe with hot water, even if it was heated before Shabbat. This Halacha is known as “Gezerat Merhasa’ot”-the decree of bathhouses. Therefore, one may not shower with hot water on Shabbat, even if he has hot water in his boiler from before Shabbat, and no cold water would enter the boiler.
However, Rabbi Akiva Eger (1761-1837) rules that if a person is “Mistaer”-suffering discomfort, even if he is not ill, he may bathe with water heated before Shabbat, as long as no water becomes indirectly heated on Shabbat; i.e. the cold water intake must be closed. Hacham Bension (Or Lesion 2:33) uses this principle to justify those who immerse in a hot Mikveh on Shabbat. Since they are used to going every day, they would suffer from missing Mikveh on Shabbat, and therefore they can bathe in the hot water which was heated before Shabbat.
Hacham Natan Ben-Senyar in his sefer Ner Sion, Hilchot Yom Tob, p.316 applies this leniency to someone who suffers without a hot shower on Yom Tob. He permits taking a hot shower even with water heated in a permitted fashion on Yom Tob. This is particularly applicable to a “three day Yom Tob” where people can get very hot and uncomfortable by the second day and would suffer if they would have to enter Shabbat without a shower. The fact that cold water will enter the boiler is less of a problem on Yom Tob, as one can rely on Hacham Ovadia’s arguments to be lenient. Even Hachamim, such as Hacham Baruch, that are generally strict regarding showering on Yom Tob, are more lenient in cases of three day holidays. Some would permit showering only in tepid water.
On Shabbat, showering in hot water heated from before Shabbat is prohibited, unless one suffers and can close the flow of cold water into the boiler. Someone who will suffer without immersing in a Mikveh on Shabbat, may immerse in a hot Mikveh.
On Yom Tob, there is room to be lenient and allow showering in hot water heated in a permissible fashion on Yom Tob for someone who suffers from discomfort.