0% found this document useful (0 votes)
7 views8 pages

Extract Page 14

The document provides templates for user subroutines in Aspen Plus related to heat transfer coefficients, interfacial area, and holdup calculations for rate-based distillation. It includes detailed argument lists and example code for creating custom subroutines, emphasizing the importance of specific parameters such as phase, component properties, and column type. The document serves as a guide for users to implement their own correlations and calculations in Aspen Plus software.

Uploaded by

GoKwo Wong
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views8 pages

Extract Page 14

The document provides templates for user subroutines in Aspen Plus related to heat transfer coefficients, interfacial area, and holdup calculations for rate-based distillation. It includes detailed argument lists and example code for creating custom subroutines, emphasizing the importance of specific parameters such as phase, component properties, and column type. The document serves as a guide for users to implement their own correlations and calculations in Aspen Plus software.

Uploaded by

GoKwo Wong
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Example: Heat Transfer Coefficients Routine

You can use the following code as a template to create your own subroutine.
In addition, Aspen Plus provides the template for this user subroutine online
(see Appendix B).
IMPLICIT NONE
INTEGER KSTG, NCOMPS, IDX(NCOMPS), NBOPST(6), KPDIAG,
+ COLTYP, USRCOR, IPAKAR, IPTYPE, ITTYPE, IPHASE,
+ NINT, INT(NINT), NREAL
REAL*8 XCOMPB(NCOMPS), FRATEL, YCOMPB(NCOMPS), FRATEV,
+ PRESS, TLIQ, TVAP, AVMWP, VISCMP, DENMXP, CPMIXP,
+ THRMCP, PREH, EXPHK, EXPHD, COLDIA, REAL(NREAL)

C Declare local variables used in the user correlations


C
REAL*8 ScOvPrB
C
C Instead of computing HTCOEF for RATEFRAC
C We will compute PREH, EXPHK, and EXPHD for
C Rate-Based Distillation
C
IF (USRCOR .EQ. 1) THEN
C user subroutine example: Chilton-Colburn analogy
C
IF (IPHASE.EQ.0) THEN
C
C Liquid phase
C
ScOvPrB = THRMCP/(CPMIXP * DENMXP)
C
PREH = CPMIXP * (ScOvPrB ** 0.666666667D0)
EXPHK = 1.0D0
EXPHD = -0.666666667D0
ELSE
C
C Vapor phase
C
ScOvPrB = THRMCP/(CPMIXP * DENMXP)
C
PREH = CPMIXP * (ScOvPrB ** 0.666666667D0)
EXPHK = 1.0D0
EXPHD = -0.666666667D0
END IF
C END OF IF (IPHASE)
C
END IF
C END OF IF (USRCOR)
C
RETURN
END

20 User Subroutines for Rate-Based Distillation 231


Rate-Based Interfacial Area
Subroutine
Calling Sequence for Interfacial Area

SUBROUTINE usrintfa (KSTG, NCOMPS, IDX, NBOPST, KPDIAG, XCOMPB,
FRATEL, YCOMPB, FRATEV, PRESS, TLIQ, TVAP,
AVMWLI, AVMWVA, VISCML, DENMXL, SIGMAL, VISCMV,
DENMXV, AREAIF, COLTYP, USRCOR, TWRARA, COLDIA,
HTPACK, PACSIZ, SPAREA, CSIGMA, PFACT, PKPRMS,
VOIDFR, IPAKAR, IPTYPE, IVENDR, IPMAT, IPSIZE,
WEIRHT, DCAREA, ARAACT, FLOPTH, NPASS, WEIRL,
IFMETH, SYSFAC, HOLEAR, ITTYPE, TRASPC, PITCH,
NINT, INT, NREAL, REAL)
Subroutine name you entered on the RadFrac | User Transfer

Subroutines | Interfacial Area sheet.

Argument List for Interfacial Area


Variable I/O† Type Dimension Description and Range

KSTG I INTEGER — Stage number


