关于aspen的user2的Fortran? 一个例题,在user2的stream results中却没有输出物流的信息(见附件图片),请教是怎么回事附件的apwz文件是8.0版的,hfum.f的代码如下: 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 HFUM (NMATI, MSIN, 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 Put in include statements and related declarations. C #include "ppexec_user.cmn" #include "dms_plex.cmn" C Real*8 B(1) Equivalence (B(1),IB(1)) C #include "dms_ncomp.cmn" C C DECLARE USRUS2 ARGUMENTS C C Include files pass additional variables via COMMONs. C Ppexec_user.cmn passes USER_NHSTRY. (1) Dms_plex.cmn passes C arrays containing component data such as molecular weight. (2) C Dms_ncomp.cmn passes NCOMP_NCC. (3) C ------------------- Declare arguments ------------------------------------- INTEGER NMATI, NINFI, NMATO, NINFO, NTOT, + NSUBS, NINT, NPO, NIWORK, NWORK, + NSIZE, NREAL 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), LD REAL*8 MSIN(NTOT,NMATI), SINFI(NINFI), + SOUT(NTOT,NMATO), SINFO(NINFO), + WORK(NWORK), SIZE(NSIZE), REAL(NREAL) C --------------- Declare Local Variables --------------------------------- INTEGER OFFSET, IERR, LDATA, KDIAG, IDX(10), NCP, I, J, INDEX, + LMW, NTUBES, IPERM, IRET,IFAIL REAL*8 DIAM, LEN, DIFF, CG, REJ_COEF, C1, C2, C3, C4, P_PERM, + DELTA_P, RHO, MU, FIN, CIN, PIN, UAVE, RE, SC, + CP, CR, KM, JM, FP, PRET, XMW, X(10), FLOW C ----------------- Declare Functions -------------------------------------- INTEGER USRUTL_GET_REAL_PARAM, ! These functions allow access to real + USRUTL_GET_INT_PARAM, ! and integer parameters using named + USRUTL_SET_REAL_PARAM ! references, and to write results data to Aspen Plus. (4) INTEGER DMS_IFCMNC !Determines offset to universal constant data. (5) REAL*8 DLOG !Standard Fortran function. C ----------------- Begin Executable Code ---------------------------------- C ----------------- Get configured REAL variables from Aspen Plus. --------- IFAIL = 0 INDEX = 0 !Used for passing a structure. (6) IERR = USRUTL_GET_REAL_PARAM('DIAM', INDEX, DIAM) !Put Configured Variable called "DIAM" in local variable DIAM. (7) IF (IERR .NE. 0) THEN !Write to History file if error. (8) WRITE(USER_NHSTRY,*) ' ERROR FETCHING HYDRAULIC DIAMETER' IFAIL = 1 END IF IERR = USRUTL_GET_REAL_PARAM('LEN', INDEX, LEN) IF (IERR .NE. 0) THEN WRITE(USER_NHSTRY,*) ' ERROR FETCHING LENGTH' IFAIL = 1 END IF IERR = USRUTL_GET_REAL_PARAM('DIFF', INDEX, DIFF) IF (IERR .NE. 0) THEN WRITE(USER_NHSTRY,*) ' ERROR FETCHING DIFFUSIVITY' IFAIL = 1 END IF IERR = USRUTL_GET_REAL_PARAM('GEL_CONC', INDEX, CG) !Local variable IF (IERR .NE. 0) THEN !can have any name. WRITE(USER_NHSTRY,*) ' ERROR FETCHING GEL CONCENTRATION' IFAIL = 1 END IF IERR = USRUTL_GET_REAL_PARAM('REJ_COEF', INDEX, REJ_COEF) IF (IERR .NE. 0) THEN WRITE(USER_NHSTRY,*) ' ERROR FETCHING REJECTION COEFFICIENT' IFAIL = 1 END IF IERR = USRUTL_GET_REAL_PARAM('COEF1', INDEX, C1) IF (IERR .NE. 0) THEN WRITE(USER_NHSTRY,*) ' ERROR FETCHING COEF1' IFAIL = 1 END IF IERR = USRUTL_GET_REAL_PARAM('COEF2', INDEX, C2) IF (IERR .NE. 0) THEN WRITE(USER_NHSTRY,*) ' ERROR FETCHING COEF2' IFAIL = 1 END IF IERR = USRUTL_GET_REAL_PARAM('COEF3', INDEX, C3) IF (IERR .NE. 0) THEN WRITE(USER_NHSTRY,*) ' ERROR FETCHING COEF3' IFAIL = 1 END IF IERR = USRUTL_GET_REAL_PARAM('COEF4', INDEX, C4) IF (IERR .NE. 0) THEN WRITE(USER_NHSTRY,*) ' ERROR FETCHING COEF4' IFAIL = 1 END IF IERR = USRUTL_GET_REAL_PARAM('PERM_PRES', INDEX, P_PERM) IF (IERR .NE. 0) THEN WRITE(USER_NHSTRY,*) ' ERROR FETCHING PERMEATE PRESSURE' IFAIL = 1 END IF IERR = USRUTL_GET_REAL_PARAM('DELTA_P', INDEX, DELTA_P) IF (IERR .NE. 0) THEN WRITE(USER_NHSTRY,*) ' ERROR FETCHING PRESSURE DROP' IFAIL = 1 END IF C ---------------- Get configured INTEGER variables from Aspen Plus -------- IERR = USRUTL_GET_INT_PARAM('NTUBES', INDEX, NTUBES) IF (IERR .NE. 0) THEN WRITE(USER_NHSTRY,*) ' ERROR FETCHING NUMBER OF TUBES' IFAIL = 1 END IF C ---------------- Calculate viscosity ------------------------------------- CALL SHS_CPACK(MSIN(1,1), NCP, IDX, X, FLOW) !Pack stream data. (9) KDIAG = 4 CALL PPMON_VISCL(MSIN(NCOMP_NCC+2,1), MSIN(NCOMP_NCC+3,1), X, + NCP,IDX, NBOPST, KDIAG, MU, IERR) C Calculate viscosity,put result in MU. (9) IF (IERR .NE. 0) THEN WRITE(USER_NHSTRY, *) ' ERROR EVALUATING VISCOSITY FOR FEED' IFAIL = 1 END IF IF (IFAIL .EQ. 1) RETURN C ---------------- Get location of molecular weight data.------------------- LMW = DMS_IFCMNC('MW') !Offset to component molecular weight data. (10) C C C ---------------- Model Equations ----------------------------------------- RHO = MSIN(NCOMP_NCC+8,1) / 1000. !Density of feed stream in g/cm^3. [= kg/l] (11) MU = MU * 10. !Viscosity of feed stream in g/cm/s. FIN = MSIN(NCOMP_NCC+1,1) * MSIN(NCOMP_NCC+9,1) / RHO * 3600. !Feed flow in l/hr. (11) CIN = MSIN(2,1) * B(LMW+2) / FIN * 3600000. !Protein conc. !in feed stream in g/l. (11) PIN = MSIN(NCOMP_NCC+3,1) / 101325. ! Feed stream pressure in atmospheres. (11) UAVE = FIN / (DIAM**2*3.14*NTUBES/4.) * 1000. / 3600. !Bulk average velocity in cm/s. RE = DIAM * UAVE * RHO / MU !Reynolds number. SC = MU / (RHO * DIFF) !Schmidt number. CP = CG * (1 - REJ_COEF) !Permeate stream protein conc. in g/l. KM = C1 * RE**C2 * SC**C3 * (DIAM/LEN)**C4 * DIFF/DIAM/100. !Mass xfer coef in m/s. JM = KM * DLOG((CG - CP) / (CIN - CP)) !Volumetric flux in m/s. FP = JM * DIAM * LEN * 3.14 * NTUBES*100*3600/1000. !Permeate stream flow rate in l/hr CR = (CIN - FP/FIN*CP) / (1 - FP/FIN) !Retentate stream protein conc. in g/l. PRET = PIN - DELTA_P !Retentate stream pressure in atm. C --------------- Assume PERMEATE stream is first, switch if not. ---------- IPERM = 1 IRET = 2 IF (IDSMO(1,1) .EQ. 'RETE') THEN !IDSMO is an argument passed to the IPERM = 2 !subroutine. It contains the outlet IRET = 1 !stream ID’s. (12) END IF C --------------- Fill SOUT array for PERMEATE stream. --------------------- SOUT(1,IPERM) = FP * RHO / 3600. / B(LMW+1) !Approximate water flow in kmol/s. (13) SOUT(2,IPERM) = FP * CP / 1000. / 3600. / B(LMW+2) !Protein flow in kmol/s. (13) SOUT(3,IPERM) = SOUT(1,IPERM) + SOUT(2,IPERM) !Total flow in kmol/s. (13) SOUT(4,IPERM) = MSIN(4,1) !Temp. unchanged from feed (K). (13) SOUT(5,IPERM) = P_PERM * 101325. !Pressure in N/m^2. (13) C C C -- Fill SOUT array for RETENTAT stream using values from PERMEATE stream. SOUT(1,IRET) = MSIN(1,1) - SOUT(1,IPERM) !Water flow in kmol/s. (13) SOUT(2,IRET) = MSIN(2,1) - SOUT(2,IPERM) !Protein flow in kmol/s. (13) SOUT(3,IRET) = SOUT(1,IRET) + SOUT(2,IRET) !Total flow in kmol/s. (13) SOUT(4,IRET) = MSIN(4,1) !Temp. unchanged from feed (K). (13) SOUT(5,IRET) = PRET * 101325. !Pressure in N/m^2. (13) C -- Now set values of the two variables designated as output parameters. -- IERR = USRUTL_SET_REAL_PARAM('CP_PROT', INDEX, CP) !The HollowF model was designed to accept 2 output parameters. (14) IF (IERR .NE. 0) THEN WRITE(USER_NHSTRY,*) ' ERROR STORING PERMEATE PROT CONC' IFAIL = 1 END IF IERR = USRUTL_SET_REAL_PARAM('CR_PROT', INDEX, CR) IF (IERR .NE. 0) THEN WRITE(USER_NHSTRY,*) ' ERROR STORING RETENTATE PROT CONC' IFAIL = 1 END IF C --------------- END Executable Code --------------------- RETURN END 查看更多0个回答 . 3人已关注