Modeling the gas exchange process in lungs