Thermo export property packages

Topics which are not specific to any given application

Moderator: jasper

Thermo export property packages

Postby tauha35 » 23 July 2021, 15:05

Can anybody advise whether there is a CAPE-OPEN thermo property package in which custom models can be defined using MATLAB/Python/Excel? My application is to design process components involving novel ionic liquids and water.

I checked “configure TEA” as a potential CAPE-OPEN thermo property package but it has very limited mixing rule models available with no option to define custom mixing models. ASPEN property package offers this flexibility but require FORTRAN knowledge. The FORTRAN coding process and subsequent file inclusions steps are not very user-friendly.

It will be great to have a MATLAB/Python Thermo Export wrapper similar to Thermo import wrapper from AmsterChem to allow custom property models for novel compounds.
tauha35
 
Posts: 8
Joined: 16 July 2021, 00:53

Re: Thermo export property packages

Postby jasper » 23 July 2021, 16:17

Can you be more specific about which models are needed?

If such models are to be developed from scratch I do not think such a framework currently exists.

AspenPlus can be extended using CAPE-OPEN based thermodynamics as well, but writing a property package requires some effort, including provision of a flash calculation.

TEA can be extended with custom property calculators; you could write just a property calculation routine for e.g. fugacity and enthalpy (and derivatives).
User avatar
jasper
 
Posts: 1128
Joined: 24 October 2012, 15:33
Location: Spain

Re: Thermo export property packages

Postby tauha35 » 23 July 2021, 21:44

As you mentioned, i am looking for a way to customize calculation of a few important properties using subroutines. To be more specific, using Redlich-Keister model with temperature correction to estimate mixture properties (density, viscosity, specific heat, thermal conductivity and electrical conductivity) through the excess property concept: https://www.intechopen.com/chapters/41931 (Eq 12). i didn't find a way to achieve this from within "Configure TEA" although the pure components manager is more user-friendly and descriptive then ASPEN's when it comes to defining new components.

A thermo export type of code would allow users to supply custom user models for properties where needed using CAPE-OPEN framework similar to how MATLAB UOP modifies parameters defined in ASPEN.
tauha35
 
Posts: 8
Joined: 16 July 2021, 00:53

Re: Thermo export property packages

Postby jasper » 25 July 2021, 10:14

Normally the route to an entire property package is that you have to create a (COM, or COBIA) based object that implements ICapeThermoMaterialContext, ICapeThermoPhases, ICapeThermoMaterialCompounds, ICapeThermoMaterialPropertyRoutine, ICapeThermoEquilibriumRoutine and ICapeThermoUniversalConstants; the property package then supplies all compound definitions, phase definitions, all property calculations, phase equilibrium calculations, etc.

The only shortcut that I can think of is to provide a property calculation routine. This still requires creating a (COM, or COBIA) based object that implements at least ICapeThermoMaterialContext and ICapeThermoMaterialPropertyRoutine - if you not provide ICapeThermoPhases or ICapeThermoMaterialCompounds it uses the phases and compound provided by the MO passed to ICapeThermoMaterialContext. Also no need to implement phase equilibria. Not many applications support such property routines, but TEA does. You can add one by clicking on the Add button in the External Routines tab of a TEA configuration. Once added, it can be selected for the properties it supports (those that are listed by ICapeThermoMaterialPropertyRoutine::GetSinglePhasePropList). This should include LogFugacityCoefficient (and implement CalcAndGetLnPhi) with derivatives if you want TEA to use that for your phase equilibrium calculations.

It is not straight forward - but what you want to do here perhaps is not straight forward.
User avatar
jasper
 
Posts: 1128
Joined: 24 October 2012, 15:33
Location: Spain

Re: Thermo export property packages

Postby tauha35 » 26 July 2021, 12:16

Thanks for your insightful reply summarizing how CAPE-OPEN property packages work in the background and how the CAPE-OPEN specs can be used to achieve what i want. However, i am not experienced in VB or C++ and therefore can't write a full COM object to fulfill the requirements of TEA.

