Class WhitsonPVTReader
java.lang.Object
neqsim.thermo.util.readwrite.WhitsonPVTReader
Whitson PVT parameter file reader.
This class reads Whitson-style PVT parameter files (e.g., from Whitson+ or similar PVT software) and creates a fully configured NeqSim fluid with:
- Correct EOS type (PR, SRK)
- LBC viscosity model with custom parameters
- C7+ gamma distribution parameters
- Omega A and Omega B parameters
- Component properties (MW, Pc, Tc, ω, volume shift, Vc, Zc, parachor, SG, Tb)
- Binary interaction parameters (full matrix)
File Format:
The file should be tab-separated with three sections:
- Parameters section: EOS type, LBC coefficients, Gamma parameters, Omega values
- Component table: Component properties with header row
- BIP matrix: Binary interaction parameters with component names as row/column headers
Usage Example:
SystemInterface fluid = WhitsonPVTReader.read("path/to/volveparam.txt");
fluid.setTemperature(373.15);
fluid.setPressure(200.0);
fluid.init(0);
- Version:
- 1.0
- Author:
- ESOL
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classInternal class to hold component data. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate double[][]BIP matrix.Component name to index mapping.private List<WhitsonPVTReader.ComponentData> Component data.private StringEOS parameters.private doubleprivate doubleC7+ Gamma distribution parameters.private doubleprivate doubleLBC viscosity parameters.private doubleprivate doubleprivate doubleprivate double(package private) static org.apache.logging.log4j.LoggerLogger object for class.private doubleprivate double -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidaddComponentToFluid(SystemInterface fluid, WhitsonPVTReader.ComponentData comp, double moles) Add a component to the fluid with all properties from the parameter file.private voidApply LBC viscosity model with parameters from the Whitson PVT file.private SystemInterfaceCreate the appropriate EOS system based on parsed EOS type.private SystemInterfaceCreate a NeqSim fluid from the parsed data.private SystemInterfacecreateFluid(double[] molarComposition) Create a NeqSim fluid with specified molar composition.Get component names.double[]Get the C7+ gamma distribution parameters.double[]Get the LBC viscosity parameters.intGet the number of components.doubleGet the Omega A parameter.doubleGet the Omega B parameter.private booleanisC7PlusFraction(String name) Check if component name indicates a C7+ fraction.private StringmapToStandardName(String name) Map Whitson component names to NeqSim standard names.private voidparseBipLine(String line, int numComponents, List<double[]> bipRows) Parse a BIP matrix row.private voidparseComponentLine(String line) Parse a component data line.private doubleparseDouble(String value) Parse a double value, handling empty or invalid strings.private voidParse the Whitson PVT parameter file.private voidparseParameterLine(String line) Parse a parameter line (key-value pair).static SystemInterfaceRead a Whitson PVT parameter file and create a NeqSim fluid.static SystemInterfaceRead a Whitson PVT parameter file and create a NeqSim fluid with specified molar composition.private voidSet binary interaction parameters from the parsed BIP matrix.private voidsetComponentProperties(SystemInterface fluid, int phase, String name, WhitsonPVTReader.ComponentData comp, double tcKelvin, double tbKelvin) Set all component properties from the data.
-
Field Details
-
logger
static org.apache.logging.log4j.Logger loggerLogger object for class. -
eosType
EOS parameters. -
omegaA
private double omegaA -
omegaB
private double omegaB -
lbcP0
private double lbcP0LBC viscosity parameters. -
lbcP1
private double lbcP1 -
lbcP2
private double lbcP2 -
lbcP3
private double lbcP3 -
lbcP4
private double lbcP4 -
lbcF0
private double lbcF0 -
gammaShape
private double gammaShapeC7+ Gamma distribution parameters. -
gammaBound
private double gammaBound -
components
Component data. -
bipMatrix
private double[][] bipMatrixBIP matrix. -
componentIndex
-
-
Constructor Details
-
WhitsonPVTReader
public WhitsonPVTReader()
-
-
Method Details
-
read
Read a Whitson PVT parameter file and create a NeqSim fluid.- Parameters:
filePath- path to the parameter file- Returns:
- configured SystemInterface fluid
- Throws:
IOException- if file cannot be read
-
read
Read a Whitson PVT parameter file and create a NeqSim fluid with specified molar composition.- Parameters:
filePath- path to the parameter filemolarComposition- array of molar fractions (same order as components in file)- Returns:
- configured SystemInterface fluid
- Throws:
IOException- if file cannot be read
-
parseFile
Parse the Whitson PVT parameter file.- Parameters:
filePath- path to the file- Throws:
IOException- if file cannot be read
-
parseParameterLine
Parse a parameter line (key-value pair). -
parseComponentLine
Parse a component data line. -
parseBipLine
-
parseDouble
Parse a double value, handling empty or invalid strings. -
createFluid
Create a NeqSim fluid from the parsed data.- Returns:
- configured SystemInterface
-
createFluid
Create a NeqSim fluid with specified molar composition.- Parameters:
molarComposition- molar fractions- Returns:
- configured SystemInterface
-
applyLBCViscosityModel
Apply LBC viscosity model with parameters from the Whitson PVT file.- Parameters:
fluid- the fluid to configure
-
createEosSystem
Create the appropriate EOS system based on parsed EOS type. -
addComponentToFluid
private void addComponentToFluid(SystemInterface fluid, WhitsonPVTReader.ComponentData comp, double moles) Add a component to the fluid with all properties from the parameter file. -
setComponentProperties
private void setComponentProperties(SystemInterface fluid, int phase, String name, WhitsonPVTReader.ComponentData comp, double tcKelvin, double tbKelvin) Set all component properties from the data.- Parameters:
fluid- The fluid system to modifyphase- The phase indexname- The component namecomp- The component data containing propertiestcKelvin- Critical temperature in KelvintbKelvin- Normal boiling point in Kelvin
-
setBinaryInteractionParameters
Set binary interaction parameters from the parsed BIP matrix. -
isC7PlusFraction
Check if component name indicates a C7+ fraction. -
mapToStandardName
-
getLBCParameters
public double[] getLBCParameters()Get the LBC viscosity parameters.- Returns:
- array of [P0, P1, P2, P3, P4, F0]
-
getGammaParameters
public double[] getGammaParameters()Get the C7+ gamma distribution parameters.- Returns:
- array of [shape, bound]
-
getOmegaA
public double getOmegaA()Get the Omega A parameter.- Returns:
- Omega A value
-
getOmegaB
public double getOmegaB()Get the Omega B parameter.- Returns:
- Omega B value
-
getNumberOfComponents
public int getNumberOfComponents()Get the number of components.- Returns:
- number of components
-
getComponentNames
-