Class FlashTable

java.lang.Object
neqsim.process.equipment.pipeline.twophasepipe.FlashTable
All Implemented Interfaces:
Serializable

public class FlashTable extends Object implements Serializable
Pre-computed flash property table for fast interpolation.

Stores thermodynamic properties on a P-T grid for rapid lookup during transient simulations. Avoids expensive flash calculations at each time step by using bilinear interpolation.

Usage

FlashTable table = new FlashTable();
table.build(referenceFluid, 1e5, 100e5, 50, 250.0, 400.0, 40);
thermoCoupling.setFlashTable(table);

Accuracy Considerations

  • Grid resolution affects interpolation accuracy near phase boundaries
  • Use finer grids near critical point or phase envelope
  • Consider adaptive refinement for high-accuracy applications
Version:
1.0
Author:
Even Solbraa
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • pressures

      private double[] pressures
      Pressure grid points (Pa).
    • temperatures

      private double[] temperatures
      Temperature grid points (K).
    • nP

      private int nP
      Number of pressure points.
    • nT

      private int nT
      Number of temperature points.
    • pMin

      private double pMin
      Minimum pressure (Pa).
    • pMax

      private double pMax
      Maximum pressure (Pa).
    • tMin

      private double tMin
      Minimum temperature (K).
    • tMax

      private double tMax
      Maximum temperature (K).
    • dP

      private double dP
      Pressure step size.
    • dT

      private double dT
      Temperature step size.
    • gasDensity

      private double[][] gasDensity
    • liquidDensity

      private double[][] liquidDensity
    • gasViscosity

      private double[][] gasViscosity
    • liquidViscosity

      private double[][] liquidViscosity
    • gasEnthalpy

      private double[][] gasEnthalpy
    • liquidEnthalpy

      private double[][] liquidEnthalpy
    • gasSoundSpeed

      private double[][] gasSoundSpeed
    • liquidSoundSpeed

      private double[][] liquidSoundSpeed
    • surfaceTension

      private double[][] surfaceTension
    • gasVaporFraction

      private double[][] gasVaporFraction
    • gasCp

      private double[][] gasCp
    • liquidCp

      private double[][] liquidCp
    • gasCompressibility

      private double[][] gasCompressibility
    • liquidCompressibility

      private double[][] liquidCompressibility
    • isBuilt

      private boolean isBuilt
      Flag indicating table is built.
  • Constructor Details

    • FlashTable

      public FlashTable()
      Default constructor.
  • Method Details

    • build

      public void build(SystemInterface referenceFluid, double pressureMin, double pressureMax, int numPressurePoints, double temperatureMin, double temperatureMax, int numTemperaturePoints)
      Build the flash table from a reference fluid.
      Parameters:
      referenceFluid - Fluid system to use for flash calculations
      pressureMin - Minimum pressure (Pa)
      pressureMax - Maximum pressure (Pa)
      numPressurePoints - Number of pressure grid points
      temperatureMin - Minimum temperature (K)
      temperatureMax - Maximum temperature (K)
      numTemperaturePoints - Number of temperature grid points
    • interpolate

      public ThermodynamicCoupling.ThermoProperties interpolate(double pressure, double temperature)
      Interpolate properties at given P-T conditions.
      Parameters:
      pressure - Pressure (Pa)
      temperature - Temperature (K)
      Returns:
      Interpolated thermodynamic properties
    • bilinearInterp

      private double bilinearInterp(double[][] table, int iP, int iT, double wP, double wT)
      Bilinear interpolation helper.
      Parameters:
      table - 2D interpolation table
      iP - pressure index
      iT - temperature index
      wP - pressure weight
      wT - temperature weight
      Returns:
      interpolated value
    • getProperty

      public double getProperty(String property, double pressure, double temperature)
      Get a specific property value using bilinear interpolation.
      Parameters:
      property - Property name
      pressure - Pressure (Pa)
      temperature - Temperature (K)
      Returns:
      Interpolated property value
    • isBuilt

      public boolean isBuilt()
      Check if table is built.
      Returns:
      True if table has been built
    • getMinPressure

      public double getMinPressure()
      Get minimum pressure of table range.
      Returns:
      Minimum pressure (Pa)
    • getMaxPressure

      public double getMaxPressure()
      Get maximum pressure of table range.
      Returns:
      Maximum pressure (Pa)
    • getMinTemperature

      public double getMinTemperature()
      Get minimum temperature of table range.
      Returns:
      Minimum temperature (K)
    • getMaxTemperature

      public double getMaxTemperature()
      Get maximum temperature of table range.
      Returns:
      Maximum temperature (K)
    • getNumPressurePoints

      public int getNumPressurePoints()
      Get number of pressure points.
      Returns:
      Number of pressure grid points
    • getNumTemperaturePoints

      public int getNumTemperaturePoints()
      Get number of temperature points.
      Returns:
      Number of temperature grid points
    • getPressures

      public double[] getPressures()
      Get pressure grid points.
      Returns:
      Array of pressure values (Pa)
    • getTemperatures

      public double[] getTemperatures()
      Get temperature grid points.
      Returns:
      Array of temperature values (K)
    • getTotalGridPoints

      public int getTotalGridPoints()
      Get total number of grid points.
      Returns:
      Total grid points (nP * nT)
    • estimateMemoryUsage

      public long estimateMemoryUsage()
      Estimate memory usage of the table in bytes.
      Returns:
      Approximate memory usage in bytes
    • clear

      public void clear()
      Clear the table to free memory.