Class PhaseUMRCPA

All Implemented Interfaces:
Serializable, Cloneable, PhaseCPAInterface, PhaseEosInterface, PhaseInterface, ThermodynamicConstantsInterface

public class PhaseUMRCPA extends PhasePrEos implements PhaseCPAInterface

PhaseSrkCPA class.

Version:
$Id: $Id
Author:
Even Solbraa
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      Serialization version UID.
      See Also:
    • logger

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

      public CPAMixingRuleHandler cpaSelect
    • cpamix

      public CPAMixingRulesInterface cpamix
    • gcpavv

      double gcpavv
    • gcpavvv

      double gcpavvv
    • gcpa

      double gcpa
    • hcpatot

      double hcpatot
    • FCPA

      double FCPA
    • dFCPAdTdV

      double dFCPAdTdV
    • dFCPAdTdT

      double dFCPAdTdT
    • dFCPAdT

      double dFCPAdT
    • dFCPAdV

      double dFCPAdV
    • dFCPAdVdV

      double dFCPAdVdV
    • dFCPAdVdVdV

      double dFCPAdVdVdV
    • gcpav

      double gcpav
    • dFdNtemp

      private double[] dFdNtemp
    • cpaon

      int cpaon
    • oldTotalNumberOfAccociationSites

      int oldTotalNumberOfAccociationSites
    • totalNumberOfAccociationSites

      int totalNumberOfAccociationSites
    • selfAccociationScheme

      int[][][] selfAccociationScheme
    • crossAccociationScheme

      int[][][][] crossAccociationScheme
    • activeAccosComp

      int[] activeAccosComp
    • lngi

      private double[] lngi
    • moleculeNumber

      int[] moleculeNumber
    • assSiteNumber

      int[] assSiteNumber
    • gvector

      private double[][] gvector
    • delta

      private double[][] delta
    • deltaNog

      private double[][] deltaNog
    • deltadT

      private double[][] deltadT
    • deltadTdT

      private double[][] deltadTdT
    • Klkni

      double[][][] Klkni
    • KlkTVMatrix

      private org.ejml.simple.SimpleMatrix KlkTVMatrix
    • KlkTTMatrix

      private org.ejml.simple.SimpleMatrix KlkTTMatrix
    • KlkTMatrix

      private org.ejml.simple.SimpleMatrix KlkTMatrix
    • udotTimesmMatrix

      private org.ejml.simple.SimpleMatrix udotTimesmMatrix
    • mVector

      private org.ejml.simple.SimpleMatrix mVector
    • udotMatrix

      private org.ejml.simple.SimpleMatrix udotMatrix
    • uMatrix

      private org.ejml.simple.SimpleMatrix uMatrix
    • QMatksiksiksi

      private org.ejml.simple.SimpleMatrix QMatksiksiksi
    • KlkVVVMatrix

      private org.ejml.simple.SimpleMatrix KlkVVVMatrix
    • KlkVVMatrix

      private org.ejml.simple.SimpleMatrix KlkVVMatrix
    • udotTimesmiMatrix

      private org.ejml.simple.SimpleMatrix udotTimesmiMatrix
    • ksiMatrix

      private org.ejml.simple.SimpleMatrix ksiMatrix
    • KlkMatrix

      private org.ejml.simple.SimpleMatrix KlkMatrix
    • hessianMatrix

      private org.ejml.simple.SimpleMatrix hessianMatrix
    • hessianInvers

      private org.ejml.simple.SimpleMatrix hessianInvers
    • KlkVMatrix

      private org.ejml.simple.SimpleMatrix KlkVMatrix
    • corr2Matrix

      private org.ejml.data.DMatrixRMaj corr2Matrix
    • corr3Matrix

      private org.ejml.data.DMatrixRMaj corr3Matrix
    • corr4Matrix

      private org.ejml.data.DMatrixRMaj corr4Matrix
  • Constructor Details

    • PhaseUMRCPA

      public PhaseUMRCPA()

      Constructor for PhaseUMRCPA.

  • Method Details

    • clone

      public PhaseUMRCPA clone()

      clone.

      Specified by:
      clone in interface PhaseInterface
      Overrides:
      clone in class PhasePrEos
      Returns:
      a PhaseInterface object
    • init

      public void init(double totalNumberOfMoles, int numberOfComponents, int initType, PhaseType pt, double beta)

      init.

      initType used in component.init()

      Calls component.init(initType)

      Specified by:
      init in interface PhaseInterface
      Overrides:
      init in class PhaseEos
      Parameters:
      totalNumberOfMoles - Total number of moles in all phases of Stream.
      numberOfComponents - Number of components in system.
      initType - a int. Use 0 to init, and 1 to reset.
      pt - Type of phase.
      beta - Mole fraction of this phase in system.
    • initCPAMatrix

      public void initCPAMatrix(int type)

      initCPAMatrix.

      Parameters:
      type - a int
    • setMixingRule

      public void setMixingRule(MixingRuleTypeInterface mr)

      setMixingRule.

      Specified by:
      setMixingRule in interface PhaseInterface
      Overrides:
      setMixingRule in class PhaseEos
      Parameters:
      mr - a MixingRuleTypeInterface
    • calcDelta

      public void calcDelta()

      calcDelta.

    • addComponent

      public void addComponent(String name, double moles, double molesInPhase, int compNumber)

      Add component to component array and update moles variables.

      Specified by:
      addComponent in interface PhaseInterface
      Overrides:
      addComponent in class PhasePrEos
      Parameters:
      name - Name of component.
      moles - Total number of moles of component.
      molesInPhase - Number of moles in phase.
      compNumber - Index number of component in phase object component array.
    • getF

      public double getF()

      getF.

      Overrides:
      getF in class PhaseEos
      Returns:
      a double
    • dFdT

      public double dFdT()

      Calculate derivative of F per Temperature, i.e., dF/dT.

      Specified by:
      dFdT in interface PhaseInterface
      Overrides:
      dFdT in class PhaseEos
      Returns:
      a double
    • dFdTdV

      public double dFdTdV()

      Calculate derivative of F per Temperature and Volume, i.e., dF/dT * 1/dV.

      Specified by:
      dFdTdV in interface PhaseInterface
      Overrides:
      dFdTdV in class PhaseEos
      Returns:
      a double
    • dFdV

      public double dFdV()

      Calculate derivative of F per Volume, i.e., dF/dV.

      Specified by:
      dFdV in interface PhaseInterface
      Overrides:
      dFdV in class PhaseEos
      Returns:
      a double
    • dFdVdV

      public double dFdVdV()

      dFdVdV.

      Specified by:
      dFdVdV in interface PhaseInterface
      Overrides:
      dFdVdV in class PhaseEos
      Returns:
      a double
    • dFdVdVdV

      public double dFdVdVdV()

      dFdVdVdV.

      Overrides:
      dFdVdVdV in class PhaseEos
      Returns:
      a double
    • dFdTdT

      public double dFdTdT()

      dFdTdT.

      Specified by:
      dFdTdT in interface PhaseInterface
      Overrides:
      dFdTdT in class PhaseEos
      Returns:
      a double
    • FCPA

      public double FCPA()

      FCPA.

      Returns:
      a double
    • dFCPAdV

      public double dFCPAdV()

      dFCPAdV.

      Returns:
      a double
    • dFCPAdVdV

      public double dFCPAdVdV()

      dFCPAdVdV.

      Returns:
      a double
    • dFCPAdVdVdV

      public double dFCPAdVdVdV()

      dFCPAdVdVdV.

      Returns:
      a double
    • dFCPAdT

      public double dFCPAdT()

      dFCPAdT.

      Returns:
      a double
    • dFCPAdTdT

      public double dFCPAdTdT()

      dFCPAdTdT.

      Returns:
      a double
    • dFCPAdTdV

      public double dFCPAdTdV()

      dFCPAdTdV.

      Returns:
      a double
    • molarVolume

      public double molarVolume(double pressure, double temperature, double A, double B, PhaseType pt) throws IsNaNException, TooManyIterationsException

      molarVolume.

      Specified by:
      molarVolume in interface PhaseInterface
      Overrides:
      molarVolume in class PhaseEos
      Parameters:
      pressure - a double
      temperature - a double
      A - a double
      B - a double
      pt - the PhaseType of the phase
      Returns:
      a double
      Throws:
      IsNaNException - if any.
      TooManyIterationsException - if any.
    • getdFdNtemp

      public double[] getdFdNtemp()

      Getter for the field dFdNtemp. Set value by calling function molarVolume.

      Returns:
      the dFdNtemp
    • calcdFdNtemp

      private double[] calcdFdNtemp()
      Calculate and return dFdNtemp. NB! Does not set field dFdNtemp.
      Returns:
      double[]
    • calcXsitedV

      public void calcXsitedV()

      calcXsitedV.

    • solveX

      public boolean solveX()

      solveX.

      Returns:
      a boolean
    • solveX2

      public boolean solveX2(int maxIter)

      solveX2.

      Parameters:
      maxIter - a int
      Returns:
      a boolean
    • getHcpatot

      public double getHcpatot()

      Getter for property hcpatot.

      Specified by:
      getHcpatot in interface PhaseCPAInterface
      Returns:
      a double
    • setHcpatot

      public void setHcpatot(double hcpatot)
      Setter for property hcpatot.
      Parameters:
      hcpatot - New value of property hcpatot.
    • getGcpa

      public double getGcpa()

      getGcpa.

      Specified by:
      getGcpa in interface PhaseCPAInterface
      Returns:
      a double
    • calcRootVolFinder

      public double calcRootVolFinder(PhaseType pt)

      calcRootVolFinder.

      Parameters:
      pt - the PhaseType of the phase
      Returns:
      a double
    • molarVolumeChangePhase

      public double molarVolumeChangePhase(double pressure, double temperature, double A, double B, PhaseType pt) throws IsNaNException, TooManyIterationsException

      molarVolumeChangePhase.

      Parameters:
      pressure - a double
      temperature - a double
      A - a double
      B - a double
      pt - the PhaseType of the phase
      Returns:
      a double
      Throws:
      IsNaNException - if any.
      TooManyIterationsException - if any.
    • getGcpav

      public double getGcpav()

      getGcpav.

      Specified by:
      getGcpav in interface PhaseCPAInterface
      Returns:
      a double
    • setGcpav

      public void setGcpav(double gcpav)

      Setter for the field gcpav.

      Parameters:
      gcpav - a double
    • getCpaMixingRule

      public CPAMixingRulesInterface getCpaMixingRule()

      getCpaMixingRule.

      Specified by:
      getCpaMixingRule in interface PhaseCPAInterface
      Returns:
      a CPAMixingRulesInterface object
    • calcPressure

      public double calcPressure()

      calcPressure.

      Specified by:
      calcPressure in interface PhaseEosInterface
      Overrides:
      calcPressure in class PhaseEos
      Returns:
      a double
    • getCrossAssosiationScheme

      public int getCrossAssosiationScheme(int comp1, int comp2, int site1, int site2)

      getCrossAssosiationScheme.

      Specified by:
      getCrossAssosiationScheme in interface PhaseCPAInterface
      Parameters:
      comp1 - a int
      comp2 - a int
      site1 - a int
      site2 - a int
      Returns:
      a int
    • croeneckerProduct

      public double[][] croeneckerProduct(double[][] a, double[][] b)

      croeneckerProduct.

      Parameters:
      a - an array of type double
      b - an array of type double
      Returns:
      an array of type double
    • getTotalNumberOfAccociationSites

      public int getTotalNumberOfAccociationSites()

      getTotalNumberOfAccociationSites.

      Specified by:
      getTotalNumberOfAccociationSites in interface PhaseCPAInterface
      Returns:
      a int
    • setTotalNumberOfAccociationSites

      public void setTotalNumberOfAccociationSites(int totalNumberOfAccociationSites)

      setTotalNumberOfAccociationSites.

      Specified by:
      setTotalNumberOfAccociationSites in interface PhaseCPAInterface
      Parameters:
      totalNumberOfAccociationSites - a int
    • initOld2

      public void initOld2(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType pt, double beta)

      initOld2.

      Parameters:
      totalNumberOfMoles - a double
      numberOfComponents - a int
      type - a int
      pt - a int
      beta - a double
    • molarVolume2

      public double molarVolume2(double pressure, double temperature, double A, double B, PhaseType pt) throws IsNaNException, TooManyIterationsException

      molarVolume2.

      Overrides:
      molarVolume2 in class PhaseEos
      Parameters:
      pressure - a double
      temperature - a double
      A - a double
      B - a double
      pt - the PhaseType of the phase
      Returns:
      a double
      Throws:
      IsNaNException - if any.
      TooManyIterationsException - if any.
    • initCPAMatrixOld

      public void initCPAMatrixOld(int type)

      initCPAMatrixOld.

      Parameters:
      type - a int
    • solveXOld

      public boolean solveXOld()

      solveXOld.

      Returns:
      a boolean
    • solveX2Old

      public boolean solveX2Old(int maxIter)

      solveX2Old.

      Parameters:
      maxIter - a int
      Returns:
      a boolean
    • molarVolumeOld

      public double molarVolumeOld(double pressure, double temperature, double A, double B, PhaseType pt) throws IsNaNException, TooManyIterationsException

      molarVolumeOld.

      Parameters:
      pressure - a double
      temperature - a double
      A - a double
      B - a double
      pt - the PhaseType of the phase
      Returns:
      a double
      Throws:
      IsNaNException - if any.
      TooManyIterationsException - if any.