NCOMPS I INTEGER — Number of components
IDX I INTEGER NCOMPS Component index vector
NBOPST I INTEGER 6 Physical property option set vector
KPDIAG I INTEGER — Physical property diagnostic code
XCOMPB I REAL*8 NCOMPS Bulk liquid mole fraction
FRATEL I REAL*8 — Flow of liquid (kgmole/s)
YCOMPB I REAL*8 NCOMPS Bulk vapor mole fraction
FRATEV I REAL*8 — Flow of vapor (kgmole/s)
PRESS I REAL*8 — Pressure (N/m2)
TLIQ I REAL*8 — Liquid temperature (K)
TVAP I REAL*8 — Vapor temperature (K)
AVMWLI I REAL*8 — Average molecular weight of liquid mixture
(kg/kgmole)
AVMWVA I REAL*8 — Average molecular weight of vapor mixture
(kg/kgmole)
VISCML I REAL*8 — Viscosity of liquid mixture (N-s/m2)
DENMXL I REAL*8 — Density of liquid mixture (kgmole/m3)
SIGMAL I REAL*8 — Surface tension of liquid (N/m)
VISCMV I REAL*8 — Viscosity of vapor mixture (N-s/m2)
DENMXV I REAL*8 — Density of vapor mixture (kgmole/m3)
AREAIF O REAL*8 — Interfacial area. Units depend on COLTYP:
When COLTYP = 1, m2/m3 of packing volume
When COLTYP = 2, m2/m2 of active tray area
COLTYP I INTEGER — Type of column: 1 = Packed, 2 = Tray
USRCOR I INTEGER — Choice of user correlation

232 20 User Subroutines for Rate-Based Distillation


Variable I/O† Type Dimension Description and Range

TWRARA I REAL*8 — Cross-sectional area of tower (m2)


COLDIA I REAL*8 — Column diameter (m)
HTPACK I REAL*8 — Height of packing in section (m)
PACSIZ I REAL*8 — Size of packing (m)
SPAREA I REAL*8 — Specific surface area of packing (m2/m3)
CSIGMA I REAL*8 — Critical surface tension of packing material
(N/m)
PFACT I REAL*8 — Packing factor (1/m)
PKPRMS I INTEGER 20 Packing parameters (See Packing Parameters)
VOIDFR I INTEGER — Void fraction of packing (m3/m3)
IPAKAR I INTEGER — Packing arrangement: 1 = Random, 2 =
Structured
IPTYPE I INTEGER — Packing Type (See Packing Type Specification)
IVENDR I INTEGER — Packing vendor code (See Packing Vendor
Specification)
IPMAT I INTEGER — Packing material code (See Packing Material
Specification)
IPSIZE I INTEGER — Packing size code (See Packing Size
Specification)
WEIRHT I REAL*8 — Height of exit weir (m)
DCAREA I REAL*8 — Area of downcomer (m2)
ARAACT I REAL*8 — Active area available on tray (m2)
FLOPTH I REAL*8 — Flowpath length (m)
NPASS I INTEGER — Number of tray passes
WEIRL I REAL*8 — Length of exit weir (m)
IFMETH I INTEGER — Flooding calculation method, required for sieve
trays
SYSFAC I REAL*8 — System factor, required for sieve trays
HOLEAR I REAL*8 — Ratio of total hole area to active area, required
for sieve tray
ITTYPE I INTEGER — Tray type: 1 = bubble cap, 2 = sieve, 3 =
Glitsch Ballast, 4 = Koch Flexitray, 5 = Nutter
Float Valve
TRASPC I REAL*8 — Tray spacing (m)
PITCH I REAL*8 — Sieve hole pitch (m), required for sieve trays
NINT I INTEGER — Number of integer parameters (see Integer
and Real Parameters)
INT I INTEGER NINT Vector of integer parameters (see Integer and
Real Parameters)
NREAL I INTEGER — Number of real parameters (see Integer and
Real Parameters)
REAL I REAL*8 NREAL Vector of real parameters (see Integer and
Real Parameters)
† I = Input to subroutine, O = Output from subroutine

20 User Subroutines for Rate-Based Distillation 233


