This paper introduces a first-order physics-based model that accounts for the fundamental heat and mass transfer between a humid-air vapor stream onthe feed side to another flow stream on the permeate side. The model comprises a few optional submodels for membrane mass transport, and adopts asegment-by-segment method for discretizing heat and mass transfer governing equations for flow streams on the feed and permeate sides. The model is ableto simulate both dehumidifiers and energy recovery ventilators in parallel-flow, cross-flow, and counter-flow configurations. The predicted tresults comparesreasonably well with the measurements. The model and C++ open-source codes are expected to become a fundament tool for the analysis of membranebaseddehumidification in the future.