From 811b5a0a556cc2ad7893d11403b51b62f6f7a21d Mon Sep 17 00:00:00 2001 From: Even Solbraa <41290109+EvenSol@users.noreply.github.com> Date: Thu, 9 May 2024 09:41:27 +0200 Subject: [PATCH] update eclipse reader (#1006) --- .../util/readwrite/EclipseFluidReadWrite.java | 25 ++++++++++++++++--- .../readwrite/EclipseFluidReadWriteTest.java | 1 - 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/main/java/neqsim/thermo/util/readwrite/EclipseFluidReadWrite.java b/src/main/java/neqsim/thermo/util/readwrite/EclipseFluidReadWrite.java index c6f79d7935..a90c22bdf7 100644 --- a/src/main/java/neqsim/thermo/util/readwrite/EclipseFluidReadWrite.java +++ b/src/main/java/neqsim/thermo/util/readwrite/EclipseFluidReadWrite.java @@ -149,13 +149,13 @@ public static SystemInterface read(String inputFile) { ArrayList ACF = new ArrayList(); ArrayList MW = new ArrayList(); ArrayList SSHIFT = new ArrayList(); + ArrayList SSHIFTS = new ArrayList(); ArrayList TBOIL = new ArrayList(); ArrayList VCRIT = new ArrayList(); ArrayList PARACHOR = new ArrayList(); ArrayList ZI = new ArrayList(); ArrayList BIC = new ArrayList(); String EOS; - boolean shiftisset = false; while ((st = br.readLine()) != null) { // System.out.println("EOS " +EOS ); @@ -234,8 +234,7 @@ public static SystemInterface read(String inputFile) { VCRIT.add(Double.parseDouble(st)); } } - if (st.equals("SSHIFT") && !shiftisset) { - shiftisset = true; + if (st.equals("SSHIFT")) { while ((st = br.readLine().replace("/", "")) != null) { if (st.startsWith("--") || st.isEmpty()) { break; @@ -285,6 +284,20 @@ public static SystemInterface read(String inputFile) { list.clear(); } } + if (st.equals("SSHIFTS")) { + String line; + while ((line = br.readLine()) != null) { + st = line.replace("/", ""); + if (st.startsWith("--") || st.isEmpty()) { + break; + } + try { + SSHIFTS.add(Double.parseDouble(st)); + } catch (NumberFormatException e) { + System.out.println("Error parsing double value: " + e.getMessage()); + } + } + } } for (int counter = 0; counter < names.size(); counter++) { String name = names.get(counter); @@ -339,7 +352,11 @@ public static SystemInterface read(String inputFile) { fluid.getPhase(i).getComponent(name).setNormalBoilingPoint(TBOIL.get(counter)); fluid.getPhase(i).getComponent(name).setCriticalVolume(VCRIT.get(counter)); fluid.getPhase(i).getComponent(name).setParachorParameter(PARACHOR.get(counter)); - fluid.getPhase(i).getComponent(name).setVolumeCorrectionConst(SSHIFT.get(counter)); + if (SSHIFTS.size() > 0) { + fluid.getPhase(i).getComponent(name).setVolumeCorrectionConst(SSHIFTS.get(counter)); + } else { + fluid.getPhase(i).getComponent(name).setVolumeCorrectionConst(SSHIFT.get(counter)); + } fluid.getPhase(i).getComponent(name).setRacketZ(0.29056 - 0.08775 * ACF.get(counter)); } if (fluid.getPhase(0).getComponent(name).isIsTBPfraction()) { diff --git a/src/test/java/neqsim/thermo/util/readwrite/EclipseFluidReadWriteTest.java b/src/test/java/neqsim/thermo/util/readwrite/EclipseFluidReadWriteTest.java index f06c42d540..d51d42d922 100644 --- a/src/test/java/neqsim/thermo/util/readwrite/EclipseFluidReadWriteTest.java +++ b/src/test/java/neqsim/thermo/util/readwrite/EclipseFluidReadWriteTest.java @@ -94,7 +94,6 @@ void testReadFluid1() throws IOException { testSystem.setPressure(50.0, "bara"); testSystem.setTemperature(50.0, "C"); testOps.TPflash(); - // testSystem.prettyPrint(); // neqsim.thermo.util.readwrite.TablePrinter.printTable( // (((PhaseEos) testSystem.getPhase(0)).getMixingRule().getBinaryInteractionParameters()));