Class SystemBnsEos

All Implemented Interfaces:
Serializable, Cloneable, SystemInterface

public class SystemBnsEos extends SystemEos
Thermodynamic system implementing the Burgoyne–Nielsen–Stanko PR correlation.
Author:
esol
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • MW_AIR

      private static final double MW_AIR
      See Also:
    • MW_CH4

      private static final double MW_CH4
      See Also:
    • TcCH4

      private static final double TcCH4
    • PcCH4

      private static final double PcCH4
    • VcZcCH4

      private static final double VcZcCH4
    • NUM_BNS_COMPONENTS

      private static final int NUM_BNS_COMPONENTS
      See Also:
    • tcs

      private final double[] tcs
    • pcs

      private final double[] pcs
    • mws

      private final double[] mws
    • acfs

      private final double[] acfs
    • omegaA

      private final double[] omegaA
    • omegaB

      private final double[] omegaB
    • vshift

      private final double[] vshift
    • vshiftField

      private final double[] vshiftField
    • cpCoeffs

      private double[][] cpCoeffs
    • zfractions

      private final double[] zfractions
    • relativeDensity

      private double relativeDensity
    • associatedGas

      private boolean associatedGas
    • mixingRuleDefined

      private boolean mixingRuleDefined
    • componentsInitialized

      private boolean componentsInitialized
  • Constructor Details

    • SystemBnsEos

      public SystemBnsEos()

      Constructor for SystemBnsEos.

    • SystemBnsEos

      public SystemBnsEos(double T, double P)

      Constructor for SystemBnsEos.

      Parameters:
      T - a double
      P - a double
    • SystemBnsEos

      public SystemBnsEos(double T, double P, double sg, double yCO2, double yH2S, double yN2, double yH2, boolean associatedGas)
      Constructs a BNS-PR system with composition.
      Parameters:
      T - a double
      P - a double
      sg - a double
      yCO2 - a double
      yH2S - a double
      yN2 - a double
      yH2 - a double
      associatedGas - a boolean
  • Method Details

    • degRToK

      private static double degRToK(double degR)
    • psiaToBar

      private static double psiaToBar(double psia)
    • tcAg

      private static double tcAg(double x)
    • tcGc

      private static double tcGc(double x)
    • pcFn

      private static double pcFn(double x, double vcSlope, double tc)
    • calcVshift

      private static double calcVshift(double ciField, double omegaB, double tc, double pc)
      Calculates the volume shift parameter.
      Parameters:
      ciField - volume shift field coefficient
      omegaB - PR equation omega B parameter
      tc - critical temperature [K]
      pc - critical pressure [bar]
      Returns:
      volume shift parameter
    • pseudoCritical

      private static double[] pseudoCritical(double sgHc, boolean ag)
    • hydrocarbonSg

      private static double hydrocarbonSg(double sg, double[] zf, double[] mws)
    • compName

      private static String compName(int i)
    • applyBnsBips

      private void applyBnsBips()
    • setComposition

      public void setComposition(double sg, double yCO2, double yH2S, double yN2, double yH2, boolean associatedGas)
      Sets the composition using BNS-specific parameters matching the Python interface. This method matches the Python call: setComposition(sg, yCO2, yH2S, yN2, yH2, associatedGas)
      Parameters:
      sg - relative density (specific gravity)
      yCO2 - mole fraction of CO2 (must be >= 0)
      yH2S - mole fraction of H2S (must be >= 0)
      yN2 - mole fraction of N2 (must be >= 0)
      yH2 - mole fraction of H2 (must be >= 0)
      associatedGas - true for associated gas, false for gas condensate
      Throws:
      IllegalArgumentException - if any mole fraction is negative or sum exceeds 1.0
    • setComposition

      public void setComposition(double yCO2, double yH2S, double yN2, double yH2)
      Sets the composition of the system using mole fractions of CO2, H2S, N2, and H2.
      Parameters:
      yCO2 - mole fraction of CO2 (must be >= 0)
      yH2S - mole fraction of H2S (must be >= 0)
      yN2 - mole fraction of N2 (must be >= 0)
      yH2 - mole fraction of H2 (must be >= 0)
      Throws:
      IllegalArgumentException - if any mole fraction is negative or sum exceeds 1.0
    • setRelativeDensity

      public void setRelativeDensity(double sg)

      Setter for the field relativeDensity.

      Parameters:
      sg - a double (relative density, must be positive)
      Throws:
      IllegalArgumentException - if relative density is not positive
    • setAssociatedGas

      public void setAssociatedGas(boolean ag)

      Setter for the field associatedGas.

      Parameters:
      ag - a boolean
    • updateHydrocarbonProperties

      private void updateHydrocarbonProperties()
      Updates the hydrocarbon pseudo-component properties based on composition and relative density.
    • updateHeatCapacityCoefficients

      private void updateHeatCapacityCoefficients()
      Updates heat capacity coefficients for all components.
    • updateComposition

      private void updateComposition()
    • addBnsComponent

      private void addBnsComponent(String name, double moles, int compIndex)
    • setMixingRule

      public void setMixingRule(int type)
      method to set mixing rule used for the fluid.
      Parameters:
      type - The type of mixing rule to be used for the fluid. 1 - classic mixing rule with all kij set to zero 2 -classic mixing rule with kij from NeqSim database 3- classic mixing rule with temperature dependent kij 4- Huron Vidal mixing rule with parameters from NeqSim database 7 -classic mixing rule with kij of CPA from NeqSim Database 9 -classicmixing rule with temperature dependent kij of CPA from NeqSim database 10-classic mixing rule with temperature and composition dependent kij of CPA from NeqSim database
    • clone

      public SystemBnsEos clone()

      clone.

      Specified by:
      clone in interface SystemInterface
      Overrides:
      clone in class SystemThermo
      Returns:
      a SystemInterface object