Integer and Real Parameters
You can use integer and real retention parameters by specifying the number
on the RadFrac | User Transfer Subroutines | Interfacial Area sheet. You can
initialize these parameters by assigning values on the same sheet. The default
values are USER_RUMISS for real parameters and USER_IUMISS for integer
parameters. Aspen Plus retains these parameters from one call to the next.
The variables USER_IUMISS and USER_RUMISS are located in labeled
common PPEXEC_USER (see Appendix A).

Example: Interfacial Area Routine


You can use the following code as a template to create you own subroutine.
In addition, Aspen Plus provides the template for this user subroutine online
(see Appendix B).
IMPLICIT NONE
INTEGER KSTG, NCOMPS, IDX(NCOMPS), NBOPST(6), KPDIAG,
+ COLTYP, USRCOR, IPAKAR, IPTYPE, NPASS, IFMETH,
+ ITTYPE, NINT, INT(NINT), NREAL
REAL*8 XCOMPB(NCOMPS), FRATEL, YCOMPB(NCOMPS), FRATEV,
+ PRESS, TLIQ, TVAP, AVMWLI, AVMWVA, VISCML, DENMXL,
+ SIGMAL, VISCMV, DENMXV, AREAIF, TWRARA, COLDIA,
+ HTPACK, PACSIZ, SPAREA, CSIGMA, PFACT, PKPRMS(20),
+ VOIDFR, WEIRHT, DCAREA, ARAACT, FLOPTH, WEIRL,
+ SYSFAC, HOLEAR, TRASPC, PITCH, REAL(NREAL)
C Declare local variables used in the user correlations
C
REAL*8 WeL, dTemp, uV, rhoVms,
+ uL, rhoLms, ReL, FrL, uL2,
+ ReV, d, Wprime
C
C Compute specific interface area as described above
C Check COLTYP/USRCOR if providing multiple area correlations
C
IF (COLTYP .EQ. 1) THEN
C
C**** PACKED COLUMN
C
IF (USRCOR .EQ. 1) THEN
C user subroutine example for packed column: Onda 68
C
C Onda, K., Takeuchi, H. and Okumoto, Y., "Mass
Transfer
C Coefficients between Gas and Liquid Phases in
Packed
C Columns", J. Chem. Eng. Jap., 1, (1968) p. 56
C
rhoLms = DENMXL * AVMWLI
uL = FRATEL / TWRARA / DENMXL
uL2 = uL * uL
ReL = rhoLms * uL / VISCML / SPAREA
FrL = SPAREA * uL2 / 9.81D0
C WHERE 9.81D0 IS GRAVITY CONSTANT IN M/S^2
WeL = rhoLms * uL2 / SIGMAL / SPAREA
dTemp = -1.45D0*((CSIGMA/SIGMAL)**0.75D0)

234 20 User Subroutines for Rate-Based Distillation


+ *(ReL**0.1D0)*(FrL**(-0.05D0))
+ *(WeL**0.2D0)
dTemp = 1.D0 - DEXP(dTemp)

AREAIF = SPAREA*dTemp
END IF
C END OF IF (USRCOR)
C
ELSE IF (COLTYP .EQ. 2) THEN
C
C**** TRAY COLUMN
C
IF (USRCOR .EQ. 1) THEN
C user subroutine example for tray column: Scheffe-
Weiland 87
C
C Scheffe, R.D. and Weiland, R.H., "Mass Transfer
C Characteristics of Valve Trays." Ind. Eng. Chem. Res.
C 26, (1987) p. 228
C
C The original paper only mentioned valve tray.
C It is also used for bubble-cap tray and sieve tray.
C
C CHARACTERISTIC LENGTH IS ALWAYS 1 METER.
d = 1.0D0
rhoLms = DENMXL * AVMWLI
rhoVms = DENMXV * AVMWVA
uL = FRATEL / TWRARA / DENMXL
uV = FRATEV / TWRARA / DENMXV
ReL = rhoLms * uL * d / VISCML
ReV = rhoVms * uV * d / VISCMV
Wprime = WEIRHT / d
AREAIF = 0.27D0 * ReV**0.375D0 * ReL**0.247D0
AREAIF = AREAIF * Wprime**0.515
END IF
C END OF IF (USRCOR)
C
END IF
C END OF IF (COLTYP)
C
RETURN
END

