diff --git a/src/main/java/neqsim/thermo/mixingrule/CPAMixing.java b/src/main/java/neqsim/thermo/mixingrule/CPAMixingRules.java similarity index 97% rename from src/main/java/neqsim/thermo/mixingrule/CPAMixing.java rename to src/main/java/neqsim/thermo/mixingrule/CPAMixingRules.java index 1a5e742ee4..9b42bb839a 100644 --- a/src/main/java/neqsim/thermo/mixingrule/CPAMixing.java +++ b/src/main/java/neqsim/thermo/mixingrule/CPAMixingRules.java @@ -17,17 +17,17 @@ /** *

- * CPAMixing class. + * CPAMixingRules class. *

* * @author Even Solbraa * @version $Id: $Id */ -public class CPAMixing implements Cloneable, ThermodynamicConstantsInterface { +public class CPAMixingRules implements Cloneable, ThermodynamicConstantsInterface { /** Serialization version UID. */ private static final long serialVersionUID = 1000; /** Logger object for class. */ - static Logger logger = LogManager.getLogger(CPAMixing.class); + static Logger logger = LogManager.getLogger(CPAMixingRules.class); int[][] assosSchemeType = null; // 0- ER - 1 - CR1 double[][] cpaBetaCross = null; @@ -39,17 +39,17 @@ public class CPAMixing implements Cloneable, ThermodynamicConstantsInterface { /** *

- * Constructor for CPAMixing. + * Constructor for CPAMixingRules. *

*/ - public CPAMixing() {} + public CPAMixingRules() {} /** {@inheritDoc} */ @Override - public CPAMixing clone() { - CPAMixing clonedSystem = null; + public CPAMixingRules clone() { + CPAMixingRules clonedSystem = null; try { - clonedSystem = (CPAMixing) super.clone(); + clonedSystem = (CPAMixingRules) super.clone(); } catch (Exception ex) { logger.error("Cloning failed.", ex); } @@ -57,7 +57,7 @@ public CPAMixing clone() { return clonedSystem; } - public class CPA_Radoch_base implements CPAMixingInterface { + public abstract class CPA_Radoch_base implements CPAMixingRulesInterface { /** Serialization version UID. */ private static final long serialVersionUID = 1000; @@ -586,9 +586,9 @@ public double calcDelta(int siteNumber1, int siteNumber2, int compnumb1, int com *

* * @param i a int - * @return a {@link neqsim.thermo.mixingrule.CPAMixingInterface} object + * @return a {@link neqsim.thermo.mixingrule.CPAMixingRulesInterface} object */ - public CPAMixingInterface getMixingRule(int i) { + public CPAMixingRulesInterface getMixingRule(int i) { if (i == 1) { return new CPA_Radoch(); } else if (i == 2) { @@ -607,9 +607,9 @@ public CPAMixingInterface getMixingRule(int i) { * * @param i a int * @param phase a {@link neqsim.thermo.phase.PhaseInterface} object - * @return a {@link neqsim.thermo.mixingrule.CPAMixingInterface} object + * @return a {@link neqsim.thermo.mixingrule.CPAMixingRulesInterface} object */ - public CPAMixingInterface getMixingRule(int i, PhaseInterface phase) { + public CPAMixingRulesInterface getMixingRule(int i, PhaseInterface phase) { assosSchemeType = new int[phase.getNumberOfComponents()][phase.getNumberOfComponents()]; cpaBetaCross = new double[phase.getNumberOfComponents()][phase.getNumberOfComponents()]; cpaEpsCross = new double[phase.getNumberOfComponents()][phase.getNumberOfComponents()]; @@ -674,9 +674,9 @@ public CPAMixingInterface getMixingRule(int i, PhaseInterface phase) { * * @param i a int * @param phase a {@link neqsim.thermo.phase.PhaseInterface} object - * @return a {@link neqsim.thermo.mixingrule.CPAMixingInterface} object + * @return a {@link neqsim.thermo.mixingrule.CPAMixingRulesInterface} object */ - public CPAMixingInterface resetMixingRule(int i, PhaseInterface phase) { + public CPAMixingRulesInterface resetMixingRule(int i, PhaseInterface phase) { if (i == 1) { return new CPA_Radoch(); } else if (i == 2) { diff --git a/src/main/java/neqsim/thermo/mixingrule/CPAMixingInterface.java b/src/main/java/neqsim/thermo/mixingrule/CPAMixingRulesInterface.java similarity index 97% rename from src/main/java/neqsim/thermo/mixingrule/CPAMixingInterface.java rename to src/main/java/neqsim/thermo/mixingrule/CPAMixingRulesInterface.java index 86e88f5df1..c2a903e146 100644 --- a/src/main/java/neqsim/thermo/mixingrule/CPAMixingInterface.java +++ b/src/main/java/neqsim/thermo/mixingrule/CPAMixingRulesInterface.java @@ -1,5 +1,5 @@ /* - * CPAMixingInterface.java + * CPAMixingRulesInterface.java * * Created on 26. februar 2001, 19:38 */ @@ -10,13 +10,13 @@ /** *

- * CPAMixingInterface interface. + * CPAMixingRulesInterface interface. *

* * @author Even Solbraa * @version $Id: $Id */ -public interface CPAMixingInterface extends java.io.Serializable { +public interface CPAMixingRulesInterface extends java.io.Serializable { // public double calcXi(int siteNumber, int compnumb, PhaseInterface phase, // double temperature, double pressure, int numbcomp); diff --git a/src/main/java/neqsim/thermo/mixingrule/EosMixingRules.java b/src/main/java/neqsim/thermo/mixingrule/EosMixingRules.java index 8d9d2f6318..c4f221d2ee 100644 --- a/src/main/java/neqsim/thermo/mixingrule/EosMixingRules.java +++ b/src/main/java/neqsim/thermo/mixingrule/EosMixingRules.java @@ -1002,7 +1002,7 @@ public ClassicSRKT clone() { } } - public class SRKHuronVidal extends ClassicSRK implements HVmixingRuleInterface { + public class SRKHuronVidal extends ClassicSRK implements HVMixingRulesInterface { /** Serialization version UID. */ private static final long serialVersionUID = 1000; @@ -1182,7 +1182,7 @@ public double calcAij(int compNumb, int compNumbj, PhaseInterface phase, double } } - public class SRKHuronVidal2 extends ClassicSRK implements HVmixingRuleInterface { + public class SRKHuronVidal2 extends ClassicSRK implements HVMixingRulesInterface { /** Serialization version UID. */ private static final long serialVersionUID = 1000; @@ -2707,9 +2707,6 @@ public java.lang.String[][] getClassicOrWS() { */ @ExcludeFromJacocoGeneratedReport public void displayInteractionCoefficients(String intType, PhaseInterface phase) { - String[][] interactTable = - new String[phase.getNumberOfComponents() + 1][phase.getNumberOfComponents() + 1]; - java.text.DecimalFormat nf = new java.text.DecimalFormat(); java.text.DecimalFormatSymbols symbols = new java.text.DecimalFormatSymbols(); @@ -2721,6 +2718,8 @@ public void displayInteractionCoefficients(String intType, PhaseInterface phase) // String[][] table = new String[getPhases()[0].getNumberOfComponents() + // 30][7]; + String[][] interactTable = + new String[phase.getNumberOfComponents() + 1][phase.getNumberOfComponents() + 1]; String[] names = new String[phase.getNumberOfComponents() + 1]; names[0] = ""; for (int i = 0; i < phase.getNumberOfComponents(); i++) { diff --git a/src/main/java/neqsim/thermo/mixingrule/HVmixingRuleInterface.java b/src/main/java/neqsim/thermo/mixingrule/HVMixingRulesInterface.java similarity index 95% rename from src/main/java/neqsim/thermo/mixingrule/HVmixingRuleInterface.java rename to src/main/java/neqsim/thermo/mixingrule/HVMixingRulesInterface.java index fc305010c3..6f3416bfce 100644 --- a/src/main/java/neqsim/thermo/mixingrule/HVmixingRuleInterface.java +++ b/src/main/java/neqsim/thermo/mixingrule/HVMixingRulesInterface.java @@ -14,7 +14,7 @@ * @author Even Solbraa * @version $Id: $Id */ -public interface HVmixingRuleInterface extends EosMixingRulesInterface { +public interface HVMixingRulesInterface extends EosMixingRulesInterface { /** *

* setHVDijParameter. diff --git a/src/main/java/neqsim/thermo/phase/PhaseCPAInterface.java b/src/main/java/neqsim/thermo/phase/PhaseCPAInterface.java index 03222f7b8c..a23a32931b 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseCPAInterface.java +++ b/src/main/java/neqsim/thermo/phase/PhaseCPAInterface.java @@ -1,6 +1,6 @@ package neqsim.thermo.phase; -import neqsim.thermo.mixingrule.CPAMixingInterface; +import neqsim.thermo.mixingrule.CPAMixingRulesInterface; /** *

@@ -74,7 +74,7 @@ public interface PhaseCPAInterface extends PhaseEosInterface { * getCpamix. *

* - * @return a {@link neqsim.thermo.mixingrule.CPAMixingInterface} object + * @return a {@link neqsim.thermo.mixingrule.CPAMixingRulesInterface} object */ - public CPAMixingInterface getCpamix(); + public CPAMixingRulesInterface getCpamix(); } diff --git a/src/main/java/neqsim/thermo/phase/PhaseElectrolyteCPA.java b/src/main/java/neqsim/thermo/phase/PhaseElectrolyteCPA.java index 415f390230..8363eb54f9 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseElectrolyteCPA.java +++ b/src/main/java/neqsim/thermo/phase/PhaseElectrolyteCPA.java @@ -8,8 +8,8 @@ import org.ejml.simple.SimpleMatrix; import neqsim.thermo.component.ComponentCPAInterface; import neqsim.thermo.component.ComponentElectrolyteCPA; -import neqsim.thermo.mixingrule.CPAMixing; -import neqsim.thermo.mixingrule.CPAMixingInterface; +import neqsim.thermo.mixingrule.CPAMixingRules; +import neqsim.thermo.mixingrule.CPAMixingRulesInterface; /** *

@@ -26,8 +26,8 @@ public class PhaseElectrolyteCPA extends PhaseModifiedFurstElectrolyteEos /** Logger object for class. */ static Logger logger = LogManager.getLogger(PhaseElectrolyteCPA.class); - public CPAMixing cpaSelect = new CPAMixing(); - public CPAMixingInterface cpamix; + public CPAMixingRules cpaSelect = new CPAMixingRules(); + public CPAMixingRulesInterface cpamix; double gcpavv = 0.0; double gcpavvv = 0.0; double gcpa = 0.0; @@ -1322,7 +1322,7 @@ public void setGcpav(double gcpav) { /** {@inheritDoc} */ @Override - public CPAMixingInterface getCpamix() { + public CPAMixingRulesInterface getCpamix() { return cpamix; } diff --git a/src/main/java/neqsim/thermo/phase/PhaseElectrolyteCPAOld.java b/src/main/java/neqsim/thermo/phase/PhaseElectrolyteCPAOld.java index 622e2d56a0..c559917812 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseElectrolyteCPAOld.java +++ b/src/main/java/neqsim/thermo/phase/PhaseElectrolyteCPAOld.java @@ -5,8 +5,8 @@ import neqsim.thermo.component.ComponentCPAInterface; import neqsim.thermo.component.ComponentElectrolyteCPA; import neqsim.thermo.component.ComponentEosInterface; -import neqsim.thermo.mixingrule.CPAMixing; -import neqsim.thermo.mixingrule.CPAMixingInterface; +import neqsim.thermo.mixingrule.CPAMixingRules; +import neqsim.thermo.mixingrule.CPAMixingRulesInterface; /** *

@@ -23,10 +23,10 @@ public class PhaseElectrolyteCPAOld extends PhaseModifiedFurstElectrolyteEos /** Logger object for class. */ static Logger logger = LogManager.getLogger(PhaseElectrolyteCPAOld.class); - public CPAMixing cpaSelect = new CPAMixing(); + public CPAMixingRules cpaSelect = new CPAMixingRules(); int totalNumberOfAccociationSites = 0; - public CPAMixingInterface cpamix; + public CPAMixingRulesInterface cpamix; double hcpatot = 1.0; double hcpatotdT = 0.0; double hcpatotdTdT = 0.0; @@ -802,7 +802,7 @@ public void setGcpav(double gcpav) { /** {@inheritDoc} */ @Override - public CPAMixingInterface getCpamix() { + public CPAMixingRulesInterface getCpamix() { return cpamix; } diff --git a/src/main/java/neqsim/thermo/phase/PhasePCSAFTa.java b/src/main/java/neqsim/thermo/phase/PhasePCSAFTa.java index 5058426c4e..f7d806c0a4 100644 --- a/src/main/java/neqsim/thermo/phase/PhasePCSAFTa.java +++ b/src/main/java/neqsim/thermo/phase/PhasePCSAFTa.java @@ -4,8 +4,8 @@ import org.apache.logging.log4j.Logger; import neqsim.thermo.component.ComponentCPAInterface; import neqsim.thermo.component.ComponentPCSAFTa; -import neqsim.thermo.mixingrule.CPAMixing; -import neqsim.thermo.mixingrule.CPAMixingInterface; +import neqsim.thermo.mixingrule.CPAMixingRules; +import neqsim.thermo.mixingrule.CPAMixingRulesInterface; /** *

@@ -21,8 +21,8 @@ public class PhasePCSAFTa extends PhasePCSAFT implements PhaseCPAInterface { /** Logger object for class. */ static Logger logger = LogManager.getLogger(PhasePCSAFTa.class); - public CPAMixing cpaSelect = new CPAMixing(); - public CPAMixingInterface cpamix; + public CPAMixingRules cpaSelect = new CPAMixingRules(); + public CPAMixingRulesInterface cpamix; double hcpatot = 1.0; double hcpatotdT = 0.0; double hcpatotdTdT = 0.0; @@ -475,7 +475,7 @@ public double getGcpav() { /** {@inheritDoc} */ @Override - public CPAMixingInterface getCpamix() { + public CPAMixingRulesInterface getCpamix() { return cpamix; } diff --git a/src/main/java/neqsim/thermo/phase/PhasePrCPA.java b/src/main/java/neqsim/thermo/phase/PhasePrCPA.java index bc4ffa64d8..92deb5e924 100644 --- a/src/main/java/neqsim/thermo/phase/PhasePrCPA.java +++ b/src/main/java/neqsim/thermo/phase/PhasePrCPA.java @@ -2,8 +2,8 @@ import neqsim.thermo.component.ComponentCPAInterface; import neqsim.thermo.component.ComponentSrkCPA; -import neqsim.thermo.mixingrule.CPAMixing; -import neqsim.thermo.mixingrule.CPAMixingInterface; +import neqsim.thermo.mixingrule.CPAMixingRules; +import neqsim.thermo.mixingrule.CPAMixingRulesInterface; /** *

@@ -18,8 +18,8 @@ public class PhasePrCPA extends PhasePrEos implements PhaseCPAInterface { private static final long serialVersionUID = 1000; int totalNumberOfAccociationSites = 0; - public CPAMixing cpaSelect = new CPAMixing(); - public CPAMixingInterface cpamix; + public CPAMixingRules cpaSelect = new CPAMixingRules(); + public CPAMixingRulesInterface cpamix; double hcpatot = 1.0; double hcpatotdT = 0.0; double hcpatotdTdT = 0.0; @@ -456,7 +456,7 @@ public double getGcpav() { /** {@inheritDoc} */ @Override - public CPAMixingInterface getCpamix() { + public CPAMixingRulesInterface getCpamix() { return cpamix; } diff --git a/src/main/java/neqsim/thermo/phase/PhaseSrkCPA.java b/src/main/java/neqsim/thermo/phase/PhaseSrkCPA.java index 3ad8d7b3ef..75c950d3ce 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseSrkCPA.java +++ b/src/main/java/neqsim/thermo/phase/PhaseSrkCPA.java @@ -8,8 +8,8 @@ import org.ejml.simple.SimpleMatrix; import neqsim.thermo.component.ComponentCPAInterface; import neqsim.thermo.component.ComponentSrkCPA; -import neqsim.thermo.mixingrule.CPAMixing; -import neqsim.thermo.mixingrule.CPAMixingInterface; +import neqsim.thermo.mixingrule.CPAMixingRules; +import neqsim.thermo.mixingrule.CPAMixingRulesInterface; /** *

@@ -25,8 +25,8 @@ public class PhaseSrkCPA extends PhaseSrkEos implements PhaseCPAInterface { /** Logger object for class. */ static Logger logger = LogManager.getLogger(PhaseSrkCPA.class); - public CPAMixing cpaSelect = new CPAMixing(); - public CPAMixingInterface cpamix; + public CPAMixingRules cpaSelect = new CPAMixingRules(); + public CPAMixingRulesInterface cpamix; double gcpavv = 0.0; double gcpavvv = 0.0; double gcpa = 0.0; @@ -667,11 +667,11 @@ public double dFCPAdTdV() { } /** - * calcdFdNtemp. + * Calculate and return dFdNtemp. NB! Does not set field dFdNtemp. * * @return double[] */ - double[] calcdFdNtemp() { + private double[] calcdFdNtemp() { double tot1 = 0.0; double tot2 = 0.0; double tot3 = 0.0; @@ -960,7 +960,7 @@ public boolean solveX2(int maxIter) { /** *

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

* * @return the dFdNtemp @@ -1419,7 +1419,7 @@ public void setGcpav(double gcpav) { /** {@inheritDoc} */ @Override - public CPAMixingInterface getCpamix() { + public CPAMixingRulesInterface getCpamix() { return cpamix; } diff --git a/src/main/java/neqsim/thermo/phase/PhaseSrkCPA_proceduralMatrices.java b/src/main/java/neqsim/thermo/phase/PhaseSrkCPA_proceduralMatrices.java index bfc11027f8..2e7daf59cd 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseSrkCPA_proceduralMatrices.java +++ b/src/main/java/neqsim/thermo/phase/PhaseSrkCPA_proceduralMatrices.java @@ -7,8 +7,8 @@ import org.ejml.dense.row.NormOps_DDRM; import neqsim.thermo.component.ComponentCPAInterface; import neqsim.thermo.component.ComponentSrkCPA; -import neqsim.thermo.mixingrule.CPAMixing; -import neqsim.thermo.mixingrule.CPAMixingInterface; +import neqsim.thermo.mixingrule.CPAMixingRules; +import neqsim.thermo.mixingrule.CPAMixingRulesInterface; /** *

@@ -24,8 +24,8 @@ public class PhaseSrkCPA_proceduralMatrices extends PhaseSrkEos implements Phase /** Logger object for class. */ static Logger logger = LogManager.getLogger(PhaseSrkCPA_proceduralMatrices.class); - public CPAMixing cpaSelect = new CPAMixing(); - public CPAMixingInterface cpamix; + public CPAMixingRules cpaSelect = new CPAMixingRules(); + public CPAMixingRulesInterface cpamix; double gcpavv = 0.0; double gcpavvv = 0.0; double gcpa = 0.0; @@ -1404,7 +1404,7 @@ public void setGcpav(double gcpav) { /** {@inheritDoc} */ @Override - public CPAMixingInterface getCpamix() { + public CPAMixingRulesInterface getCpamix() { return cpamix; } diff --git a/src/main/java/neqsim/thermo/phase/PhaseUMRCPA.java b/src/main/java/neqsim/thermo/phase/PhaseUMRCPA.java index 7aed4f1225..9c11d991e4 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseUMRCPA.java +++ b/src/main/java/neqsim/thermo/phase/PhaseUMRCPA.java @@ -9,8 +9,8 @@ // import org.ejml.data.DenseMatrix64F; import neqsim.thermo.component.ComponentCPAInterface; import neqsim.thermo.component.ComponentUMRCPA; -import neqsim.thermo.mixingrule.CPAMixing; -import neqsim.thermo.mixingrule.CPAMixingInterface; +import neqsim.thermo.mixingrule.CPAMixingRules; +import neqsim.thermo.mixingrule.CPAMixingRulesInterface; /** *

@@ -21,24 +21,13 @@ * @version $Id: $Id */ public class PhaseUMRCPA extends PhasePrEos implements PhaseCPAInterface { - /** - *

- * Getter for the field dFdNtemp. - *

- * - * @return the dFdNtemp - */ - public double[] getdFdNtemp() { - return dFdNtemp; - } - /** Serialization version UID. */ private static final long serialVersionUID = 1000; /** Logger object for class. */ static Logger logger = LogManager.getLogger(PhaseUMRCPA.class); - public CPAMixing cpaSelect = new CPAMixing(); - public CPAMixingInterface cpamix; + public CPAMixingRules cpaSelect = new CPAMixingRules(); + public CPAMixingRulesInterface cpamix; double gcpavv = 0.0; double gcpavvv = 0.0; double gcpa = 0.0; @@ -822,11 +811,22 @@ public double molarVolume(double pressure, double temperature, double A, double } /** - * calcdFdNtemp. + *

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

+ * + * @return the dFdNtemp + */ + public double[] getdFdNtemp() { + return dFdNtemp; + } + + /** + * Calculate and return dFdNtemp. NB! Does not set field dFdNtemp. * * @return double[] */ - double[] calcdFdNtemp() { + private double[] calcdFdNtemp() { double tot1 = 0.0; double tot2 = 0.0; double tot3 = 0.0; @@ -1373,7 +1373,7 @@ public void setGcpav(double gcpav) { /** {@inheritDoc} */ @Override - public CPAMixingInterface getCpamix() { + public CPAMixingRulesInterface getCpamix() { return cpamix; }