Elham Esfehani
Requirements for this tutorial
This is an advanced tutorial that needs the basics explained in other sections of this learning trail. The following should have been worked through or prepared before this tutorial is started:
- Notations and Variables – Superscripts, Subscripts,Indices should have been worked through and the example created. They should be available for reuse in the learner’s repository. The equations are also given below for reference.
- Parameter lists I – basic use should be completed as a basic understanding of the use of parameter lists is necessary here.
Example problem
Equation system
Equation System eq_sys_flash
Notation nota_flash
Base Names
[table sort=”desc,asc”]
Name,Description
,Dippr parameter A in –
,Bottom molar flow in kmol/h Dippr parameter B in K
,Dippr parameter C in –
,Head molar flow in kmol/h Dippr parameter D in –
,Dippr parameter E in –
,Feed molar flow in kmol/h
,Constant. Phase equilibrium and others
,Pressure in Pa
,Temperature in K
,Bottom molar fraction in mol/mol
,Head molar fraction in mol/mol
,Feed molar fraction in mol/mol
[/table]
Superscripts
[table sort=”desc,asc”]
Name,Description
,Phase equilibrium
,Parameter
[/table]
Subscripts
[table sort=”desc,asc”]
Name,Description
,Reference value
[/table]
Indices
[table sort=”desc,asc”]
Name,Description
,Component index 1…NC
[/table]
Use of a function
For the calculation of the vapor pressure a DIPPR function is used. As the parameters in this functions specify the mixture used in this process it makes sense to specify them in a parameter list.
Function vapor_pressure_dippr
Notation nota_thermo_variables
Base Names
[table sort=”desc,asc”]
Name, Description
, Pressure in Pa
, Temperature in K
[/table]
Parameter List params_thermo_dippr
Notation nota_thermo_dippr
Base Names
[table sort=”desc,asc”]
Name, Description
,parameter A
,parameter B
,parameter C
,parameter D
,parameter E
,parameter T
,parameter p
[/table]
Superscripts
[table sort=”desc,asc”]
Name, Description
,indicating a scaling/reference
[/table]
Problem description
Index maximum value:
NC = 2
Design variables and their values:
F = 1.0
z_{i=1} = 0.5
p = 101325
T = 354.6
Iteration Variables and their initial values:
B = 0.5
D = 0.5
Specification of physical parameters:
[table]
i,Component,A,B,C,D,E
1,Methanol,81.1,-6880.0,-8.71, 4.05E-6, 2.0
2,Water,72.6,-7210.0,-7.14,7.19E-6,2.0
[/table]
Specification of scaling/reference parameters:
[table]
Name,Value, Engineering Unit
,1,K
,1,Pa
[/table]
Expected simulation results:
B = 0.715
D = 0.285
Creating the parameter list
- Create ‘nota_thermo_dippr’.
- Create the parameter list ‘params_thermo_dippr’ which uses ‘notation_thermo_dippr’. If you have problems here, refer to the previous sections . Attention: The parameters of the list do not have any index.
Creating the function
- Create ‘nota_thermo_variables’.
- Select the Function Editor in the Model Panel.
- Select ‘nota_thermo_variables’ in the Notation file panel.
- Select ‘params_thermo_dippr’ in the Parameters file panel.
- Enter a Description for the new function.
- In the tab Interface & Body Settings check that Free Interface and Specify formula are selected in the comboboxes for the interface respectively body setting.
- Activate the tab Interface Specification.
- Press [Edit Output] and create the variable of the left hand side of the function: ‘p’.
- Press [Add Input] and create the input variable ‘T’.
- Activate the tab Body Specification.
- Enter the right hand side of the dippr function. The latex expression is: p^{sca} \cdot \exp( A + \frac{B}{T} + C \cdot \ln(\frac{T}{T^{sca}} + D\cdot(\frac{T}{T^{sca}})^{E}))
- Save the function.
Creating the equation system and applying the function
- Create the notation ‘nota_flash’. If you want to use the notation created in section 2, you have to extend the existing notation by the base name symbols p and T.
- Create the mentioned equations of the section ”Equation system eq _sys_flash”
- Create a new equation system ‘eq_sys_flash’ using notation ‘nota_flash’ and add the above equations (via naming policy ‘integrate’ without a connector).
- Activate the tab Functions
- Press [Add Function] and load the function created above.
- Have a look at the loaded contents:
- Preview shows the rendered function
- The field Output Naming shows the output variable as it is defined in the function
- The table Input Namings contains the input variable ‘T’.
- There is a section Applications (Function Calls). This section contains an empty table for the Output Variable which later on contains the Applied output namings.
- We have to add an entry into the list for the Applied Namings of the Output Variable.
- Press [Add Application] below the above mentioned table. This brings up the Edit Function Application dialog.
- Press [Edit Output] below the field for the Applied Naming for the Output and enter the name for the vapor pressure as it appears in the equation system with the component index: p_{o,i}^{LV}.
- Double click at T and enter the naming for the temperature as it should/will appear in the equation system: ‘T’.
- Enter the matchings for the parameters: A ->A^{par}_{i}, B ->B^{par}_{i}, C ->C^{par}_{i}, D ->D^{par}_{i}, E ->E^{par}_{i},p^{sca} ->p^{par}, T^{sca} ->T^{par}
- Press [OK] to leave the Edit Function Appliance dialog. The list for the applied output namings contains the entry created above.
- Press [OK] to leave the Add Function Usage dialog.
- Save the equation system.
Evaluating the equation system
- Select the Simulation Editor and activate the Equation System tab.
- Load equation system ‘eq_sys_flash’ created above in the EQ System file panel. You may check if everything is loaded correctly in the Equations and Functions tab.
- Activate the Indexing tab, set the maximum values for the indices to 2 and confirm the indexing.
- Activate the Specifications tab and the Variables sub tab. You will notice that the two P_{o,i}^{LV} are automatically classified as Calculated Variables.
- Enter the problem specification as specified in the beginning of this tutorial.
- HINTS:
- You may select several variables at the same time using the mouse and the control or shift key.
- Pressing [<<] or [>>] changes the classification of all selected variables.
- A right mouse click on the selection brings up a dialog where a value can be entered for all selected variables (useful for initialization values).
- Save the variable specification for later use.
- Activate the Parameters sub tab and enter the parameters as specified above and save this parameter specification.
- Enter a description for the simulation/evaluation.
- Save the Evaluation information using the file panel on top of the Evaluation Editor.
- Generate the code and simulate the flash