Phase transitions in solid–liquid–gas systems with applications to alkali metal generators