Class EclipseFluidReadWrite

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

public class EclipseFluidReadWrite extends Object

EclipseFluidReadWrite class.

Version:
$Id: $Id
Author:
asmund
  • Field Details

    • logger

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

      public static String pseudoName
      Constant pseudoName=""
  • Constructor Details

    • EclipseFluidReadWrite

      public EclipseFluidReadWrite()
  • Method Details

    • setComposition

      public static void setComposition(SystemInterface fluid, String inputFile, String pseudoNameIn)

      setComposition.

      Parameters:
      fluid - a SystemInterface object
      inputFile - a String object
      pseudoNameIn - a String object
    • setComposition

      public static void setComposition(SystemInterface fluid, String inputFile)

      setComposition.

      Parameters:
      fluid - a SystemInterface object
      inputFile - a String object
    • read

      public static SystemInterface read(String inputFile, String pseudoNameIn)

      read.

      Parameters:
      inputFile - a String object
      pseudoNameIn - a String object
      Returns:
      a SystemInterface object
    • read

      public static SystemInterface read(String inputFile)

      read.

      Parameters:
      inputFile - a String object
      Returns:
      a SystemInterface object
      Throws:
      IllegalArgumentException - if the input file does not exist or cannot be read
    • read

      public static SystemInterface read(String inputFile, boolean addWater)
      Read an Eclipse E300 fluid file and optionally add a water component.

      When addWater is true and the fluid does not already contain water, a water component is added with zero mole fraction and binary interaction parameters (kij) of 0.5 against all other components. This matches the water parameterization used in PVTsim-generated E300 files (e.g., osebergfluid_water.e300). Multi-phase check is also enabled so that an aqueous phase can form.

      Parameters:
      inputFile - path to the Eclipse E300 fluid file
      addWater - if true, add a water component with default kij = 0.5
      Returns:
      a SystemInterface object
      Throws:
      IllegalArgumentException - if the input file does not exist or cannot be read
    • read

      public static SystemInterface read(String inputFile, boolean addWater, double waterKij)
      Read an Eclipse E300 fluid file and optionally add a water component with a custom kij value.

      When addWater is true and the fluid does not already contain water, a water component is added with zero mole fraction and the specified binary interaction parameter (kij) against all other components. Multi-phase check is enabled so that an aqueous phase can form.

      Parameters:
      inputFile - path to the Eclipse E300 fluid file
      addWater - if true, add a water component
      waterKij - binary interaction parameter between water and all other components (typical value: 0.5)
      Returns:
      a SystemInterface object
      Throws:
      IllegalArgumentException - if the input file does not exist or cannot be read
    • read

      public static SystemInterface read(String inputFile, String pseudoNameIn, boolean addWater)
      Read an Eclipse E300 fluid file with a pseudo-name suffix and optionally add a water component.
      Parameters:
      inputFile - path to the Eclipse E300 fluid file
      pseudoNameIn - pseudo-name suffix appended to pseudo-component names
      addWater - if true, add a water component with default kij = 0.5
      Returns:
      a SystemInterface object
      Throws:
      IllegalArgumentException - if the input file does not exist or cannot be read
    • read

      public static SystemInterface read(String inputFile, String pseudoNameIn, boolean addWater, double waterKij)
      Read an Eclipse E300 fluid file with a pseudo-name suffix and optionally add a water component with a custom kij value.
      Parameters:
      inputFile - path to the Eclipse E300 fluid file
      pseudoNameIn - pseudo-name suffix appended to pseudo-component names
      addWater - if true, add a water component
      waterKij - binary interaction parameter between water and all other components
      Returns:
      a SystemInterface object
      Throws:
      IllegalArgumentException - if the input file does not exist or cannot be read
    • addWaterToFluid

      public static void addWaterToFluid(SystemInterface fluid, double waterKij)
      Add a water component to an existing fluid with specified binary interaction parameters.

      This method adds water as a component with zero mole fraction to a fluid that was typically read from an E300 file without water. The water component is added with standard NeqSim water properties from the component database, a specified kij value against all other components (default: 0.5), a volume correction constant of 0.084004, and a parachor parameter of 10.0 (matching PVTsim water calibration). Multi-phase check is enabled so that an aqueous phase can be identified.

      If the fluid already contains a water component, this method does nothing.

      Parameters:
      fluid - the fluid to add water to
      waterKij - binary interaction parameter between water and all other components (typical value: 0.5)
    • read

      public static SystemInterface read(String inputFile, String[] fluidNames)

      read.

      Parameters:
      inputFile - a String object representing the path to the input file
      fluidNames - an array of String objects representing the names of the fluids
      Returns:
      a SystemInterface object representing the thermodynamic system
      Throws:
      IllegalArgumentException - if the input file does not exist or cannot be read
    • readE300File

      public static SystemInterface readE300File(String inputFile)

      readE300File.

      Parameters:
      inputFile - a String object
      Returns:
      a SystemInterface object
      Throws:
      IllegalArgumentException - if the input file does not exist or cannot be read
    • write

      public static void write(SystemInterface fluid, String outputFile) throws IOException
      Write a NeqSim fluid to Eclipse E300 compositional EOS file format.

      The exported file contains all EOS parameters needed to recreate the fluid in Eclipse 300 or read it back into NeqSim, including: component names, critical properties, acentric factors, molecular weights, volume shifts, parachors, mole fractions, and binary interaction coefficients.

      Parameters:
      fluid - the fluid to export
      outputFile - path to output file (e.g., "myfluid.e300")
      Throws:
      IOException - if writing fails
    • write

      public static void write(SystemInterface fluid, String outputFile, double reservoirTempC) throws IOException
      Write a NeqSim fluid to Eclipse E300 compositional EOS file format.
      Parameters:
      fluid - the fluid to export
      outputFile - path to output file
      reservoirTempC - reservoir temperature in Celsius for RTEMP keyword
      Throws:
      IOException - if writing fails
    • write

      public static void write(SystemInterface fluid, Path outputPath, double reservoirTempC) throws IOException
      Write a NeqSim fluid to Eclipse E300 compositional EOS file format.
      Parameters:
      fluid - the fluid to export
      outputPath - output file path
      reservoirTempC - reservoir temperature in Celsius
      Throws:
      IOException - if writing fails
    • toE300String

      public static String toE300String(SystemInterface fluid)
      Convert a NeqSim fluid to Eclipse E300 format string.
      Parameters:
      fluid - the fluid to export
      Returns:
      E300 format content as string
    • toE300String

      public static String toE300String(SystemInterface fluid, double reservoirTempC)
      Convert a NeqSim fluid to Eclipse E300 format string.
      Parameters:
      fluid - the fluid to export
      reservoirTempC - reservoir temperature in Celsius
      Returns:
      E300 format content as string
    • writeToWriter

      private static void writeToWriter(SystemInterface fluid, Writer writer, double reservoirTempC) throws IOException
      Internal method to write E300 content to a Writer.
      Parameters:
      fluid - the fluid to export
      writer - output writer
      reservoirTempC - reservoir temperature in Celsius
      Throws:
      IOException - if writing fails
    • isPFCTViscosityModelActive

      private static boolean isPFCTViscosityModelActive(SystemInterface fluid)
      Check if PFCT (Pedersen) viscosity model is active on any phase.
      Parameters:
      fluid - the fluid
      Returns:
      true if PFCT viscosity model is active
    • getEOSType

      private static String getEOSType(SystemInterface fluid)
      Determines the EOS type string for the fluid.
      Parameters:
      fluid - the fluid
      Returns:
      EOS type string (SRK, PR, etc.)
    • shortenComponentName

      private static String shortenComponentName(String name)
      Shortens component names to E300 compatible format.
      Parameters:
      name - original component name
      Returns:
      shortened name
    • getBinaryInteractionParameters

      private static double[][] getBinaryInteractionParameters(SystemInterface fluid)
      Gets binary interaction parameters from fluid.
      Parameters:
      fluid - the fluid
      Returns:
      2D array of kij values
    • applyLBCViscosityModel

      private static void applyLBCViscosityModel(SystemInterface fluid, double[] lbcParams)
      Apply LBC viscosity model with custom parameters to fluid.
      Parameters:
      fluid - the fluid to configure
      lbcParams - array of 5 LBC dense contribution parameters
    • applyPFCTViscosityModel

      private static void applyPFCTViscosityModel(SystemInterface fluid)
      Apply PFCT (Pedersen) viscosity model to all phases.
      Parameters:
      fluid - the fluid to configure
    • getLBCParametersFromFluid

      private static double[] getLBCParametersFromFluid(SystemInterface fluid)
      Get LBC parameters from fluid if LBC viscosity model is active.
      Parameters:
      fluid - the fluid
      Returns:
      array of 5 LBC parameters, or null if not using LBC model