From 49a79dac8377efd4869dff6a7ba344c098621b3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=85smund=20V=C3=A5ge=20Fannemel?= <34712686+asmfstatoil@users.noreply.github.com> Date: Sat, 11 Jan 2025 13:11:07 +0100 Subject: [PATCH 1/2] refact: replace byValue with enums --- src/main/java/neqsim/thermo/phase/PhaseEos.java | 2 +- src/main/java/neqsim/thermo/phase/PhaseGE.java | 4 ++-- src/main/java/neqsim/thermo/phase/PhaseGENRTL.java | 2 +- src/main/java/neqsim/thermo/phase/PhaseGEUnifacPSRK.java | 2 +- src/main/java/neqsim/thermo/phase/PhaseGEUnifacUMRPRU.java | 2 +- .../flashops/saturationops/HydrateInhibitorwtFlashTest.java | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/neqsim/thermo/phase/PhaseEos.java b/src/main/java/neqsim/thermo/phase/PhaseEos.java index 10a8943f5..8c0c6293e 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseEos.java +++ b/src/main/java/neqsim/thermo/phase/PhaseEos.java @@ -89,7 +89,7 @@ public void init(double totalNumberOfMoles, int numberOfComponents, int initType pt = PhaseType.LIQUID; } if (!isMixingRuleDefined()) { - setMixingRule(EosMixingRuleType.byValue(1)); + setMixingRule(EosMixingRuleType.NO); } super.init(totalNumberOfMoles, numberOfComponents, initType, pt, beta); diff --git a/src/main/java/neqsim/thermo/phase/PhaseGE.java b/src/main/java/neqsim/thermo/phase/PhaseGE.java index ed716fa9b..809f59f0a 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseGE.java +++ b/src/main/java/neqsim/thermo/phase/PhaseGE.java @@ -143,7 +143,7 @@ public void setMixingRule(MixingRuleTypeInterface mr) { throw new RuntimeException( new neqsim.util.exception.InvalidInputException(this, "setMixingRule", "mr")); } - mixingRuleType = EosMixingRuleType.byValue(2); + mixingRuleType = EosMixingRuleType.CLASSIC); mixRule = mixSelect.getMixingRule(mixingRuleType.getValue(), this); } @@ -155,7 +155,7 @@ public void resetMixingRule(MixingRuleTypeInterface mr) { new neqsim.util.exception.InvalidInputException(this, "resetMixingRule", "mr")); } // NB! Ignores input mr - mixingRuleType = EosMixingRuleType.byValue(2); + mixingRuleType = EosMixingRuleType.CLASSIC; mixRule = mixSelect.resetMixingRule(mixingRuleType.getValue(), this); } diff --git a/src/main/java/neqsim/thermo/phase/PhaseGENRTL.java b/src/main/java/neqsim/thermo/phase/PhaseGENRTL.java index 9f7954219..8fcdb963e 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseGENRTL.java +++ b/src/main/java/neqsim/thermo/phase/PhaseGENRTL.java @@ -62,7 +62,7 @@ public PhaseGENRTL(PhaseInterface phase, double[][] alpha, double[][] Dij, Strin phase.getComponent(i).getNumberOfmoles(), phase.getComponent(i).getNumberOfMolesInPhase(), phase.getComponent(i).getComponentNumber()); } - setMixingRule(EosMixingRuleType.byValue(2)); + setMixingRule(EosMixingRuleType.CLASSIC); } /** {@inheritDoc} */ diff --git a/src/main/java/neqsim/thermo/phase/PhaseGEUnifacPSRK.java b/src/main/java/neqsim/thermo/phase/PhaseGEUnifacPSRK.java index a5e01a71b..e6a37863f 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseGEUnifacPSRK.java +++ b/src/main/java/neqsim/thermo/phase/PhaseGEUnifacPSRK.java @@ -52,7 +52,7 @@ public PhaseGEUnifacPSRK(PhaseInterface phase, double[][] alpha, double[][] Dij, phase.getComponent(i).getNumberOfmoles(), phase.getComponent(i).getNumberOfMolesInPhase(), phase.getComponent(i).getComponentNumber()); } - this.setMixingRule(EosMixingRuleType.byValue(2)); + this.setMixingRule(EosMixingRuleType.CLASSIC); } /** {@inheritDoc} */ diff --git a/src/main/java/neqsim/thermo/phase/PhaseGEUnifacUMRPRU.java b/src/main/java/neqsim/thermo/phase/PhaseGEUnifacUMRPRU.java index a3ad28c6c..938ec5e2e 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseGEUnifacUMRPRU.java +++ b/src/main/java/neqsim/thermo/phase/PhaseGEUnifacUMRPRU.java @@ -60,7 +60,7 @@ public PhaseGEUnifacUMRPRU(PhaseInterface phase, double[][] alpha, double[][] Di phase.getComponent(i).getComponentNumber()); componentArray[i].setAttractiveTerm(phase.getComponent(i).getAttractiveTermNumber()); } - this.setMixingRule(EosMixingRuleType.byValue(2)); + this.setMixingRule(EosMixingRuleType.CLASSIC); } /** diff --git a/src/test/java/neqsim/thermodynamicoperations/flashops/saturationops/HydrateInhibitorwtFlashTest.java b/src/test/java/neqsim/thermodynamicoperations/flashops/saturationops/HydrateInhibitorwtFlashTest.java index a49add3bd..3679f998b 100644 --- a/src/test/java/neqsim/thermodynamicoperations/flashops/saturationops/HydrateInhibitorwtFlashTest.java +++ b/src/test/java/neqsim/thermodynamicoperations/flashops/saturationops/HydrateInhibitorwtFlashTest.java @@ -23,7 +23,7 @@ void testRun() { testSystem.addComponent("MEG", 0.000001); testSystem.addComponent("water", 0.0010); testSystem.createDatabase(true); - testSystem.setMixingRule(EosMixingRuleType.byValue(10)); + testSystem.setMixingRule(EosMixingRuleType.CLASSIC_TX_CPA); testSystem.init(0); testSystem.setMultiPhaseCheck(true); From 38264f954218e696a827732f0617c840aef5846d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=85smund=20V=C3=A5ge=20Fannemel?= <34712686+asmfstatoil@users.noreply.github.com> Date: Sat, 11 Jan 2025 18:57:57 +0100 Subject: [PATCH 2/2] Update PhaseGE.java --- src/main/java/neqsim/thermo/phase/PhaseGE.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/neqsim/thermo/phase/PhaseGE.java b/src/main/java/neqsim/thermo/phase/PhaseGE.java index 809f59f0a..bc5e696a9 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseGE.java +++ b/src/main/java/neqsim/thermo/phase/PhaseGE.java @@ -143,7 +143,7 @@ public void setMixingRule(MixingRuleTypeInterface mr) { throw new RuntimeException( new neqsim.util.exception.InvalidInputException(this, "setMixingRule", "mr")); } - mixingRuleType = EosMixingRuleType.CLASSIC); + mixingRuleType = EosMixingRuleType.CLASSIC; mixRule = mixSelect.getMixingRule(mixingRuleType.getValue(), this); }