Skip to content

Commit

Permalink
update eclipse read (#1005)
Browse files Browse the repository at this point in the history
  • Loading branch information
EvenSol committed May 9, 2024
1 parent 8346fe4 commit 9b0d753
Show file tree
Hide file tree
Showing 3 changed files with 452 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,9 @@ public static SystemInterface read(String inputFile) {
ArrayList<Double> ZI = new ArrayList<Double>();
ArrayList<Double> BIC = new ArrayList<Double>();
String EOS;

boolean shiftisset = false;
while ((st = br.readLine()) != null) {

// System.out.println("EOS " +EOS );
if (st.trim().equals("EOS")) {
EOS = br.readLine().replace("/", "");
Expand Down Expand Up @@ -233,7 +234,8 @@ public static SystemInterface read(String inputFile) {
VCRIT.add(Double.parseDouble(st));
}
}
if (st.equals("SSHIFT")) {
if (st.equals("SSHIFT") && !shiftisset) {
shiftisset = true;
while ((st = br.readLine().replace("/", "")) != null) {
if (st.startsWith("--") || st.isEmpty()) {
break;
Expand Down Expand Up @@ -318,11 +320,13 @@ public static SystemInterface read(String inputFile) {
fluid.addComponent(name, ZI.get(counter));
} else if (TC.get(counter) >= 00.0) {
name = names.get(counter);
fluid.addTBPfraction(name, ZI.get(counter), MW.get(counter) / 1000.0, 0.9);
double stddensity = 0.5046 * MW.get(counter) / 1000.0 + 0.668468;
fluid.addTBPfraction(name, ZI.get(counter), MW.get(counter) / 1000.0, stddensity);
name = name + "_PC";
} else {
name = names.get(counter);
fluid.addTBPfraction(name, ZI.get(counter), MW.get(counter) / 1000.0, 0.9);
double stddensity = 0.5046 * MW.get(counter) / 1000.0 + 0.668468;
fluid.addTBPfraction(name, ZI.get(counter), MW.get(counter) / 1000.0, stddensity);
name = name + "_PC";
// fluid.changeComponentName(name+"_PC", names.get(counter));
}
Expand All @@ -336,6 +340,7 @@ public static SystemInterface read(String inputFile) {
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));
fluid.getPhase(i).getComponent(name).setRacketZ(0.29056 - 0.08775 * ACF.get(counter));
}
if (fluid.getPhase(0).getComponent(name).isIsTBPfraction()) {
fluid.changeComponentName(name, names.get(counter).replaceAll("_PC", "") + pseudoName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,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 fileFluid1 = file.getAbsolutePath() + "/fluid1.e300";
String fileA1 = file.getAbsolutePath() + "/A-1.E300";
String fileA13 = file.getAbsolutePath() + "/A-13.E300";
String fileA17 = file.getAbsolutePath() + "/A-17.E300";
Expand Down Expand Up @@ -85,4 +86,22 @@ void testSetComposition() throws IOException {
ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem);
testOps.TPflash();
}

@Test
void testReadFluid1() throws IOException {
testSystem = EclipseFluidReadWrite.read(fileFluid1);
ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem);
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()));

// for (int i = 0; i < testSystem.getNumberOfComponents(); i++) {
// System.out.println(testSystem.getComponent(i).getName() + " TC "
// + (testSystem.getComponent(i).getVolumeCorrectionConst()));
// }
}
}
Loading

0 comments on commit 9b0d753

Please sign in to comment.