Thermodynamically consistent modeling of gas flow and adsorption in porous media