Compositional reservoir simulation-based reactive-transport formulations, with application to CO2 storage in sandstone and ultramafic formations