Aspen膜分离模块(cross flow)? 以下是Fortran Code,计算结果跟Simsci Pro自带的膜分离模块相同,都是Symmetric and Cross flow. 当然,如果Code有什么问题,也请大家指教。谢谢! C$ #1 BY: ANAVI DATE: 1-JUL-1994 NEW FOR USER MODELS C C User Unit Operation Model (or Report) Subroutine for USER2 C SUBROUTINE GASPERM (NMATI, SIN, NINFI, SINFI, NMATO, 2 SOUT, NINFO, SINFO, IDSMI, IDSII, 3 IDSMO, IDSIO, NTOT, NSUBS, IDXSUB, 4 ITYPE, NINT, INT, NREAL, REAL, 5 IDS, NPO, NBOPST, NIWORK, IWORK, 6 NWORK, WORK, NSIZE, SIZE, INTSIZ, 7 LD ) C IMPLICIT NONE C C DECLARE VARIABLES USED IN DIMENSIONING C INTEGER NMATI, NINFI, NMATO, NINFO, NTOT, + NSUBS, NINT, NPO, NIWORK,NWORK, + NSIZE C #include "ppexec_user.cmn" EQUIVALENCE (RMISS, USER_RUMISS) EQUIVALENCE (IMISS, USER_IUMISS) #include "DMS_PLEX.CMN" #include "dms_ncomp.cmn" C C THIS SUBROUTINE WILL SEPARATE WATER INTO THE SECOND OUTLET C C FIRST COPY FIRST INLET TO FIRST OUTLET C C C DECLARE ARGUMENTS C INTEGER IDSMI(2,NMATI), IDSII(2,NINFI), + IDSMO(2,NMATO), IDSIO(2,NINFO), + IDXSUB(NSUBS),ITYPE(NSUBS), INT(NINT), + IDS(2,3), NBOPST(6,NPO), + IWORK(NIWORK),INTSIZ(NSIZE),NREAL, LD, I INTEGER KH2O, KETHANOL REAL*8 SIN(NTOT,NMATI), SINFI(NINFI), + SOUT(NTOT,NMATO), SINFO(NINFO), + WORK(NWORK), SIZE(NSIZE) C C DECLARE LOCAL VARIABLES C INTEGER IMISS, DMS_KFORMC, DMS_IFCMNC REAL*8 REAL(NREAL), RMISS, WATER INTEGER USRUTL_GET_REAL_PARAM, X USRUTL_GET_INT_PARAM, X USRUTL_SET_REAL_PARAM REAL*8 AREA, QWATER, QETHANOL, PR, THETA INTEGER IFAIL, IERR, INDEX REAL*8 YPRIME, PDR C C BEGIN EXECUTABLE CODE INTEGER NSUBAREA, ICOUNT REAL*8 GAMMA, YIWATER, YPWATER, XFWATER, FEED, DX, DY, XWATER, X PLOW, PHIGH, ALPHA, SUBAREA, FWATER, FETHANOL, RETW,RETE, X RETWP, RETEP, RET, PEM, NEWTHETA,T1,T2,NT1,NT2,TEMP,PDRW,PDRE, X XFW, FW C 11 1 0 2 0 1 1 C WRITE(USER_NHSTRY,*) NTOT, NMATI, NINFI,NMATO,NINFO,NWORK,NSIZE, C x NCOMP_NCC C DO INDEX = 1, NTOT C WRITE(USER_NHSTRY,*) SIN(INDEX,NMATI) C END DO IF((NMATI.NE.1).OR.(NMATO.NE.2))THEN WRITE(USER_NHSTRY,*) 'THIS IS NOT MEMBRANE SEPARATION' IFAIL = 1 GOTO 999 END IF IF(SIN(NCOMP_NCC+5,1).NE.1)THEN WRITE(USER_NHSTRY,*) 'GAS PERMEATION NEED VAPOR FRACTION 1' IFAIL = 1 GOTO 999 END IF IFAIL = 0 INDEX = 0 IERR = USRUTL_GET_REAL_PARAM('AREA', INDEX, AREA) IF(IERR.NE.0)THEN WRITE(USER_NHSTRY,*) 'ERROR FETCHING MEMBRANE AREA' IFAIL = 1 END IF IERR = USRUTL_GET_REAL_PARAM('QWATER', INDEX, QWATER) IF(IERR.NE.0)THEN WRITE(USER_NHSTRY,*) 'ERROR FETCHING PERMEATE COEF FOR WATER' IFAIL=1 END IF IERR = USRUTL_GET_REAL_PARAM('QETHANOL', INDEX, QETHANOL) IF(IERR.NE.0)THEN WRITE(USER_NHSTRY,*)'ERROR FETCHING PERMEATE COEF FOR ETHANOL' IFAIL = 1 END IF IERR = USRUTL_GET_INT_PARAM('NSECTIONS',INDEX,NSUBAREA) IF(IERR.NE.0)THEN WRITE(USER_NHSTRY,*) 'ERROR FETCHING NUMBER OF SECTIONS' IFAIL = 1 END IF IERR = USRUTL_GET_REAL_PARAM('PR',INDEX,PR) IF(IERR.NE.0)THEN WRITE(USER_NHSTRY,*) 'ERROR FETCHING PRESSURE RATIO (T/P)' IFAIL= 1 ELSE IF(PR.LE.1)THEN WRITE(USER_NHSTRY,*) 'PRESSURE RATIO SHOULD BE LARGER THAN X 1' IFAIL = 1 END IF END IF C---------- ENDING READ PARAMETERS --------------- C WRITE(USER_NHSTRY,'(5F10.2)') AREA, QWATER, QETHANOL, PR C--------- CONVERT THE GPU TO KMOL/M^2/HR/KpA C ASSIGN SIN TO SOUT DO 100 I = 1, NTOT SOUT(I,1) = SIN(I,1) 100 CONTINUE C C INITIALIZE THE SECOND OUTLET C DO 200 I = 1, NCOMP_NCC+1 SOUT(I,2) = 0D0 200 CONTINUE C DO 300 I = NCOMP_NCC+2, NCOMP_NCC+9 SOUT(I,2) = SIN(I,1) 300 CONTINUE C SOUT(NCOMP_NCC+3,2)=SIN(NCOMP_NCC+3,1) C SOUT(NCOMP_NCC+2,2)=SIN(NCOMP_NCC+2,1) C C LOCATE WATER AND ETHANOL C KH2O = DMS_KFORMC ( 'H2O' ) IF ( KH2O .EQ. 0 ) THEN WRITE(USER_NHSTRY,*) "NO WATER COMPONENT EXISTED" IFAIL = 1 END IF KETHANOL = DMS_KFORMC ('C2H6O-2') IF (KETHANOL.EQ.0) THEN WRITE(USER_NHSTRY,*) "NO ETHANOL COMPONENT EXISTED" IFAIL = 1 END IF C C PUT THE WATER IN THE SECOND OUTLET C C--------------- MEMBRANE SEPARATION CALCULATION ---------------------- QWATER=QWATER*3.34D-10*3600 QETHANOL=QETHANOL*3.34D-10*3600 ALPHA = QWATER/QETHANOL GAMMA = 1./PR XFWATER=SIN(KH2O,1)/SIN(NCOMP_NCC+1,1) C XFETHANOL=SIN(KETHANOL,1)/SIN(NCOMP_NCC+1,1) FEED = SIN(NCOMP_NCC+1,1)*3600 ! KMOLES/HR C WRITE(USER_NHSTRY,*) FEED, FEED/3600 PHIGH = SIN(NCOMP_NCC+3,1)/1000 PLOW = PHIGH/PR SUBAREA = AREA/NSUBAREA ! DS C WRITE(USER_NHSTRY,*) XFWATER,ALPHA,FEED,PHIGH,QWATER YIWATER = YPRIME(XFWATER,ALPHA,GAMMA) XWATER = XFWATER RETW = FEED*XFWATER RETE = FEED - RETW RETEP = RETE RETWP = RETW FWATER = XFWATER RET = FEED c write(USER_NHSTRY,*) xfwater, feed, plow, phigh,yiwater c write(user_nhstry,*) xwater*phigh-yiwater*plow c write(user_nhstry,*) qwater, qethanol C WRITE(USER_NHSTRY,*) "A",RETW, RETE,XWATER, YIWATER C WRITE(USER_NHSTRY,*) RETW, RETE, XWATER, YIWATER, QWATER, QETHANOL DO INDEX=1,NSUBAREA PDRW = QWATER*(XWATER*PHIGH-YIWATER*PLOW)*SUBAREA PDRE = QETHANOL*((1-XWATER)*PHIGH-(1-YIWATER)*PLOW)*SUBAREA XWATER=XWATER-(PDRW-XWATER*(PDRW+PDRE))/RET YIWATER=YPRIME(XWATER,ALPHA,GAMMA) C IF(YIWATER.GT.(XWATER*PHIGH/PLOW))THEN C YIWATER=XWATER*PHIGH/PLOW RET = RET - PDRW - PDRE RETW = RETW - PDRW RETE = RETE - PDRE IF(((RETWP-RETW)/RETWP).GT.(0.1))THEN WRITE(USER_NHSTRY,*) "THINKING ABOUT INCREASE NSECTIONS" IFAIL = 1 END IF RETWP = RETW RETEP = RETE END DO C WRITE(USER_NHSTRY,*) "tEST",RETE + RETW, RET WRITE(USER_NHSTRY,*) "THE RETENTATE FLOW IS", RET, "KMOL/HR" WRITE(USER_NHSTRY,*) "THE FEED FLOW RATE IS", FEED, "KMOL/HR" WRITE(USER_NHSTRY,*) "DRIVE FORCE FOR WATER",XWATER*PHIGH-YIWATER X *PLOW, "KMOL/M^2/HR" C WRITE(USER_NHSTRY,*) "debuG",RETW/RET,YPRIME(RETW/RET,ALPHA,GAMMA) c---------------Counter Flow --------------------------- C-------------------- SOUT(KH2O,1)=RET*XWATER/3600 SOUT(KETHANOL,1)=RET*(1-XWATER)/3600 SOUT(NCOMP_NCC+1,1)=RET/3600 SOUT(NCOMP_NCC+2,1)=SIN(NCOMP_NCC+2,1) SOUT(NCOMP_NCC+3,1)=SIN(NCOMP_NCC+3,1) SOUT(KH2O,2)=SIN(KH2O,1)-SOUT(KH2O,1) SOUT(KETHANOL,2)=SIN(KETHANOL,1)-SOUT(KETHANOL,1) SOUT(NCOMP_NCC+1,2)=SIN(NCOMP_NCC+1,1)-RET/3600 SOUT(NCOMP_NCC+2,2)=SIN(NCOMP_NCC+2,1) SOUT(NCOMP_NCC+3,2)=SIN(NCOMP_NCC+3,1)/PR THETA = 1- RET/FEED IERR = USRUTL_SET_REAL_PARAM('THETA',INDEX,THETA) IF(IERR.NE.0)THEN WRITE(USER_NHSTRY,*) 'ERROR FETCHING MEMBRANE AREA' IFAIL = 1 END IF C WATER = SIN(KH2O,1) C SOUT(KH2O,1) = 0D0 C SOUT(NCOMP_NCC+1,1) = SIN(NCOMP_NCC+1,1) - WATER C SOUT(KH2O,2) = WATER C SOUT(NCOMP_NCC+1,2) = WATER 999 RETURN END REAL*8 FUNCTION YPRIME(X,ALPHA,GAMMA) REAL*8 X,ALPHA, GAMMA YPRIME = 1 + (ALPHA-1)*(GAMMA+X) YPRIME = YPRIME-DSQRT((1+(ALPHA-1)*(GAMMA+X))**2- X 4*GAMMA*ALPHA*(ALPHA-1)*X) YPRIME=YPRIME/2/GAMMA/(ALPHA-1) END FUNCTION REAL*8 FUNCTION PDR(XF,YP,XR,YI,PHIGH,PLOW) REAL*8 XF,YP,XR,YI,PHIGH,PLOW REAL*8 PL,PR PL = XF*PHIGH-YP*PLOW PR = XR*PHIGH-YI*PLOW C PDR = (PL-PR)/LOG(PL/PR) PDR = (PL*PR*(PL+PR)/2.)**(1./3) C WRITE(USER_NHSTRY,*) "aaa",PDR, (PL*PR*(PL+PR)/2)**(1./3) END FUNCTION查看更多0个回答 . 5人已关注