Skip to content

Commit 17dd67c

Browse files
committed
test: update tests to use EosMixingRule
1 parent 796255e commit 17dd67c

File tree

3 files changed

+20
-14
lines changed

3 files changed

+20
-14
lines changed

src/test/java/neqsim/thermodynamicoperations/flashops/TVFlashTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import org.apache.logging.log4j.Logger;
66
import org.junit.jupiter.api.BeforeEach;
77
import org.junit.jupiter.api.Test;
8+
import neqsim.thermo.mixingrule.EosMixingRuleType;
89
import neqsim.thermodynamicoperations.ThermodynamicOperations;
910

1011
/**
@@ -30,7 +31,7 @@ void setUp() {
3031
testSystem.addComponent("ethane", 0.0);
3132
testSystem.addComponent("n-pentane", 9E-1);
3233
testSystem.addComponent("nC16", 1E-1);
33-
testSystem.setMixingRule("classic");
34+
testSystem.setMixingRule(EosMixingRuleType.CLASSIC);
3435
testOps = new ThermodynamicOperations(testSystem);
3536
testOps.TPflash();
3637
testSystem.initProperties();

src/test/java/neqsim/thermodynamicoperations/flashops/saturationops/HydrateInhibitorwtFlashTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import static org.junit.jupiter.api.Assertions.assertEquals;
44
import org.junit.jupiter.api.Assertions;
55
import org.junit.jupiter.api.Test;
6+
import neqsim.thermo.mixingrule.EosMixingRuleType;
67
import neqsim.thermo.system.SystemInterface;
78
import neqsim.thermo.system.SystemSrkCPAstatoil;
89
import neqsim.thermodynamicoperations.ThermodynamicOperations;
@@ -22,7 +23,7 @@ void testRun() {
2223
testSystem.addComponent("MEG", 0.000001);
2324
testSystem.addComponent("water", 0.0010);
2425
testSystem.createDatabase(true);
25-
testSystem.setMixingRule(10);
26+
testSystem.setMixingRule(EosMixingRuleType.byValue(10));
2627

2728
testSystem.init(0);
2829
testSystem.setMultiPhaseCheck(true);

src/test/java/neqsim/thermodynamicoperations/phaseenvelopeops/multicomponentenvelopeops/PTPhaseEnvelopeTest.java

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import static org.junit.jupiter.api.Assertions.assertTrue;
66
import org.junit.jupiter.api.BeforeEach;
77
import org.junit.jupiter.api.Test;
8+
import neqsim.thermo.mixingrule.EosMixingRuleType;
89
import neqsim.thermodynamicoperations.ThermodynamicOperations;
910

1011
public class PTPhaseEnvelopeTest {
@@ -25,22 +26,23 @@ void testDewP() {
2526
testSystem.addComponent("nitrogen", 0.01);
2627
testSystem.addComponent("CO2", 0.01);
2728
testSystem.addComponent("methane", 0.98);
28-
testSystem.setMixingRule("classic");
29+
testSystem.setMixingRule(EosMixingRuleType.byName("classic"));
2930

3031
testOps = new ThermodynamicOperations(testSystem);
3132
testOps.TPflash();
3233
testSystem.initProperties();
3334
testOps.calcPTphaseEnvelope();
3435
double[] dewPointPressures = testOps.get("dewP");
35-
double[] expectedDewPointPressures = new double[] { 1.1051709180756477, 1.2214027581601699, 1.3498588075760032,
36-
1.4918246976412703, 1.6652911949458864, 1.8794891289619104, 2.1418131227502055,
37-
2.4690864123141987, 2.881197018974799, 3.404779997613969, 4.075230307874481,
38-
4.938583914869986, 6.051801019586486, 7.477304695462727, 9.260793952051571,
39-
11.364101185282063, 13.480106047577934, 14.53423776629387, 13.607498029406681,
40-
11.181207439509638, 9.189487040488075, 9.612827246459474, 10.706126846063928,
41-
12.501491987760147, 15.075672692089958, 18.51283799420178, 23.330378296334104,
42-
29.71319711031059, 37.25532259549197, 43.660805656603934, 45.75836660678656,
43-
46.42490219574348, 46.83203503669948, 46.869568345957006, 46.903557772489435 };
36+
double[] expectedDewPointPressures =
37+
new double[] {1.1051709180756477, 1.2214027581601699, 1.3498588075760032,
38+
1.4918246976412703, 1.6652911949458864, 1.8794891289619104, 2.1418131227502055,
39+
2.4690864123141987, 2.881197018974799, 3.404779997613969, 4.075230307874481,
40+
4.938583914869986, 6.051801019586486, 7.477304695462727, 9.260793952051571,
41+
11.364101185282063, 13.480106047577934, 14.53423776629387, 13.607498029406681,
42+
11.181207439509638, 9.189487040488075, 9.612827246459474, 10.706126846063928,
43+
12.501491987760147, 15.075672692089958, 18.51283799420178, 23.330378296334104,
44+
29.71319711031059, 37.25532259549197, 43.660805656603934, 45.75836660678656,
45+
46.42490219574348, 46.83203503669948, 46.869568345957006, 46.903557772489435};
4446
// System.out.println(Arrays.toString(dewPointPressures));
4547
assertArrayEquals(expectedDewPointPressures, dewPointPressures, 10E-10);
4648
}
@@ -58,7 +60,8 @@ void testFailingCaseWithWater() {
5860
testOps.TPflash();
5961
testSystem.initProperties();
6062

61-
Exception exception = assertThrows(ArrayIndexOutOfBoundsException.class, () -> testOps.calcPTphaseEnvelope());
63+
Exception exception =
64+
assertThrows(ArrayIndexOutOfBoundsException.class, () -> testOps.calcPTphaseEnvelope());
6265
}
6366

6467
@Test
@@ -132,7 +135,8 @@ void testFailingCase1() {
132135
void testFailingCase2() {
133136
// testSystem.setTemperature(40, "C");
134137
// testSystem.setPressure(50, "bara");
135-
neqsim.thermo.system.SystemInterface fluid0_HC = new neqsim.thermo.system.SystemUMRPRUMCEos(298.0, 50.0);
138+
neqsim.thermo.system.SystemInterface fluid0_HC =
139+
new neqsim.thermo.system.SystemUMRPRUMCEos(298.0, 50.0);
136140
fluid0_HC.addComponent("nitrogen", 2.5);
137141
fluid0_HC.addComponent("CO2", 4.5);
138142
fluid0_HC.addComponent("methane", 79.45);

0 commit comments

Comments
 (0)