Skip to content

Commit 94592ac

Browse files
authored
added test for Plus fraction model (#1079)
1 parent 22cb415 commit 94592ac

File tree

2 files changed

+151
-1
lines changed

2 files changed

+151
-1
lines changed

src/main/java/neqsim/thermo/characterization/PlusFractionModel.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,9 @@ public PedersenHeavyOilPlusModel() {
308308
* @return a {@link neqsim.thermo.characterization.PlusFractionModelInterface} object
309309
*/
310310
public PlusFractionModelInterface getModel(String name) {
311-
if (name.equals("heavyOil")) {
311+
if (name.equals("Pedersen")) {
312+
return new PedersenPlusModel();
313+
} else if (name.equals("Pedersen Heavy Oil")) {
312314
return new PedersenHeavyOilPlusModel();
313315
} else {
314316
return new PedersenPlusModel();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
package neqsim.thermo.characterization;
2+
3+
import static org.junit.jupiter.api.Assertions.assertEquals;
4+
import org.junit.jupiter.api.Test;
5+
import neqsim.thermo.system.SystemInterface;
6+
import neqsim.thermo.system.SystemSrkEos;
7+
import neqsim.thermodynamicOperations.ThermodynamicOperations;
8+
9+
public class PlusFractionModelTest {
10+
11+
@Test
12+
void testPedersenPlusModelCharacterization() {
13+
SystemInterface thermoSystem = null;
14+
thermoSystem = new SystemSrkEos(298.0, 10.0);
15+
16+
thermoSystem.addComponent("CO2", 1.0);
17+
thermoSystem.addComponent("methane", 51.0);
18+
thermoSystem.addComponent("ethane", 1.0);
19+
thermoSystem.addComponent("propane", 1.0);
20+
21+
thermoSystem.getCharacterization().setTBPModel("PedersenSRK"); // this need to be set before
22+
// adding oil components
23+
24+
thermoSystem.addTBPfraction("C6", 1.0, 90.0 / 1000.0, 0.7);
25+
thermoSystem.addTBPfraction("C7", 1.0, 110.0 / 1000.0, 0.73);
26+
thermoSystem.addTBPfraction("C8", 1.0, 120.0 / 1000.0, 0.76);
27+
thermoSystem.addTBPfraction("C9", 1.0, 140.0 / 1000.0, 0.79);
28+
thermoSystem.addPlusFraction("C10", 11.0, 290.0 / 1000.0, 0.82);
29+
30+
/*
31+
* Specify that the Pedersen plus fraction model will be used for characterizing the plus
32+
* component
33+
*/
34+
thermoSystem.getCharacterization().setPlusFractionModel("Pedersen");
35+
36+
thermoSystem.getCharacterization().setLumpingModel("PVTlumpingModel"); // this is default
37+
// lumping model in
38+
// neqsim. Needs to be
39+
// set before calling
40+
// characterisePlusFraction()
41+
42+
thermoSystem.getCharacterization().getLumpingModel().setNumberOfPseudoComponents(12); // specify
43+
// numer
44+
// of
45+
// lumped
46+
// components
47+
// (C6-C80
48+
// components)
49+
thermoSystem.getCharacterization().characterisePlusFraction();
50+
assertEquals(16, thermoSystem.getNumberOfComponents());
51+
52+
ThermodynamicOperations ops = new ThermodynamicOperations(thermoSystem);
53+
ops.TPflash();
54+
55+
assertEquals(0.76652495787, thermoSystem.getBeta(), 1e-4);
56+
57+
58+
}
59+
60+
@Test
61+
void testPedersenHeavyOilPlusModelCharacterization() {
62+
SystemInterface thermoSystem = null;
63+
thermoSystem = new SystemSrkEos(298.0, 10.0);
64+
65+
thermoSystem.addComponent("CO2", 1.0);
66+
thermoSystem.addComponent("methane", 51.0);
67+
thermoSystem.addComponent("ethane", 1.0);
68+
thermoSystem.addComponent("propane", 1.0);
69+
70+
thermoSystem.getCharacterization().setTBPModel("PedersenSRK"); // this need to be set before
71+
// adding oil components
72+
73+
thermoSystem.addTBPfraction("C6", 1.0, 90.0 / 1000.0, 0.7);
74+
thermoSystem.addTBPfraction("C7", 1.0, 110.0 / 1000.0, 0.73);
75+
thermoSystem.addTBPfraction("C8", 1.0, 120.0 / 1000.0, 0.76);
76+
thermoSystem.addTBPfraction("C9", 1.0, 140.0 / 1000.0, 0.79);
77+
thermoSystem.addPlusFraction("C10", 11.0, 590.0 / 1000.0, 0.90);
78+
79+
/*
80+
* Specify that the Pedersen heavy oil plus fraction model will be used for characterizing the
81+
* plus component
82+
*/
83+
thermoSystem.getCharacterization().setPlusFractionModel("Pedersen Heavy Oil");
84+
85+
thermoSystem.getCharacterization().setLumpingModel("PVTlumpingModel"); // this is default
86+
// lumping model in
87+
// neqsim. Needs to be
88+
// set before calling
89+
// characterisePlusFraction()
90+
91+
thermoSystem.getCharacterization().getLumpingModel().setNumberOfPseudoComponents(12); // specify
92+
// numer
93+
// of
94+
// lumped
95+
// components
96+
// (C6-C80
97+
// components)
98+
thermoSystem.getCharacterization().characterisePlusFraction();
99+
assertEquals(16, thermoSystem.getNumberOfComponents());
100+
101+
ThermodynamicOperations ops = new ThermodynamicOperations(thermoSystem);
102+
ops.TPflash();
103+
104+
assertEquals(0.767085187, thermoSystem.getBeta(), 1e-4);
105+
106+
107+
}
108+
109+
@Test
110+
void testGammaModelCharacterization() {
111+
SystemInterface thermoSystem = null;
112+
thermoSystem = new SystemSrkEos(298.0, 10.0);
113+
114+
thermoSystem.addComponent("CO2", 1.0);
115+
thermoSystem.addComponent("methane", 51.0);
116+
thermoSystem.addComponent("ethane", 1.0);
117+
thermoSystem.addComponent("propane", 1.0);
118+
119+
thermoSystem.getCharacterization().setTBPModel("PedersenSRK"); // this need to be set before
120+
// adding oil components
121+
122+
thermoSystem.addTBPfraction("C6", 1.0, 90.0 / 1000.0, 0.7);
123+
thermoSystem.addTBPfraction("C7", 1.0, 110.0 / 1000.0, 0.73);
124+
thermoSystem.addTBPfraction("C8", 1.0, 120.0 / 1000.0, 0.76);
125+
thermoSystem.addTBPfraction("C9", 1.0, 140.0 / 1000.0, 0.79);
126+
thermoSystem.addPlusFraction("C10", 11.0, 290.0 / 1000.0, 0.82);
127+
128+
thermoSystem.getCharacterization().setLumpingModel("PVTlumpingModel"); // this is default
129+
// lumping model in
130+
// neqsim. Needs to be
131+
// set before calling
132+
// characterisePlusFraction()
133+
134+
thermoSystem.getCharacterization().getLumpingModel().setNumberOfPseudoComponents(12); // specify
135+
// numer
136+
// of
137+
// lumped
138+
// components
139+
// (C6-C80
140+
// components)
141+
thermoSystem.getCharacterization().characterisePlusFraction();
142+
assertEquals(16, thermoSystem.getNumberOfComponents());
143+
144+
}
145+
146+
147+
148+
}

0 commit comments

Comments
 (0)