From 311424d052fd05314fc1fb54ae579689fe315ea6 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 18:33:05 +0100 Subject: [PATCH 1/2] refact: remove deprecated functions --- .../ChemicalReactionOperations.java | 13 ---- .../chemicalReaction/ChemicalReaction.java | 14 ----- .../solidAdsorption/AdsorptionInterface.java | 27 -------- .../measurementDevice/pHProbe.java | 26 -------- .../salesContract/ContractSpecification.java | 8 ++- .../characterization/PlusCharacterize.java | 15 +---- .../thermo/component/ComponentInterface.java | 28 +-------- src/main/java/neqsim/thermo/phase/Phase.java | 26 -------- .../neqsim/thermo/phase/PhaseGEInterface.java | 19 ------ .../neqsim/thermo/phase/PhaseInterface.java | 62 ------------------- .../neqsim/thermo/system/SystemInterface.java | 39 ------------ .../neqsim/thermo/system/SystemThermo.java | 38 +----------- .../thermo/util/example/TestUniSimsFlash.java | 4 +- 13 files changed, 12 insertions(+), 307 deletions(-) diff --git a/src/main/java/neqsim/chemicalReactions/ChemicalReactionOperations.java b/src/main/java/neqsim/chemicalReactions/ChemicalReactionOperations.java index ba4f589a80..f455b2b5d4 100644 --- a/src/main/java/neqsim/chemicalReactions/ChemicalReactionOperations.java +++ b/src/main/java/neqsim/chemicalReactions/ChemicalReactionOperations.java @@ -278,19 +278,6 @@ public String[] getAllElements() { return elementList; } - /** - *

- * hasRections. - *

- * - * @return a boolean - * @deprecated Replaced by hasReactions() - */ - @Deprecated - public boolean hasRections() { - return this.hasReactions(); - } - /** *

* hasRections. diff --git a/src/main/java/neqsim/chemicalReactions/chemicalReaction/ChemicalReaction.java b/src/main/java/neqsim/chemicalReactions/chemicalReaction/ChemicalReaction.java index b5f30f691d..48a94585ce 100644 --- a/src/main/java/neqsim/chemicalReactions/chemicalReaction/ChemicalReaction.java +++ b/src/main/java/neqsim/chemicalReactions/chemicalReaction/ChemicalReaction.java @@ -40,20 +40,6 @@ public class ChemicalReaction extends NamedBaseClass double lnK = 0; int numberOfReactants = 0; - /** - *

- * Constructor for ChemicalReaction. - *

- * - * @deprecated use - * {@link #ChemicalReaction(String, String[], double[], double[], double, double, double)} - * instead - */ - @Deprecated - public ChemicalReaction() { - super("ChemicalReaction"); - } - /** *

* Constructor for ChemicalReaction. diff --git a/src/main/java/neqsim/physicalProperties/interfaceProperties/solidAdsorption/AdsorptionInterface.java b/src/main/java/neqsim/physicalProperties/interfaceProperties/solidAdsorption/AdsorptionInterface.java index 1af1b9638a..ba9d15bdfa 100644 --- a/src/main/java/neqsim/physicalProperties/interfaceProperties/solidAdsorption/AdsorptionInterface.java +++ b/src/main/java/neqsim/physicalProperties/interfaceProperties/solidAdsorption/AdsorptionInterface.java @@ -18,19 +18,6 @@ public interface AdsorptionInterface extends neqsim.thermo.ThermodynamicConstant */ public void calcAdsorption(int phase); - /** - *

- * calcAdsorption. - *

- * - * @param phase a int - * @deprecated Replaced by {@link calcAdsorption} - */ - @Deprecated - public default void calcAdorption(int phase) { - calcAdsorption(phase); - } - /** *

* getSurfaceExcess. @@ -41,20 +28,6 @@ public default void calcAdorption(int phase) { */ public double getSurfaceExcess(int component); - /** - *

- * getSurfaceExess. - *

- * - * @param component a int - * @return a double - * @deprecated Replaced by {@link getSurfaceExcess} - */ - @Deprecated - public default double getSurfaceExess(int component) { - return getSurfaceExcess(component); - } - /** *

* setSolidMaterial. diff --git a/src/main/java/neqsim/processSimulation/measurementDevice/pHProbe.java b/src/main/java/neqsim/processSimulation/measurementDevice/pHProbe.java index a8ef3a9ec2..3c80505a58 100644 --- a/src/main/java/neqsim/processSimulation/measurementDevice/pHProbe.java +++ b/src/main/java/neqsim/processSimulation/measurementDevice/pHProbe.java @@ -114,19 +114,6 @@ public double getAlkalinity() { return alkalinity; } - /** - *

- * Getter for the field alkalinity. - *

- * - * @return the alkalinity - * @deprecated Replaced by {@link getAlkalinity} - */ - @Deprecated - public double getAlkanility() { - return getAlkalinity(); - } - /** *

* Setter for the field alkalinity. @@ -137,17 +124,4 @@ public double getAlkanility() { public void setAlkalinity(double alkalinity) { this.alkalinity = alkalinity; } - - /** - *

- * Setter for the field alkalinity. - *

- * - * @param alkalinity the alkalinity to set - * @deprecated Replaced by {@link setAlkalinity} - */ - @Deprecated - public void setAlkanility(double alkalinity) { - setAlkalinity(alkalinity); - } } diff --git a/src/main/java/neqsim/standards/salesContract/ContractSpecification.java b/src/main/java/neqsim/standards/salesContract/ContractSpecification.java index 5d627a7141..d351e471b8 100644 --- a/src/main/java/neqsim/standards/salesContract/ContractSpecification.java +++ b/src/main/java/neqsim/standards/salesContract/ContractSpecification.java @@ -25,16 +25,18 @@ public class ContractSpecification extends NamedBaseClass { private String terminal = ""; private double minValue = 0; private double maxValue = 0; - private double referenceTemperatureMeasurement = 0, referenceTemperatureCombustion = 0; + private double referenceTemperatureMeasurement = 0; + private double referenceTemperatureCombustion = 0; private double referencePressure = 0; - private String unit = "", comments = ""; + private String unit = ""; + private String comments = ""; - @Deprecated /** *

* Constructor for ContractSpecification. *

*/ + @Deprecated public ContractSpecification() { super("ContractSpecification"); } diff --git a/src/main/java/neqsim/thermo/characterization/PlusCharacterize.java b/src/main/java/neqsim/thermo/characterization/PlusCharacterize.java index 1562d31c69..30456e94de 100644 --- a/src/main/java/neqsim/thermo/characterization/PlusCharacterize.java +++ b/src/main/java/neqsim/thermo/characterization/PlusCharacterize.java @@ -36,7 +36,9 @@ public class PlusCharacterize implements java.io.Serializable, CharacteriseInter SystemInterface system = null; /** - *

Constructor for PlusCharacterize.

+ *

+ * Constructor for PlusCharacterize. + *

*/ public PlusCharacterize() {} @@ -334,17 +336,6 @@ public int getStartPlus() { return firstPlusFractionNumber; } - /** - * Setter for property firstPlusFractionNumber. - * - * @param startPlus New value of property firstPlusFractionNumber. - * @deprecated use {@link #setFirstPlusFractionNumber(int firstPlusFractionNumber)} instead. - */ - @Deprecated - public void setStartPlus(int startPlus) { - setFirstPlusFractionNumber(startPlus); - } - /** {@inheritDoc} */ @Override public double getMPlus() { diff --git a/src/main/java/neqsim/thermo/component/ComponentInterface.java b/src/main/java/neqsim/thermo/component/ComponentInterface.java index 52b31d65c6..1d4d939cb9 100644 --- a/src/main/java/neqsim/thermo/component/ComponentInterface.java +++ b/src/main/java/neqsim/thermo/component/ComponentInterface.java @@ -605,19 +605,6 @@ public double fugcoefDiffTempNumeric(PhaseInterface phase, int numberOfComponent */ public double getTriplePointDensity(); - /** - *

- * getTripplePointDensity. - *

- * - * @return a double - * @deprecated Replaced by {@link getTriplePointDensity} - */ - @Deprecated - public default double getTripplePointDensity() { - return getTriplePointDensity(); - } - /** *

* getCriticalCompressibilityFactor. @@ -766,20 +753,7 @@ public default void addMolesChemReac(double dn) { /** *

- * getIdealGasGibsEnergyOfFormation. - *

- * - * @return a double - * @deprecated Replaced by {@link getIdealGasGibbsEnergyOfFormation} - */ - @Deprecated - public default double getIdealGasGibsEnergyOfFormation() { - return getIdealGasGibbsEnergyOfFormation(); - } - - /** - *

- * getIdealGasGibsEnergyOfFormation. + * getIdealGasGibbsEnergyOfFormation. *

* * @return a double diff --git a/src/main/java/neqsim/thermo/phase/Phase.java b/src/main/java/neqsim/thermo/phase/Phase.java index a65eedfad4..3365ce2e39 100644 --- a/src/main/java/neqsim/thermo/phase/Phase.java +++ b/src/main/java/neqsim/thermo/phase/Phase.java @@ -1207,32 +1207,6 @@ public double getThermalConductivity(String unit) { return refConductivity * conversionFactor; } - /** {@inheritDoc} */ - @Override - @Deprecated - public double getConductivity() { - return getPhysicalProperties().getConductivity(); - } - - /** {@inheritDoc} */ - @Override - @Deprecated - public double getConductivity(String unit) { - double refConductivity = getConductivity(); // conductivity in W/m*K - double conversionFactor = 1.0; - switch (unit) { - case "W/mK": - conversionFactor = 1.0; - break; - case "W/cmK": - conversionFactor = 0.01; - break; - default: - throw new RuntimeException("unit not supported " + unit); - } - return refConductivity * conversionFactor; - } - /** {@inheritDoc} */ @Override public void initRefPhases(boolean onlyPure) { diff --git a/src/main/java/neqsim/thermo/phase/PhaseGEInterface.java b/src/main/java/neqsim/thermo/phase/PhaseGEInterface.java index 9401b6da82..1973e130f4 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseGEInterface.java +++ b/src/main/java/neqsim/thermo/phase/PhaseGEInterface.java @@ -15,25 +15,6 @@ * @version $Id: $Id */ public interface PhaseGEInterface { - /** - *

- * getExessGibbsEnergy. - *

- * - * @param phase a {@link neqsim.thermo.phase.PhaseInterface} object - * @param numberOfComponents a int - * @param temperature a double - * @param pressure a double - * @param phasetype a int - * @return a double - * @deprecated Replaced by {@link getExcessGibbsEnergy}. - */ - @Deprecated - public default double getExessGibbsEnergy(PhaseInterface phase, int numberOfComponents, - double temperature, double pressure, int phasetype) { - return getExcessGibbsEnergy(phase, numberOfComponents, temperature, pressure, phasetype); - } - /** *

* getExcessGibbsEnergy. diff --git a/src/main/java/neqsim/thermo/phase/PhaseInterface.java b/src/main/java/neqsim/thermo/phase/PhaseInterface.java index 5e5d290938..ed8ef08a5f 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseInterface.java +++ b/src/main/java/neqsim/thermo/phase/PhaseInterface.java @@ -31,22 +31,6 @@ public interface PhaseInterface extends ThermodynamicConstantsInterface, Cloneab */ public void addComponent(String name, double moles, double molesInPhase, int compNumber); - /** - *

- * addcomponent. - *

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

* setMoleFractions. @@ -535,33 +519,6 @@ public default void init(double totalNumberOfMoles, int numberOfComponents, int */ public double getMixGibbsEnergy(); - /** - *

- * getExessGibbsEnergy. - *

- * - * @return a double - * @deprecated Replaced by {@link getExcessGibbsEnergy}. - */ - @Deprecated - public default double getExessGibbsEnergy() { - return getExcessGibbsEnergy(); - } - - /** - *

- * getExessGibbsEnergySymetric. - *

- * - * - * @return a double - * @deprecated Replace by {@link getExcessGibbsEnergySymetric}. - */ - @Deprecated - public default double getExessGibbsEnergySymetric() { - return getExcessGibbsEnergySymetric(); - } - /** *

* getExcessGibbsEnergy. @@ -1124,25 +1081,6 @@ public default void addMolesChemReac(int component, double dn) { */ public double getViscosity(String unit); - /** - * method to return conductivity of a phase. - * - * @return conductivity in unit W/m*K - * @deprecated use {@link #getThermalConductivity()} instead. - */ - @Deprecated - public double getConductivity(); - - /** - * method to return conductivity in a specified unit. - * - * @param unit Supported units are W/mK, W/cmK - * @return conductivity in specified unit - * @deprecated use {@link #getThermalConductivity(String unit)} instead. - */ - @Deprecated - public double getConductivity(String unit); - /** * method to return conductivity of a phase. * diff --git a/src/main/java/neqsim/thermo/system/SystemInterface.java b/src/main/java/neqsim/thermo/system/SystemInterface.java index 5cc3c9d1d8..75db75ed2f 100644 --- a/src/main/java/neqsim/thermo/system/SystemInterface.java +++ b/src/main/java/neqsim/thermo/system/SystemInterface.java @@ -461,16 +461,6 @@ public default double getGamma2() { */ public void setForcePhaseTypes(boolean forcePhaseTypes); - /** - * Set the flow rate of all components to zero. - * - * @deprecated use {@link #setEmptyFluid()} instead. - */ - @Deprecated - public default void removeMoles() { - setEmptyFluid(); - } - /** * Set the flow rate (moles) of all components to zero. */ @@ -1598,16 +1588,6 @@ public default void prettyPrint() { */ public SystemInterface addFluid(SystemInterface addSystem, int phase); - /** - *

- * Getter for property hydrateCheck. - *

- * - * @return a boolean - */ - @Deprecated - public boolean doHydrateCheck(); - /** *

* Getter for property hydrateCheck. @@ -2164,25 +2144,6 @@ public default ComponentInterface getComponent(int i) { */ public double getViscosity(String unit); - /** - * method to return thermal conductivity. - * - * @return conductivity in unit W/mK - * @deprecated use {@link #getThermalConductivity()} instead. - */ - @Deprecated - public double getConductivity(); - - /** - * method to return thermal conductivity in a specified unit. - * - * @param unit Supported units are W/mK, W/cmK - * @return conductivity in specified unit - * @deprecated use {@link #getThermalConductivity(String unit)} instead. - */ - @Deprecated - public double getConductivity(String unit); - /** * method to return conductivity of a fluid. * diff --git a/src/main/java/neqsim/thermo/system/SystemThermo.java b/src/main/java/neqsim/thermo/system/SystemThermo.java index 717405528f..d8fe26cbd6 100644 --- a/src/main/java/neqsim/thermo/system/SystemThermo.java +++ b/src/main/java/neqsim/thermo/system/SystemThermo.java @@ -2683,36 +2683,6 @@ public double getKinematicViscosity() { return getViscosity() / getDensity(); } - /** {@inheritDoc} */ - @Deprecated - @Override - public double getConductivity() { - double cond = 0; - for (int i = 0; i < numberOfPhases; i++) { - cond += beta[phaseIndex[i]] * getPhase(i).getPhysicalProperties().getConductivity(); - } - return cond; - } - - /** {@inheritDoc} */ - @Deprecated - @Override - public double getConductivity(String unit) { - double refConductivity = getConductivity(); // conductivity in W/m*K - double conversionFactor = 1.0; - switch (unit) { - case "W/mK": - conversionFactor = 1.0; - break; - case "W/cmK": - conversionFactor = 0.01; - break; - default: - throw new RuntimeException("unit not supported " + unit); - } - return refConductivity * conversionFactor; - } - /** {@inheritDoc} */ @Override public double getThermalConductivity() { @@ -2726,7 +2696,7 @@ public double getThermalConductivity() { /** {@inheritDoc} */ @Override public double getThermalConductivity(String unit) { - double refConductivity = getConductivity(); // conductivity in W/m*K + double refConductivity = getThermalConductivity(); // conductivity in W/m*K double conversionFactor = 1.0; switch (unit) { case "W/mK": @@ -3819,12 +3789,6 @@ public boolean checkStability() { return checkStability; } - /** {@inheritDoc} */ - @Override - public boolean doHydrateCheck() { - return hydrateCheck; - } - /** {@inheritDoc} */ @Override public boolean getHydrateCheck() { diff --git a/src/test/java/neqsim/thermo/util/example/TestUniSimsFlash.java b/src/test/java/neqsim/thermo/util/example/TestUniSimsFlash.java index 9d7638f6e0..9ed4964bd2 100644 --- a/src/test/java/neqsim/thermo/util/example/TestUniSimsFlash.java +++ b/src/test/java/neqsim/thermo/util/example/TestUniSimsFlash.java @@ -42,7 +42,7 @@ public static void main(String[] args) { testSystem.display(); double[] composition = new double[] {0.1, 0.0, 1.1, 1.0, 1.0}; - // testSystem.removeMoles(); + // testSystem.setEmptyFluid(); testSystem.setMolarComposition(composition); testSystem.init(0); // testSystem.setMultiPhaseCheck(true); @@ -53,7 +53,7 @@ public static void main(String[] args) { testSystem.display(); /* - * composition = new double[]{0.1, 0.0, 1.1, 1.0, 1.0}; testSystem.removeMoles(); + * composition = new double[]{0.1, 0.0, 1.1, 1.0, 1.0}; testSystem.setEmptyFluid(); * testSystem.setMolarComposition(composition); for (int i = 0; i < 1; i++) { testOps.TPflash(); * } testSystem.display(); */ From ccea21ed49dd75e531230632a486a9b69135d359 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 19:07:12 +0100 Subject: [PATCH 2/2] refact: reorder code --- .../chemicalReaction/ChemicalReaction.java | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/main/java/neqsim/chemicalReactions/chemicalReaction/ChemicalReaction.java b/src/main/java/neqsim/chemicalReactions/chemicalReaction/ChemicalReaction.java index 48a94585ce..ca925ac220 100644 --- a/src/main/java/neqsim/chemicalReactions/chemicalReaction/ChemicalReaction.java +++ b/src/main/java/neqsim/chemicalReactions/chemicalReaction/ChemicalReaction.java @@ -131,24 +131,6 @@ public double getRateFactor(PhaseInterface phase) { return 2.576e9 * Math.exp(-6024.0 / phase.getTemperature()) / 1000.0; } - /** - *

- * getK. - *

- * - * @param phase a {@link neqsim.thermo.phase.PhaseInterface} object - * @return a double - */ - public double getK(PhaseInterface phase) { - double temperature = phase.getTemperature(); - lnK = K[0] + K[1] / (temperature) + K[2] * Math.log(temperature) + K[3] * temperature; - if (shiftSignK) { - lnK = -lnK; - } - // System.out.println("K " + Math.exp(lnK)); - return Math.exp(lnK); - } - /** *

* Getter for the field stocCoefs. @@ -468,6 +450,24 @@ public double[] getK() { return this.K; } + /** + *

+ * getK. + *

+ * + * @param phase a {@link neqsim.thermo.phase.PhaseInterface} object + * @return a double + */ + public double getK(PhaseInterface phase) { + double temperature = phase.getTemperature(); + lnK = K[0] + K[1] / (temperature) + K[2] * Math.log(temperature) + K[3] * temperature; + if (shiftSignK) { + lnK = -lnK; + } + // System.out.println("K " + Math.exp(lnK)); + return Math.exp(lnK); + } + /** * Setter for property k. *