Class FlashTable
java.lang.Object
neqsim.process.equipment.pipeline.twophasepipe.FlashTable
- All Implemented Interfaces:
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 Summary
FieldsModifier and TypeFieldDescriptionprivate doublePressure step size.private doubleTemperature step size.private double[][]private double[][]private double[][]private double[][]private double[][]private double[][]private double[][]private booleanFlag indicating table is built.private double[][]private double[][]private double[][]private double[][]private double[][]private double[][]private intNumber of pressure points.private intNumber of temperature points.private doubleMaximum pressure (Pa).private doubleMinimum pressure (Pa).private double[]Pressure grid points (Pa).private static final longprivate double[][]private double[]Temperature grid points (K).private doubleMaximum temperature (K).private doubleMinimum temperature (K). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate doublebilinearInterp(double[][] table, int iP, int iT, double wP, double wT) Bilinear interpolation helper.voidbuild(SystemInterface referenceFluid, double pressureMin, double pressureMax, int numPressurePoints, double temperatureMin, double temperatureMax, int numTemperaturePoints) Build the flash table from a reference fluid.voidclear()Clear the table to free memory.longEstimate memory usage of the table in bytes.doubleGet maximum pressure of table range.doubleGet maximum temperature of table range.doubleGet minimum pressure of table range.doubleGet minimum temperature of table range.intGet number of pressure points.intGet number of temperature points.double[]Get pressure grid points.doublegetProperty(String property, double pressure, double temperature) Get a specific property value using bilinear interpolation.double[]Get temperature grid points.intGet total number of grid points.interpolate(double pressure, double temperature) Interpolate properties at given P-T conditions.booleanisBuilt()Check if table is built.
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
pressures
private double[] pressuresPressure grid points (Pa). -
temperatures
private double[] temperaturesTemperature grid points (K). -
nP
private int nPNumber of pressure points. -
nT
private int nTNumber of temperature points. -
pMin
private double pMinMinimum pressure (Pa). -
pMax
private double pMaxMaximum pressure (Pa). -
tMin
private double tMinMinimum temperature (K). -
tMax
private double tMaxMaximum temperature (K). -
dP
private double dPPressure step size. -
dT
private double dTTemperature 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 isBuiltFlag 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 calculationspressureMin- Minimum pressure (Pa)pressureMax- Maximum pressure (Pa)numPressurePoints- Number of pressure grid pointstemperatureMin- Minimum temperature (K)temperatureMax- Maximum temperature (K)numTemperaturePoints- Number of temperature grid points
-
interpolate
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 tableiP- pressure indexiT- temperature indexwP- pressure weightwT- temperature weight- Returns:
- interpolated value
-
getProperty
Get a specific property value using bilinear interpolation.- Parameters:
property- Property namepressure- 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.
-