A Stability Criterion for the Negative Compressibility Problem in Geothermal Simulation and Discrete Modeling of Failure in Oil Shale Pyrolysis Process