ASCEND/C2/Solving-Cubic-EOS/English
Tutorial 4: Cubic EOS: Peng Robinson
|
|
Show Slide number 1
Title slide |
Welcome to the spoken tutorial on Solving Cubic Equation Of State in ASCEND |
Show Slide 2 | In this tutorial, we will learn how to
|
Show Slide number 3
System Requirement |
Here I am using
|
Show Slide number 4
Pre-requisites |
To follow this tutorial, user must have basic knowledge of
|
Show Slide number 5
Pre-requisites |
To know more about ASCEND, please visit ascend4.org
|
Show Slide number 6
Peng Robinson Cubic EOS |
Let’s write a general model to solve Peng Robinson cubic equation of state.
|
Show Slide number 7
Peng Robinson Cubic EOS |
It is sometimes more convenient to express the polynomial in terms of the compressibility factor Z.
|
Let's now look at the code for Peng Robinson model.
| |
Open the code file in gedit | Open the file Peng Robinson.a4c in a text editor.
|
Highlight REQUIRE "thermodynamics.a4l"; | For solving this model, we require data from the thermodynamics library.
So, add REQUIRE “thermodynamics.a4l”. |
Highlight the lines sequentially | I have named this model as pengrobinson.
The variables defined using WILL_BE are used as parameters in our test model
I will come back to the explanation of WILL_BE as we move ahead in our tutorial. |
Highlight the following declaration statements
R IS_A molar_gas_constant; Pc IS_A pressure; Tc IS_A temperature; T_degC IS_A factor; alpha, beta, q,Tr, Pr, omega IS_A factor; PSI, OMEGA, sigma, eps IS_A real_constant; |
Now we define rest of the variables accordingly. Like, R IS_A molar gas constant, Pc IS_A pressure and so on,
|
Highlight the given constants used in the code
PSI :== 0.45724; OMEGA :== 0.07780; sigma :== 2.414213562; eps :== 0.414213562; |
Now we mention the values of all the constants used in Peng Robinson equation of state.
Please note that the values of these constants will be reused in our test model. |
So we use a colon and is equal to sign twice, to assign values to constants | |
Highlight the following syntax
Pc = data.Pc; Tc = data.Tc; omega = data.omega; Tr = T/Tc; Pr = P/Pc; T_degC = T/1{K} - 273.15; |
We take the critical temperature, critical pressure and omega data from the thermodynamics library.
|
Highlight the lines | Now we define the reduced temperature and reduced pressure" in terms of Tc and Pc.
|
Highlight the lines | Now we mention the Peng Robinson equation as shown in the previous slide
|
Highlight the line | Now let’s define methods to solve this model. |
Highlight the line | We use the method default to solve this model and run the METHOD specify and METHOD values under it. |
Highlight the line | Under specify we fix the variables by writing , P.fixed := TRUE;and T.fixed := TRUE; |
Highlight the line | Note that
|
Highlight the line | Now under values, we define values to the fixed variables.
For Z, we set the upper and lower bound and also provide a nominal value to initiate the solution. |
Highlight the line | The syntax used is
|
Highlight the line | Now we end Peng Robinson model. |
Highlight the line | Parameters defined in this model, can now be reused by any model to calculate Z for specific components. |
Highlight the line | Let's now see how to use these parameters and calculate Z for ethylene in a test model.
Let's now look at the code for test model. |
Highlight the line | Note that the test model is written below the Peng Robinson model in the same document.
We name this model as test We define a symbol constant – c1. And assign c1 is equal to ethylene. |
Highlight the line | We use a colon and equal to sign twice as this c1 is passed as a parameter to another variable components underscore data, which is present in thermodynamics library.
Here we define cd as components_data of ethylene. |
Highlight the line | Note that
|
Highlight the line | Note that we used WILL_BE to define P,V,Z etc |
Highlight the line | To reuse these parameters from previous model, we need to define them here using IS_A operator
Thus we define
|
Highlight the line | We define tpeng IS_A pengrobinson.
|
Highlight the line | We have passed the required parameters to the pengrobinson model in parenthesis.
So we don't have to write the equations and variables again. |
Highlight the line | The values of constants and other variables will be called in the test model from peng robinson model.
|
Highlight the line | We define equations for Tr and Pr as
|
Highlight the line |
cd.date c1.Tc imports the value of Tc for ethylene from thermodynamics library. |
Highlight the line |
In METHODS, we define the standard methods again. But now
|
Highlight the line | This is done to run the methods from pengrobinson model in our test model.
|
Highlight the line | In the end, we define the METHOD on_load in which we run specify and values.
Now end the test model. |
Open the model in ASCEND and run the on_load method | Open this model in ASCEND. |
Point as per narration | Under Modules section, you will see two names
peng robinsing and test model |
Point as per narration | In the panel below you will see the message
|
Point as per narration | As we have used WILL_BE in peng robinson, we can’t execute this model.
|
Point as per narration | Now double click on test.
The model opens under Simulation. |
Point as per narration | Now run the on_load method and click on Solve |
Point as per narration | You will see pressure, temperature are the fixed variables.
|
Open Slide number 8
Summary |
Now, let us summarize. In this tutorial, we have learnt how to:
|
Open Slide number 9
Assignment |
As an assignment, try to modify pengrobinson model to solve the value of V.
Also re-use this model in a test model, to compute value of V for ethylene. |
Open Slide number 10
About the Spoken Tutorial Project |
Information on the spoken tutorial project is available on our website
spoken-tutorial.org |
Open Slide number 11
Spoken Tutorial Workshops |
Details on Workshops based on spoken tutorials is also available on the website |
Open Slide number 12
Acknowledgements |
Spoken tutorial project is funded by NMEICT,MHRD
|
Open Slide number 13
Thank You |
This is Priya Bagde from IIT Bombay signing off
Thank You for joining |