diff --git a/src/main/java/neqsim/thermo/util/readwrite/EclipseFluidReadWrite.java b/src/main/java/neqsim/thermo/util/readwrite/EclipseFluidReadWrite.java index 3abba71149..a483b7b0eb 100644 --- a/src/main/java/neqsim/thermo/util/readwrite/EclipseFluidReadWrite.java +++ b/src/main/java/neqsim/thermo/util/readwrite/EclipseFluidReadWrite.java @@ -24,7 +24,9 @@ public class EclipseFluidReadWrite { public static String pseudoName = ""; /** - *

setComposition.

+ *

+ * setComposition. + *

* * @param fluid a {@link neqsim.thermo.system.SystemInterface} object * @param inputFile a {@link java.lang.String} object @@ -36,7 +38,9 @@ public static void setComposition(SystemInterface fluid, String inputFile, Strin } /** - *

setComposition.

+ *

+ * setComposition. + *

* * @param fluid a {@link neqsim.thermo.system.SystemInterface} object * @param inputFile a {@link java.lang.String} object @@ -107,7 +111,9 @@ public static void setComposition(SystemInterface fluid, String inputFile) { } /** - *

read.

+ *

+ * read. + *

* * @param inputFile a {@link java.lang.String} object * @param pseudoNameIn a {@link java.lang.String} object @@ -161,7 +167,7 @@ public static SystemInterface read(String inputFile) { } if (st.equals("CNAMES")) { while ((st = br.readLine().replace("/", "")) != null) { - if (st.startsWith("--")) { + if (st.startsWith("--") || st.isEmpty()) { break; } names.add(st); @@ -169,7 +175,7 @@ public static SystemInterface read(String inputFile) { } if (st.equals("TCRIT")) { while ((st = br.readLine().replace("/", "")) != null) { - if (st.startsWith("--")) { + if (st.startsWith("--") || st.isEmpty()) { break; } TC.add(Double.parseDouble(st)); @@ -177,7 +183,7 @@ public static SystemInterface read(String inputFile) { } if (st.equals("PCRIT")) { while ((st = br.readLine().replace("/", "")) != null) { - if (st.startsWith("--")) { + if (st.startsWith("--") || st.isEmpty()) { break; } PC.add(Double.parseDouble(st)); @@ -185,7 +191,7 @@ public static SystemInterface read(String inputFile) { } if (st.equals("ACF")) { while ((st = br.readLine().replace("/", "")) != null) { - if (st.startsWith("--")) { + if (st.startsWith("--") || st.isEmpty()) { break; } ACF.add(Double.parseDouble(st)); @@ -193,7 +199,7 @@ public static SystemInterface read(String inputFile) { } if (st.equals("MW")) { while ((st = br.readLine().replace("/", "")) != null) { - if (st.startsWith("--")) { + if (st.startsWith("--") || st.isEmpty()) { break; } MW.add(Double.parseDouble(st)); @@ -201,7 +207,7 @@ public static SystemInterface read(String inputFile) { } if (st.equals("TBOIL")) { while ((st = br.readLine().replace("/", "")) != null) { - if (st.startsWith("--")) { + if (st.startsWith("--") || st.isEmpty()) { break; } TBOIL.add(Double.parseDouble(st)); @@ -209,7 +215,7 @@ public static SystemInterface read(String inputFile) { } if (st.equals("VCRIT")) { while ((st = br.readLine().replace("/", "")) != null) { - if (st.startsWith("--")) { + if (st.startsWith("--") || st.isEmpty()) { break; } VCRIT.add(Double.parseDouble(st)); @@ -217,7 +223,7 @@ public static SystemInterface read(String inputFile) { } if (st.equals("SSHIFT")) { while ((st = br.readLine().replace("/", "")) != null) { - if (st.startsWith("--")) { + if (st.startsWith("--") || st.isEmpty()) { break; } SSHIFT.add(Double.parseDouble(st)); @@ -225,7 +231,7 @@ public static SystemInterface read(String inputFile) { } if (st.equals("PARACHOR")) { while ((st = br.readLine().replace("/", "")) != null) { - if (st.startsWith("--")) { + if (st.startsWith("--") || st.isEmpty()) { break; } PARACHOR.add(Double.parseDouble(st)); @@ -233,7 +239,7 @@ public static SystemInterface read(String inputFile) { } if (st.equals("ZI")) { while ((st = br.readLine().replace("/", "")) != null) { - if (st.startsWith("--")) { + if (st.startsWith("--") || st.isEmpty()) { break; } ZI.add(Double.parseDouble(st)); @@ -245,7 +251,7 @@ public static SystemInterface read(String inputFile) { kij = new double[names.size()][names.size()]; while ((st = br.readLine().replace("/", "")) != null) { numb++; - if (st.startsWith("--")) { + if (st.startsWith("--") || st.isEmpty()) { break; } diff --git a/src/test/java/neqsim/thermo/util/readwrite/A-1.E300 b/src/test/java/neqsim/thermo/util/readwrite/A-1.E300 new file mode 100644 index 0000000000..f7f1e1c43b --- /dev/null +++ b/src/test/java/neqsim/thermo/util/readwrite/A-1.E300 @@ -0,0 +1,434 @@ +-- Dummy EOS for FluidMagic Test case +-- +-- Copyright (C) 2022 Equinor + +-- Units +METRIC +-- Number of components: +NCOMPS +22 / +-- Equation of state +EOS +PR / +PRCORR + +-- Reservoir temperature (C) +RTEMP + 90.00 / + +-- Standard Conditions (C and bara) +STCOND + 15.00000 1.01325 / + +-- Component names +CNAMES +N2 +CO2 +C1 +C2 +C3 +iC4 +C4 +iC5 +C5 +C6 +C7 +C8 +C9 +C10-C12 +C13-C14 +C15-C17 +C18-C21 +C22-C28 +C29-C36 +C37-C45 +C46-C58 +C59-C80 / +-- Tc (K) +TCRIT + 126.200 + 304.200 + 190.600 + 305.400 + 369.800 + 408.100 + 425.200 + 460.400 + 469.600 + 507.400 + 548.083 + 568.470 + 592.686 + 631.845 + 680.299 + 727.035 + 774.284 + 851.846 + 943.373 + 1038.592 + 1152.236 + 1317.304 / +-- Pc (Bar) +PCRIT + 33.9439 + 73.7646 + 46.0015 + 48.8387 + 42.4552 + 36.4770 + 37.9969 + 33.8426 + 33.7412 + 29.6882 + 29.4519 + 27.6423 + 25.5535 + 22.7296 + 20.0143 + 18.1224 + 16.7108 + 15.1759 + 14.0297 + 13.2891 + 12.7370 + 12.2645 +/ +-- Omega +ACF + 0.04000 + 0.22500 + 0.00800 + 0.09800 + 0.15200 + 0.17600 + 0.19300 + 0.22700 + 0.25100 + 0.29600 + 0.33744 + 0.37547 + 0.42325 + 0.50535 + 0.61393 + 0.72473 + 0.83712 + 1.00708 + 1.15740 + 1.21951 + 1.12382 + 0.62590 / +-- OmegaA +OMEGAA + 0.45724 + 0.45724 + 0.45724 + 0.45724 + 0.45724 + 0.45724 + 0.45724 + 0.45724 + 0.45724 + 0.45724 + 0.45724 + 0.45724 + 0.45724 + 0.45724 + 0.45724 + 0.45724 + 0.45724 + 0.45724 + 0.45724 + 0.45724 + 0.45724 + 0.45724 / +-- OmegaB +OMEGAB + 0.07780 + 0.07780 + 0.07780 + 0.07780 + 0.07780 + 0.07780 + 0.07780 + 0.07780 + 0.07780 + 0.07780 + 0.07780 + 0.07780 + 0.07780 + 0.07780 + 0.07780 + 0.07780 + 0.07780 + 0.07780 + 0.07780 + 0.07780 + 0.07780 + 0.07780 / +-- Molecular weights +MW + 28.0135 + 44.0098 + 16.0429 + 30.0698 + 44.0968 + 58.1237 + 58.1237 + 72.1507 + 72.1506 + 86.1776 + 96.0000 + 107.0000 + 121.0000 + 145.7094 + 181.9678 + 220.6919 + 264.4041 + 342.9118 + 447.3217 + 565.3735 + 714.4236 + 942.2227 / +-- Boiling points (K) +TBOIL + 77.400 + 194.650 + 111.600 + 184.600 + 231.100 + 261.400 + 272.700 + 301.000 + 309.200 + 341.900 + 365.100 + 389.900 + 415.400 + 459.042 + 509.712 + 555.777 + 599.945 + 669.261 + 738.465 + 799.356 + 865.446 + 950.674 / +-- Critical volumes (m3/kg-mole) +VCRIT + 0.08980 + 0.09400 + 0.09900 + 0.14800 + 0.20300 + 0.26300 + 0.25500 + 0.30600 + 0.30400 + 0.37000 + 0.47555 + 0.48784 + 0.52918 + 0.62175 + 0.75937 + 0.92679 + 1.12076 + 1.49307 + 2.00337 + 2.60288 + 3.39260 + 4.64881 / +-- Critical Z-factors +ZCRIT + 0.29049 + 0.27414 + 0.28737 + 0.28465 + 0.28029 + 0.28272 + 0.27406 + 0.27052 + 0.26270 + 0.26037 + 0.30733 + 0.28530 + 0.27440 + 0.26900 + 0.26869 + 0.27784 + 0.29091 + 0.31991 + 0.35833 + 0.40055 + 0.45103 + 0.52054 / +-- Volume translation/co-volume +SSHIFT + -0.175888 + -0.049181 + -0.194020 + -0.143142 + -0.112702 + -0.099214 + -0.089659 + -0.070455 + -0.056872 + 0.012573 + 0.074067 + 0.085121 + 0.081268 + 0.069060 + 0.048755 + 0.018239 + -0.017443 + -0.077518 + -0.156174 + -0.235730 + -0.320950 + -0.420868 / +-- Parachors (dyn/cm) +PARACHOR + 41.000 + 78.000 + 77.300 + 108.900 + 151.900 + 181.500 + 191.700 + 225.000 + 233.900 + 271.000 + 283.940 + 309.680 + 342.440 + 402.209 + 485.824 + 577.490 + 679.641 + 866.931 + 1111.372 + 1387.629 + 1739.859 + 2282.641 / +-- Overall dummy oil composition +ZI + 0.003912 + 0.003010 + 0.403275 + 0.076341 + 0.079752 + 0.011938 + 0.040929 + 0.013944 + 0.021568 + 0.027988 + 0.042936 + 0.043237 + 0.030898 + 0.043939 + 0.045143 + 0.022571 + 0.025180 + 0.021188 + 0.014111 + 0.012845 + 0.008955 + 0.006340 / +-- Binary interaction coefficients for PR +BIC + -0.0170 + 0.0311 0.1200 + 0.0515 0.1200 0.0000 + 0.0852 0.1200 0.0000 0.0000 + 0.1033 0.1200 0.0000 0.0000 0.0000 + 0.0800 0.1200 0.0000 0.0000 0.0000 0.0000 + 0.0922 0.1200 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.1000 0.1200 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0800 0.1200 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0800 0.1000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0800 0.1000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0000 + 0.0800 0.1000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0000 0.0000 + 0.0800 0.1000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0000 0.0000 0.0000 + 0.0800 0.1000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0000 0.0000 0.0000 0.0000 + 0.0800 0.1000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0800 0.1000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0800 0.1000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0800 0.1000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0800 0.1000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0800 0.1000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0800 0.1000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0000 +/ +BICS + -0.0170 + 0.0311 0.1200 + 0.0515 0.1200 0.0000 + 0.0852 0.1200 0.0000 0.0000 + 0.1033 0.1200 0.0000 0.0000 0.0000 + 0.0800 0.1200 0.0000 0.0000 0.0000 0.0000 + 0.0922 0.1200 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.1000 0.1200 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0800 0.1200 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0800 0.1000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0800 0.1000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0000 + 0.0800 0.1000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0000 0.0000 + 0.0800 0.1000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0000 0.0000 0.0000 + 0.0800 0.1000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0000 0.0000 0.0000 0.0000 + 0.0800 0.1000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0800 0.1000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0800 0.1000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0800 0.1000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0800 0.1000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0800 0.1000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0800 0.1000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0000 +/ +-- LBC coefficients +LBCCOEF + 0.1023000 0.0233640 0.0585330 -0.0407580 0.0093324 / + +-- Volume translation/co-volume at surface conditions +SSHIFTS + -0.175888 + -0.061524 + -0.194020 + -0.143142 + -0.112702 + -0.099214 + -0.089659 + -0.070455 + -0.056872 + 0.012573 + 0.073289 + 0.087351 + 0.090562 + 0.088354 + 0.076389 + 0.053077 + 0.022966 + -0.030899 + -0.104022 + -0.179642 + -0.262040 + -0.361298 / diff --git a/src/test/java/neqsim/thermo/util/readwrite/EclipseFluidReadWriteTest.java b/src/test/java/neqsim/thermo/util/readwrite/EclipseFluidReadWriteTest.java index 6fa3b5feb7..e4048296a2 100644 --- a/src/test/java/neqsim/thermo/util/readwrite/EclipseFluidReadWriteTest.java +++ b/src/test/java/neqsim/thermo/util/readwrite/EclipseFluidReadWriteTest.java @@ -14,6 +14,7 @@ class EclipseFluidReadWriteTest extends neqsim.NeqSimTest { static neqsim.thermo.system.SystemInterface testSystem = null; File file = new File("src/test/java/neqsim/thermo/util/readwrite"); + String fileA1 = file.getAbsolutePath() + "/A-1.E300"; String fileA13 = file.getAbsolutePath() + "/A-13.E300"; String fileA17 = file.getAbsolutePath() + "/A-17.E300"; String fileA19 = file.getAbsolutePath() + "/A-19.E300"; @@ -22,8 +23,7 @@ class EclipseFluidReadWriteTest extends neqsim.NeqSimTest { * @throws java.lang.Exception */ @BeforeAll - static void setUpBeforeClass() throws Exception { - } + static void setUpBeforeClass() throws Exception {} /** * Test method for @@ -54,6 +54,17 @@ void testReadAndAddFluids() throws IOException { testOps.TPflash(); } + @Test + void testReadAndAddFluids2() throws IOException { + EclipseFluidReadWrite.pseudoName = "_A1"; + testSystem = EclipseFluidReadWrite.read(fileA1); + + ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem); + testSystem.setPressure(100.0, "bara"); + testSystem.setTemperature(25.0, "C"); + testOps.TPflash(); + } + @Test void testSetComposition() throws IOException { EclipseFluidReadWrite.pseudoName = "_A19";