Skip to content

Commit 1a922be

Browse files
authored
added tests for saturation calculations (#991)
1 parent 861a079 commit 1a922be

File tree

4 files changed

+121
-0
lines changed

4 files changed

+121
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package neqsim.thermodynamicOperations.flashOps.saturationOps;
2+
3+
import static org.junit.jupiter.api.Assertions.assertEquals;
4+
import org.junit.jupiter.api.Test;
5+
import neqsim.thermo.system.SystemSrkEos;
6+
import neqsim.thermodynamicOperations.ThermodynamicOperations;
7+
8+
public class bubblePointPressureFlashTest {
9+
@Test
10+
void testRun() {
11+
12+
SystemSrkEos fluid0_HC = new SystemSrkEos();
13+
fluid0_HC.addComponent("methane", 0.7);
14+
fluid0_HC.addComponent("ethane", 0.1);
15+
fluid0_HC.addComponent("propane", 0.1);
16+
fluid0_HC.addComponent("n-butane", 0.1);
17+
fluid0_HC.setMixingRule("classic");
18+
19+
fluid0_HC.setPressure(10.0, "bara");
20+
fluid0_HC.setTemperature(-50.0, "C");
21+
22+
ThermodynamicOperations ops = new ThermodynamicOperations(fluid0_HC);
23+
try {
24+
ops.bubblePointPressureFlash(false);
25+
} catch (Exception e) {
26+
e.printStackTrace();
27+
}
28+
assertEquals(65.150271897839, fluid0_HC.getPressure(), 1e-2);
29+
}
30+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package neqsim.thermodynamicOperations.flashOps.saturationOps;
2+
3+
import static org.junit.jupiter.api.Assertions.assertEquals;
4+
import org.junit.jupiter.api.Test;
5+
import neqsim.thermo.system.SystemSrkEos;
6+
import neqsim.thermodynamicOperations.ThermodynamicOperations;
7+
8+
public class bubblePointTemperatureFlashTest {
9+
@Test
10+
void testRun() {
11+
SystemSrkEos fluid0_HC = new SystemSrkEos();
12+
fluid0_HC.addComponent("methane", 0.7);
13+
fluid0_HC.addComponent("ethane", 0.1);
14+
fluid0_HC.addComponent("propane", 0.1);
15+
fluid0_HC.addComponent("n-butane", 0.1);
16+
fluid0_HC.setMixingRule("classic");
17+
18+
fluid0_HC.setPressure(10.0, "bara");
19+
fluid0_HC.setTemperature(-150.0, "C");
20+
21+
ThermodynamicOperations ops = new ThermodynamicOperations(fluid0_HC);
22+
try {
23+
ops.bubblePointTemperatureFlash();
24+
} catch (Exception e) {
25+
e.printStackTrace();
26+
}
27+
assertEquals(-117.7205968083, fluid0_HC.getTemperature("C"), 1e-2);
28+
}
29+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package neqsim.thermodynamicOperations.flashOps.saturationOps;
2+
3+
import static org.junit.jupiter.api.Assertions.assertEquals;
4+
import org.junit.jupiter.api.Test;
5+
import neqsim.thermo.system.SystemSrkEos;
6+
import neqsim.thermodynamicOperations.ThermodynamicOperations;
7+
8+
public class dewPointPressureFlashTest {
9+
@Test
10+
void testRun() {
11+
12+
13+
SystemSrkEos fluid0_HC = new SystemSrkEos();
14+
fluid0_HC.addComponent("methane", 0.7);
15+
fluid0_HC.addComponent("ethane", 0.1);
16+
fluid0_HC.addComponent("propane", 0.1);
17+
fluid0_HC.addComponent("n-butane", 0.1);
18+
fluid0_HC.setMixingRule("classic");
19+
20+
fluid0_HC.setPressure(10.0, "bara");
21+
fluid0_HC.setTemperature(0.0, "C");
22+
23+
ThermodynamicOperations ops = new ThermodynamicOperations(fluid0_HC);
24+
try {
25+
ops.dewPointPressureFlash();
26+
} catch (Exception e) {
27+
e.printStackTrace();
28+
}
29+
assertEquals(9.332383561, fluid0_HC.getPressure(), 1e-2);
30+
31+
}
32+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package neqsim.thermodynamicOperations.flashOps.saturationOps;
2+
3+
import static org.junit.jupiter.api.Assertions.assertEquals;
4+
import org.junit.jupiter.api.Test;
5+
import neqsim.thermo.system.SystemSrkEos;
6+
import neqsim.thermodynamicOperations.ThermodynamicOperations;
7+
8+
public class dewPointTemperatureFlashTest {
9+
@Test
10+
void testRun() {
11+
SystemSrkEos fluid0_HC = new SystemSrkEos();
12+
fluid0_HC.addComponent("methane", 0.7);
13+
fluid0_HC.addComponent("ethane", 0.1);
14+
fluid0_HC.addComponent("propane", 0.1);
15+
fluid0_HC.addComponent("n-butane", 0.1);
16+
fluid0_HC.setMixingRule("classic");
17+
18+
fluid0_HC.setPressure(10.0, "bara");
19+
fluid0_HC.setTemperature(0.0, "C");
20+
21+
ThermodynamicOperations ops = new ThermodynamicOperations(fluid0_HC);
22+
try {
23+
ops.dewPointTemperatureFlash();
24+
} catch (Exception e) {
25+
e.printStackTrace();
26+
}
27+
assertEquals(1.7007677589821242, fluid0_HC.getTemperature("C"), 1e-2);
28+
29+
}
30+
}

0 commit comments

Comments
 (0)