Class PhasePitzer
- All Implemented Interfaces:
Serializable, Cloneable, PhaseGEInterface, PhaseInterface, ThermodynamicConstantsInterface
- Author:
- esol
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate double[][]private double[][]T-dependent coefficients for beta0: beta0(T) = beta0_25 + T1*(1/T-1/Tr) + T2*ln(T/Tr).private double[][]private double[][]private double[][]T-dependent coefficients for beta1.private double[][]private double[][]Second virial coefficient for 2-2 electrolytes (Harvie & Weare 1984).private double[][]private double[][]T-dependent coefficients for Cphi.private double[][]private static final org.apache.logging.log4j.LoggerLogger object for class.private booleanWhether parameters have been loaded from database.private double[][][]Ternary mixing parameter psi (cation-cation-anion or anion-anion-cation).private static final longSerialization version UID.private double[][]Cation-cation or anion-anion mixing parameter theta (Harvie & Weare 1984).Fields inherited from class Phase
beta, calcMolarVolume, chemSyst, componentArray, diElectricConstant, mixingRuleType, molarVolume, numberOfComponents, numberOfMolesInPhase, phaseVolume, physicalPropertyHandler, pressure, pt, refPhase, temperature, thermoPropertyModelName, useVolumeCorrection, ZFields inherited from interface ThermodynamicConstantsInterface
atm, avagadroNumber, boltzmannConstant, electronCharge, faradayConstant, gravity, molarMassAir, normalStateTemperature, pi, planckConstant, R, referencePressure, referenceTemperature, standardStateTemperature, vacumPermittivity -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddComponent(String name, double moles, double molesInPhase, int compNumber) Add component to component array and update moles variables.doublegetActivityCoefficient(int k) getActivityCoefficient.doublegetBeta0ij(int i, int j) Get beta0 parameter.doublegetBeta0ij(int i, int j, double TK) Get T-dependent beta0 parameter.doublegetBeta1ij(int i, int j) Get beta1 parameter.doublegetBeta1ij(int i, int j, double TK) Get T-dependent beta1 parameter.doublegetBeta2ij(int i, int j) Get beta2 parameter for 2-2 electrolytes.doublegetCp()method to return specific heat capacity (Cp).doublegetCphiij(int i, int j) Get Cphi parameter.doublegetCphiij(int i, int j, double TK) Get T-dependent Cphi parameter.doublegetCpres()getCpres.doublegetCv()method to return specific heat capacity (Cv).doublegetCvres()getCvres.doubleGet density of a phase note: does not use Peneloux volume correction.doublegetExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, double temperature, double pressure, PhaseType pt) getExcessGibbsEnergy.doublegetHresdP.doublegetHresTP.doubleCalculate ionic strength.doublegetPsiijk(int i, int j, int k) Get psi ternary mixing parameter.doubleGet mass of solvent in kilograms.doublegetSresTP.doublegetSresTV.doublegetThetaij(int i, int j) Get theta mixing parameter for same-sign ion pair.booleanReturns whether parameters have been loaded from database.voidLoads Pitzer binary parameters from the PitzerParameters database table.doublemolarVolume(double pressure, double temperature, double A, double B, PhaseType pt) molarVolume.voidsetAlpha(double[][] alpha) setAlpha.voidsetBeta0T(int i, int j, double t1, double t2) Set T-dependent coefficients for beta0 (Silvester-Pitzer form).voidsetBeta1T(int i, int j, double t1, double t2) Set T-dependent coefficients for beta1 (Silvester-Pitzer form).voidsetBeta2(int i, int j, double value) Set beta2 parameter for 2-2 electrolytes.voidsetBinaryParameters(int i, int j, double b0, double b1, double c) Set binary Pitzer parameters.voidsetCphiT(int i, int j, double t1, double t2) Set T-dependent coefficients for Cphi (Silvester-Pitzer form).voidsetDij(double[][] Dij) setDij.voidsetDijT(double[][] DijT) setDijT.voidsetMixingRule.voidsetPsi(int i, int j, int k, double value) Set psi ternary mixing parameter.voidsetTheta(int i, int j, double value) Set theta mixing parameter for same-sign ion pair.Methods inherited from class PhaseGE
getActivityCoefficientInfDil, getActivityCoefficientInfDilWater, getActivityCoefficientSymetric, getEnthalpy, getEntropy, getJouleThomsonCoefficient, getMixingRule, getMolarVolume, getSoundSpeed, getZ, init, init, resetMixingRule, setMixingRuleGEModelMethods inherited from class Phase
addComponent, addMoles, addMolesChemReac, calcA, calcA, calcAi, calcAij, calcAiT, calcAT, calcB, calcBi, calcBij, calcDiElectricConstant, calcDiElectricConstantdT, calcDiElectricConstantdTdT, calcMolarVolume, calcR, clone, dFdT, dFdTdT, dFdTdV, dFdV, dFdVdV, equals, fb, FB, fBB, FBB, FBD, FBT, fBV, FBV, FD, FDT, FDV, Fn, FnB, FnV, FT, FTT, FTV, fv, FV, fVV, FVV, gb, gBB, gBV, geta, getA, getActivityCoefficient, getActivityCoefficient, getActivityCoefficientUnSymetric, getAiT, getAlpha0_EOSCG, getAlpha0_GERG2008, getAlpha0_Leachman, getAlpha0_Leachman, getAlpha0_Vega, getAlphares_EOSCG, getAlphares_GERG2008, getAlphares_Leachman, getAlphares_Leachman, getAlphares_Vega, getAntoineVaporPressure, getAT, getATT, getb, getB, getBeta, getBi, getComponent, getComponent, getcomponentArray, getComponentNames, getComponents, getComponentWithIndex, getComposition, getCompressibilityX, getCompressibilityY, getCorrectedVolume, getCp, getCp0, getCv, getDensity, getDensity_AGA8, getDensity_EOSCG, getDensity_GERG2008, getDensity_Leachman, getDensity_Leachman, getDensity_Vega, getDielectricConstant, getdPdrho, getdPdTVn, getdPdVTn, getdrhodN, getdrhodP, getdrhodT, getEnthalpy, getEnthalpydP, getEnthalpydT, getEntropy, getEntropydP, getEntropydT, getExcessGibbsEnergy, getExcessGibbsEnergySymetric, getFlowRate, getFugacity, getFugacity, getg, getGamma, getGibbsEnergy, getGresTP, getHelmholtzEnergy, getHID, getInfiniteDiluteFugacity, getInfiniteDiluteFugacity, getInitType, getInternalEnergy, getInternalEnergy, getIsobaricThermalExpansivity, getIsothermalCompressibility, getJouleThomsonCoefficient, getKappa, getLogActivityCoefficient, getLogInfiniteDiluteFugacity, getLogInfiniteDiluteFugacity, getLogPureComponentFugacity, getLogPureComponentFugacity, getMass, getMeanIonicActivity, getMixGibbsEnergy, getMixingRuleType, getModelName, getMolalMeanIonicActivity, getMolarComposition, getMolarMass, getMolarMass, getMolarVolume, getMoleFraction, getNumberOfComponents, getNumberOfIonicComponents, getNumberOfMolecularComponents, getNumberOfMolesInPhase, getOsmoticCoefficient, getOsmoticCoefficientOfWater, getOsmoticCoefficientOfWaterMolality, getpH, getpH, getPhase, getPhysicalProperties, getPhysicalPropertyModel, getPressure, getPressure, getProperties_EOSCG, getProperties_GERG2008, getProperties_Leachman, getProperties_Leachman, getProperties_Vega, getPseudoCriticalPressure, getPseudoCriticalTemperature, getPureComponentFugacity, getPureComponentFugacity, getRefPhase, getRefPhase, getSoundSpeed, getTemperature, getTemperature, getThermalConductivity, getThermalConductivity, getThermoPropertyModelName, getTotalVolume, getType, getViscosity, getViscosity, getVolume, getVolume, getWaterDensity, getWtFrac, getWtFrac, getWtFraction, getWtFractionOfWaxFormingComponents, getZvolcorr, groupTBPfractions, gV, gVV, hasComponent, hasPlusFraction, hasTBPFraction, initPhysicalProperties, initPhysicalProperties, initRefPhases, initRefPhases, isConstantPhaseVolume, isMixingRuleDefined, normalize, removeComponent, resetPhysicalProperties, setAttractiveTerm, setBeta, setComponentArray, setConstantPhaseVolume, setEmptyFluid, setInitType, setMolarVolume, setMoleFractions, setNumberOfComponents, setParams, setPhysicalProperties, setPhysicalPropertyModel, setPpm, setPressure, setProperties, setRefPhase, setRefPhase, setTemperature, setTotalVolume, setType, useVolumeCorrection, useVolumeCorrectionMethods inherited from class Object
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface PhaseInterface
addMolesChemReac, getGamma2, getPhaseFraction, getPhaseTypeName, hasComponent, hasIons, init, init, initPhysicalProperties, isAsphalteneRich, setMixingRule, setPhaseTypeName, setPhysicalProperties
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDSerialization version UID.- See Also:
-
logger
private static final org.apache.logging.log4j.Logger loggerLogger object for class. -
beta0
private double[][] beta0 -
beta1
private double[][] beta1 -
cphi
private double[][] cphi -
beta2
private double[][] beta2Second virial coefficient for 2-2 electrolytes (Harvie & Weare 1984). -
theta
private double[][] thetaCation-cation or anion-anion mixing parameter theta (Harvie & Weare 1984). -
psi
private double[][][] psiTernary mixing parameter psi (cation-cation-anion or anion-anion-cation). -
beta0T1
private double[][] beta0T1T-dependent coefficients for beta0: beta0(T) = beta0_25 + T1*(1/T-1/Tr) + T2*ln(T/Tr). -
beta0T2
private double[][] beta0T2 -
beta1T1
private double[][] beta1T1T-dependent coefficients for beta1. -
beta1T2
private double[][] beta1T2 -
cphiT1
private double[][] cphiT1T-dependent coefficients for Cphi. -
cphiT2
private double[][] cphiT2 -
parametersLoaded
private boolean parametersLoadedWhether parameters have been loaded from database.
-
-
Constructor Details
-
PhasePitzer
public PhasePitzer()Constructor for PhasePitzer.
-
-
Method Details
-
addComponent
Add component to component array and update moles variables.
- 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.
-
getExcessGibbsEnergy
public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, double temperature, double pressure, PhaseType pt) getExcessGibbsEnergy.
- Parameters:
phase- aPhaseInterfaceobjectnumberOfComponents- a inttemperature- a doublepressure- a doublept- the PhaseType of the phase- Returns:
- a double
-
setMixingRule
setMixingRule.
- Specified by:
setMixingRulein interfacePhaseInterface- Overrides:
setMixingRulein classPhaseGE- Parameters:
mr- a MixingRuleTypeInterface
-
setAlpha
public void setAlpha(double[][] alpha) setAlpha.
- Parameters:
alpha- an array of type double
-
setDij
public void setDij(double[][] Dij) setDij.
- Parameters:
Dij- an array of type double
-
setDijT
public void setDijT(double[][] DijT) setDijT.
- Parameters:
DijT- an array of type double
-
setBinaryParameters
public void setBinaryParameters(int i, int j, double b0, double b1, double c) Set binary Pitzer parameters.- Parameters:
i- component ij- component jb0- beta0 parameterb1- beta1 parameterc- cPhi parameter
-
setBeta0T
public void setBeta0T(int i, int j, double t1, double t2) Set T-dependent coefficients for beta0 (Silvester-Pitzer form).- Parameters:
i- component index ij- component index jt1- coefficient for (1/T - 1/Tr) termt2- coefficient for ln(T/Tr) term
-
setBeta1T
public void setBeta1T(int i, int j, double t1, double t2) Set T-dependent coefficients for beta1 (Silvester-Pitzer form).- Parameters:
i- component index ij- component index jt1- coefficient for (1/T - 1/Tr) termt2- coefficient for ln(T/Tr) term
-
setCphiT
public void setCphiT(int i, int j, double t1, double t2) Set T-dependent coefficients for Cphi (Silvester-Pitzer form).- Parameters:
i- component index ij- component index jt1- coefficient for (1/T - 1/Tr) termt2- coefficient for ln(T/Tr) term
-
loadParametersFromDatabase
public void loadParametersFromDatabase()Loads Pitzer binary parameters from the PitzerParameters database table.Matches ion names to components present in this phase and sets beta0, beta1, Cphi and their temperature-dependent coefficients.
-
getBeta0ij
public double getBeta0ij(int i, int j, double TK) Get T-dependent beta0 parameter.- Parameters:
i- component index ij- component index jTK- temperature in Kelvin- Returns:
- beta0 at temperature T
-
getBeta1ij
public double getBeta1ij(int i, int j, double TK) Get T-dependent beta1 parameter.- Parameters:
i- component index ij- component index jTK- temperature in Kelvin- Returns:
- beta1 at temperature T
-
getCphiij
public double getCphiij(int i, int j, double TK) Get T-dependent Cphi parameter.- Parameters:
i- component index ij- component index jTK- temperature in Kelvin- Returns:
- Cphi at temperature T
-
isParametersLoaded
public boolean isParametersLoaded()Returns whether parameters have been loaded from database.- Returns:
- true if loaded
-
getBeta2ij
public double getBeta2ij(int i, int j) Get beta2 parameter for 2-2 electrolytes.- Parameters:
i- component index ij- component index j- Returns:
- beta2 parameter
-
setBeta2
public void setBeta2(int i, int j, double value) Set beta2 parameter for 2-2 electrolytes.- Parameters:
i- component index ij- component index jvalue- beta2 value
-
getThetaij
public double getThetaij(int i, int j) Get theta mixing parameter for same-sign ion pair.- Parameters:
i- component index ij- component index j- Returns:
- theta parameter
-
setTheta
public void setTheta(int i, int j, double value) Set theta mixing parameter for same-sign ion pair.- Parameters:
i- component index ij- component index jvalue- theta value
-
getPsiijk
public double getPsiijk(int i, int j, int k) Get psi ternary mixing parameter.- Parameters:
i- component index ij- component index jk- component index k- Returns:
- psi parameter
-
setPsi
public void setPsi(int i, int j, int k, double value) Set psi ternary mixing parameter.- Parameters:
i- component index ij- component index jk- component index kvalue- psi value
-
getBeta0ij
public double getBeta0ij(int i, int j) Get beta0 parameter.- Parameters:
i- component index ij- component index j- Returns:
- beta0 parameter for components i and j
-
getBeta1ij
public double getBeta1ij(int i, int j) Get beta1 parameter.- Parameters:
i- component index ij- component index j- Returns:
- beta1 parameter for components i and j
-
getCphiij
public double getCphiij(int i, int j) Get Cphi parameter.- Parameters:
i- component index ij- component index j- Returns:
- Cphi parameter for components i and j
-
getIonicStrength
public double getIonicStrength()Calculate ionic strength.- Returns:
- ionic strength
-
getSolventWeight
public double getSolventWeight()Get mass of solvent in kilograms.- Returns:
- solvent mass
-
getActivityCoefficient
public double getActivityCoefficient(int k) getActivityCoefficient.
- Specified by:
getActivityCoefficientin interfacePhaseInterface- Overrides:
getActivityCoefficientin classPhaseGE- Parameters:
k- a int- Returns:
- a double
-
getDensity
public double getDensity()Get density of a phase note: does not use Peneloux volume correction.note: at the moment return density of water (997 kg/m3)
Computes brine density as a function of temperature, pressure, and salinity using the Rowe-Chou (1970) correlation for NaCl-equivalent brine, extended with pressure correction. Fall-back is pure water density from Kell (1975). Much more accurate than the inherited hard-coded 997 kg/m3.
- Specified by:
getDensityin interfacePhaseInterface- Overrides:
getDensityin classPhaseGE- Returns:
- density with unit kg/m3
-
molarVolume
public double molarVolume(double pressure, double temperature, double A, double B, PhaseType pt) throws IsNaNException, TooManyIterationsException molarVolume.
- Parameters:
pressure- a doubletemperature- a doubleA- a doubleB- a doublept- the PhaseType of the phase- Returns:
- a double
- Throws:
IsNaNException- if any.TooManyIterationsException- if any.
-
getHresTP
public double getHresTP()getHresTP.
- Specified by:
getHresTPin interfacePhaseInterface- Overrides:
getHresTPin classPhase- Returns:
- a double
-
getHresdP
-
getSresTV
-
getSresTP
public double getSresTP()getSresTP.
- Specified by:
getSresTPin interfacePhaseInterface- Overrides:
getSresTPin classPhase- Returns:
- a double
-
getCpres
public double getCpres()getCpres.
Calculates the excess heat capacity via finite-difference temperature derivatives of the activity coefficients. In the current implementation the Pitzer binary parameters are temperature independent, so the residual contribution evaluates to zero.
- Specified by:
getCpresin interfacePhaseInterface- Overrides:
getCpresin classPhase- Returns:
- a double
-
getCvres
-
getCp
public double getCp()method to return specific heat capacity (Cp).- Specified by:
getCpin interfacePhaseInterface- Overrides:
getCpin classPhaseGE- Returns:
- Cp in unit J/K
-
getCv
public double getCv()method to return specific heat capacity (Cv).- Specified by:
getCvin interfacePhaseInterface- Overrides:
getCvin classPhaseGE- Returns:
- Cv in unit J/K
-