×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Are you an
Engineering professional?
Join Eng-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

#### Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

# Kinetic subroutine for Aspen plus2

## Kinetic subroutine for Aspen plus

(OP)
Hi,

I need to write a fortran subroutine to insert the reaction kinetic to Aspen plus because this kinetic is in function of component activities instead of component concentrations. I haven't any idea, for this reason I need a similar example in which the kinetic expresion are in function of component activity. Someone know where I could find it?.

Best regards.

### RE: Kinetic subroutine for Aspen plus

We could help ypu to write it but I do not know for an existing subroutine for copy-paste.

### RE: Kinetic subroutine for Aspen plus

Hi,

I'm looking for a way to use a kinetic subroutine in the Aspen Plus module RADFRAC.  I've tried using the Aspen Plus FORTRAN templates USRKIN.f and USRKNT.f but my problem is trying to get Aspen to run them in the in-line Fortran section on the FORTRAN flowsheet.  I've checked the box on the SETUP-Simulation Option-System menu under FORTRAN compilation options to:
"write inline FORTRAN to a subroutine to be compiled and dynamically linked"

but I still get an error that I'm not allowed to use subroutines in the in-line FORTRAN box.  Does anyone know how I can include a kinetic subroutine in Aspen Plus?

Thanks in advance for any help,
Christina

### RE: Kinetic subroutine for Aspen plus

Well, here is the way to do it. as i do not have access to Aspen right now, you have to rty it out.

Note, if you have put you Fortran code in USERKIN.F, then YOU HAVE TO COMPILE it using COMPAQ Fortran (version 6.0 or higher). Once compiled, then you can call in in any place by defining the name in that Block, say in the Plug Flow reactor
block, you define "USERKIN", etc. Also, you can check if the Fortran has compiled or not by giving the following command:

ASPCOMP <filename>

Try it out and let me know...

BANDO

### RE: Kinetic subroutine for Aspen plus

Hi JBando,

Thank-you for your response to my post.
Up until last month I was working with Aspen Plus ver. 10.1 running on a Unix platform that somehow had a built-in Fortran compiler.  I did use aspcomp <filename.f> and I was able to compile the fortran code and get an object file (and consequently I had no problems running the simulation after that).  I am now running Aspen Plus 11.1 in a Windows 2000 environment and no compiler was supplied.  At first I tried using the downloadable Force Fortran compiler, but Aspen didn't like that (because Aspen was looking for some particular .lib files that the Force compiler either didn't have or were called something else).  I was able to get aspcomp to compile my fortran file (and generate an object file) using DIGITAL Visual Fortran ver. 5.0.  But now the problem is that when I run my simulation I get a dynamic link error reported by Aspen Plus.  Could this be because I don't have the COMPAQ version of Fortran?  Is there any way around the dynamic link error without having to change to another Fortran compiler?

Christina

### RE: Kinetic subroutine for Aspen plus

Dear Christina:

Yes, verily. Aspen needs COMPAQ Visual Fortran. In fact I had problem earlier, as I was using DVF5.X (X=I don't remember the  exact version no.). I switched to DVF 6.0 with the patch available in COMPAQ(well now HP). I suggested Aspen to add DVF fortran with the Aspen and add another $500 (five hunderd$). Well, Aspen people told it is good idead, but not every body will require User Defined Fortran. Well I always feel the need, and I have used DVF a lot. Though I am not that old, but I am fond of Fortran> I learnt a lot while I was making Fortral DLL for accessing from MS Excel.

Another point is Aspen 11.0 is an equation based,  just to keep every thing in the same background like their Adsim  and Speedup  engine (I have used Adsim and liked it very much for dynamic simulation) Although you will not see any difference in the Aspen 'look & feel', but the way it calculates the flowsheet is very different - well suppose to be more efficient.

So, use DFV Fortran, and let me know...

Also, use the latest template for user defined kinetics, as it passess lot of parameters via that USERKIN call.

Feel free to to concat me

Thanks,

Jay

### RE: Kinetic subroutine for Aspen plus

Dear Jay:

Well, it turns out I am able to use DIGITAL Fortran (V.5) to compile my subroutines on Aspen Plus 11.1.  I found that I did need to use the new kinetic templates that came with the new version of Aspen.  The funny thing now is that I can get my subroutines to compile and to be dynamically linked to Aspen Plus, but I can't get the Aspen example to work.  I was using Aspen's application example bayer.apw and usrbay.f to test my system, and I still can't get it to work (maybe they didn't update their own fortran code?).
I also noticed that I have to keep the Aspen Plus file and the Fortran object file in the same working directory.  Even though I can set the "working directory" in Aspen on the hard drive, if I open an .apw file from a floppy disk, it will look for the object file on the floppy disk too.

