Microscopic understanding and modeling of HfO2 RRAM device physics