diff --git a/src/main/java/neqsim/physicalProperties/physicalPropertyMethods/solidPhysicalProperties/diffusivity/Diffusivity.java b/src/main/java/neqsim/physicalProperties/physicalPropertyMethods/solidPhysicalProperties/diffusivity/Diffusivity.java index 18b9cb1d04..c0d651ab66 100644 --- a/src/main/java/neqsim/physicalProperties/physicalPropertyMethods/solidPhysicalProperties/diffusivity/Diffusivity.java +++ b/src/main/java/neqsim/physicalProperties/physicalPropertyMethods/solidPhysicalProperties/diffusivity/Diffusivity.java @@ -101,6 +101,6 @@ public double getFickBinaryDiffusionCoefficient(int i, int j) { /** {@inheritDoc} */ @Override public double calcBinaryDiffusionCoefficient(int i, int j, int method) { - throw new UnsupportedOperationException("Not supported yet."); + throw new UnsupportedOperationException("Unimplemented method 'calcBinaryDiffusionCoefficient"); } } diff --git a/src/main/java/neqsim/processSimulation/SimulationBaseClass.java b/src/main/java/neqsim/processSimulation/SimulationBaseClass.java index affaa89134..e2489859a6 100644 --- a/src/main/java/neqsim/processSimulation/SimulationBaseClass.java +++ b/src/main/java/neqsim/processSimulation/SimulationBaseClass.java @@ -2,6 +2,7 @@ import java.util.UUID; import neqsim.util.NamedBaseClass; +import neqsim.util.exception.InvalidInputException; /** * Base class for process simulation objects. @@ -20,7 +21,9 @@ public abstract class SimulationBaseClass extends NamedBaseClass implements Simu protected double time = 0; /** - *

Constructor for SimulationBaseClass.

+ *

+ * Constructor for SimulationBaseClass. + *

* * @param name a {@link java.lang.String} object */ @@ -67,8 +70,8 @@ public void setTime(double value) { /** {@inheritDoc} */ public void increaseTime(double dt) { if (dt < 0) { - throw new UnsupportedOperationException( - "Input dt is negative - not allowed to go backwards in time."); + throw new RuntimeException(new InvalidInputException(this, "increaseTime", "dt", + "Negative values are not allowed. Not possible to go backwards in time.")); } this.time = this.time + dt; } diff --git a/src/main/java/neqsim/thermo/phase/PhaseDesmukhMather.java b/src/main/java/neqsim/thermo/phase/PhaseDesmukhMather.java index cda993906d..1ff452536a 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseDesmukhMather.java +++ b/src/main/java/neqsim/thermo/phase/PhaseDesmukhMather.java @@ -4,6 +4,8 @@ import org.apache.logging.log4j.Logger; import neqsim.thermo.component.ComponentDesmukhMather; import neqsim.thermo.component.ComponentGEInterface; +import neqsim.util.exception.IsNaNException; +import neqsim.util.exception.TooManyIterationsException; /** *

@@ -95,6 +97,25 @@ && getComponents()[k].getComponentName().equals("MDEA")) { } } + /** {@inheritDoc} */ + @Override + public void setAlpha(double[][] alpha) { + throw new UnsupportedOperationException("Unimplemented method 'setAlpha'"); + } + + /** + *

+ * Getter for the field aij. + *

+ * + * @param i a int + * @param j a int + * @return a double + */ + public double getAij(int i, int j) { + return aij[i][j]; + } + /** *

* Setter for the field aij. @@ -113,14 +134,26 @@ public void setAij(double[][] alpha) { * Setter for the field bij. *

* - * @param Dij an array of {@link double} objects + * @param Bij an array of {@link double} objects */ - public void setBij(double[][] Dij) { - for (int i = 0; i < Dij.length; i++) { - System.arraycopy(bij[i], 0, this.bij[i], 0, Dij[0].length); + public void setBij(double[][] Bij) { + for (int i = 0; i < Bij.length; i++) { + System.arraycopy(bij[i], 0, this.bij[i], 0, Bij[0].length); } } + /** {@inheritDoc} */ + @Override + public void setDij(double[][] Dij) { + throw new UnsupportedOperationException("Unimplemented method 'setDij'"); + } + + /** {@inheritDoc} */ + @Override + public void setDijT(double[][] DijT) { + throw new UnsupportedOperationException("Unimplemented method 'setDijT'"); + } + /** *

* getBetaDesMatij. @@ -134,19 +167,6 @@ public double getBetaDesMatij(int i, int j) { return aij[i][j] + bij[i][j] * temperature; } - /** - *

- * Getter for the field aij. - *

- * - * @param i a int - * @param j a int - * @return a double - */ - public double getAij(int i, int j) { - return aij[i][j]; - } - /** *

* Getter for the field bij. @@ -262,4 +282,10 @@ public double getSolventMolarMass() { } return molesMass / moles; } + + @Override + public double molarVolume(double pressure, double temperature, double A, double B, PhaseType pt) + throws IsNaNException, TooManyIterationsException { + throw new UnsupportedOperationException("Unimplemented method 'molarVolume'"); + } } diff --git a/src/main/java/neqsim/thermo/phase/PhaseDuanSun.java b/src/main/java/neqsim/thermo/phase/PhaseDuanSun.java index 2978c7f7be..9dbfe21803 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseDuanSun.java +++ b/src/main/java/neqsim/thermo/phase/PhaseDuanSun.java @@ -1,6 +1,8 @@ package neqsim.thermo.phase; import neqsim.thermo.component.ComponentGeDuanSun; +import neqsim.util.exception.IsNaNException; +import neqsim.util.exception.TooManyIterationsException; /** *

@@ -59,6 +61,12 @@ public void setDij(double[][] Dij) { } } + /** {@inheritDoc} */ + @Override + public void setDijT(double[][] DijT) { + throw new UnsupportedOperationException("Unimplemented method 'setDijT'"); + } + /** {@inheritDoc} */ @Override public double getExcessGibbsEnergy() { @@ -111,4 +119,10 @@ public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, public double getGibbsEnergy() { return R * temperature * numberOfMolesInPhase * (GE + Math.log(pressure)); } + + @Override + public double molarVolume(double pressure, double temperature, double A, double B, PhaseType pt) + throws IsNaNException, TooManyIterationsException { + throw new UnsupportedOperationException("Unimplemented method 'molarVolume'"); + } } diff --git a/src/main/java/neqsim/thermo/phase/PhaseGE.java b/src/main/java/neqsim/thermo/phase/PhaseGE.java index 1e48be4610..df8797e8a0 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseGE.java +++ b/src/main/java/neqsim/thermo/phase/PhaseGE.java @@ -22,7 +22,7 @@ * @author Even Solbraa * @version $Id: $Id */ -public class PhaseGE extends Phase implements PhaseGEInterface { +public abstract class PhaseGE extends Phase implements PhaseGEInterface { private static final long serialVersionUID = 1000; static Logger logger = LogManager.getLogger(PhaseGE.class); @@ -133,29 +133,6 @@ public void resetMixingRule(int type) { mixRuleEos = mixSelect.resetMixingRule(2, this); } - /** {@inheritDoc} */ - @Override - public double molarVolume(double pressure, double temperature, double A, double B, PhaseType pt) { - return 1; - } - - /** - *

- * molarVolumeAnalytic. - *

- * - * @param pressure a double - * @param temperature a double - * @param A a double - * @param B a double - * @param phase a int - * @return a double - */ - public double molarVolumeAnalytic(double pressure, double temperature, double A, double B, - int phase) { - return 1; - } - /** {@inheritDoc} */ @Override public void addComponent(String name, double moles, double molesInPhase, int compNumber) { @@ -163,54 +140,6 @@ public void addComponent(String name, double moles, double molesInPhase, int com // TODO: compNumber not in use } - /** - *

- * setAlpha. - *

- * - * @param alpha an array of {@link double} objects - */ - public void setAlpha(double[][] alpha) {} - - /** - *

- * setDij. - *

- * - * @param Dij an array of {@link double} objects - */ - public void setDij(double[][] Dij) {} - - /** {@inheritDoc} */ - @Override - public double getExcessGibbsEnergy() { - logger.error("this getExcessGibbsEnergy should never be used......."); - return 0; - } - - /** {@inheritDoc} */ - @Override - public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, - double temperature, double pressure, PhaseType pt) { - logger.error("this getExcessGibbsEnergy should never be used......."); - return 0; - } - - /** {@inheritDoc} */ - @Override - public double getGibbsEnergy() { - return 0; - } - - /** - *

- * setDijT. - *

- * - * @param DijT an array of {@link double} objects - */ - public void setDijT(double[][] DijT) {} - /** {@inheritDoc} */ @Override public double getActivityCoefficientSymetric(int k) { diff --git a/src/main/java/neqsim/thermo/phase/PhaseGEInterface.java b/src/main/java/neqsim/thermo/phase/PhaseGEInterface.java index 7e19dad57f..12d413d3ea 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseGEInterface.java +++ b/src/main/java/neqsim/thermo/phase/PhaseGEInterface.java @@ -29,4 +29,31 @@ public interface PhaseGEInterface { */ public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, double temperature, double pressure, PhaseType pt); + + /** + *

+ * setAlpha. + *

+ * + * @param alpha an array of {@link double} objects + */ + public void setAlpha(double[][] alpha); + + /** + *

+ * setDij. + *

+ * + * @param Dij an array of {@link double} objects + */ + public void setDij(double[][] Dij); + + /** + *

+ * setDijT. + *

+ * + * @param DijT an array of {@link double} objects + */ + public void setDijT(double[][] DijT); } diff --git a/src/main/java/neqsim/thermo/phase/PhaseGENRTL.java b/src/main/java/neqsim/thermo/phase/PhaseGENRTL.java index e10e4adb17..6f273839e7 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseGENRTL.java +++ b/src/main/java/neqsim/thermo/phase/PhaseGENRTL.java @@ -8,6 +8,8 @@ import neqsim.thermo.component.ComponentGEInterface; import neqsim.thermo.component.ComponentGeNRTL; +import neqsim.util.exception.IsNaNException; +import neqsim.util.exception.TooManyIterationsException; /** *

@@ -97,6 +99,12 @@ public void setDij(double[][] Dij) { } } + /** {@inheritDoc} */ + @Override + public void setDijT(double[][] DijT) { + throw new UnsupportedOperationException("Unimplemented method 'setDijT'"); + } + /** {@inheritDoc} */ @Override public double getExcessGibbsEnergy() { @@ -124,4 +132,10 @@ public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, public double getGibbsEnergy() { return R * temperature * numberOfMolesInPhase * (GE + Math.log(pressure)); } + + @Override + public double molarVolume(double pressure, double temperature, double A, double B, PhaseType pt) + throws IsNaNException, TooManyIterationsException { + throw new UnsupportedOperationException("Unimplemented method 'molarVolume'"); + } } diff --git a/src/main/java/neqsim/thermo/phase/PhaseGEUniquac.java b/src/main/java/neqsim/thermo/phase/PhaseGEUniquac.java index 1538d546be..fad0aaa1e2 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseGEUniquac.java +++ b/src/main/java/neqsim/thermo/phase/PhaseGEUniquac.java @@ -9,6 +9,8 @@ import neqsim.thermo.ThermodynamicModelSettings; import neqsim.thermo.component.ComponentGEInterface; import neqsim.thermo.component.ComponentGEUniquac; +import neqsim.util.exception.IsNaNException; +import neqsim.util.exception.TooManyIterationsException; /** *

@@ -65,6 +67,24 @@ public PhaseGEUniquac(PhaseInterface phase, double[][] alpha, double[][] Dij, St } } + /** {@inheritDoc} */ + @Override + public void setAlpha(double[][] alpha) { + throw new UnsupportedOperationException("Unimplemented method 'setAlpha'"); + } + + /** {@inheritDoc} */ + @Override + public void setDij(double[][] Dij) { + throw new UnsupportedOperationException("Unimplemented method 'setDij'"); + } + + /** {@inheritDoc} */ + @Override + public void setDijT(double[][] DijT) { + throw new UnsupportedOperationException("Unimplemented method 'setDijT'"); + } + /** {@inheritDoc} */ @Override public void addComponent(String name, double moles, double molesInPhase, int compNumber) { @@ -99,4 +119,10 @@ public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, return R * temperature * numberOfMolesInPhase * GE; } + + @Override + public double molarVolume(double pressure, double temperature, double A, double B, PhaseType pt) + throws IsNaNException, TooManyIterationsException { + throw new UnsupportedOperationException("Unimplemented method 'molarVolume'"); + } } diff --git a/src/main/java/neqsim/thermo/phase/PhaseGEWilson.java b/src/main/java/neqsim/thermo/phase/PhaseGEWilson.java index 0d2bc6704d..19580771f4 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseGEWilson.java +++ b/src/main/java/neqsim/thermo/phase/PhaseGEWilson.java @@ -2,6 +2,8 @@ import neqsim.thermo.ThermodynamicModelSettings; import neqsim.thermo.component.ComponentGEWilson; +import neqsim.util.exception.IsNaNException; +import neqsim.util.exception.TooManyIterationsException; /** *

@@ -50,6 +52,24 @@ public PhaseGEWilson(PhaseInterface phase, double[][] alpha, double[][] Dij, Str } } + /** {@inheritDoc} */ + @Override + public void setAlpha(double[][] alpha) { + throw new UnsupportedOperationException("Unimplemented method 'setAlpha'"); + } + + /** {@inheritDoc} */ + @Override + public void setDij(double[][] Dij) { + throw new UnsupportedOperationException("Unimplemented method 'setDij'"); + } + + /** {@inheritDoc} */ + @Override + public void setDijT(double[][] DijT) { + throw new UnsupportedOperationException("Unimplemented method 'setDijT'"); + } + /** {@inheritDoc} */ @Override public void addComponent(String name, double moles, double molesInPhase, int compNumber) { @@ -89,4 +109,10 @@ public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, return R * temperature * numberOfMolesInPhase * GE; } + + @Override + public double molarVolume(double pressure, double temperature, double A, double B, PhaseType pt) + throws IsNaNException, TooManyIterationsException { + throw new UnsupportedOperationException("Unimplemented method 'molarVolume'"); + } } diff --git a/src/main/java/neqsim/util/exception/NotImplementedException.java b/src/main/java/neqsim/util/exception/NotImplementedException.java new file mode 100644 index 0000000000..8b6856e9d0 --- /dev/null +++ b/src/main/java/neqsim/util/exception/NotImplementedException.java @@ -0,0 +1,32 @@ +package neqsim.util.exception; + +/** + *

+ * NotImplementedException class. + *

+ * + * @author Åsmund Våge Fannemel + */ +public class NotImplementedException extends neqsim.util.exception.ThermoException { + private static final long serialVersionUID = 1000; + + /** + * Constructs a NotImplementedException with a standard error message. + * + * @param className Class that exception is raised from + * @param methodName Method that exception is raised from + */ + public NotImplementedException(String className, String methodName) { + super(className, methodName, "Function not implemented"); + } + + /** + * Constructs a NotImplementedException with a standard error message. + * + * @param obj object that exception is raised from + * @param methodName method that exception is raised from + */ + public NotImplementedException(Object obj, String methodName) { + this(obj.getClass().getSimpleName(), methodName); + } +} diff --git a/src/main/java/neqsim/util/exception/ThermoException.java b/src/main/java/neqsim/util/exception/ThermoException.java index c574e49b0d..11a59874fc 100644 --- a/src/main/java/neqsim/util/exception/ThermoException.java +++ b/src/main/java/neqsim/util/exception/ThermoException.java @@ -14,7 +14,7 @@ * @author Even Solbraa * @version $Id: $Id */ -public class ThermoException extends java.lang.Exception { +public abstract class ThermoException extends java.lang.Exception { private static final long serialVersionUID = 1000; /**