From 94f14e4137860fcd86f173f6d8b30c816b4f3bee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=85smund=20V=C3=A5ge=20Fannemel?= <34712686+asmfstatoil@users.noreply.github.com> Date: Mon, 13 Nov 2023 13:28:20 +0100 Subject: [PATCH] feat: use defined constant values (#825) * refact: use defined constant values for atmospheric pressure * refact: use defined constant value for R style / docfix --------- Co-authored-by: Even Solbraa <41290109+EvenSol@users.noreply.github.com> --- .../simulation/ConstantMassExpansion.java | 4 +- .../simulation/DifferentialLiberation.java | 6 +- .../neqsim/PVTsimulation/simulation/GOR.java | 9 +- .../simulation/SeparatorTest.java | 9 +- .../PVTsimulation/simulation/SlimTubeSim.java | 9 +- .../chemicalEquilibriaum/ChemEq.java | 3 +- .../ChemicalEquilibrium.java | 3 +- .../FluidBoundarySystemNonReactive.java | 3 +- .../FluidBoundarySystemReactive.java | 4 +- .../waxNode/WaxDepositionFlowNode.java | 3 +- .../twoPhasePipeFlowNode/DropletFlowNode.java | 3 +- .../TwoPhaseTrayTowerFlowNode.java | 8 +- .../StirredCellNode.java | 3 +- .../shipSystem/LNGship.java | 4 +- .../PFCTConductivityMethodMod86.java | 17 +- .../viscosity/PFCTViscosityMethod.java | 4 +- .../PFCTViscosityMethodHeavyOil.java | 7 +- .../viscosity/PFCTViscosityMethodMod86.java | 7 +- .../measurementDevice/MultiPhaseMeter.java | 3 +- .../VolumeFlowTransmitter.java | 9 +- .../simpleFlowRegime/SevereSlugAnalyser.java | 3 +- .../compressor/Compressor.java | 8 +- .../powerGeneration/GasTurbine.java | 13 +- .../reservoir/SimpleReservoir.java | 5 +- .../processEquipment/reservoir/Well.java | 9 +- .../processEquipment/util/GORfitter.java | 5 +- .../AdsorptionDehydrationlModule.java | 4 +- .../processModules/SeparationTrainModule.java | 5 +- .../SeparationTrainModuleSimple.java | 26 +- .../processModules/WellFluidModule.java | 6 +- .../gasQuality/Standard_ISO6976.java | 6 +- .../gasQuality/Standard_ISO6976_2016.java | 1 + .../oilQuality/Standard_ASTM_D6377.java | 3 +- .../WettedWallColumnSampleCreator.java | 4 +- .../characterization/TBPfractionModel.java | 16 +- .../thermo/component/ComponentHydrate.java | 13 +- .../component/ComponentHydrateKluda.java | 4 +- src/main/java/neqsim/thermo/phase/Phase.java | 14 +- .../java/neqsim/thermo/phase/PhaseGE.java | 3 +- .../neqsim/thermo/phase/PhaseGERG2004Eos.java | 14 +- .../neqsim/thermo/phase/PhaseInterface.java | 231 +++++----- .../neqsim/thermo/system/SystemInterface.java | 394 +++++++----------- .../neqsim/thermo/system/SystemThermo.java | 38 +- .../neqsim/thermo/util/GERG/GERG2008.java | 141 +++---- .../util/benchmark/TPflash_benchmark.java | 2 +- .../benchmark/TPflash_benchmark_fullcomp.java | 2 +- .../util/empiric/BukacekWaterInGas.java | 131 +++--- .../neqsim/thermo/util/empiric/DuanSun.java | 17 +- .../util/readwrite/EclipseFluidReadWrite.java | 14 +- ...GApropertyTableGeneratorKeywordFormat.java | 3 +- .../OLGApropertyTableGeneratorWater.java | 3 +- .../OLGApropertyTableGeneratorWaterEven.java | 3 +- ...pertyTableGeneratorWaterKeywordFormat.java | 3 +- ...GApropertyTableGeneratorWaterStudents.java | 3 +- ...propertyTableGeneratorWaterStudentsPH.java | 3 +- .../neqsim/util/database/NeqSimDataBase.java | 1 - src/main/java/neqsim/util/unit/BaseUnit.java | 87 ++-- .../java/neqsim/util/unit/LengthUnit.java | 8 +- src/main/java/neqsim/util/unit/RateUnit.java | 6 +- src/main/java/neqsim/util/unit/TimeUnit.java | 8 +- src/main/java/neqsim/util/unit/Unit.java | 6 +- .../simulation/SeparatorTestTest.java | 4 +- .../ChemicalReactionOperationsTest.java | 26 ++ .../util/examples/TestCondensate.java | 7 +- .../pipeline/BeggsAndBrillsPipeTest.java | 25 +- .../processEquipment/util/GORfitterTest.java | 3 +- .../processSystem/GlycolRigTest.java | 9 +- .../util/example/LNGtankfilling.java | 5 +- .../util/example/MasstransferMeOH.java | 8 +- .../util/example/OffshoreProcess3.java | 3 +- .../TEGdehydrationProcessDistillation.java | 14 +- .../TEGdehydrationProcessDistillation3.java | 14 +- ...TEGdehydrationProcessDistillationAaHa.java | 20 +- .../TEGdehydrationProcessDistillationGFA.java | 15 +- .../util/example/TestProcess4.java | 2 +- .../util/example/oxygenRemovalWater.java | 5 +- .../neqsim/thermo/component/AmmoniaTest.java | 3 +- .../thermo/component/NewComponentTest.java | 3 +- .../SystemSrkSchwartzentruberEosTest.java | 4 +- .../thermo/system/SystemThermoTest.java | 6 +- .../thermo/util/example/ActivityCalc.java | 4 +- .../thermo/util/example/AmineFlash.java | 7 +- .../thermo/util/example/FreezingPoint.java | 7 +- .../thermo/util/example/HydrateFlash.java | 5 +- .../neqsim/thermo/util/example/ModelTest.java | 3 +- .../util/example/OsmoticCoefficient.java | 11 +- .../util/example/OsmoticCoefficient_1.java | 12 +- .../util/example/SulfureDeposition.java | 3 +- .../neqsim/thermo/util/example/TPflash2.java | 7 +- .../thermo/util/example/TPflashDehyd.java | 5 +- .../thermo/util/example/TPflashMembrane.java | 4 +- .../thermo/util/example/TestFluidIssues.java | 2 +- .../thermo/util/example/TestVHflash.java | 9 +- .../ThermodynamicOperationsTest.java | 3 +- .../neqsim/util/unit/PressureUnitTest.java | 0 95 files changed, 873 insertions(+), 769 deletions(-) create mode 100644 src/test/java/neqsim/chemicalReactions/ChemicalReactionOperationsTest.java create mode 100644 src/test/java/neqsim/util/unit/PressureUnitTest.java diff --git a/src/main/java/neqsim/PVTsimulation/simulation/ConstantMassExpansion.java b/src/main/java/neqsim/PVTsimulation/simulation/ConstantMassExpansion.java index 1d8a3df4fa..d88e76a658 100644 --- a/src/main/java/neqsim/PVTsimulation/simulation/ConstantMassExpansion.java +++ b/src/main/java/neqsim/PVTsimulation/simulation/ConstantMassExpansion.java @@ -7,6 +7,7 @@ import neqsim.statistics.parameterFitting.SampleSet; import neqsim.statistics.parameterFitting.SampleValue; import neqsim.statistics.parameterFitting.nonLinearParameterFitting.LevenbergMarquardt; +import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.system.SystemInterface; import neqsim.thermo.system.SystemSrkEos; @@ -152,7 +153,8 @@ public void runCalc() { gasVolume[i] = getThermoSystem().getPhase(0).getNumberOfMolesInPhase() * getThermoSystem().getPhase(0).getMolarMass() / density[i]; // getThermoSystem().getPhase(0).getVolume(); gasStandardVolume[i] = getThermoSystem().getPhase(0).getVolume() - * getThermoSystem().getPhase(0).getPressure() / 1.01325 + * getThermoSystem().getPhase(0).getPressure() + / ThermodynamicConstantsInterface.referencePressure / getThermoSystem().getPhase(0).getZ() * 288.15 / getThermoSystem().getTemperature(); Bg[i] = gasVolume[i] * 1e5 / gasStandardVolume[i]; Zgas[i] = getThermoSystem().getPhase(0).getZ(); diff --git a/src/main/java/neqsim/PVTsimulation/simulation/DifferentialLiberation.java b/src/main/java/neqsim/PVTsimulation/simulation/DifferentialLiberation.java index a37f9e50da..248516c045 100644 --- a/src/main/java/neqsim/PVTsimulation/simulation/DifferentialLiberation.java +++ b/src/main/java/neqsim/PVTsimulation/simulation/DifferentialLiberation.java @@ -2,6 +2,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.system.SystemInterface; import neqsim.thermo.system.SystemSrkEos; @@ -125,7 +126,8 @@ public void runCalc() { } } gasStandardVolume[i] = getThermoSystem().getPhase(0).getVolume() - * getThermoSystem().getPhase(0).getPressure() / 1.01325 + * getThermoSystem().getPhase(0).getPressure() + / ThermodynamicConstantsInterface.referencePressure / getThermoSystem().getPhase(0).getZ() * 288.15 / getThermoSystem().getTemperature(); totalGasStandardVolume += getGasStandardVolume()[i]; // if (totalVolume[i] > saturationVolume) { @@ -168,7 +170,7 @@ public void runCalc() { } } } - getThermoSystem().setPressure(1.01325); + getThermoSystem().setPressure(ThermodynamicConstantsInterface.referencePressure); getThermoSystem().setTemperature(288.15); try { thermoOps.TPflash(); diff --git a/src/main/java/neqsim/PVTsimulation/simulation/GOR.java b/src/main/java/neqsim/PVTsimulation/simulation/GOR.java index e0b68dfa57..57ece9cb73 100644 --- a/src/main/java/neqsim/PVTsimulation/simulation/GOR.java +++ b/src/main/java/neqsim/PVTsimulation/simulation/GOR.java @@ -1,5 +1,6 @@ package neqsim.PVTsimulation.simulation; +import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.phase.PhaseType; import neqsim.thermo.system.SystemInterface; import neqsim.thermo.system.SystemSrkEos; @@ -70,14 +71,15 @@ public void runCalc() { } if (getThermoSystem().getNumberOfPhases() > 1 && getThermoSystem().getPhase(0).getType() == PhaseType.GAS) { - getThermoSystem().getPhase(0).setPressure(1.01325); + getThermoSystem().getPhase(0) + .setPressure(ThermodynamicConstantsInterface.referencePressure); getThermoSystem().getPhase(0).setTemperature(288.15); getThermoSystem().init(1); Sm3gas[i] = getThermoSystem().getPhase(0).getVolume(); // setThermoSystem(getThermoSystem().phaseToSystem(1)); } } - getThermoSystem().setPressure(1.01325); + getThermoSystem().setPressure(ThermodynamicConstantsInterface.referencePressure); getThermoSystem().setTemperature(288.15); thermoOps.TPflash(); oilVolumeStdCond = getThermoSystem().getPhase("oil").getVolume(); @@ -130,7 +132,8 @@ public static void main(String[] args) { GOR sepSim = new GOR(tempSystem); double[] temps = {313.15, 313.15, 313.15, 313.15, 313.15, 313.15, 313.15}; - double[] pres = {500, 400, 200, 100, 50.0, 5.0, 1.01325}; + double[] pres = + {500, 400, 200, 100, 50.0, 5.0, ThermodynamicConstantsInterface.referencePressure}; sepSim.setTemperaturesAndPressures(temps, pres); sepSim.runCalc(); } diff --git a/src/main/java/neqsim/PVTsimulation/simulation/SeparatorTest.java b/src/main/java/neqsim/PVTsimulation/simulation/SeparatorTest.java index e4e104501e..678b5c4d3d 100644 --- a/src/main/java/neqsim/PVTsimulation/simulation/SeparatorTest.java +++ b/src/main/java/neqsim/PVTsimulation/simulation/SeparatorTest.java @@ -2,6 +2,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.phase.PhaseType; import neqsim.thermo.system.SystemInterface; import neqsim.thermo.system.SystemSrkEos; @@ -70,14 +71,15 @@ public void runCalc() { } if (getThermoSystem().getNumberOfPhases() > 1 && getThermoSystem().getPhase(0).getType() == PhaseType.GAS) { - getThermoSystem().getPhase(0).setPressure(1.01325); + getThermoSystem().getPhase(0) + .setPressure(ThermodynamicConstantsInterface.referencePressure); getThermoSystem().getPhase(0).setTemperature(288.15); getThermoSystem().init(1); Sm3gas[i] = getThermoSystem().getPhase(0).getVolume(); setThermoSystem(getThermoSystem().phaseToSystem(1)); } } - getThermoSystem().setPressure(1.01325); + getThermoSystem().setPressure(ThermodynamicConstantsInterface.referencePressure); getThermoSystem().setTemperature(288.15); thermoOps.TPflash(); oilVolumeStdCond = getThermoSystem().getPhase("oil").getVolume(); @@ -130,7 +132,8 @@ public static void main(String[] args) { SeparatorTest sepSim = new SeparatorTest(tempSystem); double[] temps = {313.15, 313.15, 313.15, 313.15, 313.15, 313.15, 313.15}; - double[] pres = {500, 400, 200, 100, 50.0, 5.0, 1.01325}; + double[] pres = + {500, 400, 200, 100, 50.0, 5.0, ThermodynamicConstantsInterface.referencePressure}; sepSim.setSeparatorConditions(temps, pres); sepSim.runCalc(); } diff --git a/src/main/java/neqsim/PVTsimulation/simulation/SlimTubeSim.java b/src/main/java/neqsim/PVTsimulation/simulation/SlimTubeSim.java index 5712abf4da..c8c9b0d851 100644 --- a/src/main/java/neqsim/PVTsimulation/simulation/SlimTubeSim.java +++ b/src/main/java/neqsim/PVTsimulation/simulation/SlimTubeSim.java @@ -2,6 +2,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.system.SystemInterface; import neqsim.thermo.system.SystemSrkEos; import neqsim.thermodynamicOperations.ThermodynamicOperations; @@ -38,7 +39,7 @@ public SlimTubeSim(SystemInterface tempSystem, SystemInterface injectionGas) { public void run() { slimTubeNodeSystem = new SystemInterface[numberOfSlimTubeNodes + 1]; - getThermoSystem().setPressure(1.01325); + getThermoSystem().setPressure(ThermodynamicConstantsInterface.referencePressure); getThermoSystem().setTemperature(288.15); thermoOps.TPflash(); @@ -162,7 +163,8 @@ public void run() { * slimTubeNodeSystem[numberOfSlimTubeNodes].getNumberOfMoles()); */ slimTubeNodeSystem[numberOfSlimTubeNodes].setTemperature(288.15); - slimTubeNodeSystem[numberOfSlimTubeNodes].setPressure(1.01325); + slimTubeNodeSystem[numberOfSlimTubeNodes] + .setPressure(ThermodynamicConstantsInterface.referencePressure); slimOps1.TPflash(); /* @@ -183,7 +185,8 @@ public void run() { } slimTubeNodeSystem[numberOfSlimTubeNodes].setTemperature(288.15); - slimTubeNodeSystem[numberOfSlimTubeNodes].setPressure(1.01325); + slimTubeNodeSystem[numberOfSlimTubeNodes] + .setPressure(ThermodynamicConstantsInterface.referencePressure); slimOps1.TPflash(); /* diff --git a/src/main/java/neqsim/chemicalReactions/chemicalEquilibriaum/ChemEq.java b/src/main/java/neqsim/chemicalReactions/chemicalEquilibriaum/ChemEq.java index 40db28d2ff..03ca2be6d4 100644 --- a/src/main/java/neqsim/chemicalReactions/chemicalEquilibriaum/ChemEq.java +++ b/src/main/java/neqsim/chemicalReactions/chemicalEquilibriaum/ChemEq.java @@ -1,6 +1,7 @@ package neqsim.chemicalReactions.chemicalEquilibriaum; import Jama.Matrix; +import neqsim.thermo.ThermodynamicConstantsInterface; /** *

@@ -14,7 +15,7 @@ public class ChemEq implements java.io.Serializable { private static final long serialVersionUID = 1000; int NSPEC = 10; int NELE = 3; - double R = 8.3143; + double R = ThermodynamicConstantsInterface.R; double G_min = 0; double T = 3500; double P = 51; diff --git a/src/main/java/neqsim/chemicalReactions/chemicalEquilibriaum/ChemicalEquilibrium.java b/src/main/java/neqsim/chemicalReactions/chemicalEquilibriaum/ChemicalEquilibrium.java index 25df36f936..b299bd485d 100644 --- a/src/main/java/neqsim/chemicalReactions/chemicalEquilibriaum/ChemicalEquilibrium.java +++ b/src/main/java/neqsim/chemicalReactions/chemicalEquilibriaum/ChemicalEquilibrium.java @@ -3,6 +3,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import Jama.Matrix; +import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.component.ComponentInterface; import neqsim.thermo.system.SystemInterface; @@ -24,7 +25,7 @@ public class ChemicalEquilibrium implements java.io.Serializable { double d_n_t = 0; int NSPEC = 2; int NELE = 2; - double R = 8.314; + double R = ThermodynamicConstantsInterface.R; Matrix x_solve; double y_solve; double n_t = 0.0; diff --git a/src/main/java/neqsim/fluidMechanics/flowNode/fluidBoundary/heatMassTransferCalc/finiteVolumeBoundary/fluidBoundarySystem/fluidBoundaryNonReactive/FluidBoundarySystemNonReactive.java b/src/main/java/neqsim/fluidMechanics/flowNode/fluidBoundary/heatMassTransferCalc/finiteVolumeBoundary/fluidBoundarySystem/fluidBoundaryNonReactive/FluidBoundarySystemNonReactive.java index 7568293132..c73f6edbdf 100644 --- a/src/main/java/neqsim/fluidMechanics/flowNode/fluidBoundary/heatMassTransferCalc/finiteVolumeBoundary/fluidBoundarySystem/fluidBoundaryNonReactive/FluidBoundarySystemNonReactive.java +++ b/src/main/java/neqsim/fluidMechanics/flowNode/fluidBoundary/heatMassTransferCalc/finiteVolumeBoundary/fluidBoundarySystem/fluidBoundaryNonReactive/FluidBoundarySystemNonReactive.java @@ -6,6 +6,7 @@ import neqsim.fluidMechanics.flowNode.fluidBoundary.heatMassTransferCalc.finiteVolumeBoundary.fluidBoundarySystem.FluidBoundarySystem; import neqsim.fluidMechanics.flowNode.twoPhaseNode.twoPhasePipeFlowNode.StratifiedFlowNode; import neqsim.fluidMechanics.geometryDefinitions.pipe.PipeData; +import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.system.SystemFurstElectrolyteEos; import neqsim.thermo.system.SystemInterface; @@ -58,7 +59,7 @@ public void createSystem() { * @param args an array of {@link java.lang.String} objects */ public static void main(String[] args) { - SystemInterface testSystem = new SystemFurstElectrolyteEos(275.3, 1.01325); + SystemInterface testSystem = new SystemFurstElectrolyteEos(275.3, ThermodynamicConstantsInterface.referencePressure); PipeData pipe1 = new PipeData(10.0, 0.025); testSystem.addComponent("methane", 0.061152181, 0); diff --git a/src/main/java/neqsim/fluidMechanics/flowNode/fluidBoundary/heatMassTransferCalc/finiteVolumeBoundary/fluidBoundarySystem/fluidBoundarySystemReactive/FluidBoundarySystemReactive.java b/src/main/java/neqsim/fluidMechanics/flowNode/fluidBoundary/heatMassTransferCalc/finiteVolumeBoundary/fluidBoundarySystem/fluidBoundarySystemReactive/FluidBoundarySystemReactive.java index f46d9886ae..85e97dc80e 100644 --- a/src/main/java/neqsim/fluidMechanics/flowNode/fluidBoundary/heatMassTransferCalc/finiteVolumeBoundary/fluidBoundarySystem/fluidBoundarySystemReactive/FluidBoundarySystemReactive.java +++ b/src/main/java/neqsim/fluidMechanics/flowNode/fluidBoundary/heatMassTransferCalc/finiteVolumeBoundary/fluidBoundarySystem/fluidBoundarySystemReactive/FluidBoundarySystemReactive.java @@ -12,6 +12,7 @@ import neqsim.fluidMechanics.flowNode.fluidBoundary.heatMassTransferCalc.finiteVolumeBoundary.fluidBoundarySystem.FluidBoundarySystem; import neqsim.fluidMechanics.flowNode.twoPhaseNode.twoPhasePipeFlowNode.StratifiedFlowNode; import neqsim.fluidMechanics.geometryDefinitions.pipe.PipeData; +import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.system.SystemFurstElectrolyteEos; import neqsim.thermo.system.SystemInterface; @@ -65,7 +66,8 @@ public void createSystem() { * @param args an array of {@link java.lang.String} objects */ public static void main(String[] args) { - SystemInterface testSystem = new SystemFurstElectrolyteEos(275.3, 1.01325); + SystemInterface testSystem = + new SystemFurstElectrolyteEos(275.3, ThermodynamicConstantsInterface.referencePressure); PipeData pipe1 = new PipeData(10.0, 0.025); testSystem.addComponent("methane", 0.061152181, 0); diff --git a/src/main/java/neqsim/fluidMechanics/flowNode/multiPhaseNode/waxNode/WaxDepositionFlowNode.java b/src/main/java/neqsim/fluidMechanics/flowNode/multiPhaseNode/waxNode/WaxDepositionFlowNode.java index 7a7eb94443..910ad3bc5e 100644 --- a/src/main/java/neqsim/fluidMechanics/flowNode/multiPhaseNode/waxNode/WaxDepositionFlowNode.java +++ b/src/main/java/neqsim/fluidMechanics/flowNode/multiPhaseNode/waxNode/WaxDepositionFlowNode.java @@ -121,7 +121,8 @@ public FlowNodeInterface getNextNode() { @SuppressWarnings("unused") public static void main(String[] args) { SystemInterface testSystem = new SystemSrkEos(273.15 + 40.0, 10.0); - // SystemInterface testSystem = new SystemSrkCPAstatoil(275.3, 1.01325); + // SystemInterface testSystem = new SystemSrkCPAstatoil(275.3, + // ThermodynamicConstantsInterface.referencePressure); ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem); PipeData pipe1 = new PipeData(0.203, 0.00025); diff --git a/src/main/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhasePipeFlowNode/DropletFlowNode.java b/src/main/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhasePipeFlowNode/DropletFlowNode.java index 614c5747a5..b091df923e 100644 --- a/src/main/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhasePipeFlowNode/DropletFlowNode.java +++ b/src/main/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhasePipeFlowNode/DropletFlowNode.java @@ -152,7 +152,8 @@ public FlowNodeInterface getNextNode() { @SuppressWarnings("unused") public static void mainOld(String[] args) { SystemInterface testSystem = new SystemSrkCPAstatoil(273.15 + 11.0, 60.0); - // SystemInterface testSystem = new SystemSrkCPAstatoil(275.3, 1.01325); + // SystemInterface testSystem = new SystemSrkCPAstatoil(275.3, + // ThermodynamicConstantsInterface.referencePressure); ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem); PipeData pipe1 = new PipeData(0.203, 0.00025); diff --git a/src/main/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhaseReactorFlowNode/TwoPhaseTrayTowerFlowNode.java b/src/main/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhaseReactorFlowNode/TwoPhaseTrayTowerFlowNode.java index d5d3727949..e3203b917e 100644 --- a/src/main/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhaseReactorFlowNode/TwoPhaseTrayTowerFlowNode.java +++ b/src/main/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhaseReactorFlowNode/TwoPhaseTrayTowerFlowNode.java @@ -5,6 +5,7 @@ import neqsim.fluidMechanics.flowNode.twoPhaseNode.TwoPhaseFlowNode; import neqsim.fluidMechanics.geometryDefinitions.GeometryDefinitionInterface; import neqsim.fluidMechanics.geometryDefinitions.pipe.PipeData; +import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.system.SystemFurstElectrolyteEos; import neqsim.thermo.system.SystemInterface; import neqsim.thermodynamicOperations.ThermodynamicOperations; @@ -129,15 +130,16 @@ public FlowNodeInterface getNextNode() { public static void main(String[] args) { /* * System.out.println("Starter....."); SystemSrkEos testSystem = new SystemSrkEos(275.3, - * 1.01325); ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem); PipeData - * pipe1 = new PipeData(10.0, 0.025); + * ThermodynamicConstantsInterface.referencePressure); ThermodynamicOperations testOps = new + * ThermodynamicOperations(testSystem); PipeData pipe1 = new PipeData(10.0, 0.025); * * testSystem.addComponent("methane", 0.011152181, 0); testSystem.addComponent("ethane", * 0.00011152181, 0); testSystem.addComponent("water", 0.00462204876, 1); * testSystem.addComponent("methane", 0.061152181, 0); testSystem.addComponent("water", * 0.00862204876, 1); */ - SystemInterface testSystem = new SystemFurstElectrolyteEos(275.3, 1.01325); + SystemInterface testSystem = + new SystemFurstElectrolyteEos(275.3, ThermodynamicConstantsInterface.referencePressure); ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem); PipeData pipe1 = new PipeData(10.0, 0.025); diff --git a/src/main/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhaseStirredCellNode/StirredCellNode.java b/src/main/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhaseStirredCellNode/StirredCellNode.java index 69c298729e..c28f2ea4f4 100644 --- a/src/main/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhaseStirredCellNode/StirredCellNode.java +++ b/src/main/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhaseStirredCellNode/StirredCellNode.java @@ -226,7 +226,8 @@ public void setDt(double dt) { */ @SuppressWarnings("unused") public static void main(String[] args) { - // SystemInterface testSystem = new SystemFurstElectrolyteEos(275.3, 1.01325); + // SystemInterface testSystem = new SystemFurstElectrolyteEos(275.3, + // ThermodynamicConstantsInterface.referencePressure); // SystemInterface testSystem = new SystemSrkEos(313.3, 70.01325); SystemInterface testSystem = new SystemSrkCPAstatoil(313.3, 70.01325); ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem); diff --git a/src/main/java/neqsim/fluidMechanics/flowSystem/twoPhaseFlowSystem/shipSystem/LNGship.java b/src/main/java/neqsim/fluidMechanics/flowSystem/twoPhaseFlowSystem/shipSystem/LNGship.java index 53ce4b5d3c..649c8ef8c8 100644 --- a/src/main/java/neqsim/fluidMechanics/flowSystem/twoPhaseFlowSystem/shipSystem/LNGship.java +++ b/src/main/java/neqsim/fluidMechanics/flowSystem/twoPhaseFlowSystem/shipSystem/LNGship.java @@ -8,6 +8,7 @@ import neqsim.standards.gasQuality.Standard_ISO6578; import neqsim.standards.gasQuality.Standard_ISO6976; import neqsim.standards.gasQuality.Standard_ISO6976_2016; +import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.system.SystemInterface; import neqsim.thermodynamicOperations.ThermodynamicOperations; @@ -407,7 +408,8 @@ public static void main(String[] args) { // thermo.system.SystemInterface testSystem = new // thermo.system.SystemGERG2004Eos(273.15 - 161.4, 1.0); neqsim.thermo.system.SystemInterface testSystem = - new neqsim.thermo.system.SystemSrkEos(273.15 - 161.4, 1.013); + new neqsim.thermo.system.SystemSrkEos(273.15 - 161.4, + ThermodynamicConstantsInterface.referencePressure); /* * testSystem.addComponent("nitrogen", 0.0136); testSystem.addComponent("methane", 0.9186); * testSystem.addComponent("ethane", 0.0526); testSystem.addComponent("propane", 0.0115); diff --git a/src/main/java/neqsim/physicalProperties/physicalPropertyMethods/commonPhasePhysicalProperties/conductivity/PFCTConductivityMethodMod86.java b/src/main/java/neqsim/physicalProperties/physicalPropertyMethods/commonPhasePhysicalProperties/conductivity/PFCTConductivityMethodMod86.java index 64eda4d617..b425eba7bb 100644 --- a/src/main/java/neqsim/physicalProperties/physicalPropertyMethods/commonPhasePhysicalProperties/conductivity/PFCTConductivityMethodMod86.java +++ b/src/main/java/neqsim/physicalProperties/physicalPropertyMethods/commonPhasePhysicalProperties/conductivity/PFCTConductivityMethodMod86.java @@ -1,5 +1,6 @@ package neqsim.physicalProperties.physicalPropertyMethods.commonPhasePhysicalProperties.conductivity; +import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.system.SystemInterface; import neqsim.thermo.system.SystemSrkEos; @@ -15,7 +16,8 @@ public class PFCTConductivityMethodMod86 extends Conductivity { private static final long serialVersionUID = 1000; /** Constant referenceSystem. */ - public static SystemInterface referenceSystem = new SystemSrkEos(273.0, 1.01325); + public static SystemInterface referenceSystem = + new SystemSrkEos(273.0, ThermodynamicConstantsInterface.referencePressure); double[] GVcoef = {-2.147621e5, 2.190461e5, -8.618097e4, 1.496099e4, -4.730660e2, -2.331178e2, 3.778439e1, -2.320481, 5.311764e-2}; double condRefA = -0.25276292; @@ -167,7 +169,8 @@ public double calcConductivity() { T0 = 273.15; } - double nstarRef = getRefComponentViscosity(T0, 1.01325); + double nstarRef = + getRefComponentViscosity(T0, ThermodynamicConstantsInterface.referencePressure); double CpID = referenceSystem.getLowestGibbsEnergyPhase().getComponent(0).getCp0(T0); double Ffunc = 1.0 + 0.053432 * redDens - 0.030182 * redDens * redDens - 0.029725 * redDens * redDens * redDens; @@ -261,7 +264,8 @@ public double getRefComponentViscosity(double temp, double pres) { 4.2903609488e-2, 1.4529023444e2, 6.1276818706e3}; // double viscRefK[] = {-9.74602, 18.0834, -4126.66, 44.6055, 0.9676544, 81.8134, 15649.9}; - double molDens = 101325.0 / 8.315 / phase.getPhase().getTemperature() / 1.0e3; + double molDens = ThermodynamicConstantsInterface.atm / ThermodynamicConstantsInterface.R + / phase.getPhase().getTemperature() / 1.0e3; double critMolDens = 10.15; double redMolDens = (molDens - critMolDens) / critMolDens; double viscRefO = GVcoef[0] * Math.pow(temp, -1.0) + GVcoef[1] * Math.pow(temp, -2.0 / 3.0) @@ -319,7 +323,8 @@ public double calcMixLPViscosity() { * 1.304e-4 * (Math.pow(Mwtemp / Mmtemp, 2.303) - Math.pow(Mmtemp, 2.303))) * 1e3; * //phase.getPhase().getMolarMass(); */ - double redDens = 101325 / 8.315 / phase.getPhase().getTemperature() / 1.0e3 / 10.15; + double redDens = 101325 / ThermodynamicConstantsInterface.R / phase.getPhase().getTemperature() + / 1.0e3 / 10.15; double alfa0 = 0.0; double alfaMix = 0.0; double[] alphai = new double[phase.getPhase().getNumberOfComponents()]; @@ -339,8 +344,8 @@ public double calcMixLPViscosity() { double T0 = phase.getPhase().getTemperature() * referenceSystem.getPhase(0).getComponent(0).getTC() / TCmix * alfaMix / alfa0; - double P0 = - 1.01325 * referenceSystem.getPhase(0).getComponent(0).getPC() / PCmix * alfaMix / alfa0; + double P0 = ThermodynamicConstantsInterface.referencePressure + * referenceSystem.getPhase(0).getComponent(0).getPC() / PCmix * alfaMix / alfa0; double refVisosity = getRefComponentViscosity(T0, P0); double viscosity = refVisosity * Math.pow(TCmix / Tc0, -1.0 / 6.0) diff --git a/src/main/java/neqsim/physicalProperties/physicalPropertyMethods/commonPhasePhysicalProperties/viscosity/PFCTViscosityMethod.java b/src/main/java/neqsim/physicalProperties/physicalPropertyMethods/commonPhasePhysicalProperties/viscosity/PFCTViscosityMethod.java index 015475e32f..cbf0c6fbe9 100644 --- a/src/main/java/neqsim/physicalProperties/physicalPropertyMethods/commonPhasePhysicalProperties/viscosity/PFCTViscosityMethod.java +++ b/src/main/java/neqsim/physicalProperties/physicalPropertyMethods/commonPhasePhysicalProperties/viscosity/PFCTViscosityMethod.java @@ -6,6 +6,7 @@ package neqsim.physicalProperties.physicalPropertyMethods.commonPhasePhysicalProperties.viscosity; +import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.system.SystemInterface; import neqsim.thermo.system.SystemSrkEos; @@ -21,7 +22,8 @@ public class PFCTViscosityMethod extends Viscosity { private static final long serialVersionUID = 1000; int phaseTypeNumb = 1; - SystemInterface referenceSystem = new SystemSrkEos(273.0, 1.01325); + SystemInterface referenceSystem = + new SystemSrkEos(273.0, ThermodynamicConstantsInterface.referencePressure); double[] GVcoef = {-2.090975e5, 2.647269e5, -1.472818e5, 4.716740e4, -9.491872e3, 1.219979e3, -9.627993e1, 4.274152, -8.141531e-2}; double visRefA = 1.696985927; diff --git a/src/main/java/neqsim/physicalProperties/physicalPropertyMethods/commonPhasePhysicalProperties/viscosity/PFCTViscosityMethodHeavyOil.java b/src/main/java/neqsim/physicalProperties/physicalPropertyMethods/commonPhasePhysicalProperties/viscosity/PFCTViscosityMethodHeavyOil.java index 68fd00152a..5dac41cf77 100644 --- a/src/main/java/neqsim/physicalProperties/physicalPropertyMethods/commonPhasePhysicalProperties/viscosity/PFCTViscosityMethodHeavyOil.java +++ b/src/main/java/neqsim/physicalProperties/physicalPropertyMethods/commonPhasePhysicalProperties/viscosity/PFCTViscosityMethodHeavyOil.java @@ -1,5 +1,6 @@ package neqsim.physicalProperties.physicalPropertyMethods.commonPhasePhysicalProperties.viscosity; +import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.system.SystemInterface; import neqsim.thermo.system.SystemSrkEos; @@ -14,8 +15,10 @@ public class PFCTViscosityMethodHeavyOil extends Viscosity { private static final long serialVersionUID = 1000; - // SystemInterface referenceSystem = new SystemBWRSEos(273.15, 1.01325); - SystemInterface referenceSystem = new SystemSrkEos(273.0, 1.01325); + // SystemInterface referenceSystem = new SystemBWRSEos(273.15, + // ThermodynamicConstantsInterface.referencePressure); + SystemInterface referenceSystem = + new SystemSrkEos(273.0, ThermodynamicConstantsInterface.referencePressure); int phaseTypeNumb = 1; double[] GVcoef = {-2.090975e5, 2.647269e5, -1.472818e5, 4.716740e4, -9.491872e3, 1.219979e3, -9.627993e1, 4.274152, -8.141531e-2}; diff --git a/src/main/java/neqsim/physicalProperties/physicalPropertyMethods/commonPhasePhysicalProperties/viscosity/PFCTViscosityMethodMod86.java b/src/main/java/neqsim/physicalProperties/physicalPropertyMethods/commonPhasePhysicalProperties/viscosity/PFCTViscosityMethodMod86.java index fbee45c371..c467c76c2f 100644 --- a/src/main/java/neqsim/physicalProperties/physicalPropertyMethods/commonPhasePhysicalProperties/viscosity/PFCTViscosityMethodMod86.java +++ b/src/main/java/neqsim/physicalProperties/physicalPropertyMethods/commonPhasePhysicalProperties/viscosity/PFCTViscosityMethodMod86.java @@ -1,5 +1,6 @@ package neqsim.physicalProperties.physicalPropertyMethods.commonPhasePhysicalProperties.viscosity; +import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.system.SystemInterface; import neqsim.thermo.system.SystemSrkEos; @@ -14,8 +15,10 @@ public class PFCTViscosityMethodMod86 extends Viscosity { private static final long serialVersionUID = 1000; - // SystemInterface referenceSystem = new SystemBWRSEos(273.15, 1.01325); - SystemInterface referenceSystem = new SystemSrkEos(273.0, 1.01325); + // SystemInterface referenceSystem = new SystemBWRSEos(273.15, + // ThermodynamicConstantsInterface.referencePressure); + SystemInterface referenceSystem = + new SystemSrkEos(273.0, ThermodynamicConstantsInterface.referencePressure); int phaseTypeNumb = 1; double[] GVcoef = {-2.090975e5, 2.647269e5, -1.472818e5, 4.716740e4, -9.491872e3, 1.219979e3, -9.627993e1, 4.274152, -8.141531e-2}; diff --git a/src/main/java/neqsim/processSimulation/measurementDevice/MultiPhaseMeter.java b/src/main/java/neqsim/processSimulation/measurementDevice/MultiPhaseMeter.java index ca54cb576b..262f89b610 100644 --- a/src/main/java/neqsim/processSimulation/measurementDevice/MultiPhaseMeter.java +++ b/src/main/java/neqsim/processSimulation/measurementDevice/MultiPhaseMeter.java @@ -3,6 +3,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import neqsim.processSimulation.processEquipment.stream.StreamInterface; +import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.system.SystemInterface; import neqsim.thermodynamicOperations.ThermodynamicOperations; @@ -231,7 +232,7 @@ public double getMeasuredValue(String measurement, String unit) { } else if (measurement.equals("GOR_std")) { SystemInterface tempFluid = stream.getThermoSystem().clone(); tempFluid.setTemperature(15.0, "C"); - tempFluid.setPressure(1.01325, "bara"); + tempFluid.setPressure(ThermodynamicConstantsInterface.referencePressure, "bara"); ThermodynamicOperations thermoOps = new ThermodynamicOperations(tempFluid); try { thermoOps.TPflash(); diff --git a/src/main/java/neqsim/processSimulation/measurementDevice/VolumeFlowTransmitter.java b/src/main/java/neqsim/processSimulation/measurementDevice/VolumeFlowTransmitter.java index aabd8a74b5..2a3f952456 100644 --- a/src/main/java/neqsim/processSimulation/measurementDevice/VolumeFlowTransmitter.java +++ b/src/main/java/neqsim/processSimulation/measurementDevice/VolumeFlowTransmitter.java @@ -1,6 +1,7 @@ package neqsim.processSimulation.measurementDevice; import neqsim.processSimulation.processEquipment.stream.StreamInterface; +import neqsim.thermo.ThermodynamicConstantsInterface; /** *

@@ -58,13 +59,13 @@ public double getMeasuredValue(String unit) { } else if (unit.equals("Nm^3/day")) { return stream.getThermoSystem().getPhase(measuredPhaseNumber).getNumberOfMolesInPhase() * neqsim.thermo.ThermodynamicConstantsInterface.R - * neqsim.thermo.ThermodynamicConstantsInterface.normalStateTemperature / 101325.0 * 3600.0 - * 24; + * neqsim.thermo.ThermodynamicConstantsInterface.normalStateTemperature + / ThermodynamicConstantsInterface.atm * 3600.0 * 24; } else if (unit.equals("Sm^3/day")) { return stream.getThermoSystem().getPhase(measuredPhaseNumber).getNumberOfMolesInPhase() * neqsim.thermo.ThermodynamicConstantsInterface.R - * neqsim.thermo.ThermodynamicConstantsInterface.standardStateTemperature / 101325.0 - * 3600.0 * 24; + * neqsim.thermo.ThermodynamicConstantsInterface.standardStateTemperature + / ThermodynamicConstantsInterface.atm * 3600.0 * 24; } else { return stream.getThermoSystem().getPhase(measuredPhaseNumber).getNumberOfMolesInPhase() * stream.getThermoSystem().getPhase(measuredPhaseNumber).getMolarMass() / stream diff --git a/src/main/java/neqsim/processSimulation/measurementDevice/simpleFlowRegime/SevereSlugAnalyser.java b/src/main/java/neqsim/processSimulation/measurementDevice/simpleFlowRegime/SevereSlugAnalyser.java index 2e4a89e358..7e435f2751 100644 --- a/src/main/java/neqsim/processSimulation/measurementDevice/simpleFlowRegime/SevereSlugAnalyser.java +++ b/src/main/java/neqsim/processSimulation/measurementDevice/simpleFlowRegime/SevereSlugAnalyser.java @@ -6,6 +6,7 @@ import org.apache.logging.log4j.Logger; import neqsim.processSimulation.measurementDevice.MeasurementDeviceBaseClass; import neqsim.processSimulation.processEquipment.stream.Stream; +import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.system.SystemInterface; import neqsim.thermodynamicOperations.ThermodynamicOperations; @@ -368,7 +369,7 @@ public double getSimulationTime() { * @return a double */ public double gasConst(FluidSevereSlug fluid) { - return 8.314 / fluid.getMolecularWeight() * (273.15 + temperature); + return ThermodynamicConstantsInterface.R / fluid.getMolecularWeight() * (273.15 + temperature); } // Declare the variables for resuts after creating an object Severe slug with required number of diff --git a/src/main/java/neqsim/processSimulation/processEquipment/compressor/Compressor.java b/src/main/java/neqsim/processSimulation/processEquipment/compressor/Compressor.java index 932014083e..f7c9517964 100644 --- a/src/main/java/neqsim/processSimulation/processEquipment/compressor/Compressor.java +++ b/src/main/java/neqsim/processSimulation/processEquipment/compressor/Compressor.java @@ -473,9 +473,11 @@ public void run(UUID id) { polytropicFluidHead = polytropicHead; polytropicHeadMeter = polytropicHead * 1000.0 / 9.81; } - double pressureRatio = Math.pow((polytropicFluidHead * 1000.0 - + (n / (n - 1.0) * z_inlet * 8.314 * (temperature_inlet) / MW)) - / (n / (n - 1.0) * z_inlet * 8.314 * (temperature_inlet) / MW), n / (n - 1.0)); + double pressureRatio = Math.pow((polytropicFluidHead * 1000.0 + (n / (n - 1.0) * z_inlet + * ThermodynamicConstantsInterface.R * (temperature_inlet) / MW)) + / (n / (n - 1.0) * z_inlet * ThermodynamicConstantsInterface.R * (temperature_inlet) + / MW), + n / (n - 1.0)); setOutletPressure(thermoSystem.getPressure() * pressureRatio); if (getAntiSurge().isActive()) { logger.info("surge flow " diff --git a/src/main/java/neqsim/processSimulation/processEquipment/powerGeneration/GasTurbine.java b/src/main/java/neqsim/processSimulation/processEquipment/powerGeneration/GasTurbine.java index a15f6d7f7f..acdeb58da1 100644 --- a/src/main/java/neqsim/processSimulation/processEquipment/powerGeneration/GasTurbine.java +++ b/src/main/java/neqsim/processSimulation/processEquipment/powerGeneration/GasTurbine.java @@ -11,6 +11,7 @@ import neqsim.processSimulation.processEquipment.heatExchanger.Heater; import neqsim.processSimulation.processEquipment.stream.Stream; import neqsim.processSimulation.processEquipment.stream.StreamInterface; +import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.system.SystemInterface; /** @@ -59,7 +60,7 @@ public GasTurbine(String name) { airThermoSystem.createDatabase(true); // airThermoSystem.display(); airStream = new Stream("airStream", airThermoSystem); - airStream.setPressure(1.01325); + airStream.setPressure(ThermodynamicConstantsInterface.referencePressure); airStream.setTemperature(288.15, "K"); airCompressor = new Compressor("airCompressor", airStream); } @@ -146,7 +147,7 @@ public void setInletStream(StreamInterface inletStream) { public void run(UUID id) { thermoSystem = inStream.getThermoSystem().clone(); airStream.setFlowRate(thermoSystem.getFlowRate("mole/sec") * airGasRatio, "mole/sec"); - airStream.setPressure(1.01325); + airStream.setPressure(ThermodynamicConstantsInterface.referencePressure); airStream.run(id); airCompressor.setInletStream(airStream); @@ -181,7 +182,7 @@ public void run(UUID id) { locHeater.displayResult(); Expander expander = new Expander("expander", locHeater.getOutletStream()); - expander.setOutletPressure(1.01325); + expander.setOutletPressure(ThermodynamicConstantsInterface.referencePressure); expander.run(id); Cooler cooler1 = new Cooler("cooler1", expander.getOutletStream()); @@ -196,12 +197,10 @@ public void run(UUID id) { } /** - * - * *

- * Calculates ideal air fuel ratio [kg air/kg fuel] + * Calculates ideal air fuel ratio [kg air/kg fuel]. *

- * + * * @return ideal air fuel ratio [kg air/kg fuel] */ public double calcIdealAirFuelRatio() { diff --git a/src/main/java/neqsim/processSimulation/processEquipment/reservoir/SimpleReservoir.java b/src/main/java/neqsim/processSimulation/processEquipment/reservoir/SimpleReservoir.java index 66048d4bb9..0498b5b9b5 100644 --- a/src/main/java/neqsim/processSimulation/processEquipment/reservoir/SimpleReservoir.java +++ b/src/main/java/neqsim/processSimulation/processEquipment/reservoir/SimpleReservoir.java @@ -12,6 +12,7 @@ import neqsim.processSimulation.processEquipment.pipeline.AdiabaticTwoPhasePipe; import neqsim.processSimulation.processEquipment.stream.Stream; import neqsim.processSimulation.processEquipment.stream.StreamInterface; +import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.system.SystemInterface; import neqsim.thermodynamicOperations.ThermodynamicOperations; @@ -190,7 +191,7 @@ public StreamInterface addGasInjector(String name) { public double getGasInPlace(String unit) { SystemInterface locStream = (thermoSystem).clone(); locStream.setTemperature(288.15); - locStream.setPressure(1.01325); + locStream.setPressure(ThermodynamicConstantsInterface.referencePressure); ThermodynamicOperations ops = new ThermodynamicOperations(locStream); ops.TPflash(); locStream.initProperties(); @@ -215,7 +216,7 @@ public double getGasInPlace(String unit) { public double getOilInPlace(String unit) { SystemInterface locStream = (thermoSystem).clone(); locStream.setTemperature(288.15); - locStream.setPressure(1.01325); + locStream.setPressure(ThermodynamicConstantsInterface.referencePressure); ThermodynamicOperations ops = new ThermodynamicOperations(locStream); ops.TPflash(); locStream.initProperties(); diff --git a/src/main/java/neqsim/processSimulation/processEquipment/reservoir/Well.java b/src/main/java/neqsim/processSimulation/processEquipment/reservoir/Well.java index a1fadae858..23a707b52a 100644 --- a/src/main/java/neqsim/processSimulation/processEquipment/reservoir/Well.java +++ b/src/main/java/neqsim/processSimulation/processEquipment/reservoir/Well.java @@ -1,6 +1,7 @@ package neqsim.processSimulation.processEquipment.reservoir; import neqsim.processSimulation.processEquipment.stream.StreamInterface; +import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.system.SystemInterface; import neqsim.thermodynamicOperations.ThermodynamicOperations; import neqsim.util.NamedBaseClass; @@ -74,7 +75,7 @@ public void setStream(StreamInterface stream) { public double getGOR() { SystemInterface locStream = (stream.getFluid()).clone(); locStream.setTemperature(288.15); - locStream.setPressure(1.01325); + locStream.setPressure(ThermodynamicConstantsInterface.referencePressure); ThermodynamicOperations ops = new ThermodynamicOperations(locStream); ops.TPflash(); double GOR = Double.NaN; @@ -94,7 +95,7 @@ public double getGOR() { public double getStdGasProduction() { SystemInterface locStream = (stream.getFluid()).clone(); locStream.setTemperature(288.15); - locStream.setPressure(1.01325); + locStream.setPressure(ThermodynamicConstantsInterface.referencePressure); ThermodynamicOperations ops = new ThermodynamicOperations(locStream); ops.TPflash(); double volume = 0; @@ -114,7 +115,7 @@ public double getStdGasProduction() { public double getStdOilProduction() { SystemInterface locStream = (stream.getFluid()).clone(); locStream.setTemperature(288.15); - locStream.setPressure(1.01325); + locStream.setPressure(ThermodynamicConstantsInterface.referencePressure); ThermodynamicOperations ops = new ThermodynamicOperations(locStream); ops.TPflash(); double volume = 0; @@ -134,7 +135,7 @@ public double getStdOilProduction() { public double getStdWaterProduction() { SystemInterface locStream = (stream.getFluid()).clone(); locStream.setTemperature(288.15); - locStream.setPressure(1.01325); + locStream.setPressure(ThermodynamicConstantsInterface.referencePressure); ThermodynamicOperations ops = new ThermodynamicOperations(locStream); ops.TPflash(); double volume = 0; diff --git a/src/main/java/neqsim/processSimulation/processEquipment/util/GORfitter.java b/src/main/java/neqsim/processSimulation/processEquipment/util/GORfitter.java index 19b1f9f757..a1e971a96d 100644 --- a/src/main/java/neqsim/processSimulation/processEquipment/util/GORfitter.java +++ b/src/main/java/neqsim/processSimulation/processEquipment/util/GORfitter.java @@ -5,6 +5,7 @@ import org.apache.logging.log4j.Logger; import neqsim.processSimulation.processEquipment.TwoPortEquipment; import neqsim.processSimulation.processEquipment.stream.StreamInterface; +import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.system.SystemInterface; import neqsim.thermodynamicOperations.ThermodynamicOperations; @@ -20,7 +21,7 @@ public class GORfitter extends TwoPortEquipment { private static final long serialVersionUID = 1000; static Logger logger = LogManager.getLogger(GORfitter.class); - double pressure = 1.01325; + double pressure = ThermodynamicConstantsInterface.referencePressure; double temperature = 15.0; private String referenceConditions = "standard"; // "actual"; private boolean fitAsGVF = false; @@ -164,7 +165,7 @@ public void run(UUID id) { } if (!getReferenceConditions().equals("actual")) { tempFluid.setTemperature(15.0, "C"); - tempFluid.setPressure(1.01325, "bara"); + tempFluid.setPressure(ThermodynamicConstantsInterface.referencePressure, "bara"); } ThermodynamicOperations thermoOps = new ThermodynamicOperations(tempFluid); try { diff --git a/src/main/java/neqsim/processSimulation/processSystem/processModules/AdsorptionDehydrationlModule.java b/src/main/java/neqsim/processSimulation/processSystem/processModules/AdsorptionDehydrationlModule.java index 7fedfd4322..dc0518bfbe 100644 --- a/src/main/java/neqsim/processSimulation/processSystem/processModules/AdsorptionDehydrationlModule.java +++ b/src/main/java/neqsim/processSimulation/processSystem/processModules/AdsorptionDehydrationlModule.java @@ -9,6 +9,7 @@ import neqsim.processSimulation.processEquipment.stream.Stream; import neqsim.processSimulation.processEquipment.stream.StreamInterface; import neqsim.processSimulation.processSystem.ProcessModuleBaseClass; +import neqsim.thermo.ThermodynamicConstantsInterface; /** *

@@ -160,7 +161,8 @@ public void calcDesign() { double gasVelocity = 67.0 / Math.sqrt(gasDensity); double qa = designFlow / (numberOfAdsorptionBeds - 1.0) / 1440.0 - * (1.01325 / designAdsorptionPressure) * (designAdsorptionTemperature / 288.15) + * (ThermodynamicConstantsInterface.referencePressure / designAdsorptionPressure) + * (designAdsorptionTemperature / 288.15) * tempStream.getThermoSystem().getPhase(0).getZ(); adsorberInternalDiameter = Math.sqrt(4.0 * qa / Math.PI / gasVelocity); diff --git a/src/main/java/neqsim/processSimulation/processSystem/processModules/SeparationTrainModule.java b/src/main/java/neqsim/processSimulation/processSystem/processModules/SeparationTrainModule.java index 5ff7a28849..db3b13941a 100644 --- a/src/main/java/neqsim/processSimulation/processSystem/processModules/SeparationTrainModule.java +++ b/src/main/java/neqsim/processSimulation/processSystem/processModules/SeparationTrainModule.java @@ -342,8 +342,9 @@ public static void main(String[] args) { * getPhase(0).getPhysicalProperties().getDensity() * 3600.0 + " m^3/hr"); * System.out.println("Export gas flow " + * separationModule.getOutputStream("gas exit stream").getThermoSystem(). - * getTotalNumberOfMoles() * 8.314 * (273.15 + 15.0) / 101325.0 * 3600.0 * 24 / 1.0e6 + - * " MSm^3/day"); System.out.println("oil/water heater duty " + ((Heater) + * getTotalNumberOfMoles() * ThermodynamicConstantsInterface.R * (273.15 + 15.0) + * /ThermodynamicConstantsInterface.atm * 3600.0 * 24 / 1.0e6 + " MSm^3/day"); + * System.out.println("oil/water heater duty " + ((Heater) * separationModule.getOperations().getUnit("oil/water heater")).getEnergyInput( ) + " W"); * System.out.println("Export oil cooler duty " + ((Cooler) * separationModule.getOperations().getUnit("export oil cooler")).getEnergyInput () + " W"); diff --git a/src/main/java/neqsim/processSimulation/processSystem/processModules/SeparationTrainModuleSimple.java b/src/main/java/neqsim/processSimulation/processSystem/processModules/SeparationTrainModuleSimple.java index 40e1594961..49ee75b16e 100644 --- a/src/main/java/neqsim/processSimulation/processSystem/processModules/SeparationTrainModuleSimple.java +++ b/src/main/java/neqsim/processSimulation/processSystem/processModules/SeparationTrainModuleSimple.java @@ -301,16 +301,17 @@ public static void main(String[] args) { ((ProcessEquipmentInterface) separationModule.getOperations().getUnit("2nd stage recompressor")) .getMechanicalDesign().displayResults(); - //operations.getSystemMechanicalDesign().runDesignCalculation(); - //operations.getSystemMechanicalDesign().getTotalPlotSpace(); - //System.out.println("Modules " + operations.getSystemMechanicalDesign().getTotalVolume()); - - //System.out - // .println("Modules " + operations.getSystemMechanicalDesign().getTotalNumberOfModules()); - //System.out.println("Weight " + operations.getSystemMechanicalDesign().getTotalWeight()); - //System.out.println("Plot space " + operations.getSystemMechanicalDesign().getTotalPlotSpace()); - //System.out.println("CAPEX " + operations.getCostEstimator().getWeightBasedCAPEXEstimate()); - //System.out.println("CAPEX " + operations.getCostEstimator().getCAPEXestimate()); + // operations.getSystemMechanicalDesign().runDesignCalculation(); + // operations.getSystemMechanicalDesign().getTotalPlotSpace(); + // System.out.println("Modules " + operations.getSystemMechanicalDesign().getTotalVolume()); + + // System.out + // .println("Modules " + operations.getSystemMechanicalDesign().getTotalNumberOfModules()); + // System.out.println("Weight " + operations.getSystemMechanicalDesign().getTotalWeight()); + // System.out.println("Plot space " + + // operations.getSystemMechanicalDesign().getTotalPlotSpace()); + // System.out.println("CAPEX " + operations.getCostEstimator().getWeightBasedCAPEXEstimate()); + // System.out.println("CAPEX " + operations.getCostEstimator().getCAPEXestimate()); /* * separationModule.getOutputStream("Inlet separator").displayResult(); @@ -337,8 +338,9 @@ public static void main(String[] args) { * getPhase(0).getPhysicalProperties().getDensity() * 3600.0 + " m^3/hr"); * System.out.println("Export gas flow " + * separationModule.getOutputStream("gas exit stream").getThermoSystem(). - * getTotalNumberOfMoles() * 8.314 * (273.15 + 15.0) / 101325.0 * 3600.0 * 24 / 1.0e6 + - * " MSm^3/day"); System.out.println("oil/water heater duty " + ((Heater) + * getTotalNumberOfMoles() * ThermodynamicConstantsInterface.R * (273.15 + 15.0) + * /ThermodynamicConstantsInterface.atm * 3600.0 * 24 / 1.0e6 + " MSm^3/day"); + * System.out.println("oil/water heater duty " + ((Heater) * separationModule.getOperations().getUnit("oil/water heater")).getEnergyInput( ) + " W"); * System.out.println("Export oil cooler duty " + ((Cooler) * separationModule.getOperations().getUnit("export oil cooler")).getEnergyInput () + " W"); diff --git a/src/main/java/neqsim/processSimulation/processSystem/processModules/WellFluidModule.java b/src/main/java/neqsim/processSimulation/processSystem/processModules/WellFluidModule.java index a0bf071118..b0d3c4ac59 100644 --- a/src/main/java/neqsim/processSimulation/processSystem/processModules/WellFluidModule.java +++ b/src/main/java/neqsim/processSimulation/processSystem/processModules/WellFluidModule.java @@ -10,6 +10,7 @@ import neqsim.processSimulation.processEquipment.stream.StreamInterface; import neqsim.processSimulation.processEquipment.valve.ThrottlingValve; import neqsim.processSimulation.processSystem.ProcessModuleBaseClass; +import neqsim.thermo.ThermodynamicConstantsInterface; /** *

@@ -32,7 +33,7 @@ public class WellFluidModule extends ProcessModuleBaseClass { double gasfactor = 0.1; - double thirdstagePressure = 1.01325; + double thirdstagePressure = ThermodynamicConstantsInterface.referencePressure; double separationTemperature = 273.15 + 15; double exitGasScrubberTemperature = 273.15 + 30; double firstStageCompressorAfterCoolerTemperature = 273.15 + 30; @@ -243,7 +244,8 @@ public static void main(String[] args) { separationModule.addInputStream("feed stream", wellStream); separationModule.setSpecification("Second stage pressure", 15.0); separationModule.setSpecification("separation temperature", 273.15 + 15.0); - separationModule.setSpecification("Third stage pressure", 1.01325); + separationModule.setSpecification("Third stage pressure", + ThermodynamicConstantsInterface.referencePressure); neqsim.processSimulation.processSystem.ProcessSystem operations = new neqsim.processSimulation.processSystem.ProcessSystem(); diff --git a/src/main/java/neqsim/standards/gasQuality/Standard_ISO6976.java b/src/main/java/neqsim/standards/gasQuality/Standard_ISO6976.java index 87416a6a6f..6df5c9019d 100644 --- a/src/main/java/neqsim/standards/gasQuality/Standard_ISO6976.java +++ b/src/main/java/neqsim/standards/gasQuality/Standard_ISO6976.java @@ -5,6 +5,7 @@ import java.util.ArrayList; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.system.SystemInterface; /** @@ -23,12 +24,13 @@ public class Standard_ISO6976 extends neqsim.standards.Standard // metering conditions ArrayList componentsNotDefinedByStandard = new ArrayList(); double volRefT = 0; - double volRefP = 1.01325; + double volRefP = ThermodynamicConstantsInterface.referencePressure; + // ThermodynamicConstantsInterface.R double R = 8.314510; double molRefm3 = 0.0; // combustion conditions double energyRefT = 25; - double energyRefP = 1.01325; + double energyRefP = ThermodynamicConstantsInterface.referencePressure; String referenceType = "volume"; // mass volume molar String energyUnit = "KJ/Nm3"; double energy = 1.0; diff --git a/src/main/java/neqsim/standards/gasQuality/Standard_ISO6976_2016.java b/src/main/java/neqsim/standards/gasQuality/Standard_ISO6976_2016.java index cc08ce87aa..3ea25ac64c 100644 --- a/src/main/java/neqsim/standards/gasQuality/Standard_ISO6976_2016.java +++ b/src/main/java/neqsim/standards/gasQuality/Standard_ISO6976_2016.java @@ -18,6 +18,7 @@ public class Standard_ISO6976_2016 extends Standard_ISO6976 { // metering conditions + // ThermodynamicConstantsInterface.R double R = 8.3144621; double Zmix0 = 1.0; diff --git a/src/main/java/neqsim/standards/oilQuality/Standard_ASTM_D6377.java b/src/main/java/neqsim/standards/oilQuality/Standard_ASTM_D6377.java index 7d152a880f..f7b39c235c 100644 --- a/src/main/java/neqsim/standards/oilQuality/Standard_ASTM_D6377.java +++ b/src/main/java/neqsim/standards/oilQuality/Standard_ASTM_D6377.java @@ -2,6 +2,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.system.SystemInterface; import neqsim.thermo.system.SystemSrkEos; import neqsim.thermodynamicOperations.ThermodynamicOperations; @@ -36,7 +37,7 @@ public Standard_ASTM_D6377(SystemInterface thermoSystem) { @Override public void calculate() { this.thermoSystem.setTemperature(273.15 + 37.8); - this.thermoSystem.setPressure(1.01325); + this.thermoSystem.setPressure(ThermodynamicConstantsInterface.referencePressure); this.thermoOps = new ThermodynamicOperations(thermoSystem); try { this.thermoOps.bubblePointPressureFlash(false); diff --git a/src/main/java/neqsim/statistics/experimentalSampleCreation/sampleCreator/wettedWallColumnSampleCreator/WettedWallColumnSampleCreator.java b/src/main/java/neqsim/statistics/experimentalSampleCreation/sampleCreator/wettedWallColumnSampleCreator/WettedWallColumnSampleCreator.java index 8184637dad..6c6b69cacc 100644 --- a/src/main/java/neqsim/statistics/experimentalSampleCreation/sampleCreator/wettedWallColumnSampleCreator/WettedWallColumnSampleCreator.java +++ b/src/main/java/neqsim/statistics/experimentalSampleCreation/sampleCreator/wettedWallColumnSampleCreator/WettedWallColumnSampleCreator.java @@ -13,6 +13,7 @@ import neqsim.statistics.experimentalSampleCreation.readDataFromFile.wettedWallColumnReader.WettedWallColumnDataObject; import neqsim.statistics.experimentalSampleCreation.readDataFromFile.wettedWallColumnReader.WettedWallDataReader; import neqsim.statistics.experimentalSampleCreation.sampleCreator.SampleCreator; +import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.system.SystemInterface; import neqsim.thermo.system.SystemSrkEos; @@ -189,7 +190,8 @@ public void calcdPdt() { dNdt[i] = dPdt[i] * 1.0 / dPdn[i]; err += Math.abs((dNdtOld[i] - dNdt[i])); // System.out.println("dndt: " + dNdt[i]); - dnVdt[i] = dNdt[i] * 8.314 * 298.15 / 101325.0 * 1000 * 60; + dnVdt[i] = dNdt[i] * ThermodynamicConstantsInterface.R * 298.15 + / ThermodynamicConstantsInterface.atm * 1000 * 60; System.out.println("dVdt: " + dnVdt[i]); } System.out.println("err: " + err); diff --git a/src/main/java/neqsim/thermo/characterization/TBPfractionModel.java b/src/main/java/neqsim/thermo/characterization/TBPfractionModel.java index b5d526a9d7..582de57f78 100644 --- a/src/main/java/neqsim/thermo/characterization/TBPfractionModel.java +++ b/src/main/java/neqsim/thermo/characterization/TBPfractionModel.java @@ -2,6 +2,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.system.SystemInterface; /** @@ -55,7 +56,7 @@ public double calcAcentricFactorKeslerLee(double molarMass, double density) { double TB = calcTB(molarMass, density); double PC = calcPC(molarMass, density); double TBR = TB / TC; - double PBR = 1.01325 / PC; + double PBR = ThermodynamicConstantsInterface.referencePressure / PC; if (TBR < 0.8) { return (Math.log(PBR) - 5.92714 + 6.09649 / TBR + 1.28862 * Math.log(TBR) - 0.169347 * Math.pow(TBR, 6.0)) @@ -72,7 +73,8 @@ public double calcAcentricFactor(double molarMass, double density) { double TC = calcTC(molarMass, density); double TB = calcTB(molarMass, density); double PC = calcPC(molarMass, density); - return 3.0 / 7.0 * Math.log10(PC / 1.01325) / (TC / TB - 1.0) - 1.0; + return 3.0 / 7.0 * Math.log10(PC / ThermodynamicConstantsInterface.referencePressure) + / (TC / TB - 1.0) - 1.0; } @Override @@ -80,10 +82,11 @@ public double calcCriticalVolume(double molarMass, double density) { double TC = calcTC(molarMass, density); double PC = calcPC(molarMass, density); double acs = calcAcentricFactor(molarMass, density); // thermoSystem.getPhase(thermoSystem.getPhaseIndex(0)).getComponent(0).getAcentricFactor(); - double criticaVol = (0.2918 - 0.0928 * acs) * 8.314 * TC / PC * 10.0; + double criticaVol = + (0.2918 - 0.0928 * acs) * ThermodynamicConstantsInterface.R * TC / PC * 10.0; if (criticaVol < 0) { // logger.info("acentric factor in calc critVol " + acs); - criticaVol = (0.2918 - 0.0928) * 8.314 * TC / PC * 10.0; + criticaVol = (0.2918 - 0.0928) * ThermodynamicConstantsInterface.R * TC / PC * 10.0; } return criticaVol; } @@ -278,7 +281,8 @@ public double calcAcentricFactor2(double molarMass, double density) { double TC = calcTC(molarMass, density); double TB = calcTB(molarMass, density); double PC = calcPC(molarMass, density); - return 3.0 / 7.0 * Math.log10(PC / 1.01325) / (TC / TB - 1.0) - 1.0; + return 3.0 / 7.0 * Math.log10(PC / ThermodynamicConstantsInterface.referencePressure) + / (TC / TB - 1.0) - 1.0; } @Override @@ -295,7 +299,7 @@ public double calcAcentricFactor(double molarMass, double density) { double TB = calcTB(molarMass, density); double PC = calcPC(molarMass, density); double TBR = TB / TC; - double PBR = 1.01325 / PC; + double PBR = ThermodynamicConstantsInterface.referencePressure / PC; if (TBR < 0.8) { return (Math.log(PBR) - 5.92714 + 6.09649 / TBR + 1.28862 * Math.log(TBR) - 0.169347 * Math.pow(TBR, 6.0)) diff --git a/src/main/java/neqsim/thermo/component/ComponentHydrate.java b/src/main/java/neqsim/thermo/component/ComponentHydrate.java index 0ce2f812f2..edce0b0290 100644 --- a/src/main/java/neqsim/thermo/component/ComponentHydrate.java +++ b/src/main/java/neqsim/thermo/component/ComponentHydrate.java @@ -2,6 +2,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.phase.PhaseInterface; import neqsim.util.database.NeqSimDataBase; @@ -225,7 +226,8 @@ public double getEmptyHydrateStructureVapourPressure(int type, double temperatur return getSolidVaporPressure(temperature); } else { return Math.exp(getEmptyHydrateVapourPressureConstant(type, 0) - + getEmptyHydrateVapourPressureConstant(type, 1) / temperature) * 1.01325; + + getEmptyHydrateVapourPressureConstant(type, 1) / temperature) + * ThermodynamicConstantsInterface.referencePressure; } } @@ -684,17 +686,20 @@ public void setSolidRefFluidPhase(PhaseInterface phase) { // Math.exp(par1_struc1*Math.log(temperature)+par2_struc1/temperature+par3_struc1+par4_struc1*temperature)/1.0e5; // } // if(type==1){ - // return Math.exp(par1_struc2+par2_struc2/temperature)*1.01325; + // return + // Math.exp(par1_struc2+par2_struc2/temperature)*ThermodynamicConstantsInterface.referencePressure; // } else return 0.0; // } // public double getEmptyHydrateStructureVapourPressure(int type, double // temperature){ // if(type==0){ - // return Math.exp(par1_struc1+par2_struc1/temperature)*1.01325; + // return + // Math.exp(par1_struc1+par2_struc1/temperature)*ThermodynamicConstantsInterface.referencePressure; // } // if(type==1){ - // return Math.exp(par1_struc2+par2_struc2/temperature)*1.01325; + // return + // Math.exp(par1_struc2+par2_struc2/temperature)*ThermodynamicConstantsInterface.referencePressure; // } else return 0.0; // } diff --git a/src/main/java/neqsim/thermo/component/ComponentHydrateKluda.java b/src/main/java/neqsim/thermo/component/ComponentHydrateKluda.java index 4cd86beda9..d370eba4e3 100644 --- a/src/main/java/neqsim/thermo/component/ComponentHydrateKluda.java +++ b/src/main/java/neqsim/thermo/component/ComponentHydrateKluda.java @@ -2,6 +2,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.phase.PhaseInterface; /** @@ -178,7 +179,8 @@ public double getEmptyHydrateStructureVapourPressure(int type, double temperatur + par4_struc1 * temperature) / 1.0e5; } if (type == 1) { - return Math.exp(par1_struc2 + par2_struc2 / temperature) * 1.01325; + return Math.exp(par1_struc2 + par2_struc2 / temperature) + * ThermodynamicConstantsInterface.referencePressure; } else { return 0.0; } diff --git a/src/main/java/neqsim/thermo/phase/Phase.java b/src/main/java/neqsim/thermo/phase/Phase.java index 343df83218..1b486e29b0 100644 --- a/src/main/java/neqsim/thermo/phase/Phase.java +++ b/src/main/java/neqsim/thermo/phase/Phase.java @@ -677,7 +677,7 @@ public void setComponentArray(ComponentInterface[] components) { /** {@inheritDoc} */ @Override public double calcR() { - double R = 8.314 / getMolarMass(); + double R = ThermodynamicConstantsInterface.R / getMolarMass(); return R; } @@ -2159,16 +2159,20 @@ public double getFlowRate(String flowunit) { return numberOfMolesInPhase * 3600.0; } else if (flowunit.equals("Sm3/sec")) { return numberOfMolesInPhase * ThermodynamicConstantsInterface.R - * ThermodynamicConstantsInterface.standardStateTemperature / 101325.0; + * ThermodynamicConstantsInterface.standardStateTemperature + / ThermodynamicConstantsInterface.atm; } else if (flowunit.equals("Sm3/hr")) { return numberOfMolesInPhase * 3600.0 * ThermodynamicConstantsInterface.R - * ThermodynamicConstantsInterface.standardStateTemperature / 101325.0; + * ThermodynamicConstantsInterface.standardStateTemperature + / ThermodynamicConstantsInterface.atm; } else if (flowunit.equals("Sm3/day")) { return numberOfMolesInPhase * 3600.0 * 24.0 * ThermodynamicConstantsInterface.R - * ThermodynamicConstantsInterface.standardStateTemperature / 101325.0; + * ThermodynamicConstantsInterface.standardStateTemperature + / ThermodynamicConstantsInterface.atm; } else if (flowunit.equals("MSm3/day")) { return numberOfMolesInPhase * 3600.0 * 24.0 * ThermodynamicConstantsInterface.R - * ThermodynamicConstantsInterface.standardStateTemperature / 101325.0 / 1.0e6; + * ThermodynamicConstantsInterface.standardStateTemperature + / ThermodynamicConstantsInterface.atm / 1.0e6; } else { throw new RuntimeException("failed.. unit: " + flowunit + " not supported"); } diff --git a/src/main/java/neqsim/thermo/phase/PhaseGE.java b/src/main/java/neqsim/thermo/phase/PhaseGE.java index c11a2b4dbe..f22a0953b2 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseGE.java +++ b/src/main/java/neqsim/thermo/phase/PhaseGE.java @@ -293,7 +293,8 @@ public double getCv() { /** {@inheritDoc} */ @Override public double getZ() { - double densityIdealGas = pressure * 1e5 / 8.314 / temperature * getMolarMass(); + double densityIdealGas = + pressure * 1e5 / ThermodynamicConstantsInterface.R / temperature * getMolarMass(); return densityIdealGas / getDensity("kg/m3"); } diff --git a/src/main/java/neqsim/thermo/phase/PhaseGERG2004Eos.java b/src/main/java/neqsim/thermo/phase/PhaseGERG2004Eos.java index 30bdedd5e2..eed3fb75b2 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseGERG2004Eos.java +++ b/src/main/java/neqsim/thermo/phase/PhaseGERG2004Eos.java @@ -1,5 +1,6 @@ package neqsim.thermo.phase; +import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.component.ComponentGERG2004; import neqsim.thermo.util.JNI.GERG2004EOS; @@ -187,16 +188,17 @@ public double getCv() { public double molarVolume(double pressure, double temperature, double A, double B, int phase) throws neqsim.util.exception.IsNaNException, neqsim.util.exception.TooManyIterationsException { - double temp = - GERG2004EOS.ZOTPX(temperature, pressure / 10.0, xFracGERG[0], xFracGERG[1], xFracGERG[2], - xFracGERG[3], xFracGERG[4], xFracGERG[5], xFracGERG[6], xFracGERG[7], xFracGERG[8], - xFracGERG[9], xFracGERG[10], xFracGERG[11], xFracGERG[12], xFracGERG[13], xFracGERG[14], - xFracGERG[15], xFracGERG[16], xFracGERG[17], IPHASE) * 8.314 * temperature / (pressure); + double temp = GERG2004EOS.ZOTPX(temperature, pressure / 10.0, xFracGERG[0], xFracGERG[1], + xFracGERG[2], xFracGERG[3], xFracGERG[4], xFracGERG[5], xFracGERG[6], xFracGERG[7], + xFracGERG[8], xFracGERG[9], xFracGERG[10], xFracGERG[11], xFracGERG[12], xFracGERG[13], + xFracGERG[14], xFracGERG[15], xFracGERG[16], xFracGERG[17], IPHASE) + * ThermodynamicConstantsInterface.R * temperature / (pressure); temp = GERG2004EOS.ZOTPX(temperature, pressure / 10.0, xFracGERG[0], xFracGERG[1], xFracGERG[2], xFracGERG[3], xFracGERG[4], xFracGERG[5], xFracGERG[6], xFracGERG[7], xFracGERG[8], xFracGERG[9], xFracGERG[10], xFracGERG[11], xFracGERG[12], xFracGERG[13], xFracGERG[14], - xFracGERG[15], xFracGERG[16], xFracGERG[17], IPHASE) * 8.314 * temperature / (pressure); + xFracGERG[15], xFracGERG[16], xFracGERG[17], IPHASE) * ThermodynamicConstantsInterface.R + * temperature / (pressure); okVolume = !(Math.abs(2222 + temp) < 0.1 || Math.abs(1111 + temp) < 0.1); return temp; } diff --git a/src/main/java/neqsim/thermo/phase/PhaseInterface.java b/src/main/java/neqsim/thermo/phase/PhaseInterface.java index 34833aedff..ba7afc9f67 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseInterface.java +++ b/src/main/java/neqsim/thermo/phase/PhaseInterface.java @@ -24,10 +24,10 @@ public interface PhaseInterface extends ThermodynamicConstantsInterface, Cloneab * addcomponent. *

* - * @param name Name of component. - * @param moles a double + * @param name Name of component. + * @param moles a double * @param molesInPhase a double - * @param compNumber a int + * @param compNumber a int */ public void addComponent(String name, double moles, double molesInPhase, int compNumber); @@ -36,10 +36,10 @@ public interface PhaseInterface extends ThermodynamicConstantsInterface, Cloneab * addcomponent. *

* - * @param name Name of component. - * @param moles a double + * @param name Name of component. + * @param moles a double * @param molesInPhase a double - * @param compNumber a int + * @param compNumber a int * @deprecated Replaced by {@link addComponent} */ @Deprecated @@ -67,12 +67,10 @@ public default void addcomponent(String name, double moles, double molesInPhase, /** *

- * Returns the composition vector in unit - * molefraction/wtfraction/molespersec/volumefraction. + * Returns the composition vector in unit molefraction/wtfraction/molespersec/volumefraction. *

* - * @param unit Supported units are molefraction, wtfraction, molespersec, - * volumefraction + * @param unit Supported units are molefraction, wtfraction, molespersec, volumefraction * @return composition array with unit */ public double[] getComposition(String unit); @@ -138,8 +136,7 @@ public default void addcomponent(String name, double moles, double molesInPhase, public double getVolume(String unit); /** - * method to return heat capacity ratio/adiabatic index/Poisson constant. The - * method calculates it + * method to return heat capacity ratio/adiabatic index/Poisson constant. The method calculates it * as Cp (real) /Cv (real). * * @return gamma @@ -147,8 +144,7 @@ public default void addcomponent(String name, double moles, double molesInPhase, public double getGamma(); /** - * method to return heat capacity ratio calculated as - * Cp/(Cp-R*getNumberOfMolesInPhase). + * method to return heat capacity ratio calculated as Cp/(Cp-R*getNumberOfMolesInPhase). * * @return kappa */ @@ -243,8 +239,8 @@ public default double getGamma2() { * * @param totalNumberOfMoles Total number of moles in all phases of Stream. * @param numberOfComponents Number of components in system. - * @param type a int. Use 0 to init, and 1 to reset. - * @param beta Mole fraction of this phase in system. + * @param type a int. Use 0 to init, and 1 to reset. + * @param beta Mole fraction of this phase in system. */ public default void init(double totalNumberOfMoles, int numberOfComponents, int type, double beta) { @@ -258,9 +254,9 @@ public default void init(double totalNumberOfMoles, int numberOfComponents, int * * @param totalNumberOfMoles Total number of moles in all phases of Stream. * @param numberOfComponents Number of components in system. - * @param type a int. Use 0 to init, and 1 to reset. - * @param pt Type of phase. - * @param beta Mole fraction of this phase in system. + * @param type a int. Use 0 to init, and 1 to reset. + * @param pt Type of phase. + * @param beta Mole fraction of this phase in system. */ public void init(double totalNumberOfMoles, int numberOfComponents, int type, PhaseType pt, double beta); @@ -272,9 +268,9 @@ public void init(double totalNumberOfMoles, int numberOfComponents, int type, Ph * * @param totalNumberOfMoles Total number of moles in system. * @param numberOfComponents Number of components in system. - * @param type a int. Use 0 to init, and 1 to reset. - * @param ptNumber Phase type index. - * @param beta Mole fraction of this phase in system. + * @param type a int. Use 0 to init, and 1 to reset. + * @param ptNumber Phase type index. + * @param beta Mole fraction of this phase in system. * @deprecated Replace with init-function using PhaseType input. */ @Deprecated @@ -367,8 +363,7 @@ public default void init(double totalNumberOfMoles, int numberOfComponents, int * getcomponentArray. *

* - * @return an array of {@link neqsim.thermo.component.ComponentInterface} - * objects + * @return an array of {@link neqsim.thermo.component.ComponentInterface} objects */ public ComponentInterface[] getcomponentArray(); @@ -392,19 +387,16 @@ public default void init(double totalNumberOfMoles, int numberOfComponents, int public double getWtFraction(SystemInterface system); /** - * method to return molar volume of the phase note: without Peneloux volume - * correction. + * method to return molar volume of the phase note: without Peneloux volume correction. * * @return molar volume volume in unit m3/mol*1e5 */ public double getMolarVolume(); /** - * method to return molar volume of the fluid: - * eventual volume correction included. - * - * @param unit Supported units are m3/mol, litre/mol + * method to return molar volume of the fluid: eventual volume correction included. * + * @param unit Supported units are m3/mol, litre/mol * @return molar volume volume in unit */ public double getMolarVolume(String unit); @@ -412,9 +404,8 @@ public default void init(double totalNumberOfMoles, int numberOfComponents, int /** * method to return flow rate of a phase. * - * @param flowunit Supported units are kg/sec, kg/min, kg/hr, m3/sec, m3/min, - * m3/hr, ft3/sec, - * mole/sec, mole/min, mole/hr + * @param flowunit Supported units are kg/sec, kg/min, kg/hr, m3/sec, m3/min, m3/hr, ft3/sec, + * mole/sec, mole/min, mole/hr * @return flow rate in specified unit */ public double getFlowRate(String flowunit); @@ -424,8 +415,7 @@ public default void init(double totalNumberOfMoles, int numberOfComponents, int * setComponentArray. *

* - * @param components an array of - * {@link neqsim.thermo.component.ComponentInterface} objects + * @param components an array of {@link neqsim.thermo.component.ComponentInterface} objects */ public void setComponentArray(ComponentInterface[] components); @@ -446,8 +436,7 @@ public default void init(double totalNumberOfMoles, int numberOfComponents, int public double[] getProperties_GERG2008(); /** - * method to get density of a phase note: does not use Peneloux volume - * correction. + * method to get density of a phase note: does not use Peneloux volume correction. * * @return density with unit kg/m3 */ @@ -466,10 +455,10 @@ public default void init(double totalNumberOfMoles, int numberOfComponents, int * removeComponent. *

* - * @param name a {@link String} object - * @param moles a double + * @param name a {@link String} object + * @param moles a double * @param molesInPhase a double - * @param compNumber a int + * @param compNumber a int */ public void removeComponent(String name, double moles, double molesInPhase, int compNumber); @@ -638,8 +627,7 @@ public default double getExessGibbsEnergySymetric() { /** *

- * Getter for property beta. Beta is the mole fraction of a phase - * of all the moles of + * Getter for property beta. Beta is the mole fraction of a phase of all the moles of * a system. *

* @@ -649,8 +637,7 @@ public default double getExessGibbsEnergySymetric() { /** *

- * Setter for property beta. Beta is the mole fraction of a phase - * of all the moles of + * Setter for property beta. Beta is the mole fraction of a phase of all the moles of * a system. *

* @@ -778,7 +765,7 @@ public default double getExessGibbsEnergySymetric() { * getPureComponentFugacity. *

* - * @param k a int + * @param k a int * @param pure a boolean * @return a double */ @@ -786,18 +773,15 @@ public default double getExessGibbsEnergySymetric() { /** *

- * Change the number of moles of component of phase,i.e., - * numberOfMolesInPhase but do + * Change the number of moles of component of phase,i.e., numberOfMolesInPhase but do * not change the total number of moles of component in system. * - * NB! Phase fraction beta is not updated by this method. Must be - * done separately to - * keep consistency between phase and component calculation of of total number - * of moles in system. + * NB! Phase fraction beta is not updated by this method. Must be done separately to + * keep consistency between phase and component calculation of of total number of moles in system. *

* * @param component Component number to change - * @param dn Number of moles of component added to phase + * @param dn Number of moles of component added to phase */ public default void addMoles(int component, double dn) { addMolesChemReac(component, dn, 0); @@ -805,20 +789,16 @@ public default void addMoles(int component, double dn) { /** *

- * Change the number of moles of component of phase, i.e., - * numberOfMolesInPhase, and - * total number of moles of component in system, i.e., - * numberOfMoles with the same + * Change the number of moles of component of phase, i.e., numberOfMolesInPhase, and + * total number of moles of component in system, i.e., numberOfMoles with the same * amount. * - * NB! Phase fraction beta is not updated by this method. Must be - * done separately to - * keep consistency between phase and component calculation of of total number - * of moles in system. + * NB! Phase fraction beta is not updated by this method. Must be done separately to + * keep consistency between phase and component calculation of of total number of moles in system. *

* * @param component Component number to change - * @param dn Number of moles of component added to phase and system + * @param dn Number of moles of component added to phase and system */ public default void addMolesChemReac(int component, double dn) { addMolesChemReac(component, dn, dn); @@ -826,23 +806,18 @@ public default void addMolesChemReac(int component, double dn) { /** *

- * Change the number of moles of component of phase, i.e., - * numberOfMolesInPhase and - * Component properties for the number of moles of component of - * phase, i.e., - * numberOfMolesInPhase, and total number of moles of component in - * system, i.e., + * Change the number of moles of component of phase, i.e., numberOfMolesInPhase and + * Component properties for the number of moles of component of phase, i.e., + * numberOfMolesInPhase, and total number of moles of component in system, i.e., * numberOfMoles with separate amounts. * - * NB! Phase fraction beta is not updated by this method. Must be - * done separately to - * keep consistency between phase and component calculation of of total number - * of moles in system. + * NB! Phase fraction beta is not updated by this method. Must be done separately to + * keep consistency between phase and component calculation of of total number of moles in system. *

* * @param component Component number to change - * @param dn Number of moles of component to add to phase - * @param totdn Number of moles of component to add to system + * @param dn Number of moles of component to add to phase + * @param totdn Number of moles of component to add to system */ public void addMolesChemReac(int component, double dn, double totdn); @@ -908,8 +883,7 @@ public default void addMolesChemReac(int component, double dn) { * getPhysicalProperties. *

* - * @return a - * {@link neqsim.physicalProperties.physicalPropertySystem.PhysicalPropertiesInterface} + * @return a {@link neqsim.physicalProperties.physicalPropertySystem.PhysicalPropertiesInterface} * object */ public neqsim.physicalProperties.physicalPropertySystem.PhysicalPropertiesInterface getPhysicalProperties(); @@ -919,13 +893,13 @@ public default void addMolesChemReac(int component, double dn) { * molarVolume. *

* - * @param pressure a double + * @param pressure a double * @param temperature a double - * @param A a double - * @param B a double - * @param phase a int + * @param A a double + * @param B a double + * @param phase a int * @return a double - * @throws neqsim.util.exception.IsNaNException if any. + * @throws neqsim.util.exception.IsNaNException if any. * @throws neqsim.util.exception.TooManyIterationsException if any. */ double molarVolume(double pressure, double temperature, double A, double B, int phase) @@ -936,10 +910,10 @@ public default void addMolesChemReac(int component, double dn) { * geta. *

* - * @param phase a {@link neqsim.thermo.phase.PhaseInterface} object + * @param phase a {@link neqsim.thermo.phase.PhaseInterface} object * @param temperature a double - * @param pressure a double - * @param numbcomp a int + * @param pressure a double + * @param numbcomp a int * @return a double */ public double geta(PhaseInterface phase, double temperature, double pressure, int numbcomp); @@ -949,10 +923,10 @@ public default void addMolesChemReac(int component, double dn) { * getb. *

* - * @param phase a {@link neqsim.thermo.phase.PhaseInterface} object + * @param phase a {@link neqsim.thermo.phase.PhaseInterface} object * @param temperature a double - * @param pressure a double - * @param numbcomp a int + * @param pressure a double + * @param numbcomp a int * @return a double */ public double getb(PhaseInterface phase, double temperature, double pressure, int numbcomp); @@ -972,10 +946,10 @@ public default void addMolesChemReac(int component, double dn) { * calcA. *

* - * @param phase a {@link neqsim.thermo.phase.PhaseInterface} object + * @param phase a {@link neqsim.thermo.phase.PhaseInterface} object * @param temperature a double - * @param pressure a double - * @param numbcomp a int + * @param pressure a double + * @param numbcomp a int * @return a double */ double calcA(PhaseInterface phase, double temperature, double pressure, int numbcomp); @@ -985,10 +959,10 @@ public default void addMolesChemReac(int component, double dn) { * calcB. *

* - * @param phase a {@link neqsim.thermo.phase.PhaseInterface} object + * @param phase a {@link neqsim.thermo.phase.PhaseInterface} object * @param temperature a double - * @param pressure a double - * @param numbcomp a int + * @param pressure a double + * @param numbcomp a int * @return a double */ double calcB(PhaseInterface phase, double temperature, double pressure, int numbcomp); @@ -998,11 +972,11 @@ public default void addMolesChemReac(int component, double dn) { * calcAi. *

* - * @param compNumb a int - * @param phase a {@link neqsim.thermo.phase.PhaseInterface} object + * @param compNumb a int + * @param phase a {@link neqsim.thermo.phase.PhaseInterface} object * @param temperature a double - * @param pressure a double - * @param numbcomp a int + * @param pressure a double + * @param numbcomp a int * @return a double */ double calcAi(int compNumb, PhaseInterface phase, double temperature, double pressure, @@ -1013,11 +987,11 @@ public default void addMolesChemReac(int component, double dn) { * calcAiT. *

* - * @param compNumb a int - * @param phase a {@link neqsim.thermo.phase.PhaseInterface} object + * @param compNumb a int + * @param phase a {@link neqsim.thermo.phase.PhaseInterface} object * @param temperature a double - * @param pressure a double - * @param numbcomp a int + * @param pressure a double + * @param numbcomp a int * @return a double */ double calcAiT(int compNumb, PhaseInterface phase, double temperature, double pressure, @@ -1028,12 +1002,12 @@ public default void addMolesChemReac(int component, double dn) { * calcAij. *

* - * @param compNumb a int - * @param j a int - * @param phase a {@link neqsim.thermo.phase.PhaseInterface} object + * @param compNumb a int + * @param j a int + * @param phase a {@link neqsim.thermo.phase.PhaseInterface} object * @param temperature a double - * @param pressure a double - * @param numbcomp a int + * @param pressure a double + * @param numbcomp a int * @return a double */ double calcAij(int compNumb, int j, PhaseInterface phase, double temperature, double pressure, @@ -1044,12 +1018,12 @@ public default void addMolesChemReac(int component, double dn) { * calcBij. *

* - * @param compNumb a int - * @param j a int - * @param phase a {@link neqsim.thermo.phase.PhaseInterface} object + * @param compNumb a int + * @param j a int + * @param phase a {@link neqsim.thermo.phase.PhaseInterface} object * @param temperature a double - * @param pressure a double - * @param numbcomp a int + * @param pressure a double + * @param numbcomp a int * @return a double */ double calcBij(int compNumb, int j, PhaseInterface phase, double temperature, double pressure, @@ -1060,11 +1034,11 @@ public default void addMolesChemReac(int component, double dn) { * calcAT. *

* - * @param compNumb a int - * @param phase a {@link neqsim.thermo.phase.PhaseInterface} object + * @param compNumb a int + * @param phase a {@link neqsim.thermo.phase.PhaseInterface} object * @param temperature a double - * @param pressure a double - * @param numbcomp a int + * @param pressure a double + * @param numbcomp a int * @return a double */ double calcAT(int compNumb, PhaseInterface phase, double temperature, double pressure, @@ -1075,11 +1049,11 @@ public default void addMolesChemReac(int component, double dn) { * calcBi. *

* - * @param compNumb a int - * @param phase a {@link neqsim.thermo.phase.PhaseInterface} object + * @param compNumb a int + * @param phase a {@link neqsim.thermo.phase.PhaseInterface} object * @param temperature a double - * @param pressure a double - * @param numbcomp a int + * @param pressure a double + * @param numbcomp a int * @return a double */ double calcBi(int compNumb, PhaseInterface phase, double temperature, double pressure, @@ -1233,8 +1207,7 @@ public default void addMolesChemReac(int component, double dn) { public double getCv(String unit); /** - * method to return real gas isentropic exponent (kappa = - Cp/Cv*(v/p)*dp/dv - * method to return + * method to return real gas isentropic exponent (kappa = - Cp/Cv*(v/p)*dp/dv method to return * heat capacity ratio/adiabatic index/Poisson constant. * * @return kappa @@ -1318,8 +1291,7 @@ public default void addMolesChemReac(int component, double dn) { * getComponents. *

* - * @return an array of {@link neqsim.thermo.component.ComponentInterface} - * objects + * @return an array of {@link neqsim.thermo.component.ComponentInterface} objects */ ComponentInterface[] getComponents(); @@ -1888,7 +1860,7 @@ public default void addMolesChemReac(int component, double dn) { * Indexed setter for property refPhase. *

* - * @param index a int + * @param index a int * @param refPhase a {@link neqsim.thermo.phase.PhaseInterface} object */ public void setRefPhase(int index, neqsim.thermo.phase.PhaseInterface refPhase); @@ -1898,8 +1870,7 @@ public default void addMolesChemReac(int component, double dn) { * Setter for property refPhase. *

* - * @param refPhase an array of {@link neqsim.thermo.phase.PhaseInterface} - * objects + * @param refPhase an array of {@link neqsim.thermo.phase.PhaseInterface} objects */ public void setRefPhase(neqsim.thermo.phase.PhaseInterface[] refPhase); @@ -1926,11 +1897,11 @@ public default void addMolesChemReac(int component, double dn) { * setParams. *

* - * @param phase a {@link neqsim.thermo.phase.PhaseInterface} object - * @param alpha an array of {@link double} objects - * @param Dij an array of {@link double} objects - * @param DijT an array of {@link double} objects - * @param mixRule an array of {@link String} objects + * @param phase a {@link neqsim.thermo.phase.PhaseInterface} object + * @param alpha an array of {@link double} objects + * @param Dij an array of {@link double} objects + * @param DijT an array of {@link double} objects + * @param mixRule an array of {@link String} objects * @param intparam an array of {@link double} objects */ public void setParams(PhaseInterface phase, double[][] alpha, double[][] Dij, double[][] DijT, diff --git a/src/main/java/neqsim/thermo/system/SystemInterface.java b/src/main/java/neqsim/thermo/system/SystemInterface.java index a213c7fc2f..b5ce9ee19a 100644 --- a/src/main/java/neqsim/thermo/system/SystemInterface.java +++ b/src/main/java/neqsim/thermo/system/SystemInterface.java @@ -31,7 +31,7 @@ public interface SystemInterface extends Cloneable, java.io.Serializable { * saveFluid. *

* - * @param id a int + * @param id a int * @param text a {@link java.lang.String} object */ public void saveFluid(int id, String text); @@ -68,10 +68,10 @@ public interface SystemInterface extends Cloneable, java.io.Serializable { * addPhaseFractionToPhase. *

* - * @param fraction a double + * @param fraction a double * @param specification a {@link java.lang.String} object * @param fromPhaseName a {@link java.lang.String} object - * @param toPhaseName a {@link java.lang.String} object + * @param toPhaseName a {@link java.lang.String} object */ public void addPhaseFractionToPhase(double fraction, String specification, String fromPhaseName, String toPhaseName); @@ -81,22 +81,20 @@ public void addPhaseFractionToPhase(double fraction, String specification, Strin * addPhaseFractionToPhase. *

* - * @param fraction a double - * @param specification a {@link java.lang.String} object + * @param fraction a double + * @param specification a {@link java.lang.String} object * @param specifiedStream a {@link java.lang.String} object - * @param fromPhaseName a {@link java.lang.String} object - * @param toPhaseName a {@link java.lang.String} object + * @param fromPhaseName a {@link java.lang.String} object + * @param toPhaseName a {@link java.lang.String} object */ public void addPhaseFractionToPhase(double fraction, String specification, String specifiedStream, String fromPhaseName, String toPhaseName); /** - * Add named components to a System. Does nothing if components already exist in - * System. + * Add named components to a System. Does nothing if components already exist in System. * - * @param names Names of the components to be added. See NeqSim database for - * available components - * in the database. + * @param names Names of the components to be added. See NeqSim database for available components + * in the database. */ public default void addComponents(String[] names) { for (int i = 0; i < names.length; i++) { @@ -105,13 +103,11 @@ public default void addComponents(String[] names) { } /** - * Add named components to a System with a number of moles. If component already - * exists, the moles + * Add named components to a System with a number of moles. If component already exists, the moles * will be added to the component. * - * @param names Names of the components to be added. See NeqSim database for - * available components - * in the database. + * @param names Names of the components to be added. See NeqSim database for available components + * in the database. * @param moles Number of moles to add per component. */ public default void addComponents(String[] names, double[] moles) { @@ -168,27 +164,21 @@ public default String[][] calcResultTable() { public int getNumberOfComponents(); /** - * This method is used to set the total molar composition of a plus fluid. The - * total flow rate + * This method is used to set the total molar composition of a plus fluid. The total flow rate * will be kept constant. The input mole fractions will be normalized. * - * @param molefractions is a double array taking the molar fraction of the - * components in the - * fluid. THe last molfraction is the mole fraction of the - * plus component + * @param molefractions is a double array taking the molar fraction of the components in the + * fluid. THe last molfraction is the mole fraction of the plus component */ public void setMolarCompositionPlus(double[] molefractions); /** - * This method is used to set the total molar composition of a characterized - * fluid. The total flow + * This method is used to set the total molar composition of a characterized fluid. The total flow * rate will be kept constant. The input mole fractions will be normalized. * - * @param molefractions is a double array taking the molar fraction of the - * components in the - * fluid. THe last fraction in the array is the total - * molefraction of the characterized - * components. + * @param molefractions is a double array taking the molar fraction of the components in the + * fluid. THe last fraction in the array is the total molefraction of the characterized + * components. */ public void setMolarCompositionOfPlusFluid(double[] molefractions); @@ -204,14 +194,13 @@ public default String[][] calcResultTable() { * method to return exergy in a specified unit. * * @param temperatureOfSurroundings in Kelvin - * @param exergyUnit a {@link java.lang.String} object + * @param exergyUnit a {@link java.lang.String} object * @return exergy in specified unit */ public double getExergy(double temperatureOfSurroundings, String exergyUnit); /** - * method to get the Joule Thomson Coefficient of a system. Based on a phase - * mole fraction basis + * method to get the Joule Thomson Coefficient of a system. Based on a phase mole fraction basis * average * * @return Joule Thomson coefficient in K/bar @@ -219,8 +208,7 @@ public default String[][] calcResultTable() { public double getJouleThomsonCoefficient(); /** - * method to get the Joule Thomson Coefficient of a system. Based on a phase - * mole fraction basis + * method to get the Joule Thomson Coefficient of a system. Based on a phase mole fraction basis * average. * * @param unit Supported units are K/bar, C/bar @@ -238,8 +226,7 @@ public default String[][] calcResultTable() { /** *

- * Get sum of mole fractions for all components. NB! init(0) must be called - * first. + * Get sum of mole fractions for all components. NB! init(0) must be called first. *

* * @return a double @@ -247,8 +234,7 @@ public default String[][] calcResultTable() { public double getMoleFractionsSum(); /** - * method to get the speed of sound of a system. The sound speed is implemented - * based on a molar + * method to get the speed of sound of a system. The sound speed is implemented based on a molar * average over the phases * * @param unit Supported units are m/s, km/h @@ -257,8 +243,7 @@ public default String[][] calcResultTable() { public double getSoundSpeed(String unit); /** - * method to get the speed of sound of a system. The sound speed is implemented - * based on a molar + * method to get the speed of sound of a system. The sound speed is implemented based on a molar * average over the phases * * @return speed of sound in m/s @@ -287,8 +272,7 @@ public default String[][] calcResultTable() { public void initPhysicalProperties(String propertyName); /** - * Calculates thermodynamic and physical properties of a fluid using - * initThermoProperties() and + * Calculates thermodynamic and physical properties of a fluid using initThermoProperties() and * initPhysicalProperties(). */ public void initProperties(); @@ -309,12 +293,9 @@ public static SystemInterface addFluids(SystemInterface addFluid1, SystemInterfa /** * method to return interfacial tension between two phases. * - * @param phase1 phase type of phase1 as string (valid phases are gas, oil, - * aqueous) - * @param phase2 phase type of phase2 as string (valid phases are gas, oil, - * aqueous) - * @return interfacial tension with unit N/m. If one or both phases does not - * exist - the method + * @param phase1 phase type of phase1 as string (valid phases are gas, oil, aqueous) + * @param phase2 phase type of phase2 as string (valid phases are gas, oil, aqueous) + * @return interfacial tension with unit N/m. If one or both phases does not exist - the method * will return NaN */ public double getInterfacialTension(String phase1, String phase2); @@ -335,7 +316,7 @@ public static SystemInterface addFluids(SystemInterface addFluid1, SystemInterfa * * @param phase1 phase number of phase1 * @param phase2 phase number of phase2 - * @param unit a {@link java.lang.String} object + * @param unit a {@link java.lang.String} object * @return interfacial tension with specified unit */ public double getInterfacialTension(int phase1, int phase2, String unit); @@ -374,10 +355,8 @@ public default double getGamma2() { /** * method to return flow rate of fluid. * - * @param flowunit Supported units are kg/sec, kg/min, kg/hr, kg/day, m3/sec, - * m3/min, m3/hr, - * idSm3/hr, Sm3/sec, Sm3/hr, Sm3/day, MSm3/day, mole/sec, - * mole/min, mole/hr + * @param flowunit Supported units are kg/sec, kg/min, kg/hr, kg/day, m3/sec, m3/min, m3/hr, + * idSm3/hr, Sm3/sec, Sm3/hr, Sm3/day, MSm3/day, mole/sec, mole/min, mole/hr * @return flow rate in specified unit */ public double getFlowRate(String flowunit); @@ -393,7 +372,7 @@ public default double getGamma2() { * method to set the pressure of a fluid (same pressure for all phases). * * @param newPressure in specified unit - * @param unit unit can be bar, bara, barg or atm + * @param unit unit can be bar, bara, barg or atm */ public void setPressure(double newPressure, String unit); @@ -412,7 +391,7 @@ public default double getGamma2() { *

* * @param newTemperature a double - * @param phaseNumber a int + * @param phaseNumber a int */ public void setTemperature(double newTemperature, int phaseNumber); @@ -420,13 +399,12 @@ public default double getGamma2() { * method to set the temperature of a fluid (same temperature for all phases). * * @param newTemperature in specified unit - * @param unit unit can be C or K (Celsius or Kelvin) + * @param unit unit can be C or K (Celsius or Kelvin) */ public void setTemperature(double newTemperature, String unit); /** - * method to return the volume fraction of a phase note: without Peneloux volume - * correction. + * method to return the volume fraction of a phase note: without Peneloux volume correction. * * @param phaseNumber number of the phase to get volume fraction for * @return volume fraction @@ -434,8 +412,7 @@ public default double getGamma2() { public double getVolumeFraction(int phaseNumber); /** - * method to return the volume fraction of a phase note: with Peneloux volume - * correction. + * method to return the volume fraction of a phase note: with Peneloux volume correction. * * @param phaseNumber number of the phase to get volume fraction for * @return volume fraction @@ -529,7 +506,7 @@ public default void removeMoles() { * saveObjectToFile. *

* - * @param filePath a {@link java.lang.String} object + * @param filePath a {@link java.lang.String} object * @param fluidName a {@link java.lang.String} object */ public void saveObjectToFile(String filePath, String fluidName); @@ -539,7 +516,7 @@ public default void removeMoles() { * readObjectFromFile. *

* - * @param filePath a {@link java.lang.String} object + * @param filePath a {@link java.lang.String} object * @param fluidName a {@link java.lang.String} object * @return a {@link neqsim.thermo.system.SystemInterface} object */ @@ -607,7 +584,7 @@ public default void removeMoles() { * changeComponentName. *

* - * @param name a {@link java.lang.String} object + * @param name a {@link java.lang.String} object * @param newName a {@link java.lang.String} object */ public void changeComponentName(String name, String newName); @@ -719,10 +696,8 @@ public default boolean IsPhase(int i) { *

* * @param flowRate a double - * @param flowunit a {@link java.lang.String} object. flow units are: kg/sec, - * kg/min, kg/hr - * m3/sec, m3/min, m3/hr, mole/sec, mole/min, mole/hr, Sm3/hr, - * Sm3/day, idSm3/hr, idSm3/day + * @param flowunit a {@link java.lang.String} object. flow units are: kg/sec, kg/min, kg/hr + * m3/sec, m3/min, m3/hr, mole/sec, mole/min, mole/hr, Sm3/hr, Sm3/day, idSm3/hr, idSm3/day */ public void setTotalFlowRate(double flowRate, String flowunit); @@ -874,7 +849,7 @@ public default boolean IsPhase(int i) { * saveObject. *

* - * @param ID a int + * @param ID a int * @param text a {@link java.lang.String} object */ public void saveObject(int ID, String text); @@ -957,8 +932,7 @@ public default boolean IsPhase(int i) { /** *

- * This method is used to set the total molar composition of a fluid. The total - * flow rate will be + * This method is used to set the total molar composition of a fluid. The total flow rate will be * kept constant. The input mole fractions will be normalized. *

* @@ -967,12 +941,10 @@ public default boolean IsPhase(int i) { public void setMolarComposition(double[] moles); /** - * return the phase of to specified type if the phase does not exist, the method - * will return null. + * return the phase of to specified type if the phase does not exist, the method will return null. * - * @param phaseTypeName the phase type to be returned (gas, oil, aqueous, wax, - * hydrate are - * supported) + * @param phaseTypeName the phase type to be returned (gas, oil, aqueous, wax, hydrate are + * supported) * @return a {@link neqsim.thermo.phase.PhaseInterface} object */ public PhaseInterface getPhaseOfType(String phaseTypeName); @@ -991,8 +963,8 @@ public default boolean IsPhase(int i) { * * @param componentName selected name of the component to be added * @param numberOfMoles number of moles to be added - * @param molarMass molar mass of the component in kg/mol - * @param density density of the component in g/cm3 + * @param molarMass molar mass of the component in kg/mol + * @param density density of the component in g/cm3 */ public void addTBPfraction(String componentName, double numberOfMoles, double molarMass, double density); @@ -1002,13 +974,13 @@ public void addTBPfraction(String componentName, double numberOfMoles, double mo * addTBPfraction. *

* - * @param componentName a {@link java.lang.String} object - * @param numberOfMoles a double - * @param molarMass a double - * @param density a double + * @param componentName a {@link java.lang.String} object + * @param numberOfMoles a double + * @param molarMass a double + * @param density a double * @param criticalTemperature a double - * @param criticalPressure a double - * @param acentricFactor a double + * @param criticalPressure a double + * @param acentricFactor a double */ public void addTBPfraction(String componentName, double numberOfMoles, double molarMass, double density, double criticalTemperature, double criticalPressure, double acentricFactor); @@ -1020,8 +992,8 @@ public void addTBPfraction(String componentName, double numberOfMoles, double mo * * @param componentName a {@link java.lang.String} object * @param numberOfMoles a double - * @param molarMass a double - * @param density a double + * @param molarMass a double + * @param density a double */ public void addPlusFraction(String componentName, double numberOfMoles, double molarMass, double density); @@ -1032,7 +1004,7 @@ public void addPlusFraction(String componentName, double numberOfMoles, double m *

* * @param componentName a {@link java.lang.String} object - * @param value a double + * @param value a double */ public void addSalt(String componentName, double value); @@ -1123,14 +1095,13 @@ public default boolean hasSolidPhase() { *

* * @param model a {@link java.lang.String} object - * @param val a double + * @param val a double * @param phase a int */ public void tuneModel(String model, double val, int phase); /** - * add a component to a fluid. If component already exists, the moles will be - * added to the + * add a component to a fluid. If component already exists, the moles will be added to the * existing component. * * @param inComponent Component object to add. @@ -1138,38 +1109,30 @@ public default boolean hasSolidPhase() { public void addComponent(ComponentInterface inComponent); /** - * add a component to a fluid. If component already exists, the moles will be - * added to the + * add a component to a fluid. If component already exists, the moles will be added to the * existing component. * - * @param name Name of the component to add. See NeqSim database for component - * in the database. + * @param name Name of the component to add. See NeqSim database for component in the database. */ public void addComponent(String name); /** - * add a component to a fluid. If component already exists, the moles will be - * added to the + * add a component to a fluid. If component already exists, the moles will be added to the * existing component. * - * @param moles number of moles (per second) of the component to be added to the - * fluid - * @param name Name of the component to add. See NeqSim database for component - * in the database. + * @param moles number of moles (per second) of the component to be added to the fluid + * @param name Name of the component to add. See NeqSim database for component in the database. */ public void addComponent(String name, double moles); /** - * add a component to a fluid. If component already exists, the moles will be - * added to the + * add a component to a fluid. If component already exists, the moles will be added to the * existing component. * - * @param name Name of the component to add. See NeqSim database for - * component in the database. - * @param value The amount - * @param unitName the unit of rate (sported units are kg/sec, mol/sec, - * Nlitre/min, kg/hr, - * Sm^3/hr, Sm^3/day, MSm^3/day .. + * @param name Name of the component to add. See NeqSim database for component in the database. + * @param value The amount + * @param unitName the unit of rate (sported units are kg/sec, mol/sec, Nlitre/min, kg/hr, + * Sm^3/hr, Sm^3/day, MSm^3/day .. */ public void addComponent(String name, double value, String unitName); @@ -1178,37 +1141,30 @@ public default boolean hasSolidPhase() { * addComponent. *

* - * @param name Name of the component to add. See NeqSim database for component - * in the database. - * @param moles number of moles (per second) of the component to be added to the - * fluid - * @param TC Critical temperature - * @param PC Critical pressure - * @param acs a double + * @param name Name of the component to add. See NeqSim database for component in the database. + * @param moles number of moles (per second) of the component to be added to the fluid + * @param TC Critical temperature + * @param PC Critical pressure + * @param acs a double */ public void addComponent(String name, double moles, double TC, double PC, double acs); /** - * add a component to a fluid. If component already exists, the moles will be - * added to the + * add a component to a fluid. If component already exists, the moles will be added to the * existing component. * - * @param name Name of the component to add. See NeqSim database for - * component in the database. - * @param moles number of moles (per second) of the component to be added - * to the fluid + * @param name Name of the component to add. See NeqSim database for component in the database. + * @param moles number of moles (per second) of the component to be added to the fluid * @param phaseNumber Number of the phase to add the component to */ public void addComponent(String name, double moles, int phaseNumber); /** - * add a component to a fluid. I component already exists, it will be added to - * the component + * add a component to a fluid. I component already exists, it will be added to the component * - * @param name Name of the component to add. See NeqSim database for - * component in the database. - * @param value rate of the component to add to the fluid - * @param unitName the unit of the flow rate (eg. mol/sec, kg/sec, etc.) + * @param name Name of the component to add. See NeqSim database for component in the database. + * @param value rate of the component to add to the fluid + * @param unitName the unit of the flow rate (eg. mol/sec, kg/sec, etc.) * @param phaseNumber Number of the phase to add the component to */ public void addComponent(String name, double value, String unitName, int phaseNumber); @@ -1219,8 +1175,7 @@ public default boolean hasSolidPhase() { *

* * @param index Component number to add - * @param moles number of moles (per second) of the component to be added to the - * fluid + * @param moles number of moles (per second) of the component to be added to the fluid */ public void addComponent(int index, double moles); @@ -1229,9 +1184,8 @@ public default boolean hasSolidPhase() { * addComponent. *

* - * @param index Component number to add - * @param moles number of moles (per second) of the component to be added - * to the fluid + * @param index Component number to add + * @param moles number of moles (per second) of the component to be added to the fluid * @param phaseNumber Number of the phase to add the component to */ public void addComponent(int index, double moles, int phaseNumber); @@ -1241,8 +1195,7 @@ public default boolean hasSolidPhase() { * removeComponent. *

* - * @param name Name of the component to remove. See NeqSim database for - * component in the database. + * @param name Name of the component to remove. See NeqSim database for component in the database. */ public void removeComponent(String name); @@ -1269,8 +1222,7 @@ public default boolean hasSolidPhase() { /** *

- * Setter for property beta. NB! Sets beta = b for first phase and - * 1-b for second + * Setter for property beta. NB! Sets beta = b for first phase and 1-b for second * phase, not for multiphase systems. *

* @@ -1284,7 +1236,7 @@ public default boolean hasSolidPhase() { *

* * @param phase Phase number to set beta for. - * @param b Beta value to set. + * @param b Beta value to set. */ public void setBeta(int phase, double b); @@ -1310,19 +1262,13 @@ public default boolean hasSolidPhase() { /** * method to set mixing rule used for the fluid. * - * @param type The type of mixing rule to be used for the fluid. 1 - classic - * mixing rule with all - * kij set to zero 2 -classic mixing rule with kij from NeqSim - * database 3- classic mixing - * rule with temperature dependent kij 4- Huron Vidal mixing rule - * with parameters from - * NeqSim database 7 -classic mixing rule with kij of CPA from - * NeqSim Database 9 - * -classicmixing rule with temperature dependent kij of CPA from - * NeqSim database - * 10-classic mixing rule with temperature and composition dependent - * kij of CPA from NeqSim - * database + * @param type The type of mixing rule to be used for the fluid. 1 - classic mixing rule with all + * kij set to zero 2 -classic mixing rule with kij from NeqSim database 3- classic mixing + * rule with temperature dependent kij 4- Huron Vidal mixing rule with parameters from + * NeqSim database 7 -classic mixing rule with kij of CPA from NeqSim Database 9 + * -classicmixing rule with temperature dependent kij of CPA from NeqSim database + * 10-classic mixing rule with temperature and composition dependent kij of CPA from NeqSim + * database */ public void setMixingRule(int type); @@ -1339,7 +1285,7 @@ public default boolean hasSolidPhase() { *

* * @param typename a {@link java.lang.String} object - * @param GEmodel a {@link java.lang.String} object + * @param GEmodel a {@link java.lang.String} object */ public void setMixingRule(String typename, String GEmodel); @@ -1432,9 +1378,9 @@ public default boolean hasSolidPhase() { * write. *

* - * @param name a {@link java.lang.String} object + * @param name a {@link java.lang.String} object * @param filename a {@link java.lang.String} object - * @param newfile a boolean + * @param newfile a boolean */ public void write(String name, String filename, boolean newfile); @@ -1489,15 +1435,14 @@ public default boolean hasSolidPhase() { * this.phaseIndex[index] = phaseIndex; *

* - * @param index a int + * @param index a int * @param phaseIndex a int */ public void setPhaseIndex(int index, int phaseIndex); /** *

- * Set phaseArray[phaseIndex] = phase. NB! Transfers the pressure - * and temperature + * Set phaseArray[phaseIndex] = phase. NB! Transfers the pressure and temperature * from the currently existing phase object at index numb *

* @@ -1507,26 +1452,17 @@ public default boolean hasSolidPhase() { public void setPhase(PhaseInterface phase, int index); /** - * method to read pure component and interaction parameters from the NeqSim - * database and create + * method to read pure component and interaction parameters from the NeqSim database and create * temporary tables with parameters for active fluid. * - * @param reset If reset is set to true, new temporary tables with parameters - * for the added - * components will be created. When parameters are needed (eg. when - * adding components or - * when setting a mixing rule) it will try to find them in the - * temporary tables first eg. - * COMPTEMP (for pure component parameters) and INTERTEMP (for - * interaction parameters). If - * reset is set to false it will not create new temporary tables. - * If a fluid is created - * with the same components many times, performance improvements - * will be obtained, if - * temporary tables are created the first time (reset=true), and - * then the same tables is - * used when creating new fluids with the same temporary tables - * (reset=false) + * @param reset If reset is set to true, new temporary tables with parameters for the added + * components will be created. When parameters are needed (eg. when adding components or + * when setting a mixing rule) it will try to find them in the temporary tables first eg. + * COMPTEMP (for pure component parameters) and INTERTEMP (for interaction parameters). If + * reset is set to false it will not create new temporary tables. If a fluid is created + * with the same components many times, performance improvements will be obtained, if + * temporary tables are created the first time (reset=true), and then the same tables is + * used when creating new fluids with the same temporary tables (reset=false) */ public void createDatabase(boolean reset); @@ -1574,21 +1510,16 @@ public default boolean hasSolidPhase() { public boolean doMultiPhaseCheck(); /** - * method to specify if calculations should check for more than two fluid - * phases. + * method to specify if calculations should check for more than two fluid phases. * - * @param doMultiPhaseCheck Specify if the calculations should check for more - * than two fluid - * phases. Default is two fluid phases (gas and - * liquid). If set to true the program will - * check for gas and multiple liquid phases (eg. - * gas-oil-aqueous). + * @param doMultiPhaseCheck Specify if the calculations should check for more than two fluid + * phases. Default is two fluid phases (gas and liquid). If set to true the program will + * check for gas and multiple liquid phases (eg. gas-oil-aqueous). */ public void setMultiPhaseCheck(boolean doMultiPhaseCheck); /** - * Calculate thermodynamic properties of the fluid using the init type set in - * fluid. + * Calculate thermodynamic properties of the fluid using the init type set in fluid. * * @see getInitType */ @@ -1597,34 +1528,25 @@ public default void init() { } /** - * method to calculate thermodynamic properties of the fluid. The temperature, - * pressure, number of + * method to calculate thermodynamic properties of the fluid. The temperature, pressure, number of * phases and composition of the phases will be used as basis for calculation. * - * @param number - The number can be 0, 1, 2 or 3. 0: Set feed composition for - * all phases. 1: - * Calculation of density, fugacities and Z-factor 2: 1 + - * calculation of enthalpy, entropy, - * Cp, Cv, and most other thermodynamic properties 3: 1+2 + - * Calculation of composition - * derivatives of fugacity coefficients. + * @param number - The number can be 0, 1, 2 or 3. 0: Set feed composition for all phases. 1: + * Calculation of density, fugacities and Z-factor 2: 1 + calculation of enthalpy, entropy, + * Cp, Cv, and most other thermodynamic properties 3: 1+2 + Calculation of composition + * derivatives of fugacity coefficients. */ public void init(int number); /** - * method to calculate thermodynamic properties of the selected phase. The - * temperature, pressure, - * number of phases and composition of the phase will be used as basis for - * calculation. + * method to calculate thermodynamic properties of the selected phase. The temperature, pressure, + * number of phases and composition of the phase will be used as basis for calculation. * - * @param number - The number can be 0, 1, 2 or 3. 0: Set feed composition. 1: - * Calculation of - * density, fugacities and Z-factor 2: 1 + calculation of - * enthalpy, entropy, Cp, Cv, and - * most other thermodynamic properties 3: 1+2 + Calculation of - * composition derivatives of - * fugacity coefficients. - * @param phase a int + * @param number - The number can be 0, 1, 2 or 3. 0: Set feed composition. 1: Calculation of + * density, fugacities and Z-factor 2: 1 + calculation of enthalpy, entropy, Cp, Cv, and + * most other thermodynamic properties 3: 1+2 + Calculation of composition derivatives of + * fugacity coefficients. + * @param phase a int */ public void init(int number, int phase); @@ -1680,7 +1602,7 @@ public default void prettyPrint() { *

* * @param addSystem a {@link neqsim.thermo.system.SystemInterface} object - * @param phase phase number of phase to add fluid to + * @param phase phase number of phase to add fluid to * @return SystemInterface */ public SystemInterface addFluid(SystemInterface addSystem, int phase); @@ -1728,9 +1650,8 @@ public default void prettyPrint() { * calcBeta. For simple gas liquid systems. *

* - * @return Beta Mole fraction contained in the heaviest phase, i.e., liquid - * phase. - * @throws neqsim.util.exception.IsNaNException if any. + * @return Beta Mole fraction contained in the heaviest phase, i.e., liquid phase. + * @throws neqsim.util.exception.IsNaNException if any. * @throws neqsim.util.exception.TooManyIterationsException if any. */ public double calcBeta() @@ -1882,16 +1803,14 @@ public double calcBeta() public void isChemicalSystem(boolean temp); /** - * method to return molar volume of the fluid note: without Peneloux volume - * correction. + * method to return molar volume of the fluid note: without Peneloux volume correction. * * @return molar volume volume in unit m3/mol*1e5 */ public double getMolarVolume(); /** - * method to return molar volume of the fluid: - * eventual volume correction included. + * method to return molar volume of the fluid: eventual volume correction included. * * @param unit Supported units are m3/mol, litre/mol * @@ -1941,16 +1860,14 @@ public double calcBeta() * getInterphaseProperties. *

* - * @return a - * {@link neqsim.physicalProperties.interfaceProperties.InterphasePropertiesInterface} + * @return a {@link neqsim.physicalProperties.interfaceProperties.InterphasePropertiesInterface} * object */ public InterphasePropertiesInterface getInterphaseProperties(); /** *

- * Calculate system beta values using Phase.getNumberOfMolesInPhase and - * getTotalNumberOfMoles. + * Calculate system beta values using Phase.getNumberOfMolesInPhase and getTotalNumberOfMoles. *

*/ public void initBeta(); @@ -2015,7 +1932,7 @@ public double calcBeta() * Change the phase type of a given phase. * * @param phaseToChange the phase number of the phase to set phase type - * @param newPhaseType the phasetype number to set + * @param newPhaseType the phasetype number to set * @deprecated Replaced by {@link setPhaseType} */ @Deprecated @@ -2037,14 +1954,14 @@ public default void setPhaseType(int phaseToChange, String phaseTypeName) { * Change the phase type of a given phase. * * @param phaseToChange the phase number of the phase to set phase type - * @param pt PhaseType to set + * @param pt PhaseType to set */ public void setPhaseType(int phaseToChange, PhaseType pt); /** * Set phase type of all phases. * - * @param phases Set to "all" to set all phases, else nothing happens. + * @param phases Set to "all" to set all phases, else nothing happens. * @param newPhaseType the phasetype number to set * @deprecated Replaced by {@link setAllPhaseType} */ @@ -2268,8 +2185,7 @@ public default ComponentInterface getComponent(int i) { public PhaseInterface getLiquidPhase(); /** - * method to return compressibility factor of a fluid compressibility factor is - * defined in EoS + * method to return compressibility factor of a fluid compressibility factor is defined in EoS * from PV=ZnRT where V is total volume of fluid. * * @return compressibility factor Z @@ -2372,7 +2288,7 @@ public default ComponentInterface getComponent(int i) { * method to return phase fraction of selected phase. * * @param phaseTypeName gas/oil/aqueous - * @param unit mole/volume/weight + * @param unit mole/volume/weight * @return phase: fraction in specified unit */ public double getPhaseFraction(String phaseTypeName, String unit); @@ -2382,9 +2298,9 @@ public default ComponentInterface getComponent(int i) { * getProperty. *

* - * @param prop a {@link java.lang.String} object + * @param prop a {@link java.lang.String} object * @param compName a {@link java.lang.String} object - * @param phase a int + * @param phase a int * @return a double */ public double getProperty(String prop, String compName, int phase); @@ -2394,7 +2310,7 @@ public default ComponentInterface getComponent(int i) { * getProperty. *

* - * @param prop a {@link java.lang.String} object + * @param prop a {@link java.lang.String} object * @param phase a int * @return a double */ @@ -2674,10 +2590,10 @@ public void setImplementedCompositionDeriativesofFugacity( * addCharacterized. *

* - * @param charNames an array of {@link java.lang.String} objects - * @param charFlowrate an array of {@link double} objects - * @param molarMass an array of {@link double} objects - * @param relativedensity an array of {@link double} objects + * @param charNames an array of {@link java.lang.String} objects + * @param charFlowrate an array of {@link double} objects + * @param molarMass an array of {@link double} objects + * @param relativedensity an array of {@link double} objects * @param lastIsPlusFraction True if last fraction is a Plus fraction */ public void addOilFractions(String[] charNames, double[] charFlowrate, double[] molarMass, @@ -2688,12 +2604,12 @@ public void addOilFractions(String[] charNames, double[] charFlowrate, double[] * addCharacterized. *

* - * @param charNames an array of {@link java.lang.String} objects - * @param charFlowrate an array of {@link double} objects - * @param molarMass an array of {@link double} objects - * @param relativedensity an array of {@link double} objects - * @param lastIsPlusFraction True if last fraction is a Plus fraction - * @param lumpComponents True if component should be lumped + * @param charNames an array of {@link java.lang.String} objects + * @param charFlowrate an array of {@link double} objects + * @param molarMass an array of {@link double} objects + * @param relativedensity an array of {@link double} objects + * @param lastIsPlusFraction True if last fraction is a Plus fraction + * @param lumpComponents True if component should be lumped * @param numberOfPseudoComponents number of pseudo components */ public void addOilFractions(String[] charNames, double[] charFlowrate, double[] molarMass, @@ -2705,9 +2621,9 @@ public void addOilFractions(String[] charNames, double[] charFlowrate, double[] * addCharacterized. *

* - * @param charNames an array of {@link java.lang.String} objects - * @param charFlowrate an array of {@link double} objects - * @param molarMass an array of {@link double} objects + * @param charNames an array of {@link java.lang.String} objects + * @param charFlowrate an array of {@link double} objects + * @param molarMass an array of {@link double} objects * @param relativedensity an array of {@link double} objects */ public void addCharacterized(String[] charNames, double[] charFlowrate, double[] molarMass, diff --git a/src/main/java/neqsim/thermo/system/SystemThermo.java b/src/main/java/neqsim/thermo/system/SystemThermo.java index 987d89675c..960a203470 100644 --- a/src/main/java/neqsim/thermo/system/SystemThermo.java +++ b/src/main/java/neqsim/thermo/system/SystemThermo.java @@ -731,19 +731,24 @@ public double getFlowRate(String flowunit) { return totalNumberOfMoles * getMolarMass() * 3600.0 / getIdealLiquidDensity("kg/m3"); } else if (flowunit.equals("Sm3/sec")) { return totalNumberOfMoles * ThermodynamicConstantsInterface.R - * ThermodynamicConstantsInterface.standardStateTemperature / 101325.0; + * ThermodynamicConstantsInterface.standardStateTemperature + / ThermodynamicConstantsInterface.atm; } else if (flowunit.equals("Sm3/hr")) { return totalNumberOfMoles * 3600.0 * ThermodynamicConstantsInterface.R - * ThermodynamicConstantsInterface.standardStateTemperature / 101325.0; + * ThermodynamicConstantsInterface.standardStateTemperature + / ThermodynamicConstantsInterface.atm; } else if (flowunit.equals("Sm3/day")) { return totalNumberOfMoles * 3600.0 * 24.0 * ThermodynamicConstantsInterface.R - * ThermodynamicConstantsInterface.standardStateTemperature / 101325.0; + * ThermodynamicConstantsInterface.standardStateTemperature + / ThermodynamicConstantsInterface.atm; } else if (flowunit.equals("MSm3/day")) { return totalNumberOfMoles * 3600.0 * 24.0 * ThermodynamicConstantsInterface.R - * ThermodynamicConstantsInterface.standardStateTemperature / 101325.0 / 1.0e6; + * ThermodynamicConstantsInterface.standardStateTemperature + / ThermodynamicConstantsInterface.atm / 1.0e6; } else if (flowunit.equals("MSm3/hr")) { return totalNumberOfMoles * 3600.0 * ThermodynamicConstantsInterface.R - * ThermodynamicConstantsInterface.standardStateTemperature / 101325.0 / 1.0e6; + * ThermodynamicConstantsInterface.standardStateTemperature + / ThermodynamicConstantsInterface.atm / 1.0e6; } else if (flowunit.equals("mole/sec")) { return totalNumberOfMoles; } else if (flowunit.equals("mole/min")) { @@ -803,7 +808,7 @@ public void addTBPfraction(String componentName, double numberOfMoles, double mo try { refSystem = this.getClass().getDeclaredConstructor().newInstance(); refSystem.setTemperature(273.15 + 15.0); - refSystem.setPressure(1.01325); + refSystem.setPressure(ThermodynamicConstantsInterface.referencePressure); refSystem.addComponent("default", 1.0, 273.15, 50.0, 0.1); refSystem.init(0); refSystem.setNumberOfPhases(1); @@ -818,7 +823,7 @@ public void addTBPfraction(String componentName, double numberOfMoles, double mo // Math.pow((molarMass/5.805e-5*Math.pow(density,0.9371)), 1.0/2.3776); // acs = TBPfractionModel.calcAcentricFactor(molarMass, density); // System.out.println("acentric " + acs); - // 3.0/7.0*Math.log10(PC/1.01325)/(TC/TB-1.0)-1.0; + // 3.0/7.0*Math.log10(PC/ThermodynamicConstantsInterface.referencePressure)/(TC/TB-1.0)-1.0; molarMass /= 1000.0; for (int i = 0; i < refSystem.getNumberOfPhases(); i++) { @@ -836,7 +841,7 @@ public void addTBPfraction(String componentName, double numberOfMoles, double mo } refSystem.setTemperature(273.15 + 15.0); - refSystem.setPressure(1.01325); + refSystem.setPressure(ThermodynamicConstantsInterface.referencePressure); refSystem.init(1); // refSystem.display(); racketZ = characterization.getTBPModel().calcRacketZ(refSystem, molarMass * 1000.0, density); @@ -854,7 +859,7 @@ public void addTBPfraction(String componentName, double numberOfMoles, double mo // refSystem.getPhase(1).getComponent(0).setRacketZ(racketZ); // // refSystem.setTemperature(273.15+80.0); - // // refSystem.setPressure(1.01325); + // // refSystem.setPressure(ThermodynamicConstantsInterface.referencePressure); // // refSystem.init(1); // //refSystem.initPhysicalProperties(); // // APIdens - refSystem.getPhase(1).getPhysicalProperties().getDensity(); @@ -863,8 +868,8 @@ public void addTBPfraction(String componentName, double numberOfMoles, double mo logger.error(ex.getMessage(), ex); } - double critVol = characterization.getTBPModel().calcCriticalVolume(molarMass * 1000, density); // 0.2918-0.0928* - // acs)*8.314*TC/PC*10.0; + double critVol = characterization.getTBPModel().calcCriticalVolume(molarMass * 1000, density); + // 0.2918-0.0928*acs)*ThermodynamicConstantsInterface.R*TC/PC*10.0; addComponent(componentName, numberOfMoles, TC, PC, acs); double Kwatson = Math.pow(TB * 1.8, 1.0 / 3.0) / density; // System.out.println("watson " + Kwatson); @@ -945,7 +950,7 @@ public void addTBPfraction(String componentName, double numberOfMoles, double mo try { refSystem = this.getClass().getDeclaredConstructor().newInstance(); refSystem.setTemperature(273.15 + 15.0); - refSystem.setPressure(1.01325); + refSystem.setPressure(ThermodynamicConstantsInterface.referencePressure); refSystem.addComponent("default", 1.0, 273.15, 50.0, 0.1); refSystem.init(0); refSystem.setNumberOfPhases(1); @@ -977,7 +982,7 @@ public void addTBPfraction(String componentName, double numberOfMoles, double mo } refSystem.setTemperature(273.15 + 15.0); - refSystem.setPressure(1.01325); + refSystem.setPressure(ThermodynamicConstantsInterface.referencePressure); refSystem.init(1); // refSystem.display(); racketZ = characterization.getTBPModel().calcRacketZ(refSystem, molarMass * 1000.0, density); @@ -995,7 +1000,7 @@ public void addTBPfraction(String componentName, double numberOfMoles, double mo // refSystem.getPhase(1).getComponent(0).setRacketZ(racketZ); // // refSystem.setTemperature(273.15+80.0); - // // refSystem.setPressure(1.01325); + // // refSystem.setPressure(ThermodynamicConstantsInterface.referencePressure); // // refSystem.init(1); // // refSystem.initPhysicalProperties(); // // APIdens - refSystem.getPhase(1).getPhysicalProperties().getDensity(); @@ -1005,7 +1010,7 @@ public void addTBPfraction(String componentName, double numberOfMoles, double mo } double critVol = characterization.getTBPModel().calcCriticalVolume(molarMass * 1000, density); // 0.2918-0.0928* - // acs)*8.314*TC/PC*10.0; + // acs)*ThermodynamicConstantsInterface.R*TC/PC*10.0; addComponent(componentName, numberOfMoles, TC, PC, acs); double Kwatson = Math.pow(TB * 1.8, 1.0 / 3.0) / density; // System.out.println("watson " + Kwatson); @@ -2868,7 +2873,8 @@ public double getDensity(String unit) { conversionFactor = 0.0624279606; break; case "kg/Sm3": - return getMolarMass() * 101325.0 / ThermodynamicConstantsInterface.R + return getMolarMass() * ThermodynamicConstantsInterface.atm + / ThermodynamicConstantsInterface.R / ThermodynamicConstantsInterface.standardStateTemperature; case "mol/m3": conversionFactor = 1.0 / getMolarMass(); diff --git a/src/main/java/neqsim/thermo/util/GERG/GERG2008.java b/src/main/java/neqsim/thermo/util/GERG/GERG2008.java index 88f45f3f53..d1fb9b2ae1 100644 --- a/src/main/java/neqsim/thermo/util/GERG/GERG2008.java +++ b/src/main/java/neqsim/thermo/util/GERG/GERG2008.java @@ -14,57 +14,57 @@ */ public class GERG2008 { // Variables containing the common parameters in the GERG-2008 equations - double RGERG; - int NcGERG = 21; - int MaxFlds = 21; - int MaxMdl = 10; - int MaxTrmM = 12; - int MaxTrmP = 24; - double epsilon = 1e-15; - int[][] intcoik = new int[MaxFlds + 1][MaxTrmP + 1]; - int[][] coik = new int[MaxFlds + 1][MaxTrmP + 1]; - int[][] doik = new int[MaxFlds + 1][MaxTrmP + 1]; - int[][] dijk = new int[MaxMdl + 1][MaxTrmM + 1]; - - double Drold; - double Trold; - double Told; - double Trold2; - double[] xold = new double[MaxFlds + 1]; - int[][] mNumb = new int[MaxFlds + 1][MaxFlds + 1]; - int[] kpol = new int[MaxFlds + 1]; - int[] kexp = new int[MaxFlds + 1]; - int[] kpolij = new int[MaxMdl + 1]; - int[] kexpij = new int[MaxMdl + 1]; - - double[] Dc = new double[MaxFlds + 1]; - double[] Tc = new double[MaxFlds + 1]; - double[] MMiGERG = new double[MaxFlds + 1]; - double[] Vc3 = new double[MaxFlds + 1]; - double[] Tc2 = new double[MaxFlds + 1]; - - double[][] noik = new double[MaxFlds + 1][MaxTrmP + 1]; - double[][] toik = new double[MaxFlds + 1][MaxTrmP + 1]; - - double[][] cijk = new double[MaxMdl + 1][MaxTrmM + 1]; - - double[][] eijk = new double[MaxMdl + 1][MaxTrmM + 1]; - double[][] gijk = new double[MaxMdl + 1][MaxTrmM + 1]; - double[][] nijk = new double[MaxMdl + 1][MaxTrmM + 1]; - double[][] tijk = new double[MaxMdl + 1][MaxTrmM + 1]; - - double[][] btij = new double[MaxFlds + 1][MaxFlds + 1]; - double[][] bvij = new double[MaxFlds + 1][MaxFlds + 1]; - double[][] gtij = new double[MaxFlds + 1][MaxFlds + 1]; - double[][] gvij = new double[MaxFlds + 1][MaxFlds + 1]; - - double[][] fij = new double[MaxFlds + 1][MaxFlds + 1]; - double[][] th0i = new double[MaxFlds + 1][7 + 1]; - double[][] n0i = new double[MaxFlds + 1][7 + 1]; - - double[][] taup = new double[MaxFlds + 1][MaxTrmP + 1]; - double[][] taupijk = new double[MaxFlds + 1][MaxTrmM + 1]; - double dPdDsave; + double RGERG; + int NcGERG = 21; + int MaxFlds = 21; + int MaxMdl = 10; + int MaxTrmM = 12; + int MaxTrmP = 24; + double epsilon = 1e-15; + int[][] intcoik = new int[MaxFlds + 1][MaxTrmP + 1]; + int[][] coik = new int[MaxFlds + 1][MaxTrmP + 1]; + int[][] doik = new int[MaxFlds + 1][MaxTrmP + 1]; + int[][] dijk = new int[MaxMdl + 1][MaxTrmM + 1]; + + double Drold; + double Trold; + double Told; + double Trold2; + double[] xold = new double[MaxFlds + 1]; + int[][] mNumb = new int[MaxFlds + 1][MaxFlds + 1]; + int[] kpol = new int[MaxFlds + 1]; + int[] kexp = new int[MaxFlds + 1]; + int[] kpolij = new int[MaxMdl + 1]; + int[] kexpij = new int[MaxMdl + 1]; + + double[] Dc = new double[MaxFlds + 1]; + double[] Tc = new double[MaxFlds + 1]; + double[] MMiGERG = new double[MaxFlds + 1]; + double[] Vc3 = new double[MaxFlds + 1]; + double[] Tc2 = new double[MaxFlds + 1]; + + double[][] noik = new double[MaxFlds + 1][MaxTrmP + 1]; + double[][] toik = new double[MaxFlds + 1][MaxTrmP + 1]; + + double[][] cijk = new double[MaxMdl + 1][MaxTrmM + 1]; + + double[][] eijk = new double[MaxMdl + 1][MaxTrmM + 1]; + double[][] gijk = new double[MaxMdl + 1][MaxTrmM + 1]; + double[][] nijk = new double[MaxMdl + 1][MaxTrmM + 1]; + double[][] tijk = new double[MaxMdl + 1][MaxTrmM + 1]; + + double[][] btij = new double[MaxFlds + 1][MaxFlds + 1]; + double[][] bvij = new double[MaxFlds + 1][MaxFlds + 1]; + double[][] gtij = new double[MaxFlds + 1][MaxFlds + 1]; + double[][] gvij = new double[MaxFlds + 1][MaxFlds + 1]; + + double[][] fij = new double[MaxFlds + 1][MaxFlds + 1]; + double[][] th0i = new double[MaxFlds + 1][7 + 1]; + double[][] n0i = new double[MaxFlds + 1][7 + 1]; + + double[][] taup = new double[MaxFlds + 1][MaxTrmP + 1]; + double[][] taupijk = new double[MaxFlds + 1][MaxTrmM + 1]; + double dPdDsave; /** *

@@ -74,7 +74,7 @@ public class GERG2008 { * @param x an array of {@link double} objects * @param Mm a {@link org.netlib.util.doubleW} object */ - public void MolarMassGERG(double[] x, doubleW Mm) { + public void MolarMassGERG(double[] x, doubleW Mm) { // Sub MolarMassGERG(x, Mm) // Calculate molar mass of the mixture with the compositions contained in the @@ -107,7 +107,7 @@ public void MolarMassGERG(double[] x, doubleW Mm) { * @param P a {@link org.netlib.util.doubleW} object * @param Z a {@link org.netlib.util.doubleW} object */ - public void PressureGERG(double T, double D, double[] x, doubleW P, doubleW Z) { + public void PressureGERG(double T, double D, double[] x, doubleW P, doubleW Z) { // Sub PressureGERG(T, D, x, P, Z) // Calculate pressure as a function of temperature and density. The derivative @@ -156,7 +156,7 @@ public void PressureGERG(double T, double D, double[] x, doubleW P, doubleW Z) * @param ierr a {@link org.netlib.util.intW} object * @param herr a {@link org.netlib.util.StringW} object */ - public void DensityGERG(int iFlag, double T, double P, double[] x, doubleW D, intW ierr, + public void DensityGERG(int iFlag, double T, double P, double[] x, doubleW D, intW ierr, StringW herr) { // Sub DensityGERG(iFlag, T, P, x, D, ierr, herr) @@ -352,9 +352,9 @@ public void DensityGERG(int iFlag, double T, double P, double[] x, doubleW D, i * @param Kappa a {@link org.netlib.util.doubleW} object * @param A a {@link org.netlib.util.doubleW} object */ - public void PropertiesGERG(double T, double D, double[] x, doubleW P, doubleW Z, - doubleW dPdD, doubleW d2PdD2, doubleW d2PdTD, doubleW dPdT, doubleW U, doubleW H, doubleW S, - doubleW Cv, doubleW Cp, doubleW W, doubleW G, doubleW JT, doubleW Kappa, doubleW A) { + public void PropertiesGERG(double T, double D, double[] x, doubleW P, doubleW Z, doubleW dPdD, + doubleW d2PdD2, doubleW d2PdTD, doubleW dPdT, doubleW U, doubleW H, doubleW S, doubleW Cv, + doubleW Cp, doubleW W, doubleW G, doubleW JT, doubleW Kappa, doubleW A) { // Sub PropertiesGERG(T, D, x, P, Z, dPdD, d2PdD2, d2PdTD, dPdT, U, H, S, Cv, // Cp, W, G, JT, Kappa, A) @@ -456,7 +456,7 @@ public void PropertiesGERG(double T, double D, double[] x, doubleW P, doubleW Z * @param Dr ... */ // The following routines are low-level routines that should not be called outside of this code. - void ReducingParametersGERG(double[] x, doubleW Tr, doubleW Dr) { + void ReducingParametersGERG(double[] x, doubleW Tr, doubleW Dr) { // Private Sub ReducingParametersGERG(x, Tr, Dr) // Calculate reducing variables. Only need to call this if the composition has @@ -521,7 +521,7 @@ void ReducingParametersGERG(double[] x, doubleW Tr, doubleW Dr) { * @param x ... * @param a0 ... */ - void Alpha0GERG(double T, double D, double[] x, doubleW[] a0) { + void Alpha0GERG(double T, double D, double[] x, doubleW[] a0) { // Private Sub Alpha0GERG(T, D, x, a0) // Calculate the ideal gas Helmholtz energy and its derivatives with respect to @@ -601,7 +601,7 @@ void Alpha0GERG(double T, double D, double[] x, doubleW[] a0) { * @param x .... * @param ar ... */ - void AlpharGERG(int itau, int idelta, double T, double D, double[] x, doubleW[][] ar) { + void AlpharGERG(int itau, int idelta, double T, double D, double[] x, doubleW[][] ar) { // Private Sub AlpharGERG(itau, idelta, T, D, x, ar) // Calculate dimensionless residual Helmholtz energy and its derivatives with @@ -760,7 +760,7 @@ void AlpharGERG(int itau, int idelta, double T, double D, double[] x, doubleW[][ * @param lntau ... * @param x .... */ - void tTermsGERG(double lntau, double[] x) { + void tTermsGERG(double lntau, double[] x) { // Private Sub tTermsGERG(lntau, x) // Calculate temperature dependent parts of the GERG-2008 equation of state @@ -808,7 +808,7 @@ void tTermsGERG(double lntau, double[] x) { * @param Tcx temperature in Kelvin * @param Dcx density */ - void PseudoCriticalPointGERG(double[] x, doubleW Tcx, doubleW Dcx) { + void PseudoCriticalPointGERG(double[] x, doubleW Tcx, doubleW Dcx) { // PseudoCriticalPointGERG(x, Tcx, Dcx) // Calculate a pseudo critical point as the mole fraction average of the @@ -833,7 +833,7 @@ void PseudoCriticalPointGERG(double[] x, doubleW Tcx, doubleW Dcx) { * SetupGERG. *

*/ - public void SetupGERG() { + public void SetupGERG() { // Initialize all the constants and parameters in the GERG-2008 model. // Some values are modified for calculations that do not depend on T, D, and x in order to // speed up the program. @@ -845,6 +845,7 @@ public void SetupGERG() { double T0; double d0; + // ThermodynamicConstantsInterface.R RGERG = 8.314472; Rs = 8.31451; Rsr = Rs / RGERG; @@ -3249,14 +3250,14 @@ public static void main(String[] args) { test.MolarMassGERG(x, Mm); - // System.out.println("mol mass " + Mm.val); + // System.out.println("mol mass " + Mm.val); - test.PressureGERG(T, D.val, x, P, Z); + test.PressureGERG(T, D.val, x, P, Z); - System.out.println("pressure " + P.val); - System.out.println("Z " + Z.val); + System.out.println("pressure " + P.val); + System.out.println("Z " + Z.val); - test.DensityGERG(iFlag, T, P.val, x, D, ierr, herr); + test.DensityGERG(iFlag, T, P.val, x, D, ierr, herr); System.out.println("density " + D.val); doubleW dPdD = new doubleW(0.0d); @@ -3276,8 +3277,8 @@ public static void main(String[] args) { doubleW JT = new doubleW(0.0d); doubleW Kappa = new doubleW(0.0d); doubleW PP = new doubleW(0.0d); - test.PropertiesGERG(T, D.val, x, P, Z, dPdD, d2PdD2, d2PdTD, dPdT, U, H, S, Cv, Cp, W, G, - JT, Kappa, A); + test.PropertiesGERG(T, D.val, x, P, Z, dPdD, d2PdD2, d2PdTD, dPdT, U, H, S, Cv, Cp, W, G, JT, + Kappa, A); /* * // test.PressureGERG(400, 12.798286, x); String herr = ""; test.DensityGERG(0, T, P, x, ierr, diff --git a/src/main/java/neqsim/thermo/util/benchmark/TPflash_benchmark.java b/src/main/java/neqsim/thermo/util/benchmark/TPflash_benchmark.java index 83f89405b1..f269fdd783 100644 --- a/src/main/java/neqsim/thermo/util/benchmark/TPflash_benchmark.java +++ b/src/main/java/neqsim/thermo/util/benchmark/TPflash_benchmark.java @@ -27,7 +27,7 @@ public static void main(String args[]) { // SystemInterface testSystem = new SystemSrkCPAstatoil(303.15, 10.0); // SystemInterface testSystem = new SystemUMRPRUMCEos(303.0, 10.0); // SystemInterface testSystem = new SystemSrkSchwartzentruberEos(298.15, - // 1.01325); + // ThermodynamicConstantsInterface.referencePressure); ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem); testSystem.addComponent("nitrogen", 0.0028941); diff --git a/src/main/java/neqsim/thermo/util/benchmark/TPflash_benchmark_fullcomp.java b/src/main/java/neqsim/thermo/util/benchmark/TPflash_benchmark_fullcomp.java index bf6ca88889..a9f32f244a 100644 --- a/src/main/java/neqsim/thermo/util/benchmark/TPflash_benchmark_fullcomp.java +++ b/src/main/java/neqsim/thermo/util/benchmark/TPflash_benchmark_fullcomp.java @@ -28,7 +28,7 @@ public static void main(String args[]) { SystemInterface testSystem = new SystemSrkCPAstatoil(273.15 - 5.0, 10.0); // SystemInterface testSystem = new SystemSrkSchwartzentruberEos(298.15, - // 1.01325); + // ThermodynamicConstantsInterface.referencePressure); ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem); // testSystem.addComponent("CO2", 2.1); diff --git a/src/main/java/neqsim/thermo/util/empiric/BukacekWaterInGas.java b/src/main/java/neqsim/thermo/util/empiric/BukacekWaterInGas.java index e2d25a1580..0695911184 100644 --- a/src/main/java/neqsim/thermo/util/empiric/BukacekWaterInGas.java +++ b/src/main/java/neqsim/thermo/util/empiric/BukacekWaterInGas.java @@ -1,70 +1,85 @@ package neqsim.thermo.util.empiric; +import neqsim.thermo.ThermodynamicConstantsInterface; + /** - *

BukacekWaterInGas class.

+ *

+ * BukacekWaterInGas class. + *

* * @author asmund * @version $Id: $Id */ public class BukacekWaterInGas { - /* - * Calculates the ppm(mol) water content of a gas at its water dew point - */ - /** - *

getWaterInGas.

- * - * @param temperature a double - * @param pressure a double - * @return a double - */ - public static double getWaterInGas(double temperature, double pressure) { - double TCwater = 393.99+273.15, PCwater = 220.64; - double tau = (TCwater-temperature)/TCwater; - - double temp = (-7.85823*tau + 1.83991*Math.pow(tau, 1.5) - 11.7811*Math.pow(tau, 3.0) - + 22.67*Math.pow(tau, 3.5) - 15.9393*Math.pow(tau, 4.0) + 1.77516*Math.pow(tau, 7.5))/(1.0-tau); - double psw = PCwater*Math.exp(temp); - - double mgwaterSm3 = 761900.42*psw/pressure + 16.016*Math.pow(10.0, -1716.26/(temperature) + 6.69449); - - double molarMassGas = 0.6*28.0*1000.0; // mgr/mol - - double ans = mgwaterSm3/molarMassGas; // mol water /Sm3 gas - - double molgasSm3 = 101325.0/(8.314*288.15); // mol gas/ Sm3 - - return ans / molgasSm3; - } - - /** - *

waterDewPointTemperature.

- * - * @param moleFractionWaterInGas a double - * @param pressure a double - * @return a double - */ - public static double waterDewPointTemperature(double moleFractionWaterInGas, double pressure) { - int iter = 0; - double newppm, newTemp = 273.15; - do { - iter++; + /* + * Calculates the ppm(mol) water content of a gas at its water dew point + */ + /** + *

+ * getWaterInGas. + *

+ * + * @param temperature a double + * @param pressure a double + * @return a double + */ + public static double getWaterInGas(double temperature, double pressure) { + double TCwater = 393.99 + 273.15, PCwater = 220.64; + double tau = (TCwater - temperature) / TCwater; + + double temp = (-7.85823 * tau + 1.83991 * Math.pow(tau, 1.5) - 11.7811 * Math.pow(tau, 3.0) + + 22.67 * Math.pow(tau, 3.5) - 15.9393 * Math.pow(tau, 4.0) + 1.77516 * Math.pow(tau, 7.5)) + / (1.0 - tau); + double psw = PCwater * Math.exp(temp); + + double mgwaterSm3 = + 761900.42 * psw / pressure + 16.016 * Math.pow(10.0, -1716.26 / (temperature) + 6.69449); + + double molarMassGas = 0.6 * 28.0 * 1000.0; // mgr/mol + + double ans = mgwaterSm3 / molarMassGas; // mol water /Sm3 gas + + double molgasSm3 = + ThermodynamicConstantsInterface.atm / (ThermodynamicConstantsInterface.R * 288.15); // mol + // gas/ + // Sm3 + + return ans / molgasSm3; + } + + /** + *

+ * waterDewPointTemperature. + *

+ * + * @param moleFractionWaterInGas a double + * @param pressure a double + * @return a double + */ + public static double waterDewPointTemperature(double moleFractionWaterInGas, double pressure) { + int iter = 0; + double newppm, newTemp = 273.15; + do { + iter++; - newppm = getWaterInGas(newTemp, pressure); - newTemp -= (newppm - moleFractionWaterInGas) * 1e5; - } while (Math.abs((newppm - moleFractionWaterInGas) / moleFractionWaterInGas) > 1e-8 - && iter < 1000); - return newTemp; - } + newppm = getWaterInGas(newTemp, pressure); + newTemp -= (newppm - moleFractionWaterInGas) * 1e5; + } while (Math.abs((newppm - moleFractionWaterInGas) / moleFractionWaterInGas) > 1e-8 + && iter < 1000); + return newTemp; + } - /** - *

main.

- * - * @param args an array of {@link java.lang.String} objects - */ - public static void main(String[] args) { - System.out.println("water in gas " + BukacekWaterInGas.getWaterInGas(273.15 - 18.0, 70.0)); + /** + *

+ * main. + *

+ * + * @param args an array of {@link java.lang.String} objects + */ + public static void main(String[] args) { + System.out.println("water in gas " + BukacekWaterInGas.getWaterInGas(273.15 - 18.0, 70.0)); - System.out.println("water dew point temperature " - + (BukacekWaterInGas.waterDewPointTemperature(20.0e-6, 70.0) - 273.15)); - } + System.out.println("water dew point temperature " + + (BukacekWaterInGas.waterDewPointTemperature(20.0e-6, 70.0) - 273.15)); + } } diff --git a/src/main/java/neqsim/thermo/util/empiric/DuanSun.java b/src/main/java/neqsim/thermo/util/empiric/DuanSun.java index 0059b9a19f..9484f333ed 100644 --- a/src/main/java/neqsim/thermo/util/empiric/DuanSun.java +++ b/src/main/java/neqsim/thermo/util/empiric/DuanSun.java @@ -2,6 +2,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.system.SystemElectrolyteCPAstatoil; import neqsim.thermo.system.SystemInterface; import neqsim.thermodynamicOperations.ThermodynamicOperations; @@ -69,7 +70,7 @@ public double bublePointPressure(double temperature, double x_CO2, double salini // System.out.println(SUMY); // System.out.println(y[0]); - double R = 8.314 * Math.pow(10.0, -2.0); + double R = ThermodynamicConstantsInterface.R * Math.pow(10.0, -2.0); // Calculate A and B of pure compound double[] Tr = {0.0, 0.0}; @@ -267,13 +268,13 @@ public double bublePointPressure(double temperature, double x_CO2, double salini double VCO2INF = 0.0; - VCO2INF = (-159751499.972988 * Math.pow(10.0, -10.0)) - + (101831855.926854 * Math.pow(10.0, -10)) * S - + (18075168.978622 * Math.pow(10.0, -11.0)) * T - - (787538191.939352 * Math.pow(10.0, -13.0)) * S * T - - (192886808.345857 * Math.pow(10.0, -11.0)) * (Math.pow(S, 2.0)) - + 142830810.095592 * Math.pow(10.0, -15.0) * S * (Math.pow(T, 2.0)) - + (123450785.102997 * Math.pow(10.0, -13.0)) * T * (Math.pow(S, 2.0)) + VCO2INF = + (-159751499.972988 * Math.pow(10.0, -10.0)) + (101831855.926854 * Math.pow(10.0, -10)) * S + + (18075168.978622 * Math.pow(10.0, -11.0)) * T + - (787538191.939352 * Math.pow(10.0, -13.0)) * S * T + - (192886808.345857 * Math.pow(10.0, -11.0)) * (Math.pow(S, 2.0)) + + 142830810.095592 * Math.pow(10.0, -15.0) * S * (Math.pow(T, 2.0)) + + (123450785.102997 * Math.pow(10.0, -13.0)) * T * (Math.pow(S, 2.0)) - (220053285.910771 * Math.pow(10.0, -16.0)) * (Math.pow(S, 2.0)) * (Math.pow(T, 2.0)) - 35351000.350961 * Math.pow(10.0, -17.0) * (Math.pow(T, 3.0)); diff --git a/src/main/java/neqsim/thermo/util/readwrite/EclipseFluidReadWrite.java b/src/main/java/neqsim/thermo/util/readwrite/EclipseFluidReadWrite.java index a483b7b0eb..009145fc27 100644 --- a/src/main/java/neqsim/thermo/util/readwrite/EclipseFluidReadWrite.java +++ b/src/main/java/neqsim/thermo/util/readwrite/EclipseFluidReadWrite.java @@ -6,6 +6,7 @@ import java.util.ArrayList; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.phase.PhaseEosInterface; import neqsim.thermo.system.SystemInterface; @@ -133,8 +134,8 @@ public static SystemInterface read(String inputFile, String pseudoNameIn) { * @return a {@link neqsim.thermo.system.SystemInterface} object */ public static SystemInterface read(String inputFile) { - neqsim.thermo.system.SystemInterface fluid = - new neqsim.thermo.system.SystemSrkEos(288.15, 1.01325); + neqsim.thermo.system.SystemInterface fluid = new neqsim.thermo.system.SystemSrkEos(288.15, + ThermodynamicConstantsInterface.referencePressure); double[][] kij = null; try (BufferedReader br = new BufferedReader(new FileReader(new File(inputFile)))) { @@ -158,11 +159,14 @@ public static SystemInterface read(String inputFile) { if (st.trim().equals("EOS")) { EOS = br.readLine().replace("/", ""); if (EOS.contains("SRK")) { - fluid = new neqsim.thermo.system.SystemSrkEos(288.15, 100.01325); + fluid = new neqsim.thermo.system.SystemSrkEos(288.15, + ThermodynamicConstantsInterface.referencePressure); } else if (EOS.contains("PR")) { - fluid = new neqsim.thermo.system.SystemPrEos(288.15, 1.01325); + fluid = new neqsim.thermo.system.SystemPrEos(288.15, + ThermodynamicConstantsInterface.referencePressure); } else if (EOS.contains("PR78")) { - fluid = new neqsim.thermo.system.SystemPrEos1978(288.15, 1.01325); + fluid = new neqsim.thermo.system.SystemPrEos1978(288.15, + ThermodynamicConstantsInterface.referencePressure); } } if (st.equals("CNAMES")) { diff --git a/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorKeywordFormat.java b/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorKeywordFormat.java index 670260bd48..77bc570676 100644 --- a/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorKeywordFormat.java +++ b/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorKeywordFormat.java @@ -7,6 +7,7 @@ import java.io.Writer; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.system.SystemInterface; import neqsim.thermodynamicOperations.ThermodynamicOperations; @@ -25,7 +26,7 @@ public class OLGApropertyTableGeneratorKeywordFormat SystemInterface thermoSystem = null; ThermodynamicOperations thermoOps = null; - double stdPres = 1.01325; + double stdPres = ThermodynamicConstantsInterface.referencePressure; double stdPresATM = 1; double stdTemp = 288.15; double[] molfracs; diff --git a/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWater.java b/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWater.java index fc6edbf503..01591076ef 100644 --- a/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWater.java +++ b/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWater.java @@ -10,6 +10,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import Jama.Matrix; +import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.system.SystemInterface; import neqsim.thermo.system.SystemSrkCPAstatoil; import neqsim.thermo.system.SystemSrkEos; @@ -243,7 +244,7 @@ public double[] calcBubT(double[] pressures) { */ public void initCalc() { double stdTemp = 288.15; - double stdPres = 1.01325; + double stdPres = ThermodynamicConstantsInterface.referencePressure; // double GOR, GLR; double[] molfracs = new double[thermoSystem.getPhase(0).getNumberOfComponents()]; double[] MW = new double[thermoSystem.getPhase(0).getNumberOfComponents()]; diff --git a/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWaterEven.java b/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWaterEven.java index 2df3f6599a..9640ce97bb 100644 --- a/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWaterEven.java +++ b/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWaterEven.java @@ -7,6 +7,7 @@ import java.io.Writer; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.system.SystemInterface; import neqsim.thermodynamicOperations.ThermodynamicOperations; @@ -207,7 +208,7 @@ public double[] calcBubT(double[] pressures) { */ public void initCalc() { double stdTemp = 288.15; - double stdPres = 1.01325; + double stdPres = ThermodynamicConstantsInterface.referencePressure; // double GOR, GLR; double[] molfracs = new double[thermoSystem.getPhase(0).getNumberOfComponents()]; double[] MW = new double[thermoSystem.getPhase(0).getNumberOfComponents()]; diff --git a/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWaterKeywordFormat.java b/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWaterKeywordFormat.java index e1647e3f51..a96467f600 100644 --- a/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWaterKeywordFormat.java +++ b/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWaterKeywordFormat.java @@ -7,6 +7,7 @@ import java.io.Writer; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.system.SystemInterface; import neqsim.thermodynamicOperations.ThermodynamicOperations; @@ -25,7 +26,7 @@ public class OLGApropertyTableGeneratorWaterKeywordFormat SystemInterface thermoSystem = null; ThermodynamicOperations thermoOps = null; - double stdPres = 1.01325; + double stdPres = ThermodynamicConstantsInterface.referencePressure; double stdPresATM = 1; double stdTemp = 288.15; double[] molfracs; diff --git a/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWaterStudents.java b/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWaterStudents.java index 5132b0b2ea..7286025174 100644 --- a/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWaterStudents.java +++ b/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWaterStudents.java @@ -8,6 +8,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import Jama.Matrix; +import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.system.SystemInterface; import neqsim.thermo.system.SystemSrkCPAstatoil; import neqsim.thermo.system.SystemSrkEos; @@ -255,7 +256,7 @@ public double[] calcBubT(double[] pressures) { */ public void initCalc() { double stdTemp = 288.15; - double stdPres = 1.01325; + double stdPres = ThermodynamicConstantsInterface.referencePressure; // double GOR, GLR; double[] molfracs = new double[thermoSystem.getPhase(0).getNumberOfComponents()]; double[] MW = new double[thermoSystem.getPhase(0).getNumberOfComponents()]; diff --git a/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWaterStudentsPH.java b/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWaterStudentsPH.java index ee015defa8..bffa4a432d 100644 --- a/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWaterStudentsPH.java +++ b/src/main/java/neqsim/thermodynamicOperations/propertyGenerator/OLGApropertyTableGeneratorWaterStudentsPH.java @@ -8,6 +8,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import Jama.Matrix; +import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.system.SystemInterface; import neqsim.thermo.system.SystemSrkCPAstatoil; import neqsim.thermo.system.SystemSrkEos; @@ -253,7 +254,7 @@ public double[] calcBubT(double[] pressures) { */ public void initCalc() { double stdTemp = 288.15; - double stdPres = 1.01325; + double stdPres = ThermodynamicConstantsInterface.referencePressure; // double GOR, GLR; double[] molfracs = new double[thermoSystem.getPhase(0).getNumberOfComponents()]; double[] MW = new double[thermoSystem.getPhase(0).getNumberOfComponents()]; diff --git a/src/main/java/neqsim/util/database/NeqSimDataBase.java b/src/main/java/neqsim/util/database/NeqSimDataBase.java index 359699b00e..ba3860c5f6 100644 --- a/src/main/java/neqsim/util/database/NeqSimDataBase.java +++ b/src/main/java/neqsim/util/database/NeqSimDataBase.java @@ -55,7 +55,6 @@ public class NeqSimDataBase *

*/ public NeqSimDataBase() { - setDataBaseType(dataBaseType); try { diff --git a/src/main/java/neqsim/util/unit/BaseUnit.java b/src/main/java/neqsim/util/unit/BaseUnit.java index 65f31d4faa..4ec4bdcf49 100644 --- a/src/main/java/neqsim/util/unit/BaseUnit.java +++ b/src/main/java/neqsim/util/unit/BaseUnit.java @@ -8,47 +8,48 @@ * @author esol * @version $Id: $Id */ -public class BaseUnit implements Unit, neqsim.thermo.ThermodynamicConstantsInterface { - private static final long serialVersionUID = 1000; - - protected double SIvalue = 0.0, invalue = 0.0, factor = 1.0; - protected String inunit = null; - - /** - *

- * Constructor for BaseUnit. - *

- */ - public BaseUnit() {} - - /** - *

- * Constructor for BaseUnit. - *

- * - * @param value a double - * @param name a {@link java.lang.String} object - */ - public BaseUnit(double value, String name) { - this.invalue = value; - this.inunit = name; - } - - /** {@inheritDoc} */ - @Override - public double getSIvalue() { - return SIvalue; - } - - /** {@inheritDoc} */ - @Override - public double getValue(String fromunit) { - return 0.0; - } - - /** {@inheritDoc} */ - @Override - public double getValue(double val, String fromunit, String tounit) { - return 0.0; - } +public abstract class BaseUnit implements Unit, neqsim.thermo.ThermodynamicConstantsInterface { + private static final long serialVersionUID = 1000; + + /** Process value in SI units */ + protected double SIvalue = 0.0; + + /** Process value in given unit */ + protected double invalue = 0.0; + /** Unit of process value */ + protected String inunit = null; + + /** Conversion factor */ + protected double factor = 1.0; + + /** + *

+ * Constructor for BaseUnit. + *

+ * + * @param value a double + * @param name a {@link java.lang.String} object + */ + public BaseUnit(double value, String name) { + this.invalue = value; + this.inunit = name; + } + + /** {@inheritDoc} */ + @Override + public double getSIvalue() { + return SIvalue; + } + + /** {@inheritDoc} */ + @Override + public double getValue(String fromunit) { + return 0.0; + } + + /** {@inheritDoc} */ + @Override + public double getValue(double val, String fromunit, String tounit) { + return 0.0; + } } diff --git a/src/main/java/neqsim/util/unit/LengthUnit.java b/src/main/java/neqsim/util/unit/LengthUnit.java index 8eb5b2538c..f19048778a 100644 --- a/src/main/java/neqsim/util/unit/LengthUnit.java +++ b/src/main/java/neqsim/util/unit/LengthUnit.java @@ -17,10 +17,16 @@ public class LengthUnit extends neqsim.util.unit.BaseUnit { private static final long serialVersionUID = 1000; + /** *

* Constructor for LengthUnit. *

+ * + * @param value + * @param name */ - public LengthUnit() {} + public LengthUnit(double value, String name) { + super(value, name); + } } diff --git a/src/main/java/neqsim/util/unit/RateUnit.java b/src/main/java/neqsim/util/unit/RateUnit.java index 15d47b6e12..21bf9714e5 100644 --- a/src/main/java/neqsim/util/unit/RateUnit.java +++ b/src/main/java/neqsim/util/unit/RateUnit.java @@ -67,9 +67,11 @@ public double getValue(String tounit) { */ public double getConversionFactor(String name) { double mol_m3 = 0.0; - double mol_Sm3 = 101325.0 / (ThermodynamicConstantsInterface.R * standardStateTemperature); + double mol_Sm3 = ThermodynamicConstantsInterface.atm + / (ThermodynamicConstantsInterface.R * standardStateTemperature); if (boilp < 25) { - mol_m3 = 101325.0 / (ThermodynamicConstantsInterface.R * standardStateTemperature); + mol_m3 = ThermodynamicConstantsInterface.atm + / (ThermodynamicConstantsInterface.R * standardStateTemperature); } else { mol_m3 = 1.0 / (molarmass) * stddens * 1000; } diff --git a/src/main/java/neqsim/util/unit/TimeUnit.java b/src/main/java/neqsim/util/unit/TimeUnit.java index f02de44c77..2635ed108f 100644 --- a/src/main/java/neqsim/util/unit/TimeUnit.java +++ b/src/main/java/neqsim/util/unit/TimeUnit.java @@ -21,6 +21,12 @@ public class TimeUnit extends neqsim.util.unit.BaseUnit { *

* Constructor for TimeUnit. *

+ * + * @param value + * @param name */ - public TimeUnit() {} + public TimeUnit(double value, String name) { + super(value, name); + } + } diff --git a/src/main/java/neqsim/util/unit/Unit.java b/src/main/java/neqsim/util/unit/Unit.java index 77306bd9f9..cde4b08c2d 100644 --- a/src/main/java/neqsim/util/unit/Unit.java +++ b/src/main/java/neqsim/util/unit/Unit.java @@ -26,11 +26,11 @@ public interface Unit { /** *

- * getValue. + * Get process value in specified unit. *

* - * @param tounit a {@link java.lang.String} object - * @return a double + * @param tounit Unit to get process value in. + * @return Value converted to the specified unit. */ double getValue(String tounit); diff --git a/src/test/java/neqsim/PVTsimulation/simulation/SeparatorTestTest.java b/src/test/java/neqsim/PVTsimulation/simulation/SeparatorTestTest.java index de15436844..d27e28ddbf 100644 --- a/src/test/java/neqsim/PVTsimulation/simulation/SeparatorTestTest.java +++ b/src/test/java/neqsim/PVTsimulation/simulation/SeparatorTestTest.java @@ -2,6 +2,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import org.junit.jupiter.api.Test; +import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.system.SystemInterface; import neqsim.thermo.system.SystemSrkEos; @@ -39,7 +40,8 @@ void testRunCalc() { SeparatorTest sepSim = new SeparatorTest(tempSystem); double[] temps = {313.15, 313.15, 313.15, 313.15, 313.15, 313.15, 313.15}; - double[] pres = {500, 400, 200, 100, 50.0, 5.0, 1.01325}; + double[] pres = + {500, 400, 200, 100, 50.0, 5.0, ThermodynamicConstantsInterface.referencePressure}; sepSim.setSeparatorConditions(temps, pres); sepSim.runCalc(); diff --git a/src/test/java/neqsim/chemicalReactions/ChemicalReactionOperationsTest.java b/src/test/java/neqsim/chemicalReactions/ChemicalReactionOperationsTest.java new file mode 100644 index 0000000000..7766160dd5 --- /dev/null +++ b/src/test/java/neqsim/chemicalReactions/ChemicalReactionOperationsTest.java @@ -0,0 +1,26 @@ +package neqsim.chemicalReactions; + +import org.junit.jupiter.api.BeforeAll; +import neqsim.thermo.system.SystemSrkEos; + +public class ChemicalReactionOperationsTest { + + static SystemSrkEos testSystem; + + @BeforeAll + public void setUp() { + testSystem = new SystemSrkEos(303.3, 2.8); + + testSystem.addComponent("methane", 5.0, "kg/sec"); + // testSystem.addComponent("nitrogen", 100.0, "kg/sec"); + testSystem.addComponent("oxygen", 40.0, "kg/sec"); + testSystem.chemicalReactionInit(); + + testSystem.createDatabase(true); + testSystem.setMixingRule(2); + testSystem.init(0); + testSystem.setMaxNumberOfPhases(1); + testSystem.setNumberOfPhases(1); + testSystem.getChemicalReactionOperations().solveChemEq(0, 0); + } +} diff --git a/src/test/java/neqsim/physicalProperties/util/examples/TestCondensate.java b/src/test/java/neqsim/physicalProperties/util/examples/TestCondensate.java index 94779034af..915c06c25e 100644 --- a/src/test/java/neqsim/physicalProperties/util/examples/TestCondensate.java +++ b/src/test/java/neqsim/physicalProperties/util/examples/TestCondensate.java @@ -2,6 +2,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.system.SystemInterface; import neqsim.thermo.system.SystemPrEos; import neqsim.thermodynamicOperations.ThermodynamicOperations; @@ -26,8 +27,10 @@ public class TestCondensate { * @param args an array of {@link java.lang.String} objects */ public static void main(String args[]) { - // SystemInterface testSystem = new SystemSrkEos(273.15 + 15.0, 1.01325); - SystemInterface testSystem = new SystemPrEos(273.15 + 15.0, 1.01325); + // SystemInterface testSystem = new SystemSrkEos(273.15 + 15.0, + // ThermodynamicConstantsInterface.referencePressure); + SystemInterface testSystem = + new SystemPrEos(273.15 + 15.0, ThermodynamicConstantsInterface.referencePressure); // testSystem.getCharacterization().setTBPModel("PedersenSRKHeavyOil"); testSystem.setFluidName("Condensate1"); diff --git a/src/test/java/neqsim/processSimulation/processEquipment/pipeline/BeggsAndBrillsPipeTest.java b/src/test/java/neqsim/processSimulation/processEquipment/pipeline/BeggsAndBrillsPipeTest.java index 88faa5f747..7c515a8ff1 100644 --- a/src/test/java/neqsim/processSimulation/processEquipment/pipeline/BeggsAndBrillsPipeTest.java +++ b/src/test/java/neqsim/processSimulation/processEquipment/pipeline/BeggsAndBrillsPipeTest.java @@ -3,13 +3,15 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import neqsim.processSimulation.processEquipment.stream.Stream; +import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermodynamicOperations.ThermodynamicOperations; public class BeggsAndBrillsPipeTest { @Test public void testFlowNoVolumeCorrection() { neqsim.thermo.system.SystemInterface testSystem = - new neqsim.thermo.system.SystemSrkEos((273.15 + 15), 1.01325); + new neqsim.thermo.system.SystemSrkEos((273.15 + 15), + ThermodynamicConstantsInterface.referencePressure); testSystem.addComponent("nC10", 50, "MSm^3/day"); testSystem.setMixingRule(2); @@ -27,7 +29,8 @@ public void testFlowNoVolumeCorrection() { @Test public void testFlowVolumeCorrection() { neqsim.thermo.system.SystemInterface testSystem = - new neqsim.thermo.system.SystemSrkEos((273.15 + 15), 1.01325); + new neqsim.thermo.system.SystemSrkEos((273.15 + 15), + ThermodynamicConstantsInterface.referencePressure); testSystem.addComponent("nC10", 50, "MSm^3/day"); testSystem.setMixingRule(2); @@ -50,7 +53,8 @@ public void testPipeLineBeggsAndBrills() { double massFlowRate = 1100000.000000000; neqsim.thermo.system.SystemInterface testSystem = - new neqsim.thermo.system.SystemSrkEos((273.15 + 45), 1.01325); + new neqsim.thermo.system.SystemSrkEos((273.15 + 45), + ThermodynamicConstantsInterface.referencePressure); testSystem.addComponent("methane", 0.5); testSystem.addComponent("nC10", 0.5); @@ -98,7 +102,8 @@ public void testPipeLineBeggsAndBrills2() { double massFlowRate = 110000.000000000; neqsim.thermo.system.SystemInterface testSystem = - new neqsim.thermo.system.SystemSrkEos((273.15 + 45), 1.01325); + new neqsim.thermo.system.SystemSrkEos((273.15 + 45), + ThermodynamicConstantsInterface.referencePressure); testSystem.addComponent("methane", 0.5); testSystem.addComponent("nC10", 0.5); @@ -147,7 +152,8 @@ public void testPipeLineBeggsAndBrills3() { double massFlowRate = 110000.000000000; neqsim.thermo.system.SystemInterface testSystem = - new neqsim.thermo.system.SystemSrkEos((273.15 + 45), 1.01325); + new neqsim.thermo.system.SystemSrkEos((273.15 + 45), + ThermodynamicConstantsInterface.referencePressure); testSystem.addComponent("methane", 0.3); testSystem.addComponent("nC10", 0.4); @@ -211,7 +217,8 @@ public void testPipeLineBeggsAndBrills4() { double massFlowRate = 110000.000000000; neqsim.thermo.system.SystemInterface testSystem = - new neqsim.thermo.system.SystemSrkEos((273.15 + 45), 1.01325); + new neqsim.thermo.system.SystemSrkEos((273.15 + 45), + ThermodynamicConstantsInterface.referencePressure); testSystem.addComponent("methane", 1); testSystem.setMixingRule(2); @@ -247,7 +254,8 @@ public void testPipeLineBeggsAndBrills4() { neqsim.thermo.system.SystemInterface testSystem2 = - new neqsim.thermo.system.SystemSrkEos((273.15 + 45), 1.01325); + new neqsim.thermo.system.SystemSrkEos((273.15 + 45), + ThermodynamicConstantsInterface.referencePressure); testSystem2.addComponent("water", 1); testSystem2.setMixingRule(2); @@ -282,7 +290,8 @@ public void testPipeLineBeggsAndBrills4() { neqsim.thermo.system.SystemInterface testSystem3 = - new neqsim.thermo.system.SystemSrkEos((273.15 + 45), 1.01325); + new neqsim.thermo.system.SystemSrkEos((273.15 + 45), + ThermodynamicConstantsInterface.referencePressure); testSystem3.addComponent("ethane", 1); testSystem3.setMixingRule(2); diff --git a/src/test/java/neqsim/processSimulation/processEquipment/util/GORfitterTest.java b/src/test/java/neqsim/processSimulation/processEquipment/util/GORfitterTest.java index 86bca19a37..ce3c692c97 100644 --- a/src/test/java/neqsim/processSimulation/processEquipment/util/GORfitterTest.java +++ b/src/test/java/neqsim/processSimulation/processEquipment/util/GORfitterTest.java @@ -4,6 +4,7 @@ import org.junit.jupiter.api.Test; import neqsim.processSimulation.measurementDevice.MultiPhaseMeter; import neqsim.processSimulation.processEquipment.stream.Stream; +import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.system.SystemInterface; import neqsim.thermo.system.SystemSrkEos; @@ -36,7 +37,7 @@ void testMain() { GORfitter gORFItter = new GORfitter("test", stream_1); gORFItter.setTemperature(15.0, "C"); - gORFItter.setPressure(1.01325, "bara"); + gORFItter.setPressure(ThermodynamicConstantsInterface.referencePressure, "bara"); gORFItter.setReferenceConditions("actual"); // gORFItter.setGVF(0.1); gORFItter.setGOR(10.1); diff --git a/src/test/java/neqsim/processSimulation/processSystem/GlycolRigTest.java b/src/test/java/neqsim/processSimulation/processSystem/GlycolRigTest.java index c943065806..537d765c4f 100644 --- a/src/test/java/neqsim/processSimulation/processSystem/GlycolRigTest.java +++ b/src/test/java/neqsim/processSimulation/processSystem/GlycolRigTest.java @@ -13,6 +13,7 @@ import neqsim.processSimulation.processEquipment.separator.Separator; import neqsim.processSimulation.processEquipment.stream.Stream; import neqsim.processSimulation.processEquipment.util.Recycle; +import neqsim.thermo.ThermodynamicConstantsInterface; /** * Test class for GlycolRig. @@ -63,8 +64,8 @@ public void runTEGProcessTest() { column.getCondenser().setOutTemperature(273.15 + 104.0); column.getTray(1).addStream(gasToReboiler); // column.getReboiler().addStream(gasToReboiler); - column.setTopPressure(0.1 + 1.01325); - column.setBottomPressure(0.2 + 1.01325); + column.setTopPressure(0.1 + ThermodynamicConstantsInterface.referencePressure); + column.setBottomPressure(0.2 + ThermodynamicConstantsInterface.referencePressure); WaterStripperColumn stripper = new WaterStripperColumn("TEG stripper"); stripper.addSolventInStream(column.getLiquidOutStream()); @@ -199,8 +200,8 @@ public void runDistillationProcessTest() { column.addFeedStream(feedToRegenerator, 1); column.getReboiler().setOutTemperature(273.15 + 70.0); column.getCondenser().setOutTemperature(273.15 - 10.0); - column.setTopPressure(1.0 + 1.01325); - column.setBottomPressure(1.0 + 1.01325); + column.setTopPressure(1.0 + ThermodynamicConstantsInterface.referencePressure); + column.setBottomPressure(1.0 + ThermodynamicConstantsInterface.referencePressure); neqsim.processSimulation.processSystem.ProcessSystem operations = new neqsim.processSimulation.processSystem.ProcessSystem(); diff --git a/src/test/java/neqsim/processSimulation/util/example/LNGtankfilling.java b/src/test/java/neqsim/processSimulation/util/example/LNGtankfilling.java index 135589a1df..7ca17be9fd 100644 --- a/src/test/java/neqsim/processSimulation/util/example/LNGtankfilling.java +++ b/src/test/java/neqsim/processSimulation/util/example/LNGtankfilling.java @@ -6,6 +6,7 @@ import neqsim.processSimulation.processEquipment.tank.Tank; import neqsim.processSimulation.processEquipment.valve.ThrottlingValve; import neqsim.processSimulation.processEquipment.valve.ValveInterface; +import neqsim.thermo.ThermodynamicConstantsInterface; /** *

LNGtankfilling class.

@@ -60,7 +61,7 @@ public static void main(String args[]) { Stream stream_1 = new Stream("Methane Stream", testSystem); ValveInterface valve = new ThrottlingValve("valve", stream_1); - valve.setOutletPressure(1.01325 + 0.110); + valve.setOutletPressure(ThermodynamicConstantsInterface.referencePressure + 0.110); Tank tank = new neqsim.processSimulation.processEquipment.tank.Tank("tank"); tank.addStream(valve.getOutletStream()); @@ -84,7 +85,7 @@ public static void main(String args[]) { // ControllerDeviceInterface pressureController = new ControllerDeviceBaseClass(); // pressureController.setTransmitter(tankPressureTransmitter); // pressureController.setReverseActing(false); - // pressureController.setControllerSetPoint(1.01325+0.110); + // pressureController.setControllerSetPoint(ThermodynamicConstantsInterface.referencePressure+0.110); // pressureController.setControllerParameters(2.0,400,0); neqsim.processSimulation.processSystem.ProcessSystem operations = diff --git a/src/test/java/neqsim/processSimulation/util/example/MasstransferMeOH.java b/src/test/java/neqsim/processSimulation/util/example/MasstransferMeOH.java index 36c23238c6..eac9492228 100644 --- a/src/test/java/neqsim/processSimulation/util/example/MasstransferMeOH.java +++ b/src/test/java/neqsim/processSimulation/util/example/MasstransferMeOH.java @@ -5,6 +5,7 @@ import neqsim.processSimulation.processEquipment.separator.GasScrubber; import neqsim.processSimulation.processEquipment.stream.Stream; import neqsim.processSimulation.processEquipment.util.StreamSaturatorUtil; +import neqsim.thermo.ThermodynamicConstantsInterface; /** *

@@ -88,9 +89,10 @@ public static void main(String[] args) { // operations.run(); // ((DistillationColumn)operations.getUnit("TEG regeneration // column")).setNumberOfTrays(2); - System.out.println("water in wet gas [kg/MSm3] " - + ((Stream) operations.getUnit("water saturated feed gas")).getFluid().getPhase(0) - .getComponent("water").getz() * 1.0e6 * 0.01802 * 101325.0 / (8.314 * 288.15)); + System.out.println( + "water in wet gas [kg/MSm3] " + ((Stream) operations.getUnit("water saturated feed gas")) + .getFluid().getPhase(0).getComponent("water").getz() * 1.0e6 * 0.01802 + * ThermodynamicConstantsInterface.atm / (ThermodynamicConstantsInterface.R * 288.15)); // mainMixer.getFluid().display(); // scrubber.getGasOutStream().displayResult(); System.out.println("hydt " + gasFromScrubber.getHydrateEquilibriumTemperature()); diff --git a/src/test/java/neqsim/processSimulation/util/example/OffshoreProcess3.java b/src/test/java/neqsim/processSimulation/util/example/OffshoreProcess3.java index 755a59453f..2a483e700e 100644 --- a/src/test/java/neqsim/processSimulation/util/example/OffshoreProcess3.java +++ b/src/test/java/neqsim/processSimulation/util/example/OffshoreProcess3.java @@ -11,6 +11,7 @@ import neqsim.processSimulation.processEquipment.util.Recycle; import neqsim.processSimulation.processEquipment.util.SetPoint; import neqsim.processSimulation.processEquipment.valve.ThrottlingValve; +import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.system.SystemSrkEos; /** @@ -82,7 +83,7 @@ public static void main(String[] args) { ThrottlingValve waterDPvalve = new ThrottlingValve("Water HP to LP valve", inletSeparator.getWaterOutStream()); - waterDPvalve.setOutletPressure(1.01325); + waterDPvalve.setOutletPressure(ThermodynamicConstantsInterface.referencePressure); Separator waterStabSep = new Separator("water degassing separator", waterDPvalve.getOutletStream()); diff --git a/src/test/java/neqsim/processSimulation/util/example/TEGdehydrationProcessDistillation.java b/src/test/java/neqsim/processSimulation/util/example/TEGdehydrationProcessDistillation.java index 956aa73bfc..a90c0bbe6c 100644 --- a/src/test/java/neqsim/processSimulation/util/example/TEGdehydrationProcessDistillation.java +++ b/src/test/java/neqsim/processSimulation/util/example/TEGdehydrationProcessDistillation.java @@ -15,6 +15,7 @@ import neqsim.processSimulation.processEquipment.util.Recycle; import neqsim.processSimulation.processEquipment.util.StreamSaturatorUtil; import neqsim.processSimulation.processEquipment.valve.ThrottlingValve; +import neqsim.thermo.ThermodynamicConstantsInterface; /** *

@@ -245,9 +246,10 @@ public static void main(String[] args) { // operations.run(); // ((DistillationColumn)operations.getUnit("TEG regeneration // column")).setNumberOfTrays(2); - System.out.println("water in wet gas " - + ((Stream) operations.getUnit("water saturated feed gas")).getFluid().getPhase(0) - .getComponent("water").getz() * 1.0e6 * 0.01802 * 101325.0 / (8.314 * 288.15)); + System.out + .println("water in wet gas " + ((Stream) operations.getUnit("water saturated feed gas")) + .getFluid().getPhase(0).getComponent("water").getz() * 1.0e6 * 0.01802 + * ThermodynamicConstantsInterface.atm / (ThermodynamicConstantsInterface.R * 288.15)); System.out.println("water in dry gas " + ((Stream) operations.getUnit("dry gas from absorber")) .getFluid().getPhase(0).getComponent("water").getz() * 1.0e6); System.out.println("reboiler duty (KW) " @@ -258,12 +260,14 @@ public static void main(String[] args) { double waterInWetGasppm = waterSaturatedFeedGas.getFluid().getPhase(0).getComponent("water").getz() * 1.0e6; - double waterInWetGaskgMSm3 = waterInWetGasppm * 0.01802 * 101325.0 / (8.314 * 288.15); + double waterInWetGaskgMSm3 = waterInWetGasppm * 0.01802 * ThermodynamicConstantsInterface.atm + / (ThermodynamicConstantsInterface.R * 288.15); double TEGfeedwt = TEGFeed.getFluid().getPhase("aqueous").getWtFrac("TEG"); double TEGfeedflw = TEGFeed.getFlowRate("kg/hr"); double waterInDehydratedGasppm = dehydratedGas.getFluid().getPhase(0).getComponent("water").getz() * 1.0e6; - double waterInDryGaskgMSm3 = waterInDehydratedGasppm * 0.01802 * 101325.0 / (8.314 * 288.15); + double waterInDryGaskgMSm3 = waterInDehydratedGasppm * 0.01802 + * ThermodynamicConstantsInterface.atm / (ThermodynamicConstantsInterface.R * 288.15); double richTEG2 = richTEG.getFluid().getPhase("aqueous").getWtFrac("TEG"); System.out.println("reboiler duty (KW) " + ((Reboiler) column.getReboiler()).getDuty() / 1.0e3); System.out.println("flow rate from reboiler " diff --git a/src/test/java/neqsim/processSimulation/util/example/TEGdehydrationProcessDistillation3.java b/src/test/java/neqsim/processSimulation/util/example/TEGdehydrationProcessDistillation3.java index c3e354b64f..410031f184 100644 --- a/src/test/java/neqsim/processSimulation/util/example/TEGdehydrationProcessDistillation3.java +++ b/src/test/java/neqsim/processSimulation/util/example/TEGdehydrationProcessDistillation3.java @@ -15,6 +15,7 @@ import neqsim.processSimulation.processEquipment.util.Recycle; import neqsim.processSimulation.processEquipment.util.StreamSaturatorUtil; import neqsim.processSimulation.processEquipment.valve.ThrottlingValve; +import neqsim.thermo.ThermodynamicConstantsInterface; /** *

@@ -242,9 +243,10 @@ public static void main(String[] args) { // operations.run(); // ((DistillationColumn)operations.getUnit("TEG regeneration // column")).setNumberOfTrays(2); - System.out.println("water in wet gas " - + ((Stream) operations.getUnit("water saturated feed gas")).getFluid().getPhase(0) - .getComponent("water").getz() * 1.0e6 * 0.01802 * 101325.0 / (8.314 * 288.15)); + System.out + .println("water in wet gas " + ((Stream) operations.getUnit("water saturated feed gas")) + .getFluid().getPhase(0).getComponent("water").getz() * 1.0e6 * 0.01802 + * ThermodynamicConstantsInterface.atm / (ThermodynamicConstantsInterface.R * 288.15)); System.out.println("water in dry gas " + ((Stream) operations.getUnit("dry gas from absorber")) .getFluid().getPhase(0).getComponent("water").getz() * 1.0e6); System.out.println("reboiler duty (KW) " @@ -255,12 +257,14 @@ public static void main(String[] args) { double waterInWetGasppm = waterSaturatedFeedGas.getFluid().getPhase(0).getComponent("water").getz() * 1.0e6; - double waterInWetGaskgMSm3 = waterInWetGasppm * 0.01802 * 101325.0 / (8.314 * 288.15); + double waterInWetGaskgMSm3 = waterInWetGasppm * 0.01802 * ThermodynamicConstantsInterface.atm + / (ThermodynamicConstantsInterface.R * 288.15); double TEGfeedwt = TEGFeed.getFluid().getPhase("aqueous").getWtFrac("TEG"); double TEGfeedflw = TEGFeed.getFlowRate("kg/hr"); double waterInDehydratedGasppm = dehydratedGas.getFluid().getPhase(0).getComponent("water").getz() * 1.0e6; - double waterInDryGaskgMSm3 = waterInDehydratedGasppm * 0.01802 * 101325.0 / (8.314 * 288.15); + double waterInDryGaskgMSm3 = waterInDehydratedGasppm * 0.01802 + * ThermodynamicConstantsInterface.atm / (ThermodynamicConstantsInterface.R * 288.15); double richTEG2 = richTEG.getFluid().getPhase("aqueous").getWtFrac("TEG"); System.out.println("reboiler duty (KW) " + ((Reboiler) column.getReboiler()).getDuty() / 1.0e3); System.out.println("flow rate from reboiler " diff --git a/src/test/java/neqsim/processSimulation/util/example/TEGdehydrationProcessDistillationAaHa.java b/src/test/java/neqsim/processSimulation/util/example/TEGdehydrationProcessDistillationAaHa.java index f784ccf383..957f8841dc 100644 --- a/src/test/java/neqsim/processSimulation/util/example/TEGdehydrationProcessDistillationAaHa.java +++ b/src/test/java/neqsim/processSimulation/util/example/TEGdehydrationProcessDistillationAaHa.java @@ -17,6 +17,7 @@ import neqsim.processSimulation.processEquipment.util.SetPoint; import neqsim.processSimulation.processEquipment.util.StreamSaturatorUtil; import neqsim.processSimulation.processEquipment.valve.ThrottlingValve; +import neqsim.thermo.ThermodynamicConstantsInterface; /** *

@@ -156,7 +157,7 @@ public static neqsim.processSimulation.processSystem.ProcessSystem getProcess() column.getReboiler().setOutTemperature(273.15 + 201.0); column.getCondenser().setOutTemperature(273.15 + 92.0); column.getReboiler().addStream(gasToReboiler); - column.setTopPressure(1.01325); + column.setTopPressure(ThermodynamicConstantsInterface.referencePressure); column.setBottomPressure(1.02); Heater coolerRegenGas = new Heater("regen gas cooler", column.getGasOutStream()); @@ -305,7 +306,8 @@ public static void main(String[] args) { /* * System.out.println("water in wet gas " + ((Stream) * operations.getUnit("water saturated feed gas")).getFluid() - * .getPhase(0).getComponent("water").getz() * 1.0e6 * 0.01802 * 101325.0 / (8.314 * 288.15)); + * .getPhase(0).getComponent("water").getz() * 1.0e6 * 0.01802 + * *ThermodynamicConstantsInterface.atm / (ThermodynamicConstantsInterface.R * 288.15)); * System.out.println("water in dry gas " + ((Stream) * operations.getUnit("dry gas from absorber")).getFluid() * .getPhase(0).getComponent("water").getz() * 1.0e6); System.out.println("reboiler duty (KW) " @@ -317,15 +319,17 @@ public static void main(String[] args) { * * double waterInWetGasppm = * waterSaturatedFeedGas.getFluid().getPhase(0).getComponent("water").getz() * 1.0e6; double - * waterInWetGaskgMSm3 = waterInWetGasppm * 0.01802 * 101325.0 / (8.314 * 288.15); double - * TEGfeedwt = TEGFeed.getFluid().getPhase("aqueous").getWtFrac("TEG"); double TEGfeedflw = + * waterInWetGaskgMSm3 = waterInWetGasppm * 0.01802 *ThermodynamicConstantsInterface.atm / + * (ThermodynamicConstantsInterface.R * 288.15); double TEGfeedwt = + * TEGFeed.getFluid().getPhase("aqueous").getWtFrac("TEG"); double TEGfeedflw = * TEGFeed.getFlowRate("kg/hr"); double waterInDehydratedGasppm = * dehydratedGas.getFluid().getPhase(0).getComponent("water").getz() * 1.0e6; double - * waterInDryGaskgMSm3 = waterInDehydratedGasppm * 0.01802 * 101325.0 / (8.314 * 288.15); double - * richTEG2 = richTEG.getFluid().getPhase("aqueous").getWtFrac("TEG"); double temp = + * waterInDryGaskgMSm3 = waterInDehydratedGasppm * 0.01802 *ThermodynamicConstantsInterface.atm + * / (ThermodynamicConstantsInterface.R * 288.15); double richTEG2 = + * richTEG.getFluid().getPhase("aqueous").getWtFrac("TEG"); double temp = * ((Stream)operations.getUnit("feed to TEG absorber")).getFluid().getPhase(0). - * getComponent("water").getz()*1.0e6*0.01802*101325.0/(8.314*288.15); - * System.out.println("reboiler duty (KW) " + ((Reboiler) column.getReboiler()).getDuty() / + * getComponent("water").getz()*1.0e6*0.01802*101325.0/(ThermodynamicConstantsInterface.R*288.15 + * ); System.out.println("reboiler duty (KW) " + ((Reboiler) column.getReboiler()).getDuty() / * 1.0e3); System.out.println("flow rate from reboiler " + ((Reboiler) * column.getReboiler()).getLiquidOutStream().getFlowRate("kg/hr")); * System.out.println("flow rate from stripping column " + diff --git a/src/test/java/neqsim/processSimulation/util/example/TEGdehydrationProcessDistillationGFA.java b/src/test/java/neqsim/processSimulation/util/example/TEGdehydrationProcessDistillationGFA.java index 03d9f8b788..76c44ce6b6 100644 --- a/src/test/java/neqsim/processSimulation/util/example/TEGdehydrationProcessDistillationGFA.java +++ b/src/test/java/neqsim/processSimulation/util/example/TEGdehydrationProcessDistillationGFA.java @@ -453,7 +453,8 @@ public static void main(String[] args) { /* * System.out.println("water in wet gas " + ((Stream) * operations.getUnit("water saturated feed gas")).getFluid() - * .getPhase(0).getComponent("water").getz() * 1.0e6 * 0.01802 * 101325.0 / (8.314 * 288.15)); + * .getPhase(0).getComponent("water").getz() * 1.0e6 * 0.01802 + * *ThermodynamicConstantsInterface.atm / (ThermodynamicConstantsInterface.R * 288.15)); * System.out.println("water in dry gas " + ((Stream) * operations.getUnit("dry gas from absorber")).getFluid() * .getPhase(0).getComponent("water").getz() * 1.0e6); System.out.println("reboiler duty (KW) " @@ -480,14 +481,16 @@ public static void main(String[] args) { /* * double waterInWetGasppm = * waterSaturatedFeedGas.getFluid().getPhase(0).getComponent("water").getz() * 1.0e6; double - * waterInWetGaskgMSm3 = waterInWetGasppm * 0.01802 * 101325.0 / (8.314 * 288.15); double - * TEGfeedwt = TEGFeed.getFluid().getPhase("aqueous").getWtFrac("TEG"); double TEGfeedflw = + * waterInWetGaskgMSm3 = waterInWetGasppm * 0.01802 *ThermodynamicConstantsInterface.atm / + * (ThermodynamicConstantsInterface.R * 288.15); double TEGfeedwt = + * TEGFeed.getFluid().getPhase("aqueous").getWtFrac("TEG"); double TEGfeedflw = * TEGFeed.getFlowRate("kg/hr"); double waterInDehydratedGasppm = * dehydratedGas.getFluid().getPhase(0).getComponent("water").getz() * 1.0e6; double - * waterInDryGaskgMSm3 = waterInDehydratedGasppm * 0.01802 * 101325.0 / (8.314 * 288.15); double - * richTEG2 = richTEG.getFluid().getPhase("aqueous").getWtFrac("TEG"); double temp = + * waterInDryGaskgMSm3 = waterInDehydratedGasppm * 0.01802 *ThermodynamicConstantsInterface.atm + * / (ThermodynamicConstantsInterface.R * 288.15); double richTEG2 = + * richTEG.getFluid().getPhase("aqueous").getWtFrac("TEG"); double temp = * ((Stream)operations.getUnit("feed to TEG absorber")).getFluid().getPhase(0).getComponent( - * "water").getz()*1.0e6*0.01802*101325.0/(8.314*288.15); + * "water").getz()*1.0e6*0.01802*101325.0/(ThermodynamicConstantsInterface.R*288.15); * System.out.println("reboiler duty (KW) " + ((Reboiler) column.getReboiler()).getDuty() / * 1.0e3); System.out.println("flow rate from reboiler " + ((Reboiler) * column.getReboiler()).getLiquidOutStream().getFlowRate("kg/hr")); diff --git a/src/test/java/neqsim/processSimulation/util/example/TestProcess4.java b/src/test/java/neqsim/processSimulation/util/example/TestProcess4.java index 3e5cd35b15..12a572ff97 100644 --- a/src/test/java/neqsim/processSimulation/util/example/TestProcess4.java +++ b/src/test/java/neqsim/processSimulation/util/example/TestProcess4.java @@ -37,7 +37,7 @@ public static void main(String args[]) { Separator separator = new Separator("Separator 1", stream_1); // ThrottlingValve valve_1 = new ThrottlingValve(separator.getGasOutStream()); - // valve_1.setOutletPressure(75.0 + 1.01325); + // valve_1.setOutletPressure(75.0 + ThermodynamicConstantsInterface.referencePressure); // valve_1.setIsoThermal(true); // Heater heater = new Heater(valve_1.getOutStream()); diff --git a/src/test/java/neqsim/processSimulation/util/example/oxygenRemovalWater.java b/src/test/java/neqsim/processSimulation/util/example/oxygenRemovalWater.java index 9dd350c644..ae1d10817f 100644 --- a/src/test/java/neqsim/processSimulation/util/example/oxygenRemovalWater.java +++ b/src/test/java/neqsim/processSimulation/util/example/oxygenRemovalWater.java @@ -5,6 +5,7 @@ import neqsim.processSimulation.processEquipment.separator.Separator; import neqsim.processSimulation.processEquipment.stream.Stream; import neqsim.processSimulation.processEquipment.valve.ThrottlingValve; +import neqsim.thermo.ThermodynamicConstantsInterface; /** *

oxygenRemovalWater class.

@@ -25,10 +26,10 @@ public static void main(String[] args) { neqsim.thermo.system.SystemInterface fluid1 = fluidCreator.create("air").autoSelectModel(); fluid1.setMultiPhaseCheck(true); neqsim.thermo.system.SystemInterface fluid2 = fluidCreator.create("water"); - fluid1.setPressure(1.01325); + fluid1.setPressure(ThermodynamicConstantsInterface.referencePressure); fluid1.setTemperature(273.15 + 10); fluid1.setTotalFlowRate(1.0, "kg/hr"); - fluid2.setPressure(1.01325); + fluid2.setPressure(ThermodynamicConstantsInterface.referencePressure); fluid2.setTemperature(273.15 + 10); fluid2.setTotalFlowRate(3500.0, "kg/hr"); diff --git a/src/test/java/neqsim/thermo/component/AmmoniaTest.java b/src/test/java/neqsim/thermo/component/AmmoniaTest.java index 6e35cc548c..1c8ea75155 100644 --- a/src/test/java/neqsim/thermo/component/AmmoniaTest.java +++ b/src/test/java/neqsim/thermo/component/AmmoniaTest.java @@ -3,6 +3,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; +import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.system.SystemInterface; import neqsim.thermo.system.SystemSrkEos; import neqsim.thermodynamicOperations.ThermodynamicOperations; @@ -15,7 +16,7 @@ public class AmmoniaTest extends neqsim.NeqSimTest { */ @BeforeAll static void setUpBeforeClass() throws Exception { - thermoSystem = new SystemSrkEos(298.0, 1.01325); + thermoSystem = new SystemSrkEos(298.0, ThermodynamicConstantsInterface.referencePressure); thermoSystem.addComponent("ammonia", 1.0); thermoSystem.init(0); } diff --git a/src/test/java/neqsim/thermo/component/NewComponentTest.java b/src/test/java/neqsim/thermo/component/NewComponentTest.java index 28ed9e156b..6da9c2e5bc 100644 --- a/src/test/java/neqsim/thermo/component/NewComponentTest.java +++ b/src/test/java/neqsim/thermo/component/NewComponentTest.java @@ -4,6 +4,7 @@ import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; +import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.phase.PhaseSrkEos; import neqsim.thermo.system.SystemInterface; import neqsim.thermo.system.SystemSrkEos; @@ -37,7 +38,7 @@ public void createComponentTest() { @Test public void newComponentTest() { - thermoSystem = new SystemSrkEos(298.0, 1.01325); + thermoSystem = new SystemSrkEos(298.0, ThermodynamicConstantsInterface.referencePressure); thermoSystem.addComponent("ammonia", 1.0); thermoSystem.init(0); assertEquals(0.01703052, thermoSystem.getMolarMass("kg/mol"), 0.01); diff --git a/src/test/java/neqsim/thermo/system/SystemSrkSchwartzentruberEosTest.java b/src/test/java/neqsim/thermo/system/SystemSrkSchwartzentruberEosTest.java index 1b6fe239c8..2e943e39af 100644 --- a/src/test/java/neqsim/thermo/system/SystemSrkSchwartzentruberEosTest.java +++ b/src/test/java/neqsim/thermo/system/SystemSrkSchwartzentruberEosTest.java @@ -1,6 +1,7 @@ package neqsim.thermo.system; import org.junit.jupiter.api.BeforeAll; +import neqsim.thermo.ThermodynamicConstantsInterface; /** *

@@ -19,7 +20,8 @@ public class SystemSrkSchwartzentruberEosTest extends ModelBaseTest { */ @BeforeAll public static void setUp() { - thermoSystem = new SystemSrkSchwartzentruberEos(298.15, 1.01325); + thermoSystem = new SystemSrkSchwartzentruberEos(298.15, + ThermodynamicConstantsInterface.referencePressure); thermoSystem.addComponent("methanol", 1.0); thermoSystem.addComponent("water", 1.0); thermoSystem.createDatabase(true); diff --git a/src/test/java/neqsim/thermo/system/SystemThermoTest.java b/src/test/java/neqsim/thermo/system/SystemThermoTest.java index d8dc0e93d4..16b42d536a 100644 --- a/src/test/java/neqsim/thermo/system/SystemThermoTest.java +++ b/src/test/java/neqsim/thermo/system/SystemThermoTest.java @@ -4,6 +4,7 @@ import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; +import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermodynamicOperations.ThermodynamicOperations; class SystemThermoTest extends neqsim.NeqSimTest { @@ -85,9 +86,8 @@ public void testSetPressure() { fluid.addComponent("nitrogen", 1.0); fluid.setPressure(0.0, "barg"); - assertEquals(1.01325, fluid.getPressure("bara"), 1e-4); + assertEquals(ThermodynamicConstantsInterface.referencePressure, fluid.getPressure("bara"), + 1e-4); assertEquals(0.0, fluid.getPressure("barg"), 1e-4); - - } } diff --git a/src/test/java/neqsim/thermo/util/example/ActivityCalc.java b/src/test/java/neqsim/thermo/util/example/ActivityCalc.java index 71231c48c8..cc8db77078 100644 --- a/src/test/java/neqsim/thermo/util/example/ActivityCalc.java +++ b/src/test/java/neqsim/thermo/util/example/ActivityCalc.java @@ -6,6 +6,7 @@ package neqsim.thermo.util.example; +import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.system.SystemInterface; import neqsim.thermo.system.SystemSrkCPAstatoil; import neqsim.thermodynamicOperations.ThermodynamicOperations; @@ -28,7 +29,8 @@ public class ActivityCalc { * @param args an array of {@link java.lang.String} objects */ public static void main(String args[]) { - SystemInterface testSystem = new SystemSrkCPAstatoil(273.15 + 42, 1.01325); + SystemInterface testSystem = + new SystemSrkCPAstatoil(273.15 + 42, ThermodynamicConstantsInterface.referencePressure); ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem); diff --git a/src/test/java/neqsim/thermo/util/example/AmineFlash.java b/src/test/java/neqsim/thermo/util/example/AmineFlash.java index 5a438a0988..8bf2c09e33 100644 --- a/src/test/java/neqsim/thermo/util/example/AmineFlash.java +++ b/src/test/java/neqsim/thermo/util/example/AmineFlash.java @@ -2,6 +2,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.system.SystemFurstElectrolyteEos; import neqsim.thermo.system.SystemInterface; import neqsim.thermodynamicOperations.ThermodynamicOperations; @@ -26,8 +27,10 @@ public class AmineFlash { * @param args an array of {@link java.lang.String} objects */ public static void main(String args[]) { - SystemInterface testSystem = new SystemFurstElectrolyteEos(273.15 + 50, 1.01325); - // SystemInterface testSystem = new SystemElectrolyteCPA(273.15+40, 1.01325); + SystemInterface testSystem = new SystemFurstElectrolyteEos(273.15 + 50, + ThermodynamicConstantsInterface.referencePressure); + // SystemInterface testSystem = new SystemElectrolyteCPA(273.15+40, + // ThermodynamicConstantsInterface.referencePressure); double molMDEA = 0.1; double loading = 0.4; double density = 1088; diff --git a/src/test/java/neqsim/thermo/util/example/FreezingPoint.java b/src/test/java/neqsim/thermo/util/example/FreezingPoint.java index ebe9114958..059458db1b 100644 --- a/src/test/java/neqsim/thermo/util/example/FreezingPoint.java +++ b/src/test/java/neqsim/thermo/util/example/FreezingPoint.java @@ -2,6 +2,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.system.SystemInterface; import neqsim.thermo.system.SystemSrkCPAstatoil; import neqsim.thermodynamicOperations.ThermodynamicOperations; @@ -27,10 +28,12 @@ public class FreezingPoint { */ public static void main(String[] args) { // SystemInterface testSystem = new SystemSrkSchwartzentruberEos(260.15,19.00); - SystemInterface testSystem = new SystemSrkCPAstatoil(273.15 - 1, 1.01325); + SystemInterface testSystem = + new SystemSrkCPAstatoil(273.15 - 1, ThermodynamicConstantsInterface.referencePressure); ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem); - SystemInterface testSystem2 = new SystemSrkCPAstatoil(273.15 + 100, 1.01325); + SystemInterface testSystem2 = + new SystemSrkCPAstatoil(273.15 + 100, ThermodynamicConstantsInterface.referencePressure); ThermodynamicOperations testOps2 = new ThermodynamicOperations(testSystem2); testSystem.addComponent("methane", 0.00882); diff --git a/src/test/java/neqsim/thermo/util/example/HydrateFlash.java b/src/test/java/neqsim/thermo/util/example/HydrateFlash.java index 9d8317d9b0..29579bbd76 100644 --- a/src/test/java/neqsim/thermo/util/example/HydrateFlash.java +++ b/src/test/java/neqsim/thermo/util/example/HydrateFlash.java @@ -150,8 +150,9 @@ public static void main(String args[]) { // testSystem.display(); // System.out.println("kg vann/MSm^3 gas " + // (testSystem.getPhase(0).getComponent("water").getx() * - // testSystem.getPhase(0).getComponent("water").getMolarMass() * 101325.0 / - // 8.314 / 288.15) * 1.0e6); + // testSystem.getPhase(0).getComponent("water").getMolarMass() + // *ThermodynamicConstantsInterface.atm / + // ThermodynamicConstantsInterface.R / 288.15) * 1.0e6); // System.out.println("activity coef water " + // testSystem.getPhase(1).getActivityCoefficientSymetric(1)); // int n = testSystem.getNumberOfPhases()-1; diff --git a/src/test/java/neqsim/thermo/util/example/ModelTest.java b/src/test/java/neqsim/thermo/util/example/ModelTest.java index 2ffce3ac5a..e905e668e2 100644 --- a/src/test/java/neqsim/thermo/util/example/ModelTest.java +++ b/src/test/java/neqsim/thermo/util/example/ModelTest.java @@ -33,7 +33,8 @@ public static void main(String args[]) { // SystemInterface testSystem = new SystemFurstElectrolyteEos(273.14 + 12, // 61.0); // SystemInterface testSystem = new SystemUMRPRUMCEos(300.0, 10.0); - // SystemInterface testSystem = new SystemSrkEos(298.15, 1.01325); + // SystemInterface testSystem = new SystemSrkEos(298.15, + // ThermodynamicConstantsInterface.referencePressure); ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem); //testSystem.addComponent("methane", 100); diff --git a/src/test/java/neqsim/thermo/util/example/OsmoticCoefficient.java b/src/test/java/neqsim/thermo/util/example/OsmoticCoefficient.java index 8e24ecee71..22e5599766 100644 --- a/src/test/java/neqsim/thermo/util/example/OsmoticCoefficient.java +++ b/src/test/java/neqsim/thermo/util/example/OsmoticCoefficient.java @@ -1,5 +1,6 @@ package neqsim.thermo.util.example; +import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.system.SystemElectrolyteCPAstatoil; import neqsim.thermo.system.SystemInterface; @@ -22,11 +23,13 @@ public class OsmoticCoefficient { */ @SuppressWarnings("unused") public static void main(String args[]) { - SystemInterface testSystem = new SystemElectrolyteCPAstatoil(298.0, 1.01325); - // SystemInterface testSystem = new SystemElectrolyteCPA(298.15,1.01325201325); - // SystemInterface testSystem = new SystemSrkCPAs(298.15,1.01325); + SystemInterface testSystem = + new SystemElectrolyteCPAstatoil(298.0, ThermodynamicConstantsInterface.referencePressure); + // SystemInterface testSystem = new SystemElectrolyteCPA(298.15,1.01325201325); // SystemInterface testSystem = new - // SystemSrkSchwartzentruberEos(298.15,1.01325); + // SystemSrkCPAs(298.15,ThermodynamicConstantsInterface.referencePressure); + // SystemInterface testSystem = new + // SystemSrkSchwartzentruberEos(298.15,ThermodynamicConstantsInterface.referencePressure); // creates a 0.1 molar solution 0.0018 testSystem.addComponent("methane", 10.0); diff --git a/src/test/java/neqsim/thermo/util/example/OsmoticCoefficient_1.java b/src/test/java/neqsim/thermo/util/example/OsmoticCoefficient_1.java index 4937271d3c..c5362907ed 100644 --- a/src/test/java/neqsim/thermo/util/example/OsmoticCoefficient_1.java +++ b/src/test/java/neqsim/thermo/util/example/OsmoticCoefficient_1.java @@ -1,5 +1,6 @@ package neqsim.thermo.util.example; +import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.system.SystemFurstElectrolyteEos; import neqsim.thermo.system.SystemInterface; import neqsim.thermodynamicOperations.ThermodynamicOperations; @@ -23,11 +24,14 @@ public class OsmoticCoefficient_1 { */ @SuppressWarnings("unused") public static void main(String args[]) { - SystemInterface testSystem = new SystemFurstElectrolyteEos(298.15, 1.01325); - // SystemInterface testSystem = new SystemElectrolyteCPA(298.15,1.01325); - // SystemInterface testSystem = new SystemSrkCPAs(298.15,1.01325); + SystemInterface testSystem = + new SystemFurstElectrolyteEos(298.15, ThermodynamicConstantsInterface.referencePressure); // SystemInterface testSystem = new - // SystemSrkSchwartzentruberEos(298.15,1.01325); + // SystemElectrolyteCPA(298.15,ThermodynamicConstantsInterface.referencePressure); + // SystemInterface testSystem = new + // SystemSrkCPAs(298.15,ThermodynamicConstantsInterface.referencePressure); + // SystemInterface testSystem = new + // SystemSrkSchwartzentruberEos(298.15,ThermodynamicConstantsInterface.referencePressure); // creates a 0.1 molar solution 0.0018 testSystem.addComponent("CO2", 0.1); diff --git a/src/test/java/neqsim/thermo/util/example/SulfureDeposition.java b/src/test/java/neqsim/thermo/util/example/SulfureDeposition.java index b1c1fd4a8b..37c889e1f5 100644 --- a/src/test/java/neqsim/thermo/util/example/SulfureDeposition.java +++ b/src/test/java/neqsim/thermo/util/example/SulfureDeposition.java @@ -2,6 +2,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.system.SystemInterface; import neqsim.thermo.system.SystemSrkEos; import neqsim.thermodynamicOperations.ThermodynamicOperations; @@ -137,7 +138,7 @@ public static void main(String args[]) { logger.info("mol S8/mol gas (ppb) " + testSystem.getPhase(0).getComponent("S8").getx() * 1e9); logger.info("mg S8/Sm^3 gas " + testSystem.getPhase(0).getComponent("S8").getx() * testSystem.getPhase(0).getComponent("S8").getMolarMass() * 1e6 - * (101325 / (8.315 * 288.15))); + * (101325 / (ThermodynamicConstantsInterface.R * 288.15))); logger.info("wt% S8 in gas " + testSystem.getPhase(0).getComponent("S8").getx() * testSystem.getPhase(0).getComponent("S8").getMolarMass() diff --git a/src/test/java/neqsim/thermo/util/example/TPflash2.java b/src/test/java/neqsim/thermo/util/example/TPflash2.java index 47835671e0..3adcb4eb01 100644 --- a/src/test/java/neqsim/thermo/util/example/TPflash2.java +++ b/src/test/java/neqsim/thermo/util/example/TPflash2.java @@ -2,6 +2,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.system.SystemInterface; import neqsim.thermo.system.SystemSrkCPAstatoil; import neqsim.thermodynamicOperations.ThermodynamicOperations; @@ -26,14 +27,16 @@ public class TPflash2 { * @param args an array of {@link java.lang.String} objects */ public static void main(String[] args) { - SystemInterface testSystem = new SystemSrkCPAstatoil(273.15 + 80.0, 1.01325); + SystemInterface testSystem = + new SystemSrkCPAstatoil(273.15 + 80.0, ThermodynamicConstantsInterface.referencePressure); testSystem.addComponent("nitrogen", 8.71604938); // testSystem.addComponent("oxygen", 22.71604938); testSystem.addComponent("water", 110.234567901); testSystem.createDatabase(true); testSystem.setMixingRule(10); // testSystem.setMultiPhaseCheck(true); - SystemInterface testSystem2 = new SystemSrkCPAstatoil(273.15 + 80.0, 1.01325); + SystemInterface testSystem2 = + new SystemSrkCPAstatoil(273.15 + 80.0, ThermodynamicConstantsInterface.referencePressure); testSystem2.addComponent("nitrogen", 8.71604938); // testSystem.addComponent("oxygen", 22.71604938); testSystem2.addComponent("MEG", 110.234567901); diff --git a/src/test/java/neqsim/thermo/util/example/TPflashDehyd.java b/src/test/java/neqsim/thermo/util/example/TPflashDehyd.java index 1909d11e56..70bd2bf68a 100644 --- a/src/test/java/neqsim/thermo/util/example/TPflashDehyd.java +++ b/src/test/java/neqsim/thermo/util/example/TPflashDehyd.java @@ -171,8 +171,9 @@ public static void main(String[] args) { * testSystem.getPhase(0).getComponent("methane").getx()); * * - * double solubility = testSystem.getPhase(1).getComponent("CO2").getx() * 8.314 * 298.15 / - * 101325.0 / (testSystem.getPhase(1).getMolarMass()) * 1000; + * double solubility = testSystem.getPhase(1).getComponent("CO2").getx() * + * ThermodynamicConstantsInterface.R * 298.15 /ThermodynamicConstantsInterface.atm / + * (testSystem.getPhase(1).getMolarMass()) * 1000; * * System.out.println("selectivity " + seletivity); System.out.println("CO2 solubility " + * solubility); System.out.println("Z " + testSystem.getPhase(0).getZ()); // diff --git a/src/test/java/neqsim/thermo/util/example/TPflashMembrane.java b/src/test/java/neqsim/thermo/util/example/TPflashMembrane.java index 722bf67073..4696a02b50 100644 --- a/src/test/java/neqsim/thermo/util/example/TPflashMembrane.java +++ b/src/test/java/neqsim/thermo/util/example/TPflashMembrane.java @@ -2,6 +2,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.phase.PhaseType; import neqsim.thermo.system.SystemInterface; import neqsim.thermo.system.SystemSrkEos; @@ -30,7 +31,8 @@ public static void main(String args[]) { // SystemInterface testSystem2 = // util.serialization.SerializationManager.open("c:/test.fluid"); // testSystem2.display(); - SystemInterface testSystem = new SystemSrkEos(298, 1.01325); + SystemInterface testSystem = + new SystemSrkEos(298, ThermodynamicConstantsInterface.referencePressure); ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem); diff --git a/src/test/java/neqsim/thermo/util/example/TestFluidIssues.java b/src/test/java/neqsim/thermo/util/example/TestFluidIssues.java index 7c5971e928..9bf29fe417 100644 --- a/src/test/java/neqsim/thermo/util/example/TestFluidIssues.java +++ b/src/test/java/neqsim/thermo/util/example/TestFluidIssues.java @@ -26,7 +26,7 @@ public static void main(String args[]) { // SystemInterface testSystem = new SystemSrkEos(303.15, 10.01325); SystemInterface testSystem = new SystemSrkCPAstatoil(303.15, 15.0); // SystemInterface testSystem = new SystemSrkSchwartzentruberEos(298.15, - // 1.01325); + // ThermodynamicConstantsInterface.referencePressure); ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem); testSystem.addComponent("methane", 100.0); // testSystem.addComponent("water", 100.0); diff --git a/src/test/java/neqsim/thermo/util/example/TestVHflash.java b/src/test/java/neqsim/thermo/util/example/TestVHflash.java index f6ab07021e..9ad56b3f51 100644 --- a/src/test/java/neqsim/thermo/util/example/TestVHflash.java +++ b/src/test/java/neqsim/thermo/util/example/TestVHflash.java @@ -2,6 +2,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.system.SystemInterface; import neqsim.thermo.system.SystemSrkEos; import neqsim.thermodynamicOperations.ThermodynamicOperations; @@ -26,13 +27,15 @@ public class TestVHflash { * @param args an array of {@link java.lang.String} objects */ public static void main(String args[]) { - double pressureInTank = 1.01325; // Pa + double pressureInTank = ThermodynamicConstantsInterface.referencePressure; // Pa double temperatureInTank = 293.15; - double totalMolesInTank = 136000 * pressureInTank * 1.0e5 / 8.314 / temperatureInTank; + double totalMolesInTank = + 136000 * pressureInTank * 1.0e5 / ThermodynamicConstantsInterface.R / temperatureInTank; double molefractionNitrogenInTank = 0.95; double molesInjectedLNG = 200000.0; - double molesInjecedVacumBreakerGas = 18 * pressureInTank * 1.0e5 / 8.314 / temperatureInTank; + double molesInjecedVacumBreakerGas = + 18 * pressureInTank * 1.0e5 / ThermodynamicConstantsInterface.R / temperatureInTank; SystemInterface testSystem = new SystemSrkEos(temperatureInTank, pressureInTank); ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem); diff --git a/src/test/java/neqsim/thermodynamicOperations/ThermodynamicOperationsTest.java b/src/test/java/neqsim/thermodynamicOperations/ThermodynamicOperationsTest.java index 5ee1abe953..a85bc8caf1 100644 --- a/src/test/java/neqsim/thermodynamicOperations/ThermodynamicOperationsTest.java +++ b/src/test/java/neqsim/thermodynamicOperations/ThermodynamicOperationsTest.java @@ -16,6 +16,7 @@ import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; import neqsim.api.ioc.CalculationResult; +import neqsim.thermo.ThermodynamicConstantsInterface; import neqsim.thermo.system.SystemInterface; import neqsim.thermo.system.SystemProperties; import neqsim.thermo.system.SystemSrkEos; @@ -105,7 +106,7 @@ void testNeqSimPython2() { new neqsim.thermodynamicOperations.ThermodynamicOperations(thermoSystem); double temp = 373.15; - double press = 60.0 + 1.013; + double press = 60.0 + ThermodynamicConstantsInterface.referencePressure; List jP = Arrays.asList(new Double[] {press}); List jT = Arrays.asList(new Double[] {temp}); diff --git a/src/test/java/neqsim/util/unit/PressureUnitTest.java b/src/test/java/neqsim/util/unit/PressureUnitTest.java new file mode 100644 index 0000000000..e69de29bb2