Harry stumbled across it as he was making his way around the palace and recharging the mood enchantments with positive energy. He hoped this would speed up the process of everyone dealing with this temporary bout of crushing depression. Perhaps unsurprisingly, it was Hermione who had discovered the relaxation technique, and she was effectively applying it to a particularly distraught little girl when Harry found her.