Numerical simulation of gas flow in porous media is becoming increasingly attractive due to its importance in shale and natural gas production and carbon dioxide sequestration. In this talk, we will discuss a multicomponent Maxwell-Stefan (MS) model with rock compressibility. Benefiting from the definitions of gas and solid free energies, this MS formulation follows an energy dissipation law which is consistent with the second law of thermodynamics. An efficient energy-stable numerical scheme will be introduced for the solution of the multicomponent MS model. Furthermore, we will also introduce a thermodynamically consistent numerical method for gas flow in poroelasticity media, which is coupled with the single-phase compressible flow and poromechanics.