Use of Functions III – Parameter Lists and Indices

Model description

The model consists of very basic flash equations, i.e., the component mole balances, phase equilibria (VLE), and the summation of mole fractions in liquid and vapor phase. The temperature is constant:

   F \cdot z_c = L \cdot x_c + V \cdot y_c \\[2ex] x_c \cdot P^{LV}_{c} = y_c \cdot P \\[2ex] 1 = \sum_{c=1}^{NC} x_c \\[2ex] 1 = \sum_{c=1}^{NC} y_c \\[2ex]

Therein, the vapor pressure P^{LV} is to be calculated via a DIPPR equation, which will again be treated as a function:

 P^{LV} ( T ) = \exp(A + \frac{B}{T} + C \cdot \ln(T) + D \cdot T^E).

As the parameters in this functions specify the mixture used in this process, it makes sense to specify them in a parameter list. Thus, we could set up another paramater specification for another mixture and could solve this system with the same variable specification.

Workflow

Notation of equation system

For the notation of the equation, we need to set up the following symbols. Note that we do not define the parameters of the DIPPR equation in a separate notation for simplicity (although it would be possible). However, we will use a parameter list:

Base names
  • A, DIPPR parameter A 
  • B, DIPPR parameter B in K
  • C, DIPPR parameter C 
  • D, DIPPR parameter D in 1/T^E
  • E, DIPPR parameter E
  • F, feed mole flow in kmol/h
  • L, liquid mole flow in kmol/h
  • P, pressure in Pa
  • T, temperature in K
  • V, vapor mole flow in kmol/h 
  • x, liquid mole fraction in mol/mol
  • y, vapor mole fraction in mol/mol
  • z, feed mole fraction in mol/mol
Superscripts
  • LV, phase equilibrium
Indices
  • c, component index 1…NC

The resulting notation has ID 182668.

Parameter list

After the notation has been set up, we can move to the Parameter List tab. Here, we take the following steps:

  1. Load the notation that was created in the previous step
  2. Add all parameter by clicking on the “+” button, writing the parameter into the Tex Expression, rendering, and confirming. Add the parameters in their general form, i.e., A, B, C, D, and E. This is how they will be used in the function. Do not add any component index
  3. Save the parameter list

The parameter list is saved with ID 182669.

Equations

Now formulate the equations of the model and save them. The parameter list does not need to be loaded for any of the equations.

The equations of this example have the IDs 182670, 182671, 182672, and 182673.

Definition of function

To create the DIPPR function for the vapor pressure, we take the following steps:

  1. Load the notation of this example
  2. Load the parameter list of this example
  3. Add an informative description of the function
  4. Make sure that Free interface and Specify formula are selected in the Interface & Body Settings
  5. Move to the tab Interface Specifications; add P^{LV} as output and T as input. Theoretically, it would make sense to use engineering units for this example, but we will not do that in this example. As a result, we need to make sure manually that our equations are unit-consistent
  6. Move to the tab Body Specification and add the formula from the section on the model formulation from above: \exp(A + \frac{B}{T} + C \cdot \ln(T) + D \cdot T^E)
  7. Save the function

The function has ID 182674.

Equation system

Go to the tab Equation System and add your equations in the same way as in the previous examples. Then go to the Functions tab within the equation system and take the following steps:

  1. Add the function by clicking on the “Add” button at the bottom
  2. Add an application by clicking on “Add Application”
  3. Add P_c^{LV} as Applied Naming for the output and T as Applied Naming for the input
  4. Add the parameters 
  5. A_c, B_c, C_c, D_c, and E_c (now with component index!) as Applied Naming for the parameters
  6. Confirm that and confirm again to close the popup windows. You should now see one application of the function within the equation system

The resulting equation system has ID 182675.

Evaluation / Simulation

Next, we can move to the “Simulation” section and load the equation system we just created. Then, we take the following steps:

  1. Add a description for your simulation
  2. In the tab on the Generic System, go to Functions and check whether MOSAICmodeling confirms two usages of the function in one application
  3. Go to Indexing and enter 2 as Max Value for NC; then click on Confirm Index Data
  4. Go to the Specifications tab and assign the following variables as design values:
    • F
    • P
    • T
    • z_{c=1}
    • z_{c=2}
  5. Assign the remaining six variables – i.e., L, V, x_{c=1}, x_{c=2}, y_{c=1}, and y_{c=2} – as iteration values
  6. Now you may wonder where your parameters for the vapor pressure function are. Therefore, go to the Parameters tab where you should find these ten parameters

Initialization and results

To initialize and specify the model, take the following steps:

  1. Initialize this example with the design values and initial guesses given in Table 1
  2. Save the variable specification 
  3. Enter the parameter values given in Table 1
  4. Save the parameter specification
  5. Save the simulation
  6. Go to the Evaluation tab and generate the code for your preferred environment / software package
  7. Simulate the flash

This simulation is available with ID 182676 with variable specification 182677 and parameter specification 182678. The solution for all iteration variables is also given in Table 1.

NameDescriptionValue / Initial guessSolution
FFeed mole flow in kmol/h1.0
PPressure in Pa101325
TTemperature in K354.6
z_{c=1}Feed mole fraction of component 1 in mol/mol0.5
z_{c=2}Feed mole fraction of component 2 in mol/mol0.5
A_{c=1}Parameter in DIPPR equation82.718 
B_{c=1}Parameter in DIPPR equation-6904.5 
C_{c=1}Parameter in DIPPR equation-8.8622 
D_{c=1}Parameter in DIPPR equation7.4664E-6 
E_{c=1}Parameter in DIPPR equation2.0 
A_{c=2}Parameter in DIPPR equation73.649 
B_{c=2}Parameter in DIPPR equation-7258.2 
C_{c=2}Parameter in DIPPR equation-7.3037 
D_{c=2}Parameter in DIPPR equation4.1653E-6 
E_{c=2}Parameter in DIPPR equation2.0 
P_{c=1}^{LV}Calculated vapor pressure of component 1 in Pa190176.44
P_{c=1}^{LV}Calculated vapor pressure of component 2 in Pa50216.55
LLiquid mole flow in kmol/h0.50.57892
VVapor mole flow in kmol/h0.50.42108
x_{c=1}Liquid mole fraction of component 1 in mol/mol0.50.36516
x_{c=2}Liquid mole fraction of component 2 in mol/mol0.50.63484
y_{c=1}Vapor mole fraction of component 1 in mol/mol0.50.68538
y_{c=2}Vapor mole fraction of component 2 in mol/mol0.50.31462
Table 1: Overview of parameter values, initial guesses, and the solution.