20 User Subroutines for Rate-Based Distillation 235


Rate-Based Holdup Subroutine
Calling Sequence for Holdup Subroutine

SUBROUTINE usrhldup (KSTG, FRATEL, FRATEV, AVMWLI, AVMWVA, VISCML,
DENMXL, SIGMAL, VISCMV, DENMXV, LHLDUP, VHLDUP,
VSPACE, COLTYP, USRCOR, TWRARA, COLDIA, HTPACK,
PACSIZ, SPAREA, CSIGMA, PFACT, PKPRMS, VOIDFR,
PLHOLD, PVHOLD, IPAKAR, IPTYPE, IVENDR, IPMAT,
IPSIZE, WEIRHT, DCAREA, ARAACT, FLOPTH, NPASS,
WEIRL, IFMETH, SYSFAC, HOLEAR, ITTYPE, TRASPC,
PITCH, NINT, INT, NREAL, REAL)
Subroutine name you entered on the RadFrac | User Transfer

Subroutines | Holdup sheet.

Argument List for Holdup Subroutine


Variable I/O† Type DimensionDescription and Range

KSTG I INTEGER — Stage number


FRATEL I REAL*8 — Flow of liquid (kgmole/s)
FRATEV I REAL*8 — Flow of vapor (kgmole/s)
AVMWLI I REAL*8 — Average molecular weight of liquid mixture
(kg/kgmole)
AVMWVA I REAL*8 — Average molecular weight of vapor mixture
(kg/kgmole)
VISCML I REAL*8 — Viscosity of liquid (N-s/m2)
DENMXL I REAL*8 — Density of liquid mixture (kgmole/ m3)
SIGMAL I REAL*8 — Surface tension of liquid (N/m)
VISCMV I REAL*8 — Viscosity of vapor mixture (N-s/m2)
DENMXV I REAL*8 — Density of vapor mixture (kgmole/m3)
LHLDUP O REAL*8 — Liquid stage holdup (m3)
VHLDUP O REAL*8 — Vapor stage holdup (m3)
VSPACE O REAL*8 — Vapor space holdup (m3)
COLTYP I INTEGER — Type of column: 1 = Packed, 2 = Tray
USRCOR I INTEGER — Choice of user correlation
TWRARA I REAL*8 — Cross-sectional area of tower (m2)
COLDIA I REAL*8 — Column diameter (m)
HTPACK I REAL*8 — Height of packing in the section (m)
PACSIZ I REAL*8 — Size of packing (m)
SPAREA I REAL*8 — Specific surface area of packing (m2/m3)
CSIGMA I REAL*8 — Critical surface tension of packing material
(N/m)
PFACT I REAL*8 — Packing factor (1/m)
PKPRMS I INTEGER 20 Packing parameters (See Packing Parameters)
VOIDFR I INTEGER — Void fraction of packing (m3/m3)

236 20 User Subroutines for Rate-Based Distillation


Variable I/O† Type DimensionDescription and Range

PLHOLD I REAL*8 — User specified % free volume for liquid holdup


PVHOLD I REAL*8 — User specified % free volume for vapor holdup
IPAKAR I INTEGER — Packing arrangement: 1 = Random, 2 =
Structured
IPTYPE I INTEGER — Packing Type (see Packing Type Specification)
IVENDR I INTEGER — Packing vendor code (See Packing Vendor
Specification)
IPMAT I INTEGER — Packing material code (See Packing Material
Specification)
IPSIZE I INTEGER — Packing size code (See Packing Size
Specification)
WEIRHT I REAL*8 — Height of exit weir (m)
DCAREA I REAL*8 — Area of downcomer (m2)
ARAACT I REAL*8 — Active area available on tray (m2)
FLOPTH I REAL*8 — Flowpath length (m)
NPASS I INTEGER — Number of tray passes
WEIRL I REAL*8 — Length of exit weir (m)
IFMETH I INTEGER — Flooding calculation method, required for sieve
trays
SYSFAC I REAL*8 — System factor, required for sieve trays
HOLEAR I REAL*8 — Ratio of total hole area to active area, required
for sieve tray
ITTYPE I INTEGER — Tray type: 1 = bubble cap, 2 = sieve, 3 =
Glitsch Ballast, 4 = Koch Flexitray, 5 = Nutter
Float Valve
TRASPC I REAL*8 — Tray spacing (m)
PITCH I REAL*8 — Sieve hole pitch (m), required for sieve trays
NINT I INTEGER — Number of integer parameters (see Integer
and Real Parameters)
INT I INTEGER NINT Vector of integer parameters (see Integer and
Real Parameters)
NREAL I INTEGER — Number of real parameters (see Integer and
Real Parameters)
REAL I REAL*8 NREAL Vector of real parameters (see Integer and
Real Parameters)
† I = Input to subroutine, O = Output from subroutine

