# 5. Connecting CHEMCAD to the Wolfram Cloud for Membrane Calculations

## Description

CHEMCAD is a suite of process design software and Mathematica is a powerful computer algebra system for theoretical or numerical solution of advanced mathematical problems. In previous publications, we provided detailed instructions and examples for connecting Mathematica running locally or on the cloud to CHEMCAD. In References 1-3, we showed how to connect CHEMCAD to Excel using Mathematica Link For Excel running locally on the desktop computer. Reference 4 explains how to deploy functions to the cloud. Once deployed to the cloud, functions can be accessed over the internet in Excel, which in turn is connected to CHEMCAD through data mapping. This data set further extends that study by providing an additional example. The example is a simple well-mixed membrane calculation with a fully specified feed stream split by the membrane into retentate and permeate streams similar to Reference 3. To arrive at a solution, we specify the governing equations and invoke the symbolic solver in Mathematica to generate the design functions. The model is flexible since changes to the underlying equations can be easily made to accommodate different mechanical designs in the equipment, different transport mechanisms, or additional components. The results are interesting because a wide range of advanced design and simulation equations can be posed in Mathematica, deployed to the cloud, and then used directly by multiple users running CHEMCAD.

## Files

## Steps to reproduce

We took the following steps to verify that the software connectivity, data maps, and calculations are working correctly. The work was verified by replicating a published example problem [5], achiving the exact same answers as in the published solution. We also had each contributor download the files and follow the procedure in the instructions file to make sure the guidance is correct. Problem statement: Air containing only nitrogen and oxygen is continuously separated into a nitrogen-enriched retentate stream and an oxygen-enriched permeate stream by gas permeation through a low-density polyethylene membrane. The membrane is in the form of a thin-film composite with a 0.2-μm-thick membrane skin. A total of 20,000 SCFM of clean dry air with composition 79 mol% nitrogen and 21 mole% oxygen at 150 psia and 78 degrees F is sent to the separator. The solubilities and diffusivities of nitrogen and oxygen are taken from Table 14.6 in Reference 5. The material balance and molar flux equation are used to calculate the retentate and permeate flow rates and mole fractions given the membrane area and system pressures. Pressures of 150 psia on the retentate side and 15 psia on the permeate side are assumed, with perfect mixing on both sides of the membrane, such that compositions on both sides are uniform and equal to exit compositions. A function giving the permeaate cut (moles in the permeate divided by moles in the feed) is also determined. Pressure drops and any mass transfer resistances external to the membrane are neglected. References [1] Biaglow, Andrew; Cowart, Sam (2023), “Simple Flash Unit in Mathematica Linked to CHEMCAD”, Mendeley Data, V1, doi: 10.17632/smzy2998df.1; https://data.mendeley.com/datasets/smzy2998df/draft?a=e425fbc8-19d9-46c3-b4c5-b0324c7a6385. [2] Biaglow, Andrew; Cowart, Sam (2023), “Simple Membrane Unit in Mathematica Linked to CHEMCAD ”, Mendeley Data, V1, doi: 10.17632/cdcgbsrrhc.1; https://data.mendeley.com/datasets/cdcgbsrrhc/draft?a=a444cdf4-2630-426c-ab33-92639c929847. [3] Biaglow, Andrew (2023), “Improved Membrane Unit in Mathematica Linked to CHEMCAD ”, Mendeley Data, V1, doi: 10.17632/nz7p8bhhs3.1; https://data.mendeley.com/datasets/nz7p8bhhs3/draft?a=c9ceb8a5-1501-4239-8932-d45833a50b39. [4] Biaglow, Andrew (2023), “Connecting CHEMCAD to the Wolfram Cloud for Flash Calculations”, Mendeley Data, V1, doi: 10.17632/3b8n72m28v.1; https://data.mendeley.com/datasets/3b8n72m28v/draft?a=21876e25-2d38-4981-81e6-2bd81769d21b. [5] J. Henley and E. Seader, Separation Process Principles, New York: Wiley, 1998, Example 14.5, pp. 705-707.