This paper presents a simulation study of direct contact membrane distillation (DCMD) and air gap membrane distillation (AGMD) for desalination. Simulation models are built on Aspen Plus® platform as user defined unit operations for these two types of modules, respectively. Large scale modules for practical industrial applications are simulated and studied for the effects of design and operation variables, as well as the importance of heat and mass transfers of each phase. For each type of modules with heat recovery design, the response surface method (RSM) is applied to develop the performance-variables quadratic model, followed by the multivariable optimization. Optimal designs can realize separation efficiencies, defined as the ratio of water produced to the feed, of 8.2% and 5.8% for DCMD and AGMD, respectively.