diff --git a/src/main/java/neqsim/thermo/phase/Phase.java b/src/main/java/neqsim/thermo/phase/Phase.java index 72ec94d81f..a0cfe57689 100644 --- a/src/main/java/neqsim/thermo/phase/Phase.java +++ b/src/main/java/neqsim/thermo/phase/Phase.java @@ -337,7 +337,8 @@ public double getMixGibbsEnergy() { for (int i = 0; i < numberOfComponents; i++) { gmix += getComponent(i).getx() * Math.log(getComponent(i).getx()); } - return getExcessGibbsEnergy() + R * temperature * gmix * numberOfMolesInPhase; + // todo: is this correct? + return R * temperature * numberOfMolesInPhase * getExcessGibbsEnergy() * gmix; } /** {@inheritDoc} */ diff --git a/src/main/java/neqsim/thermo/phase/PhaseDesmukhMather.java b/src/main/java/neqsim/thermo/phase/PhaseDesmukhMather.java index 1ff452536a..468d30288b 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseDesmukhMather.java +++ b/src/main/java/neqsim/thermo/phase/PhaseDesmukhMather.java @@ -203,8 +203,7 @@ public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, GE += phase.getComponents()[i].getx() * Math.log(((ComponentDesmukhMather) componentArray[i]) .getGamma(phase, numberOfComponents, temperature, pressure, pt)); } - // System.out.println("ge " + GE); - return R * temperature * numberOfMolesInPhase * GE; // phase.getNumberOfMolesInPhase()* + return R * temperature * numberOfMolesInPhase * GE; } /** {@inheritDoc} */ diff --git a/src/main/java/neqsim/thermo/phase/PhaseDuanSun.java b/src/main/java/neqsim/thermo/phase/PhaseDuanSun.java index 9dbfe21803..c315624a1b 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseDuanSun.java +++ b/src/main/java/neqsim/thermo/phase/PhaseDuanSun.java @@ -111,7 +111,7 @@ public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, .getGammaPitzer(phase, numberOfComponents, temperature, pressure, pt, salinity)); } - return R * temperature * numberOfMolesInPhase * GE; // phase.getNumberOfMolesInPhase()* + return R * temperature * numberOfMolesInPhase * GE; } /** {@inheritDoc} */ diff --git a/src/main/java/neqsim/thermo/phase/PhaseGENRTL.java b/src/main/java/neqsim/thermo/phase/PhaseGENRTL.java index 6f273839e7..5465c74324 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseGENRTL.java +++ b/src/main/java/neqsim/thermo/phase/PhaseGENRTL.java @@ -124,7 +124,7 @@ public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, temperature, pressure, pt, alpha, Dij, intparam, mixRule)); } - return R * temperature * numberOfMolesInPhase * GE; // phase.getNumberOfMolesInPhase()* + return R * temperature * numberOfMolesInPhase * GE; } /** {@inheritDoc} */ diff --git a/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedHV.java b/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedHV.java index 80b299d004..6dffa94249 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedHV.java +++ b/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedHV.java @@ -138,7 +138,7 @@ public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, temperature, pressure, pt, alpha, Dij, DijT, intparam, mixRule)); } } - return (R * phase.getTemperature() * GE) * phase.getNumberOfMolesInPhase(); + return R * phase.getTemperature() * phase.getNumberOfMolesInPhase() * GE; } /** {@inheritDoc} */ @@ -149,7 +149,7 @@ public double getGibbsEnergy() { val += getComponent(i).getNumberOfMolesInPhase() * (getComponent(i).getLogFugacityCoefficient()); // +Math.log(getComponent(i).getx()*getComponent(i).getAntoineVaporPressure(temperature))); } - return R * temperature * ((val) + Math.log(pressure) * numberOfMolesInPhase); + return R * temperature * numberOfMolesInPhase * (val + Math.log(pressure)); } /** {@inheritDoc} */ diff --git a/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedWS.java b/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedWS.java index 6044e0ea8a..bae95b38d0 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedWS.java +++ b/src/main/java/neqsim/thermo/phase/PhaseGENRTLmodifiedWS.java @@ -93,19 +93,19 @@ public void addComponent(String name, double moles, double molesInPhase, int com @Override public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, double temperature, double pressure, PhaseType pt) { + // TODO: why is GE a local variable? double GE = 0; for (int i = 0; i < numberOfComponents; i++) { if (type == 0) { GE += phase.getComponents()[i].getx() * Math.log(((ComponentGEInterface) componentArray[i]).getGamma(phase, numberOfComponents, temperature, pressure, pt, alpha, Dij, intparam, mixRule)); - } - if (type == 1) { + } else if (type == 1) { GE += phase.getComponents()[i].getx() * Math .log(((ComponentGENRTLmodifiedWS) componentArray[i]).getGamma(phase, numberOfComponents, temperature, pressure, pt, alpha, Dij, DijT, intparam, mixRule)); } } - return R * temperature * GE * numberOfMolesInPhase; + return R * temperature * numberOfMolesInPhase * GE; } } diff --git a/src/main/java/neqsim/thermo/phase/PhaseGEUnifac.java b/src/main/java/neqsim/thermo/phase/PhaseGEUnifac.java index ae4971dcb9..b1060211f1 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseGEUnifac.java +++ b/src/main/java/neqsim/thermo/phase/PhaseGEUnifac.java @@ -193,7 +193,7 @@ public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, GE += phase.getComponents()[i].getx() * Math.log(((ComponentGEUniquac) componentArray[i]) .getGamma(phase, numberOfComponents, temperature, pressure, pt)); } - return R * phase.getTemperature() * GE * phase.getNumberOfMolesInPhase(); + return R * phase.getTemperature() * phase.getNumberOfMolesInPhase() * GE; } /** {@inheritDoc} */ @@ -204,7 +204,7 @@ public double getGibbsEnergy() { val += getComponent(i).getNumberOfMolesInPhase() * (getComponent(i).getLogFugacityCoefficient()); } - return R * temperature * ((val) + Math.log(pressure) * numberOfMolesInPhase); + return R * temperature * numberOfMolesInPhase * (val + Math.log(pressure)); } /** diff --git a/src/main/java/neqsim/thermo/phase/PhaseGEUnifacPSRK.java b/src/main/java/neqsim/thermo/phase/PhaseGEUnifacPSRK.java index 3171221a5a..d462c70752 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseGEUnifacPSRK.java +++ b/src/main/java/neqsim/thermo/phase/PhaseGEUnifacPSRK.java @@ -80,7 +80,7 @@ public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, GE += phase.getComponents()[i].getx() * Math.log(((ComponentGEUniquac) componentArray[i]) .getGamma(phase, numberOfComponents, temperature, pressure, pt)); } - return R * phase.getTemperature() * GE * phase.getNumberOfMolesInPhase(); // phase.getNumberOfMolesInPhase()* + return R * phase.getTemperature() * phase.getNumberOfMolesInPhase() * GE; } /** diff --git a/src/main/java/neqsim/thermo/phase/PhaseGEUnifacUMRPRU.java b/src/main/java/neqsim/thermo/phase/PhaseGEUnifacUMRPRU.java index 6cb88f6f38..7b62645a8f 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseGEUnifacUMRPRU.java +++ b/src/main/java/neqsim/thermo/phase/PhaseGEUnifacUMRPRU.java @@ -125,7 +125,7 @@ public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, GE += phase.getComponents()[i].getx() * Math.log(((ComponentGEUniquac) componentArray[i]) .getGamma(phase, numberOfComponents, temperature, pressure, pt)); } - return R * phase.getTemperature() * GE * phase.getNumberOfMolesInPhase(); + return R * phase.getTemperature() * phase.getNumberOfMolesInPhase() * GE; } /** diff --git a/src/main/java/neqsim/thermo/phase/PhasePCSAFT.java b/src/main/java/neqsim/thermo/phase/PhasePCSAFT.java index 500295f408..a612249540 100644 --- a/src/main/java/neqsim/thermo/phase/PhasePCSAFT.java +++ b/src/main/java/neqsim/thermo/phase/PhasePCSAFT.java @@ -334,7 +334,6 @@ public double calcmSAFT() { */ public double calcF1dispSumTerm() { double temp1 = 0.0; - for (int i = 0; i < numberOfComponents; i++) { for (int j = 0; j < numberOfComponents; j++) { temp1 += @@ -358,7 +357,6 @@ public double calcF1dispSumTerm() { */ public double calcF2dispSumTerm() { double temp1 = 0.0; - for (int i = 0; i < numberOfComponents; i++) { for (int j = 0; j < numberOfComponents; j++) { temp1 += getComponent(i).getNumberOfMolesInPhase() diff --git a/src/main/java/neqsim/thermo/phase/PhasePCSAFTRahmat.java b/src/main/java/neqsim/thermo/phase/PhasePCSAFTRahmat.java index 383174b619..c33887385c 100644 --- a/src/main/java/neqsim/thermo/phase/PhasePCSAFTRahmat.java +++ b/src/main/java/neqsim/thermo/phase/PhasePCSAFTRahmat.java @@ -15,12 +15,11 @@ */ public class PhasePCSAFTRahmat extends PhasePCSAFT { private static final long serialVersionUID = 1000; + static Logger logger = LogManager.getLogger(PhasePCSAFTRahmat.class); double nSAFT = 1.0; double dnSAFTdV = 1.0; - double dnSAFTdVdV = 1.0; - double dnSAFTdVdVdV = 1.0; double dmeanSAFT = 0.0; @@ -34,33 +33,22 @@ public class PhasePCSAFTRahmat extends PhasePCSAFT { double volumeSAFT = 1.0; double daHCSAFTdN = 1.0; double daHSSAFTdN = 1.0; - double dgHSSAFTdN = 1.0; - double daHSSAFTdNdN = 1.0; - double dgHSSAFTdNdN = 1.0; - double daHSSAFTdNdNdN = 1.0; - double dgHSSAFTdNdNdN = 1.0; // by Rahmat double dNSAFTdT = 1.0; double dF1dispVolTermdT = 0.0; double dF1dispI1dT = 1.0; - double dF2dispI2dT = 1.0; - double dF2dispZHCdT = 1.0; double dF1dispSumTermdT = 1.0; - double dF2dispSumTermdT = 1.0; - int useHS = 1; - int useDISP1 = 1; - int useDISP2 = 1; private double[][] aConstSAFT = { @@ -78,65 +66,35 @@ public class PhasePCSAFTRahmat extends PhasePCSAFT { {0.0976883116, -0.2557574982, -9.1558561530, 20.642075974, -38.804430052, 93.626774077, -29.666905585}}; private double F1dispVolTerm = 1.0; - private double F1dispSumTerm = 1.0; - private double F1dispI1 = 1.0; - private double F2dispI2 = 1.0; - private double F2dispZHC = 1.0; - private double F2dispZHCdN = 1.0; - private double F2dispZHCdm = 1.0; - private double F2dispZHCdV = 1.0; - private double F2dispI2dVdV; - private double F2dispI2dVdVdV = 0.0; - private double F2dispZHCdVdV = 1.0; - private double F2dispZHCdVdVdV = 1.0; - private double F1dispI1dNdN = 1.0; - private double F1dispI1dNdNdN = 1.0; - private double F1dispVolTermdV = 1.0; - private double F1dispVolTermdVdV = 1.0; - private double F1dispI1dN = 1.0; - private double F1dispI1dm = 1.0; - private double F1dispI1dV = 1.0; - private double F2dispI2dV = 1.0; - private double F2dispI2dN = 1.0; - private double F2dispI2dm = 1.0; - private double F2dispSumTerm = 0.0; - private double F2dispZHCdNdN = 1.0; - private double F2dispZHCdNdNdN = 1.0; - private double F2dispI2dNdN = 1.0; - private double F2dispI2dNdNdN = 1.0; - private double F1dispI1dVdV = 1.0; - private double F1dispI1dVdVdV = 1.0; - private double F1dispVolTermdVdVdV = 1.0; - static Logger logger = LogManager.getLogger(PhasePCSAFTRahmat.class); /** *

@@ -171,10 +129,13 @@ public void addComponent(String name, double moles, double molesInPhase, int com @Override public void init(double totalNumberOfMoles, int numberOfComponents, int initType, PhaseType pt, double beta) { + // missing? + // if (initType > 0) { for (int i = 0; i < numberOfComponents; i++) { componentArray[i].Finit(this, temperature, pressure, totalNumberOfMoles, beta, numberOfComponents, initType); } + // } super.init(totalNumberOfMoles, numberOfComponents, initType, pt, beta); }