Modeling of gas flow in confined formations at different scales