diff --git a/README.md b/README.md
index d7764b9be..b38ebdba3 100644
--- a/README.md
+++ b/README.md
@@ -3,7 +3,7 @@
[![Build Status](https://neqsim.visualstudio.com/neqsim_cicd/_apis/build/status/neqsim_build?branchName=master)](https://neqsim.visualstudio.com/neqsim_cicd/_build/latest?definitionId=1&branchName=master)
![Build maven](https://github.com/equinor/neqsim/workflows/Build%20maven/badge.svg?branch=master)
NeqSim is the main part of the [NeqSim project](https://equinor.github.io/neqsimhome/). NeqSim (Non-Equilibrium Simulator) is a Java library for estimation of fluid behavior and process design for oil and gas production.
-The basis for NeqSim is a library of fundamental mathematical models related to phase behavior and physical properties of oil and gas. NeqSim is easilly extended with new method. NeqSim development was initiated at the [Norwegian University of Science and Technology (NTNU)](https://www.ntnu.edu/employees/even.solbraa).
+The basis for NeqSim is a library of fundamental mathematical models related to phase behavior and physical properties of oil and gas. NeqSim is easilly extended with new models. NeqSim development was initiated at the [Norwegian University of Science and Technology (NTNU)](https://www.ntnu.edu/employees/even.solbraa).
## Releases
@@ -11,7 +11,7 @@ The basis for NeqSim is a library of fundamental mathematical models related to
## Getting started as a NeqSim Java user
-NeqSim can be used in a Java application by adding the NeqSim.jar found in [NeqSim releases](https://github.com/equinor/neqsim/releases) to the classpath. A demonstration of dowloading the library and running a TPflash bencmark is illustrated in this [NeqSim Colab demo](https://colab.research.google.com/drive/1XkQ_CrVj2gLTtJvXhFQMWALzXii522CL). Learn and ask questions in [Discussions for use and development of NeqSim](https://github.com/equinor/neqsim/discussions). Also see the [NeqSim JavaDoc](https://htmlpreview.github.io/?https://github.com/equinor/neqsimhome/blob/master/javadoc/site/apidocs/index.html).
+NeqSim can be used in a Java application by adding the neqsim-x.x.x.jar found in [NeqSim releases](https://github.com/equinor/neqsim/releases) to the classpath. A demonstration of dowloading the library and running a TPflash bencmark is illustrated in this [NeqSim Colab demo](https://colab.research.google.com/drive/1XkQ_CrVj2gLTtJvXhFQMWALzXii522CL). Learn and ask questions in [Discussions for use and development of NeqSim](https://github.com/equinor/neqsim/discussions). Also see the [NeqSim JavaDoc](https://htmlpreview.github.io/?https://github.com/equinor/neqsimhome/blob/master/javadoc/site/apidocs/index.html).
## Getting Started as a NeqSim Java developer
diff --git a/pom.xml b/pom.xml
index 17376df34..6c9fd0c5a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -74,7 +74,6 @@
com.lowagie
itext
1.4.8
- provided
gov.nist.math
@@ -90,7 +89,6 @@
org.jfree
jfreechart
1.5.1
- provided
com.googlecode.matrix-toolkits-java
diff --git a/src/main/java/neqsim/PVTsimulation/simulation/SlimTubeSim.java b/src/main/java/neqsim/PVTsimulation/simulation/SlimTubeSim.java
index b1858b6ce..1a5812d1a 100644
--- a/src/main/java/neqsim/PVTsimulation/simulation/SlimTubeSim.java
+++ b/src/main/java/neqsim/PVTsimulation/simulation/SlimTubeSim.java
@@ -135,9 +135,9 @@ public void run() {
}
slimOps0.setSystem(slimTubeNodeSystem[i]);
slimOps0.TPflash();
- System.out.println("node " + i + " delta volume end "
- + (slimTubeNodeSystem[i].getVolume() - standardNodeVolume) + " add moles "
- + sum);
+ // System.out.println("node " + i + " delta volume end "
+ // + (slimTubeNodeSystem[i].getVolume() - standardNodeVolume) + " add moles "
+ // + sum);
slimOps1.setSystem(slimTubeNodeSystem[i + 1]);
slimOps1.TPflash();
diff --git a/src/main/java/neqsim/fluidMechanics/flowSolver/onePhaseFlowSolver/onePhasePipeFlowSolver/OnePhaseFixedStaggeredGrid.java b/src/main/java/neqsim/fluidMechanics/flowSolver/onePhaseFlowSolver/onePhasePipeFlowSolver/OnePhaseFixedStaggeredGrid.java
index c03199040..fd47e7c96 100644
--- a/src/main/java/neqsim/fluidMechanics/flowSolver/onePhaseFlowSolver/onePhasePipeFlowSolver/OnePhaseFixedStaggeredGrid.java
+++ b/src/main/java/neqsim/fluidMechanics/flowSolver/onePhaseFlowSolver/onePhasePipeFlowSolver/OnePhaseFixedStaggeredGrid.java
@@ -127,8 +127,8 @@ public void initProfiles() {
// System.out.println("velocity " + pipe.getNode(i).getVelocity());
// setting pressures
- System.out
- .println("presbef : " + pipe.getNode(i + 1).getBulkSystem().getPressure());
+ // System.out
+ // .println("presbef : " + pipe.getNode(i + 1).getBulkSystem().getPressure());
oldPres = pipe.getNode(i + 1).getBulkSystem().getPressure();
pipe.getNode(i + 1).getBulkSystem()
.setPressure(-pipe.getNode(i).getWallFrictionFactor()
@@ -152,22 +152,21 @@ public void initProfiles() {
- pipe.getNode(i).getBulkSystem().getPressure())
/ ((pipe.getNode(i + 1).getGeometry().getNodeLength()
+ pipe.getNode(i).getGeometry().getNodeLength()) * 0.5);
-
- System.out.println("pres : " + pipe.getNode(i + 1).getBulkSystem().getPressure());
- System.out
- .println("temp : " + pipe.getNode(i + 1).getBulkSystem().getTemperature());
- System.out.println("velocity : " + pipe.getNode(i + 1).getVelocity());
- System.out.println("dpdx : " + dpdx);
- System.out
- .println("JT coeff : " + pipe.getNode(i + 1).getBulkSystem().getPhases()[0]
- .getJouleThomsonCoefficient());
+ /*
+ * System.out.println("pres : " + pipe.getNode(i +
+ * 1).getBulkSystem().getPressure()); System.out .println("temp : " + pipe.getNode(i
+ * + 1).getBulkSystem().getTemperature()); System.out.println("velocity : " +
+ * pipe.getNode(i + 1).getVelocity()); System.out.println("dpdx : " + dpdx);
+ * System.out .println("JT coeff : " + pipe.getNode(i +
+ * 1).getBulkSystem().getPhases()[0] .getJouleThomsonCoefficient());
+ */
// setting velocities
pipe.getNode(i + 1).setVelocityIn(pipe.getNode(i + 1).getVelocity());
pipe.getNode(i + 1)
.setVelocity((pipe.getNode(i + 1).getVelocityIn().doubleValue()));
pipe.getNode(i + 1).init();
}
- System.out.println("err: " + err);
+ // System.out.println("err: " + err);
} while (Math.abs(err) > 1);
initMatrix();
}
@@ -779,7 +778,7 @@ public void solveTDMA() {
d = TDMAsolve.solve(a, b, c, r);
sol3Matrix = new Matrix(d, 1).transpose();
diffMatrix = sol3Matrix.minus(sol3Old);
- System.out.println("diff3: " + diffMatrix.norm1() / sol3Matrix.norm1());
+ // System.out.println("diff3: " + diffMatrix.norm1() / sol3Matrix.norm1());
initTemperature(iter);
diff = Math.abs(diffMatrix.norm1() / sol3Matrix.norm1());
@@ -810,7 +809,7 @@ public void solveTDMA() {
} while (diff > 1e-15 && iter < 10);
}
- System.out.println("maxDiff " + maxDiff);
+ // System.out.println("maxDiff " + maxDiff);
} while (Math.abs(maxDiff) > 1e-10 && iterTop < 100);// diffMatrix.norm2()/sol2Matrix.norm2())>0.1);
initFinalResults();
diff --git a/src/main/java/neqsim/fluidMechanics/flowSystem/FlowSystem.java b/src/main/java/neqsim/fluidMechanics/flowSystem/FlowSystem.java
index e708261a9..c63104cca 100644
--- a/src/main/java/neqsim/fluidMechanics/flowSystem/FlowSystem.java
+++ b/src/main/java/neqsim/fluidMechanics/flowSystem/FlowSystem.java
@@ -102,7 +102,7 @@ public void flowLegInit() {
}
totalNumberOfNodes = this.calcTotalNumberOfNodes();
- System.out.println("total number of nodes : " + totalNumberOfNodes);
+ // System.out.println("total number of nodes : " + totalNumberOfNodes);
}
/** {@inheritDoc} */
diff --git a/src/main/java/neqsim/fluidMechanics/flowSystem/onePhaseFlowSystem/pipeFlowSystem/PipeFlowSystem.java b/src/main/java/neqsim/fluidMechanics/flowSystem/onePhaseFlowSystem/pipeFlowSystem/PipeFlowSystem.java
index 430caf8e7..a8534d2d0 100644
--- a/src/main/java/neqsim/fluidMechanics/flowSystem/onePhaseFlowSystem/pipeFlowSystem/PipeFlowSystem.java
+++ b/src/main/java/neqsim/fluidMechanics/flowSystem/onePhaseFlowSystem/pipeFlowSystem/PipeFlowSystem.java
@@ -35,7 +35,7 @@ public void createSystem() {
flowNode =
new neqsim.fluidMechanics.flowNode.onePhaseNode.onePhasePipeFlowNode.onePhasePipeFlowNode[totalNumberOfNodes];
- System.out.println("nodes: " + totalNumberOfNodes);
+ // System.out.println("nodes: " + totalNumberOfNodes);
flowNode[0] =
new neqsim.fluidMechanics.flowNode.onePhaseNode.onePhasePipeFlowNode.onePhasePipeFlowNode(
thermoSystem, this.equipmentGeometry[0]);
diff --git a/src/main/java/neqsim/fluidMechanics/util/fluidMechanicsVisualization/flowSystemVisualization/FlowSystemVisualization.java b/src/main/java/neqsim/fluidMechanics/util/fluidMechanicsVisualization/flowSystemVisualization/FlowSystemVisualization.java
index 5628fd4b5..a504ca6d3 100644
--- a/src/main/java/neqsim/fluidMechanics/util/fluidMechanicsVisualization/flowSystemVisualization/FlowSystemVisualization.java
+++ b/src/main/java/neqsim/fluidMechanics/util/fluidMechanicsVisualization/flowSystemVisualization/FlowSystemVisualization.java
@@ -42,8 +42,8 @@ public FlowSystemVisualization(int nodes, int timeSteps) {
flowNodes[i][j] = new FlowNodeVisualization();
}
}
- System.out.println("nodes " + nodes);
- System.out.println("times " + time);
+ // System.out.println("nodes " + nodes);
+ // System.out.println("times " + time);
}
/** {@inheritDoc} */
diff --git a/src/main/java/neqsim/fluidMechanics/util/fluidMechanicsVisualization/flowSystemVisualization/onePhaseFlowVisualization/pipeFlowVisualization/PipeFlowVisualization.java b/src/main/java/neqsim/fluidMechanics/util/fluidMechanicsVisualization/flowSystemVisualization/onePhaseFlowVisualization/pipeFlowVisualization/PipeFlowVisualization.java
index b43790dc3..d096ff802 100644
--- a/src/main/java/neqsim/fluidMechanics/util/fluidMechanicsVisualization/flowSystemVisualization/onePhaseFlowVisualization/pipeFlowVisualization/PipeFlowVisualization.java
+++ b/src/main/java/neqsim/fluidMechanics/util/fluidMechanicsVisualization/flowSystemVisualization/onePhaseFlowVisualization/pipeFlowVisualization/PipeFlowVisualization.java
@@ -49,8 +49,8 @@ public PipeFlowVisualization(int nodes, int timeSteps) {
new neqsim.fluidMechanics.util.fluidMechanicsVisualization.flowNodeVisualization.onePhaseFlowNodeVisualization.onePhasePipeFlowNodeVisualization.OnePhasePipeFlowNodeVisualization();
}
}
- System.out.println("nodes " + nodes);
- System.out.println("times " + time);
+ // System.out.println("nodes " + nodes);
+ // System.out.println("times " + time);
}
/** {@inheritDoc} */
diff --git a/src/main/java/neqsim/fluidMechanics/util/fluidMechanicsVisualization/flowSystemVisualization/twoPhaseFlowVisualization/twoPhasePipeFlowVisualization/TwoPhasePipeFlowVisualization.java b/src/main/java/neqsim/fluidMechanics/util/fluidMechanicsVisualization/flowSystemVisualization/twoPhaseFlowVisualization/twoPhasePipeFlowVisualization/TwoPhasePipeFlowVisualization.java
index 138facf86..c2bf58869 100644
--- a/src/main/java/neqsim/fluidMechanics/util/fluidMechanicsVisualization/flowSystemVisualization/twoPhaseFlowVisualization/twoPhasePipeFlowVisualization/TwoPhasePipeFlowVisualization.java
+++ b/src/main/java/neqsim/fluidMechanics/util/fluidMechanicsVisualization/flowSystemVisualization/twoPhaseFlowVisualization/twoPhasePipeFlowVisualization/TwoPhasePipeFlowVisualization.java
@@ -56,8 +56,8 @@ public TwoPhasePipeFlowVisualization(int nodes, int timeSteps) {
flowNodes[i][j] = new TwoPhaseFlowNodeVisualization();
}
}
- System.out.println("nodes " + nodes);
- System.out.println("times " + time);
+ // System.out.println("nodes " + nodes);
+ // System.out.println("times " + time);
}
/** {@inheritDoc} */
diff --git a/src/main/java/neqsim/fluidMechanics/util/timeSeries/TimeSeries.java b/src/main/java/neqsim/fluidMechanics/util/timeSeries/TimeSeries.java
index e9ca2852d..26063cdca 100644
--- a/src/main/java/neqsim/fluidMechanics/util/timeSeries/TimeSeries.java
+++ b/src/main/java/neqsim/fluidMechanics/util/timeSeries/TimeSeries.java
@@ -103,7 +103,7 @@ public void init(FlowSystemInterface flowSystem) {
timeSteps = new double[(timeSeries.length - 1) * numberOfTimeStepsInInterval];
times = new double[(timeSeries.length - 1) * numberOfTimeStepsInInterval];
- System.out.println("times " + inletThermoSystem.length);
+ // System.out.println("times " + inletThermoSystem.length);
double temp = 0;
for (int k = 0; k < timeSeries.length - 1; k++) {
double stepLength = (timeSeries[k + 1] - timeSeries[k]) / numberOfTimeStepsInInterval;
diff --git a/src/main/java/neqsim/processSimulation/processEquipment/compressor/Compressor.java b/src/main/java/neqsim/processSimulation/processEquipment/compressor/Compressor.java
index bdff2f894..4017161d4 100644
--- a/src/main/java/neqsim/processSimulation/processEquipment/compressor/Compressor.java
+++ b/src/main/java/neqsim/processSimulation/processEquipment/compressor/Compressor.java
@@ -302,6 +302,7 @@ public void run() {
gergProps = getThermoSystem().getPhase(0).getProperties_GERG2008();
hinn = gergProps[7] * getThermoSystem().getPhase(0).getNumberOfMolesInPhase();
entropy = gergProps[8] * getThermoSystem().getPhase(0).getNumberOfMolesInPhase();
+ densInn = getThermoSystem().getPhase(0).getDensity_GERG2008();
}
inletEnthalpy = hinn;
@@ -411,6 +412,7 @@ public void run() {
gergProps = getThermoSystem().getPhase(0).getProperties_GERG2008();
actualFlowRate *= gergProps[1] / z_inlet;
kappa = gergProps[14];
+ z_inlet = gergProps[1];
}
double polytropEff =
@@ -444,8 +446,8 @@ public void run() {
// thermoSystem.getFlowRate("m3/hr")));
}
if (surgeCheck && getAntiSurge().isActive()) {
- thermoSystem.setTotalNumberOfMoles(getAntiSurge().getSurgeControlFactor()
- * thermoSystem.getTotalNumberOfMoles());
+ thermoSystem.setTotalFlowRate(getAntiSurge().getSurgeControlFactor()
+ * getCompressorChart().getSurgeCurve().getSurgeFlow(polytropicFluidHead), "Am3/hr");
thermoSystem.init(3);
fractionAntiSurge =
thermoSystem.getTotalNumberOfMoles() / orginalMolarFLow - 1.0;
@@ -804,13 +806,17 @@ public String getName() {
* @return a double
*/
public double getTotalWork() {
+ double multi = 1.0;
+ if(getAntiSurge().isActive()) {
+ multi=1.0+getAntiSurge().getCurrentSurgeFraction();
+ }
if (useGERG2008 && thermoSystem.getNumberOfPhases() == 1) {
double[] gergProps;
gergProps = getThermoSystem().getPhase(0).getProperties_GERG2008();
double enth = gergProps[7] * getThermoSystem().getPhase(0).getNumberOfMolesInPhase();
- return enth - inletEnthalpy;
+ return (enth - inletEnthalpy)*multi;
} else
- return getThermoSystem().getEnthalpy() - inletEnthalpy;
+ return multi*(getThermoSystem().getEnthalpy() - inletEnthalpy);
}
/** {@inheritDoc} */
diff --git a/src/main/java/neqsim/processSimulation/processEquipment/compressor/CompressorChart.java b/src/main/java/neqsim/processSimulation/processEquipment/compressor/CompressorChart.java
index cdaabc557..ab73fabf3 100644
--- a/src/main/java/neqsim/processSimulation/processEquipment/compressor/CompressorChart.java
+++ b/src/main/java/neqsim/processSimulation/processEquipment/compressor/CompressorChart.java
@@ -288,13 +288,13 @@ public static void main(String[] args) {
testFluid.setTemperature(24.0, "C");
testFluid.setPressure(48.0, "bara");
- testFluid.setTotalFlowRate(4.5, "MSm3/day");
+ testFluid.setTotalFlowRate(1.0, "MSm3/day");
Stream stream_1 = new Stream("Stream1", testFluid);
Compressor comp1 = new Compressor(stream_1);
comp1.setUsePolytropicCalc(true);
// comp1.getAntiSurge().setActive(true);
- comp1.setSpeed(12918);
+ comp1.setSpeed(11918);
double[] chartConditions = new double[] {0.3, 1.0, 1.0, 1.0};
// double[] speed = new double[] { 1000.0, 2000.0, 3000.0, 4000.0 };
@@ -360,12 +360,19 @@ public static void main(String[] args) {
// double[][] polyEff = new double[][] { { 66.8, 69.0, 66.4, 55.6 } };
comp1.getCompressorChart().setCurves(chartConditions, speed, flow, head, polyEff);
comp1.getCompressorChart().setHeadUnit("kJ/kg");
+
+ double[] surgeflow = new double[] {2789.0, 2550.0, 2500.0, 2200.0 };
+ double[] surgehead =
+ new double[] { 80.0, 72.0, 70.0, 65.0 };
+ comp1.getCompressorChart().getSurgeCurve().setCurve(chartConditions, surgeflow,
+ surgehead);
+ //comp1.getAntiSurge().setActive(true);
+ comp1.getAntiSurge().setSurgeControlFactor(1.0);
/*
* double[] surgeflow = new double[] { 453.2, 550.0, 700.0, 800.0 }; double[] surgehead =
* new double[] { 6000.0, 7000.0, 8000.0, 10000.0 };
* comp1.getCompressorChart().getSurgeCurve().setCurve(chartConditions, surgeflow,
- * surgehead);
- *
+ * surgehead)
* double[] stoneWallflow = new double[] { 923.2, 950.0, 980.0, 1000.0 }; double[]
* stoneWallHead = new double[] { 6000.0, 7000.0, 8000.0, 10000.0 };
* comp1.getCompressorChart().getStoneWallCurve().setCurve(chartConditions, stoneWallflow,
@@ -379,6 +386,7 @@ public static void main(String[] args) {
// operations.displayResult();
System.out.println("power " + comp1.getPower());
+ System.out.println("is surge " + comp1.getAntiSurge().isSurge());
System.out.println(
"fraction in anti surge line " + comp1.getAntiSurge().getCurrentSurgeFraction());
System.out.println("Polytropic head from curve:" + comp1.getPolytropicHead());
diff --git a/src/test/java/neqsim/fluidMechanics/flowSystem/onePhaseFlowSystem/pipeFlowSystem/PipeFlowSystemTest.java b/src/test/java/neqsim/fluidMechanics/flowSystem/onePhaseFlowSystem/pipeFlowSystem/PipeFlowSystemTest.java
index fa84a6edf..3a13ff5e5 100644
--- a/src/test/java/neqsim/fluidMechanics/flowSystem/onePhaseFlowSystem/pipeFlowSystem/PipeFlowSystemTest.java
+++ b/src/test/java/neqsim/fluidMechanics/flowSystem/onePhaseFlowSystem/pipeFlowSystem/PipeFlowSystemTest.java
@@ -69,7 +69,7 @@ void testInit() {
void testSolveSteadyState() {
testInit();
pipe.solveSteadyState(10);
- pipe.print();
+ // pipe.print();
}
@Test
diff --git a/src/test/java/neqsim/processSimulation/processEquipment/compressor/CompressorTest.java b/src/test/java/neqsim/processSimulation/processEquipment/compressor/CompressorTest.java
index 3fbadb5dc..524694f25 100644
--- a/src/test/java/neqsim/processSimulation/processEquipment/compressor/CompressorTest.java
+++ b/src/test/java/neqsim/processSimulation/processEquipment/compressor/CompressorTest.java
@@ -123,7 +123,7 @@ public void testCompressorWithGERG2008() {
//System.out.println("gerg polytropic efficiency " + compressor1.getPolytropicEfficiency()*100 + " poly eff");
//System.out.println("gerg fluid head " + compressor1.getPolytropicFluidHead() + " kJ/kg");
//System.out.println("gerg power " + compressor1.getPower() + " W");
- assertEquals(compressor1.getPolytropicEfficiency()*100, 89.99229675168343,
+ assertEquals(compressor1.getPolytropicEfficiency() * 100, 89.99367027631443,
"Test case for rigorous polytropic efficiency with GER2008 calculation should return approximate 89.992296751");
}
}
diff --git a/src/test/java/neqsim/thermo/system/SystemPrEosTest.java b/src/test/java/neqsim/thermo/system/SystemPrEosTest.java
index 7b32b221e..ad7e26844 100644
--- a/src/test/java/neqsim/thermo/system/SystemPrEosTest.java
+++ b/src/test/java/neqsim/thermo/system/SystemPrEosTest.java
@@ -116,7 +116,6 @@ public void checkFugacityCoefficientsDn2() {
@Test
@DisplayName("calculate compressibility of gas phase")
public void checkCompressibility() {
- System.out.println("gas compressibility " + testSystem.getPhase("gas").getZ());
assertEquals(testSystem.getPhase("gas").getZ(), 0.9708455641951108, 1e-5);
}
@@ -132,7 +131,6 @@ public void calcProperties() {
ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem);
testOps.TPflash();
testSystem.initProperties();
- System.out.print("enthalpy " + testSystem.getEnthalpy("kJ/kg"));
assertEquals(testSystem.getEnthalpy("kJ/kg"), -165.60627184389855,
Math.abs(-165.60627184389855 / 1000.0));
}