Series solutions for a gas permeator with countercurrent and cocurrent flow