The easiest route to using the Redlich-Keister mixing model in a PME would be learn the FORTRAN basics and then interface the FORTRAN subroutine with ASPEN as explained in this youtube video: https://www.youtube.com/watch?v=T_yecyAqD4Q

The other way is to fit the data to models already present in ASPEN or TEA and then model my process in a PME. I am not sure about the market but given Python's rise as a science and engineering field's programming language (if not MATLAB), a way to provide external subroutines written in Python to "configure TEA" would be of great benefit to chemical research engineers.
tauha35
 
Posts: 8
Joined: 16 July 2021, 00:53

Re: Thermo export property packages

Postby jasper » 26 July 2021, 14:05

The solution you are suggesting will of course work only in AspenPlus (which is not the case for any CAPE-OPEN based solution). I also do not think that the CAPE-OPEN part is the most complicated - you still need to solve the equation of state reliably and to high accuracy and pick the right root, and probably also supply the derivatives. This is complicated, and therefore there are not many frameworks in which this can easily be done.

In any case, you could write a PhysicalPropertyCalculator in COBIA (https://www.colan.org/experiences-projects/cape-open-binary-interop-architecture-cobia/) - now you no longer have to worry about most of the complications that COM bring. Currently however, only a C++ binding is provided, so you cannot easily do this in FORTRAN, if FORTRAN is your language of choice.
User avatar
jasper
 
Posts: 1128
Joined: 24 October 2012, 15:33
Location: Spain

Re: Thermo export property packages

Postby tauha35 » 26 July 2021, 21:10

I do not understand why equation of state and derivatives are involved when all i want to accomplish is provide a single equation (one each for the five properties of interest) that predicts the properties of mixtures by using the excess property concept. A big simplification in my case is that there is only liquid phase possible (no gas or solid) for the different compounds.

I don't think this forum members have access to source code files but in any case i only know, at this stage in my career, MATLAB and python (a little bit) programming languages that are relevant to writing process modeling code. i still need to get familiar with basic FORTRAN syntax to be able to supply the mixing equation in ASPEN (I need to explore the merit of using Redlich-Kister model now versus what is already available).
tauha35
 
Posts: 8
Joined: 16 July 2021, 00:53

Re: Thermo export property packages

Postby jasper » 27 July 2021, 07:31

My bad - I presumed Redlich-Keister was an equation of state. Do you have documentation on the method?
User avatar
jasper
 
Posts: 1128
Joined: 24 October 2012, 15:33
Location: Spain

Re: Thermo export property packages

Postby tauha35 » 27 July 2021, 14:41

The basic Redlich-Kister equation is presented in Eq.11 of the link shared earlier in the second post of this thread. The mixing model involves summation of pure component properties multiplied by their respective molar fraction and the excess property calculated by Redlich-Kister expansion is added to that sum.

This has been demonstrated to work for density, viscosity, specific heat, thermal conductivity and electrical conductivity:
density and viscosity: https://doi.org/10.1007/978-94-017-7573-1_1 or https://doi.org/10.1248/cpb.53.519. (slightly modified by dividing excess property by temperature)
specific heat: https://doi.org/10.1016/j.tca.2011.11.036.
thermal conductivity: https://doi.org/10.3390/molecules25173816.
electrical conductivity: https://doi.org/10.1021/je800468h.
tauha35
 
Posts: 8
Joined: 16 July 2021, 00:53

Re: Thermo export property packages

Postby jasper » 29 July 2021, 06:51

I am still not clear how you go from there to phase equilibria - will you be using one of the integrals over excess volume or gibbs energy to get to ln Phi?
User avatar
jasper
 
Posts: 1128
Joined: 24 October 2012, 15:33
Location: Spain

Next

Return to Process modelling and simulation

Who is online

Users browsing this forum: No registered users and 1 guest

cron