From 081201fda4347738c84d20f0d454f222be5bf430 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=85smund=20V=C3=A5ge=20Fannemel?= <34712686+asmfstatoil@users.noreply.github.com> Date: Thu, 22 Feb 2024 00:13:34 +0100 Subject: [PATCH] fix --- .../chemicalEquilibriaum/ChemEq.java | 6 ++---- .../viscosity/Viscosity.java | 3 +-- src/main/java/neqsim/standards/Standard.java | 12 +++++------- src/main/java/neqsim/thermo/system/SystemThermo.java | 3 +++ .../standards/gasQuality/Standard_ISO6976Test.java | 5 +---- .../gasQuality/Standard_ISO6976_2016_Test.java | 5 +---- .../standards/salesContract/BaseContractTest.java | 3 --- 7 files changed, 13 insertions(+), 24 deletions(-) diff --git a/src/main/java/neqsim/chemicalReactions/chemicalEquilibriaum/ChemEq.java b/src/main/java/neqsim/chemicalReactions/chemicalEquilibriaum/ChemEq.java index 03ca2be6d4..82d5186f0f 100644 --- a/src/main/java/neqsim/chemicalReactions/chemicalEquilibriaum/ChemEq.java +++ b/src/main/java/neqsim/chemicalReactions/chemicalEquilibriaum/ChemEq.java @@ -243,9 +243,7 @@ public double step() { double[] n_omega = new double[NSPEC]; double[] chem_pot_omega = new double[NSPEC]; double[] chem_pot = new double[NSPEC]; - double G_1; - double G_0; check = 0; step = 1; @@ -262,8 +260,8 @@ public double step() { } } - G_1 = 0; - + double G_0; + double G_1 = 0; for (i = 0; i < NSPEC; i++) { G_1 += chem_pot_omega[i] * d_n[i]; } diff --git a/src/main/java/neqsim/physicalProperties/physicalPropertyMethods/liquidPhysicalProperties/viscosity/Viscosity.java b/src/main/java/neqsim/physicalProperties/physicalPropertyMethods/liquidPhysicalProperties/viscosity/Viscosity.java index 88d6ec48d4..bd538bd63a 100644 --- a/src/main/java/neqsim/physicalProperties/physicalPropertyMethods/liquidPhysicalProperties/viscosity/Viscosity.java +++ b/src/main/java/neqsim/physicalProperties/physicalPropertyMethods/liquidPhysicalProperties/viscosity/Viscosity.java @@ -61,7 +61,6 @@ public Viscosity clone() { public double calcViscosity() { double tempVar = 0; double tempVar2 = 0; - double viscosity = 0; this.calcPureComponentViscosity(); // method og Grunberg and Nissan [87] @@ -85,7 +84,7 @@ public double calcViscosity() { // liquidPhase.getPhase().getComponents()[i].getx()*liquidPhase.getPhase().getComponents()[j].getx()*liquidPhase.getMixingRule().getViscosityGij(i,j); } } - viscosity = Math.exp(tempVar + tempVar2) / 1.0e3; // N-sek/m2 + double viscosity = Math.exp(tempVar + tempVar2) / 1.0e3; // N-sek/m2 return viscosity; } diff --git a/src/main/java/neqsim/standards/Standard.java b/src/main/java/neqsim/standards/Standard.java index 5ad10d405f..1896bb60ad 100644 --- a/src/main/java/neqsim/standards/Standard.java +++ b/src/main/java/neqsim/standards/Standard.java @@ -111,6 +111,10 @@ public void setStandardDescription(String standardDescription) { /** {@inheritDoc} */ @Override public String[][] createTable(String name) { + if (thermoSystem == null) { + String[][] table = new String[0][6]; + return table; + } thermoSystem.setNumberOfPhases(1); thermoSystem.createTable(name); @@ -118,13 +122,7 @@ public String[][] createTable(String name) { nf.setMaximumFractionDigits(5); nf.applyPattern("#.#####E0"); - int rows = 0; - if (thermoSystem == null) { - String[][] table = new String[0][6]; - return table; - } - - rows = thermoSystem.getPhases()[0].getNumberOfComponents() + 30; + int rows = thermoSystem.getPhases()[0].getNumberOfComponents() + 30; String[][] table = new String[rows][6]; // String[] names = {"", "Phase 1", "Phase 2", "Phase 3", "Unit"}; table[0][0] = ""; // getPhases()[0].getType(); //""; diff --git a/src/main/java/neqsim/thermo/system/SystemThermo.java b/src/main/java/neqsim/thermo/system/SystemThermo.java index 1d7bd50e07..ad028075a7 100644 --- a/src/main/java/neqsim/thermo/system/SystemThermo.java +++ b/src/main/java/neqsim/thermo/system/SystemThermo.java @@ -3622,6 +3622,9 @@ public String[][] createTable(String name) { /** {@inheritDoc} */ @Override public void display(String name) { + if (this.getNumberOfComponents() == 0) { + return; + } javax.swing.JFrame dialog = new javax.swing.JFrame("System-Report"); java.awt.Dimension screenDimension = java.awt.Toolkit.getDefaultToolkit().getScreenSize(); java.awt.Container dialogContentPane = dialog.getContentPane(); diff --git a/src/test/java/neqsim/standards/gasQuality/Standard_ISO6976Test.java b/src/test/java/neqsim/standards/gasQuality/Standard_ISO6976Test.java index ab5a2fae6f..10d6e09315 100644 --- a/src/test/java/neqsim/standards/gasQuality/Standard_ISO6976Test.java +++ b/src/test/java/neqsim/standards/gasQuality/Standard_ISO6976Test.java @@ -169,10 +169,7 @@ void testCalculate2() { @Test void testDisplay() { - Standard_ISO6976 s = new Standard_ISO6976(null); - s.display("test"); - - s = new Standard_ISO6976(testSystem); + Standard_ISO6976 s = new Standard_ISO6976(testSystem); s.display("test"); } } diff --git a/src/test/java/neqsim/standards/gasQuality/Standard_ISO6976_2016_Test.java b/src/test/java/neqsim/standards/gasQuality/Standard_ISO6976_2016_Test.java index 49c9f40765..d6c75257a3 100644 --- a/src/test/java/neqsim/standards/gasQuality/Standard_ISO6976_2016_Test.java +++ b/src/test/java/neqsim/standards/gasQuality/Standard_ISO6976_2016_Test.java @@ -134,10 +134,7 @@ void testCalculate2() { @Test void testDisplay() { - Standard_ISO6976_2016 s = new Standard_ISO6976_2016(null); - s.display("test"); - - s = new Standard_ISO6976_2016(testSystem); + Standard_ISO6976_2016 s = new Standard_ISO6976_2016(testSystem); s.display("test"); } } diff --git a/src/test/java/neqsim/standards/salesContract/BaseContractTest.java b/src/test/java/neqsim/standards/salesContract/BaseContractTest.java index 4d23c9d4b3..5e4ccb34dd 100644 --- a/src/test/java/neqsim/standards/salesContract/BaseContractTest.java +++ b/src/test/java/neqsim/standards/salesContract/BaseContractTest.java @@ -57,8 +57,5 @@ void testDisplay() { BaseContract bc = new BaseContract(); bc.display(); - - bc = new BaseContract(null); - bc.display(); } }