Reactor Modeling with Aspen Plus
User Kinetics
User Kinetics Objective: How to write you own User Kinetics Fortran routine
Aspen Plus Refere References: nces: User Models Reference Manual , Manual , Chapter 11. User Kinetics Subroutines ©2002 AspenTech. All Rights Reserved.
User Kinetic Subroutines • When your your reaction reaction kinetic kinetic does not not fit the the standard standard Aspen Plus expressions. The following models allow you to supply a kinetic subroutine to calculate the reaction rates
Model Na Name
Reaction Type
RPlug
USER
RCSTR
USER
RBatch
USER
Pres Relief
USER
RadFrac
REAC-DIST or USER
RateFrac
REAC-DIST or USER
BatchFrac
REAC-DIST
©2002 AspenTech. All Rights Reserved.
©2002 AspenTech. All Rights Reserved.
6–1
Aspen Technology, Inc.
Reactor Modeling with Aspen Plus
User Kinetics
The Goal of the Kinetics Routine • For reactor models – Calculate rate of generation for each component in each
substream – Make sure rates are in mass balance
• For stage separation models – Calculate the rate of generation for each component on a
given stage – Make sure rates are in mass balance
©2002 AspenTech. All Rights Reserved.
User Kinetic: Subroutine • All units are in SI • Have access to – Aspen Plus physical property system through the physical
property monitors – Pure component physical property parameters – Parameters specific to a reactor
©2002 AspenTech. All Rights Reserved.
©2002 AspenTech. All Rights Reserved.
6–2
Aspen Technology, Inc.
Reactor Modeling with Aspen Plus
User Kinetics
User Kinetic Reactions • Fortran subroutine – Name maximum 6 characters in length – Uses real variables in double precision
• On the Reactions Reactions sheets specify: – Reaction stoichiometry – Subroutine name – Input variables through the INT and REAL vectors
©2002 AspenTech. All Rights Reserved.
Reaction Rates (1) • Units of reaction rates are different in different blocks:
• For RBatch and RCSTR – Conventional components:
(kgmole/m3-s)(m3) = kgmole/s
Note: Rates per unit volume are multiplied by the volume occupied by the reacting phase
©2002 AspenTech. All Rights Reserved.
©2002 AspenTech. All Rights Reserved.
6–3
Aspen Technology, Inc.
Reactor Modeling with Aspen Plus
User Kinetics
Reaction Rates (2) • For RPLUG – Conventional components:
(kgmole/m3-s)(m2) = kgmole/m-s
Note: Rates per unit volume are multiplied by the crosssectional area covered by the reacting phase
©2002 AspenTech. All Rights Reserved.
Points to Remember about Reaction Rates • We recommend that when calculating the final rates, use the reaction volume variables, RPROPS_VLIQ and RPROPS_VVAP from common RXN_RPROPS. This guarantees: – That RCSTR behaves the same way with or without the user
kinetics subroutine. (in terms of the behavior of the parameters VOL and REAC-VOL) – That the same subroutine can be used for all types of reactor
blocks
©2002 AspenTech. All Rights Reserved.
©2002 AspenTech. All Rights Reserved.
6–4
Aspen Technology, Inc.
Reactor Modeling with Aspen Plus
User Kinetics
User Kinetics: Physical Properties (1) • Use the ASPEN PLUS monitor routines to access the Aspen Plus physical property system • Monitors are available to calculate the following pure component and mixture thermodynamic properties for either vapor, liquid or solid – Fugacity coefficients – Enthalpies – Entropies – Free energies – Molar volumes – K-values – Ideal gas properties
©2002 AspenTech. All Rights Reserved.
User Kinetics: Physical Properties (2) • Vapor, Liquid and Solids transport properties are also available
• See the User Models Reference Manual Chapter 3 for more details
©2002 AspenTech. All Rights Reserved.
©2002 AspenTech. All Rights Reserved.
6–5
Aspen Technology, Inc.
Reactor Modeling with Aspen Plus
User Kinetics
Passing Parameters • User constants and variables are available to kinetics routine in the real and integer vectors • They can be defined in two places – Reactions Reactions Subroutine sheet • •
Global variables Vector names in subroutine REALR and INTR
– The User Subroutine Kinetics sheet, for the RCSTR, RBatch
and RPlug reactors • •
Local to that reactor Vector names in subroutine REAL and INT
©2002 AspenTech. All Rights Reserved.
Useful Argument List Parameters • SOUT - Vector containing information about the reactor contents at the time of calling the Fortran routine – Total and component flow rates – Temperature and Pressure – Total mass enthalpy and entropy – Vapor and liquid molar fractions – Mass density – Molecular weight
• Detailed list of contents and units in this array see User Models reference manual, Appendix C
©2002 AspenTech. All Rights Reserved.
©2002 AspenTech. All Rights Reserved.
6–6
Aspen Technology, Inc.
Reactor Modeling with Aspen Plus
User Kinetics
SOUT: Stream Vector Array Index
Description
1,……,NCC
Component mole flows (kmol/s)
NCC+1
Total mole flow (kmol/s)
NCC+2
Temperature (K)
NCC+3
Pressure (N/m )
NCC+4
Mass enthalpy (J/kg)
NCC+5
Molar Vapor Fraction
NCC+6
Molar Liquid Fraction
NCC+7
Mass entropy (J/kg-K)
NCC+8
Mass Density (kg/m )
NCC+9
Molecular weight (kg/kmol)
2
3
©2002 AspenTech. All Rights Reserved.
Useful Argument List Parameters • Arrays, Y, X, X1 and X2. Vapor, liquid, liquid1 and liquid2 mole fraction arrays – Mole fraction arrays are packed vectors of length NCOMP – Contain only components with non zero fractions – IDX vector defines the order of components with respect to the
Components Specifications Selection sheet Example.
If NCOMP=2 and IDX(1,3) Then Y(2) is the vapor mole fraction of the third component on the Components Specifications Selection sheet
©2002 AspenTech. All Rights Reserved.
©2002 AspenTech. All Rights Reserved.
6–7
Aspen Technology, Inc.
Reactor Modeling with Aspen Plus
User Kinetics
Component Mole Fractions Size = NC Size = NCOMP X 0.3 0.3 0.4
IDX 1 2 4
Order Components.Main 1 Water 2 Ethanol 3 Methanol 4 Benzene 5 Nitrogen
Stream Liquid Mole Fractions 0.3 0.3 0 0.4 0
©2002 AspenTech. All Rights Reserved.
Accessing Universal Constants • All physical property parameters used in the simulation are available to a user routine • Stored in a labeled common call the DMS_PLEX • Each parameter occupies a continuous area within the PLEX • To access a parameter you will need to know: – The name of the parameter – The offset of the parameter in the PLEX – The structure of that area
©2002 AspenTech. All Rights Reserved.
©2002 AspenTech. All Rights Reserved.
6–8
Aspen Technology, Inc.
Reactor Modeling with Aspen Plus
User Kinetics
User Kinetics: Universal Constants (1) • You can access the following universal constants: Name
Definition
MW
Molecular weight(kg/kgmole)
TC
Critical Temperature (K)
PC
Critical Pressure (N/m )
VC
Critical volume (m /kgmole)
OMEGA
Pitzer acentric factor
DHFOR M
Standard heat of formation of ideal gas at 298.15 K (J/kgmole)
DGFORM
Standard energy of formation of ideal gas at 298.15 K (J/kgmole)
TB
Normal boiling poi nt (K)
VB
Liquid molar volume at TB (m /kgmole)
TFP
Normal freezing point (K)
DEL TA
Solubility parameter at 298.15 K (J/m )
2
3
3
3 1/2
©2002 AspenTech. All Rights Reserved.
User Kinetics: Universal Constants (2) Name
Definition
MUP
Dipole moment (J*m )
RGYR
Radius of gyration (m)
CHI
Stiel polar factor
CHARGE
Ionic charge number
3 1/2
©2002 AspenTech. All Rights Reserved.
©2002 AspenTech. All Rights Reserved.
6–9
Aspen Technology, Inc.
Reactor Modeling with Aspen Plus
User Kinetics
Practical Steps Required to Get a Value (1) • Include the labeled common DMS_PLEX in the model • Find the parameters name – See page 6-13 of “User Model” Reference Manual for a list of
common parameters
• Determine the offset of the parameter – Use the functions DMS_IFCMNC or DMS_IFCMN
LMW = DMS_IFCMNC(‘MW’) – This line must appear before any executable code – The MW values start from B(LMW + 1) and will be in the same order as components on Components Specifications sheet
©2002 AspenTech. All Rights Reserved.
Practical Steps Required to Get a Value (2) • Use statement functions to find the offset of any component: XMW(I) = LMW + I – Define XMW as an integer
INTEGER XMW • Use the parameter in your equation SUM=0 DO 10 I=1,NC SUM=SUM+B(XMW(I)) 10
CONTINUE
©2002 AspenTech. All Rights Reserved.
©2002 AspenTech. All Rights Reserved.
6 – 10
Aspen Technology, Inc.
Reactor Modeling with Aspen Plus
User Kinetics
Reactor Specific Parameters (1) • Different parameters are available for each reactor unit operation • RPlug COMMON Block
Description
RPLG_RPLUGI
Integer configuration parameters, Number of reactor tubes
RPLG_RPLUGR Reactor length Reactor diameter
©2002 AspenTech. All Rights Reserved.
Reactor Specific Parameters (2) • RBatch COMMON Block
Description
RBTC_RBATI
Reactor Type
RBTC_VOLRB
Reactor volume (m )
3
©2002 AspenTech. All Rights Reserved.
©2002 AspenTech. All Rights Reserved.
6 – 11
Aspen Technology, Inc.
Reactor Modeling with Aspen Plus
User Kinetics
Reactor Specific Parameters (3) • RCSTR COMMON Block
Description
RCST_RCSTRI
Reactor Type
RXN_RCSTRR
Reactor volume (m ), Reactor volume fraction
3
©2002 AspenTech. All Rights Reserved.
Reactor Specific Parameters (4) • General properties COMMON Block
Description
RXN_RPROPS
Reactor temperature, pressure, molar vapor fraction, BETA, Volume of vapor, liquid or liquid and solid
©2002 AspenTech. All Rights Reserved.
©2002 AspenTech. All Rights Reserved.
6 – 12
Aspen Technology, Inc.
Reactor Modeling with Aspen Plus
User Kinetics
Using a Fortran Routine • You must compile on the Aspen Plus server with the command aspcomp
• Place the compiled object files in the run directory
• Alternatively – Write a Dynamic Linking Options (DLOPT) file which specifies
the objects to use
©2002 AspenTech. All Rights Reserved.
Fortran Compiler • To develop user kinetics routines on the PC you require a Digital Visual Fortran 5.0 compiler • End users do not required a compiler, distribute file as as shared library – Create shared libraries with the command: asplink
©2002 AspenTech. All Rights Reserved.
©2002 AspenTech. All Rights Reserved.
6 – 13
Aspen Technology, Inc.
Reactor Modeling with Aspen Plus
User Kinetics
User Kinetic References • See User Models Reference Manual for more detailed information
• Templates are provided for many user subroutines. By default they are located in the Program Files\AspenTech\ap100\user directory
©2002 AspenTech. All Rights Reserved.
User Kinetics: Workshop 7 (1) Objective: To model a Power Law expression using a User Kinetics routine CSTR-PL
DUPL FEED
FEEDPL
PRODUCT
FEEDUK CSTR-UK
PRODUK
Filename: WK7-USERKIN.BKP
©2002 AspenTech. All Rights Reserved.
©2002 AspenTech. All Rights Reserved.
6 – 14
Aspen Technology, Inc.
Reactor Modeling with Aspen Plus
User Kinetics
User Kinetics: Workshop 7 (2) • Setup two RCSTR reactors – Use the standard Power Law expression – Use a User kinetic routine of the Power Law expression
• Reaction Acetone + Allyl Alcohol
→
N-Propyl Propionate
r = K*EXP(-E/RT)*C ACB0. 5
Where C A
=
Concentration of Allyl-Alcohol, in kmol/m 3
CB
=
Concentration of Acetone, in kmol/m 3
©2002 AspenTech. All Rights Reserved.
User Kinetics: Workshop 7 (3) • Reaction Kinetics Pre-Exponential Factor= 52860000 m3**0.5/kmol**0.5-Sec Activation Energy = 62E6 J/kmol • Reactor Conditions Temperature = Pressure = Volume =
25 C 1 Atm 300 Liters
• Feed Conditions Acetone Allyl Alcohol Temperature Pressure
= = = =
75 kg/hr 50 kg/hr 25 C 1 Atm
©2002 AspenTech. All Rights Reserved.
©2002 AspenTech. All Rights Reserved.
6 – 15
Aspen Technology, Inc.
Reactor Modeling with Aspen Plus
User Kinetics
User Kinetics: Workshop 7 (4) • Property Method : NRTL-RK • A template has been supplied for the User kinetic routine, USRKIN.F • Calculate the rate of reaction for all the components from the information given • Save file as WK7-USERKIN.BKP
©2002 AspenTech. All Rights Reserved.
©2002 AspenTech. All Rights Reserved.
6 – 16
Aspen Technology, Inc.