Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Kinetic subroutine for Aspen plus 2

Status
Not open for further replies.

vinxenso

Chemical
Aug 13, 2002
14
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.
 
Replies continue below

Recommended for you

We could help ypu to write it but I do not know for an existing subroutine for copy-paste.
 
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
 
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
 
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?

Thanks for your help,
Christina
 
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



 
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 &quot;working directory&quot; 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
 
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
 
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:

&quot;Hydration of Isoamylenes in a Catalytic Distillation Column&quot; 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 &quot;passed&quot; 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
 
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.
 
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
 
cbd,
Thanks for your attention.you may mail me to bakhshayeshi@yahoo.com...

Regards
 
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,



 
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
 
Thanks for your answer,

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?


Thanks again for your fast answer,
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor