Skip to content

Commit 0071710

Browse files
authored
add eclipse with water (#1281)
* add eclipse with water * update * update test * update
1 parent e610d14 commit 0071710

File tree

3 files changed

+372
-4
lines changed

3 files changed

+372
-4
lines changed

src/main/java/neqsim/thermo/util/readwrite/EclipseFluidReadWrite.java

+8-4
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,9 @@ public static SystemInterface read(String inputFile) {
336336
} else if (name.equals("CO2") || TC.get(counter) < 00.0) {
337337
name = "CO2";
338338
fluid.addComponent(name, ZI.get(counter));
339+
} else if (name.strip().equals("H2O") || TC.get(counter) < 00.0) {
340+
name = "water";
341+
fluid.addComponent(name, ZI.get(counter));
339342
} else if (TC.get(counter) >= 00.0) {
340343
name = names.get(counter);
341344
Double stddensity = 0.5046 * MW.get(counter) / 1000.0 + 0.668468;
@@ -389,8 +392,6 @@ public static SystemInterface read(String inputFile) {
389392
return fluid;
390393
}
391394

392-
393-
394395
/**
395396
* <p>
396397
* read.
@@ -569,7 +570,6 @@ public static SystemInterface read(String inputFile, String[] fluidNames) {
569570
}
570571
}
571572

572-
573573
for (String fluidName : fluidNames) {
574574
for (int counter = 0; counter < names.size(); counter++) {
575575
String name = names.get(counter);
@@ -603,6 +603,9 @@ public static SystemInterface read(String inputFile, String[] fluidNames) {
603603
} else if (name.equals("CO2") || TC.get(counter) < 00.0) {
604604
name = "CO2";
605605
fluid.addComponent(name, ZI.get(counter));
606+
} else if (name.strip().equals("H2O") || TC.get(counter) < 00.0) {
607+
name = "water";
608+
fluid.addComponent(name, ZI.get(counter));
606609
} else if (TC.get(counter) >= 0.0) {
607610
name = names.get(counter);
608611
Double stddensity = 0.5046 * MW.get(counter) / 1000.0 + 0.668468;
@@ -660,7 +663,8 @@ public static SystemInterface read(String inputFile, String[] fluidNames) {
660663
// Then, to replicate the original kij,
661664
// we just pick the old kij[baseIndexI][baseIndexJ].
662665
// System.out.println("i: " + i + " j: " + j);
663-
// System.out.println("baseIndexI: " + baseIndexI + " baseIndexJ: " + baseIndexJ);
666+
// System.out.println("baseIndexI: " + baseIndexI + " baseIndexJ: " +
667+
// baseIndexJ);
664668
double kijVal = kij[baseIndexI][baseIndexJ];
665669

666670
// Finally set it in the fluid

src/test/java/neqsim/thermo/util/readwrite/EclipseFluidReadWriteTest.java

+31
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import static org.junit.jupiter.api.Assertions.assertEquals;
44
import java.io.File;
55
import java.io.IOException;
6+
import org.junit.jupiter.api.Assertions;
67
import org.junit.jupiter.api.Test;
78
import neqsim.thermo.phase.PhaseEos;
89
import neqsim.thermodynamicoperations.ThermodynamicOperations;
@@ -20,6 +21,7 @@ class EclipseFluidReadWriteTest extends neqsim.NeqSimTest {
2021
String fileA17 = file.getAbsolutePath() + "/A-17.E300";
2122
String fileA19 = file.getAbsolutePath() + "/A-19.E300";
2223
String filer = file.getAbsolutePath() + "/fluid-r.E300";
24+
String fluid_water = file.getAbsolutePath() + "/fluid_water.E300";
2325

2426
/**
2527
* Test method for
@@ -161,4 +163,33 @@ void testReadFluidR() throws IOException {
161163
// testSystem.prettyPrint();
162164
// Assertions.assertEquals(0.9270363530, testSystem.getBeta(0), 1e-6);
163165
}
166+
167+
@Test
168+
void testFluidWater() throws IOException {
169+
testSystem = EclipseFluidReadWrite.read(fluid_water);
170+
testSystem.setMultiPhaseCheck(true);
171+
ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem);
172+
testSystem.setPressure(60.0, "bara");
173+
testSystem.setTemperature(65.0, "C");
174+
testOps.TPflash();
175+
176+
// testSystem.prettyPrint();
177+
178+
neqsim.thermo.util.readwrite.TablePrinter.printTable(
179+
(((PhaseEos) testSystem.getPhase(0)).getMixingRule().getBinaryInteractionParameters()));
180+
double[][] paramsPhase0 =
181+
((PhaseEos) testSystem.getPhase(0)).getMixingRule().getBinaryInteractionParameters();
182+
double[][] paramsPhase1 =
183+
((PhaseEos) testSystem.getPhase(2)).getMixingRule().getBinaryInteractionParameters();
184+
185+
// Check that both 2D arrays have the same dimensions first.
186+
Assertions.assertEquals(paramsPhase0.length, paramsPhase1.length);
187+
188+
// CHeck that kij are equal of phase gas and water
189+
for (int i = 0; i < paramsPhase0.length; i++) {
190+
for (int j = 0; j < paramsPhase0.length; j++) {
191+
Assertions.assertEquals(paramsPhase0[i][j], paramsPhase1[i][j]);
192+
}
193+
}
194+
}
164195
}

0 commit comments

Comments
 (0)