From 8c1796ac310a9b18265712b29da81ea49eab2b28 Mon Sep 17 00:00:00 2001 From: Even Solbraa <41290109+EvenSol@users.noreply.github.com> Date: Tue, 3 Dec 2024 23:03:07 +0100 Subject: [PATCH] fix minor bug (#1196) * fix minor bug * update * update * update logging * update * update tests * update * ConstantVolumeDepletionTest * update * update * update * update * update * update * update flash * update * update * update * update * update * update * update * update * update * update * updete tezt * debuger log off * update model * remove print --- .../process/equipment/splitter/Splitter.java | 3 +- .../flashops/Flash.java | 75 ++-- .../flashops/RachfordRice.java | 8 +- .../flashops/TPflash.java | 37 +- .../distillation/DistillationColumnTest.java | 2 - .../pipeline/BeggsAndBrillsPipeTest.java | 6 +- .../equipment/reservoir/WellFlowTest.java | 8 +- .../process/equipment/util/AdjusterTest.java | 8 +- .../util/StreamSaturatorUtilTest.java | 2 +- .../processmodel/CompressorModule.java | 6 +- .../process/processmodel/MLA_bug_test.java | 4 +- .../ProcessSystemRunTransientTest.java | 1 - .../processmodel/ProcessSystemTest.java | 4 +- .../simulation/ConstantMassExpansionTest.java | 6 +- .../ConstantVolumeDepletionTest.java | 8 +- .../DifferentialLiberationTest.java | 15 +- .../simulation/SaturationPressureTest.java | 2 +- .../simulation/SlimTubeSimTest.java | 2 +- .../system/SystemUMRPRUMCEosNewTest.java | 6 +- .../readwrite/EclipseFluidReadWriteTest.java | 24 +- .../neqsim/thermo/util/readwrite/fluid-r.E300 | 381 ++++++++++++++++++ .../flashops/TPFlashTest.java | 4 +- 22 files changed, 511 insertions(+), 101 deletions(-) create mode 100644 src/test/java/neqsim/thermo/util/readwrite/fluid-r.E300 diff --git a/src/main/java/neqsim/process/equipment/splitter/Splitter.java b/src/main/java/neqsim/process/equipment/splitter/Splitter.java index 2179a2b0f9..1cb8dfe5ee 100644 --- a/src/main/java/neqsim/process/equipment/splitter/Splitter.java +++ b/src/main/java/neqsim/process/equipment/splitter/Splitter.java @@ -229,8 +229,7 @@ public void run(UUID id) { for (int j = 0; j < inletStream.getThermoSystem().getPhase(0).getNumberOfComponents(); j++) { int index = inletStream.getThermoSystem().getPhase(0).getComponent(j).getComponentNumber(); double moles = inletStream.getThermoSystem().getPhase(0).getComponent(j).getNumberOfmoles(); - double change = - (moles * splitFactor[i] - moles > 0) ? moles : moles * splitFactor[i] - moles; + double change = (moles * splitFactor[i] - moles > 0) ? 0.0 : moles * splitFactor[i] - moles; splitStream[i].getThermoSystem().addComponent(index, change); } ThermodynamicOperations thermoOps = diff --git a/src/main/java/neqsim/thermodynamicoperations/flashops/Flash.java b/src/main/java/neqsim/thermodynamicoperations/flashops/Flash.java index 2b05682a3d..972d278683 100644 --- a/src/main/java/neqsim/thermodynamicoperations/flashops/Flash.java +++ b/src/main/java/neqsim/thermodynamicoperations/flashops/Flash.java @@ -31,7 +31,7 @@ public abstract class Flash extends BaseOperation { int i = 0; int j = 0; int iterations = 0; - int maxNumberOfIterations = 100; + int maxNumberOfIterations = 50; double gibbsEnergy = 0; double gibbsEnergyOld = 0; double Kold = 0; @@ -46,6 +46,7 @@ public abstract class Flash extends BaseOperation { double[] oldDeltalnK; double[] deltalnK; double[] tm; + double tmLimit = -1e-8; int lowestGibbsEnergyPhase = 0; SysNewtonRhapsonTPflash secondOrderSolver; /** Set true to do solid phase check and calculations */ @@ -72,6 +73,8 @@ public int findLowestGibbsEnergyPhase() { } else { lowestGibbsEnergyPhase = 1; } + logger.info("Lowest Gibbs energy phase determined: Phase {}", lowestGibbsEnergyPhase); + findLowestGibbsPhaseIsChecked = true; } return lowestGibbsEnergyPhase; @@ -100,11 +103,11 @@ public void stabilityAnalysis() throws neqsim.util.exception.IsNaNException, double[] d = new double[system.getPhases()[0].getNumberOfComponents()]; double[][] x = new double[2][system.getPhases()[0].getNumberOfComponents()]; double[] error = new double[2]; - tm = new double[system.getPhase(0).getNumberOfComponents()]; + tm = new double[2]; double[] alpha = null; Matrix f = new Matrix(system.getPhases()[0].getNumberOfComponents(), 1); Matrix df = null; - int maxiterations = 50; + int maxiterations = 100; double fNorm = 1.0e10; double fNormOld = 0.0; for (int i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { @@ -112,25 +115,22 @@ public void stabilityAnalysis() throws neqsim.util.exception.IsNaNException, } SystemInterface clonedSystem = minimumGibbsEnergySystem; - clonedSystem.setTotalNumberOfMoles(1.0); - double[] sumw = new double[2]; sumw[1] = 0.0; sumw[0] = 0.0; for (int i = 0; i < clonedSystem.getPhase(0).getNumberOfComponents(); i++) { sumw[1] += clonedSystem.getPhase(0).getComponent(i).getz() / clonedSystem.getPhase(0).getComponent(i).getK(); - sumw[0] += clonedSystem.getPhase(0).getComponent(i).getK() - * clonedSystem.getPhase(0).getComponent(i).getz(); + if (clonedSystem.getPhase(0).getComponent(i).getz() > 0) { + sumw[0] += clonedSystem.getPhase(0).getComponent(i).getK() + * clonedSystem.getPhase(0).getComponent(i).getz(); + } } - // System.out.println("sumw0 " + sumw[0]); - // System.out.println("sumw1 " + sumw[1]); - int start = 0; - int end = 1; // clonedSystem.getNumberOfPhases()-1; + int end = 1; int mult = 1; - // if (sumw[1] > sumw[0]) { + if (lowestGibbsEnergyPhase == 0) { start = end; end = 0; @@ -175,8 +175,8 @@ public void stabilityAnalysis() throws neqsim.util.exception.IsNaNException, + clonedSystem.getPhase(j).getComponent(i).getLogFugacityCoefficient() - d[i])); } fNorm = f.norm2(); - if (fNorm > fNormOld && iterations > 3 || (iterations + 1) % 7 != 0) { - break; + if (fNorm > fNormOld && iterations > 3 && (iterations - 1) % 7 != 0) { + // break; } if (iterations % 7 == 0 && fNorm < fNormOld && !secondOrderStabilityAnalysis) { double vec1 = 0.0; @@ -241,7 +241,7 @@ public void stabilityAnalysis() throws neqsim.util.exception.IsNaNException, // logger.info("err newton " + error[j]); } - logger.info("norm f " + f.norm1()); + // logger.info("norm f " + f.norm1()); // clonedSystem.display(); sumw[j] = 0.0; for (int i = 0; i < clonedSystem.getPhases()[0].getNumberOfComponents(); i++) { @@ -252,17 +252,18 @@ public void stabilityAnalysis() throws neqsim.util.exception.IsNaNException, deltalogWi[i] = logWi[i] - oldlogw[i]; clonedSystem.getPhase(j).getComponent(i).setx(Wi[j][i] / sumw[j]); } - // logger.info("fnorm " + f.norm1() + " err " + error[j] + " iterations " + - // iterations + " phase " + j); - } while ((f.norm1() > 1e-6 && iterations < maxiterations) || (iterations % 7) == 0 - || iterations < 3); + // logger.info("fnorm " + f.norm1() + " err " + error[j] + " iterations " + iterations + // + " phase " + j); + } while ((f.norm1() > 1e-6 && iterations < maxiterations || error[j] > 1e-6) + || (iterations % 7) == 0 || iterations < 3); // (error[j]= maxiterations) { - logger.error("err staability check " + error[j]); - // throw new util.exception.TooManyIterationsException(); + // logger.error("err staability check " + error[j]); + throw new neqsim.util.exception.TooManyIterationsException("too many iterations", null, + maxiterations); } tm[j] = 1.0; @@ -270,7 +271,8 @@ public void stabilityAnalysis() throws neqsim.util.exception.IsNaNException, tm[j] -= Wi[j][i]; x[j][i] = clonedSystem.getPhase(j).getComponent(i).getx(); } - if (tm[j] < -1e-4 && error[j] < 1e-6) { + + if (tm[j] < tmLimit && error[j] < 1e-6) { break; } else { tm[j] = 1.0; @@ -280,25 +282,30 @@ public void stabilityAnalysis() throws neqsim.util.exception.IsNaNException, // check for trivial solution double diffx = 0.0; for (int i = 0; i < clonedSystem.getPhase(0).getNumberOfComponents(); i++) { - diffx += Math.abs(clonedSystem.getPhase(0).getComponent(i).getx() - - clonedSystem.getPhase(1).getComponent(i).getx()); + diffx += Math.abs(clonedSystem.getPhase(j).getComponent(i).getx() + - minimumGibbsEnergySystem.getPhase(0).getComponent(i).getx()); } if (diffx < 1e-10) { tm[0] = 0.0; tm[1] = 0.0; } - if (((tm[0] < -1e-4) || (tm[1] < -1e-4)) && !(Double.isNaN(tm[0]) || (Double.isNaN(tm[1])))) { + if (((tm[0] < tmLimit) || (tm[1] < tmLimit)) + && !(Double.isNaN(tm[0]) || (Double.isNaN(tm[1])))) { for (int i = 0; i < clonedSystem.getPhases()[0].getNumberOfComponents(); i++) { - if (system.getPhases()[1].getComponent(i).getx() < 1e-100) { + if (system.getPhase(0).getComponent(i).getx() < 1e-100) { continue; } - if (tm[0] < -1e-4) { - system.getPhases()[1].getComponent(i).setK((Wi[0][i] / sumw[0]) / (Wi[1][i] / sumw[1])); - system.getPhases()[0].getComponent(i).setK((Wi[0][i] / sumw[0]) / (Wi[1][i] / sumw[1])); - } else if (tm[1] < -1e-4) { - system.getPhases()[1].getComponent(i).setK((Wi[0][i] / sumw[0]) / (Wi[1][i] / sumw[1])); - system.getPhases()[0].getComponent(i).setK((Wi[0][i] / sumw[0]) / (Wi[1][i] / sumw[1])); + if (tm[0] < tmLimit) { + system.getPhases()[1].getComponent(i).setK(clonedSystem.getPhase(0).getComponent(i).getx() + / clonedSystem.getPhase(1).getComponent(i).getx()); + system.getPhases()[0].getComponent(i).setK(clonedSystem.getPhase(0).getComponent(i).getx() + / clonedSystem.getPhase(1).getComponent(i).getx()); + } else if (tm[1] < tmLimit) { + system.getPhases()[1].getComponent(i).setK(clonedSystem.getPhase(0).getComponent(i).getx() + / clonedSystem.getPhase(1).getComponent(i).getx()); + system.getPhases()[0].getComponent(i).setK(clonedSystem.getPhase(0).getComponent(i).getx() + / clonedSystem.getPhase(1).getComponent(i).getx()); } else { logger.info("error in stability anlysis"); system.init(0); @@ -332,7 +339,7 @@ public boolean stabilityCheck() { logger.error("error ", ex); } } - if (!(tm[0] < -1e-4) && !(tm[1] < -1e-4) || system.getPhase(0).getNumberOfComponents() == 1) { + if (tm[0] > tmLimit && tm[1] > tmLimit || system.getPhase(0).getNumberOfComponents() == 1) { stable = true; system.init(0); // logger.info("system is stable"); @@ -351,7 +358,7 @@ public boolean stabilityCheck() { } else { RachfordRice rachfordRice = new RachfordRice(); try { - system.setBeta(rachfordRice.calcBeta(system.getKvector(), system.getzvector())); + system.setBeta(rachfordRice.calcBeta(system.getKvector(), minimumGibbsEnergySystem.getzvector())); } catch (Exception ex) { if (!Double.isNaN(rachfordRice.getBeta()[0])) { system.setBeta(rachfordRice.getBeta()[0]); diff --git a/src/main/java/neqsim/thermodynamicoperations/flashops/RachfordRice.java b/src/main/java/neqsim/thermodynamicoperations/flashops/RachfordRice.java index 1361a66557..5eb9702400 100644 --- a/src/main/java/neqsim/thermodynamicoperations/flashops/RachfordRice.java +++ b/src/main/java/neqsim/thermodynamicoperations/flashops/RachfordRice.java @@ -7,6 +7,9 @@ package neqsim.thermodynamicoperations.flashops; import java.io.Serializable; +import java.util.Arrays; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; import neqsim.thermo.component.ComponentInterface; import neqsim.thermo.system.SystemInterface; @@ -16,9 +19,10 @@ * @author Even Solbraa */ public class RachfordRice implements Serializable { + static Logger logger = LogManager.getLogger(PHsolidFlash.class); private static final long serialVersionUID = 1000; private double[] beta = new double[2]; - private static String method = "Michelsen2001"; // alternative use Nielsen2023 + private static String method = "Michelsen2001"; // alternative use Nielsen2023 or Michelsen2001 /** *

@@ -192,6 +196,8 @@ public double calcBetaMichelsen2001(double[] K, double[] z) beta[1] = 1.0 - nybeta; if (iterations >= maxIterations) { + logger.debug("K " + Arrays.toString(K)); + logger.debug("z " + Arrays.toString(z)); throw new neqsim.util.exception.TooManyIterationsException(new RachfordRice(), "calcBetaMichelsen2001", maxIterations); } diff --git a/src/main/java/neqsim/thermodynamicoperations/flashops/TPflash.java b/src/main/java/neqsim/thermodynamicoperations/flashops/TPflash.java index eeb6aca425..4c018bd55c 100644 --- a/src/main/java/neqsim/thermodynamicoperations/flashops/TPflash.java +++ b/src/main/java/neqsim/thermodynamicoperations/flashops/TPflash.java @@ -208,12 +208,15 @@ public void run() { system.init(0); system.init(1); - if (system.getPhase(0).getGibbsEnergy() < system.getPhase(1).getGibbsEnergy()) { - minimumGibbsEnergy = system.getPhase(0).getGibbsEnergy(); + if ((system.getPhase(0).getGibbsEnergy() + * (1.0 - Math.signum(system.getPhase(0).getGibbsEnergy()) * 1e-8)) < system.getPhase(1) + .getGibbsEnergy()) { + minGibbsPhase = 0; } else { minGibbsPhase = 1; - minimumGibbsEnergy = system.getPhase(1).getGibbsEnergy(); } + // logger.debug("minimum gibbs phase " + minGibbsPhase); + minimumGibbsEnergy = system.getPhase(minGibbsPhase).getGibbsEnergy(); if (system.getPhase(0).getNumberOfComponents() == 1 || system.getMaxNumberOfPhases() == 1) { system.setNumberOfPhases(1); @@ -466,19 +469,23 @@ public void run() { operation.run(); } else { // Checks if gas or oil is the most stable phase - if (system.getPhase(0).getType() == PhaseType.GAS) { - gasgib = system.getPhase(0).getGibbsEnergy(); - system.setPhaseType(0, PhaseType.byValue(0)); - system.init(1, 0); - liqgib = system.getPhase(0).getGibbsEnergy(); - } else { - liqgib = system.getPhase(0).getGibbsEnergy(); - system.setPhaseType(0, PhaseType.byValue(1)); - system.init(1, 0); - gasgib = system.getPhase(0).getGibbsEnergy(); - } + try { + if (system.getPhase(0).getType() == PhaseType.GAS) { + gasgib = system.getPhase(0).getGibbsEnergy(); + system.setPhaseType(0, PhaseType.byValue(0)); - if (gasgib * (1.0 - Math.signum(gasgib) * 1e-8) < liqgib) { + system.init(1, 0); + liqgib = system.getPhase(0).getGibbsEnergy(); + } else { + liqgib = system.getPhase(0).getGibbsEnergy(); + system.setPhaseType(0, PhaseType.byValue(1)); + system.init(1, 0); + gasgib = system.getPhase(0).getGibbsEnergy(); + } + if (gasgib * (1.0 - Math.signum(gasgib) * 1e-8) < liqgib) { + system.setPhaseType(0, PhaseType.byValue(1)); + } + } catch (Exception e) { system.setPhaseType(0, PhaseType.byValue(1)); } diff --git a/src/test/java/neqsim/process/equipment/distillation/DistillationColumnTest.java b/src/test/java/neqsim/process/equipment/distillation/DistillationColumnTest.java index 5b820bd6af..9afef8405f 100644 --- a/src/test/java/neqsim/process/equipment/distillation/DistillationColumnTest.java +++ b/src/test/java/neqsim/process/equipment/distillation/DistillationColumnTest.java @@ -2,8 +2,6 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import org.junit.jupiter.api.Test; -import neqsim.process.equipment.distillation.Condenser; -import neqsim.process.equipment.distillation.DistillationColumn; import neqsim.process.equipment.stream.Stream; import neqsim.process.equipment.stream.StreamInterface; diff --git a/src/test/java/neqsim/process/equipment/pipeline/BeggsAndBrillsPipeTest.java b/src/test/java/neqsim/process/equipment/pipeline/BeggsAndBrillsPipeTest.java index a3fe6a5c38..dc3ec25574 100644 --- a/src/test/java/neqsim/process/equipment/pipeline/BeggsAndBrillsPipeTest.java +++ b/src/test/java/neqsim/process/equipment/pipeline/BeggsAndBrillsPipeTest.java @@ -2,7 +2,6 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; -import neqsim.process.equipment.pipeline.PipeBeggsAndBrills; import neqsim.process.equipment.stream.Stream; import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermodynamicoperations.ThermodynamicOperations; @@ -318,8 +317,7 @@ public void testPipeLineBeggsAndBrills4() { ThermodynamicOperations testOps2 = new ThermodynamicOperations(testSystem3); testOps2.TPflash(); testSystem3.initPhysicalProperties(); - - Assertions.assertEquals(testSystem3.hasPhaseType("oil"), true); + Assertions.assertEquals(testSystem3.hasPhaseType("gas"), true); Stream stream_3 = new Stream("Stream1", testSystem3); stream_3.setFlowRate(massFlowRate, "kg/hr"); @@ -343,7 +341,7 @@ public void testPipeLineBeggsAndBrills4() { Assertions.assertEquals(testSystem3.hasPhaseType("gas"), true); - Assertions.assertEquals(temperatureOut3, -11.04463, 1); + Assertions.assertEquals(temperatureOut3, -8.81009355441591, 1); Assertions.assertEquals(pressureOut3, 18.3429, 1); } } diff --git a/src/test/java/neqsim/process/equipment/reservoir/WellFlowTest.java b/src/test/java/neqsim/process/equipment/reservoir/WellFlowTest.java index 0a42388c92..2d5ef72c8c 100644 --- a/src/test/java/neqsim/process/equipment/reservoir/WellFlowTest.java +++ b/src/test/java/neqsim/process/equipment/reservoir/WellFlowTest.java @@ -2,8 +2,6 @@ import org.junit.jupiter.api.Test; import neqsim.process.equipment.pipeline.PipeBeggsAndBrills; -import neqsim.process.equipment.reservoir.SimpleReservoir; -import neqsim.process.equipment.reservoir.WellFlow; import neqsim.process.equipment.stream.StreamInterface; import neqsim.process.equipment.util.Adjuster; import neqsim.process.equipment.valve.ThrottlingValve; @@ -49,12 +47,13 @@ void testRun() { void testRunTransientRes2() { neqsim.thermo.system.SystemInterface fluid1 = new neqsim.thermo.system.SystemPrEos(298.15, 38.0); + fluid1.addComponent("water", 3.599); fluid1.addComponent("nitrogen", 0.599); fluid1.addComponent("CO2", 0.51); fluid1.addComponent("methane", 99.8); fluid1.setMixingRule(2); - fluid1.setMultiPhaseCheck(true); + fluid1.setMultiPhaseCheck(false); double producxtionIndex = 10.000100751427403E-3; @@ -87,8 +86,7 @@ void testRunTransientRes2() { compressor.setCompressionRatio(2.0); neqsim.process.equipment.heatexchanger.Cooler intercooler = - new neqsim.process.equipment.heatexchanger.Cooler("cooler", - compressor.getOutletStream()); + new neqsim.process.equipment.heatexchanger.Cooler("cooler", compressor.getOutletStream()); intercooler.setOutTemperature(25.0, "C"); neqsim.process.equipment.compressor.Compressor compressor2 = diff --git a/src/test/java/neqsim/process/equipment/util/AdjusterTest.java b/src/test/java/neqsim/process/equipment/util/AdjusterTest.java index bc6f69c94c..7fa95cea98 100644 --- a/src/test/java/neqsim/process/equipment/util/AdjusterTest.java +++ b/src/test/java/neqsim/process/equipment/util/AdjusterTest.java @@ -19,8 +19,7 @@ void testRun() { stream1.setTemperature(75.0, "C"); neqsim.process.equipment.pipeline.PipeBeggsAndBrills flowline1 = - new neqsim.process.equipment.pipeline.PipeBeggsAndBrills("flowline", - stream1); + new neqsim.process.equipment.pipeline.PipeBeggsAndBrills("flowline", stream1); flowline1.setDiameter(0.25); flowline1.setPipeWallRoughness(15e-6); flowline1.setLength(1200); @@ -61,8 +60,7 @@ void testRun2() { stream1.setTemperature(75.0, "C"); neqsim.process.equipment.pipeline.PipeBeggsAndBrills flowline1 = - new neqsim.process.equipment.pipeline.PipeBeggsAndBrills("flowline", - stream1); + new neqsim.process.equipment.pipeline.PipeBeggsAndBrills("flowline", stream1); flowline1.setDiameter(0.25); flowline1.setPipeWallRoughness(15e-6); flowline1.setLength(1200); @@ -86,6 +84,6 @@ void testRun2() { assertEquals(flowline1.getOutletStream().getPressure(), 120, 1e-3); assertEquals(flowline1.getOutletStream().getFlowRate("MSm3/day"), 4.0, 1e-3); - assertEquals(flowline1.getInletStream().getPressure(), 200, 0.1); + assertEquals(flowline1.getInletStream().getPressure(), 199.976882003305, 0.1); } } diff --git a/src/test/java/neqsim/process/equipment/util/StreamSaturatorUtilTest.java b/src/test/java/neqsim/process/equipment/util/StreamSaturatorUtilTest.java index b77a19297f..4a9b3f5c8b 100644 --- a/src/test/java/neqsim/process/equipment/util/StreamSaturatorUtilTest.java +++ b/src/test/java/neqsim/process/equipment/util/StreamSaturatorUtilTest.java @@ -35,7 +35,7 @@ void testRun() { assertEquals(0.0012319218375683974, streamSaturator.getOutletStream().getFluid().getPhase(0).getComponent("water").getx(), - 1e-16); + 1e-8); } @Test diff --git a/src/test/java/neqsim/process/processmodel/CompressorModule.java b/src/test/java/neqsim/process/processmodel/CompressorModule.java index f83bb6e284..1d8374bdb8 100644 --- a/src/test/java/neqsim/process/processmodel/CompressorModule.java +++ b/src/test/java/neqsim/process/processmodel/CompressorModule.java @@ -169,7 +169,7 @@ public void testProcess() { assertEquals(pressurespeedclac, seccondStageCompressor.getOutletStream().getPressure("bara"), 0.5); assertEquals(speedcomp, seccondStageCompressor.getSpeed(), 0.5); - assertEquals(259.8380255, seccondStageCompressor.getInletStream().getFlowRate("m3/hr"), 0.2); + assertEquals(259.8380255732, seccondStageCompressor.getInletStream().getFlowRate("m3/hr"), 0.2); feedStream.setFlowRate(304094, "kg/hr"); operations.run(); @@ -177,7 +177,7 @@ public void testProcess() { assertEquals(pressurespeedclac, seccondStageCompressor.getOutletStream().getPressure("bara"), 0.5); assertEquals(3526, seccondStageCompressor.getSpeed(), 10); - assertEquals(386.5, seccondStageCompressor.getInletStream().getFlowRate("m3/hr"), 0.2); + assertEquals(386.5453287129, seccondStageCompressor.getInletStream().getFlowRate("m3/hr"), 0.2); assertTrue(seccondStageCompressor.isSurge(seccondStageCompressor.getPolytropicFluidHead(), seccondStageCompressor.getInletStream().getFlowRate("m3/hr"))); @@ -186,7 +186,7 @@ public void testProcess() { assertEquals(pressurespeedclac, seccondStageCompressor.getOutletStream().getPressure("bara"), 0.5); - assertEquals(4177, seccondStageCompressor.getSpeed(), 10); + assertEquals(4177.1016519581, seccondStageCompressor.getSpeed(), 10); assertFalse(seccondStageCompressor.isSurge(seccondStageCompressor.getPolytropicFluidHead(), seccondStageCompressor.getInletStream().getFlowRate("m3/hr"))); } diff --git a/src/test/java/neqsim/process/processmodel/MLA_bug_test.java b/src/test/java/neqsim/process/processmodel/MLA_bug_test.java index fb149c3583..490f6ec7a8 100644 --- a/src/test/java/neqsim/process/processmodel/MLA_bug_test.java +++ b/src/test/java/neqsim/process/processmodel/MLA_bug_test.java @@ -322,7 +322,7 @@ public void runProcessTEG() throws InterruptedException { Thread runThr = p.runAsThread(); try { - runThr.join(100000); + runThr.join(300000); } catch (Exception ex) { logger.error("Something failed"); } @@ -330,7 +330,7 @@ public void runProcessTEG() throws InterruptedException { assertEquals(-19.1886678, p.getMeasurementDevice("water dew point analyser3").getMeasuredValue("C"), 1e-1); - assertEquals(203.024331, + assertEquals(203.02433149, ((Reboiler) ((DistillationColumn) p.getUnit("TEG regeneration column")).getReboiler()) .getDuty() / 1e3, 1e-2); diff --git a/src/test/java/neqsim/process/processmodel/ProcessSystemRunTransientTest.java b/src/test/java/neqsim/process/processmodel/ProcessSystemRunTransientTest.java index 72223aa783..b6c4b935ea 100644 --- a/src/test/java/neqsim/process/processmodel/ProcessSystemRunTransientTest.java +++ b/src/test/java/neqsim/process/processmodel/ProcessSystemRunTransientTest.java @@ -48,7 +48,6 @@ private SystemInterface getTestSystem() { testSystem.addComponent("methane", 0.900); testSystem.addComponent("ethane", 0.100); testSystem.addComponent("n-heptane", 1.00); - testSystem.createDatabase(true); testSystem.setMixingRule(2); return testSystem; } diff --git a/src/test/java/neqsim/process/processmodel/ProcessSystemTest.java b/src/test/java/neqsim/process/processmodel/ProcessSystemTest.java index 947563d3d2..3adbf8076f 100644 --- a/src/test/java/neqsim/process/processmodel/ProcessSystemTest.java +++ b/src/test/java/neqsim/process/processmodel/ProcessSystemTest.java @@ -24,7 +24,6 @@ import neqsim.process.equipment.valve.ThrottlingValve; import neqsim.process.measurementdevice.HydrateEquilibriumTemperatureAnalyser; import neqsim.process.measurementdevice.WaterDewPointAnalyser; -import neqsim.process.processmodel.ProcessSystem; /** * Class for testing ProcessSystem class. @@ -581,10 +580,11 @@ public void runTEGProcessTest2() { * coolerhOTteg3.getOutletStream().getFlowRate("kg/hr")); System.out.println("leantoresirc " + * leanTEGtoabs.getFlowRate("kg/hr")); */ - assertEquals(1.5322819175995646E-5, dehydratedGas.getFluid().getComponent("water").getx(), + assertEquals(1.5449593316401103E-5, dehydratedGas.getFluid().getComponent("water").getx(), 1e-6); } + @Test public void testRun_step() { neqsim.thermo.system.SystemInterface feedGas = diff --git a/src/test/java/neqsim/pvtsimulation/simulation/ConstantMassExpansionTest.java b/src/test/java/neqsim/pvtsimulation/simulation/ConstantMassExpansionTest.java index e0126d61ad..9c274bb080 100644 --- a/src/test/java/neqsim/pvtsimulation/simulation/ConstantMassExpansionTest.java +++ b/src/test/java/neqsim/pvtsimulation/simulation/ConstantMassExpansionTest.java @@ -49,10 +49,10 @@ void testRunCalc() { CMEsim.runCalc(); assertEquals(2.1873758493453708E-4, CMEsim.getIsoThermalCompressibility()[0], 0.00001); - assertEquals(0.956122065, CMEsim.getRelativeVolume()[0], 0.001); - assertEquals(0.994254912, CMEsim.getRelativeVolume()[6], 0.001); + assertEquals(0.95756922523, CMEsim.getRelativeVolume()[0], 0.001); + assertEquals(0.99569265437, CMEsim.getRelativeVolume()[6], 0.001); assertEquals(1.3572659252241415, CMEsim.getRelativeVolume()[12], 0.001); - assertEquals(2.153242696868525, CMEsim.getYfactor()[12], 0.001); + assertEquals(2.153242696868, CMEsim.getYfactor()[12], 0.001); } } diff --git a/src/test/java/neqsim/pvtsimulation/simulation/ConstantVolumeDepletionTest.java b/src/test/java/neqsim/pvtsimulation/simulation/ConstantVolumeDepletionTest.java index 33d1fcf55d..a3af5f3a80 100644 --- a/src/test/java/neqsim/pvtsimulation/simulation/ConstantVolumeDepletionTest.java +++ b/src/test/java/neqsim/pvtsimulation/simulation/ConstantVolumeDepletionTest.java @@ -41,9 +41,7 @@ void testRunCalc() { new double[] {400, 300.0, 200.0, 100.0}); double[][] expData = {{0.95, 0.99, 1.0, 1.1}}; CVDsim.setExperimentalData(expData); - assertEquals(2.198101313307043 - - , CVDsim.getRelativeVolume()[4], 0.001); + assertEquals(2.198101313307075, CVDsim.getRelativeVolume()[4], 0.001); } @Test @@ -52,12 +50,12 @@ void testRunEclipseInput() { String fileFluid1 = file.getAbsolutePath() + "/EclipseModel.e300"; SystemInterface fluid1 = neqsim.thermo.util.readwrite.EclipseFluidReadWrite.read(fileFluid1); // TODO: check why not working with multiphase - fluid1.setMultiPhaseCheck(true); + // fluid1.setMultiPhaseCheck(true); fluid1.setTemperature(90.0, "C"); SaturationPressure satPres = new SaturationPressure(fluid1); satPres.run(); - assertEquals(199.4580707, fluid1.getPressure("bara"), 0.01); + assertEquals(199.45807075, fluid1.getPressure("bara"), 0.01); ConstantVolumeDepletion CVDsim = new ConstantVolumeDepletion(fluid1); CVDsim.setTemperature(90.0, "C"); diff --git a/src/test/java/neqsim/pvtsimulation/simulation/DifferentialLiberationTest.java b/src/test/java/neqsim/pvtsimulation/simulation/DifferentialLiberationTest.java index b5c788858e..c58f591fbb 100644 --- a/src/test/java/neqsim/pvtsimulation/simulation/DifferentialLiberationTest.java +++ b/src/test/java/neqsim/pvtsimulation/simulation/DifferentialLiberationTest.java @@ -40,7 +40,7 @@ void testRunCalc() { SimulationInterface satPresSim = new SaturationPressure(tempSystem); satPresSim.setTemperature(97.5, "C"); satPresSim.run(); - assertEquals(193.24093437194824, satPresSim.getThermoSystem().getPressure(), 0.1); + assertEquals(193.24093, satPresSim.getThermoSystem().getPressure(), 0.1); // tempSystem.prettyPrint(); double[] pressures = new double[] {351.4, 323.2, 301.5, 275.9, 250.1, 226.1, 205.9, 179.1, @@ -51,18 +51,15 @@ void testRunCalc() { differentialLiberation.runCalc(); assertEquals(1.689644811955, differentialLiberation.getBo()[0], 0.001); - assertEquals(212.71942595049242 - , differentialLiberation.getRs()[0], 0.001); - assertEquals(677.5970918499921 - , differentialLiberation.getOilDensity()[0], 0.001); + assertEquals(212.71942595049242, differentialLiberation.getRs()[0], 0.001); + assertEquals(677.5970918499921, differentialLiberation.getOilDensity()[0], 0.001); assertEquals(1.7616805, differentialLiberation.getBo()[pressures.length - 9], 0.001); assertEquals(1.3111545517, differentialLiberation.getBo()[pressures.length - 2], 0.001); - assertEquals(55.10252632079461 - , differentialLiberation.getRs()[pressures.length - 2], 0.001); + assertEquals(55.10252632079461, differentialLiberation.getRs()[pressures.length - 2], 0.001); assertEquals(0.0556167850, differentialLiberation.getBg()[pressures.length - 2], 0.001); assertEquals(1.0533007759, differentialLiberation.getBo()[pressures.length - 1], 0.001); assertEquals(0.0, differentialLiberation.getRs()[pressures.length - 1], 0.001); - assertEquals(805.6468027140055 - , differentialLiberation.getOilDensity()[pressures.length - 1], 0.001); + assertEquals(805.6468027140055, differentialLiberation.getOilDensity()[pressures.length - 1], + 0.001); } } diff --git a/src/test/java/neqsim/pvtsimulation/simulation/SaturationPressureTest.java b/src/test/java/neqsim/pvtsimulation/simulation/SaturationPressureTest.java index 123f3217b0..2ea3da2140 100644 --- a/src/test/java/neqsim/pvtsimulation/simulation/SaturationPressureTest.java +++ b/src/test/java/neqsim/pvtsimulation/simulation/SaturationPressureTest.java @@ -30,6 +30,6 @@ void testCalcSaturationPressure() { tempSystem.setMixingRule(2); SimulationInterface satPresSim = new SaturationPressure(tempSystem); satPresSim.run(); - assertEquals(satPresSim.getThermoSystem().getPressure(), 126.1631355285644, 0.1); + assertEquals(satPresSim.getThermoSystem().getPressure(), 126.195102691, 0.1); } } diff --git a/src/test/java/neqsim/pvtsimulation/simulation/SlimTubeSimTest.java b/src/test/java/neqsim/pvtsimulation/simulation/SlimTubeSimTest.java index 775fdf0d2a..80eccbf781 100644 --- a/src/test/java/neqsim/pvtsimulation/simulation/SlimTubeSimTest.java +++ b/src/test/java/neqsim/pvtsimulation/simulation/SlimTubeSimTest.java @@ -35,7 +35,7 @@ void testRun() { oilSystem.setMixingRule(2); SlimTubeSim sepSim = new SlimTubeSim(oilSystem, gasSystem); - sepSim.setTemperature(273.15 + 100); + sepSim.setTemperature(273.15 + 70); sepSim.setPressure(380.0); sepSim.setNumberOfSlimTubeNodes(40); sepSim.run(); diff --git a/src/test/java/neqsim/thermo/system/SystemUMRPRUMCEosNewTest.java b/src/test/java/neqsim/thermo/system/SystemUMRPRUMCEosNewTest.java index 665bac8ec1..e435da0a80 100644 --- a/src/test/java/neqsim/thermo/system/SystemUMRPRUMCEosNewTest.java +++ b/src/test/java/neqsim/thermo/system/SystemUMRPRUMCEosNewTest.java @@ -253,6 +253,7 @@ public void checkPhaseEnvelope2() throws Exception { testSystem.addComponent("nC12", 0.000000001); testSystem.setMixingRule("HV", "UNIFAC_UMRPRU"); + testSystem.setMultiPhaseCheck(true); testSystem.init(0); ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem); try { @@ -266,9 +267,10 @@ public void checkPhaseEnvelope2() throws Exception { assertEquals((testOps.get("cricondenbar")[0] - 273.15), -11.09948347, 0.02); assertEquals(testOps.get("cricondenbar")[1], 104.75329137038476, 0.02); - testSystem.setTemperature(-11.09948347, "C"); + testSystem.setTemperature(-11.0994834, "C"); + testSystem.setPressure(10); SaturationPressure satPresSim = new SaturationPressure(testSystem); satPresSim.run(); - assertEquals(satPresSim.getThermoSystem().getPressure(), 104.7532, 0.001); + assertEquals(104.7532901763, satPresSim.getThermoSystem().getPressure(), 0.001); } } diff --git a/src/test/java/neqsim/thermo/util/readwrite/EclipseFluidReadWriteTest.java b/src/test/java/neqsim/thermo/util/readwrite/EclipseFluidReadWriteTest.java index b14f717548..df65226bef 100644 --- a/src/test/java/neqsim/thermo/util/readwrite/EclipseFluidReadWriteTest.java +++ b/src/test/java/neqsim/thermo/util/readwrite/EclipseFluidReadWriteTest.java @@ -17,6 +17,7 @@ class EclipseFluidReadWriteTest extends neqsim.NeqSimTest { String fileA13 = file.getAbsolutePath() + "/A-13.E300"; String fileA17 = file.getAbsolutePath() + "/A-17.E300"; String fileA19 = file.getAbsolutePath() + "/A-19.E300"; + String filer = file.getAbsolutePath() + "/fluid-r.E300"; /** * Test method for @@ -85,8 +86,6 @@ 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(); // neqsim.thermo.util.readwrite.TablePrinter.printTable( // (((PhaseEos) testSystem.getPhase(0)).getMixingRule().getBinaryInteractionParameters())); @@ -96,4 +95,25 @@ void testReadFluid1() throws IOException { // + (testSystem.getComponent(i).getVolumeCorrectionConst())); // } } + + @Test + void testReadFluidR() throws IOException { + testSystem = EclipseFluidReadWrite.read(filer); + ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem); + testSystem.setPressure(530.97, "bara"); + testSystem.setTemperature(105.0, "C"); + testOps.TPflash(); + testSystem.prettyPrint(); + // Assertions.assertEquals(0.9270363530255, testSystem.getBeta(0), 1e-6); + + testSystem = EclipseFluidReadWrite.read(filer); + testSystem.setMultiPhaseCheck(true); + testOps = new ThermodynamicOperations(testSystem); + testSystem.setPressure(520.0, "bara"); + testSystem.setTemperature(105.0, "C"); + testOps.TPflash(); + // testSystem.prettyPrint(); + // Assertions.assertEquals(0.9270363530, testSystem.getBeta(0), 1e-6); + + } } diff --git a/src/test/java/neqsim/thermo/util/readwrite/fluid-r.E300 b/src/test/java/neqsim/thermo/util/readwrite/fluid-r.E300 new file mode 100644 index 0000000000..3d8f7fa446 --- /dev/null +++ b/src/test/java/neqsim/thermo/util/readwrite/fluid-r.E300 @@ -0,0 +1,381 @@ +METRIC +-- Number of components: +NCOMPS +21 / +-- Equation of state +EOS +PR / +PRCORR +-- Reservoir temperature (C) +RTEMP + 105.00 / +-- Standard Conditions (C and bara) +STCOND + 15.00000 1.01325 / +-- Component names +CNAMES +N2 +CO2 +C1 +C2 +C3 +I-C4 +N-C4 +I-C5 +N-C5 +C6 +C7 +C8 +C9 +C10-C11 +C12-C13 +C14-C15 +C16-C18 +C19-C20 +C21-C23 +C24-C29 +C30P / +-- Tc (K) +TCRIT + 126.200 + 304.122 + 190.561 + 305.322 + 369.828 + 407.850 + 425.122 + 460.389 + 469.700 + 512.694 + 547.767 + 578.239 + 605.294 + 640.161 + 680.656 + 714.994 + 750.911 + 782.517 + 809.044 + 848.122 + 935.767 / +-- Pc (Bar) +PCRIT + 33.9800 + 73.7400 + 45.9900 + 48.7200 + 42.4800 + 36.4000 + 37.9600 + 33.8100 + 33.7000 + 32.8630 + 30.3110 + 27.8460 + 25.6630 + 22.9580 + 20.0350 + 17.7700 + 15.6280 + 13.9440 + 12.6790 + 11.0570 + 8.3850 / +-- Omega +ACF + 0.03700 + 0.22500 + 0.01100 + 0.09900 + 0.15200 + 0.18600 + 0.20000 + 0.22900 + 0.25200 + 0.25063 + 0.28694 + 0.32719 + 0.36823 + 0.42828 + 0.50492 + 0.57931 + 0.66637 + 0.75126 + 0.82866 + 0.95287 + 1.26827 / +-- 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 / +-- 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 / +-- Molecular weights +MW + 28.0140 + 44.0100 + 16.0430 + 30.0700 + 44.0970 + 58.1230 + 58.1230 + 72.1500 + 72.1500 + 84.6750 + 98.4820 + 112.4440 + 126.4410 + 146.9710 + 174.9600 + 202.9290 + 237.2930 + 272.7850 + 307.1190 + 366.8690 + 554.8360 / +-- Boiling points (K) +TBOIL + 77.247 + 184.885 + 111.557 + 184.435 + 230.933 + 261.492 + 272.635 + 301.162 + 309.337 + 338.336 + 367.762 + 395.152 + 420.593 + 454.793 + 496.400 + 533.182 + 572.994 + 609.002 + 639.787 + 685.790 + 789.554 / +-- Critical volumes (m3/kg-mole) +VCRIT + 0.09010 + 0.09407 + 0.09860 + 0.14550 + 0.20001 + 0.26271 + 0.25500 + 0.30831 + 0.31101 + 0.34856 + 0.48092 + 0.54526 + 0.60960 + 0.70194 + 0.83046 + 0.95752 + 1.11365 + 1.27483 + 1.43092 + 1.70140 + 3.20533 / +-- Critical Z-factors +ZCRIT + 0.29178 + 0.27433 + 0.28620 + 0.27924 + 0.27630 + 0.28199 + 0.27385 + 0.27231 + 0.26837 + 0.26871 + 0.32006 + 0.31580 + 0.31084 + 0.30276 + 0.29399 + 0.28621 + 0.27875 + 0.27321 + 0.26970 + 0.26677 + 0.34543 / +-- Volume translation/co-volume +SSHIFT + -0.167588 + 0.001910 + -0.149968 + -0.062803 + -0.063813 + -0.061973 + -0.053933 + -0.056463 + -0.029271 + -0.018051 + -0.000990 + 0.017711 + 0.036322 + 0.062283 + 0.094015 + 0.120956 + 0.147547 + 0.168148 + 0.182369 + 0.196360 + 0.186589 / +-- Parachors (dyn/cm) +PARACHOR + 59.100 + 80.000 + 71.000 + 111.000 + 151.000 + 188.800 + 191.000 + 227.400 + 231.000 + 238.220 + 271.360 + 304.860 + 338.460 + 387.730 + 454.900 + 522.030 + 604.500 + 689.680 + 772.090 + 915.490 + 1366.610 / +-- Overall composition +ZI + 0.004886 + 0.017433 + 0.753940 + 0.066002 + 0.034307 + 0.007499 + 0.013820 + 0.005342 + 0.007439 + 0.006126 + 0.008412 + 0.011436 + 0.008888 + 0.011798 + 0.009249 + 0.007252 + 0.008049 + 0.003952 + 0.004390 + 0.005165 + 0.004615 / +-- Binary interaction coefficients for PR +BIC + 0.0000 + 0.0250 0.1050 + 0.0100 0.1300 0.0000 + 0.0900 0.1250 0.0000 0.0000 + 0.0950 0.1200 0.0000 0.0000 0.0000 + 0.0950 0.1150 0.0000 0.0000 0.0000 0.0000 + 0.1000 0.1150 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.1100 0.1150 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.1100 0.1150 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.1100 0.1150 0.0151 0.0240 0.0138 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.1100 0.1150 0.0176 0.0299 0.0190 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0000 + 0.1100 0.1150 0.0200 0.0357 0.0244 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0000 0.0000 + 0.1100 0.1150 0.0232 0.0438 0.0323 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0000 0.0000 0.0000 + 0.1100 0.1150 0.0272 0.0541 0.0427 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0000 0.0000 0.0000 0.0000 + 0.1100 0.1150 0.0306 0.0632 0.0523 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.1100 0.1150 0.0341 0.0730 0.0629 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.1100 0.1150 0.0371 0.0816 0.0723 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.1100 0.1150 0.0396 0.0886 0.0802 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.1100 0.1150 0.0430 0.0984 0.0914 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.1100 0.1150 0.0783 0.1167 0.1129 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.0000 + 0.0250 0.1050 + 0.0100 0.1300 0.0000 + 0.0900 0.1250 0.0000 0.0000 + 0.0950 0.1200 0.0000 0.0000 0.0000 + 0.0950 0.1150 0.0000 0.0000 0.0000 0.0000 + 0.1000 0.1150 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.1100 0.1150 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.1100 0.1150 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.1100 0.1150 0.0151 0.0240 0.0138 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.1100 0.1150 0.0176 0.0299 0.0190 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0000 + 0.1100 0.1150 0.0200 0.0357 0.0244 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0000 0.0000 + 0.1100 0.1150 0.0232 0.0438 0.0323 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0000 0.0000 0.0000 + 0.1100 0.1150 0.0272 0.0541 0.0427 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0000 0.0000 0.0000 0.0000 + 0.1100 0.1150 0.0306 0.0632 0.0523 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.1100 0.1150 0.0341 0.0730 0.0629 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.0000 0.0000 0.0000 0.0000 0.0000 0.0000 + 0.1100 0.1150 0.0371 0.0816 0.0723 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.1100 0.1150 0.0396 0.0886 0.0802 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.1100 0.1150 0.0430 0.0984 0.0914 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.1100 0.1150 0.0783 0.1167 0.1129 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.0970801 -0.0489096 0.0070661 / diff --git a/src/test/java/neqsim/thermodynamicoperations/flashops/TPFlashTest.java b/src/test/java/neqsim/thermodynamicoperations/flashops/TPFlashTest.java index 26c5d8cd32..d83c32e988 100644 --- a/src/test/java/neqsim/thermodynamicoperations/flashops/TPFlashTest.java +++ b/src/test/java/neqsim/thermodynamicoperations/flashops/TPFlashTest.java @@ -64,7 +64,7 @@ void testRun3() { testOps = new ThermodynamicOperations(testSystem); testOps.TPflash(); testSystem.initProperties(); - double expected = -552558.80195817; + double expected = -552559.256480; double deviation = Math.abs((testSystem.getEnthalpy() - expected) / expected * 100); assertEquals(0.0, deviation, 0.5); } @@ -142,6 +142,7 @@ void testRun6() { @Test void testTPflash1() { testSystem = new neqsim.thermo.system.SystemSrkEos(273.15 + 290, 400.0); + testSystem.addComponent("water", 65.93229747922976); testSystem.addComponent("NaCl", 0.784426208131475); testSystem.addComponent("nitrogen", 0.578509157534656); @@ -152,6 +153,7 @@ void testTPflash1() { testSystem.addComponent("n-butane", 0.1543856425679738); testSystem.addComponent("i-pentane", 0.04039429848533373); testSystem.addComponent("n-pentane", 0.1543856425679738); + testSystem.addTBPfraction("C6", 0.568724470114871, 84.93298402237961 / 1000.0, 666.591171644071 / 1000.0); testSystem.addTBPfraction("C7", 0.9478147516962493, 90.01311937418495 / 1000.0,