Theoretical and experimental analysis of precipitation and solubility effects in lithium-sulfur batteries