From 11d51236596e7b91cdcf64183ac0bfc7df8009a8 Mon Sep 17 00:00:00 2001 From: Even Solbraa <41290109+EvenSol@users.noreply.github.com> Date: Mon, 12 Aug 2024 21:34:43 +0000 Subject: [PATCH 1/2] fix bug in PC calculation for oil components and all tests --- .../surfaceTension/SurfaceTension.java | 2 +- .../characterization/PlusCharacterize.java | 2 +- .../characterization/TBPCharacterize.java | 2 +- .../characterization/TBPfractionModel.java | 26 +++++-------------- .../neqsim/thermo/component/Component.java | 14 +++++++--- .../thermo/component/ComponentInterface.java | 15 +++++++++-- src/main/java/neqsim/thermo/phase/Phase.java | 2 +- .../neqsim/thermo/system/SystemThermo.java | 6 ++--- .../simulation/ConstantMassExpansionTest.java | 5 ++-- .../ConstantVolumeDepletionTest.java | 4 ++- .../DifferentialLiberationTest.java | 20 ++++++++------ .../simulation/SaturationTemperatureTest.java | 2 +- .../simulation/SeparatorTestTest.java | 2 +- .../simulation/SlimTubeSimTest.java | 9 +++---- .../simulation/ViscositySimTest.java | 2 +- .../simulation/WaxFractionSimTest.java | 6 +++-- .../reservoir/SimpleReservoirTest.java | 3 ++- .../CombinedOilGasFieldTest.java | 5 ++-- .../processSystem/CompressorModule.java | 3 ++- .../processSystem/OilGasProcessTest.java | 2 +- .../oilQuality/Standard_ASTM_D6377Test.java | 9 ++++--- .../TBPfractionModelTest.java | 15 ++++++----- .../thermo/system/SystemThermoTest.java | 2 +- .../flashOps/TPFlashTest.java | 3 ++- .../flashOps/TPFlashTestWellFluid.java | 3 ++- .../flashOps/WaxFlashTest.java | 2 +- 26 files changed, 93 insertions(+), 73 deletions(-) diff --git a/src/main/java/neqsim/physicalProperties/interfaceProperties/surfaceTension/SurfaceTension.java b/src/main/java/neqsim/physicalProperties/interfaceProperties/surfaceTension/SurfaceTension.java index 830f2bee36..f255d198cf 100644 --- a/src/main/java/neqsim/physicalProperties/interfaceProperties/surfaceTension/SurfaceTension.java +++ b/src/main/java/neqsim/physicalProperties/interfaceProperties/surfaceTension/SurfaceTension.java @@ -67,7 +67,7 @@ public double calcSurfaceTension(int interface1, int interface2) { */ public int getComponentWithHighestBoilingpoint() { int compNumb = 0; - double boilPoint = -273.15; + double boilPoint = 0; for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { if (system.getPhase(0).getComponent(i).getNormalBoilingPoint() > boilPoint) { compNumb = i; diff --git a/src/main/java/neqsim/thermo/characterization/PlusCharacterize.java b/src/main/java/neqsim/thermo/characterization/PlusCharacterize.java index 30456e94de..d926fde9a7 100644 --- a/src/main/java/neqsim/thermo/characterization/PlusCharacterize.java +++ b/src/main/java/neqsim/thermo/characterization/PlusCharacterize.java @@ -432,7 +432,7 @@ public void removeTBPfraction() { ArrayList list = new ArrayList(); for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { double boilpoint = system.getPhase(0).getComponent(i).getNormalBoilingPoint(); - if (boilpoint >= 69.0) { + if (boilpoint >= 273.15 + 69.0) { list.add(system.getPhase(0).getComponent(i).getName()); } } diff --git a/src/main/java/neqsim/thermo/characterization/TBPCharacterize.java b/src/main/java/neqsim/thermo/characterization/TBPCharacterize.java index d836ffc01c..31fd1ed4b4 100644 --- a/src/main/java/neqsim/thermo/characterization/TBPCharacterize.java +++ b/src/main/java/neqsim/thermo/characterization/TBPCharacterize.java @@ -62,7 +62,7 @@ public boolean groupTBPfractions() { for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { // if (system.getPhase(0).getComponent(i).getComponentType().equals("HC")) { - double boilpoint = system.getPhase(0).getComponent(i).getNormalBoilingPoint(); + double boilpoint = system.getPhase(0).getComponent(i).getNormalBoilingPoint("C"); if (boilpoint >= 331.0) { numb = 13; diff --git a/src/main/java/neqsim/thermo/characterization/TBPfractionModel.java b/src/main/java/neqsim/thermo/characterization/TBPfractionModel.java index ad61a4cf2b..67017cd9a1 100644 --- a/src/main/java/neqsim/thermo/characterization/TBPfractionModel.java +++ b/src/main/java/neqsim/thermo/characterization/TBPfractionModel.java @@ -155,7 +155,7 @@ public double calcPC(double molarMass, double density) { TBPfractionCoefs = TBPfractionCoefsHeavyOil; } - return 0.01325 + Math.exp(TBPfractionCoefs[1][0] + return Math.exp(0.01325 + TBPfractionCoefs[1][0] + TBPfractionCoefs[1][1] * Math.pow(density, TBPfractionCoefs[1][4]) + TBPfractionCoefs[1][2] / molarMass + TBPfractionCoefs[1][3] / Math.pow(molarMass, 2.0)); } @@ -173,26 +173,12 @@ public double calcm(double molarMass, double density) { @Override public double calcTB(double molarMass, double density) { - if (molarMass < 90) { - return 273.15 + 84; - } - if (molarMass < 107) { - return 273.15 + 116.6; - } - if (molarMass < 121) { - return 273.15 + 142.2; - } - if (molarMass < 134) { - return 273.15 + 165.8; - } - if (molarMass < 147) { - return 273.15 + 187.2; - } - if (molarMass < 161) { - return 273.15 + 208.3; + if (molarMass < 540) { + return 2E-06 * Math.pow(molarMass, 3) - 0.0035 * Math.pow(molarMass, 2) + 2.4003 * molarMass + + 171.74; + } else { + return 97.58 * Math.pow(molarMass, 0.3323) * Math.pow(density, 0.04609); } - - return 97.58 * Math.pow(molarMass, 0.3323) * Math.pow(density, 0.04609); } @Override diff --git a/src/main/java/neqsim/thermo/component/Component.java b/src/main/java/neqsim/thermo/component/Component.java index 486f93cb70..7417adae32 100644 --- a/src/main/java/neqsim/thermo/component/Component.java +++ b/src/main/java/neqsim/thermo/component/Component.java @@ -287,10 +287,10 @@ public void createComponent(String name, double moles, double molesInPhase, int AntoineC = Double.parseDouble(dataSet.getString("ANTOINEC")); // AX AntoineD = Double.parseDouble(dataSet.getString("ANTOINED")); AntoineE = Double.parseDouble(dataSet.getString("ANTOINEE")); - + normalBoilingPoint = Double.parseDouble(dataSet.getString("normboil")) + 273.15; if (AntoineA == 0) { AntoineA = 1.0; - AntoineB = getNormalBoilingPoint(); + AntoineB = getNormalBoilingPoint() - 273.15; } AntoineASolid = Double.parseDouble(dataSet.getString("ANTOINESolidA")); @@ -298,7 +298,7 @@ public void createComponent(String name, double moles, double molesInPhase, int AntoineCSolid = Double.parseDouble(dataSet.getString("ANTOINESolidC")); debyeDipoleMoment = Double.parseDouble(dataSet.getString("dipolemoment")); - normalBoilingPoint = Double.parseDouble(dataSet.getString("normboil")); + standardDensity = Double.parseDouble(dataSet.getString("stddens")); viscosityCorrectionFactor = Double.parseDouble(dataSet.getString("viscfact")); // BC racketZ = Double.parseDouble(dataSet.getString("racketZ")); // BE @@ -1663,6 +1663,14 @@ public double getNormalBoilingPoint() { return normalBoilingPoint; } + /** {@inheritDoc} */ + @Override + public double getNormalBoilingPoint(String unit) { + neqsim.util.unit.TemperatureUnit tempConversion = + new neqsim.util.unit.TemperatureUnit(getNormalBoilingPoint(), "K"); + return tempConversion.getValue(unit); + } + /** {@inheritDoc} */ @Override public void setNormalBoilingPoint(double normalBoilingPoint) { diff --git a/src/main/java/neqsim/thermo/component/ComponentInterface.java b/src/main/java/neqsim/thermo/component/ComponentInterface.java index ca67688c59..ded1f2c0da 100644 --- a/src/main/java/neqsim/thermo/component/ComponentInterface.java +++ b/src/main/java/neqsim/thermo/component/ComponentInterface.java @@ -921,16 +921,27 @@ public void Finit(PhaseInterface phase, double temperature, double pressure, * Getter for property NormalBoilingPoint. *

* - * @return The normal boiling point of the component + * @return The normal boiling point of the component with unit Kelvin */ public double getNormalBoilingPoint(); + /** + *

+ * Getter for property NormalBoilingPoint. + *

+ * + * @param unit Unit of return pressure + * + * @return The normal boiling point of the component + */ + public double getNormalBoilingPoint(String unit); + /** *

* setNormalBoilingPoint. *

* - * @param normalBoilingPoint a double + * @param normalBoilingPoint a double with unit Kelvin */ public void setNormalBoilingPoint(double normalBoilingPoint); diff --git a/src/main/java/neqsim/thermo/phase/Phase.java b/src/main/java/neqsim/thermo/phase/Phase.java index d3c8407ded..8a421f51a3 100644 --- a/src/main/java/neqsim/thermo/phase/Phase.java +++ b/src/main/java/neqsim/thermo/phase/Phase.java @@ -1967,7 +1967,7 @@ public double[] groupTBPfractions() { double[] TPBfrac = new double[20]; for (int i = 0; i < getNumberOfComponents(); i++) { - double boilpoint = getComponent(i).getNormalBoilingPoint(); + double boilpoint = getComponent(i).getNormalBoilingPoint("C"); if (boilpoint >= 331.0) { TPBfrac[19] += getComponent(i).getx(); diff --git a/src/main/java/neqsim/thermo/system/SystemThermo.java b/src/main/java/neqsim/thermo/system/SystemThermo.java index 3177abb004..4848ced670 100644 --- a/src/main/java/neqsim/thermo/system/SystemThermo.java +++ b/src/main/java/neqsim/thermo/system/SystemThermo.java @@ -944,7 +944,7 @@ public void addTBPfraction(String componentName, double numberOfMoles, double mo getPhase(i).getComponent(componentName).setMolarMass(molarMass); getPhase(i).getComponent(componentName).setComponentType("TBPfraction"); getPhase(i).getComponent(componentName).setNormalLiquidDensity(density); - getPhase(i).getComponent(componentName).setNormalBoilingPoint(TB - 273.15); + getPhase(i).getComponent(componentName).setNormalBoilingPoint(TB); getPhase(i).getComponent(componentName) .setAcentricFactor(refSystem.getPhase(0).getComponent(0).getAcentricFactor()); getPhase(i).getComponent(componentName).setCriticalVolume(critVol); @@ -1086,7 +1086,7 @@ public void addTBPfraction(String componentName, double numberOfMoles, double mo getPhase(i).getComponent(componentName).setMolarMass(molarMass); getPhase(i).getComponent(componentName).setComponentType("TBPfraction"); getPhase(i).getComponent(componentName).setNormalLiquidDensity(density); - getPhase(i).getComponent(componentName).setNormalBoilingPoint(TB - 273.15); + getPhase(i).getComponent(componentName).setNormalBoilingPoint(TB); getPhase(i).getComponent(componentName) .setAcentricFactor(refSystem.getPhase(0).getComponent(0).getAcentricFactor()); getPhase(i).getComponent(componentName).setCriticalVolume(critVol); @@ -2552,7 +2552,7 @@ public double[] getNormalBoilingPointTemperatures() { double[] bt = new double[numberOfComponents]; for (int compNumb = 0; compNumb < numberOfComponents; compNumb++) { - bt[compNumb] = getPhase(0).getComponent(compNumb).getNormalBoilingPoint() + 273.15; + bt[compNumb] = getPhase(0).getComponent(compNumb).getNormalBoilingPoint(); } return bt; } diff --git a/src/test/java/neqsim/PVTsimulation/simulation/ConstantMassExpansionTest.java b/src/test/java/neqsim/PVTsimulation/simulation/ConstantMassExpansionTest.java index e8adac7c25..4340469398 100644 --- a/src/test/java/neqsim/PVTsimulation/simulation/ConstantMassExpansionTest.java +++ b/src/test/java/neqsim/PVTsimulation/simulation/ConstantMassExpansionTest.java @@ -51,8 +51,9 @@ void testRunCalc() { 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(1.3486190, CMEsim.getRelativeVolume()[12], 0.001); - assertEquals(2.1400177022, CMEsim.getYfactor()[12], 0.001); + assertEquals(1.3572659252241415, CMEsim.getRelativeVolume()[12], 0.001); + assertEquals(2.153242696868525 + , 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 9b85a19827..f1f3e9184c 100644 --- a/src/test/java/neqsim/PVTsimulation/simulation/ConstantVolumeDepletionTest.java +++ b/src/test/java/neqsim/PVTsimulation/simulation/ConstantVolumeDepletionTest.java @@ -40,7 +40,9 @@ 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.2458466, CVDsim.getRelativeVolume()[4], 0.001); + assertEquals(2.198101313307043 + + , CVDsim.getRelativeVolume()[4], 0.001); } @Test diff --git a/src/test/java/neqsim/PVTsimulation/simulation/DifferentialLiberationTest.java b/src/test/java/neqsim/PVTsimulation/simulation/DifferentialLiberationTest.java index c0d52b4b54..7d0b85ad56 100644 --- a/src/test/java/neqsim/PVTsimulation/simulation/DifferentialLiberationTest.java +++ b/src/test/java/neqsim/PVTsimulation/simulation/DifferentialLiberationTest.java @@ -40,25 +40,29 @@ void testRunCalc() { SimulationInterface satPresSim = new SaturationPressure(tempSystem); satPresSim.setTemperature(97.5, "C"); satPresSim.run(); - assertEquals(190.7882175445, satPresSim.getThermoSystem().getPressure(), 0.1); + assertEquals(193.24093437194824, 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, - 154.6, 132.1, 109.0, 78.6, 53.6, 22.0, 1.0 }; + double[] pressures = new double[] {351.4, 323.2, 301.5, 275.9, 250.1, 226.1, 205.9, 179.1, + 154.6, 132.1, 109.0, 78.6, 53.6, 22.0, 1.0}; DifferentialLiberation differentialLiberation = new DifferentialLiberation(tempSystem); differentialLiberation.setPressures(pressures); differentialLiberation.setTemperature(97.5, "C"); differentialLiberation.runCalc(); assertEquals(1.689644811955, differentialLiberation.getBo()[0], 0.001); - assertEquals(212.366545704, differentialLiberation.getRs()[0], 0.001); - assertEquals(677.27184, 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.312174206633, differentialLiberation.getBo()[pressures.length - 2], 0.001); - assertEquals(55.1339349, differentialLiberation.getRs()[pressures.length - 2], 0.001); + assertEquals(1.3111545517, differentialLiberation.getBo()[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.00070, 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/SaturationTemperatureTest.java b/src/test/java/neqsim/PVTsimulation/simulation/SaturationTemperatureTest.java index df9361acf2..dd4f568883 100644 --- a/src/test/java/neqsim/PVTsimulation/simulation/SaturationTemperatureTest.java +++ b/src/test/java/neqsim/PVTsimulation/simulation/SaturationTemperatureTest.java @@ -49,7 +49,7 @@ void testCalcSaturationTemperature() { SimulationInterface satPresSim = new SaturationTemperature(tempSystem); satPresSim.run(); - assertEquals(tempSystem.getTemperature(), 380.3071922, 0.1); + assertEquals(tempSystem.getTemperature(), 380.127567672, 0.1); } /** diff --git a/src/test/java/neqsim/PVTsimulation/simulation/SeparatorTestTest.java b/src/test/java/neqsim/PVTsimulation/simulation/SeparatorTestTest.java index d27e28ddbf..cb5b7c580e 100644 --- a/src/test/java/neqsim/PVTsimulation/simulation/SeparatorTestTest.java +++ b/src/test/java/neqsim/PVTsimulation/simulation/SeparatorTestTest.java @@ -45,6 +45,6 @@ void testRunCalc() { sepSim.setSeparatorConditions(temps, pres); sepSim.runCalc(); - assertEquals(1.1245991497229437, sepSim.getBofactor()[4], 0.0001); + assertEquals(1.1224612120760051, sepSim.getBofactor()[4], 0.0001); } } diff --git a/src/test/java/neqsim/PVTsimulation/simulation/SlimTubeSimTest.java b/src/test/java/neqsim/PVTsimulation/simulation/SlimTubeSimTest.java index c56a0a62b0..f630643d93 100644 --- a/src/test/java/neqsim/PVTsimulation/simulation/SlimTubeSimTest.java +++ b/src/test/java/neqsim/PVTsimulation/simulation/SlimTubeSimTest.java @@ -1,6 +1,5 @@ package neqsim.PVTsimulation.simulation; -import static org.junit.jupiter.api.Assertions.assertEquals; import org.junit.jupiter.api.Test; import neqsim.thermo.system.SystemInterface; import neqsim.thermo.system.SystemSrkEos; @@ -35,10 +34,10 @@ void testRun() { oilSystem.setMixingRule(2); SlimTubeSim sepSim = new SlimTubeSim(oilSystem, gasSystem); - sepSim.setTemperature(273.15 + 100); + sepSim.setTemperature(273.15 + 80); sepSim.setPressure(380.0); - sepSim.setNumberOfSlimTubeNodes(40); - sepSim.run(); - assertEquals(242.3, sepSim.getPressures()[3], 0.001); + sepSim.setNumberOfSlimTubeNodes(10); + // sepSim.run(); + // assertEquals(242.3, sepSim.getPressures()[3], 0.001); } } diff --git a/src/test/java/neqsim/PVTsimulation/simulation/ViscositySimTest.java b/src/test/java/neqsim/PVTsimulation/simulation/ViscositySimTest.java index 30be13d56e..9c36e0f946 100644 --- a/src/test/java/neqsim/PVTsimulation/simulation/ViscositySimTest.java +++ b/src/test/java/neqsim/PVTsimulation/simulation/ViscositySimTest.java @@ -24,6 +24,6 @@ void testRunCalc() { sepSim.setExperimentalData(expData); // sepSim.runTuning(); sepSim.runCalc(); - assertEquals(4.420762033045493E-4, sepSim.getOilViscosity()[0], 0.000001); + assertEquals(4.443002015621749E-4, sepSim.getOilViscosity()[0], 0.000001); } } diff --git a/src/test/java/neqsim/PVTsimulation/simulation/WaxFractionSimTest.java b/src/test/java/neqsim/PVTsimulation/simulation/WaxFractionSimTest.java index 9b0b048fb9..84cad879d2 100644 --- a/src/test/java/neqsim/PVTsimulation/simulation/WaxFractionSimTest.java +++ b/src/test/java/neqsim/PVTsimulation/simulation/WaxFractionSimTest.java @@ -26,7 +26,8 @@ void testRunCalc() { double[] pres = {5, 5, 5.0, 5.0, 5.0, 5.0, 5.0}; sepSim.setTemperaturesAndPressures(temps, pres); sepSim.runCalc(); - assertEquals(0.2661032806907, sepSim.getThermoSystem().getPhaseFraction("wax", "mass"), 0.001); + assertEquals(0.2683853533110433, sepSim.getThermoSystem().getPhaseFraction("wax", "mass"), + 0.001); } @Test @@ -50,6 +51,7 @@ void testRunCalc2() { sepSim.setTemperaturesAndPressures(temps, pres); sepSim.runCalc(); NeqSimDataBase.setCreateTemporaryTables(false); - assertEquals(0.24679416544, sepSim.getThermoSystem().getPhaseFraction("wax", "mass"), 0.001); + assertEquals(0.24895564649970403, sepSim.getThermoSystem().getPhaseFraction("wax", "mass"), + 0.001); } } diff --git a/src/test/java/neqsim/processSimulation/processEquipment/reservoir/SimpleReservoirTest.java b/src/test/java/neqsim/processSimulation/processEquipment/reservoir/SimpleReservoirTest.java index 51ae93546f..5189d934de 100644 --- a/src/test/java/neqsim/processSimulation/processEquipment/reservoir/SimpleReservoirTest.java +++ b/src/test/java/neqsim/processSimulation/processEquipment/reservoir/SimpleReservoirTest.java @@ -58,7 +58,8 @@ void testRun2() { for (int i = 0; i < 10; i++) { reservoirOps.runTransient(deltaTime); } - Assertions.assertEquals(352.274030, reservoirOps.getReservoirFluid().getPressure("bara"), 0.1); + Assertions.assertEquals(355.19330033985693 + , reservoirOps.getReservoirFluid().getPressure("bara"), 0.1); Assertions.assertEquals(11.698, reservoirOps.getWaterProdution("Sm3/day"), 0.1); reservoirOps.setLowPressureLimit(52.0e5, "Pa"); diff --git a/src/test/java/neqsim/processSimulation/processSystem/CombinedOilGasFieldTest.java b/src/test/java/neqsim/processSimulation/processSystem/CombinedOilGasFieldTest.java index 7645164132..969d0f991d 100644 --- a/src/test/java/neqsim/processSimulation/processSystem/CombinedOilGasFieldTest.java +++ b/src/test/java/neqsim/processSimulation/processSystem/CombinedOilGasFieldTest.java @@ -80,10 +80,11 @@ public void testreservoirTPsim() { operations.add(reservoirGasTPsim); operations.add(MPFMgas); operations.run(); - assertEquals(8760.096083, MPFMgas.getMeasuredValue("GOR_std", ""), 1.0); + assertEquals(8834.875493073961, MPFMgas.getMeasuredValue("GOR_std", ""), 1.0); reservoirGasTPsim.setPressure(150.0, "bara"); operations.run(); - assertEquals(14880.1810, MPFMgas.getMeasuredValue("GOR_std", ""), 1.0); + assertEquals(14937.606339690177 + , MPFMgas.getMeasuredValue("GOR_std", ""), 1.0); } } diff --git a/src/test/java/neqsim/processSimulation/processSystem/CompressorModule.java b/src/test/java/neqsim/processSimulation/processSystem/CompressorModule.java index 98dd76020a..6b805d975b 100644 --- a/src/test/java/neqsim/processSimulation/processSystem/CompressorModule.java +++ b/src/test/java/neqsim/processSimulation/processSystem/CompressorModule.java @@ -134,7 +134,8 @@ public void testProcess() { operations.run(); - assertEquals(2053.120373716, resycleScrubberStream.getFlowRate("kg/hr"), 0.1); + assertEquals(2046.8012652616517 + , resycleScrubberStream.getFlowRate("kg/hr"), 0.1); neqsim.processSimulation.processEquipment.compressor.CompressorChartGenerator compchartgenerator = new neqsim.processSimulation.processEquipment.compressor.CompressorChartGenerator( diff --git a/src/test/java/neqsim/processSimulation/processSystem/OilGasProcessTest.java b/src/test/java/neqsim/processSimulation/processSystem/OilGasProcessTest.java index dffe76021f..87ed44d5ef 100644 --- a/src/test/java/neqsim/processSimulation/processSystem/OilGasProcessTest.java +++ b/src/test/java/neqsim/processSimulation/processSystem/OilGasProcessTest.java @@ -117,7 +117,7 @@ public void runProcess() throws InterruptedException { operations.run(); - assertEquals(17195.25050, seprator3rdStage.getGasOutStream().getFlowRate("kg/hr"), 1.1); + assertEquals(17105.52983567356, seprator3rdStage.getGasOutStream().getFlowRate("kg/hr"), 1.1); assertEquals(seprator3rdStage.getGasOutStream().getFlowRate("kg/hr"), coolerLP.getOutletStream().getFlowRate("kg/hr"), 1e-4); diff --git a/src/test/java/neqsim/standards/oilQuality/Standard_ASTM_D6377Test.java b/src/test/java/neqsim/standards/oilQuality/Standard_ASTM_D6377Test.java index fff91d0133..413c620b9b 100644 --- a/src/test/java/neqsim/standards/oilQuality/Standard_ASTM_D6377Test.java +++ b/src/test/java/neqsim/standards/oilQuality/Standard_ASTM_D6377Test.java @@ -39,13 +39,14 @@ void testCalculate2() { standard.setMethodRVP("VPCR4"); standard.setReferenceTemperature(37.8, "C"); standard.calculate(); - Assertions.assertEquals(3.604002003478, standard.getValue("RVP", "bara"), 1e-3); - Assertions.assertEquals(7.8448385024, standard.getValue("TVP", "bara"), 1e-3); + Assertions.assertEquals(3.6145219653041623, standard.getValue("RVP", "bara"), 1e-3); + Assertions.assertEquals(7.867696779327479, standard.getValue("TVP", "bara"), 1e-3); standard.setMethodRVP("RVP_ASTM_D6377"); standard.setReferenceTemperature(37.8, "C"); standard.calculate(); - Assertions.assertEquals(3.00573767, standard.getValue("RVP", "bara"), 1e-3); - Assertions.assertEquals(7.8448385024, standard.getValue("TVP", "bara"), 1e-3); + Assertions.assertEquals(3.014511319063671, standard.getValue("RVP", "bara"), 1e-3); + Assertions.assertEquals(7.867696779327479 + , standard.getValue("TVP", "bara"), 1e-3); } } diff --git a/src/test/java/neqsim/thermo/characterization/TBPfractionModelTest.java b/src/test/java/neqsim/thermo/characterization/TBPfractionModelTest.java index 2ae7dcb7bb..6d9d2b9773 100644 --- a/src/test/java/neqsim/thermo/characterization/TBPfractionModelTest.java +++ b/src/test/java/neqsim/thermo/characterization/TBPfractionModelTest.java @@ -34,10 +34,12 @@ void testPedersenSRKModel() { SystemInterface thermoSystem = new SystemSrkEos(298.0, 10.0); thermoSystem.getCharacterization().setTBPModel("PedersenSRK"); thermoSystem.addTBPfraction("C7", 1.0, 110.0 / 1000.0, 0.73); - assertEquals(554.3185637098962, thermoSystem.getComponent(0).getTC(), 1e-3); - assertEquals(26.007549082822628, thermoSystem.getComponent(0).getPC(), 1e-3); + assertEquals(281.1685637, thermoSystem.getComponent(0).getTC() - 273.15, 1e-3); + assertEquals(26.341015469211726 + , thermoSystem.getComponent(0).getPC(), 1e-3); assertEquals(0.508241, thermoSystem.getComponent(0).getAcentricFactor(), 1e-3); - assertEquals(384.6714299777243, thermoSystem.getComponent(0).getCriticalVolume(), 1e-3); + assertEquals(426.46717439, thermoSystem.getComponent(0).getCriticalVolume(), 1e-3); + assertEquals(122.93500, thermoSystem.getComponent(0).getNormalBoilingPoint("C"), 1e-3); } @Test @@ -46,10 +48,9 @@ void testPedersenPRModel() { thermoSystem.getCharacterization().setTBPModel("PedersenPR"); thermoSystem.addTBPfraction("C7", 1.0, 110.0 / 1000.0, 0.73); assertEquals(560.546, thermoSystem.getComponent(0).getTC(), 1e-3); - assertEquals(25.838137535018557, thermoSystem.getComponent(0).getPC(), 1e-3); + assertEquals(26.16934428134274, thermoSystem.getComponent(0).getPC(), 1e-3); assertEquals(0.3838836222383, thermoSystem.getComponent(0).getAcentricFactor(), 1e-3); - assertEquals(405.0890245138075, thermoSystem.getComponent(0).getCriticalVolume(), 1e-3); + assertEquals(444.07282144, thermoSystem.getComponent(0).getCriticalVolume(), 1e-3); + assertEquals(122.93500, thermoSystem.getComponent(0).getNormalBoilingPoint("C"), 1e-3); } - - } diff --git a/src/test/java/neqsim/thermo/system/SystemThermoTest.java b/src/test/java/neqsim/thermo/system/SystemThermoTest.java index abff550621..2d6e940e35 100644 --- a/src/test/java/neqsim/thermo/system/SystemThermoTest.java +++ b/src/test/java/neqsim/thermo/system/SystemThermoTest.java @@ -43,7 +43,7 @@ public void testCp() { ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem); testOps.TPflash(); testSystem.initProperties(); - assertEquals(2.0188664689245, testSystem.getPhase(1).getCp("kJ/kgK"), 1e-6); + assertEquals(2.00406932521, testSystem.getPhase(1).getCp("kJ/kgK"), 1e-6); } /** diff --git a/src/test/java/neqsim/thermodynamicOperations/flashOps/TPFlashTest.java b/src/test/java/neqsim/thermodynamicOperations/flashOps/TPFlashTest.java index a700beed41..fb3a5e9e65 100644 --- a/src/test/java/neqsim/thermodynamicOperations/flashOps/TPFlashTest.java +++ b/src/test/java/neqsim/thermodynamicOperations/flashOps/TPFlashTest.java @@ -135,7 +135,8 @@ void testRun6() { testOps = new ThermodynamicOperations(testSystem5); testOps.TPflash(); testSystem5.initProperties(); - assertEquals(0.27697023508525664, testSystem5.getBeta(), 1e-6); + assertEquals(0.2838675588923609 + , testSystem5.getBeta(), 1e-6); assertEquals(3, testSystem5.getNumberOfPhases()); } diff --git a/src/test/java/neqsim/thermodynamicOperations/flashOps/TPFlashTestWellFluid.java b/src/test/java/neqsim/thermodynamicOperations/flashOps/TPFlashTestWellFluid.java index 1ba453a913..bdca57ff62 100644 --- a/src/test/java/neqsim/thermodynamicOperations/flashOps/TPFlashTestWellFluid.java +++ b/src/test/java/neqsim/thermodynamicOperations/flashOps/TPFlashTestWellFluid.java @@ -69,6 +69,7 @@ void testTPflashComp2() { 8.96e-3, 1.539e-3, 5.9921e-1}); testOps = new ThermodynamicOperations(wellFluid); testOps.TPflash(); - assertEquals(1.4292538950216407, wellFluid.getPhase(0).getDensity(), 1e-5); + assertEquals(1.432253736300898 + , wellFluid.getPhase(0).getDensity(), 1e-5); } } diff --git a/src/test/java/neqsim/thermodynamicOperations/flashOps/WaxFlashTest.java b/src/test/java/neqsim/thermodynamicOperations/flashOps/WaxFlashTest.java index a59583debd..c93f01a0ed 100644 --- a/src/test/java/neqsim/thermodynamicOperations/flashOps/WaxFlashTest.java +++ b/src/test/java/neqsim/thermodynamicOperations/flashOps/WaxFlashTest.java @@ -64,7 +64,7 @@ void testRun() { if (testSystem.hasPhaseType("wax")) { waxVolumeFrac = testSystem.getWtFraction(testSystem.getPhaseIndex("wax")); } - assertEquals(30.33516095, waxT, 0.001); + assertEquals(30.323689017118397, waxT, 0.001); assertEquals(3.236072552269342E-4, waxVolumeFrac, 0.0001); } } From 89d60f12cac1ff3113ce16a8d230e94ebed06b84 Mon Sep 17 00:00:00 2001 From: Even Solbraa <41290109+EvenSol@users.noreply.github.com> Date: Mon, 12 Aug 2024 21:37:33 +0000 Subject: [PATCH 2/2] fix slim tube test --- .../PVTsimulation/simulation/SlimTubeSimTest.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/test/java/neqsim/PVTsimulation/simulation/SlimTubeSimTest.java b/src/test/java/neqsim/PVTsimulation/simulation/SlimTubeSimTest.java index f630643d93..37694696ab 100644 --- a/src/test/java/neqsim/PVTsimulation/simulation/SlimTubeSimTest.java +++ b/src/test/java/neqsim/PVTsimulation/simulation/SlimTubeSimTest.java @@ -1,5 +1,6 @@ package neqsim.PVTsimulation.simulation; +import static org.junit.jupiter.api.Assertions.assertEquals; import org.junit.jupiter.api.Test; import neqsim.thermo.system.SystemInterface; import neqsim.thermo.system.SystemSrkEos; @@ -29,15 +30,15 @@ void testRun() { oilSystem.addTBPfraction("C17", 0.17, 234.0 / 1000.0, 0.84); oilSystem.addTBPfraction("C18", 0.13, 251.0 / 1000.0, 0.844); oilSystem.addTBPfraction("C19", 0.13, 270.0 / 1000.0, 0.854); - oilSystem.addPlusFraction("C20", 10.62, 381.0 / 1000.0, 0.88); + oilSystem.addPlusFraction("C20", 20.62, 381.0 / 1000.0, 0.88); oilSystem.getCharacterization().characterisePlusFraction(); oilSystem.setMixingRule(2); SlimTubeSim sepSim = new SlimTubeSim(oilSystem, gasSystem); - sepSim.setTemperature(273.15 + 80); + sepSim.setTemperature(273.15 + 100); sepSim.setPressure(380.0); - sepSim.setNumberOfSlimTubeNodes(10); - // sepSim.run(); - // assertEquals(242.3, sepSim.getPressures()[3], 0.001); + sepSim.setNumberOfSlimTubeNodes(40); + sepSim.run(); + assertEquals(242.3, sepSim.getPressures()[3], 0.001); } }