Storage of CO2 in depleted gas reservoirs or large aquifers is one of the available solutions to reduce anthropogenic greenhouse gas emissions. Numerical modeling of these processes requires the use of large geological models with several orders of magnitude of variations in the porous media properties. Moreover, modeling the injection of highly concentrated and cold CO2 in large reservoirs with the correct physics is introducing numerical challenges that conventional reservoir simulators cannot handle. We propose a thermal formulation based on a full equation of state formalism to model pure CO2 and CO2 mixtures with the residual gas of depleted reservoirs. Most of the reservoir simulators model the phase-equilibriums with a pressure-temperature based formulation. With this usual framework, it is not possible to exhibit two phases with pure CO2 contents. Moreover, in this classical framework, the crossing of the phase envelope is associated with a large discontinuity in the enthalpy computation which can prevent the convergence of the energy conservation equation. In this work, accurate and continuous phase properties are obtained basing our formulation on enthalpy as a primary variable. We first implement a new phase-split algorithm with input variables as pressure and enthalpy instead of the usual pressure and temperature and we validate it on several test cases. This algorithm can model situations where the mixture can change rapidly from one phase to the other at constant pressure and temperature. Then treating enthalpy instead of temperature as a primary variable in both the reservoir and the well modeling algorithms, our reservoir simulator can model situations with pure or near pure components as well as crossing of the phase envelope that usual formulations implemented in reservoir simulators cannot handle. We first validate our new formulation against the usual formulation on a problem where both formulations can correctly represent the physics. Then we show situations where the usual formulations fail to represent the correct physics and that are simulated well with our new formulation. Finally, we apply our new model for the simulation of pure and cold CO2 injection in a real depleted gas reservoir from the Netherlands.