From 58c04dd0d7218156935d25a55767cd339bd09174 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=85smund=20V=C3=A5ge=20Fannemel?= <34712686+asmfstatoil@users.noreply.github.com> Date: Thu, 9 Jan 2025 22:02:47 +0100 Subject: [PATCH] refact: replace numeric mixingrule with enum type (#1248) * feat: introduce MixingRulesInterface* refact: get eosmixingruletype * refact: use eosmixingruletype * fix: add CLASSIC_HV * doc: remove wrong doc * doc: fix variable name , getName() --- .../equipment/stream/StreamInterface.java | 2 - .../thermo/characterization/LumpingModel.java | 13 ++ .../characterization/PlusFractionModel.java | 22 +++ .../characterization/TBPfractionModel.java | 26 ++++ .../characterization/WaxCharacterise.java | 9 ++ .../thermo/mixingrule/CPAMixingRules.java | 45 +++++- .../mixingrule/CPAMixingRulesInterface.java | 2 +- .../ElectrolyteMixingRulesInterface.java | 2 +- .../thermo/mixingrule/EosMixingRuleType.java | 10 +- .../thermo/mixingrule/EosMixingRules.java | 139 +++++++++++++++--- .../mixingrule/EosMixingRulesInterface.java | 11 +- .../mixingrule/MixingRulesInterface.java | 14 ++ src/main/java/neqsim/thermo/phase/Phase.java | 23 +-- .../java/neqsim/thermo/phase/PhaseEos.java | 2 +- .../thermo/phase/PhaseEosInterface.java | 2 +- .../neqsim/thermo/phase/PhaseInterface.java | 9 +- .../neqsim/thermo/system/SystemInterface.java | 15 +- .../neqsim/thermo/system/SystemThermo.java | 45 ++---- .../HydrocarbonDewPointAnalyserTest.java | 2 - .../SalesGasAndStableOilTest.java | 30 ++-- .../thermo/system/SystemThermoTest.java | 4 +- .../system/SystemUMRPRUMCEosNewTest.java | 3 +- .../thermo/util/example/BubbleFlash.java | 2 - .../thermo/util/example/DewPointCurve.java | 2 - .../thermo/util/example/PS_PH_flash.java | 2 - .../thermo/util/example/PhaseEnvelope.java | 2 - .../thermo/util/example/TPMultiFlash.java | 2 - .../thermo/util/example/TPflashMembrane.java | 2 - .../thermo/util/example/TestGERGwater.java | 2 - .../neqsim/thermo/util/example/TestPSRK.java | 2 +- .../ThermodynamicOperationsTest.java | 109 +++++++------- .../util/example/TVflash.java | 2 - .../util/example/VLSolidTPFLash.java | 2 - 33 files changed, 364 insertions(+), 195 deletions(-) create mode 100644 src/main/java/neqsim/thermo/mixingrule/MixingRulesInterface.java diff --git a/src/main/java/neqsim/process/equipment/stream/StreamInterface.java b/src/main/java/neqsim/process/equipment/stream/StreamInterface.java index 65c1a79f40..61d4c85dc8 100644 --- a/src/main/java/neqsim/process/equipment/stream/StreamInterface.java +++ b/src/main/java/neqsim/process/equipment/stream/StreamInterface.java @@ -154,7 +154,6 @@ public default double getFlowRate(String unit) { */ public double getRVP(double referenceTemperature, String unit, String returnUnit); - /** * Calculates the Reid Vapor Pressure (RVP) of the stream. * @@ -321,7 +320,6 @@ public double getRVP(double referenceTemperature, String unit, String returnUnit @Override public int hashCode(); - /** * Calculates the hydrocarbon dew point of the stream. * diff --git a/src/main/java/neqsim/thermo/characterization/LumpingModel.java b/src/main/java/neqsim/thermo/characterization/LumpingModel.java index 73f6e0d216..6d2cb46446 100644 --- a/src/main/java/neqsim/thermo/characterization/LumpingModel.java +++ b/src/main/java/neqsim/thermo/characterization/LumpingModel.java @@ -50,41 +50,49 @@ public class StandardLumpingModel public StandardLumpingModel() {} + /** {@inheritDoc} */ @Override public void setNumberOfLumpedComponents(int lumpedNumb) { numberOfLumpedComponents = lumpedNumb; } + /** {@inheritDoc} */ @Override public int getNumberOfLumpedComponents() { return numberOfLumpedComponents; } + /** {@inheritDoc} */ @Override public void setNumberOfPseudoComponents(int lumpedNumb) { numberOfPseudocomponents = lumpedNumb; } + /** {@inheritDoc} */ @Override public int getNumberOfPseudoComponents() { return numberOfPseudocomponents; } + /** {@inheritDoc} */ @Override public String getName() { return name; } + /** {@inheritDoc} */ @Override public String getLumpedComponentName(int i) { return lumpedComponentNames[i]; } + /** {@inheritDoc} */ @Override public String[] getLumpedComponentNames() { return lumpedComponentNames; } + /** {@inheritDoc} */ @Override public void generateLumpedComposition(Characterise charac) { numberOfLumpedComponents = numberOfPseudocomponents; @@ -196,6 +204,7 @@ public void generateLumpedComposition(Characterise charac) { } } + /** {@inheritDoc} */ @Override public double getFractionOfHeavyEnd(int i) { if (fractionOfHeavyEnd == null) { @@ -220,6 +229,7 @@ public class PVTLumpingModel extends StandardLumpingModel { public PVTLumpingModel() {} + /** {@inheritDoc} */ @Override public void generateLumpedComposition(Characterise charac) { double weightFrac = 0.0; @@ -311,6 +321,7 @@ public void generateLumpedComposition(Characterise charac) { system.init(0); } + /** {@inheritDoc} */ @Override public double getFractionOfHeavyEnd(int i) { if (fractionOfHeavyEnd == null) { @@ -334,6 +345,7 @@ public class NoLumpingModel extends StandardLumpingModel { public NoLumpingModel() {} + /** {@inheritDoc} */ @Override public void generateLumpedComposition(Characterise charac) { numberOfPseudocomponents = charac.getPlusFractionModel().getLastPlusFractionNumber(); @@ -414,6 +426,7 @@ public void generateLumpedComposition(Characterise charac) { system.init(0); } + /** {@inheritDoc} */ @Override public double getFractionOfHeavyEnd(int i) { if (fractionOfHeavyEnd == null) { diff --git a/src/main/java/neqsim/thermo/characterization/PlusFractionModel.java b/src/main/java/neqsim/thermo/characterization/PlusFractionModel.java index cc4fc09807..4446f7e120 100644 --- a/src/main/java/neqsim/thermo/characterization/PlusFractionModel.java +++ b/src/main/java/neqsim/thermo/characterization/PlusFractionModel.java @@ -101,11 +101,13 @@ public String getName() { return name; } + /** {@inheritDoc} */ @Override public double getMPlus() { return MPlus; } + /** {@inheritDoc} */ @Override public double getZPlus() { return zPlus; @@ -119,36 +121,43 @@ public double getMaxPlusMolarMass() { return maxPlusMolarMass; } + /** {@inheritDoc} */ @Override public double getNumberOfPlusPseudocomponents() { return numberOfPlusPseudocomponents; } + /** {@inheritDoc} */ @Override public double[] getZ() { return z; } + /** {@inheritDoc} */ @Override public double[] getM() { return M; } + /** {@inheritDoc} */ @Override public double[] getDens() { return dens; } + /** {@inheritDoc} */ @Override public double getDensPlus() { return densPlus; } + /** {@inheritDoc} */ @Override public int getFirstPlusFractionNumber() { return firstPlusFractionNumber; } + /** {@inheritDoc} */ @Override public int getFirstTBPFractionNumber() { int firstTBPNumber = 0; @@ -174,16 +183,19 @@ public int getFirstTBPFractionNumber() { return firstTBPNumber; } + /** {@inheritDoc} */ @Override public int getPlusComponentNumber() { return plusComponentNumber; } + /** {@inheritDoc} */ @Override public int getLastPlusFractionNumber() { return lastPlusFractionNumber; } + /** {@inheritDoc} */ @Override public boolean hasPlusFraction() { for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { @@ -198,6 +210,7 @@ public boolean hasPlusFraction() { return false; } + /** {@inheritDoc} */ @Override public boolean characterizePlusFraction(TBPModelInterface TBPModel) { system.init(0); @@ -242,11 +255,13 @@ public boolean characterizePlusFraction(TBPModelInterface TBPModel) { return true; } + /** {@inheritDoc} */ @Override public double[] getCoefs() { return this.coefs; } + /** {@inheritDoc} */ @Override public double getCoef(int i) { return this.coefs[i]; @@ -298,6 +313,7 @@ public void setCoefs(double coef, int i) { this.coefs[i] = coef; } + /** {@inheritDoc} */ @Override public void setLastPlusFractionNumber(int fract) { lastPlusFractionNumber = fract + 1; @@ -392,6 +408,7 @@ public void densityUOP() { } } + /** {@inheritDoc} */ @Override public boolean characterizePlusFraction(TBPModelInterface TBPModel) { system.init(0); @@ -451,11 +468,13 @@ public double[] getGammaParameters() { return new double[] {this.alfa, this.eta}; } + /** {@inheritDoc} */ @Override public double[] getCoefs() { return new double[] {alfa, eta}; } + /** {@inheritDoc} */ @Override public double getCoef(int i) { if (i == 0) @@ -465,16 +484,19 @@ public double getCoef(int i) { return 0; } + /** {@inheritDoc} */ @Override public double[] getZ() { return zValues; } + /** {@inheritDoc} */ @Override public double[] getM() { return molarMasses; } + /** {@inheritDoc} */ @Override public double[] getDens() { return densities; diff --git a/src/main/java/neqsim/thermo/characterization/TBPfractionModel.java b/src/main/java/neqsim/thermo/characterization/TBPfractionModel.java index 3d533969b2..d1a93df2ca 100644 --- a/src/main/java/neqsim/thermo/characterization/TBPfractionModel.java +++ b/src/main/java/neqsim/thermo/characterization/TBPfractionModel.java @@ -37,22 +37,26 @@ public abstract class TBPBaseModel implements TBPModelInterface, Cloneable, java protected boolean calcm = true; + /** {@inheritDoc} */ @Override public String getName() { return name; } + /** {@inheritDoc} */ @Override public double calcTB(double molarMass, double density) { return Math.pow((molarMass / 5.805e-5 * Math.pow(density, 0.9371)), 1.0 / 2.3776); } + /** {@inheritDoc} */ @Override public double calcWatsonCharacterizationFactor(double molarMass, double density) { // System.out.println("boiling point " + calcTB(molarMass, density)); return Math.pow(1.8 * calcTB(molarMass, density), 1.0 / 3.0) / density; } + /** {@inheritDoc} */ @Override public double calcAcentricFactorKeslerLee(double molarMass, double density) { double TC = calcTC(molarMass, density); @@ -71,6 +75,7 @@ public double calcAcentricFactorKeslerLee(double molarMass, double density) { } } + /** {@inheritDoc} */ @Override public double calcAcentricFactor(double molarMass, double density) { double TC = calcTC(molarMass, density); @@ -80,6 +85,7 @@ public double calcAcentricFactor(double molarMass, double density) { / (TC / TB - 1.0) - 1.0; } + /** {@inheritDoc} */ @Override public double calcCriticalVolume(double molarMass, double density) { double TC = calcTC(molarMass, density); @@ -94,11 +100,13 @@ public double calcCriticalVolume(double molarMass, double density) { return criticaVol; } + /** {@inheritDoc} */ @Override public double calcParachorParameter(double molarMass, double density) { return 59.3 + 2.34 * molarMass * 1000.0; } + /** {@inheritDoc} */ @Override public double calcCriticalViscosity(double molarMass, double density) { double TC = calcTC(molarMass, density); @@ -107,17 +115,20 @@ public double calcCriticalViscosity(double molarMass, double density) { * 1e-7; } + /** {@inheritDoc} */ @Override public double calcRacketZ(SystemInterface thermoSystem, double molarMass, double density) { throw new RuntimeException( new neqsim.util.exception.NotImplementedException(this, "calcRacketZ")); } + /** {@inheritDoc} */ @Override public double calcm(double molarMass, double density) { throw new RuntimeException(new neqsim.util.exception.NotImplementedException(this, "calcm")); } + /** {@inheritDoc} */ @Override public boolean isCalcm() { return calcm; @@ -139,6 +150,7 @@ public class PedersenTBPModelSRK extends TBPBaseModel { double[] TPBracketcoefs = {0.29441, 0.40768}; double[][] TBPfractionCoefs = null; + /** {@inheritDoc} */ @Override public double calcTC(double molarMass, double density) { // System.out.println("TC ccc " + TBPfractionCoefs[0][0]); @@ -152,6 +164,7 @@ public double calcTC(double molarMass, double density) { + TBPfractionCoefs[0][2] * molarMass + TBPfractionCoefs[0][3] / molarMass; } + /** {@inheritDoc} */ @Override public double calcPC(double molarMass, double density) { if (molarMass < 1120) { @@ -165,6 +178,7 @@ public double calcPC(double molarMass, double density) { + TBPfractionCoefs[1][2] / molarMass + TBPfractionCoefs[1][3] / Math.pow(molarMass, 2.0)); } + /** {@inheritDoc} */ @Override public double calcm(double molarMass, double density) { if (molarMass < 1120) { @@ -176,6 +190,7 @@ public double calcm(double molarMass, double density) { + TBPfractionCoefs[2][2] * density + TBPfractionCoefs[2][3] * Math.pow(molarMass, 2.0); } + /** {@inheritDoc} */ @Override public double calcTB(double molarMass, double density) { if (molarMass < 540) { @@ -186,6 +201,7 @@ public double calcTB(double molarMass, double density) { } } + /** {@inheritDoc} */ @Override public double calcRacketZ(SystemInterface thermoSystem, double molarMass, double density) { double penelouxC = (thermoSystem.getPhase(0).getMolarVolume() - molarMass / (density * 10.0)); @@ -256,6 +272,7 @@ public RiaziDaubert() { calcm = false; } + /** {@inheritDoc} */ @Override public double calcTC(double molarMass, double density) { // molarMass=molarMass*1e3; @@ -268,6 +285,7 @@ public double calcTC(double molarMass, double density) { // Math.pow(sig2, c); } + /** {@inheritDoc} */ @Override public double calcPC(double molarMass, double density) { if (molarMass > 300) { @@ -288,6 +306,7 @@ public double calcAcentricFactor2(double molarMass, double density) { / (TC / TB - 1.0) - 1.0; } + /** {@inheritDoc} */ @Override public double calcTB(double molarMass, double density) { // Soreide method (Whitson book) @@ -296,6 +315,7 @@ public double calcTB(double molarMass, double density) { * Math.exp(-4.922e-3 * molarMass - 4.7685 * density + 3.462e-3 * molarMass * density)); // 97.58*Math.pow(molarMass,0.3323)*Math.pow(density,0.04609); } + /** {@inheritDoc} */ @Override public double calcAcentricFactor(double molarMass, double density) { double TC = calcTC(molarMass, density); @@ -326,6 +346,7 @@ public LeeKesler() { calcm = false; } + /** {@inheritDoc} */ @Override public double calcTC(double molarMass, double density) { double sg = density; @@ -335,6 +356,7 @@ public double calcTC(double molarMass, double density) { return TC; } + /** {@inheritDoc} */ @Override public double calcPC(double molarMass, double density) { double sg = density; @@ -347,6 +369,7 @@ public double calcPC(double molarMass, double density) { return PC; } + /** {@inheritDoc} */ @Override public double calcAcentricFactor(double molarMass, double density) { return super.calcAcentricFactorKeslerLee(molarMass, density); @@ -364,6 +387,7 @@ public TwuModel() { calcm = false; } + /** {@inheritDoc} */ @Override public double calcTC(double molarMass, double density) { double sg = density; @@ -417,6 +441,7 @@ public double solveMW(double TB) { return MW_alkane; } + /** {@inheritDoc} */ @Override public double calcPC(double molarMass, double density) { double sg = density; @@ -447,6 +472,7 @@ public double calcPC(double molarMass, double density) { return PC * 10.0; // * 10 due to conversion MPa to bar } + /** {@inheritDoc} */ @Override public double calcCriticalVolume(double molarMass, double density) { double sg = density; diff --git a/src/main/java/neqsim/thermo/characterization/WaxCharacterise.java b/src/main/java/neqsim/thermo/characterization/WaxCharacterise.java index 744b878448..acf55c2664 100644 --- a/src/main/java/neqsim/thermo/characterization/WaxCharacterise.java +++ b/src/main/java/neqsim/thermo/characterization/WaxCharacterise.java @@ -54,6 +54,7 @@ public abstract class WaxBaseModel implements WaxModelInterface { double[] parameterWaxHeatOfFusion = new double[1]; double[] parameterWaxTriplePointTemperature = new double[1]; + /** {@inheritDoc} */ @Override public WaxBaseModel clone() { WaxBaseModel clonedSystem = null; @@ -65,29 +66,35 @@ public WaxBaseModel clone() { return clonedSystem; } + /** {@inheritDoc} */ @Override public void addTBPWax() {} + /** {@inheritDoc} */ @Override public void setWaxParameters(double[] parameters) { parameterWax = parameters; } + /** {@inheritDoc} */ @Override public void setWaxParameter(int i, double parameters) { parameterWax[i] = parameters; } + /** {@inheritDoc} */ @Override public void setParameterWaxHeatOfFusion(int i, double parameters) { parameterWaxHeatOfFusion[i] = parameters; } + /** {@inheritDoc} */ @Override public void setParameterWaxTriplePointTemperature(int i, double parameters) { parameterWaxTriplePointTemperature[i] = parameters; } + /** {@inheritDoc} */ @Override public double[] getWaxParameters() { return parameterWax; @@ -164,6 +171,7 @@ public double calcPCwax(int componentNumber, String normalComponent) { 3.46); } + /** {@inheritDoc} */ @Override public void addTBPWax() { int numberOfCOmponents = thermoSystem.getPhase(0).getNumberOfComponents(); @@ -239,6 +247,7 @@ public void addTBPWax() { } } + /** {@inheritDoc} */ @Override public void removeWax() { for (int i = 0; i < thermoSystem.getPhase(0).getNumberOfComponents(); i++) { diff --git a/src/main/java/neqsim/thermo/mixingrule/CPAMixingRules.java b/src/main/java/neqsim/thermo/mixingrule/CPAMixingRules.java index 3dc4e7d362..6a5e8cdc30 100644 --- a/src/main/java/neqsim/thermo/mixingrule/CPAMixingRules.java +++ b/src/main/java/neqsim/thermo/mixingrule/CPAMixingRules.java @@ -29,6 +29,9 @@ public class CPAMixingRules implements Cloneable, ThermodynamicConstantsInterfac /** Logger object for class. */ static Logger logger = LogManager.getLogger(CPAMixingRules.class); + /** Name of mixing rule. */ + private String mixingRuleName = "CPA_Radoch"; + int[][] assosSchemeType = null; // 0- ER - 1 - CR1 double[][] cpaBetaCross = null; double[][] cpaEpsCross = null; @@ -73,48 +76,56 @@ public double calcXi(int siteNumber, int compnumb, PhaseInterface phase, double return 1.0; } + /** {@inheritDoc} */ @Override public double calcXi(int[][][] assosScheme, int[][][][] assosScheme2, int siteNumber, int compnumb, PhaseInterface phase, double temperature, double pressure, int numbcomp) { return 1.0; } + /** {@inheritDoc} */ @Override public double calcDelta(int siteNumber1, int siteNumber2, int compnumb1, int compnumb2, PhaseInterface phase, double temperature, double pressure, int numbcomp) { return 1.0; } + /** {@inheritDoc} */ @Override public double calcDeltaNog(int siteNumber1, int siteNumber2, int compnumb1, int compnumb2, PhaseInterface phase, double temperature, double pressure, int numbcomp) { return 1.0; } + /** {@inheritDoc} */ @Override public double calcDeltadN(int derivativeComp, int siteNumber1, int siteNumber2, int compnumb1, int compnumb2, PhaseInterface phase, double temperature, double pressure, int numbcomp) { return 1.0; } + /** {@inheritDoc} */ @Override public double calcDeltadT(int siteNumber1, int siteNumber2, int compnumb1, int compnumb2, PhaseInterface phase, double temperature, double pressure, int numbcomp) { return 1.0; } + /** {@inheritDoc} */ @Override public double calcDeltadV(int siteNumber1, int siteNumber2, int compnumb1, int compnumb2, PhaseInterface phase, double temperature, double pressure, int numbcomp) { return 1.0; } + /** {@inheritDoc} */ @Override public double calcDeltadTdT(int siteNumber1, int siteNumber2, int compnumb1, int compnumb2, PhaseInterface phase, double temperature, double pressure, int numbcomp) { return 1.0; } + /** {@inheritDoc} */ @Override public double calcDeltadTdV(int siteNumber1, int siteNumber2, int compnumb1, int compnumb2, PhaseInterface phase, double temperature, double pressure, int numbcomp) { @@ -126,6 +137,12 @@ public class CPA_Radoch extends CPA_Radoch_base { /** Serialization version UID. */ private static final long serialVersionUID = 1000; + /** {@inheritDoc} */ + @Override + public String getName() { + return mixingRuleName; + } + public double getCrossAssociationEnergy(int compnumb1, int compnumb2, PhaseInterface phase, double temperature, double pressure, int numbcomp) { if (Math.abs(cpaEpsCross[compnumb1][compnumb2]) > 1e-10) { @@ -154,6 +171,7 @@ public double getCrossAssociationVolume(int compnumb1, int compnumb2, PhaseInter * phase.getComponent(compnumb2).getAssociationVolume()); } + /** {@inheritDoc} */ @Override public double calcDelta(int siteNumber1, int siteNumber2, int compnumb1, int compnumb2, PhaseInterface phase, double temperature, double pressure, int numbcomp) { @@ -230,6 +248,7 @@ public double calcDelta(int compnumb1, int compnumb2, PhaseInterface phase, doub * ((PhaseCPAInterface) phase).getGcpa(); } + /** {@inheritDoc} */ @Override public double calcDeltaNog(int siteNumber1, int siteNumber2, int compnumb1, int compnumb2, PhaseInterface phase, double temperature, double pressure, int numbcomp) { @@ -266,6 +285,7 @@ public double calcDeltaNog(int siteNumber1, int siteNumber2, int compnumb1, int * getCrossAssociationVolume(compnumb1, compnumb2, phase, temperature, pressure, numbcomp); } + /** {@inheritDoc} */ @Override public double calcDeltadN(int derivativeComp, int siteNumber1, int siteNumber2, int compnumb1, int compnumb2, PhaseInterface phase, double temperature, double pressure, int numbcomp) { @@ -275,6 +295,7 @@ public double calcDeltadN(int derivativeComp, int siteNumber1, int siteNumber2, * ((ComponentSrkCPA) phase.getComponent(derivativeComp)).calc_lngi(phase); } + /** {@inheritDoc} */ @Override public double calcDeltadT(int siteNumber1, int siteNumber2, int compnumb1, int compnumb2, PhaseInterface phase, double temperature, double pressure, int numbcomp) { @@ -337,6 +358,7 @@ public double calcDeltadT(int siteNumber1, int siteNumber2, int compnumb1, int c * ((PhaseCPAInterface) phase).getGcpa(); } + /** {@inheritDoc} */ @Override public double calcDeltadV(int siteNumber1, int siteNumber2, int compnumb1, int compnumb2, PhaseInterface phase, double temperature, double pressure, int numbcomp) { @@ -346,6 +368,7 @@ public double calcDeltadV(int siteNumber1, int siteNumber2, int compnumb1, int c * ((PhaseCPAInterface) phase).getGcpav(); } + /** {@inheritDoc} */ @Override public double calcDeltadTdV(int siteNumber1, int siteNumber2, int compnumb1, int compnumb2, PhaseInterface phase, double temperature, double pressure, int numbcomp) { @@ -380,6 +403,7 @@ public double calcDeltadTdV(int siteNumber1, int siteNumber2, int compnumb1, int * ((PhaseCPAInterface) phase).getGcpa() * ((PhaseCPAInterface) phase).getGcpav(); } + /** {@inheritDoc} */ @Override public double calcDeltadTdT(int siteNumber1, int siteNumber2, int compnumb1, int compnumb2, PhaseInterface phase, double temperature, double pressure, int numbcomp) { @@ -561,6 +585,7 @@ public double getCrossAssociationVolume(int siteNumber1, int siteNumber2, int co * phase.getComponent(compnumb2).getAssociationVolumeSAFT()) * extrwterm; } + /** {@inheritDoc} */ @Override public double calcDelta(int siteNumber1, int siteNumber2, int compnumb1, int compnumb2, PhaseInterface phase, double temperature, double pressure, int numbcomp) { @@ -585,17 +610,21 @@ public double calcDelta(int siteNumber1, int siteNumber2, int compnumb1, int com * getMixingRule. *

* - * @param i a int + * @param mr a int * @return a {@link neqsim.thermo.mixingrule.CPAMixingRulesInterface} object */ - public CPAMixingRulesInterface getMixingRule(int i) { - if (i == 1) { + public CPAMixingRulesInterface getMixingRule(int mr) { + if (mr == 1) { + mixingRuleName = "CPA_Radoch"; return new CPA_Radoch(); - } else if (i == 2) { + } else if (mr == 2) { + mixingRuleName = "CPA_Radoch"; return new CPA_Radoch(); - } else if (i == 3) { + } else if (mr == 3) { + mixingRuleName = "PCSAFTa_Radoch"; return new PCSAFTa_Radoch(); } else { + mixingRuleName = "CPA_Radoch"; return new CPA_Radoch(); } } @@ -605,11 +634,11 @@ public CPAMixingRulesInterface getMixingRule(int i) { * getMixingRule. *

* - * @param i a int + * @param mr a int * @param phase a {@link neqsim.thermo.phase.PhaseInterface} object * @return a {@link neqsim.thermo.mixingrule.CPAMixingRulesInterface} object */ - public CPAMixingRulesInterface getMixingRule(int i, PhaseInterface phase) { + public CPAMixingRulesInterface getMixingRule(int mr, PhaseInterface phase) { assosSchemeType = new int[phase.getNumberOfComponents()][phase.getNumberOfComponents()]; cpaBetaCross = new double[phase.getNumberOfComponents()][phase.getNumberOfComponents()]; cpaEpsCross = new double[phase.getNumberOfComponents()][phase.getNumberOfComponents()]; @@ -656,7 +685,7 @@ public CPAMixingRulesInterface getMixingRule(int i, PhaseInterface phase) { } } - return getMixingRule(i); + return getMixingRule(mr); } /** diff --git a/src/main/java/neqsim/thermo/mixingrule/CPAMixingRulesInterface.java b/src/main/java/neqsim/thermo/mixingrule/CPAMixingRulesInterface.java index c2a903e146..52004f02ed 100644 --- a/src/main/java/neqsim/thermo/mixingrule/CPAMixingRulesInterface.java +++ b/src/main/java/neqsim/thermo/mixingrule/CPAMixingRulesInterface.java @@ -16,7 +16,7 @@ * @author Even Solbraa * @version $Id: $Id */ -public interface CPAMixingRulesInterface extends java.io.Serializable { +public interface CPAMixingRulesInterface extends MixingRulesInterface { // public double calcXi(int siteNumber, int compnumb, PhaseInterface phase, // double temperature, double pressure, int numbcomp); diff --git a/src/main/java/neqsim/thermo/mixingrule/ElectrolyteMixingRulesInterface.java b/src/main/java/neqsim/thermo/mixingrule/ElectrolyteMixingRulesInterface.java index 3c784feee1..8f5af7b9c0 100644 --- a/src/main/java/neqsim/thermo/mixingrule/ElectrolyteMixingRulesInterface.java +++ b/src/main/java/neqsim/thermo/mixingrule/ElectrolyteMixingRulesInterface.java @@ -16,7 +16,7 @@ * @author Even Solbraa * @version $Id: $Id */ -public interface ElectrolyteMixingRulesInterface extends java.io.Serializable { +public interface ElectrolyteMixingRulesInterface extends MixingRulesInterface { /** *

* calcWij. diff --git a/src/main/java/neqsim/thermo/mixingrule/EosMixingRuleType.java b/src/main/java/neqsim/thermo/mixingrule/EosMixingRuleType.java index 2dca6514e4..59b2ca56c9 100644 --- a/src/main/java/neqsim/thermo/mixingrule/EosMixingRuleType.java +++ b/src/main/java/neqsim/thermo/mixingrule/EosMixingRuleType.java @@ -6,10 +6,11 @@ * Types of EosMixingRule, relating to different kind of mixing rules relevant for EOS type phases. * Available types are: *