Tutorials: Flash Calculations
This tutorial will show how to perform flash calculations using JSteam and the REFPROP thermodynamic engine. A flash calculation is used to determine whether a particular fluid or mixture is in the liquid or vapour phase, or whether a 2-phase solution exists. The flash calculation requires an iterative solution that is computationally intensive.
This model assumes the standard JSteam units (°C,bar,tonne/hr,kW,mass basis).
Implicit Flash Calculation
Whenever you call one of the JSteam pure fluid or mixture functions, you are implicitly solving a flash calculation using REFPROP. This is because for a given pressure and temperature (or other compatible property pair), the thermodynamic engine must know what phase the fluid/mixture is in, before it can calculate the remaining properties.
To illustrate, consider one of the simplest routines
HcPT. This routine calculates the Specific Enthalpy of a pure fluid, given its pressure and temperature. We will examine its use now with JSteam:
Open a new Excel Workbook, and Load JSteam. Click on Cell B3, and from the JSteam Ribbon click Insert Function, and insert the
HcPT function from General Thermodynamics -> Pure Fluid -> Enthalpy -> HcPT:
Repeat the above step, and paste another HcPT function in Cell E3. Your sheet should now look like the below, if you add the optional titles as well:
Step 2 Next we will enter some specifications for water, resulting in super-heated and sub-cooled enthalpy values. Enter the following values:
- Fluid - Enter 'Water' (without quotes) in both C3 and F3.
- Pressure - Enter 1 in both C4 and F4.
- Temperature - Enter 150 in C5, and enter 60 in F5.
Your sheet should now look like the below:
At this point you have now completed two flash calculations. You may be wondering, what if I had used
HPT instead? Because IAPWS-97 is a high-speed library dedicated to only water and steam, it has a look-up table that allows it to work out whether the fluid is liquid or vapour, thus saving the expensive flash calculation. Therefore when working with water/steam, you should always use the dedicated water/steam routines, unless super high accuracy is required.
Step 3 It's a good a idea to validate our hypothesis that the conditions entered actually resulted in vapour and liquid. Enter the following functions:
- Cell C7:
- Cell F7:
On each cell apply the efficiency style, and tidy it up by labelling the cell as Quality and completing the box around it:
At this point you have now completed two more flash calculations, in order to calculate the quality (vapour fraction) of each fluid. Remember that when specifying pressure and temperature for a pure fluid, you will only ever see pure liquid or pure vapour - it is not possible to specify a 2-phase fluid with P & T alone.
Step 4 Let's compare what would happen if we skipped the flash calculation, and just assumed the fluid is always a vapour. This might be sensible if you are working with super heated steam exiting a boiler, but what about the discharge from a back-pressure turbine - is there a chance it could contain a small fraction of liquid?
Click on Cell B10, and from the JSteam Ribbon click Insert Function, and insert the
HcPTvap function from General Thermodynamics -> Pure Fluid -> Enthalpy -> HcPTvap. Repeat in Cell E10:
HcPTvap function uses the same underlying thermodynamic engine, but assumes the fluid is in the vapour phase. We will now see what happens if that is not the case!
Copy down the specifications from the
HcPT function tables above each respective
HcPTvap table, to result in the following:
Now have a look at the enthalpy returned for the liquid table - seems a little high?
Step 5 As we did previously in Step 3, add the following equations to check the quality. In this case we will use the enthalpy values, rather than the input temperature values:
- Cell C14:
- Cell F14:
Now we can see its obvious that
HcPTvap has not only incorrectly calculated the enthalpy for the liquid table, but it has returned a value that is in the 2-phase region.
The morale here is that while a flash calculation may be computationally expensive (and therefore take longer to run), if you can't guarantee that the fluid/mixture is always operating in the vapour region, then don't use the
vap routines. They are provided for advanced use only, and you are safer to always perform the implicit flash calculation!
Note: The above examples work the same for mixtures as well.
Explicit Flash Calculation
Generally, the flash calculation is performed by JSteam and REFPROP behind the scenes, and you don't even know it is being run. This is the way JSteam was intended to be used. However there may be times when you wish to perform an explicit flash calculation on a mixture, and view the resulting liquid and vapour mixtures. This is equivalent to passing a mixture through a throttling valve (lowering the pressure) and splitting the vapour and liquid streams within a flash drum.
For this example, either in the same workbook (but different sheet) as the implicit example, or in a new workbook, click on Cell B3, and from the JSteam Ribbon click Insert Function, and insert the
FlashmPT function from General Thermodynamics -> Mixture -> Flash Routines -> FlashmPT:
JSteam will automatically add a FuelMixtures and RefrigMixtures sheet whenever a mixture function is inserted, if they don't already exist. Your sheet should now look similar to the below figure:
Step 2 In order to complete the flash calculation, we need to create a mixture. Select the "RefrigMixtures" sheet, and within the second mixture column (Refrig2), add a 50/50 mix of R600 (n-Butane) and R601 (n-Pentane). You may optionally give this mixture a name if you like.
Step 3 Return to the sheet with the flash calculation, and within the "Mixture" field, reference the "Refrig2" Cell in the RefrigMixtures sheet. If you are unsure about this step, see the Getting Started Guide.
Note that the flash calculation has completed, even though we have not entered a pressure or temperature. In this case, an empty cell in Excel is treated as 0, so it has solved assuming 0 bar, 0 deg C.
Complete the remaining specifications:
- Cell C4 - Pressure - 1
- Cell C5 - Temperature - 20
The flash calculation is now complete, noting we have specified a 2-phase region (70% vapour) of the mixture. Remember that within a 2-phase region heat capacity is undefined, hence the #'s in the returned results.
Step 4 Looking at the Liquid and Vapour Mixture results, you will see some obscure letters and characters. This is an internal code that JSteam uses to represent mixtures within Excel, to avoid creating an entire mixtures sheet for each output. This code can be used to extract the mixture fractions using the advanced user function
To illustrate, click on Cell E3, and from the JSteam Ribbon click Insert Function, and insert the
GetMixtureFrac function from Support Functions-> Get Mixture Fractions, ensuring you specified "nButane,nPentane" as the return arguments.
Repeat for Cell H3 as well.
To extract the mixture fractions, simply reference the codes returned by the flash routine:
- Cell F3: =C12
- Cell I3: =C13
The mole fractions of each mixture will now be displayed within each table:
Using this technique you can include multi-component (mixture) flash drums within your JSteam models, and export the mixture fractions back to a Refrigerant or FuelGas sheet. The Excel iterative solver will take care of the rest!
Note: Flash routines work best with PH or PS property pairs, as they allow more accurate fluid specification within the saturated region