Class WhitsonPVTReader

java.lang.Object
neqsim.thermo.util.readwrite.WhitsonPVTReader

public class WhitsonPVTReader extends Object
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:

  1. Parameters section: EOS type, LBC coefficients, Gamma parameters, Omega values
  2. Component table: Component properties with header row
  3. 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
  • Field Details

    • logger

      static org.apache.logging.log4j.Logger logger
      Logger object for class.
    • eosType

      private String eosType
      EOS parameters.
    • omegaA

      private double omegaA
    • omegaB

      private double omegaB
    • lbcP0

      private double lbcP0
      LBC 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 gammaShape
      C7+ Gamma distribution parameters.
    • gammaBound

      private double gammaBound
    • components

      private List<WhitsonPVTReader.ComponentData> components
      Component data.
    • bipMatrix

      private double[][] bipMatrix
      BIP matrix.
    • componentIndex

      private Map<String,Integer> componentIndex
      Component name to index mapping.
  • Constructor Details

    • WhitsonPVTReader

      public WhitsonPVTReader()
  • Method Details

    • read

      public static SystemInterface read(String filePath) throws IOException
      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

      public static SystemInterface read(String filePath, double[] molarComposition) throws IOException
      Read a Whitson PVT parameter file and create a NeqSim fluid with specified molar composition.
      Parameters:
      filePath - path to the parameter file
      molarComposition - array of molar fractions (same order as components in file)
      Returns:
      configured SystemInterface fluid
      Throws:
      IOException - if file cannot be read
    • parseFile

      private void parseFile(String filePath) throws IOException
      Parse the Whitson PVT parameter file.
      Parameters:
      filePath - path to the file
      Throws:
      IOException - if file cannot be read
    • parseParameterLine

      private void parseParameterLine(String line)
      Parse a parameter line (key-value pair).
    • parseComponentLine

      private void parseComponentLine(String line)
      Parse a component data line.
    • parseBipLine

      private void parseBipLine(String line, int numComponents, List<double[]> bipRows)
      Parse a BIP matrix row.
    • parseDouble

      private double parseDouble(String value)
      Parse a double value, handling empty or invalid strings.
    • createFluid

      private SystemInterface createFluid()
      Create a NeqSim fluid from the parsed data.
      Returns:
      configured SystemInterface
    • createFluid

      private SystemInterface createFluid(double[] molarComposition)
      Create a NeqSim fluid with specified molar composition.
      Parameters:
      molarComposition - molar fractions
      Returns:
      configured SystemInterface
    • applyLBCViscosityModel

      private void applyLBCViscosityModel(SystemInterface fluid)
      Apply LBC viscosity model with parameters from the Whitson PVT file.
      Parameters:
      fluid - the fluid to configure
    • createEosSystem

      private SystemInterface 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 modify
      phase - The phase index
      name - The component name
      comp - The component data containing properties
      tcKelvin - Critical temperature in Kelvin
      tbKelvin - Normal boiling point in Kelvin
    • setBinaryInteractionParameters

      private void setBinaryInteractionParameters(SystemInterface fluid)
      Set binary interaction parameters from the parsed BIP matrix.
    • isC7PlusFraction

      private boolean isC7PlusFraction(String name)
      Check if component name indicates a C7+ fraction.
    • mapToStandardName

      private String mapToStandardName(String name)
      Map Whitson component names to NeqSim standard names.
    • 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

      public List<String> getComponentNames()
      Get component names.
      Returns:
      list of component names