In any case, for my kinetic code DVF ver.5 is working ok for now and maybe new problems will come up, but for now I'm starting to get results!

Thanks for all your suggestions and help!
It's greatly appreciated,
Christina

### RE: Kinetic subroutine for Aspen plus

Dear Christina:

Glad that your DVF5.0 is working. But my suggestion will be to switch to at least DVF 6.0 or so. The problem may occur later on.

And your bayer.APW- I think it will be easy to solve. Do the following:
1. If you have .BKP for the bayer, open that file.
2. Do the compilation (I think the newer template was compiles in DVF6.X , X=not sure).
3.Run the program - it should work

IF YOU DO NOT HAVE bayer.BKP, then

1a. open the APW file, and save it as bayer_Chris.bkp. Ignore any warning.
2a. Compile the file (re-initilize the simulation)
3. Run the simulation (IT WILL WORK)

Thanks,

Jay

### RE: Kinetic subroutine for Aspen plus

Vinxenso,

If you are still looking for a way to include activities into a kinetic subroutine, I have come across a reference that has some sample Fortran code.  It is in a PhD. thesis from the U of Texas:

"Hydration of Isoamylenes in a Catalytic Distillation Column" by Jose Castor Gonzalez, U of Texas at Austin, 1997

The user kinetic subroutine calls another subroutine which calculates activity coefficients and then uses them to calculates activities.  The Fortran code is written for the UNIQUAC method.  The binary interaction parameters are not "passed" as an argument through the kinetic subroutine.  It appears they have been manually calculated and input as data.  If you are interested in the code please send let me know.

cbd

### RE: Kinetic subroutine for Aspen plus

Hi cbd,
I want to write a fortran subroutine to insert a reaction kinetic to Aspen plus, because the kinetic I have is not in the form as in aspen plus kinetics.as I have no idea to do that,I would be so grateful if you send me the example you metioned.

Regards.

### RE: Kinetic subroutine for Aspen plus

bakhshayeshi,

I don't have a way to send you an e-mail; possibly you can update your e-mail in your personal profile?

cbd

### RE: Kinetic subroutine for Aspen plus

cbd,
Thanks for your attention.you may mail me to bakhshayeshi@yahoo.com...

Regards

### RE: Kinetic subroutine for Aspen plus

Hi All,

I used an ASPEN example to write the kinetics I found in a publication with no success. I checked the aspen documentation but it is not very helpful.

the publication is:
An industrial design/control study for the vinyl acetate monomer process. M.L. Luyben and B.D. Tyreus. Computers chem. Engng Vol 22 N 7-8, pp867-877
(if required I can send the pdf I can be contacted at mendivil@vodafone.es)

Can anybody help me?

Thanks,

### RE: Kinetic subroutine for Aspen plus

Rmendivil:

You mentioned that you have checked Aspen documentation, and did not work. Make sure that the Aspen version (the software) and the documentation you are following are the same. Best thing will be, print the PDF Help file for the USER DEFINED SUBROUTINE. There you will find Exactly how to use and the calling procedure. Note, the calling procedure of Aspen 9.0-9.2 and the number of variables are very different, and I did have an opportunity to check for Aspen 11.

Again, it is not very easy to use, that I mentiond in my very first posting.

Thanks,

Jay

### RE: Kinetic subroutine for Aspen plus

I am using Aspen 11.1 and compaq visual fortran 6.6, I used a subroutine that was availabe for aspen 10 as an example for mine.

Compilation seems to work and the linking is fine but there are still things from the code I got that I do not understand and I do not get the results mentioned in the publication.

As you say they are some variables that are called sifferently for example the ppmon_voll (...., VMXl,... ) in my code is as ppmon_voll (...., VMX,... ) in the documentation, I am not an expert and sometimes I am lost but compilation seems to work.

I only have one example and it is a plugflow reactor with liquid phase reaction and I am trying to do solve a vapor phase with partial pressure as concentration. Is there any example available anywhere for this kind of reaction-reactor?

#### Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

#### Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

#### Resources

Low-Volume Rapid Injection Molding With 3D Printed Molds
Learn methods and guidelines for using stereolithography (SLA) 3D printed molds in the injection molding process to lower costs and lead time. Discover how this hybrid manufacturing process enables on-demand mold fabrication to quickly produce small batches of thermoplastic parts. Download Now
Examine how the principles of DfAM upend many of the long-standing rules around manufacturability - allowing engineers and designers to place a partâ€™s function at the center of their design considerations. Download Now
Taking Control of Engineering Documents
This ebook covers tips for creating and managing workflows, security best practices and protection of intellectual property, Cloud vs. on-premise software solutions, CAD file management, compliance, and more. Download Now

Close Box

# Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!