Integer and Real Parameters


You can use integer and real retention parameters by specifying the number
on the RadFrac | User Transfer Subroutines | Holdup sheet. You can initialize
these parameters by assigning values on the same sheet. The default values
are USER_RUMISS for real parameters and USER_IUMISS for integer
parameters. Aspen Plus retains these parameters from one call to the next.
The variables USER_IUMISS and USER_RUMISS are located in labeled
common PPEXEC_USER (see Appendix A).

20 User Subroutines for Rate-Based Distillation 237


Example: Holdup Subroutine
You can use the following code as a template to create your own subroutine.
In addition, Aspen Plus provides the template for this user subroutine online
(see Appendix B).
IMPLICIT NONE
INTEGER KSTG, COLTYP, USRCOR, IPAKAR, IPTYPE, NPASS,
1 IFMETH, ITTYPE, NINT, INT(NINT), NREAL
REAL*8 FRATEL, FRATEV, AVMWLI, AVMWVA, VISCML, DENMXL,
1 SIGMAL, VISCMV, DENMXV, LHLDUP, VHLDUP, VSPACE,
2 TWRARA,COLDIA, HTPACK, PACSIZ, SPAREA, CSIGMA,
3 PFACT,PKPRMS(20), VOIDFR, PLHOLD, PVHOLD, WEIRHT,
4 DCAREA,ARAACT, FLOPTH, WEIRL, SYSFAC, HOLEAR,
5 TRASPC, PITCH, REAL(NREAL)
C
C Define local variables
C
INTEGER ITER, KHTERR, KDPERR
C Variables used in the Stichlmair 89 correlation
REAL*8 DEQ, UL, UV, REV, C1, C2, C3,
+ DP, DPDRY, DPWET, FRL, HT, HT0, AUX, F, D,
+ C_S, GRAV, FF, HTETA
C
C Variables used in the Bennett 83 correlation
REAL*8 RS_BennettA, RS_BennettC, RS_BennettHL
REAL*8 FREVOL, US, RHOV, RHOL, ALPHAE, C_B, QL, HL, HF,
+ VOID, PLH, PVH
DATA GRAV /9.806599D0/
C
IF (COLTYP .EQ. 1) THEN
C
C PACKED COLUMN
C
VSPACE = 0.0D0
IF (USRCOR .EQ. 1) THEN
C user subroutine example for packed column: Stichlmair 89
C
C Stichlmair, J., Bravo, J.L. and Fair, J.R., "General Model
C for Prediction of Pressure Drop and Capacity of
C Countercurrent Gas/Liquid Packed Columns", Gas Sep.
C Purif., 3, (1989), P19
C
DEQ = 6D0*(1D0 - VOIDFR)/SPAREA
RHOL = AVMWLI*DENMXL
RHOV = AVMWVA*DENMXV
C
C *** CALCULATE FRICTION FACTOR ***
C
UV = FRATEV/DENMXV/TWRARA
REV = DEQ*UV*RHOV/VISCMV
C1 = PKPRMS(1)
C2 = PKPRMS(2)
C3 = PKPRMS(3)
FF = C1/REV + C2/DSQRT(REV) + C3
IF (FF .EQ. 0D0) FF = 10D0
C_S = (-C1/REV - C2/2D0/DSQRT(REV))/FF

238 20 User Subroutines for Rate-Based Distillation

You might also like