From 3a6e3f55f76f8ee62c30bc9f29b0b447d5d25e6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=85smund=20V=C3=A5ge=20Fannemel?= <34712686+asmfstatoil@users.noreply.github.com> Date: Sun, 24 Jul 2022 12:12:06 +0200 Subject: [PATCH 1/2] refact: autoformatting and fixing style warnings --- .../dataPresentation/dataHandeling.java | 220 +++--- .../KrishnaStandartFilmModel.java | 630 +++++++++--------- .../waxNode/WaxDepositionFlowNode.java | 320 +++++---- .../onePhasePipeFlowNode.java | 142 ++-- .../twoPhasePipeFlowNode/AnnularFlow.java | 509 +++++++------- .../twoPhasePipeFlowNode/BubbleFlowNode.java | 406 +++++------ .../twoPhasePipeFlowNode/DropletFlowNode.java | 592 ++++++++-------- .../StratifiedFlowNode.java | 358 +++++----- .../TwoPhaseTrayTowerFlowNode.java | 264 ++++---- .../StirredCellNode.java | 483 +++++++------- .../TwoPhasePipeFlowSolver.java | 138 ++-- .../geometryDefinitions/pipe/PipeData.java | 94 +-- .../reactor/ReactorData.java | 214 +++--- .../stirredCell/StirredCell.java | 86 +-- .../PhysicalPropertyHandler.java | 325 +++++---- .../parameterFitting/BaseFunction.java | 216 +++--- .../parameterFitting/SampleSet.java | 246 ++++--- .../LevenbergMarquardt.java | 256 +++---- .../LevenbergMarquardtAbsDev.java | 125 ++-- .../LevenbergMarquardtBiasDev.java | 115 ++-- 20 files changed, 2863 insertions(+), 2876 deletions(-) diff --git a/src/main/java/neqsim/dataPresentation/dataHandeling.java b/src/main/java/neqsim/dataPresentation/dataHandeling.java index 2eabb5f1e..32e0214ad 100644 --- a/src/main/java/neqsim/dataPresentation/dataHandeling.java +++ b/src/main/java/neqsim/dataPresentation/dataHandeling.java @@ -15,127 +15,127 @@ * @version $Id: $Id */ public class dataHandeling { - /** - *

- * Constructor for dataHandeling. - *

- */ - public dataHandeling() {} + /** + *

+ * Constructor for dataHandeling. + *

+ */ + public dataHandeling() {} - /** - *

- * getXValue. - *

- * - * @param series a int - * @param item a int - * @return a {@link java.lang.Number} object - */ - public Number getXValue(int series, int item) { - return Double.valueOf(-10.0 + (item * 0.2)); - } + /** + *

+ * getXValue. + *

+ * + * @param series a int + * @param item a int + * @return a {@link java.lang.Number} object + */ + public Number getXValue(int series, int item) { + return Double.valueOf(-10.0 + (item * 0.2)); + } - /** - * Returns the y-value for the specified series and item. Series are numbered 0, 1, ... - * - * @param series The index (zero-based) of the series; - * @param item The index (zero-based) of the required item; - * @return The y-value for the specified series and item. - */ - public Number getYValue(int series, int item) { - if (series == 0) { - return Double.valueOf(Math.cos(-10.0 + (item * 0.2))); - } else { - return Double.valueOf(2 * (Math.sin(-10.0 + (item * 0.2)))); - } + /** + * Returns the y-value for the specified series and item. Series are numbered 0, 1, ... + * + * @param series The index (zero-based) of the series; + * @param item The index (zero-based) of the required item; + * @return The y-value for the specified series and item. + */ + public Number getYValue(int series, int item) { + if (series == 0) { + return Double.valueOf(Math.cos(-10.0 + (item * 0.2))); + } else { + return Double.valueOf(2 * (Math.sin(-10.0 + (item * 0.2)))); } + } - /** - * Returns the number of series in the data source. - * - * @return The number of series in the data source. - */ - public int getSeriesCount() { - return 2; - } + /** + * Returns the number of series in the data source. + * + * @return The number of series in the data source. + */ + public int getSeriesCount() { + return 2; + } - /** - * Returns the name of the series. - * - * @param series The index (zero-based) of the series; - * @return The name of the series. - */ - public String getSeriesName(int series) { - if (series == 0) { - return "y = cosine(x)"; - } else if (series == 1) { - return "y = 2*sine(x)"; - } else { - return "Error"; - } + /** + * Returns the name of the series. + * + * @param series The index (zero-based) of the series; + * @return The name of the series. + */ + public String getSeriesName(int series) { + if (series == 0) { + return "y = cosine(x)"; + } else if (series == 1) { + return "y = 2*sine(x)"; + } else { + return "Error"; } + } - /** - * Returns the number of items in the specified series. - * - * @param series The index (zero-based) of the series; - * @return The number of items in the specified series. - */ - public int getItemCount(int series) { - return 81; - } + /** + * Returns the number of items in the specified series. + * + * @param series The index (zero-based) of the series; + * @return The number of items in the specified series. + */ + public int getItemCount(int series) { + return 81; + } - /** - *

- * getLegendItemCount. - *

- * - * @return a int - */ - public int getLegendItemCount() { - return 2; - } + /** + *

+ * getLegendItemCount. + *

+ * + * @return a int + */ + public int getLegendItemCount() { + return 2; + } - /** - *

- * getLegendItemLabels. - *

- * - * @return an array of {@link java.lang.String} objects - */ - public String[] getLegendItemLabels() { - String[] str = new String[2]; - str[1] = ""; - str[2] = ""; - return str; - } + /** + *

+ * getLegendItemLabels. + *

+ * + * @return an array of {@link java.lang.String} objects + */ + public String[] getLegendItemLabels() { + String[] str = new String[2]; + str[1] = ""; + str[2] = ""; + return str; + } - /** - *

- * printToFile. - *

- * - * @param points an array of {@link double} objects - * @param filename a {@link java.lang.String} object - */ - public void printToFile(double[][] points, String filename) { - DecimalFormat nf = new DecimalFormat(); - nf.setMaximumFractionDigits(5); - nf.applyPattern("#.####E0"); + /** + *

+ * printToFile. + *

+ * + * @param points an array of {@link double} objects + * @param filename a {@link java.lang.String} object + */ + public void printToFile(double[][] points, String filename) { + DecimalFormat nf = new DecimalFormat(); + nf.setMaximumFractionDigits(5); + nf.applyPattern("#.####E0"); - try (DataOutputStream rt = new DataOutputStream( - new BufferedOutputStream(new FileOutputStream(new File("c:/temp/" + filename))))) { - for (int i = 0; i < points.length; i++) { - for (int j = 0; j < points[i].length; j++) { - rt.writeBytes(nf.format(points[i][j]) + "\t"); - if (j == (points[i].length - 1)) { - rt.writeBytes("\n"); - } - } - } - } catch (Exception e) { - String err = e.toString(); - System.out.println(err); + try (DataOutputStream rt = new DataOutputStream( + new BufferedOutputStream(new FileOutputStream(new File("c:/temp/" + filename))))) { + for (int i = 0; i < points.length; i++) { + for (int j = 0; j < points[i].length; j++) { + rt.writeBytes(nf.format(points[i][j]) + "\t"); + if (j == (points[i].length - 1)) { + rt.writeBytes("\n"); + } } + } + } catch (Exception e) { + String err = e.toString(); + System.out.println(err); } + } } diff --git a/src/main/java/neqsim/fluidMechanics/flowNode/fluidBoundary/heatMassTransferCalc/nonEquilibriumFluidBoundary/filmModelBoundary/KrishnaStandartFilmModel.java b/src/main/java/neqsim/fluidMechanics/flowNode/fluidBoundary/heatMassTransferCalc/nonEquilibriumFluidBoundary/filmModelBoundary/KrishnaStandartFilmModel.java index 63981d90d..1ffe45837 100644 --- a/src/main/java/neqsim/fluidMechanics/flowNode/fluidBoundary/heatMassTransferCalc/nonEquilibriumFluidBoundary/filmModelBoundary/KrishnaStandartFilmModel.java +++ b/src/main/java/neqsim/fluidMechanics/flowNode/fluidBoundary/heatMassTransferCalc/nonEquilibriumFluidBoundary/filmModelBoundary/KrishnaStandartFilmModel.java @@ -18,359 +18,355 @@ * @version $Id: $Id */ public class KrishnaStandartFilmModel extends - neqsim.fluidMechanics.flowNode.fluidBoundary.heatMassTransferCalc.nonEquilibriumFluidBoundary.NonEquilibriumFluidBoundary - implements ThermodynamicConstantsInterface { - private static final long serialVersionUID = 1000; + neqsim.fluidMechanics.flowNode.fluidBoundary.heatMassTransferCalc.nonEquilibriumFluidBoundary.NonEquilibriumFluidBoundary + implements ThermodynamicConstantsInterface { + private static final long serialVersionUID = 1000; - Matrix phiMatrix; - Matrix redPhiMatrix; - Matrix redCorrectionMatrix; - Matrix betaMatrix; + Matrix phiMatrix; + Matrix redPhiMatrix; + Matrix redCorrectionMatrix; + Matrix betaMatrix; - /** - *

- * Constructor for KrishnaStandartFilmModel. - *

- */ - public KrishnaStandartFilmModel() {} + /** + *

+ * Constructor for KrishnaStandartFilmModel. + *

+ */ + public KrishnaStandartFilmModel() {} - /** - *

- * Constructor for KrishnaStandartFilmModel. - *

- * - * @param system a {@link neqsim.thermo.system.SystemInterface} object - */ - public KrishnaStandartFilmModel(SystemInterface system) { - super(system); - binaryMassTransferCoefficient = new double[2][getBulkSystem().getPhases()[0] - .getNumberOfComponents()][getBulkSystem().getPhases()[0].getNumberOfComponents()]; - binarySchmidtNumber = new double[2][getBulkSystem().getPhases()[0] - .getNumberOfComponents()][getBulkSystem().getPhases()[0].getNumberOfComponents()]; - uMassTrans = new Matrix(neq, 1); - Xgij = new Matrix(neq, 4); - this.setuMassTrans(); - uMassTransold = uMassTrans.copy(); - } - - /** - *

- * Constructor for KrishnaStandartFilmModel. - *

- * - * @param flowNode a {@link neqsim.fluidMechanics.flowNode.FlowNodeInterface} object - */ - public KrishnaStandartFilmModel(FlowNodeInterface flowNode) { - super(flowNode); - binaryMassTransferCoefficient = new double[2][getBulkSystem().getPhases()[0] - .getNumberOfComponents()][getBulkSystem().getPhases()[0].getNumberOfComponents()]; - binarySchmidtNumber = new double[2][getBulkSystem().getPhases()[0] - .getNumberOfComponents()][getBulkSystem().getPhases()[0].getNumberOfComponents()]; - uMassTrans = new Matrix(neq, 1); - Xgij = new Matrix(neq, 4); - this.setuMassTrans(); - uMassTransold = uMassTrans.copy(); - phiMatrix = new Matrix(getBulkSystem().getPhases()[0].getNumberOfComponents() - 1, - getBulkSystem().getPhases()[0].getNumberOfComponents() - 1); - redCorrectionMatrix = - new Matrix(getBulkSystem().getPhases()[0].getNumberOfComponents() - 1, 1); - } + /** + *

+ * Constructor for KrishnaStandartFilmModel. + *

+ * + * @param system a {@link neqsim.thermo.system.SystemInterface} object + */ + public KrishnaStandartFilmModel(SystemInterface system) { + super(system); + binaryMassTransferCoefficient = new double[2][getBulkSystem().getPhases()[0] + .getNumberOfComponents()][getBulkSystem().getPhases()[0].getNumberOfComponents()]; + binarySchmidtNumber = new double[2][getBulkSystem().getPhases()[0] + .getNumberOfComponents()][getBulkSystem().getPhases()[0].getNumberOfComponents()]; + uMassTrans = new Matrix(neq, 1); + Xgij = new Matrix(neq, 4); + this.setuMassTrans(); + uMassTransold = uMassTrans.copy(); + } - /** {@inheritDoc} */ - @Override - public KrishnaStandartFilmModel clone() { - KrishnaStandartFilmModel clonedSystem = null; + /** + *

+ * Constructor for KrishnaStandartFilmModel. + *

+ * + * @param flowNode a {@link neqsim.fluidMechanics.flowNode.FlowNodeInterface} object + */ + public KrishnaStandartFilmModel(FlowNodeInterface flowNode) { + super(flowNode); + binaryMassTransferCoefficient = new double[2][getBulkSystem().getPhases()[0] + .getNumberOfComponents()][getBulkSystem().getPhases()[0].getNumberOfComponents()]; + binarySchmidtNumber = new double[2][getBulkSystem().getPhases()[0] + .getNumberOfComponents()][getBulkSystem().getPhases()[0].getNumberOfComponents()]; + uMassTrans = new Matrix(neq, 1); + Xgij = new Matrix(neq, 4); + this.setuMassTrans(); + uMassTransold = uMassTrans.copy(); + phiMatrix = new Matrix(getBulkSystem().getPhases()[0].getNumberOfComponents() - 1, + getBulkSystem().getPhases()[0].getNumberOfComponents() - 1); + redCorrectionMatrix = new Matrix(getBulkSystem().getPhases()[0].getNumberOfComponents() - 1, 1); + } - try { - clonedSystem = (KrishnaStandartFilmModel) super.clone(); - } catch (Exception e) { - e.printStackTrace(System.err); - } + /** {@inheritDoc} */ + @Override + public KrishnaStandartFilmModel clone() { + KrishnaStandartFilmModel clonedSystem = null; - return clonedSystem; + try { + clonedSystem = (KrishnaStandartFilmModel) super.clone(); + } catch (Exception e) { + e.printStackTrace(System.err); } - /** - *

- * calcBinarySchmidtNumbers. - *

- * - * @param phase a int - * @return a double - */ - public double calcBinarySchmidtNumbers(int phase) { - for (int i = 0; i < getBulkSystem().getPhases()[phase].getNumberOfComponents(); i++) { - for (int j = 0; j < getBulkSystem().getPhases()[phase].getNumberOfComponents(); j++) { - binarySchmidtNumber[phase][i][j] = getBulkSystem().getPhases()[phase] - .getPhysicalProperties().getKinematicViscosity() - / getBulkSystem().getPhases()[phase].getPhysicalProperties() - .getDiffusionCoefficient(i, j); - // System.out.println("i j " + i +" j " + j); - // System.out.println("phase " + phase + " diff" + - // getBulkSystem().getPhases()[phase].getPhysicalProperties().getDiffusionCoefficient(i,j)); - // System.out.println("phase " + phase + " visk" + - // getBulkSystem().getPhases()[phase].getPhysicalProperties().getKinematicViscosity()); - } - } - return 1; + return clonedSystem; + } + + /** + *

+ * calcBinarySchmidtNumbers. + *

+ * + * @param phase a int + * @return a double + */ + public double calcBinarySchmidtNumbers(int phase) { + for (int i = 0; i < getBulkSystem().getPhases()[phase].getNumberOfComponents(); i++) { + for (int j = 0; j < getBulkSystem().getPhases()[phase].getNumberOfComponents(); j++) { + binarySchmidtNumber[phase][i][j] = + getBulkSystem().getPhases()[phase].getPhysicalProperties().getKinematicViscosity() + / getBulkSystem().getPhases()[phase].getPhysicalProperties() + .getDiffusionCoefficient(i, j); + // System.out.println("i j " + i +" j " + j); + // System.out.println("phase " + phase + " diff" + + // getBulkSystem().getPhases()[phase].getPhysicalProperties().getDiffusionCoefficient(i,j)); + // System.out.println("phase " + phase + " visk" + + // getBulkSystem().getPhases()[phase].getPhysicalProperties().getKinematicViscosity()); + } } + return 1; + } - /** - *

- * calcBinaryMassTransferCoefficients. - *

- * - * @param phase a int - * @return a double - */ - public double calcBinaryMassTransferCoefficients(int phase) { - for (int i = 0; i < getBulkSystem().getPhases()[phase].getNumberOfComponents(); i++) { - for (int j = 0; j < getBulkSystem().getPhases()[phase].getNumberOfComponents(); j++) { - binaryMassTransferCoefficient[phase][i][j] = flowNode - .getInterphaseTransportCoefficient().calcInterphaseMassTransferCoefficient( - phase, binarySchmidtNumber[phase][i][j], flowNode); - } - } - return 1; + /** + *

+ * calcBinaryMassTransferCoefficients. + *

+ * + * @param phase a int + * @return a double + */ + public double calcBinaryMassTransferCoefficients(int phase) { + for (int i = 0; i < getBulkSystem().getPhases()[phase].getNumberOfComponents(); i++) { + for (int j = 0; j < getBulkSystem().getPhases()[phase].getNumberOfComponents(); j++) { + binaryMassTransferCoefficient[phase][i][j] = + flowNode.getInterphaseTransportCoefficient().calcInterphaseMassTransferCoefficient( + phase, binarySchmidtNumber[phase][i][j], flowNode); + } } + return 1; + } - /** - *

- * calcMassTransferCoefficients. - *

- * - * @param phase a int - * @return a double - */ - public double calcMassTransferCoefficients(int phase) { - int n = getBulkSystem().getPhases()[phase].getNumberOfComponents() - 1; + /** + *

+ * calcMassTransferCoefficients. + *

+ * + * @param phase a int + * @return a double + */ + public double calcMassTransferCoefficients(int phase) { + int n = getBulkSystem().getPhases()[phase].getNumberOfComponents() - 1; - for (int i = 0; i < getBulkSystem().getPhases()[phase].getNumberOfComponents() - 1; i++) { - double tempVar = 0; - for (int j = 0; j < getBulkSystem().getPhases()[phase].getNumberOfComponents(); j++) { - if (i != j) { - tempVar += getBulkSystem().getPhases()[phase].getComponents()[j].getx() - / binaryMassTransferCoefficient[phase][i][j]; - } - if (j < n) { - massTransferCoefficientMatrix[phase].set(i, j, - -getBulkSystem().getPhases()[phase].getComponents()[i].getx() - * (1.0 / binaryMassTransferCoefficient[phase][i][j] - - 1.0 / binaryMassTransferCoefficient[phase][i][n])); - } - } - massTransferCoefficientMatrix[phase].set(i, i, - tempVar + getBulkSystem().getPhases()[phase].getComponents()[i].getx() - / binaryMassTransferCoefficient[phase][i][n]); + for (int i = 0; i < getBulkSystem().getPhases()[phase].getNumberOfComponents() - 1; i++) { + double tempVar = 0; + for (int j = 0; j < getBulkSystem().getPhases()[phase].getNumberOfComponents(); j++) { + if (i != j) { + tempVar += getBulkSystem().getPhases()[phase].getComponents()[j].getx() + / binaryMassTransferCoefficient[phase][i][j]; + } + if (j < n) { + massTransferCoefficientMatrix[phase].set(i, j, + -getBulkSystem().getPhases()[phase].getComponents()[i].getx() + * (1.0 / binaryMassTransferCoefficient[phase][i][j] + - 1.0 / binaryMassTransferCoefficient[phase][i][n])); } - massTransferCoefficientMatrix[phase] = massTransferCoefficientMatrix[phase].inverse(); - return 1; + } + massTransferCoefficientMatrix[phase].set(i, i, + tempVar + getBulkSystem().getPhases()[phase].getComponents()[i].getx() + / binaryMassTransferCoefficient[phase][i][n]); } + massTransferCoefficientMatrix[phase] = massTransferCoefficientMatrix[phase].inverse(); + return 1; + } - /** - *

- * calcPhiMatrix. - *

- * - * @param phase a int - */ - public void calcPhiMatrix(int phase) { - int n = getBulkSystem().getPhases()[phase].getNumberOfComponents() - 1; + /** + *

+ * calcPhiMatrix. + *

+ * + * @param phase a int + */ + public void calcPhiMatrix(int phase) { + int n = getBulkSystem().getPhases()[phase].getNumberOfComponents() - 1; - for (int i = 0; i < getBulkSystem().getPhases()[phase].getNumberOfComponents() - 1; i++) { - double tempVar = 0; - for (int j = 0; j < getBulkSystem().getPhases()[phase].getNumberOfComponents(); j++) { - if (i != j || i == n) { - tempVar += nFlux.get(i, 0) - / (1.0 / (getBulkSystem().getPhases()[phase].getMolarVolume() * 1e-5) - * binaryMassTransferCoefficient[phase][i][j]); - } - if (j < n) { - phiMatrix.set(i, j, -nFlux.get(i, 0) * (1.0 - / (1.0 / (getBulkSystem().getPhases()[phase].getMolarVolume() * 1e-5) - * binaryMassTransferCoefficient[phase][i][j]) - - 1.0 / (1.0 - / (getBulkSystem().getPhases()[phase].getMolarVolume() * 1e-5) - * binaryMassTransferCoefficient[phase][i][n]))); - } - } - phiMatrix - .set(i, i, - tempVar + nFlux.get(i, 0) / (1.0 - / (getBulkSystem().getPhases()[phase].getMolarVolume() * 1e-5) - * binaryMassTransferCoefficient[phase][i][n])); + for (int i = 0; i < getBulkSystem().getPhases()[phase].getNumberOfComponents() - 1; i++) { + double tempVar = 0; + for (int j = 0; j < getBulkSystem().getPhases()[phase].getNumberOfComponents(); j++) { + if (i != j || i == n) { + tempVar += + nFlux.get(i, 0) / (1.0 / (getBulkSystem().getPhases()[phase].getMolarVolume() * 1e-5) + * binaryMassTransferCoefficient[phase][i][j]); + } + if (j < n) { + phiMatrix.set(i, j, -nFlux.get(i, 0) * (1.0 + / (1.0 / (getBulkSystem().getPhases()[phase].getMolarVolume() * 1e-5) + * binaryMassTransferCoefficient[phase][i][j]) + - 1.0 / (1.0 / (getBulkSystem().getPhases()[phase].getMolarVolume() * 1e-5) + * binaryMassTransferCoefficient[phase][i][n]))); } + } + phiMatrix.set(i, i, + tempVar + nFlux.get(i, 0) + / (1.0 / (getBulkSystem().getPhases()[phase].getMolarVolume() * 1e-5) + * binaryMassTransferCoefficient[phase][i][n])); } + } - /** - *

- * calcRedPhiMatrix. - *

- * - * @param phase a int - */ - public void calcRedPhiMatrix(int phase) { - redPhiMatrix = new Matrix(phiMatrix.eig().getRealEigenvalues(), 1); - } + /** + *

+ * calcRedPhiMatrix. + *

+ * + * @param phase a int + */ + public void calcRedPhiMatrix(int phase) { + redPhiMatrix = new Matrix(phiMatrix.eig().getRealEigenvalues(), 1); + } - /** - *

- * calcRedCorrectionMatrix. - *

- * - * @param phase a int - */ - public void calcRedCorrectionMatrix(int phase) { - for (int i = 0; i < getBulkSystem().getPhases()[phase].getNumberOfComponents() - 1; i++) { - redCorrectionMatrix.set(i, 0, - (redPhiMatrix.get(0, i) * Math.exp(redPhiMatrix.get(0, i))) - / (Math.exp(redPhiMatrix.get(0, i)) - (1.0 - 1e-15))); - } + /** + *

+ * calcRedCorrectionMatrix. + *

+ * + * @param phase a int + */ + public void calcRedCorrectionMatrix(int phase) { + for (int i = 0; i < getBulkSystem().getPhases()[phase].getNumberOfComponents() - 1; i++) { + redCorrectionMatrix.set(i, 0, (redPhiMatrix.get(0, i) * Math.exp(redPhiMatrix.get(0, i))) + / (Math.exp(redPhiMatrix.get(0, i)) - (1.0 - 1e-15))); } + } - /** - *

- * calcCorrectionMatrix. - *

- * - * @param phase a int - */ - public void calcCorrectionMatrix(int phase) { - Matrix modalPhiMatrix = phiMatrix.eig().getV(); - Matrix diagonalRedCorrectionMatrix = - new Matrix(getBulkSystem().getPhases()[phase].getNumberOfComponents() - 1, - getBulkSystem().getPhases()[phase].getNumberOfComponents() - 1); - for (int i = 0; i < getBulkSystem().getPhases()[phase].getNumberOfComponents() - 1; i++) { - diagonalRedCorrectionMatrix.set(i, i, redCorrectionMatrix.get(i, 0)); - } - rateCorrectionMatrix[phase] = - modalPhiMatrix.times(diagonalRedCorrectionMatrix.times(modalPhiMatrix.inverse())); + /** + *

+ * calcCorrectionMatrix. + *

+ * + * @param phase a int + */ + public void calcCorrectionMatrix(int phase) { + Matrix modalPhiMatrix = phiMatrix.eig().getV(); + Matrix diagonalRedCorrectionMatrix = + new Matrix(getBulkSystem().getPhases()[phase].getNumberOfComponents() - 1, + getBulkSystem().getPhases()[phase].getNumberOfComponents() - 1); + for (int i = 0; i < getBulkSystem().getPhases()[phase].getNumberOfComponents() - 1; i++) { + diagonalRedCorrectionMatrix.set(i, i, redCorrectionMatrix.get(i, 0)); } + rateCorrectionMatrix[phase] = + modalPhiMatrix.times(diagonalRedCorrectionMatrix.times(modalPhiMatrix.inverse())); + } - /** - *

- * calcTotalMassTransferCoefficientMatrix. - *

- * - * @param phase a int - */ - public void calcTotalMassTransferCoefficientMatrix(int phase) { + /** + *

+ * calcTotalMassTransferCoefficientMatrix. + *

+ * + * @param phase a int + */ + public void calcTotalMassTransferCoefficientMatrix(int phase) { + totalMassTransferCoefficientMatrix[phase] = massTransferCoefficientMatrix[phase]; + // System.out.println("before phase: " + phase); + // totalMassTransferCoefficientMatrix[phase].print(10,10); + // System.out.println("eqcorr " + useThermodynamicCorrections(phase)); + // System.out.println("fluxcorr " + useFiniteFluxCorrection(phase)); + if (Math.abs(totalFlux) > 1e-30) { + if (useFiniteFluxCorrection(phase) && useThermodynamicCorrections(phase)) { + totalMassTransferCoefficientMatrix[phase] = rateCorrectionMatrix[phase] + .times(nonIdealCorrections[phase].times(massTransferCoefficientMatrix[phase])); + } else if (useFiniteFluxCorrection(phase)) { + totalMassTransferCoefficientMatrix[phase] = + rateCorrectionMatrix[phase].times(massTransferCoefficientMatrix[phase]); + } else if (useThermodynamicCorrections(phase)) { + totalMassTransferCoefficientMatrix[phase] = + massTransferCoefficientMatrix[phase].times(nonIdealCorrections[phase]); + } else { totalMassTransferCoefficientMatrix[phase] = massTransferCoefficientMatrix[phase]; - // System.out.println("before phase: " + phase); - // totalMassTransferCoefficientMatrix[phase].print(10,10); - // System.out.println("eqcorr " + useThermodynamicCorrections(phase)); - // System.out.println("fluxcorr " + useFiniteFluxCorrection(phase)); - if (Math.abs(totalFlux) > 1e-30) { - if (useFiniteFluxCorrection(phase) && useThermodynamicCorrections(phase)) { - totalMassTransferCoefficientMatrix[phase] = rateCorrectionMatrix[phase].times( - nonIdealCorrections[phase].times(massTransferCoefficientMatrix[phase])); - } else if (useFiniteFluxCorrection(phase)) { - totalMassTransferCoefficientMatrix[phase] = - rateCorrectionMatrix[phase].times(massTransferCoefficientMatrix[phase]); - } else if (useThermodynamicCorrections(phase)) { - totalMassTransferCoefficientMatrix[phase] = - massTransferCoefficientMatrix[phase].times(nonIdealCorrections[phase]); - } else { - totalMassTransferCoefficientMatrix[phase] = massTransferCoefficientMatrix[phase]; - } - } else { - totalMassTransferCoefficientMatrix[phase] = massTransferCoefficientMatrix[phase]; - } - // System.out.println("phase: " + phase); - // totalMassTransferCoefficientMatrix[phase].print(10,10); + } + } else { + totalMassTransferCoefficientMatrix[phase] = massTransferCoefficientMatrix[phase]; } + // System.out.println("phase: " + phase); + // totalMassTransferCoefficientMatrix[phase].print(10,10); + } - /** - *

- * initCorrections. - *

- * - * @param phase a int - */ - public void initCorrections(int phase) { - calcPhiMatrix(phase); - // phiMatrix.print(10,10); - calcRedPhiMatrix(phase); - // redPhiMatrix.print(10,10); - calcRedCorrectionMatrix(phase); - // redCorrectionMatrix.print(10,10); - calcCorrectionMatrix(phase); - // System.out.println("corr mat: " + phase); - // rateCorrectionMatrix[phase].print(10,10); - } + /** + *

+ * initCorrections. + *

+ * + * @param phase a int + */ + public void initCorrections(int phase) { + calcPhiMatrix(phase); + // phiMatrix.print(10,10); + calcRedPhiMatrix(phase); + // redPhiMatrix.print(10,10); + calcRedCorrectionMatrix(phase); + // redCorrectionMatrix.print(10,10); + calcCorrectionMatrix(phase); + // System.out.println("corr mat: " + phase); + // rateCorrectionMatrix[phase].print(10,10); + } - /** {@inheritDoc} */ - @Override - public void initMassTransferCalc() { - super.initMassTransferCalc(); - for (int phase = 0; phase < 2; phase++) { - this.calcBinarySchmidtNumbers(phase); - this.calcBinaryMassTransferCoefficients(phase); - this.calcMassTransferCoefficients(phase); - this.initCorrections(phase); - this.calcNonIdealCorrections(phase); - // this.calcFluxTypeCorrectionMatrix(phase,0); - this.calcTotalMassTransferCoefficientMatrix(phase); - } + /** {@inheritDoc} */ + @Override + public void initMassTransferCalc() { + super.initMassTransferCalc(); + for (int phase = 0; phase < 2; phase++) { + this.calcBinarySchmidtNumbers(phase); + this.calcBinaryMassTransferCoefficients(phase); + this.calcMassTransferCoefficients(phase); + this.initCorrections(phase); + this.calcNonIdealCorrections(phase); + // this.calcFluxTypeCorrectionMatrix(phase,0); + this.calcTotalMassTransferCoefficientMatrix(phase); } + } - /** {@inheritDoc} */ - @Override - public void initHeatTransferCalc() { - super.initHeatTransferCalc(); - for (int phase = 0; phase < 2; phase++) { - this.calcHeatTransferCoefficients(phase); - this.calcHeatTransferCorrection(phase); - } + /** {@inheritDoc} */ + @Override + public void initHeatTransferCalc() { + super.initHeatTransferCalc(); + for (int phase = 0; phase < 2; phase++) { + this.calcHeatTransferCoefficients(phase); + this.calcHeatTransferCorrection(phase); } + } - /** {@inheritDoc} */ - @Override - public void init() { - super.init(); - if (massTransferCalc) { - this.initMassTransferCalc(); - } - if (heatTransferCalc) { - this.initHeatTransferCalc(); - } + /** {@inheritDoc} */ + @Override + public void init() { + super.init(); + if (massTransferCalc) { + this.initMassTransferCalc(); } - - /** {@inheritDoc} */ - @Override - public void solve() { - super.solve(); + if (heatTransferCalc) { + this.initHeatTransferCalc(); } + } - /** - *

- * main. - *

- * - * @param args an array of {@link java.lang.String} objects - */ - @SuppressWarnings("unused") - public static void main(String[] args) { - System.out.println("Starter....."); - SystemSrkEos testSystem = new SystemSrkEos(295.3, 3.0); - ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem); - PipeData pipe1 = new PipeData(0.1, 0.025); + /** {@inheritDoc} */ + @Override + public void solve() { + super.solve(); + } - testSystem.addComponent("methane", 0.0071152181, 0); - testSystem.addComponent("ethane", 0.0071152181, 0); - testSystem.addComponent("water", 0.00362204876, 1); - testSystem.createDatabase(true); - testSystem.setMixingRule(2); - testSystem.initPhysicalProperties(); - FlowNodeInterface test = new AnnularFlow(testSystem, pipe1); - test.initFlowCalc(); - test.init(); + /** + *

+ * main. + *

+ * + * @param args an array of {@link java.lang.String} objects + */ + @SuppressWarnings("unused") + public static void main(String[] args) { + System.out.println("Starter....."); + SystemSrkEos testSystem = new SystemSrkEos(295.3, 3.0); + ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem); + PipeData pipe1 = new PipeData(0.1, 0.025); - KrishnaStandartFilmModel test2 = new KrishnaStandartFilmModel(test); - test2.solve(); - // test2.initCorrections(1); - test2.calcFluxes(); - test2.getInterphaseSystem().display(); - test2.display(""); - } + testSystem.addComponent("methane", 0.0071152181, 0); + testSystem.addComponent("ethane", 0.0071152181, 0); + testSystem.addComponent("water", 0.00362204876, 1); + testSystem.createDatabase(true); + testSystem.setMixingRule(2); + testSystem.initPhysicalProperties(); + FlowNodeInterface test = new AnnularFlow(testSystem, pipe1); + test.initFlowCalc(); + test.init(); + + KrishnaStandartFilmModel test2 = new KrishnaStandartFilmModel(test); + test2.solve(); + // test2.initCorrections(1); + test2.calcFluxes(); + test2.getInterphaseSystem().display(); + test2.display(""); + } } 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 02e6e619a..ed6e8942e 100644 --- a/src/main/java/neqsim/fluidMechanics/flowNode/multiPhaseNode/waxNode/WaxDepositionFlowNode.java +++ b/src/main/java/neqsim/fluidMechanics/flowNode/multiPhaseNode/waxNode/WaxDepositionFlowNode.java @@ -19,171 +19,169 @@ * @version $Id: $Id */ public class WaxDepositionFlowNode extends MultiPhaseFlowNode { - private static final long serialVersionUID = 1000; - - /** - *

- * Constructor for WaxDepositionFlowNode. - *

- */ - public WaxDepositionFlowNode() { - this.flowNodeType = "wax deposition node"; - } - - /** - *

- * Constructor for WaxDepositionFlowNode. - *

- * - * @param system a {@link neqsim.thermo.system.SystemInterface} object - * @param pipe a {@link neqsim.fluidMechanics.geometryDefinitions.GeometryDefinitionInterface} - * object - */ - public WaxDepositionFlowNode(SystemInterface system, GeometryDefinitionInterface pipe) { - super(system, pipe); - this.flowNodeType = "wax deposition node"; - this.interphaseTransportCoefficient = new InterphaseStratifiedFlow(this); - this.fluidBoundary = - new neqsim.fluidMechanics.flowNode.fluidBoundary.heatMassTransferCalc.nonEquilibriumFluidBoundary.filmModelBoundary.KrishnaStandartFilmModel( - this); - } - - /** - *

- * Constructor for WaxDepositionFlowNode. - *

- * - * @param system a {@link neqsim.thermo.system.SystemInterface} object - * @param interphaseSystem a {@link neqsim.thermo.system.SystemInterface} object - * @param pipe a {@link neqsim.fluidMechanics.geometryDefinitions.GeometryDefinitionInterface} - * object - */ - public WaxDepositionFlowNode(SystemInterface system, SystemInterface interphaseSystem, - GeometryDefinitionInterface pipe) { - super(system, pipe); - this.flowNodeType = "wax deposition node"; - this.interphaseTransportCoefficient = new InterphaseStratifiedFlow(this); - this.fluidBoundary = - new neqsim.fluidMechanics.flowNode.fluidBoundary.heatMassTransferCalc.nonEquilibriumFluidBoundary.filmModelBoundary.KrishnaStandartFilmModel( - this); + private static final long serialVersionUID = 1000; + + /** + *

+ * Constructor for WaxDepositionFlowNode. + *

+ */ + public WaxDepositionFlowNode() { + this.flowNodeType = "wax deposition node"; + } + + /** + *

+ * Constructor for WaxDepositionFlowNode. + *

+ * + * @param system a {@link neqsim.thermo.system.SystemInterface} object + * @param pipe a {@link neqsim.fluidMechanics.geometryDefinitions.GeometryDefinitionInterface} + * object + */ + public WaxDepositionFlowNode(SystemInterface system, GeometryDefinitionInterface pipe) { + super(system, pipe); + this.flowNodeType = "wax deposition node"; + this.interphaseTransportCoefficient = new InterphaseStratifiedFlow(this); + this.fluidBoundary = + new neqsim.fluidMechanics.flowNode.fluidBoundary.heatMassTransferCalc.nonEquilibriumFluidBoundary.filmModelBoundary.KrishnaStandartFilmModel( + this); + } + + /** + *

+ * Constructor for WaxDepositionFlowNode. + *

+ * + * @param system a {@link neqsim.thermo.system.SystemInterface} object + * @param interphaseSystem a {@link neqsim.thermo.system.SystemInterface} object + * @param pipe a {@link neqsim.fluidMechanics.geometryDefinitions.GeometryDefinitionInterface} + * object + */ + public WaxDepositionFlowNode(SystemInterface system, SystemInterface interphaseSystem, + GeometryDefinitionInterface pipe) { + super(system, pipe); + this.flowNodeType = "wax deposition node"; + this.interphaseTransportCoefficient = new InterphaseStratifiedFlow(this); + this.fluidBoundary = + new neqsim.fluidMechanics.flowNode.fluidBoundary.heatMassTransferCalc.nonEquilibriumFluidBoundary.filmModelBoundary.KrishnaStandartFilmModel( + this); + } + + /** {@inheritDoc} */ + @Override + public StratifiedFlowNode clone() { + StratifiedFlowNode clonedSystem = null; + try { + clonedSystem = (StratifiedFlowNode) super.clone(); + } catch (Exception e) { + e.printStackTrace(System.err); } - /** {@inheritDoc} */ - @Override - public StratifiedFlowNode clone() { - StratifiedFlowNode clonedSystem = null; - try { - clonedSystem = (StratifiedFlowNode) super.clone(); - } catch (Exception e) { - e.printStackTrace(System.err); - } - - return clonedSystem; + return clonedSystem; + } + + /** {@inheritDoc} */ + @Override + public void init() { + inclination = 0.0; + this.calcContactLength(); + // System.out.println("len " + this.calcContactLength()); + super.init(); + } + + /** {@inheritDoc} */ + @Override + public double calcContactLength() { + double phaseAngel = + pi * phaseFraction[1] + Math.pow(3.0 * pi / 2.0, 1.0 / 3.0) * (1.0 - 2.0 * phaseFraction[1] + + Math.pow(phaseFraction[1], 1.0 / 3.0) - Math.pow(phaseFraction[0], 1.0 / 3.0)); + wallContactLength[1] = phaseAngel * pipe.getDiameter(); + wallContactLength[0] = pi * pipe.getDiameter() - wallContactLength[1]; + interphaseContactLength[0] = pipe.getDiameter() * Math.sin(phaseAngel); + interphaseContactLength[1] = pipe.getDiameter() * Math.sin(phaseAngel); + return wallContactLength[0]; + } + + /** {@inheritDoc} */ + @Override + public FlowNodeInterface getNextNode() { + StratifiedFlowNode newNode = this.clone(); + + for (int i = 0; i < getBulkSystem().getPhases()[0].getNumberOfComponents(); i++) { + // newNode.getBulkSystem().getPhases()[0].addMoles(i, -molarMassTransfer[i]); + // newNode.getBulkSystem().getPhases()[1].addMoles(i, +molarMassTransfer[i]); } - /** {@inheritDoc} */ - @Override - public void init() { - inclination = 0.0; - this.calcContactLength(); - // System.out.println("len " + this.calcContactLength()); - super.init(); + return newNode; + } + + /** + *

+ * main. + *

+ * + * @param args an array of {@link java.lang.String} objects + */ + @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); + ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem); + PipeData pipe1 = new PipeData(0.203, 0.00025); + + testSystem.addComponent("methane", 25.0, 0); + // testSystem.addComponent("water", 1.95, 1); + testSystem.addComponent("nC16", 1.5, 1); + + testSystem.createDatabase(true); + testSystem.setMixingRule(2); + testSystem.init_x_y(); + testSystem.initBeta(); + testSystem.display(); + + FlowNodeInterface test = new StratifiedFlowNode(testSystem, pipe1); + test.setInterphaseModelType(1); + test.setLengthOfNode(0.005); + test.getGeometry().getSurroundingEnvironment().setTemperature(273.15 + 40.0); + + test.getFluidBoundary().setHeatTransferCalc(true); + test.getFluidBoundary().setMassTransferCalc(true); + + test.initFlowCalc(); + test.calcFluxes(); + test.update(); + test.getInterphaseSystem().display(); + test.getFluidBoundary().display(""); + test.getFluidBoundary().getInterphaseSystem().display(); + // test.getBulkSystem().display(); + + for (int i = 0; i < 5; i++) { + test.initFlowCalc(); + test.calcFluxes(); + test.update(); } - - /** {@inheritDoc} */ - @Override - public double calcContactLength() { - double phaseAngel = pi * phaseFraction[1] + Math.pow(3.0 * pi / 2.0, 1.0 / 3.0) - * (1.0 - 2.0 * phaseFraction[1] + Math.pow(phaseFraction[1], 1.0 / 3.0) - - Math.pow(phaseFraction[0], 1.0 / 3.0)); - wallContactLength[1] = phaseAngel * pipe.getDiameter(); - wallContactLength[0] = pi * pipe.getDiameter() - wallContactLength[1]; - interphaseContactLength[0] = pipe.getDiameter() * Math.sin(phaseAngel); - interphaseContactLength[1] = pipe.getDiameter() * Math.sin(phaseAngel); - return wallContactLength[0]; - } - - /** {@inheritDoc} */ - @Override - public FlowNodeInterface getNextNode() { - StratifiedFlowNode newNode = this.clone(); - - for (int i = 0; i < getBulkSystem().getPhases()[0].getNumberOfComponents(); i++) { - // newNode.getBulkSystem().getPhases()[0].addMoles(i, -molarMassTransfer[i]); - // newNode.getBulkSystem().getPhases()[1].addMoles(i, +molarMassTransfer[i]); - } - - return newNode; - } - - /** - *

- * main. - *

- * - * @param args an array of {@link java.lang.String} objects + test.getBulkSystem().display(); + + /* + * double length = 0; + * + * double[][] temperatures2 = new double[3][1000]; int k = 0; for (int i = 0; i < 11; i++) { + * length += test.getLengthOfNode(); test.initFlowCalc(); test.calcFluxes(); if (i > 1 && (i % + * 1) == 0) { k++; test.display("length " + length); test.getBulkSystem().display("length " + + * length); test.getInterphaseSystem().display("length " + length); + * //test.getFluidBoundary().display("length " + length); test.setLengthOfNode(0.000005 + + * test.getLengthOfNode() / 2.0); temperatures2[0][k] = length; temperatures2[1][k] = + * test.getGeometry().getTemperature(); test.getFluidBoundary().display("test"); } + * + * //test.getBulkSystem().display(); test.update(); test.getFluidBoundary().display("length " + + * length); test.getInterphaseSystem().display("length " + length); + * + * + * //test.getFluidBoundary().display("test"); } + * + * for (int i = 0; i < k; i++) { System.out.println("len temp " + temperatures2[0][i] + " " + + * temperatures2[1][i]); } */ - @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); - ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem); - PipeData pipe1 = new PipeData(0.203, 0.00025); - - testSystem.addComponent("methane", 25.0, 0); - // testSystem.addComponent("water", 1.95, 1); - testSystem.addComponent("nC16", 1.5, 1); - - testSystem.createDatabase(true); - testSystem.setMixingRule(2); - testSystem.init_x_y(); - testSystem.initBeta(); - testSystem.display(); - - FlowNodeInterface test = new StratifiedFlowNode(testSystem, pipe1); - test.setInterphaseModelType(1); - test.setLengthOfNode(0.005); - test.getGeometry().getSurroundingEnvironment().setTemperature(273.15 + 40.0); - - test.getFluidBoundary().setHeatTransferCalc(true); - test.getFluidBoundary().setMassTransferCalc(true); - - test.initFlowCalc(); - test.calcFluxes(); - test.update(); - test.getInterphaseSystem().display(); - test.getFluidBoundary().display(""); - test.getFluidBoundary().getInterphaseSystem().display(); - // test.getBulkSystem().display(); - - for (int i = 0; i < 5; i++) { - test.initFlowCalc(); - test.calcFluxes(); - test.update(); - } - test.getBulkSystem().display(); - - /* - * double length = 0; - * - * double[][] temperatures2 = new double[3][1000]; int k = 0; for (int i = 0; i < 11; i++) { - * length += test.getLengthOfNode(); test.initFlowCalc(); test.calcFluxes(); if (i > 1 && (i - * % 1) == 0) { k++; test.display("length " + length); - * test.getBulkSystem().display("length " + length); - * test.getInterphaseSystem().display("length " + length); - * //test.getFluidBoundary().display("length " + length); test.setLengthOfNode(0.000005 + - * test.getLengthOfNode() / 2.0); temperatures2[0][k] = length; temperatures2[1][k] = - * test.getGeometry().getTemperature(); test.getFluidBoundary().display("test"); } - * - * //test.getBulkSystem().display(); test.update(); - * test.getFluidBoundary().display("length " + length); - * test.getInterphaseSystem().display("length " + length); - * - * - * //test.getFluidBoundary().display("test"); } - * - * for (int i = 0; i < k; i++) { System.out.println("len temp " + temperatures2[0][i] + " " - * + temperatures2[1][i]); } - */ - } + } } diff --git a/src/main/java/neqsim/fluidMechanics/flowNode/onePhaseNode/onePhasePipeFlowNode/onePhasePipeFlowNode.java b/src/main/java/neqsim/fluidMechanics/flowNode/onePhaseNode/onePhasePipeFlowNode/onePhasePipeFlowNode.java index 9822dffd3..9734f37e3 100644 --- a/src/main/java/neqsim/fluidMechanics/flowNode/onePhaseNode/onePhasePipeFlowNode/onePhasePipeFlowNode.java +++ b/src/main/java/neqsim/fluidMechanics/flowNode/onePhaseNode/onePhasePipeFlowNode/onePhasePipeFlowNode.java @@ -18,88 +18,88 @@ * @version $Id: $Id */ public class onePhasePipeFlowNode extends onePhaseFlowNode { - private static final long serialVersionUID = 1000; + private static final long serialVersionUID = 1000; - /** - *

- * Constructor for onePhasePipeFlowNode. - *

- */ - public onePhasePipeFlowNode() {} + /** + *

+ * Constructor for onePhasePipeFlowNode. + *

+ */ + public onePhasePipeFlowNode() {} - /** - *

- * Constructor for onePhasePipeFlowNode. - *

- * - * @param system a {@link neqsim.thermo.system.SystemInterface} object - * @param pipe a {@link neqsim.fluidMechanics.geometryDefinitions.GeometryDefinitionInterface} - * object - */ - public onePhasePipeFlowNode(SystemInterface system, GeometryDefinitionInterface pipe) { - super(system, pipe); - this.interphaseTransportCoefficient = new InterphasePipeFlow(this); - phaseOps = new ThermodynamicOperations(this.getBulkSystem()); - phaseOps.TPflash(); - initBulkSystem(); - } + /** + *

+ * Constructor for onePhasePipeFlowNode. + *

+ * + * @param system a {@link neqsim.thermo.system.SystemInterface} object + * @param pipe a {@link neqsim.fluidMechanics.geometryDefinitions.GeometryDefinitionInterface} + * object + */ + public onePhasePipeFlowNode(SystemInterface system, GeometryDefinitionInterface pipe) { + super(system, pipe); + this.interphaseTransportCoefficient = new InterphasePipeFlow(this); + phaseOps = new ThermodynamicOperations(this.getBulkSystem()); + phaseOps.TPflash(); + initBulkSystem(); + } - /** {@inheritDoc} */ - @Override - public onePhasePipeFlowNode clone() { - onePhasePipeFlowNode clonedSystem = null; - try { - clonedSystem = (onePhasePipeFlowNode) super.clone(); - } catch (Exception e) { - e.printStackTrace(System.err); - } - return clonedSystem; + /** {@inheritDoc} */ + @Override + public onePhasePipeFlowNode clone() { + onePhasePipeFlowNode clonedSystem = null; + try { + clonedSystem = (onePhasePipeFlowNode) super.clone(); + } catch (Exception e) { + e.printStackTrace(System.err); } + return clonedSystem; + } - /** {@inheritDoc} */ - @Override - public void init() { - super.init(); - } + /** {@inheritDoc} */ + @Override + public void init() { + super.init(); + } - /** {@inheritDoc} */ - @Override - public double calcReynoldsNumber() { - reynoldsNumber[0] = getVelocity() * pipe.getDiameter() - / getBulkSystem().getPhases()[0].getPhysicalProperties().getKinematicViscosity(); - return reynoldsNumber[0]; - } + /** {@inheritDoc} */ + @Override + public double calcReynoldsNumber() { + reynoldsNumber[0] = getVelocity() * pipe.getDiameter() + / getBulkSystem().getPhases()[0].getPhysicalProperties().getKinematicViscosity(); + return reynoldsNumber[0]; + } - /** - *

- * main. - *

- * - * @param args an array of {@link java.lang.String} objects - */ - public static void main(String[] args) { - System.out.println("Starter....."); - SystemSrkEos testSystem = new SystemSrkEos(300.3, 200.0); + /** + *

+ * main. + *

+ * + * @param args an array of {@link java.lang.String} objects + */ + public static void main(String[] args) { + System.out.println("Starter....."); + SystemSrkEos testSystem = new SystemSrkEos(300.3, 200.0); - GeometryDefinitionInterface pipe1 = new PipeData(1, 0.0025); - testSystem.addComponent("methane", 50000.0); - testSystem.addComponent("ethane", 1.0); + testSystem.addComponent("methane", 50000.0); + testSystem.addComponent("ethane", 1.0); - testSystem.init(0); - testSystem.init(1); + testSystem.init(0); + testSystem.init(1); - FlowNodeInterface[] test = new onePhasePipeFlowNode[100]; + FlowNodeInterface[] test = new onePhasePipeFlowNode[100]; - test[0] = new onePhasePipeFlowNode(testSystem, pipe1); - // test[0].setFrictionFactorType(0); + GeometryDefinitionInterface pipe1 = new PipeData(1, 0.0025); + test[0] = new onePhasePipeFlowNode(testSystem, pipe1); + // test[0].setFrictionFactorType(0); - // test[0].init() - test[0].initFlowCalc(); - test[0].init(); + // test[0].init() + test[0].initFlowCalc(); + test[0].init(); - // test[0].getVolumetricFlow(); - System.out.println("flow: " + test[0].getVolumetricFlow() + " velocity: " - + test[0].getVelocity() + " reynolds number " + test[0].getReynoldsNumber() - + "friction : " + test[0].getWallFrictionFactor()); - } + // test[0].getVolumetricFlow(); + System.out.println("flow: " + test[0].getVolumetricFlow() + " velocity: " + + test[0].getVelocity() + " reynolds number " + test[0].getReynoldsNumber() + "friction : " + + test[0].getWallFrictionFactor()); + } } diff --git a/src/main/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhasePipeFlowNode/AnnularFlow.java b/src/main/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhasePipeFlowNode/AnnularFlow.java index c0b3ea61f..877c4b87b 100644 --- a/src/main/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhasePipeFlowNode/AnnularFlow.java +++ b/src/main/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhasePipeFlowNode/AnnularFlow.java @@ -21,281 +21,280 @@ * @version $Id: $Id */ public class AnnularFlow extends TwoPhaseFlowNode { - private static final long serialVersionUID = 1000; - // ThermodynamicOperations interphaseOps = new ThermodynamicOperations(); - // double liquidFilmThickness=0; + private static final long serialVersionUID = 1000; + // ThermodynamicOperations interphaseOps = new ThermodynamicOperations(); + // double liquidFilmThickness=0; - /** - *

- * Constructor for AnnularFlow. - *

- */ - public AnnularFlow() { - this.flowNodeType = "annular"; - } + /** + *

+ * Constructor for AnnularFlow. + *

+ */ + public AnnularFlow() { + this.flowNodeType = "annular"; + } - /** - *

- * Constructor for AnnularFlow. - *

- * - * @param system a {@link neqsim.thermo.system.SystemInterface} object - * @param pipe a {@link neqsim.fluidMechanics.geometryDefinitions.GeometryDefinitionInterface} - * object - */ - public AnnularFlow(SystemInterface system, GeometryDefinitionInterface pipe) { - super(system, pipe); - this.flowNodeType = "annular"; - this.interphaseTransportCoefficient = new InterphaseStratifiedFlow(this); - this.fluidBoundary = - new neqsim.fluidMechanics.flowNode.fluidBoundary.heatMassTransferCalc.nonEquilibriumFluidBoundary.filmModelBoundary.KrishnaStandartFilmModel( - this); - } + /** + *

+ * Constructor for AnnularFlow. + *

+ * + * @param system a {@link neqsim.thermo.system.SystemInterface} object + * @param pipe a {@link neqsim.fluidMechanics.geometryDefinitions.GeometryDefinitionInterface} + * object + */ + public AnnularFlow(SystemInterface system, GeometryDefinitionInterface pipe) { + super(system, pipe); + this.flowNodeType = "annular"; + this.interphaseTransportCoefficient = new InterphaseStratifiedFlow(this); + this.fluidBoundary = + new neqsim.fluidMechanics.flowNode.fluidBoundary.heatMassTransferCalc.nonEquilibriumFluidBoundary.filmModelBoundary.KrishnaStandartFilmModel( + this); + } - /** - *

- * Constructor for AnnularFlow. - *

- * - * @param system a {@link neqsim.thermo.system.SystemInterface} object - * @param interphaseSystem a {@link neqsim.thermo.system.SystemInterface} object - * @param pipe a {@link neqsim.fluidMechanics.geometryDefinitions.GeometryDefinitionInterface} - * object - */ - public AnnularFlow(SystemInterface system, SystemInterface interphaseSystem, - GeometryDefinitionInterface pipe) { - super(system, pipe); - this.flowNodeType = "annular"; - this.interphaseTransportCoefficient = new InterphaseStratifiedFlow(this); - this.fluidBoundary = - new neqsim.fluidMechanics.flowNode.fluidBoundary.heatMassTransferCalc.nonEquilibriumFluidBoundary.filmModelBoundary.KrishnaStandartFilmModel( - this); - } + /** + *

+ * Constructor for AnnularFlow. + *

+ * + * @param system a {@link neqsim.thermo.system.SystemInterface} object + * @param interphaseSystem a {@link neqsim.thermo.system.SystemInterface} object + * @param pipe a {@link neqsim.fluidMechanics.geometryDefinitions.GeometryDefinitionInterface} + * object + */ + public AnnularFlow(SystemInterface system, SystemInterface interphaseSystem, + GeometryDefinitionInterface pipe) { + super(system, pipe); + this.flowNodeType = "annular"; + this.interphaseTransportCoefficient = new InterphaseStratifiedFlow(this); + this.fluidBoundary = + new neqsim.fluidMechanics.flowNode.fluidBoundary.heatMassTransferCalc.nonEquilibriumFluidBoundary.filmModelBoundary.KrishnaStandartFilmModel( + this); + } - /** {@inheritDoc} */ - @Override - public AnnularFlow clone() { - AnnularFlow clonedSystem = null; - try { - clonedSystem = (AnnularFlow) super.clone(); - } catch (Exception e) { - e.printStackTrace(System.err); - } - return clonedSystem; + /** {@inheritDoc} */ + @Override + public AnnularFlow clone() { + AnnularFlow clonedSystem = null; + try { + clonedSystem = (AnnularFlow) super.clone(); + } catch (Exception e) { + e.printStackTrace(System.err); } + return clonedSystem; + } - /** {@inheritDoc} */ - @Override - public void init() { - inclination = 1.0; - this.calcContactLength(); - super.init(); - } + /** {@inheritDoc} */ + @Override + public void init() { + inclination = 1.0; + this.calcContactLength(); + super.init(); + } - /** {@inheritDoc} */ - @Override - public double calcContactLength() { - wallContactLength[1] = pi * pipe.getDiameter(); - wallContactLength[0] = 0.0; + /** {@inheritDoc} */ + @Override + public double calcContactLength() { + wallContactLength[1] = pi * pipe.getDiameter(); + wallContactLength[0] = 0.0; - interphaseContactLength[0] = pi * pipe.getDiameter() * Math.sqrt(phaseFraction[0]); - interphaseContactLength[1] = pi * pipe.getDiameter() * Math.sqrt(phaseFraction[0]); - return wallContactLength[0]; - } + interphaseContactLength[0] = pi * pipe.getDiameter() * Math.sqrt(phaseFraction[0]); + interphaseContactLength[1] = pi * pipe.getDiameter() * Math.sqrt(phaseFraction[0]); + return wallContactLength[0]; + } - /** {@inheritDoc} */ - @Override - public FlowNodeInterface getNextNode() { - AnnularFlow newNode = this.clone(); + /** {@inheritDoc} */ + @Override + public FlowNodeInterface getNextNode() { + AnnularFlow newNode = this.clone(); - for (int i = 0; i < getBulkSystem().getPhases()[0].getNumberOfComponents(); i++) { - // newNode.getBulkSystem().getPhases()[0].addMoles(i, -molarMassTransfer[i]); - // newNode.getBulkSystem().getPhases()[1].addMoles(i, +molarMassTransfer[i]); - } - return newNode; + for (int i = 0; i < getBulkSystem().getPhases()[0].getNumberOfComponents(); i++) { + // newNode.getBulkSystem().getPhases()[0].addMoles(i, -molarMassTransfer[i]); + // newNode.getBulkSystem().getPhases()[1].addMoles(i, +molarMassTransfer[i]); } + return newNode; + } - /** - *

- * main. - *

- * - * @param args an array of {@link java.lang.String} objects - */ - @SuppressWarnings("unused") - public static void main(String[] args) { - System.out.println("Starter....."); - String fileName = "c:/labsim/exp-heat.txt"; - double gasflow = 10.0; // MSm^3/day - double flow = 1000.0; // kg/min - double wtpr = 0.99; // wt frac MEG + /** + *

+ * main. + *

+ * + * @param args an array of {@link java.lang.String} objects + */ + @SuppressWarnings("unused") + public static void main(String[] args) { + System.out.println("Starter....."); + String fileName = "c:/labsim/exp-heat.txt"; - double outtemperature = 273.15 + 95; - SystemInterface testSystem = new SystemSrkCPAstatoil(273.15 + 55, 70.0); - // SystemInterface testSystem = new SystemSrkEos(273.15 + 85, 50.0); - // SystemInterface testSystem = new SystemFurstElectrolyteEos(298.15, 20.0); - ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem); + SystemInterface testSystem = new SystemSrkCPAstatoil(273.15 + 55, 70.0); + // SystemInterface testSystem = new SystemSrkEos(273.15 + 85, 50.0); + // SystemInterface testSystem = new SystemFurstElectrolyteEos(298.15, 20.0); + ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem); - PipeData pipe1 = new PipeData(0.5, 1.0e-6); + PipeData pipe1 = new PipeData(0.5, 1.0e-6); - MaterialLayer epoxmat = new MaterialLayer("epoxy", 0.01); - MaterialLayer steelmat = new MaterialLayer("steel", 0.02); - MaterialLayer concretemat = new MaterialLayer("concrete", 0.05); - pipe1.getWall().addMaterialLayer(epoxmat); - pipe1.getWall().addMaterialLayer(steelmat); - pipe1.getWall().addMaterialLayer(concretemat); - System.out.println("pipe heat trans coef " + pipe1.getWall().getHeatTransferCoefficient()); - System.out.println("pipe heat trans coef " + pipe1.getWallHeatTransferCoefficient()); + MaterialLayer epoxmat = new MaterialLayer("epoxy", 0.01); + MaterialLayer steelmat = new MaterialLayer("steel", 0.02); + MaterialLayer concretemat = new MaterialLayer("concrete", 0.05); + pipe1.getWall().addMaterialLayer(epoxmat); + pipe1.getWall().addMaterialLayer(steelmat); + pipe1.getWall().addMaterialLayer(concretemat); + System.out.println("pipe heat trans coef " + pipe1.getWall().getHeatTransferCoefficient()); + System.out.println("pipe heat trans coef " + pipe1.getWallHeatTransferCoefficient()); - SurroundingEnvironment surrEnv = new PipeSurroundingEnvironment("sea"); - pipe1.setSurroundingEnvironment(surrEnv); + SurroundingEnvironment surrEnv = new PipeSurroundingEnvironment("sea"); + pipe1.setSurroundingEnvironment(surrEnv); - pipe1.getSurroundingEnvironment().setTemperature(outtemperature); - testSystem.addComponent("methane", 0.99847 * gasflow, "MSm^3/day", 0); - testSystem.addComponent("water", 0.99847 * gasflow * 2000e-6, "MSm^3/day", 0); - // testSystem.addComponent("water", 0.00151314 * gasflow, "MSm^3/day", 0); - // testSystem.addComponent("MEG", 0.0000168455 * gasflow, "MSm^3/day", 0); - // testSystem.init(1); - // testSystem.addComponent("methane", 10, "MSm^3/day", 0); - // testSystem.addComponent("water", 5.9, 0); - // testSystem.addComponent("CO2", 100.333, "Nlitre/min", 0); - testSystem.addComponent("water", 5 * (1.0 - wtpr) * flow, "kg/min", 1); - testSystem.addComponent("MEG", (wtpr) * flow, "kg/min", 1); - // testSystem.addComponent("MDEA", wtpr*flow, "kg/min", 1); + double gasflow = 10.0; // MSm^3/day + double outtemperature = 273.15 + 95; + pipe1.getSurroundingEnvironment().setTemperature(outtemperature); + testSystem.addComponent("methane", 0.99847 * gasflow, "MSm^3/day", 0); + testSystem.addComponent("water", 0.99847 * gasflow * 2000e-6, "MSm^3/day", 0); + // testSystem.addComponent("water", 0.00151314 * gasflow, "MSm^3/day", 0); + // testSystem.addComponent("MEG", 0.0000168455 * gasflow, "MSm^3/day", 0); + // testSystem.init(1); + // testSystem.addComponent("methane", 10, "MSm^3/day", 0); + // testSystem.addComponent("water", 5.9, 0); + // testSystem.addComponent("CO2", 100.333, "Nlitre/min", 0); - // testSystem.chemicalReactionInit(); - testSystem.createDatabase(true); - testSystem.setMixingRule(10); - // testSystem.setPhysicalPropertyModel(3); - // testSystem.setNumericDerivatives(true); - testSystem.initPhysicalProperties(); - testSystem.getPhase(0).setTemperature(273.15 + 85); - testSystem.getPhase(1).setTemperature(273.15 + 85); - // testSystem.init(0); + double flow = 1000.0; // kg/min + double wtpr = 0.99; // wt frac MEG + testSystem.addComponent("water", 5 * (1.0 - wtpr) * flow, "kg/min", 1); + testSystem.addComponent("MEG", (wtpr) * flow, "kg/min", 1); + // testSystem.addComponent("MDEA", wtpr*flow, "kg/min", 1); - AnnularFlow test = new AnnularFlow(testSystem, pipe1); - test.setInterphaseModelType(1); - test.setLengthOfNode(0.01); - test.getFluidBoundary().setHeatTransferCalc(true); - test.getFluidBoundary().setMassTransferCalc(true); - test.getFluidBoundary().useFiniteFluxCorrection(true); - test.getFluidBoundary().useThermodynamicCorrections(true); - test.initFlowCalc(); - // test.display("testnode 0"); - // test.write("node 0", fileName, true); - System.out.println( - "rate " + test.getBulkSystem().getPhase(0).getComponent(1).getRate("Nlitre/min")); - double oldRate = test.getBulkSystem().getPhase(0).getComponent(1).getRate("Nlitre/min"); - for (int i = 0; i < 1; i++) { - test.initFlowCalc(); - test.init(); - test.calcFluxes(); - // test.getFluidBoundary().display(""); - // test.update(); - // test.write(("node " + i), fileName, false); - // System.out.println("velocity " + test.getVelocity(1)); - // test.getInterphaseSystem().display("length "); - test.display("testnode " + i); - test.getBulkSystem().display("test"); - // test.getFluidBoundary().display("test"); - } - // test.display("testnode last"); + // testSystem.chemicalReactionInit(); + testSystem.createDatabase(true); + testSystem.setMixingRule(10); + // testSystem.setPhysicalPropertyModel(3); + // testSystem.setNumericDerivatives(true); + testSystem.initPhysicalProperties(); + testSystem.getPhase(0).setTemperature(273.15 + 85); + testSystem.getPhase(1).setTemperature(273.15 + 85); + // testSystem.init(0); - System.out.println( - "rate " + test.getBulkSystem().getPhase(0).getComponent(1).getRate("Nlitre/min")); - System.out.println( - "diff " + (test.getBulkSystem().getPhase(0).getComponent(1).getRate("Nlitre/min") - - oldRate)); - for (int i = 0; i < 1000; i++) { - test.calcFluxes(); - test.update(); - if (i % 100 == 0) { - test.display("testnode " + i); - test.getBulkSystem().display("test " + i); - } - System.out - .println("aqueous phase " + test.getBulkSystem().getPhaseFraction("oil", "wt")); - } + AnnularFlow test = new AnnularFlow(testSystem, pipe1); + test.setInterphaseModelType(1); + test.setLengthOfNode(0.01); + test.getFluidBoundary().setHeatTransferCalc(true); + test.getFluidBoundary().setMassTransferCalc(true); + test.getFluidBoundary().useFiniteFluxCorrection(true); + test.getFluidBoundary().useThermodynamicCorrections(true); + test.initFlowCalc(); + // test.display("testnode 0"); + // test.write("node 0", fileName, true); + System.out + .println("rate " + test.getBulkSystem().getPhase(0).getComponent(1).getRate("Nlitre/min")); + double oldRate = test.getBulkSystem().getPhase(0).getComponent(1).getRate("Nlitre/min"); + for (int i = 0; i < 1; i++) { + test.initFlowCalc(); + test.init(); + test.calcFluxes(); + // test.getFluidBoundary().display(""); + // test.update(); + // test.write(("node " + i), fileName, false); + // System.out.println("velocity " + test.getVelocity(1)); + // test.getInterphaseSystem().display("length "); + test.display("testnode " + i); + test.getBulkSystem().display("test"); + // test.getFluidBoundary().display("test"); + } + // test.display("testnode last"); - // test.getFluidBoundary().display("test"); - // test.display("testnode4"); - // test.calcFluxes(); - // test.update(); - // test.display("testnode5"); - // test.calcFluxes(); - // test.update(); - // test.display("testnode6"); - // test.calcFluxes(); - // test.update(); - // test.display("testnode7"); - // test.calcFluxes(); - // test.update(); - // test.display("testnode8"); - // test.calcFluxes(); - // test.update(); - // test.display("testnode9"); - // test.calcFluxes(); - // test.update(); - // test.display("testnode10"); - // test.calcFluxes(); - // test.update(); - // test.display("testnode11"); - // test.calcFluxes(); - // test.update(); - // test.display("testnode12"); - // test.calcFluxes(); - // test.update(); - // test.display("testnode13"); - // test.calcFluxes(); - // test.update(); - // test.display("testnode14"); - // test.calcFluxes(); - // test.update(); - // test.display("testnode15"); - // test.calcFluxes(); - // test.update(); - // test.display("testnode16"); - // test.calcFluxes(); - // test.update(); - // test.display("testnode17"); - // test.calcFluxes(); - // test.update(); - // test.display("testnode18"); - // test.calcFluxes(); - // test.update(); - // test.display("testnode19"); - // test.calcFluxes(); - // test.update(); - // test.display("testnode20"); - // test.calcFluxes(); - // test.update(); - // test.display("testnod21"); - // test.calcFluxes(); - // test.update(); - // test.display("testnode22"); - // test.calcFluxes(); - // test.update(); - // test.display("testnode23"); - // test.calcFluxes(); - // test.update(); - // test.display("testnode24"); - // test.calcFluxes(); - // test.update(); - // test.display("testnode25"); - // test.calcFluxes(); - // test.update(); - // test.display("testnode26"); - // test.calcFluxes(); - // test.update(); - // test.display("testnode27"); - // test.calcFluxes(); - // test.update(); - // test.display("testnode28"); - // test.calcFluxes(); - // test.update(); - // test.display("testnode29"); - // test.calcFluxes(); - // test.update(); - // test.display("testnode30"); + System.out + .println("rate " + test.getBulkSystem().getPhase(0).getComponent(1).getRate("Nlitre/min")); + System.out.println("diff " + + (test.getBulkSystem().getPhase(0).getComponent(1).getRate("Nlitre/min") - oldRate)); + for (int i = 0; i < 1000; i++) { + test.calcFluxes(); + test.update(); + if (i % 100 == 0) { + test.display("testnode " + i); + test.getBulkSystem().display("test " + i); + } + System.out.println("aqueous phase " + test.getBulkSystem().getPhaseFraction("oil", "wt")); } + + // test.getFluidBoundary().display("test"); + // test.display("testnode4"); + // test.calcFluxes(); + // test.update(); + // test.display("testnode5"); + // test.calcFluxes(); + // test.update(); + // test.display("testnode6"); + // test.calcFluxes(); + // test.update(); + // test.display("testnode7"); + // test.calcFluxes(); + // test.update(); + // test.display("testnode8"); + // test.calcFluxes(); + // test.update(); + // test.display("testnode9"); + // test.calcFluxes(); + // test.update(); + // test.display("testnode10"); + // test.calcFluxes(); + // test.update(); + // test.display("testnode11"); + // test.calcFluxes(); + // test.update(); + // test.display("testnode12"); + // test.calcFluxes(); + // test.update(); + // test.display("testnode13"); + // test.calcFluxes(); + // test.update(); + // test.display("testnode14"); + // test.calcFluxes(); + // test.update(); + // test.display("testnode15"); + // test.calcFluxes(); + // test.update(); + // test.display("testnode16"); + // test.calcFluxes(); + // test.update(); + // test.display("testnode17"); + // test.calcFluxes(); + // test.update(); + // test.display("testnode18"); + // test.calcFluxes(); + // test.update(); + // test.display("testnode19"); + // test.calcFluxes(); + // test.update(); + // test.display("testnode20"); + // test.calcFluxes(); + // test.update(); + // test.display("testnod21"); + // test.calcFluxes(); + // test.update(); + // test.display("testnode22"); + // test.calcFluxes(); + // test.update(); + // test.display("testnode23"); + // test.calcFluxes(); + // test.update(); + // test.display("testnode24"); + // test.calcFluxes(); + // test.update(); + // test.display("testnode25"); + // test.calcFluxes(); + // test.update(); + // test.display("testnode26"); + // test.calcFluxes(); + // test.update(); + // test.display("testnode27"); + // test.calcFluxes(); + // test.update(); + // test.display("testnode28"); + // test.calcFluxes(); + // test.update(); + // test.display("testnode29"); + // test.calcFluxes(); + // test.update(); + // test.display("testnode30"); + } } diff --git a/src/main/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhasePipeFlowNode/BubbleFlowNode.java b/src/main/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhasePipeFlowNode/BubbleFlowNode.java index b6f77dfef..48acc46c1 100644 --- a/src/main/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhasePipeFlowNode/BubbleFlowNode.java +++ b/src/main/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhasePipeFlowNode/BubbleFlowNode.java @@ -17,214 +17,214 @@ * @version $Id: $Id */ public class BubbleFlowNode extends TwoPhaseFlowNode { - private static final long serialVersionUID = 1000; - private double averageBubbleDiameter = 0.001; - - /** - *

- * Constructor for BubbleFlowNode. - *

- */ - public BubbleFlowNode() { - this.flowNodeType = "bubble"; + private static final long serialVersionUID = 1000; + private double averageBubbleDiameter = 0.001; + + /** + *

+ * Constructor for BubbleFlowNode. + *

+ */ + public BubbleFlowNode() { + this.flowNodeType = "bubble"; + } + + /** + *

+ * Constructor for BubbleFlowNode. + *

+ * + * @param system a {@link neqsim.thermo.system.SystemInterface} object + * @param pipe a {@link neqsim.fluidMechanics.geometryDefinitions.GeometryDefinitionInterface} + * object + */ + public BubbleFlowNode(SystemInterface system, GeometryDefinitionInterface pipe) { + super(system, pipe); + this.flowNodeType = "bubble"; + this.interphaseTransportCoefficient = new InterphaseDropletFlow(this); + this.fluidBoundary = + new neqsim.fluidMechanics.flowNode.fluidBoundary.heatMassTransferCalc.nonEquilibriumFluidBoundary.filmModelBoundary.KrishnaStandartFilmModel( + this); + } + + /** + *

+ * Constructor for BubbleFlowNode. + *

+ * + * @param system a {@link neqsim.thermo.system.SystemInterface} object + * @param interphaseSystem a {@link neqsim.thermo.system.SystemInterface} object + * @param pipe a {@link neqsim.fluidMechanics.geometryDefinitions.GeometryDefinitionInterface} + * object + */ + public BubbleFlowNode(SystemInterface system, SystemInterface interphaseSystem, + GeometryDefinitionInterface pipe) { + super(system, pipe); + this.flowNodeType = "bubble"; + this.interphaseTransportCoefficient = new InterphaseDropletFlow(this); + this.fluidBoundary = + new neqsim.fluidMechanics.flowNode.fluidBoundary.heatMassTransferCalc.nonEquilibriumFluidBoundary.filmModelBoundary.KrishnaStandartFilmModel( + this); + } + + /** {@inheritDoc} */ + @Override + public double calcGasLiquidContactArea() { + interphaseContactArea = pipe.getNodeLength() * interphaseContactLength[0]; + return interphaseContactArea; + } + + /** {@inheritDoc} */ + @Override + public void initFlowCalc() { + // phaseFraction[0] = bulkSystem.getPhase(0).getBeta(); + phaseFraction[0] = getBulkSystem().getVolumeFraction(0); + phaseFraction[1] = 1.0 - phaseFraction[0]; + initVelocity(); + this.init(); + + initVelocity(); + } + + /** {@inheritDoc} */ + @Override + public BubbleFlowNode clone() { + BubbleFlowNode clonedSystem = null; + try { + clonedSystem = (BubbleFlowNode) super.clone(); + } catch (Exception e) { + e.printStackTrace(System.err); } - /** - *

- * Constructor for BubbleFlowNode. - *

- * - * @param system a {@link neqsim.thermo.system.SystemInterface} object - * @param pipe a {@link neqsim.fluidMechanics.geometryDefinitions.GeometryDefinitionInterface} - * object - */ - public BubbleFlowNode(SystemInterface system, GeometryDefinitionInterface pipe) { - super(system, pipe); - this.flowNodeType = "bubble"; - this.interphaseTransportCoefficient = new InterphaseDropletFlow(this); - this.fluidBoundary = - new neqsim.fluidMechanics.flowNode.fluidBoundary.heatMassTransferCalc.nonEquilibriumFluidBoundary.filmModelBoundary.KrishnaStandartFilmModel( - this); + return clonedSystem; + } + + /** {@inheritDoc} */ + @Override + public void init() { + inclination = 0.0; + this.calcContactLength(); + // System.out.println("len " + this.calcContactLength()); + super.init(); + } + + /** {@inheritDoc} */ + @Override + public double calcContactLength() { + double phaseAngel = + pi * phaseFraction[1] + Math.pow(3.0 * pi / 2.0, 1.0 / 3.0) * (1.0 - 2.0 * phaseFraction[1] + + Math.pow(phaseFraction[1], 1.0 / 3.0) - Math.pow(phaseFraction[0], 1.0 / 3.0)); + wallContactLength[1] = phaseAngel * pipe.getDiameter(); + wallContactLength[0] = pi * pipe.getDiameter() - wallContactLength[1]; + interphaseContactLength[0] = pipe.getDiameter() * Math.sin(phaseAngel); + interphaseContactLength[1] = pipe.getDiameter() * Math.sin(phaseAngel); + + double volumeOfBubble = 4.0 / 3.0 * Math.PI * Math.pow(averageBubbleDiameter / 2.0, 3.0); + double surfaceAreaOfBubble = 4.0 * Math.PI * Math.pow(averageBubbleDiameter / 2.0, 2.0); + + double numbDropletsPerTime = getBulkSystem().getPhase(0).getVolume("m3") / volumeOfBubble; + interphaseContactLength[0] = numbDropletsPerTime * surfaceAreaOfBubble / velocity[0]; + interphaseContactLength[1] = interphaseContactLength[0]; + + return wallContactLength[0]; + } + + /** {@inheritDoc} */ + @Override + public FlowNodeInterface getNextNode() { + BubbleFlowNode newNode = this.clone(); + + for (int i = 0; i < getBulkSystem().getPhases()[0].getNumberOfComponents(); i++) { + // newNode.getBulkSystem().getPhases()[0].addMoles(i, -molarMassTransfer[i]); + // newNode.getBulkSystem().getPhases()[1].addMoles(i, +molarMassTransfer[i]); } - /** - *

- * Constructor for BubbleFlowNode. - *

- * - * @param system a {@link neqsim.thermo.system.SystemInterface} object - * @param interphaseSystem a {@link neqsim.thermo.system.SystemInterface} object - * @param pipe a {@link neqsim.fluidMechanics.geometryDefinitions.GeometryDefinitionInterface} - * object - */ - public BubbleFlowNode(SystemInterface system, SystemInterface interphaseSystem, - GeometryDefinitionInterface pipe) { - super(system, pipe); - this.flowNodeType = "bubble"; - this.interphaseTransportCoefficient = new InterphaseDropletFlow(this); - this.fluidBoundary = - new neqsim.fluidMechanics.flowNode.fluidBoundary.heatMassTransferCalc.nonEquilibriumFluidBoundary.filmModelBoundary.KrishnaStandartFilmModel( - this); + return newNode; + } + + /** + *

+ * main. + *

+ * + * @param args an array of {@link java.lang.String} objects + */ + @SuppressWarnings("unused") + public static void main(String[] args) { + SystemInterface testSystem = + new neqsim.thermo.system.SystemSrkSchwartzentruberEos(295.3, 50.01325); + ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem); + PipeData pipe1 = new PipeData(0.0250203, 0.00025); + testSystem.addComponent("CO2", 100.1061152181, "kg/hr", 0); + testSystem.addComponent("water", 1000.206862204876, "kg/hr", 1); + testSystem.createDatabase(true); + testSystem.setMixingRule(4); + testSystem.initPhysicalProperties(); + testSystem.init_x_y(); + testSystem.initBeta(); + testSystem.init(3); + + testSystem.display(); + FlowNodeInterface test = new BubbleFlowNode(testSystem, pipe1); + test.setInterphaseModelType(1); + test.setLengthOfNode(0.0001); + test.getGeometry().getSurroundingEnvironment().setTemperature(273.15 + 20.0); + + test.getFluidBoundary().setHeatTransferCalc(false); + test.getFluidBoundary().setMassTransferCalc(true); + double length = 0; + test.initFlowCalc(); + double[][] temperatures2 = new double[3][1000]; + int k = 0; + for (int i = 0; i < 10000; i++) { + length += test.getLengthOfNode(); + test.initFlowCalc(); + test.calcFluxes(); + if (i > 1 && (i % 100) == 0) { + k++; + test.display("length " + length); + test.getBulkSystem().display("length " + length); + // test.getInterphaseSystem().display("length " + length); + // test.getFluidBoundary().display("length " + length); + // test.setLengthOfNode(0.000005 + test.getLengthOfNode() / 2.0); + temperatures2[0][k] = length; + temperatures2[1][k] = test.getGeometry().getInnerWallTemperature(); + // test.getFluidBoundary().display("test"); + } + + // test.getBulkSystem().display(); + test.update(); + // test.getFluidBoundary().display("length " + length); + // test.getInterphaseSystem().display("length " + length); + + // test.getFluidBoundary().display("test"); } - /** {@inheritDoc} */ - @Override - public double calcGasLiquidContactArea() { - interphaseContactArea = pipe.getNodeLength() * interphaseContactLength[0]; - return interphaseContactArea; - } - - /** {@inheritDoc} */ - @Override - public void initFlowCalc() { - // phaseFraction[0] = bulkSystem.getPhase(0).getBeta(); - phaseFraction[0] = getBulkSystem().getVolumeFraction(0); - phaseFraction[1] = 1.0 - phaseFraction[0]; - initVelocity(); - this.init(); - - initVelocity(); - } - - /** {@inheritDoc} */ - @Override - public BubbleFlowNode clone() { - BubbleFlowNode clonedSystem = null; - try { - clonedSystem = (BubbleFlowNode) super.clone(); - } catch (Exception e) { - e.printStackTrace(System.err); - } - - return clonedSystem; - } - - /** {@inheritDoc} */ - @Override - public void init() { - inclination = 0.0; - this.calcContactLength(); - // System.out.println("len " + this.calcContactLength()); - super.init(); - } - - /** {@inheritDoc} */ - @Override - public double calcContactLength() { - double phaseAngel = pi * phaseFraction[1] + Math.pow(3.0 * pi / 2.0, 1.0 / 3.0) - * (1.0 - 2.0 * phaseFraction[1] + Math.pow(phaseFraction[1], 1.0 / 3.0) - - Math.pow(phaseFraction[0], 1.0 / 3.0)); - wallContactLength[1] = phaseAngel * pipe.getDiameter(); - wallContactLength[0] = pi * pipe.getDiameter() - wallContactLength[1]; - interphaseContactLength[0] = pipe.getDiameter() * Math.sin(phaseAngel); - interphaseContactLength[1] = pipe.getDiameter() * Math.sin(phaseAngel); - - double volumeOfBubble = 4.0 / 3.0 * Math.PI * Math.pow(averageBubbleDiameter / 2.0, 3.0); - double surfaceAreaOfBubble = 4.0 * Math.PI * Math.pow(averageBubbleDiameter / 2.0, 2.0); - - double numbDropletsPerTime = getBulkSystem().getPhase(0).getVolume("m3") / volumeOfBubble; - interphaseContactLength[0] = numbDropletsPerTime * surfaceAreaOfBubble / velocity[0]; - interphaseContactLength[1] = interphaseContactLength[0]; - - return wallContactLength[0]; - } - - /** {@inheritDoc} */ - @Override - public FlowNodeInterface getNextNode() { - BubbleFlowNode newNode = this.clone(); - - for (int i = 0; i < getBulkSystem().getPhases()[0].getNumberOfComponents(); i++) { - // newNode.getBulkSystem().getPhases()[0].addMoles(i, -molarMassTransfer[i]); - // newNode.getBulkSystem().getPhases()[1].addMoles(i, +molarMassTransfer[i]); - } - - return newNode; - } - - /** - *

- * main. - *

- * - * @param args an array of {@link java.lang.String} objects - */ - @SuppressWarnings("unused") - public static void main(String[] args) { - SystemInterface testSystem = - new neqsim.thermo.system.SystemSrkSchwartzentruberEos(295.3, 50.01325); - ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem); - PipeData pipe1 = new PipeData(0.0250203, 0.00025); - testSystem.addComponent("CO2", 100.1061152181, "kg/hr", 0); - testSystem.addComponent("water", 1000.206862204876, "kg/hr", 1); - testSystem.createDatabase(true); - testSystem.setMixingRule(4); - testSystem.initPhysicalProperties(); - testSystem.init_x_y(); - testSystem.initBeta(); - testSystem.init(3); - - testSystem.display(); - FlowNodeInterface test = new BubbleFlowNode(testSystem, pipe1); - test.setInterphaseModelType(1); - test.setLengthOfNode(0.0001); - test.getGeometry().getSurroundingEnvironment().setTemperature(273.15 + 20.0); - - test.getFluidBoundary().setHeatTransferCalc(false); - test.getFluidBoundary().setMassTransferCalc(true); - double length = 0; - test.initFlowCalc(); - double[][] temperatures2 = new double[3][1000]; - int k = 0; - for (int i = 0; i < 10000; i++) { - length += test.getLengthOfNode(); - test.initFlowCalc(); - test.calcFluxes(); - if (i > 1 && (i % 100) == 0) { - k++; - test.display("length " + length); - test.getBulkSystem().display("length " + length); - // test.getInterphaseSystem().display("length " + length); - // test.getFluidBoundary().display("length " + length); - // test.setLengthOfNode(0.000005 + test.getLengthOfNode() / 2.0); - temperatures2[0][k] = length; - temperatures2[1][k] = test.getGeometry().getInnerWallTemperature(); - // test.getFluidBoundary().display("test"); - } - - // test.getBulkSystem().display(); - test.update(); - // test.getFluidBoundary().display("length " + length); - // test.getInterphaseSystem().display("length " + length); - - // test.getFluidBoundary().display("test"); - } - - for (int i = 0; i < k; i++) { - System.out.println("len temp " + temperatures2[0][i] + " " + temperatures2[1][i]); - } - System.out.println("contact length " + test.getInterphaseContactArea()); - } - - /** - *

- * Getter for the field averageBubbleDiameter. - *

- * - * @return a double - */ - public double getAverageBubbleDiameter() { - return averageBubbleDiameter; - } - - /** - *

- * Setter for the field averageBubbleDiameter. - *

- * - * @param averageBubbleDiameter a double - */ - public void setAverageBubbleDiameter(double averageBubbleDiameter) { - this.averageBubbleDiameter = averageBubbleDiameter; + for (int i = 0; i < k; i++) { + System.out.println("len temp " + temperatures2[0][i] + " " + temperatures2[1][i]); } + System.out.println("contact length " + test.getInterphaseContactArea()); + } + + /** + *

+ * Getter for the field averageBubbleDiameter. + *

+ * + * @return a double + */ + public double getAverageBubbleDiameter() { + return averageBubbleDiameter; + } + + /** + *

+ * Setter for the field averageBubbleDiameter. + *

+ * + * @param averageBubbleDiameter a double + */ + public void setAverageBubbleDiameter(double averageBubbleDiameter) { + this.averageBubbleDiameter = averageBubbleDiameter; + } } 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 c393c6caa..270a55785 100644 --- a/src/main/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhasePipeFlowNode/DropletFlowNode.java +++ b/src/main/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhasePipeFlowNode/DropletFlowNode.java @@ -18,310 +18,310 @@ * @version $Id: $Id */ public class DropletFlowNode extends TwoPhaseFlowNode { - private static final long serialVersionUID = 1000; - private double averageDropletDiameter = 100.0e-6; - - /** - *

- * Constructor for DropletFlowNode. - *

- */ - public DropletFlowNode() { - this.flowNodeType = "droplet"; + private static final long serialVersionUID = 1000; + private double averageDropletDiameter = 100.0e-6; + + /** + *

+ * Constructor for DropletFlowNode. + *

+ */ + public DropletFlowNode() { + this.flowNodeType = "droplet"; + } + + /** + *

+ * Constructor for DropletFlowNode. + *

+ * + * @param system a {@link neqsim.thermo.system.SystemInterface} object + * @param pipe a {@link neqsim.fluidMechanics.geometryDefinitions.GeometryDefinitionInterface} + * object + */ + public DropletFlowNode(SystemInterface system, GeometryDefinitionInterface pipe) { + super(system, pipe); + this.flowNodeType = "droplet"; + this.interphaseTransportCoefficient = new InterphaseDropletFlow(this); + this.fluidBoundary = + new neqsim.fluidMechanics.flowNode.fluidBoundary.heatMassTransferCalc.nonEquilibriumFluidBoundary.filmModelBoundary.KrishnaStandartFilmModel( + this); + } + + /** + *

+ * Constructor for DropletFlowNode. + *

+ * + * @param system a {@link neqsim.thermo.system.SystemInterface} object + * @param interphaseSystem a {@link neqsim.thermo.system.SystemInterface} object + * @param pipe a {@link neqsim.fluidMechanics.geometryDefinitions.GeometryDefinitionInterface} + * object + */ + public DropletFlowNode(SystemInterface system, SystemInterface interphaseSystem, + GeometryDefinitionInterface pipe) { + super(system, pipe); + this.flowNodeType = "stratified"; + this.interphaseTransportCoefficient = new InterphaseDropletFlow(this); + this.fluidBoundary = + new neqsim.fluidMechanics.flowNode.fluidBoundary.heatMassTransferCalc.nonEquilibriumFluidBoundary.filmModelBoundary.KrishnaStandartFilmModel( + this); + } + + /** {@inheritDoc} */ + @Override + public double calcGasLiquidContactArea() { + interphaseContactArea = pipe.getNodeLength() * interphaseContactLength[0]; + return interphaseContactArea; + } + + /** {@inheritDoc} */ + @Override + public void initFlowCalc() { + // phaseFraction[0] = bulkSystem.getPhase(0).getBeta(); + phaseFraction[0] = getBulkSystem().getVolumeFraction(0); + phaseFraction[1] = 1.0 - phaseFraction[0]; + initVelocity(); + this.init(); + + initVelocity(); + } + + /** {@inheritDoc} */ + @Override + public DropletFlowNode clone() { + DropletFlowNode clonedSystem = null; + try { + clonedSystem = (DropletFlowNode) super.clone(); + } catch (Exception e) { + e.printStackTrace(System.err); } - /** - *

- * Constructor for DropletFlowNode. - *

- * - * @param system a {@link neqsim.thermo.system.SystemInterface} object - * @param pipe a {@link neqsim.fluidMechanics.geometryDefinitions.GeometryDefinitionInterface} - * object - */ - public DropletFlowNode(SystemInterface system, GeometryDefinitionInterface pipe) { - super(system, pipe); - this.flowNodeType = "droplet"; - this.interphaseTransportCoefficient = new InterphaseDropletFlow(this); - this.fluidBoundary = - new neqsim.fluidMechanics.flowNode.fluidBoundary.heatMassTransferCalc.nonEquilibriumFluidBoundary.filmModelBoundary.KrishnaStandartFilmModel( - this); + return clonedSystem; + } + + /** {@inheritDoc} */ + @Override + public void init() { + inclination = 0.0; + this.calcContactLength(); + // System.out.println("len " + this.calcContactLength()); + super.init(); + } + + /** {@inheritDoc} */ + @Override + public double calcContactLength() { + double phaseAngel = + pi * phaseFraction[1] + Math.pow(3.0 * pi / 2.0, 1.0 / 3.0) * (1.0 - 2.0 * phaseFraction[1] + + Math.pow(phaseFraction[1], 1.0 / 3.0) - Math.pow(phaseFraction[0], 1.0 / 3.0)); + wallContactLength[1] = phaseAngel * pipe.getDiameter(); + wallContactLength[0] = pi * pipe.getDiameter() - wallContactLength[1]; + interphaseContactLength[0] = pipe.getDiameter() * Math.sin(phaseAngel); + interphaseContactLength[1] = pipe.getDiameter() * Math.sin(phaseAngel); + + double volumeOfDroplet = 4.0 / 3.0 * Math.PI * Math.pow(averageDropletDiameter / 2.0, 3.0); + double surfaceAreaOfDroplet = 4.0 * Math.PI * Math.pow(averageDropletDiameter / 2.0, 2.0); + + double numbDropletsPerTime = getBulkSystem().getPhase(1).getVolume("m3") / volumeOfDroplet; + interphaseContactLength[0] = numbDropletsPerTime * surfaceAreaOfDroplet / velocity[0]; + interphaseContactLength[1] = interphaseContactLength[0]; + + return wallContactLength[0]; + } + + /** {@inheritDoc} */ + @Override + public FlowNodeInterface getNextNode() { + DropletFlowNode newNode = this.clone(); + + for (int i = 0; i < getBulkSystem().getPhases()[0].getNumberOfComponents(); i++) { + // newNode.getBulkSystem().getPhases()[0].addMoles(i, -molarMassTransfer[i]); + // newNode.getBulkSystem().getPhases()[1].addMoles(i, +molarMassTransfer[i]); } - /** - *

- * Constructor for DropletFlowNode. - *

- * - * @param system a {@link neqsim.thermo.system.SystemInterface} object - * @param interphaseSystem a {@link neqsim.thermo.system.SystemInterface} object - * @param pipe a {@link neqsim.fluidMechanics.geometryDefinitions.GeometryDefinitionInterface} - * object - */ - public DropletFlowNode(SystemInterface system, SystemInterface interphaseSystem, - GeometryDefinitionInterface pipe) { - super(system, pipe); - this.flowNodeType = "stratified"; - this.interphaseTransportCoefficient = new InterphaseDropletFlow(this); - this.fluidBoundary = - new neqsim.fluidMechanics.flowNode.fluidBoundary.heatMassTransferCalc.nonEquilibriumFluidBoundary.filmModelBoundary.KrishnaStandartFilmModel( - this); + return newNode; + } + + /** + *

+ * mainOld. + *

+ * + * @param args an array of {@link java.lang.String} objects + */ + @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); + ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem); + PipeData pipe1 = new PipeData(0.203, 0.00025); + + testSystem.addComponent("methane", 250.0, "Nliter/min", 0); + testSystem.addComponent("water", .00010, "Nliter/min", 0); + // testSystem.addComponent("n-heptane", 20.0, "Nliter/min", 1); + testSystem.addComponent("TEG", 90.0, "kg/min", 1); + testSystem.addComponent("water", 1.0, "kg/min", 1); + testSystem.createDatabase(true); + testSystem.setMixingRule(10); + testSystem.initPhysicalProperties(); + + testSystem.init_x_y(); + testSystem.initBeta(); + testSystem.init(3); + + // testOps.TPflash(); + testSystem.display(); + // testSystem.setTemperature(273.15+20); + // testSystem.initPhysicalProperties(); + + FlowNodeInterface test = new DropletFlowNode(testSystem, pipe1); + + test.setInterphaseModelType(1); + test.setLengthOfNode(0.1); + test.getGeometry().getSurroundingEnvironment().setTemperature(273.15 + 11.0); + + test.getFluidBoundary().setHeatTransferCalc(true); + test.getFluidBoundary().setMassTransferCalc(true); + double length = 0; + // test.initFlowCalc(); + + test.initFlowCalc(); + test.calcFluxes(); + test.getFluidBoundary().display("test"); + double[][] temperatures2 = new double[3][1000]; + int k = 0; + for (int i = 0; i < 1000; i++) { + length += test.getLengthOfNode(); + test.initFlowCalc(); + test.calcFluxes(); + + if (i > 1 && (i % 1) == 0) { + k++; + // test.display("length " + length); + // test.getBulkSystem().display("length " + length); + // test.getInterphaseSystem().display("length " + length); + // test.getFluidBoundary().display("length " + length); + // test.setLengthOfNode(0.000005 + test.getLengthOfNode() / 2.0); + temperatures2[0][k] = length; + temperatures2[1][k] = test.getGeometry().getInnerWallTemperature(); + System.out.println(test.getBulkSystem().getPhase(0).getComponent("water").getx()); + // test.getFluidBoundary().display("test"); + } + + // test.getBulkSystem().display(); + test.update(); + // test.getFluidBoundary().display("length " + length); + // test.getInterphaseSystem().display("length " + length); + + // test.getFluidBoundary().display("test"); } - /** {@inheritDoc} */ - @Override - public double calcGasLiquidContactArea() { - interphaseContactArea = pipe.getNodeLength() * interphaseContactLength[0]; - return interphaseContactArea; + for (int i = 0; i < k; i++) { + System.out.println("len temp " + temperatures2[0][i] + " " + temperatures2[1][i]); } - - /** {@inheritDoc} */ - @Override - public void initFlowCalc() { - // phaseFraction[0] = bulkSystem.getPhase(0).getBeta(); - phaseFraction[0] = getBulkSystem().getVolumeFraction(0); - phaseFraction[1] = 1.0 - phaseFraction[0]; - initVelocity(); - this.init(); - - initVelocity(); - } - - /** {@inheritDoc} */ - @Override - public DropletFlowNode clone() { - DropletFlowNode clonedSystem = null; - try { - clonedSystem = (DropletFlowNode) super.clone(); - } catch (Exception e) { - e.printStackTrace(System.err); - } - - return clonedSystem; - } - - /** {@inheritDoc} */ - @Override - public void init() { - inclination = 0.0; - this.calcContactLength(); - // System.out.println("len " + this.calcContactLength()); - super.init(); - } - - /** {@inheritDoc} */ - @Override - public double calcContactLength() { - double phaseAngel = pi * phaseFraction[1] + Math.pow(3.0 * pi / 2.0, 1.0 / 3.0) - * (1.0 - 2.0 * phaseFraction[1] + Math.pow(phaseFraction[1], 1.0 / 3.0) - - Math.pow(phaseFraction[0], 1.0 / 3.0)); - wallContactLength[1] = phaseAngel * pipe.getDiameter(); - wallContactLength[0] = pi * pipe.getDiameter() - wallContactLength[1]; - interphaseContactLength[0] = pipe.getDiameter() * Math.sin(phaseAngel); - interphaseContactLength[1] = pipe.getDiameter() * Math.sin(phaseAngel); - - double volumeOfDroplet = 4.0 / 3.0 * Math.PI * Math.pow(averageDropletDiameter / 2.0, 3.0); - double surfaceAreaOfDroplet = 4.0 * Math.PI * Math.pow(averageDropletDiameter / 2.0, 2.0); - - double numbDropletsPerTime = getBulkSystem().getPhase(1).getVolume("m3") / volumeOfDroplet; - interphaseContactLength[0] = numbDropletsPerTime * surfaceAreaOfDroplet / velocity[0]; - interphaseContactLength[1] = interphaseContactLength[0]; - - return wallContactLength[0]; - } - - /** {@inheritDoc} */ - @Override - public FlowNodeInterface getNextNode() { - DropletFlowNode newNode = this.clone(); - - for (int i = 0; i < getBulkSystem().getPhases()[0].getNumberOfComponents(); i++) { - // newNode.getBulkSystem().getPhases()[0].addMoles(i, -molarMassTransfer[i]); - // newNode.getBulkSystem().getPhases()[1].addMoles(i, +molarMassTransfer[i]); - } - - return newNode; - } - - /** - *

- * mainOld. - *

- * - * @param args an array of {@link java.lang.String} objects - */ - @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); - ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem); - PipeData pipe1 = new PipeData(0.203, 0.00025); - - testSystem.addComponent("methane", 250.0, "Nliter/min", 0); - testSystem.addComponent("water", .00010, "Nliter/min", 0); - // testSystem.addComponent("n-heptane", 20.0, "Nliter/min", 1); - testSystem.addComponent("TEG", 90.0, "kg/min", 1); - testSystem.addComponent("water", 1.0, "kg/min", 1); - testSystem.createDatabase(true); - testSystem.setMixingRule(10); - testSystem.initPhysicalProperties(); - - testSystem.init_x_y(); - testSystem.initBeta(); - testSystem.init(3); - - // testOps.TPflash(); - testSystem.display(); - // testSystem.setTemperature(273.15+20); - // testSystem.initPhysicalProperties(); - - FlowNodeInterface test = new DropletFlowNode(testSystem, pipe1); - - test.setInterphaseModelType(1); - test.setLengthOfNode(0.1); - test.getGeometry().getSurroundingEnvironment().setTemperature(273.15 + 11.0); - - test.getFluidBoundary().setHeatTransferCalc(true); - test.getFluidBoundary().setMassTransferCalc(true); - double length = 0; - // test.initFlowCalc(); - - test.initFlowCalc(); - test.calcFluxes(); - test.getFluidBoundary().display("test"); - double[][] temperatures2 = new double[3][1000]; - int k = 0; - for (int i = 0; i < 1000; i++) { - length += test.getLengthOfNode(); - test.initFlowCalc(); - test.calcFluxes(); - - if (i > 1 && (i % 1) == 0) { - k++; - // test.display("length " + length); - // test.getBulkSystem().display("length " + length); - // test.getInterphaseSystem().display("length " + length); - // test.getFluidBoundary().display("length " + length); - // test.setLengthOfNode(0.000005 + test.getLengthOfNode() / 2.0); - temperatures2[0][k] = length; - temperatures2[1][k] = test.getGeometry().getInnerWallTemperature(); - System.out.println(test.getBulkSystem().getPhase(0).getComponent("water").getx()); - // test.getFluidBoundary().display("test"); - } - - // test.getBulkSystem().display(); - test.update(); - // test.getFluidBoundary().display("length " + length); - // test.getInterphaseSystem().display("length " + length); - - // test.getFluidBoundary().display("test"); - } - - for (int i = 0; i < k; i++) { - System.out.println("len temp " + temperatures2[0][i] + " " + temperatures2[1][i]); - } - ThermodynamicOperations ops = new ThermodynamicOperations(testSystem); - ops.TPflash(); - testSystem.display(); - } - - /** - *

- * main. - *

- * - * @param args an array of {@link java.lang.String} objects - */ - public static void main(String[] args) { - SystemInterface testSystem = new SystemSrkCPAstatoil(273.15 + 5.0, 10.0e-3); - ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem); - PipeData pipe1 = new PipeData(0.203, 0.00025); - - testSystem.addComponent("oxygen", 50.0e-6, "kg/min", 0); - testSystem.addComponent("oxygen", 8e-6, "kg/min", 1); - testSystem.addComponent("water", 100.0, "kg/min", 1); - testSystem.createDatabase(true); - testSystem.setMixingRule(10); - testSystem.initPhysicalProperties(); - - testSystem.init_x_y(); - testSystem.initBeta(); - testSystem.init(3); - - testOps.TPflash(); - testSystem.display(); - // testSystem.setTemperature(273.15+20); - // testSystem.initPhysicalProperties(); - - FlowNodeInterface test = new DropletFlowNode(testSystem, pipe1); - - test.setInterphaseModelType(1); - test.setLengthOfNode(0.1); - test.getGeometry().getSurroundingEnvironment().setTemperature(273.15 + 11.0); - - test.getFluidBoundary().setHeatTransferCalc(true); - test.getFluidBoundary().setMassTransferCalc(true); - double length = 0; - // test.initFlowCalc(); - - test.initFlowCalc(); - test.calcFluxes(); - test.getFluidBoundary().display("test"); - double[][] temperatures2 = new double[3][1000]; - int k = 0; - for (int i = 0; i < 1000; i++) { - length += test.getLengthOfNode(); - test.initFlowCalc(); - test.calcFluxes(); - - if (i > 1 && (i % 1) == 0) { - k++; - // test.display("length " + length); - // test.getBulkSystem().display("length " + length); - // test.getInterphaseSystem().display("length " + length); - // test.getFluidBoundary().display("length " + length); - // test.setLengthOfNode(0.000005 + test.getLengthOfNode() / 2.0); - temperatures2[0][k] = length; - temperatures2[1][k] = test.getGeometry().getInnerWallTemperature(); - System.out.println(test.getBulkSystem().getPhase(0).getComponent("water").getx()); - // test.getFluidBoundary().display("test"); - } - - // test.getBulkSystem().display(); - test.update(); - // test.getFluidBoundary().display("length " + length); - // test.getInterphaseSystem().display("length " + length); - - // test.getFluidBoundary().display("test"); - } - - for (int i = 0; i < k; i++) { - System.out.println("len temp " + temperatures2[0][i] + " " + temperatures2[1][i]); - } - ThermodynamicOperations ops = new ThermodynamicOperations(testSystem); - ops.TPflash(); - testSystem.display(); - } - - /** - *

- * Getter for the field averageDropletDiameter. - *

- * - * @return a double - */ - public double getAverageDropletDiameter() { - return averageDropletDiameter; + ThermodynamicOperations ops = new ThermodynamicOperations(testSystem); + ops.TPflash(); + testSystem.display(); + } + + /** + *

+ * main. + *

+ * + * @param args an array of {@link java.lang.String} objects + */ + public static void main(String[] args) { + SystemInterface testSystem = new SystemSrkCPAstatoil(273.15 + 5.0, 10.0e-3); + + testSystem.addComponent("oxygen", 50.0e-6, "kg/min", 0); + testSystem.addComponent("oxygen", 8e-6, "kg/min", 1); + testSystem.addComponent("water", 100.0, "kg/min", 1); + testSystem.createDatabase(true); + testSystem.setMixingRule(10); + testSystem.initPhysicalProperties(); + + testSystem.init_x_y(); + testSystem.initBeta(); + testSystem.init(3); + + ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem); + testOps.TPflash(); + testSystem.display(); + // testSystem.setTemperature(273.15+20); + // testSystem.initPhysicalProperties(); + + PipeData pipe1 = new PipeData(0.203, 0.00025); + FlowNodeInterface test = new DropletFlowNode(testSystem, pipe1); + + test.setInterphaseModelType(1); + test.setLengthOfNode(0.1); + test.getGeometry().getSurroundingEnvironment().setTemperature(273.15 + 11.0); + + test.getFluidBoundary().setHeatTransferCalc(true); + test.getFluidBoundary().setMassTransferCalc(true); + double length = 0; + // test.initFlowCalc(); + + test.initFlowCalc(); + test.calcFluxes(); + test.getFluidBoundary().display("test"); + double[][] temperatures2 = new double[3][1000]; + int k = 0; + for (int i = 0; i < 1000; i++) { + length += test.getLengthOfNode(); + test.initFlowCalc(); + test.calcFluxes(); + + if (i > 1 && (i % 1) == 0) { + k++; + // test.display("length " + length); + // test.getBulkSystem().display("length " + length); + // test.getInterphaseSystem().display("length " + length); + // test.getFluidBoundary().display("length " + length); + // test.setLengthOfNode(0.000005 + test.getLengthOfNode() / 2.0); + temperatures2[0][k] = length; + temperatures2[1][k] = test.getGeometry().getInnerWallTemperature(); + System.out.println(test.getBulkSystem().getPhase(0).getComponent("water").getx()); + // test.getFluidBoundary().display("test"); + } + + // test.getBulkSystem().display(); + test.update(); + // test.getFluidBoundary().display("length " + length); + // test.getInterphaseSystem().display("length " + length); + + // test.getFluidBoundary().display("test"); } - /** - *

- * Setter for the field averageDropletDiameter. - *

- * - * @param averageDropletDiameter a double - */ - public void setAverageDropletDiameter(double averageDropletDiameter) { - this.averageDropletDiameter = averageDropletDiameter; + for (int i = 0; i < k; i++) { + System.out.println("len temp " + temperatures2[0][i] + " " + temperatures2[1][i]); } + ThermodynamicOperations ops = new ThermodynamicOperations(testSystem); + ops.TPflash(); + testSystem.display(); + } + + /** + *

+ * Getter for the field averageDropletDiameter. + *

+ * + * @return a double + */ + public double getAverageDropletDiameter() { + return averageDropletDiameter; + } + + /** + *

+ * Setter for the field averageDropletDiameter. + *

+ * + * @param averageDropletDiameter a double + */ + public void setAverageDropletDiameter(double averageDropletDiameter) { + this.averageDropletDiameter = averageDropletDiameter; + } } diff --git a/src/main/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhasePipeFlowNode/StratifiedFlowNode.java b/src/main/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhasePipeFlowNode/StratifiedFlowNode.java index bee67e92b..75ef5bb33 100644 --- a/src/main/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhasePipeFlowNode/StratifiedFlowNode.java +++ b/src/main/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhasePipeFlowNode/StratifiedFlowNode.java @@ -17,190 +17,190 @@ * @version $Id: $Id */ public class StratifiedFlowNode extends TwoPhaseFlowNode { - private static final long serialVersionUID = 1000; - - /** - *

- * Constructor for StratifiedFlowNode. - *

- */ - public StratifiedFlowNode() { - this.flowNodeType = "stratified"; + private static final long serialVersionUID = 1000; + + /** + *

+ * Constructor for StratifiedFlowNode. + *

+ */ + public StratifiedFlowNode() { + this.flowNodeType = "stratified"; + } + + /** + *

+ * Constructor for StratifiedFlowNode. + *

+ * + * @param system a {@link neqsim.thermo.system.SystemInterface} object + * @param pipe a {@link neqsim.fluidMechanics.geometryDefinitions.GeometryDefinitionInterface} + * object + */ + public StratifiedFlowNode(SystemInterface system, GeometryDefinitionInterface pipe) { + super(system, pipe); + this.flowNodeType = "stratified"; + this.interphaseTransportCoefficient = new InterphaseStratifiedFlow(this); + this.fluidBoundary = + new neqsim.fluidMechanics.flowNode.fluidBoundary.heatMassTransferCalc.nonEquilibriumFluidBoundary.filmModelBoundary.KrishnaStandartFilmModel( + this); + } + + /** + *

+ * Constructor for StratifiedFlowNode. + *

+ * + * @param system a {@link neqsim.thermo.system.SystemInterface} object + * @param interphaseSystem a {@link neqsim.thermo.system.SystemInterface} object + * @param pipe a {@link neqsim.fluidMechanics.geometryDefinitions.GeometryDefinitionInterface} + * object + */ + public StratifiedFlowNode(SystemInterface system, SystemInterface interphaseSystem, + GeometryDefinitionInterface pipe) { + super(system, pipe); + this.flowNodeType = "stratified"; + this.interphaseTransportCoefficient = new InterphaseStratifiedFlow(this); + this.fluidBoundary = + new neqsim.fluidMechanics.flowNode.fluidBoundary.heatMassTransferCalc.nonEquilibriumFluidBoundary.filmModelBoundary.KrishnaStandartFilmModel( + this); + } + + /** {@inheritDoc} */ + @Override + public StratifiedFlowNode clone() { + StratifiedFlowNode clonedSystem = null; + try { + clonedSystem = (StratifiedFlowNode) super.clone(); + } catch (Exception e) { + e.printStackTrace(System.err); } - /** - *

- * Constructor for StratifiedFlowNode. - *

- * - * @param system a {@link neqsim.thermo.system.SystemInterface} object - * @param pipe a {@link neqsim.fluidMechanics.geometryDefinitions.GeometryDefinitionInterface} - * object - */ - public StratifiedFlowNode(SystemInterface system, GeometryDefinitionInterface pipe) { - super(system, pipe); - this.flowNodeType = "stratified"; - this.interphaseTransportCoefficient = new InterphaseStratifiedFlow(this); - this.fluidBoundary = - new neqsim.fluidMechanics.flowNode.fluidBoundary.heatMassTransferCalc.nonEquilibriumFluidBoundary.filmModelBoundary.KrishnaStandartFilmModel( - this); + return clonedSystem; + } + + /** {@inheritDoc} */ + @Override + public void init() { + inclination = 0.0; + this.calcContactLength(); + // System.out.println("len " + this.calcContactLength()); + super.init(); + } + + /** {@inheritDoc} */ + @Override + public double calcContactLength() { + double phaseAngel = + pi * phaseFraction[1] + Math.pow(3.0 * pi / 2.0, 1.0 / 3.0) * (1.0 - 2.0 * phaseFraction[1] + + Math.pow(phaseFraction[1], 1.0 / 3.0) - Math.pow(phaseFraction[0], 1.0 / 3.0)); + wallContactLength[1] = phaseAngel * pipe.getDiameter(); + wallContactLength[0] = pi * pipe.getDiameter() - wallContactLength[1]; + interphaseContactLength[0] = pipe.getDiameter() * Math.sin(phaseAngel); + interphaseContactLength[1] = pipe.getDiameter() * Math.sin(phaseAngel); + return wallContactLength[0]; + } + + /** {@inheritDoc} */ + @Override + public FlowNodeInterface getNextNode() { + StratifiedFlowNode newNode = this.clone(); + + for (int i = 0; i < getBulkSystem().getPhases()[0].getNumberOfComponents(); i++) { + // newNode.getBulkSystem().getPhases()[0].addMoles(i, -molarMassTransfer[i]); + // newNode.getBulkSystem().getPhases()[1].addMoles(i, +molarMassTransfer[i]); } - /** - *

- * Constructor for StratifiedFlowNode. - *

- * - * @param system a {@link neqsim.thermo.system.SystemInterface} object - * @param interphaseSystem a {@link neqsim.thermo.system.SystemInterface} object - * @param pipe a {@link neqsim.fluidMechanics.geometryDefinitions.GeometryDefinitionInterface} - * object - */ - public StratifiedFlowNode(SystemInterface system, SystemInterface interphaseSystem, - GeometryDefinitionInterface pipe) { - super(system, pipe); - this.flowNodeType = "stratified"; - this.interphaseTransportCoefficient = new InterphaseStratifiedFlow(this); - this.fluidBoundary = - new neqsim.fluidMechanics.flowNode.fluidBoundary.heatMassTransferCalc.nonEquilibriumFluidBoundary.filmModelBoundary.KrishnaStandartFilmModel( - this); + return newNode; + } + + /** + *

+ * main. + *

+ * + * @param args an array of {@link java.lang.String} objects + */ + @SuppressWarnings("unused") + public static void main(String[] args) { + // SystemInterface testSystem = new SystemSrkEos(273.15 + 11.0, 60.0); + SystemInterface testSystem = new neqsim.thermo.system.SystemSrkCPAstatoil(325.3, 100.0); + ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem); + PipeData pipe1 = new PipeData(0.250203, 0.00025); + testSystem.addComponent("methane", 0.1, "MSm3/day", 0); + testSystem.addComponent("water", 0.4 * 5.0, "kg/hr", 1); + testSystem.addComponent("MEG", 0.6 * 5.0, "kg/hr", 1); + // testSystem.addComponent("nitrogen", 25.0, 0); + // testSystem.addComponent("CO2", 250.0, 0); + // testSystem.addComponent("methane", 5.0, 0); + // testSystem.addComponent("nitrogen", 5.0, 1); + // testSystem.addComponent("CO2", 250.0, 1); + // testSystem.addComponent("methane", 25.0, 1); + // testSystem.addComponent("n-pentane", 25.0, 1); + // testSystem.addComponent("MDEA", 0.08, 1); + // testSystem.getPhase(1).setTemperature(275); + // testSystem.chemicalReactionInit(); + testSystem.createDatabase(true); + testSystem.setMixingRule(10); + // testSystem.getPhase(0).setTemperature(273.15 + 100.0); + testSystem.initPhysicalProperties(); + + // testSystem.addComponent("nitrogen", testSystem.getPhase(1).getMolarVolume() / + // testSystem.getPhase(0).getMolarVolume() * + // testSystem.getPhase(0).getComponent("CO2").getNumberOfmoles(), 0); + + // testSystem.getChemicalReactionOperations().solveChemEq(1); + testSystem.init_x_y(); + testSystem.initBeta(); + testSystem.init(3); + + // testOps.TPflash(); + testSystem.display(); + // testSystem.setTemperature(273.15+20); + // testSystem.initPhysicalProperties(); + + // FlowNodeInterface test = new StratifiedFlowNode(testSystem, pipe1); + // FlowNodeInterface test = new AnnularFlow(testSystem, pipe1); + FlowNodeInterface test = new DropletFlowNode(testSystem, pipe1); + test.setInterphaseModelType(1); + test.setLengthOfNode(0.001); + test.getGeometry().getSurroundingEnvironment().setTemperature(273.15 + 4.0); + + test.getFluidBoundary().setHeatTransferCalc(false); + test.getFluidBoundary().setMassTransferCalc(true); + double length = 0; + test.initFlowCalc(); + double[][] temperatures2 = new double[3][1000]; + int k = 0; + for (int i = 0; i < 100000; i++) { + length += test.getLengthOfNode(); + test.initFlowCalc(); + test.calcFluxes(); + if (i > 1 && (i % 1000) == 0) { + k++; + test.display("length " + length); + System.out.println("length " + length + " wt% MEG " + + test.getBulkSystem().getPhase("aqueous").getWtFrac("MEG") * 100.0); + // test.getBulkSystem().display("length " + length); + // test.getInterphaseSystem().display("length " + length); + // test.getFluidBoundary().display("length " + length); + // test.setLengthOfNode(0.000005 + test.getLengthOfNode() / 2.0); + temperatures2[0][k] = length; + temperatures2[1][k] = test.getGeometry().getInnerWallTemperature(); + // test.getFluidBoundary().display("test"); + } + + // test.getBulkSystem().display(); + test.update(); + // test.getFluidBoundary().display("length " + length); + // test.getInterphaseSystem().display("length " + length); + + // test.getFluidBoundary().display("test"); } - /** {@inheritDoc} */ - @Override - public StratifiedFlowNode clone() { - StratifiedFlowNode clonedSystem = null; - try { - clonedSystem = (StratifiedFlowNode) super.clone(); - } catch (Exception e) { - e.printStackTrace(System.err); - } - - return clonedSystem; - } - - /** {@inheritDoc} */ - @Override - public void init() { - inclination = 0.0; - this.calcContactLength(); - // System.out.println("len " + this.calcContactLength()); - super.init(); - } - - /** {@inheritDoc} */ - @Override - public double calcContactLength() { - double phaseAngel = pi * phaseFraction[1] + Math.pow(3.0 * pi / 2.0, 1.0 / 3.0) - * (1.0 - 2.0 * phaseFraction[1] + Math.pow(phaseFraction[1], 1.0 / 3.0) - - Math.pow(phaseFraction[0], 1.0 / 3.0)); - wallContactLength[1] = phaseAngel * pipe.getDiameter(); - wallContactLength[0] = pi * pipe.getDiameter() - wallContactLength[1]; - interphaseContactLength[0] = pipe.getDiameter() * Math.sin(phaseAngel); - interphaseContactLength[1] = pipe.getDiameter() * Math.sin(phaseAngel); - return wallContactLength[0]; - } - - /** {@inheritDoc} */ - @Override - public FlowNodeInterface getNextNode() { - StratifiedFlowNode newNode = this.clone(); - - for (int i = 0; i < getBulkSystem().getPhases()[0].getNumberOfComponents(); i++) { - // newNode.getBulkSystem().getPhases()[0].addMoles(i, -molarMassTransfer[i]); - // newNode.getBulkSystem().getPhases()[1].addMoles(i, +molarMassTransfer[i]); - } - - return newNode; - } - - /** - *

- * main. - *

- * - * @param args an array of {@link java.lang.String} objects - */ - @SuppressWarnings("unused") - public static void main(String[] args) { - // SystemInterface testSystem = new SystemSrkEos(273.15 + 11.0, 60.0); - SystemInterface testSystem = new neqsim.thermo.system.SystemSrkCPAstatoil(325.3, 100.0); - ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem); - PipeData pipe1 = new PipeData(0.250203, 0.00025); - testSystem.addComponent("methane", 0.1, "MSm3/day", 0); - testSystem.addComponent("water", 0.4 * 5.0, "kg/hr", 1); - testSystem.addComponent("MEG", 0.6 * 5.0, "kg/hr", 1); - // testSystem.addComponent("nitrogen", 25.0, 0); - // testSystem.addComponent("CO2", 250.0, 0); - // testSystem.addComponent("methane", 5.0, 0); - // testSystem.addComponent("nitrogen", 5.0, 1); - // testSystem.addComponent("CO2", 250.0, 1); - // testSystem.addComponent("methane", 25.0, 1); - // testSystem.addComponent("n-pentane", 25.0, 1); - // testSystem.addComponent("MDEA", 0.08, 1); - // testSystem.getPhase(1).setTemperature(275); - // testSystem.chemicalReactionInit(); - testSystem.createDatabase(true); - testSystem.setMixingRule(10); - // testSystem.getPhase(0).setTemperature(273.15 + 100.0); - testSystem.initPhysicalProperties(); - - // testSystem.addComponent("nitrogen", testSystem.getPhase(1).getMolarVolume() / - // testSystem.getPhase(0).getMolarVolume() * - // testSystem.getPhase(0).getComponent("CO2").getNumberOfmoles(), 0); - - // testSystem.getChemicalReactionOperations().solveChemEq(1); - testSystem.init_x_y(); - testSystem.initBeta(); - testSystem.init(3); - - // testOps.TPflash(); - testSystem.display(); - // testSystem.setTemperature(273.15+20); - // testSystem.initPhysicalProperties(); - - // FlowNodeInterface test = new StratifiedFlowNode(testSystem, pipe1); - // FlowNodeInterface test = new AnnularFlow(testSystem, pipe1); - FlowNodeInterface test = new DropletFlowNode(testSystem, pipe1); - test.setInterphaseModelType(1); - test.setLengthOfNode(0.001); - test.getGeometry().getSurroundingEnvironment().setTemperature(273.15 + 4.0); - - test.getFluidBoundary().setHeatTransferCalc(false); - test.getFluidBoundary().setMassTransferCalc(true); - double length = 0; - test.initFlowCalc(); - double[][] temperatures2 = new double[3][1000]; - int k = 0; - for (int i = 0; i < 100000; i++) { - length += test.getLengthOfNode(); - test.initFlowCalc(); - test.calcFluxes(); - if (i > 1 && (i % 1000) == 0) { - k++; - test.display("length " + length); - System.out.println("length " + length + " wt% MEG " - + test.getBulkSystem().getPhase("aqueous").getWtFrac("MEG") * 100.0); - // test.getBulkSystem().display("length " + length); - // test.getInterphaseSystem().display("length " + length); - // test.getFluidBoundary().display("length " + length); - // test.setLengthOfNode(0.000005 + test.getLengthOfNode() / 2.0); - temperatures2[0][k] = length; - temperatures2[1][k] = test.getGeometry().getInnerWallTemperature(); - // test.getFluidBoundary().display("test"); - } - - // test.getBulkSystem().display(); - test.update(); - // test.getFluidBoundary().display("length " + length); - // test.getInterphaseSystem().display("length " + length); - - // test.getFluidBoundary().display("test"); - } - - for (int i = 0; i < k; i++) { - System.out.println("len temp " + temperatures2[0][i] + " " + temperatures2[1][i]); - } - System.out.println("contact length " + test.getInterphaseContactArea()); + for (int i = 0; i < k; i++) { + System.out.println("len temp " + temperatures2[0][i] + " " + temperatures2[1][i]); } + System.out.println("contact length " + test.getInterphaseContactArea()); + } } 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 301460231..401c4a699 100644 --- a/src/main/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhaseReactorFlowNode/TwoPhaseTrayTowerFlowNode.java +++ b/src/main/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhaseReactorFlowNode/TwoPhaseTrayTowerFlowNode.java @@ -18,147 +18,147 @@ * @version $Id: $Id */ public class TwoPhaseTrayTowerFlowNode extends TwoPhaseFlowNode { - private static final long serialVersionUID = 1000; - - /** - *

- * Constructor for TwoPhaseTrayTowerFlowNode. - *

- */ - public TwoPhaseTrayTowerFlowNode() { - this.flowNodeType = "stratified"; + private static final long serialVersionUID = 1000; + + /** + *

+ * Constructor for TwoPhaseTrayTowerFlowNode. + *

+ */ + public TwoPhaseTrayTowerFlowNode() { + this.flowNodeType = "stratified"; + } + + /** + *

+ * Constructor for TwoPhaseTrayTowerFlowNode. + *

+ * + * @param system a {@link neqsim.thermo.system.SystemInterface} object + * @param pipe a {@link neqsim.fluidMechanics.geometryDefinitions.GeometryDefinitionInterface} + * object + */ + public TwoPhaseTrayTowerFlowNode(SystemInterface system, GeometryDefinitionInterface pipe) { + super(system, pipe); + this.flowNodeType = "stratified"; + this.interphaseTransportCoefficient = new InterphaseStratifiedFlow(this); + this.fluidBoundary = + new neqsim.fluidMechanics.flowNode.fluidBoundary.heatMassTransferCalc.nonEquilibriumFluidBoundary.filmModelBoundary.KrishnaStandartFilmModel( + this); + } + + /** + *

+ * Constructor for TwoPhaseTrayTowerFlowNode. + *

+ * + * @param system a {@link neqsim.thermo.system.SystemInterface} object + * @param interphaseSystem a {@link neqsim.thermo.system.SystemInterface} object + * @param pipe a {@link neqsim.fluidMechanics.geometryDefinitions.GeometryDefinitionInterface} + * object + */ + public TwoPhaseTrayTowerFlowNode(SystemInterface system, SystemInterface interphaseSystem, + GeometryDefinitionInterface pipe) { + super(system, pipe); + this.flowNodeType = "stratified"; + this.interphaseTransportCoefficient = new InterphaseStratifiedFlow(this); + this.fluidBoundary = + new neqsim.fluidMechanics.flowNode.fluidBoundary.heatMassTransferCalc.nonEquilibriumFluidBoundary.filmModelBoundary.KrishnaStandartFilmModel( + this); + } + + /** {@inheritDoc} */ + @Override + public TwoPhaseTrayTowerFlowNode clone() { + TwoPhaseTrayTowerFlowNode clonedSystem = null; + try { + clonedSystem = (TwoPhaseTrayTowerFlowNode) super.clone(); + } catch (Exception e) { + e.printStackTrace(System.err); } - /** - *

- * Constructor for TwoPhaseTrayTowerFlowNode. - *

- * - * @param system a {@link neqsim.thermo.system.SystemInterface} object - * @param pipe a {@link neqsim.fluidMechanics.geometryDefinitions.GeometryDefinitionInterface} - * object - */ - public TwoPhaseTrayTowerFlowNode(SystemInterface system, GeometryDefinitionInterface pipe) { - super(system, pipe); - this.flowNodeType = "stratified"; - this.interphaseTransportCoefficient = new InterphaseStratifiedFlow(this); - this.fluidBoundary = - new neqsim.fluidMechanics.flowNode.fluidBoundary.heatMassTransferCalc.nonEquilibriumFluidBoundary.filmModelBoundary.KrishnaStandartFilmModel( - this); + return clonedSystem; + } + + /** {@inheritDoc} */ + @Override + public void init() { + inclination = 0.0; + this.calcContactLength(); + super.init(); + } + + /** {@inheritDoc} */ + @Override + public double calcContactLength() { + double phaseAngel = + pi * phaseFraction[1] + Math.pow(3.0 * pi / 2.0, 1.0 / 3.0) * (1.0 - 2.0 * phaseFraction[1] + + Math.pow(phaseFraction[1], 1.0 / 3.0) - Math.pow(phaseFraction[0], 1.0 / 3.0)); + + wallContactLength[1] = phaseAngel * pipe.getDiameter(); + wallContactLength[0] = pi * pipe.getDiameter() - wallContactLength[1]; + interphaseContactLength[0] = pipe.getDiameter() * Math.sin(phaseAngel); + interphaseContactLength[1] = pipe.getDiameter() * Math.sin(phaseAngel); + // System.out.println("cont " + interphaseContactLength[1] + " " + + // phaseFraction[1]); + + return wallContactLength[0]; + } + + /** {@inheritDoc} */ + @Override + public FlowNodeInterface getNextNode() { + TwoPhaseTrayTowerFlowNode newNode = this.clone(); + + for (int i = 0; i < getBulkSystem().getPhases()[0].getNumberOfComponents(); i++) { + // newNode.getBulkSystem().getPhases()[0].addMoles(i, -molarMassTransfer[i]); + // newNode.getBulkSystem().getPhases()[1].addMoles(i, +molarMassTransfer[i]); } - /** - *

- * Constructor for TwoPhaseTrayTowerFlowNode. - *

- * - * @param system a {@link neqsim.thermo.system.SystemInterface} object - * @param interphaseSystem a {@link neqsim.thermo.system.SystemInterface} object - * @param pipe a {@link neqsim.fluidMechanics.geometryDefinitions.GeometryDefinitionInterface} - * object + return newNode; + } + + /** + *

+ * main. + *

+ * + * @param args an array of {@link java.lang.String} objects + */ + @SuppressWarnings("unused") + 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); + * + * 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); */ - public TwoPhaseTrayTowerFlowNode(SystemInterface system, SystemInterface interphaseSystem, - GeometryDefinitionInterface pipe) { - super(system, pipe); - this.flowNodeType = "stratified"; - this.interphaseTransportCoefficient = new InterphaseStratifiedFlow(this); - this.fluidBoundary = - new neqsim.fluidMechanics.flowNode.fluidBoundary.heatMassTransferCalc.nonEquilibriumFluidBoundary.filmModelBoundary.KrishnaStandartFilmModel( - this); - } + SystemInterface testSystem = new SystemFurstElectrolyteEos(275.3, 1.01325); + ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem); + PipeData pipe1 = new PipeData(10.0, 0.025); - /** {@inheritDoc} */ - @Override - public TwoPhaseTrayTowerFlowNode clone() { - TwoPhaseTrayTowerFlowNode clonedSystem = null; - try { - clonedSystem = (TwoPhaseTrayTowerFlowNode) super.clone(); - } catch (Exception e) { - e.printStackTrace(System.err); - } - - return clonedSystem; - } + testSystem.addComponent("methane", 0.061152181, 0); + // testSystem.addComponent("CO2", 0.00061152181, 0); + testSystem.addComponent("water", 0.1862204876, 1); + // testSystem.addComponent("MDEA", 0.008,1); - /** {@inheritDoc} */ - @Override - public void init() { - inclination = 0.0; - this.calcContactLength(); - super.init(); - } + // testSystem.chemicalReactionInit(); + testSystem.setMixingRule(2); - /** {@inheritDoc} */ - @Override - public double calcContactLength() { - double phaseAngel = pi * phaseFraction[1] + Math.pow(3.0 * pi / 2.0, 1.0 / 3.0) - * (1.0 - 2.0 * phaseFraction[1] + Math.pow(phaseFraction[1], 1.0 / 3.0) - - Math.pow(phaseFraction[0], 1.0 / 3.0)); - - wallContactLength[1] = phaseAngel * pipe.getDiameter(); - wallContactLength[0] = pi * pipe.getDiameter() - wallContactLength[1]; - interphaseContactLength[0] = pipe.getDiameter() * Math.sin(phaseAngel); - interphaseContactLength[1] = pipe.getDiameter() * Math.sin(phaseAngel); - // System.out.println("cont " + interphaseContactLength[1] + " " + - // phaseFraction[1]); - - return wallContactLength[0]; - } - - /** {@inheritDoc} */ - @Override - public FlowNodeInterface getNextNode() { - TwoPhaseTrayTowerFlowNode newNode = this.clone(); + // testSystem.init(0); + testSystem.init_x_y(); - for (int i = 0; i < getBulkSystem().getPhases()[0].getNumberOfComponents(); i++) { - // newNode.getBulkSystem().getPhases()[0].addMoles(i, -molarMassTransfer[i]); - // newNode.getBulkSystem().getPhases()[1].addMoles(i, +molarMassTransfer[i]); - } + // testSystem.getPhases()[1].setTemperature(294.0); + // testSystem.getPhases()[0].setTemperature(299.0); - return newNode; - } + FlowNodeInterface test = new TwoPhaseTrayTowerFlowNode(testSystem, pipe1); + test.setInterphaseModelType(1); - /** - *

- * main. - *

- * - * @param args an array of {@link java.lang.String} objects - */ - @SuppressWarnings("unused") - 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); - * - * 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); - ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem); - PipeData pipe1 = new PipeData(10.0, 0.025); - - testSystem.addComponent("methane", 0.061152181, 0); - // testSystem.addComponent("CO2", 0.00061152181, 0); - testSystem.addComponent("water", 0.1862204876, 1); - // testSystem.addComponent("MDEA", 0.008,1); - - // testSystem.chemicalReactionInit(); - testSystem.setMixingRule(2); - - // testSystem.init(0); - testSystem.init_x_y(); - - // testSystem.getPhases()[1].setTemperature(294.0); - // testSystem.getPhases()[0].setTemperature(299.0); - - FlowNodeInterface test = new TwoPhaseTrayTowerFlowNode(testSystem, pipe1); - test.setInterphaseModelType(1); - - test.initFlowCalc(); - test.calcFluxes(); - } + test.initFlowCalc(); + test.calcFluxes(); + } } 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 f3cc6e52d..2606304c3 100644 --- a/src/main/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhaseStirredCellNode/StirredCellNode.java +++ b/src/main/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhaseStirredCellNode/StirredCellNode.java @@ -18,277 +18,278 @@ * @version $Id: $Id */ public class StirredCellNode extends TwoPhaseFlowNode { - private static final long serialVersionUID = 1000; + private static final long serialVersionUID = 1000; - private double[] stirrerRate = {1.0, 1.0}, stirrerDiameter = {1.0, 1.0}; - private double dt = 1.0; + private double[] stirrerRate = {1.0, 1.0}; + private double[] stirrerDiameter = {1.0, 1.0}; + private double dt = 1.0; - /** - *

- * Constructor for StirredCellNode. - *

- */ - public StirredCellNode() { - this.flowNodeType = "stirred cell"; - } + /** + *

+ * Constructor for StirredCellNode. + *

+ */ + public StirredCellNode() { + this.flowNodeType = "stirred cell"; + } - /** - *

- * Constructor for StirredCellNode. - *

- * - * @param system a {@link neqsim.thermo.system.SystemInterface} object - * @param pipe a {@link neqsim.fluidMechanics.geometryDefinitions.GeometryDefinitionInterface} - * object - */ - public StirredCellNode(SystemInterface system, GeometryDefinitionInterface pipe) { - super(system, pipe); - this.flowNodeType = "stirred cell"; - this.interphaseTransportCoefficient = new InterphaseStirredCellFlow(this); - this.fluidBoundary = - new neqsim.fluidMechanics.flowNode.fluidBoundary.heatMassTransferCalc.nonEquilibriumFluidBoundary.filmModelBoundary.KrishnaStandartFilmModel( - this); - } + /** + *

+ * Constructor for StirredCellNode. + *

+ * + * @param system a {@link neqsim.thermo.system.SystemInterface} object + * @param pipe a {@link neqsim.fluidMechanics.geometryDefinitions.GeometryDefinitionInterface} + * object + */ + public StirredCellNode(SystemInterface system, GeometryDefinitionInterface pipe) { + super(system, pipe); + this.flowNodeType = "stirred cell"; + this.interphaseTransportCoefficient = new InterphaseStirredCellFlow(this); + this.fluidBoundary = + new neqsim.fluidMechanics.flowNode.fluidBoundary.heatMassTransferCalc.nonEquilibriumFluidBoundary.filmModelBoundary.KrishnaStandartFilmModel( + this); + } - /** - *

- * Constructor for StirredCellNode. - *

- * - * @param system a {@link neqsim.thermo.system.SystemInterface} object - * @param interphaseSystem a {@link neqsim.thermo.system.SystemInterface} object - * @param pipe a {@link neqsim.fluidMechanics.geometryDefinitions.GeometryDefinitionInterface} - * object - */ - public StirredCellNode(SystemInterface system, SystemInterface interphaseSystem, - GeometryDefinitionInterface pipe) { - super(system, pipe); - this.flowNodeType = "stirred cell"; - this.interphaseTransportCoefficient = new InterphaseStirredCellFlow(this); - this.fluidBoundary = - new neqsim.fluidMechanics.flowNode.fluidBoundary.heatMassTransferCalc.nonEquilibriumFluidBoundary.filmModelBoundary.KrishnaStandartFilmModel( - this); - } + /** + *

+ * Constructor for StirredCellNode. + *

+ * + * @param system a {@link neqsim.thermo.system.SystemInterface} object + * @param interphaseSystem a {@link neqsim.thermo.system.SystemInterface} object + * @param pipe a {@link neqsim.fluidMechanics.geometryDefinitions.GeometryDefinitionInterface} + * object + */ + public StirredCellNode(SystemInterface system, SystemInterface interphaseSystem, + GeometryDefinitionInterface pipe) { + super(system, pipe); + this.flowNodeType = "stirred cell"; + this.interphaseTransportCoefficient = new InterphaseStirredCellFlow(this); + this.fluidBoundary = + new neqsim.fluidMechanics.flowNode.fluidBoundary.heatMassTransferCalc.nonEquilibriumFluidBoundary.filmModelBoundary.KrishnaStandartFilmModel( + this); + } - /** {@inheritDoc} */ - @Override - public double calcHydraulicDiameter() { - return getGeometry().getDiameter(); - } + /** {@inheritDoc} */ + @Override + public double calcHydraulicDiameter() { + return getGeometry().getDiameter(); + } - /** {@inheritDoc} */ - @Override - public double calcReynoldNumber() { - reynoldsNumber[1] = Math.pow(stirrerDiameter[1], 2.0) * stirrerRate[1] - * bulkSystem.getPhases()[1].getPhysicalProperties().getDensity() - / bulkSystem.getPhases()[1].getPhysicalProperties().getViscosity(); - reynoldsNumber[0] = Math.pow(stirrerDiameter[0], 2.0) * stirrerRate[0] - * bulkSystem.getPhases()[0].getPhysicalProperties().getDensity() - / bulkSystem.getPhases()[0].getPhysicalProperties().getViscosity(); - System.out.println("rey liq " + reynoldsNumber[1]); - System.out.println("rey gas " + reynoldsNumber[0]); - return reynoldsNumber[1]; - } + /** {@inheritDoc} */ + @Override + public double calcReynoldNumber() { + reynoldsNumber[1] = Math.pow(stirrerDiameter[1], 2.0) * stirrerRate[1] + * bulkSystem.getPhases()[1].getPhysicalProperties().getDensity() + / bulkSystem.getPhases()[1].getPhysicalProperties().getViscosity(); + reynoldsNumber[0] = Math.pow(stirrerDiameter[0], 2.0) * stirrerRate[0] + * bulkSystem.getPhases()[0].getPhysicalProperties().getDensity() + / bulkSystem.getPhases()[0].getPhysicalProperties().getViscosity(); + System.out.println("rey liq " + reynoldsNumber[1]); + System.out.println("rey gas " + reynoldsNumber[0]); + return reynoldsNumber[1]; + } - /** {@inheritDoc} */ - @Override - public StirredCellNode clone() { - StirredCellNode clonedSystem = null; - try { - clonedSystem = (StirredCellNode) super.clone(); - } catch (Exception e) { - e.printStackTrace(System.err); - } - - return clonedSystem; + /** {@inheritDoc} */ + @Override + public StirredCellNode clone() { + StirredCellNode clonedSystem = null; + try { + clonedSystem = (StirredCellNode) super.clone(); + } catch (Exception e) { + e.printStackTrace(System.err); } - /** {@inheritDoc} */ - @Override - public void init() { - this.calcContactLength(); - super.init(); - } + return clonedSystem; + } - /** {@inheritDoc} */ - @Override - public void initFlowCalc() { - this.init(); - } + /** {@inheritDoc} */ + @Override + public void init() { + this.calcContactLength(); + super.init(); + } - /** {@inheritDoc} */ - @Override - public double calcContactLength() { - wallContactLength[1] = 1.0; - wallContactLength[0] = 1.0; + /** {@inheritDoc} */ + @Override + public void initFlowCalc() { + this.init(); + } - interphaseContactLength[0] = pi * Math.pow(pipe.getDiameter(), 2.0) / 4.0; - interphaseContactLength[1] = interphaseContactLength[0]; - interphaseContactArea = interphaseContactLength[0]; - return wallContactLength[0]; - } + /** {@inheritDoc} */ + @Override + public double calcContactLength() { + wallContactLength[1] = 1.0; + wallContactLength[0] = 1.0; - /** {@inheritDoc} */ - @Override - public double calcGasLiquidContactArea() { - return pi * Math.pow(pipe.getDiameter(), 2.0) / 4.0; - } + interphaseContactLength[0] = pi * Math.pow(pipe.getDiameter(), 2.0) / 4.0; + interphaseContactLength[1] = interphaseContactLength[0]; + interphaseContactArea = interphaseContactLength[0]; + return wallContactLength[0]; + } - /** {@inheritDoc} */ - @Override - public void update() { - for (int componentNumber = 0; componentNumber < getBulkSystem().getPhases()[0] - .getNumberOfComponents(); componentNumber++) { - double liquidMolarRate = getFluidBoundary().getInterphaseMolarFlux(componentNumber) - * getInterphaseContactArea() * getDt(); - double gasMolarRate = -getFluidBoundary().getInterphaseMolarFlux(componentNumber) - * getInterphaseContactArea() * getDt(); - // System.out.println("liquidMolarRate" + liquidMolarRate); - getBulkSystem().getPhases()[0].addMoles(componentNumber, gasMolarRate); - getBulkSystem().getPhases()[1].addMoles(componentNumber, liquidMolarRate); - } - // getBulkSystem().initBeta(); - getBulkSystem().init_x_y(); - getBulkSystem().init(1); + /** {@inheritDoc} */ + @Override + public double calcGasLiquidContactArea() { + return pi * Math.pow(pipe.getDiameter(), 2.0) / 4.0; + } - if (bulkSystem.isChemicalSystem()) { - getOperations().chemicalEquilibrium(); - } - getBulkSystem().init(1); + /** {@inheritDoc} */ + @Override + public void update() { + for (int componentNumber = 0; componentNumber < getBulkSystem().getPhases()[0] + .getNumberOfComponents(); componentNumber++) { + double liquidMolarRate = getFluidBoundary().getInterphaseMolarFlux(componentNumber) + * getInterphaseContactArea() * getDt(); + double gasMolarRate = -getFluidBoundary().getInterphaseMolarFlux(componentNumber) + * getInterphaseContactArea() * getDt(); + // System.out.println("liquidMolarRate" + liquidMolarRate); + getBulkSystem().getPhases()[0].addMoles(componentNumber, gasMolarRate); + getBulkSystem().getPhases()[1].addMoles(componentNumber, liquidMolarRate); } + // getBulkSystem().initBeta(); + getBulkSystem().init_x_y(); + getBulkSystem().init(1); - /** {@inheritDoc} */ - @Override - public FlowNodeInterface getNextNode() { - StirredCellNode newNode = this.clone(); - for (int i = 0; i < getBulkSystem().getPhases()[0].getNumberOfComponents(); i++) { - // newNode.getBulkSystem().getPhases()[0].addMoles(i, -molarMassTransfer[i]); - // newNode.getBulkSystem().getPhases()[1].addMoles(i, +molarMassTransfer[i]); - } - return newNode; + if (bulkSystem.isChemicalSystem()) { + getOperations().chemicalEquilibrium(); } + getBulkSystem().init(1); + } - /** - * Getter for property stirrerRate. - * - * @return Value of property stirrerRate. - * @param i a int - */ - public double getStirrerRate(int i) { - return stirrerRate[i]; + /** {@inheritDoc} */ + @Override + public FlowNodeInterface getNextNode() { + StirredCellNode newNode = this.clone(); + for (int i = 0; i < getBulkSystem().getPhases()[0].getNumberOfComponents(); i++) { + // newNode.getBulkSystem().getPhases()[0].addMoles(i, -molarMassTransfer[i]); + // newNode.getBulkSystem().getPhases()[1].addMoles(i, +molarMassTransfer[i]); } + return newNode; + } - /** - * Setter for property stirrerRate. - * - * @param stirrerRate New value of property stirrerRate. - * @param i a int - */ - public void setStirrerSpeed(int i, double stirrerRate) { - this.stirrerRate[i] = stirrerRate; - } + /** + * Getter for property stirrerRate. + * + * @param i a int + * @return Value of property stirrerRate. + */ + public double getStirrerRate(int i) { + return stirrerRate[i]; + } - /** - *

- * setStirrerSpeed. - *

- * - * @param stirrerRate a double - */ - public void setStirrerSpeed(double stirrerRate) { - this.stirrerRate[0] = stirrerRate; - this.stirrerRate[1] = stirrerRate; - } + /** + * Setter for property stirrerRate. + * + * @param stirrerRate New value of property stirrerRate. + * @param i a int + */ + public void setStirrerSpeed(int i, double stirrerRate) { + this.stirrerRate[i] = stirrerRate; + } - /** - * Getter for property dt. - * - * @return Value of property dt. - */ - public double getDt() { - return dt; - } + /** + *

+ * setStirrerSpeed. + *

+ * + * @param stirrerRate a double + */ + public void setStirrerSpeed(double stirrerRate) { + this.stirrerRate[0] = stirrerRate; + this.stirrerRate[1] = stirrerRate; + } - /** - * Setter for property dt. - * - * @param dt New value of property dt. - */ - public void setDt(double dt) { - this.dt = dt; - } + /** + * Getter for property dt. + * + * @return Value of property dt. + */ + public double getDt() { + return dt; + } - /** - *

- * main. - *

- * - * @param args an array of {@link java.lang.String} objects - */ - @SuppressWarnings("unused") - public static void main(String[] args) { - // SystemInterface testSystem = new SystemFurstElectrolyteEos(275.3, 1.01325); - // SystemInterface testSystem = new SystemSrkEos(313.3, 70.01325); - SystemInterface testSystem = new SystemSrkCPAstatoil(313.3, 70.01325); - ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem); - StirredCell pipe1 = new StirredCell(2.0, 0.05); + /** + * Setter for property dt. + * + * @param dt New value of property dt. + */ + public void setDt(double dt) { + this.dt = dt; + } - testSystem.addComponent("methane", 0.1061152181, "MSm3/hr", 0); - testSystem.addComponent("water", 10.206862204876, "kg/min", 0); - testSystem.addComponent("methanol", 1011.206862204876, "kg/min", 1); - testSystem.createDatabase(true); - testSystem.setMixingRule(10); - testSystem.initPhysicalProperties(); - StirredCellNode test = new StirredCellNode(testSystem, pipe1); - test.setInterphaseModelType(1); - test.getFluidBoundary().useFiniteFluxCorrection(true); - test.getFluidBoundary().useThermodynamicCorrections(true); - test.setStirrerSpeed(111350.0 / 60.0); - test.setStirrerDiameter(0.05); - test.setDt(1.10); + /** + *

+ * main. + *

+ * + * @param args an array of {@link java.lang.String} objects + */ + @SuppressWarnings("unused") + public static void main(String[] args) { + // SystemInterface testSystem = new SystemFurstElectrolyteEos(275.3, 1.01325); + // SystemInterface testSystem = new SystemSrkEos(313.3, 70.01325); + SystemInterface testSystem = new SystemSrkCPAstatoil(313.3, 70.01325); + ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem); + StirredCell pipe1 = new StirredCell(2.0, 0.05); - test.initFlowCalc(); - // testSystem.init(0); - // testOps.TPflash(); + testSystem.addComponent("methane", 0.1061152181, "MSm3/hr", 0); + testSystem.addComponent("water", 10.206862204876, "kg/min", 0); + testSystem.addComponent("methanol", 1011.206862204876, "kg/min", 1); + testSystem.createDatabase(true); + testSystem.setMixingRule(10); + testSystem.initPhysicalProperties(); + StirredCellNode test = new StirredCellNode(testSystem, pipe1); + test.setInterphaseModelType(1); + test.getFluidBoundary().useFiniteFluxCorrection(true); + test.getFluidBoundary().useThermodynamicCorrections(true); + test.setStirrerSpeed(111350.0 / 60.0); + test.setStirrerDiameter(0.05); + test.setDt(1.10); - test.display(); - for (int i = 0; i < 120; i++) { - test.initFlowCalc(); - test.calcFluxes(); - test.update(); - // test.display("new"); - test.getBulkSystem().display(); - // test.getFluidBoundary().display("test"); - } - } + test.initFlowCalc(); + // testSystem.init(0); + // testOps.TPflash(); - /** - * Getter for property stirrerDiameter. - * - * @return Value of property stirrerDiameter. - */ - public double[] getStirrerDiameter() { - return this.stirrerDiameter; + test.display(); + for (int i = 0; i < 120; i++) { + test.initFlowCalc(); + test.calcFluxes(); + test.update(); + // test.display("new"); + test.getBulkSystem().display(); + // test.getFluidBoundary().display("test"); } + } - /** - *

- * Setter for the field stirrerDiameter. - *

- * - * @param stirrerDiameter a double - */ - public void setStirrerDiameter(double stirrerDiameter) { - this.stirrerDiameter[0] = stirrerDiameter; - this.stirrerDiameter[1] = stirrerDiameter; - } + /** + * Getter for property stirrerDiameter. + * + * @return Value of property stirrerDiameter. + */ + public double[] getStirrerDiameter() { + return this.stirrerDiameter; + } - /** - * Setter for property stirrerDiameter. - * - * @param stirrerDiameter New value of property stirrerDiameter. - */ - public void setStirrerDiameter(double[] stirrerDiameter) { - this.stirrerDiameter = stirrerDiameter; - } + /** + *

+ * Setter for the field stirrerDiameter. + *

+ * + * @param stirrerDiameter a double + */ + public void setStirrerDiameter(double stirrerDiameter) { + this.stirrerDiameter[0] = stirrerDiameter; + this.stirrerDiameter[1] = stirrerDiameter; + } + + /** + * Setter for property stirrerDiameter. + * + * @param stirrerDiameter New value of property stirrerDiameter. + */ + public void setStirrerDiameter(double[] stirrerDiameter) { + this.stirrerDiameter = stirrerDiameter; + } } diff --git a/src/main/java/neqsim/fluidMechanics/flowSolver/twoPhaseFlowSolver/twoPhasePipeFlowSolver/TwoPhasePipeFlowSolver.java b/src/main/java/neqsim/fluidMechanics/flowSolver/twoPhaseFlowSolver/twoPhasePipeFlowSolver/TwoPhasePipeFlowSolver.java index c30f5ab11..4952116b0 100644 --- a/src/main/java/neqsim/fluidMechanics/flowSolver/twoPhaseFlowSolver/twoPhasePipeFlowSolver/TwoPhasePipeFlowSolver.java +++ b/src/main/java/neqsim/fluidMechanics/flowSolver/twoPhaseFlowSolver/twoPhasePipeFlowSolver/TwoPhasePipeFlowSolver.java @@ -12,80 +12,80 @@ * @version $Id: $Id */ public class TwoPhasePipeFlowSolver - extends neqsim.fluidMechanics.flowSolver.onePhaseFlowSolver.OnePhaseFlowSolver { - private static final long serialVersionUID = 1000; + extends neqsim.fluidMechanics.flowSolver.onePhaseFlowSolver.OnePhaseFlowSolver { + private static final long serialVersionUID = 1000; - protected double[] PbArray; // = new double[100]; - protected Matrix[] solMatrix; - protected Matrix[][] solMolFracMatrix; - protected Matrix[] solPhaseConsMatrix; - protected Matrix sol2Matrix; - protected Matrix[] sol3Matrix; - protected Matrix[] sol4Matrix; + protected double[] PbArray; // = new double[100]; + protected Matrix[] solMatrix; + protected Matrix[][] solMolFracMatrix; + protected Matrix[] solPhaseConsMatrix; + protected Matrix sol2Matrix; + protected Matrix[] sol3Matrix; + protected Matrix[] sol4Matrix; - protected double a[]; - protected double b[]; - protected double c[]; - protected double r[]; - protected double length; - protected FlowSystemInterface pipe; - protected int numberOfNodes; + protected double[] a; + protected double[] b; + protected double[] c; + protected double[] r; + protected double length; + protected FlowSystemInterface pipe; + protected int numberOfNodes; - /** - *

- * Constructor for TwoPhasePipeFlowSolver. - *

- */ - public TwoPhasePipeFlowSolver() {} + /** + *

+ * Constructor for TwoPhasePipeFlowSolver. + *

+ */ + public TwoPhasePipeFlowSolver() {} - /** - *

- * Constructor for TwoPhasePipeFlowSolver. - *

- * - * @param pipe a {@link neqsim.fluidMechanics.flowSystem.FlowSystemInterface} object - * @param length a double - * @param nodes a int - */ - public TwoPhasePipeFlowSolver(FlowSystemInterface pipe, double length, int nodes) { - this.pipe = pipe; - this.length = length; - this.numberOfNodes = nodes; - PbArray = new double[nodes]; - solMatrix = new Matrix[2]; - sol3Matrix = new Matrix[2]; - solPhaseConsMatrix = new Matrix[2]; - solMolFracMatrix = new Matrix[2][pipe.getNode(0).getBulkSystem().getPhases()[0] - .getNumberOfComponents()]; - solMatrix[0] = new Matrix(PbArray, 1).transpose(); - solMatrix[1] = new Matrix(PbArray, 1).transpose(); - for (int phase = 0; phase < 2; phase++) { - for (int i = 0; i < pipe.getNode(0).getBulkSystem().getPhases()[0] - .getNumberOfComponents(); i++) { - solMolFracMatrix[phase][i] = new Matrix(PbArray, 1).transpose(); - } - } - sol3Matrix[0] = new Matrix(PbArray, 1).transpose(); - sol3Matrix[1] = new Matrix(PbArray, 1).transpose(); - solPhaseConsMatrix[0] = new Matrix(PbArray, 1).transpose(); - solPhaseConsMatrix[1] = new Matrix(PbArray, 1).transpose(); - sol2Matrix = new Matrix(PbArray, 1).transpose(); - a = new double[nodes]; - b = new double[nodes]; - c = new double[nodes]; - r = new double[nodes]; + /** + *

+ * Constructor for TwoPhasePipeFlowSolver. + *

+ * + * @param pipe a {@link neqsim.fluidMechanics.flowSystem.FlowSystemInterface} object + * @param length a double + * @param nodes a int + */ + public TwoPhasePipeFlowSolver(FlowSystemInterface pipe, double length, int nodes) { + this.pipe = pipe; + this.length = length; + this.numberOfNodes = nodes; + PbArray = new double[nodes]; + solMatrix = new Matrix[2]; + sol3Matrix = new Matrix[2]; + solPhaseConsMatrix = new Matrix[2]; + solMolFracMatrix = + new Matrix[2][pipe.getNode(0).getBulkSystem().getPhases()[0].getNumberOfComponents()]; + solMatrix[0] = new Matrix(PbArray, 1).transpose(); + solMatrix[1] = new Matrix(PbArray, 1).transpose(); + for (int phase = 0; phase < 2; phase++) { + for (int i = 0; i < pipe.getNode(0).getBulkSystem().getPhases()[0] + .getNumberOfComponents(); i++) { + solMolFracMatrix[phase][i] = new Matrix(PbArray, 1).transpose(); + } } + sol3Matrix[0] = new Matrix(PbArray, 1).transpose(); + sol3Matrix[1] = new Matrix(PbArray, 1).transpose(); + solPhaseConsMatrix[0] = new Matrix(PbArray, 1).transpose(); + solPhaseConsMatrix[1] = new Matrix(PbArray, 1).transpose(); + sol2Matrix = new Matrix(PbArray, 1).transpose(); + a = new double[nodes]; + b = new double[nodes]; + c = new double[nodes]; + r = new double[nodes]; + } - /** {@inheritDoc} */ - @Override - public TwoPhasePipeFlowSolver clone() { - TwoPhasePipeFlowSolver clonedSystem = null; - try { - clonedSystem = (TwoPhasePipeFlowSolver) super.clone(); - } catch (Exception e) { - e.printStackTrace(System.err); - } - - return clonedSystem; + /** {@inheritDoc} */ + @Override + public TwoPhasePipeFlowSolver clone() { + TwoPhasePipeFlowSolver clonedSystem = null; + try { + clonedSystem = (TwoPhasePipeFlowSolver) super.clone(); + } catch (Exception e) { + e.printStackTrace(System.err); } + + return clonedSystem; + } } diff --git a/src/main/java/neqsim/fluidMechanics/geometryDefinitions/pipe/PipeData.java b/src/main/java/neqsim/fluidMechanics/geometryDefinitions/pipe/PipeData.java index 025affd7f..f4796f8c9 100644 --- a/src/main/java/neqsim/fluidMechanics/geometryDefinitions/pipe/PipeData.java +++ b/src/main/java/neqsim/fluidMechanics/geometryDefinitions/pipe/PipeData.java @@ -12,57 +12,57 @@ * @version $Id: $Id */ public class PipeData extends GeometryDefinition { - private static final long serialVersionUID = 1000; + private static final long serialVersionUID = 1000; - /** - *

- * Constructor for PipeData. - *

- */ - public PipeData() { - this.wall = new PipeWall(); - } + /** + *

+ * Constructor for PipeData. + *

+ */ + public PipeData() { + this.wall = new PipeWall(); + } - /** - *

- * Constructor for PipeData. - *

- * - * @param diameter a double - */ - public PipeData(double diameter) { - super(diameter); - wall = new PipeWall(); - } + /** + *

+ * Constructor for PipeData. + *

+ * + * @param diameter a double + */ + public PipeData(double diameter) { + super(diameter); + wall = new PipeWall(); + } - /** - *

- * Constructor for PipeData. - *

- * - * @param diameter a double - * @param roughness a double - */ - public PipeData(double diameter, double roughness) { - super(diameter, roughness); - wall = new PipeWall(); - } + /** + *

+ * Constructor for PipeData. + *

+ * + * @param diameter a double + * @param roughness a double + */ + public PipeData(double diameter, double roughness) { + super(diameter, roughness); + wall = new PipeWall(); + } - /** {@inheritDoc} */ - @Override - public void init() { - super.init(); - } + /** {@inheritDoc} */ + @Override + public void init() { + super.init(); + } - /** {@inheritDoc} */ - @Override - public PipeData clone() { - PipeData clonedPipe = null; - try { - clonedPipe = (PipeData) super.clone(); - } catch (Exception e) { - e.printStackTrace(System.err); - } - return clonedPipe; + /** {@inheritDoc} */ + @Override + public PipeData clone() { + PipeData clonedPipe = null; + try { + clonedPipe = (PipeData) super.clone(); + } catch (Exception e) { + e.printStackTrace(System.err); } + return clonedPipe; + } } diff --git a/src/main/java/neqsim/fluidMechanics/geometryDefinitions/reactor/ReactorData.java b/src/main/java/neqsim/fluidMechanics/geometryDefinitions/reactor/ReactorData.java index 3e85b4045..d4724fe60 100644 --- a/src/main/java/neqsim/fluidMechanics/geometryDefinitions/reactor/ReactorData.java +++ b/src/main/java/neqsim/fluidMechanics/geometryDefinitions/reactor/ReactorData.java @@ -11,123 +11,123 @@ * @version $Id: $Id */ public class ReactorData extends GeometryDefinition { - private static final long serialVersionUID = 1000; + private static final long serialVersionUID = 1000; - /** - *

- * Constructor for ReactorData. - *

- */ - public ReactorData() {} + /** + *

+ * Constructor for ReactorData. + *

+ */ + public ReactorData() {} - /** - *

- * Constructor for ReactorData. - *

- * - * @param diameter a double - */ - public ReactorData(double diameter) { - super(diameter); - } + /** + *

+ * Constructor for ReactorData. + *

+ * + * @param diameter a double + */ + public ReactorData(double diameter) { + super(diameter); + } - /** - *

- * Constructor for ReactorData. - *

- * - * @param diameter a double - * @param roughness a double - */ - public ReactorData(double diameter, double roughness) { - super(diameter, roughness); - packing = - new neqsim.fluidMechanics.geometryDefinitions.internalGeometry.packings.PallRingPacking( - "PallRingPacking"); - } + /** + *

+ * Constructor for ReactorData. + *

+ * + * @param diameter a double + * @param roughness a double + */ + public ReactorData(double diameter, double roughness) { + super(diameter, roughness); + packing = + new neqsim.fluidMechanics.geometryDefinitions.internalGeometry.packings.PallRingPacking( + "PallRingPacking"); + } - /** - *

- * Constructor for ReactorData. - *

- * - * @param diameter a double - * @param packingType a int - */ - public ReactorData(double diameter, int packingType) { - super(diameter); - setPackingType(packingType); - } + /** + *

+ * Constructor for ReactorData. + *

+ * + * @param diameter a double + * @param packingType a int + */ + public ReactorData(double diameter, int packingType) { + super(diameter); + setPackingType(packingType); + } - /** {@inheritDoc} */ - @Override - public void setPackingType(int i) { - // if(i!=100){ - packing = - new neqsim.fluidMechanics.geometryDefinitions.internalGeometry.packings.PallRingPacking( - "PallRingPacking"); - // } - } + /** {@inheritDoc} */ + @Override + public void setPackingType(int i) { + // if(i!=100){ + packing = + new neqsim.fluidMechanics.geometryDefinitions.internalGeometry.packings.PallRingPacking( + "PallRingPacking"); + // } + } - /** - *

- * setPackingType. - *

- * - * @param name a {@link java.lang.String} object - */ - public void setPackingType(String name) { - if (name.equals("pallring")) { - packing = - new neqsim.fluidMechanics.geometryDefinitions.internalGeometry.packings.PallRingPacking( - "pallring"); - } else if (name.equals("rashigring")) { - packing = - new neqsim.fluidMechanics.geometryDefinitions.internalGeometry.packings.RachigRingPacking( - "rashigring"); - } else { - System.out.println("pakcing " + name + " not defined in database - using pallrings"); - packing = - new neqsim.fluidMechanics.geometryDefinitions.internalGeometry.packings.PallRingPacking( - "pallring"); - } + /** + *

+ * setPackingType. + *

+ * + * @param name a {@link java.lang.String} object + */ + public void setPackingType(String name) { + if (name.equals("pallring")) { + packing = + new neqsim.fluidMechanics.geometryDefinitions.internalGeometry.packings.PallRingPacking( + "pallring"); + } else if (name.equals("rashigring")) { + packing = + new neqsim.fluidMechanics.geometryDefinitions.internalGeometry.packings.RachigRingPacking( + "rashigring"); + } else { + System.out.println("pakcing " + name + " not defined in database - using pallrings"); + packing = + new neqsim.fluidMechanics.geometryDefinitions.internalGeometry.packings.PallRingPacking( + "pallring"); } + } - /** {@inheritDoc} */ - @Override - public void setPackingType(String name, String material, int size) { - if (name.equals("pallring")) { - packing = - new neqsim.fluidMechanics.geometryDefinitions.internalGeometry.packings.PallRingPacking( - "pallring", material, size); - } else if (name.equals("rashigring")) { - packing = - new neqsim.fluidMechanics.geometryDefinitions.internalGeometry.packings.RachigRingPacking( - "rashigring", material, size); - } else { - System.out.println("pakcing " + name + " not defined in database - using pallrings"); - packing = - new neqsim.fluidMechanics.geometryDefinitions.internalGeometry.packings.PallRingPacking( - "pallring", material, size); - } + /** {@inheritDoc} */ + @Override + public void setPackingType(String name, String material, int size) { + if (name.equals("pallring")) { + packing = + new neqsim.fluidMechanics.geometryDefinitions.internalGeometry.packings.PallRingPacking( + "pallring", material, size); + } else if (name.equals("rashigring")) { + packing = + new neqsim.fluidMechanics.geometryDefinitions.internalGeometry.packings.RachigRingPacking( + "rashigring", material, size); + } else { + System.out.println("pakcing " + name + " not defined in database - using pallrings"); + packing = + new neqsim.fluidMechanics.geometryDefinitions.internalGeometry.packings.PallRingPacking( + "pallring", material, size); } + } - /** {@inheritDoc} */ - @Override - public void init() { - super.init(); - } - - /** {@inheritDoc} */ - @Override - public ReactorData clone() { - ReactorData clonedPipe = null; - try { - clonedPipe = (ReactorData) super.clone(); - } catch (Exception e) { - e.printStackTrace(System.err); - } + /** {@inheritDoc} */ + @Override + public void init() { + super.init(); + } - return clonedPipe; + /** {@inheritDoc} */ + @Override + public ReactorData clone() { + ReactorData clonedPipe = null; + try { + clonedPipe = (ReactorData) super.clone(); + } catch (Exception e) { + e.printStackTrace(System.err); } + + return clonedPipe; + } } diff --git a/src/main/java/neqsim/fluidMechanics/geometryDefinitions/stirredCell/StirredCell.java b/src/main/java/neqsim/fluidMechanics/geometryDefinitions/stirredCell/StirredCell.java index c7b743836..2fb2062a6 100644 --- a/src/main/java/neqsim/fluidMechanics/geometryDefinitions/stirredCell/StirredCell.java +++ b/src/main/java/neqsim/fluidMechanics/geometryDefinitions/stirredCell/StirredCell.java @@ -11,53 +11,53 @@ * @version $Id: $Id */ public class StirredCell extends GeometryDefinition { - private static final long serialVersionUID = 1000; + private static final long serialVersionUID = 1000; - /** - *

- * Constructor for StirredCell. - *

- */ - public StirredCell() {} + /** + *

+ * Constructor for StirredCell. + *

+ */ + public StirredCell() {} - /** - *

- * Constructor for StirredCell. - *

- * - * @param diameter a double - */ - public StirredCell(double diameter) { - super(diameter); - } + /** + *

+ * Constructor for StirredCell. + *

+ * + * @param diameter a double + */ + public StirredCell(double diameter) { + super(diameter); + } - /** - *

- * Constructor for StirredCell. - *

- * - * @param diameter a double - * @param roughness a double - */ - public StirredCell(double diameter, double roughness) { - super(diameter, roughness); - } + /** + *

+ * Constructor for StirredCell. + *

+ * + * @param diameter a double + * @param roughness a double + */ + public StirredCell(double diameter, double roughness) { + super(diameter, roughness); + } - /** {@inheritDoc} */ - @Override - public void init() { - super.init(); - } + /** {@inheritDoc} */ + @Override + public void init() { + super.init(); + } - /** {@inheritDoc} */ - @Override - public StirredCell clone() { - StirredCell clonedPipe = null; - try { - clonedPipe = (StirredCell) super.clone(); - } catch (Exception e) { - e.printStackTrace(System.err); - } - return clonedPipe; + /** {@inheritDoc} */ + @Override + public StirredCell clone() { + StirredCell clonedPipe = null; + try { + clonedPipe = (StirredCell) super.clone(); + } catch (Exception e) { + e.printStackTrace(System.err); } + return clonedPipe; + } } diff --git a/src/main/java/neqsim/physicalProperties/PhysicalPropertyHandler.java b/src/main/java/neqsim/physicalProperties/PhysicalPropertyHandler.java index 391b2ea68..439b66dad 100644 --- a/src/main/java/neqsim/physicalProperties/PhysicalPropertyHandler.java +++ b/src/main/java/neqsim/physicalProperties/PhysicalPropertyHandler.java @@ -14,175 +14,174 @@ * @version $Id: $Id */ public class PhysicalPropertyHandler implements Cloneable, java.io.Serializable { - private neqsim.physicalProperties.physicalPropertySystem.PhysicalPropertiesInterface gasPhysicalProperties = - null; - private neqsim.physicalProperties.physicalPropertySystem.PhysicalPropertiesInterface oilPhysicalProperties = - null; - private neqsim.physicalProperties.physicalPropertySystem.PhysicalPropertiesInterface aqueousPhysicalProperties = - null; - private neqsim.physicalProperties.physicalPropertySystem.PhysicalPropertiesInterface solidPhysicalProperties = - null; - private neqsim.physicalProperties.mixingRule.PhysicalPropertyMixingRule mixingRule = null; - static Logger logger = LogManager.getLogger(PhysicalPropertyHandler.class); - private static final long serialVersionUID = 1000; + private neqsim.physicalProperties.physicalPropertySystem.PhysicalPropertiesInterface gasPhysicalProperties = + null; + private neqsim.physicalProperties.physicalPropertySystem.PhysicalPropertiesInterface oilPhysicalProperties = + null; + private neqsim.physicalProperties.physicalPropertySystem.PhysicalPropertiesInterface aqueousPhysicalProperties = + null; + private neqsim.physicalProperties.physicalPropertySystem.PhysicalPropertiesInterface solidPhysicalProperties = + null; + private neqsim.physicalProperties.mixingRule.PhysicalPropertyMixingRule mixingRule = null; + static Logger logger = LogManager.getLogger(PhysicalPropertyHandler.class); + private static final long serialVersionUID = 1000; - /** - *

- * Constructor for PhysicalPropertyHandler. - *

- */ - public PhysicalPropertyHandler() {} + /** + *

+ * Constructor for PhysicalPropertyHandler. + *

+ */ + public PhysicalPropertyHandler() {} - /** - *

- * setPhysicalProperties. - *

- * - * @param phase a {@link neqsim.thermo.phase.PhaseInterface} object - * @param type a int - */ - public void setPhysicalProperties(PhaseInterface phase, int type) { - switch (type) { - case 0: - gasPhysicalProperties = - new neqsim.physicalProperties.physicalPropertySystem.gasPhysicalProperties.GasPhysicalProperties( - phase, 0, 0); - oilPhysicalProperties = - new neqsim.physicalProperties.physicalPropertySystem.liquidPhysicalProperties.LiquidPhysicalProperties( - phase, 0, 0); - aqueousPhysicalProperties = - new neqsim.physicalProperties.physicalPropertySystem.liquidPhysicalProperties.WaterPhysicalProperties( - phase, 0, 0); - break; - case 1: - gasPhysicalProperties = - new neqsim.physicalProperties.physicalPropertySystem.gasPhysicalProperties.GasPhysicalProperties( - phase, 0, 0); - oilPhysicalProperties = - new neqsim.physicalProperties.physicalPropertySystem.liquidPhysicalProperties.LiquidPhysicalProperties( - phase, 0, 0); - aqueousPhysicalProperties = - new neqsim.physicalProperties.physicalPropertySystem.liquidPhysicalProperties.WaterPhysicalProperties( - phase, 0, 0); - break; - case 2: - gasPhysicalProperties = - new neqsim.physicalProperties.physicalPropertySystem.gasPhysicalProperties.GasPhysicalProperties( - phase, 0, 0); - oilPhysicalProperties = - new neqsim.physicalProperties.physicalPropertySystem.liquidPhysicalProperties.LiquidPhysicalProperties( - phase, 0, 0); - aqueousPhysicalProperties = - new neqsim.physicalProperties.physicalPropertySystem.liquidPhysicalProperties.GlycolPhysicalProperties( - phase, 0, 0); - break; - case 3: - gasPhysicalProperties = - new neqsim.physicalProperties.physicalPropertySystem.gasPhysicalProperties.GasPhysicalProperties( - phase, 0, 0); - oilPhysicalProperties = - new neqsim.physicalProperties.physicalPropertySystem.liquidPhysicalProperties.LiquidPhysicalProperties( - phase, 0, 0); - aqueousPhysicalProperties = - new neqsim.physicalProperties.physicalPropertySystem.liquidPhysicalProperties.AminePhysicalProperties( - phase, 0, 0); - break; - case 4: - gasPhysicalProperties = - new neqsim.physicalProperties.physicalPropertySystem.gasPhysicalProperties.GasPhysicalProperties( - phase, 0, 0); - oilPhysicalProperties = - new neqsim.physicalProperties.physicalPropertySystem.liquidPhysicalProperties.LiquidPhysicalProperties( - phase, 0, 0); - aqueousPhysicalProperties = - new neqsim.physicalProperties.physicalPropertySystem.liquidPhysicalProperties.CO2waterPhysicalProperties( - phase, 0, 0); - break; - case 6: - gasPhysicalProperties = - new neqsim.physicalProperties.physicalPropertySystem.commonPhasePhysicalProperties.DefaultPhysicalProperties( - phase, 0, 0); - oilPhysicalProperties = - new neqsim.physicalProperties.physicalPropertySystem.commonPhasePhysicalProperties.DefaultPhysicalProperties( - phase, 0, 0); - aqueousPhysicalProperties = - new neqsim.physicalProperties.physicalPropertySystem.commonPhasePhysicalProperties.DefaultPhysicalProperties( - phase, 0, 0); - break; - default: - logger.error( - "error selecting physical properties model.\n Continue using default model..."); - setPhysicalProperties(phase, 0); - break; - } - solidPhysicalProperties = new SolidPhysicalProperties(phase); - mixingRule = new neqsim.physicalProperties.mixingRule.PhysicalPropertyMixingRule(); - mixingRule.initMixingRules(phase); - gasPhysicalProperties.setMixingRule(mixingRule); - oilPhysicalProperties.setMixingRule(mixingRule); - aqueousPhysicalProperties.setMixingRule(mixingRule); + /** + *

+ * setPhysicalProperties. + *

+ * + * @param phase a {@link neqsim.thermo.phase.PhaseInterface} object + * @param type a int + */ + public void setPhysicalProperties(PhaseInterface phase, int type) { + switch (type) { + case 0: + gasPhysicalProperties = + new neqsim.physicalProperties.physicalPropertySystem.gasPhysicalProperties.GasPhysicalProperties( + phase, 0, 0); + oilPhysicalProperties = + new neqsim.physicalProperties.physicalPropertySystem.liquidPhysicalProperties.LiquidPhysicalProperties( + phase, 0, 0); + aqueousPhysicalProperties = + new neqsim.physicalProperties.physicalPropertySystem.liquidPhysicalProperties.WaterPhysicalProperties( + phase, 0, 0); + break; + case 1: + gasPhysicalProperties = + new neqsim.physicalProperties.physicalPropertySystem.gasPhysicalProperties.GasPhysicalProperties( + phase, 0, 0); + oilPhysicalProperties = + new neqsim.physicalProperties.physicalPropertySystem.liquidPhysicalProperties.LiquidPhysicalProperties( + phase, 0, 0); + aqueousPhysicalProperties = + new neqsim.physicalProperties.physicalPropertySystem.liquidPhysicalProperties.WaterPhysicalProperties( + phase, 0, 0); + break; + case 2: + gasPhysicalProperties = + new neqsim.physicalProperties.physicalPropertySystem.gasPhysicalProperties.GasPhysicalProperties( + phase, 0, 0); + oilPhysicalProperties = + new neqsim.physicalProperties.physicalPropertySystem.liquidPhysicalProperties.LiquidPhysicalProperties( + phase, 0, 0); + aqueousPhysicalProperties = + new neqsim.physicalProperties.physicalPropertySystem.liquidPhysicalProperties.GlycolPhysicalProperties( + phase, 0, 0); + break; + case 3: + gasPhysicalProperties = + new neqsim.physicalProperties.physicalPropertySystem.gasPhysicalProperties.GasPhysicalProperties( + phase, 0, 0); + oilPhysicalProperties = + new neqsim.physicalProperties.physicalPropertySystem.liquidPhysicalProperties.LiquidPhysicalProperties( + phase, 0, 0); + aqueousPhysicalProperties = + new neqsim.physicalProperties.physicalPropertySystem.liquidPhysicalProperties.AminePhysicalProperties( + phase, 0, 0); + break; + case 4: + gasPhysicalProperties = + new neqsim.physicalProperties.physicalPropertySystem.gasPhysicalProperties.GasPhysicalProperties( + phase, 0, 0); + oilPhysicalProperties = + new neqsim.physicalProperties.physicalPropertySystem.liquidPhysicalProperties.LiquidPhysicalProperties( + phase, 0, 0); + aqueousPhysicalProperties = + new neqsim.physicalProperties.physicalPropertySystem.liquidPhysicalProperties.CO2waterPhysicalProperties( + phase, 0, 0); + break; + case 6: + gasPhysicalProperties = + new neqsim.physicalProperties.physicalPropertySystem.commonPhasePhysicalProperties.DefaultPhysicalProperties( + phase, 0, 0); + oilPhysicalProperties = + new neqsim.physicalProperties.physicalPropertySystem.commonPhasePhysicalProperties.DefaultPhysicalProperties( + phase, 0, 0); + aqueousPhysicalProperties = + new neqsim.physicalProperties.physicalPropertySystem.commonPhasePhysicalProperties.DefaultPhysicalProperties( + phase, 0, 0); + break; + default: + logger + .error("error selecting physical properties model.\n Continue using default model..."); + setPhysicalProperties(phase, 0); + break; } + solidPhysicalProperties = new SolidPhysicalProperties(phase); + mixingRule = new neqsim.physicalProperties.mixingRule.PhysicalPropertyMixingRule(); + mixingRule.initMixingRules(phase); + gasPhysicalProperties.setMixingRule(mixingRule); + oilPhysicalProperties.setMixingRule(mixingRule); + aqueousPhysicalProperties.setMixingRule(mixingRule); + } - /** - *

- * getPhysicalProperty. - *

- * - * @param phase a {@link neqsim.thermo.phase.PhaseInterface} object - * @return a - * {@link neqsim.physicalProperties.physicalPropertySystem.PhysicalPropertiesInterface} - * object - */ - public neqsim.physicalProperties.physicalPropertySystem.PhysicalPropertiesInterface getPhysicalProperty( - PhaseInterface phase) { - switch (phase.getPhaseTypeName()) { - case "gas": - return gasPhysicalProperties; - case "oil": - return oilPhysicalProperties; - case "aqueous": - return aqueousPhysicalProperties; - case "solid": - return solidPhysicalProperties; - case "wax": - return solidPhysicalProperties; - case "hydrate": - return solidPhysicalProperties; - default: - return gasPhysicalProperties; - } + /** + *

+ * getPhysicalProperty. + *

+ * + * @param phase a {@link neqsim.thermo.phase.PhaseInterface} object + * @return a {@link neqsim.physicalProperties.physicalPropertySystem.PhysicalPropertiesInterface} + * object + */ + public neqsim.physicalProperties.physicalPropertySystem.PhysicalPropertiesInterface getPhysicalProperty( + PhaseInterface phase) { + switch (phase.getPhaseTypeName()) { + case "gas": + return gasPhysicalProperties; + case "oil": + return oilPhysicalProperties; + case "aqueous": + return aqueousPhysicalProperties; + case "solid": + return solidPhysicalProperties; + case "wax": + return solidPhysicalProperties; + case "hydrate": + return solidPhysicalProperties; + default: + return gasPhysicalProperties; } + } - /** {@inheritDoc} */ - @Override - public PhysicalPropertyHandler clone() { - PhysicalPropertyHandler clonedHandler = null; + /** {@inheritDoc} */ + @Override + public PhysicalPropertyHandler clone() { + PhysicalPropertyHandler clonedHandler = null; - try { - clonedHandler = (PhysicalPropertyHandler) super.clone(); - } catch (Exception e) { - // e.printStackTrace(System.err); - logger.error(e.getMessage()); - } - try { - if (gasPhysicalProperties != null) { - clonedHandler.gasPhysicalProperties = gasPhysicalProperties.clone(); - } - if (oilPhysicalProperties != null) { - clonedHandler.oilPhysicalProperties = oilPhysicalProperties.clone(); - } - if (aqueousPhysicalProperties != null) { - clonedHandler.aqueousPhysicalProperties = aqueousPhysicalProperties.clone(); - } - if (solidPhysicalProperties != null) { - clonedHandler.solidPhysicalProperties = solidPhysicalProperties.clone(); - } - if (mixingRule != null) { - clonedHandler.mixingRule = mixingRule.clone(); - } - } catch (Exception e) { - e.printStackTrace(System.err); - } - return clonedHandler; + try { + clonedHandler = (PhysicalPropertyHandler) super.clone(); + } catch (Exception e) { + // e.printStackTrace(System.err); + logger.error(e.getMessage()); } + try { + if (gasPhysicalProperties != null) { + clonedHandler.gasPhysicalProperties = gasPhysicalProperties.clone(); + } + if (oilPhysicalProperties != null) { + clonedHandler.oilPhysicalProperties = oilPhysicalProperties.clone(); + } + if (aqueousPhysicalProperties != null) { + clonedHandler.aqueousPhysicalProperties = aqueousPhysicalProperties.clone(); + } + if (solidPhysicalProperties != null) { + clonedHandler.solidPhysicalProperties = solidPhysicalProperties.clone(); + } + if (mixingRule != null) { + clonedHandler.mixingRule = mixingRule.clone(); + } + } catch (Exception e) { + e.printStackTrace(System.err); + } + return clonedHandler; + } } diff --git a/src/main/java/neqsim/statistics/parameterFitting/BaseFunction.java b/src/main/java/neqsim/statistics/parameterFitting/BaseFunction.java index a678d180a..00713a261 100644 --- a/src/main/java/neqsim/statistics/parameterFitting/BaseFunction.java +++ b/src/main/java/neqsim/statistics/parameterFitting/BaseFunction.java @@ -12,113 +12,113 @@ * @version $Id: $Id */ public abstract class BaseFunction implements FunctionInterface { - public double[] params = null; - public double[][] bounds = null; - - public SystemInterface system; - public ThermodynamicOperations thermoOps; - - /** - *

- * Constructor for BaseFunction. - *

- */ - public BaseFunction() {} - - /** {@inheritDoc} */ - @Override - public BaseFunction clone() { - BaseFunction clonedClass = null; - try { - clonedClass = (BaseFunction) super.clone(); - } catch (Exception e) { - e.printStackTrace(System.err); - } - // if(system!=null) clonedClass.system = system.clone(); - clonedClass.params = params.clone(); - System.arraycopy(params, 0, clonedClass.params, 0, params.length); - - return clonedClass; - } - - /** {@inheritDoc} */ - @Override - public void setThermodynamicSystem(SystemInterface system) { - this.system = system; - thermoOps = new ThermodynamicOperations(system); - } - - /** {@inheritDoc} */ - @Override - public double getFittingParams(int i) { - return params[i]; - } - - /** {@inheritDoc} */ - @Override - public SystemInterface getSystem() { - return system; - } - - /** {@inheritDoc} */ - @Override - public double[] getFittingParams() { - return params; - } - - /** {@inheritDoc} */ - @Override - public int getNumberOfFittingParams() { - return params.length; - } - - /** {@inheritDoc} */ - @Override - public void setInitialGuess(double[] guess) { - System.out.println("start fitting " + guess.length + " parameter(s)..."); - params = new double[guess.length]; - System.arraycopy(guess, 0, params, 0, guess.length); - } - - /** {@inheritDoc} */ - @Override - public abstract double calcValue(double[] dependentValues); - - /** {@inheritDoc} */ - @Override - public double calcTrueValue(double val) { - return val; - } - - /** {@inheritDoc} */ - @Override - public abstract void setFittingParams(int i, double value); - - /** {@inheritDoc} */ - @Override - public void setDatabaseParameters() {} - - /** {@inheritDoc} */ - @Override - public double getLowerBound(int i) { - return this.bounds[i][0]; - } - - /** {@inheritDoc} */ - @Override - public double getUpperBound(int i) { - return this.bounds[i][1]; - } - - /** {@inheritDoc} */ - @Override - public double[][] getBounds() { - return this.bounds; - } - - /** {@inheritDoc} */ - @Override - public void setBounds(double[][] bounds) { - this.bounds = bounds; + public double[] params = null; + public double[][] bounds = null; + + public SystemInterface system; + public ThermodynamicOperations thermoOps; + + /** + *

+ * Constructor for BaseFunction. + *

+ */ + public BaseFunction() {} + + /** {@inheritDoc} */ + @Override + public BaseFunction clone() { + BaseFunction clonedClass = null; + try { + clonedClass = (BaseFunction) super.clone(); + } catch (Exception e) { + e.printStackTrace(System.err); } + // if(system!=null) clonedClass.system = system.clone(); + clonedClass.params = params.clone(); + System.arraycopy(params, 0, clonedClass.params, 0, params.length); + + return clonedClass; + } + + /** {@inheritDoc} */ + @Override + public void setThermodynamicSystem(SystemInterface system) { + this.system = system; + thermoOps = new ThermodynamicOperations(system); + } + + /** {@inheritDoc} */ + @Override + public double[] getFittingParams() { + return params; + } + + /** {@inheritDoc} */ + @Override + public double getFittingParams(int i) { + return params[i]; + } + + /** {@inheritDoc} */ + @Override + public SystemInterface getSystem() { + return system; + } + + /** {@inheritDoc} */ + @Override + public int getNumberOfFittingParams() { + return params.length; + } + + /** {@inheritDoc} */ + @Override + public void setInitialGuess(double[] guess) { + System.out.println("start fitting " + guess.length + " parameter(s)..."); + params = new double[guess.length]; + System.arraycopy(guess, 0, params, 0, guess.length); + } + + /** {@inheritDoc} */ + @Override + public abstract double calcValue(double[] dependentValues); + + /** {@inheritDoc} */ + @Override + public double calcTrueValue(double val) { + return val; + } + + /** {@inheritDoc} */ + @Override + public abstract void setFittingParams(int i, double value); + + /** {@inheritDoc} */ + @Override + public void setDatabaseParameters() {} + + /** {@inheritDoc} */ + @Override + public double getLowerBound(int i) { + return this.bounds[i][0]; + } + + /** {@inheritDoc} */ + @Override + public double getUpperBound(int i) { + return this.bounds[i][1]; + } + + /** {@inheritDoc} */ + @Override + public double[][] getBounds() { + return this.bounds; + } + + /** {@inheritDoc} */ + @Override + public void setBounds(double[][] bounds) { + this.bounds = bounds; + } } diff --git a/src/main/java/neqsim/statistics/parameterFitting/SampleSet.java b/src/main/java/neqsim/statistics/parameterFitting/SampleSet.java index c32502eff..a7cc697fe 100644 --- a/src/main/java/neqsim/statistics/parameterFitting/SampleSet.java +++ b/src/main/java/neqsim/statistics/parameterFitting/SampleSet.java @@ -18,135 +18,133 @@ * @version $Id: $Id */ public class SampleSet implements Cloneable { - private ArrayList samples = new ArrayList(1); - - /** - *

- * Constructor for SampleSet. - *

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

- * Constructor for SampleSet. - *

- * - * @param samplesIn an array of {@link neqsim.statistics.parameterFitting.SampleValue} objects - */ - public SampleSet(SampleValue[] samplesIn) { - samples.addAll(Arrays.asList(samplesIn)); + private ArrayList samples = new ArrayList(1); + + /** + *

+ * Constructor for SampleSet. + *

+ */ + public SampleSet() {} + + /** + *

+ * Constructor for SampleSet. + *

+ * + * @param samplesIn an array of {@link neqsim.statistics.parameterFitting.SampleValue} objects + */ + public SampleSet(SampleValue[] samplesIn) { + samples.addAll(Arrays.asList(samplesIn)); + } + + /** + *

+ * Constructor for SampleSet. + *

+ * + * @param samplesIn a {@link java.util.ArrayList} object + */ + public SampleSet(ArrayList samplesIn) { + for (int i = 0; i < samplesIn.size(); i++) { + samples.add(samplesIn.get(i)); } - - /** - *

- * Constructor for SampleSet. - *

- * - * @param samplesIn a {@link java.util.ArrayList} object - */ - public SampleSet(ArrayList samplesIn) { - for (int i = 0; i < samplesIn.size(); i++) { - samples.add(samplesIn.get(i)); - } - } - - /** {@inheritDoc} */ - @Override - public SampleSet clone() { - SampleSet clonedSet = null; - try { - clonedSet = (SampleSet) super.clone(); - } catch (Exception e) { - e.printStackTrace(System.err); - } - - clonedSet.samples = new ArrayList(samples); - for (int i = 0; i < samples.size(); i++) { - clonedSet.samples.set(i, samples.get(i).clone()); - } - - return clonedSet; - } - - /** - *

- * add. - *

- * - * @param sampleIn a {@link neqsim.statistics.parameterFitting.SampleValue} object - */ - public void add(SampleValue sampleIn) { - samples.add(sampleIn); - } - - /** - *

- * addSampleSet. - *

- * - * @param sampleSet a {@link neqsim.statistics.parameterFitting.SampleSet} object - */ - public void addSampleSet(SampleSet sampleSet) { - for (int i = 0; i < sampleSet.getLength(); i++) { - samples.add(sampleSet.getSample(i)); - } + } + + /** {@inheritDoc} */ + @Override + public SampleSet clone() { + SampleSet clonedSet = null; + try { + clonedSet = (SampleSet) super.clone(); + } catch (Exception e) { + e.printStackTrace(System.err); } - /** - *

- * getSample. - *

- * - * @param i a int - * @return a {@link neqsim.statistics.parameterFitting.SampleValue} object - */ - public SampleValue getSample(int i) { - return this.samples.get(i); + clonedSet.samples = new ArrayList(samples); + for (int i = 0; i < samples.size(); i++) { + clonedSet.samples.set(i, samples.get(i).clone()); } - // public SampleValue[] getSamples() { - // SampleValue[] samplesOut = new SampleValue[samples.size()]; - // for(int i=0;i - * getLength. - *

- * - * @return a int - */ - public int getLength() { - return samples.size(); + return clonedSet; + } + + /** + *

+ * add. + *

+ * + * @param sampleIn a {@link neqsim.statistics.parameterFitting.SampleValue} object + */ + public void add(SampleValue sampleIn) { + samples.add(sampleIn); + } + + /** + *

+ * addSampleSet. + *

+ * + * @param sampleSet a {@link neqsim.statistics.parameterFitting.SampleSet} object + */ + public void addSampleSet(SampleSet sampleSet) { + for (int i = 0; i < sampleSet.getLength(); i++) { + samples.add(sampleSet.getSample(i)); } - - /** - *

- * createNewNormalDistributedSet. - *

- * - * @return a {@link neqsim.statistics.parameterFitting.SampleSet} object - */ - public SampleSet createNewNormalDistributedSet() { - SampleSet newSet = this.clone(); - - for (int i = 0; i < samples.size(); i++) { - for (int j = 0; j < newSet.getSample(i).getDependentValues().length; j++) { - System.out.println("old Var: " + newSet.getSample(i).getDependentValue(j)); - double newVar = cern.jet.random.Normal.staticNextDouble( - newSet.getSample(i).getDependentValue(j), - newSet.getSample(i).getStandardDeviation(j)); - newVar = cern.jet.random.Normal.staticNextDouble( - newSet.getSample(i).getDependentValue(j), - newSet.getSample(i).getStandardDeviation(j)); - newSet.getSample(i).setDependentValue(j, newVar); - System.out.println("new var: " + newVar); - } - } - return newSet; + } + + /** + *

+ * getSample. + *

+ * + * @param i a int + * @return a {@link neqsim.statistics.parameterFitting.SampleValue} object + */ + public SampleValue getSample(int i) { + return this.samples.get(i); + } + + // public SampleValue[] getSamples() { + // SampleValue[] samplesOut = new SampleValue[samples.size()]; + // for(int i=0;i + * getLength. + *

+ * + * @return a int + */ + public int getLength() { + return samples.size(); + } + + /** + *

+ * createNewNormalDistributedSet. + *

+ * + * @return a {@link neqsim.statistics.parameterFitting.SampleSet} object + */ + public SampleSet createNewNormalDistributedSet() { + SampleSet newSet = this.clone(); + + for (int i = 0; i < samples.size(); i++) { + for (int j = 0; j < newSet.getSample(i).getDependentValues().length; j++) { + System.out.println("old Var: " + newSet.getSample(i).getDependentValue(j)); + double newVar = cern.jet.random.Normal.staticNextDouble( + newSet.getSample(i).getDependentValue(j), newSet.getSample(i).getStandardDeviation(j)); + newVar = cern.jet.random.Normal.staticNextDouble(newSet.getSample(i).getDependentValue(j), + newSet.getSample(i).getStandardDeviation(j)); + newSet.getSample(i).setDependentValue(j, newVar); + System.out.println("new var: " + newVar); + } } + return newSet; + } } diff --git a/src/main/java/neqsim/statistics/parameterFitting/nonLinearParameterFitting/LevenbergMarquardt.java b/src/main/java/neqsim/statistics/parameterFitting/nonLinearParameterFitting/LevenbergMarquardt.java index 653fa4e57..6f83f195f 100644 --- a/src/main/java/neqsim/statistics/parameterFitting/nonLinearParameterFitting/LevenbergMarquardt.java +++ b/src/main/java/neqsim/statistics/parameterFitting/nonLinearParameterFitting/LevenbergMarquardt.java @@ -18,143 +18,143 @@ * @version $Id: $Id */ public class LevenbergMarquardt extends StatisticsBaseClass { - double oldChiSquare = 1e100; - double newChiSquare = 0; - Matrix parameterStdDevMatrix; - Matrix parameterUncertaintyMatrix; - Thread thisThread; - boolean solved = false; - private int maxNumberOfIterations = 50; + double oldChiSquare = 1e100; + double newChiSquare = 0; + Matrix parameterStdDevMatrix; + Matrix parameterUncertaintyMatrix; + Thread thisThread; + boolean solved = false; + private int maxNumberOfIterations = 50; - /** - *

- * Constructor for LevenbergMarquardt. - *

- */ - public LevenbergMarquardt() { - thisThread = new Thread(); - } - - /** {@inheritDoc} */ - @Override - public LevenbergMarquardt clone() { - LevenbergMarquardt clonedClass = null; - try { - clonedClass = (LevenbergMarquardt) super.clone(); - } catch (Exception e) { - e.printStackTrace(System.err); - } + /** + *

+ * Constructor for LevenbergMarquardt. + *

+ */ + public LevenbergMarquardt() { + thisThread = new Thread(); + } - return clonedClass; + /** {@inheritDoc} */ + @Override + public LevenbergMarquardt clone() { + LevenbergMarquardt clonedClass = null; + try { + clonedClass = (LevenbergMarquardt) super.clone(); + } catch (Exception e) { + e.printStackTrace(System.err); } - /** {@inheritDoc} */ - @Override - public void init() { - chiSquare = calcChiSquare(); - System.out.println("Chi square: " + chiSquare); - dyda = calcDerivatives(); - beta = calcBetaMatrix(); - alpha = calcAlphaMatrix(); - } + return clonedClass; + } - /** {@inheritDoc} */ - @Override - public void solve() { - setFittingParameters(sampleSet.getSample(0).getFunction().getFittingParams()); - Matrix betaMatrix; - Matrix newParameters; - int n = 0; - init(); - do { - n++; - if (chiSquare < oldChiSquare) { - oldChiSquare = chiSquare; - } - betaMatrix = new Matrix(beta, 1).transpose(); - Matrix alphaMatrix = new Matrix(alpha); - betaMatrix.print(10, 3); - alphaMatrix.print(10, 3); - Matrix solvedMatrix = alphaMatrix.solve(betaMatrix); + /** {@inheritDoc} */ + @Override + public void init() { + chiSquare = calcChiSquare(); + System.out.println("Chi square: " + chiSquare); + dyda = calcDerivatives(); + beta = calcBetaMatrix(); + alpha = calcAlphaMatrix(); + } - Matrix oldParameters = - new Matrix(sampleSet.getSample(0).getFunction().getFittingParams(), 1).copy(); - newParameters = oldParameters.copy().plus(solvedMatrix.transpose()); - // Matrix diffMat = newParameters.copy().minus(oldParameters); - this.checkBounds(newParameters); - this.setFittingParameters(newParameters.copy().getArray()[0]); - newChiSquare = calcChiSquare(); - if (newChiSquare >= oldChiSquare || Double.isNaN(newChiSquare)) { - newChiSquare = oldChiSquare; - multiFactor *= 10.0; - System.out.println("keeping old values"); - this.setFittingParameters(oldParameters.getArray()[0]); - } else { - multiFactor /= 10.0; - System.out.println("Chi square ok : "); - } - System.out.println("Chi after : " + newChiSquare); - System.out.println("iterations: " + n); - calcAbsDev(); - try { - Thread.sleep(50); - } catch (Exception e) { - } - System.out.println("Parameters:"); - newParameters.print(100, 100); - init(); - } while (((Math.abs(newChiSquare) > 1e-6) && n < maxNumberOfIterations - && Math.abs(betaMatrix.norm2()) > 1.0e-6) || n < 5); - solved = true; + /** {@inheritDoc} */ + @Override + public void solve() { + setFittingParameters(sampleSet.getSample(0).getFunction().getFittingParams()); + Matrix betaMatrix; + Matrix newParameters; + int n = 0; + init(); + do { + n++; + if (chiSquare < oldChiSquare) { + oldChiSquare = chiSquare; + } + betaMatrix = new Matrix(beta, 1).transpose(); + Matrix alphaMatrix = new Matrix(alpha); + betaMatrix.print(10, 3); + alphaMatrix.print(10, 3); + Matrix solvedMatrix = alphaMatrix.solve(betaMatrix); - System.out.println("iterations: " + n); - System.out.println("Chi square: " + chiSquare); - System.out.println("Parameters:"); - newParameters.print(10, 10); - } + Matrix oldParameters = + new Matrix(sampleSet.getSample(0).getFunction().getFittingParams(), 1).copy(); + newParameters = oldParameters.copy().plus(solvedMatrix.transpose()); + // Matrix diffMat = newParameters.copy().minus(oldParameters); + this.checkBounds(newParameters); + this.setFittingParameters(newParameters.copy().getArray()[0]); + newChiSquare = calcChiSquare(); + if (newChiSquare >= oldChiSquare || Double.isNaN(newChiSquare)) { + newChiSquare = oldChiSquare; + multiFactor *= 10.0; + System.out.println("keeping old values"); + this.setFittingParameters(oldParameters.getArray()[0]); + } else { + multiFactor /= 10.0; + System.out.println("Chi square ok : "); + } + System.out.println("Chi after : " + newChiSquare); + System.out.println("iterations: " + n); + calcAbsDev(); + try { + Thread.sleep(50); + } catch (Exception e) { + } + System.out.println("Parameters:"); + newParameters.print(100, 100); + init(); + } while (((Math.abs(newChiSquare) > 1e-6) && n < maxNumberOfIterations + && Math.abs(betaMatrix.norm2()) > 1.0e-6) || n < 5); + solved = true; - /** - *

- * main. - *

- * - * @param args an array of {@link java.lang.String} objects - */ - public static void main(String[] args) { - /* - * LevenbergMarquardt optim = new LevenbergMarquardt(); TestFunction testFunction = new - * TestFunction(); // optim.setFunction(testFunction); - * - * SampleValue[] sample = new SampleValue[3]; double sample1[] = { 6 }; sample[0] = new - * SampleValue(8.5,0.1,sample1); double sample2[] = { 4 }; sample[1] = new - * SampleValue(5.5,0.1,sample2); double sample3[] = { 4 }; sample[2] = new - * SampleValue(5.51,0.1,sample3); - * - * SampleSet sampleSet = new SampleSet(sample); sampleSet = - * sampleSet.createNewNormalDistributedSet(); optim.setSampleSet(sampleSet); optim.solve(); - * optim.runMonteCarloSimulation(); - */ - } + System.out.println("iterations: " + n); + System.out.println("Chi square: " + chiSquare); + System.out.println("Parameters:"); + newParameters.print(10, 10); + } - /** - *

- * Getter for the field maxNumberOfIterations. - *

- * - * @return the maxNumberOfIterations + /** + *

+ * main. + *

+ * + * @param args an array of {@link java.lang.String} objects + */ + public static void main(String[] args) { + /* + * LevenbergMarquardt optim = new LevenbergMarquardt(); TestFunction testFunction = new + * TestFunction(); // optim.setFunction(testFunction); + * + * SampleValue[] sample = new SampleValue[3]; double sample1[] = { 6 }; sample[0] = new + * SampleValue(8.5,0.1,sample1); double sample2[] = { 4 }; sample[1] = new + * SampleValue(5.5,0.1,sample2); double sample3[] = { 4 }; sample[2] = new + * SampleValue(5.51,0.1,sample3); + * + * SampleSet sampleSet = new SampleSet(sample); sampleSet = + * sampleSet.createNewNormalDistributedSet(); optim.setSampleSet(sampleSet); optim.solve(); + * optim.runMonteCarloSimulation(); */ - public int getMaxNumberOfIterations() { - return maxNumberOfIterations; - } + } - /** - *

- * Setter for the field maxNumberOfIterations. - *

- * - * @param maxNumberOfIterations the maxNumberOfIterations to set - */ - public void setMaxNumberOfIterations(int maxNumberOfIterations) { - this.maxNumberOfIterations = maxNumberOfIterations; - } + /** + *

+ * Getter for the field maxNumberOfIterations. + *

+ * + * @return the maxNumberOfIterations + */ + public int getMaxNumberOfIterations() { + return maxNumberOfIterations; + } + + /** + *

+ * Setter for the field maxNumberOfIterations. + *

+ * + * @param maxNumberOfIterations the maxNumberOfIterations to set + */ + public void setMaxNumberOfIterations(int maxNumberOfIterations) { + this.maxNumberOfIterations = maxNumberOfIterations; + } } diff --git a/src/main/java/neqsim/statistics/parameterFitting/nonLinearParameterFitting/LevenbergMarquardtAbsDev.java b/src/main/java/neqsim/statistics/parameterFitting/nonLinearParameterFitting/LevenbergMarquardtAbsDev.java index 98191a4e2..ba1b1a11d 100644 --- a/src/main/java/neqsim/statistics/parameterFitting/nonLinearParameterFitting/LevenbergMarquardtAbsDev.java +++ b/src/main/java/neqsim/statistics/parameterFitting/nonLinearParameterFitting/LevenbergMarquardtAbsDev.java @@ -15,77 +15,76 @@ * @version $Id: $Id */ public class LevenbergMarquardtAbsDev extends LevenbergMarquardt { - /** - *

- * Constructor for LevenbergMarquardtAbsDev. - *

- */ - public LevenbergMarquardtAbsDev() { - super(); + /** + *

+ * Constructor for LevenbergMarquardtAbsDev. + *

+ */ + public LevenbergMarquardtAbsDev() { + super(); + } + + /** {@inheritDoc} */ + @Override + public LevenbergMarquardtAbsDev clone() { + LevenbergMarquardtAbsDev clonedClass = null; + try { + clonedClass = (LevenbergMarquardtAbsDev) super.clone(); + } catch (Exception e) { + e.printStackTrace(System.err); } - /** {@inheritDoc} */ - @Override - public LevenbergMarquardtAbsDev clone() { - LevenbergMarquardtAbsDev clonedClass = null; - try { - clonedClass = (LevenbergMarquardtAbsDev) super.clone(); - } catch (Exception e) { - e.printStackTrace(System.err); - } + return clonedClass; + } - return clonedClass; + /** {@inheritDoc} */ + @Override + public double calcChiSquare() { + double chiSquare = 0; + for (int i = 0; i < sampleSet.getLength(); i++) { + chiSquare += Math + .abs((sampleSet.getSample(i).getSampleValue() - this.calcValue(sampleSet.getSample(i)))) + / sampleSet.getSample(i).getStandardDeviation(); } + return chiSquare; + } - /** {@inheritDoc} */ - @Override - public double calcChiSquare() { - double chiSquare = 0; - for (int i = 0; i < sampleSet.getLength(); i++) { - chiSquare += Math - .abs((sampleSet.getSample(i).getSampleValue() - - this.calcValue(sampleSet.getSample(i)))) - / sampleSet.getSample(i).getStandardDeviation(); + /** {@inheritDoc} */ + @Override + public double[][] calcAlphaMatrix() { + double[][] alpha = new double[sampleSet.getSample(0).getFunction() + .getFittingParams().length][sampleSet.getSample(0).getFunction().getFittingParams().length]; + for (int i = 0; i < alpha.length; i++) { + for (int j = 0; j < alpha[0].length; j++) { + alpha[i][j] = 0.0; + for (int k = 0; k < sampleSet.getLength(); k++) { + alpha[i][j] += (dyda[k][i] * dyda[k][j]) / sampleSet.getSample(k).getStandardDeviation(); } - return chiSquare; - } - - /** {@inheritDoc} */ - @Override - public double[][] calcAlphaMatrix() { - double[][] alpha = - new double[sampleSet.getSample(0).getFunction().getFittingParams().length][sampleSet - .getSample(0).getFunction().getFittingParams().length]; - for (int i = 0; i < alpha.length; i++) { - for (int j = 0; j < alpha[0].length; j++) { - alpha[i][j] = 0.0; - for (int k = 0; k < sampleSet.getLength(); k++) { - alpha[i][j] += (dyda[k][i] * dyda[k][j]) - / sampleSet.getSample(k).getStandardDeviation(); - } - if (i == j) { - alpha[i][j] *= (1.0 + multiFactor); - } - } + if (i == j) { + alpha[i][j] *= (1.0 + multiFactor); } - return alpha; + } } + return alpha; + } - /** {@inheritDoc} */ - @Override - public double[] calcBetaMatrix() { - double[] beta = new double[sampleSet.getSample(0).getFunction().getFittingParams().length]; - for (int i = 0; i < beta.length; i++) { - beta[i] = 0.0; - for (int j = 0; j < sampleSet.getLength(); j++) { - int k = (sampleSet.getSample(i).getSampleValue() - - this.calcValue(sampleSet.getSample(i))) > 0 ? 1 : -1; - beta[i] += k - * Math.abs((sampleSet.getSample(j).getSampleValue() - - calcValue(sampleSet.getSample(j)))) - / sampleSet.getSample(j).getStandardDeviation() * dyda[j][i]; - } - } - return beta; + /** {@inheritDoc} */ + @Override + public double[] calcBetaMatrix() { + double[] beta = new double[sampleSet.getSample(0).getFunction().getFittingParams().length]; + for (int i = 0; i < beta.length; i++) { + beta[i] = 0.0; + for (int j = 0; j < sampleSet.getLength(); j++) { + int k = + (sampleSet.getSample(i).getSampleValue() - this.calcValue(sampleSet.getSample(i))) > 0 + ? 1 + : -1; + beta[i] += k + * Math + .abs((sampleSet.getSample(j).getSampleValue() - calcValue(sampleSet.getSample(j)))) + / sampleSet.getSample(j).getStandardDeviation() * dyda[j][i]; + } } + return beta; + } } diff --git a/src/main/java/neqsim/statistics/parameterFitting/nonLinearParameterFitting/LevenbergMarquardtBiasDev.java b/src/main/java/neqsim/statistics/parameterFitting/nonLinearParameterFitting/LevenbergMarquardtBiasDev.java index 6afe43354..bd6fa62c8 100644 --- a/src/main/java/neqsim/statistics/parameterFitting/nonLinearParameterFitting/LevenbergMarquardtBiasDev.java +++ b/src/main/java/neqsim/statistics/parameterFitting/nonLinearParameterFitting/LevenbergMarquardtBiasDev.java @@ -15,73 +15,70 @@ * @version $Id: $Id */ public class LevenbergMarquardtBiasDev extends LevenbergMarquardt { - /** - *

- * Constructor for LevenbergMarquardtBiasDev. - *

- */ - public LevenbergMarquardtBiasDev() { - super(); + /** + *

+ * Constructor for LevenbergMarquardtBiasDev. + *

+ */ + public LevenbergMarquardtBiasDev() { + super(); + } + + /** {@inheritDoc} */ + @Override + public LevenbergMarquardtBiasDev clone() { + LevenbergMarquardtBiasDev clonedClass = null; + try { + clonedClass = (LevenbergMarquardtBiasDev) super.clone(); + } catch (Exception e) { + e.printStackTrace(System.err); } - /** {@inheritDoc} */ - @Override - public LevenbergMarquardtBiasDev clone() { - LevenbergMarquardtBiasDev clonedClass = null; - try { - clonedClass = (LevenbergMarquardtBiasDev) super.clone(); - } catch (Exception e) { - e.printStackTrace(System.err); - } + return clonedClass; + } - return clonedClass; + /** {@inheritDoc} */ + @Override + public double calcChiSquare() { + double chiSquare = 0; + for (int i = 0; i < sampleSet.getLength(); i++) { + chiSquare += + (sampleSet.getSample(i).getSampleValue() - this.calcValue(sampleSet.getSample(i))) + / sampleSet.getSample(i).getStandardDeviation(); } + return chiSquare; + } - /** {@inheritDoc} */ - @Override - public double calcChiSquare() { - double chiSquare = 0; - for (int i = 0; i < sampleSet.getLength(); i++) { - chiSquare += (sampleSet.getSample(i).getSampleValue() - - this.calcValue(sampleSet.getSample(i))) - / sampleSet.getSample(i).getStandardDeviation(); + /** {@inheritDoc} */ + @Override + public double[][] calcAlphaMatrix() { + double[][] alpha = new double[sampleSet.getSample(0).getFunction() + .getFittingParams().length][sampleSet.getSample(0).getFunction().getFittingParams().length]; + for (int i = 0; i < alpha.length; i++) { + for (int j = 0; j < alpha[0].length; j++) { + alpha[i][j] = 0.0; + for (int k = 0; k < sampleSet.getLength(); k++) { + alpha[i][j] += (dyda[k][i] * dyda[k][j]) / sampleSet.getSample(k).getStandardDeviation(); } - return chiSquare; - } - - /** {@inheritDoc} */ - @Override - public double[][] calcAlphaMatrix() { - double[][] alpha = - new double[sampleSet.getSample(0).getFunction().getFittingParams().length][sampleSet - .getSample(0).getFunction().getFittingParams().length]; - for (int i = 0; i < alpha.length; i++) { - for (int j = 0; j < alpha[0].length; j++) { - alpha[i][j] = 0.0; - for (int k = 0; k < sampleSet.getLength(); k++) { - alpha[i][j] += (dyda[k][i] * dyda[k][j]) - / sampleSet.getSample(k).getStandardDeviation(); - } - if (i == j) { - alpha[i][j] *= (1.0 + multiFactor); - } - } + if (i == j) { + alpha[i][j] *= (1.0 + multiFactor); } - return alpha; + } } + return alpha; + } - /** {@inheritDoc} */ - @Override - public double[] calcBetaMatrix() { - double[] beta = new double[sampleSet.getSample(0).getFunction().getFittingParams().length]; - for (int i = 0; i < beta.length; i++) { - beta[i] = 0.0; - for (int j = 0; j < sampleSet.getLength(); j++) { - beta[i] += (sampleSet.getSample(j).getSampleValue() - - calcValue(sampleSet.getSample(j))) - / sampleSet.getSample(j).getStandardDeviation() * dyda[j][i]; - } - } - return beta; + /** {@inheritDoc} */ + @Override + public double[] calcBetaMatrix() { + double[] beta = new double[sampleSet.getSample(0).getFunction().getFittingParams().length]; + for (int i = 0; i < beta.length; i++) { + beta[i] = 0.0; + for (int j = 0; j < sampleSet.getLength(); j++) { + beta[i] += (sampleSet.getSample(j).getSampleValue() - calcValue(sampleSet.getSample(j))) + / sampleSet.getSample(j).getStandardDeviation() * dyda[j][i]; + } } + return beta; + } } From f07f81309549af9d549a899e64cde6faef1e5ebf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=85smund=20V=C3=A5ge=20Fannemel?= <34712686+asmfstatoil@users.noreply.github.com> Date: Sun, 24 Jul 2022 15:14:19 +0200 Subject: [PATCH 2/2] stuff --- .../fluidMechanics/flowNode/FlowNode.java | 4 +- .../heatMassTransferCalc/FluidBoundary.java | 4 +- .../NonEquilibriumFluidBoundary.java | 4 +- .../KrishnaStandartFilmModel.java | 4 +- .../ReactiveFluidBoundary.java | 4 +- .../multiPhaseNode/MultiPhaseFlowNode.java | 4 +- .../waxNode/WaxDepositionFlowNode.java | 4 +- .../onePhaseNode/onePhaseFlowNode.java | 4 +- .../onePhasePipeFlowNode.java | 4 +- .../twoPhaseNode/TwoPhaseFlowNode.java | 4 +- .../twoPhasePipeFlowNode/AnnularFlow.java | 4 +- .../twoPhasePipeFlowNode/BubbleFlowNode.java | 4 +- .../twoPhasePipeFlowNode/DropletFlowNode.java | 4 +- .../StratifiedFlowNode.java | 4 +- .../TwoPhasePackedBedFlowNode.java | 4 +- .../TwoPhaseTrayTowerFlowNode.java | 4 +- .../StirredCellNode.java | 4 +- .../OnePhaseFixedStaggeredGrid.java | 4 +- .../OnePhasePipeFlowSolver.java | 4 +- .../stirredCellSolver/StirredCellSolver.java | 4 +- .../TwoPhaseFixedStaggeredGridSolver.java | 4 +- .../TwoPhasePipeFlowSolver.java | 4 +- .../GeometryDefinition.java | 5 +- .../internalGeometry/packings/Packing.java | 8 +- .../geometryDefinitions/pipe/PipeData.java | 4 +- .../reactor/ReactorData.java | 4 +- .../stirredCell/StirredCell.java | 4 +- .../PipeFlowVisualization.java | 4 +- .../TwoPhasePipeFlowVisualization.java | 2 +- .../masstransfer/MassTransferFunction.java | 56 +++++------ .../masstransfer/TestMassTransfer.java | 96 +++++++++---------- 31 files changed, 135 insertions(+), 136 deletions(-) diff --git a/src/main/java/neqsim/fluidMechanics/flowNode/FlowNode.java b/src/main/java/neqsim/fluidMechanics/flowNode/FlowNode.java index 4dab9569e..1e476d47e 100644 --- a/src/main/java/neqsim/fluidMechanics/flowNode/FlowNode.java +++ b/src/main/java/neqsim/fluidMechanics/flowNode/FlowNode.java @@ -227,8 +227,8 @@ public FlowNode clone() { FlowNode clonedSystem = null; try { clonedSystem = (FlowNode) super.clone(); - } catch (Exception e) { - e.printStackTrace(System.err); + } catch (Exception ex) { + ex.printStackTrace(); } clonedSystem.bulkSystem = bulkSystem.clone(); diff --git a/src/main/java/neqsim/fluidMechanics/flowNode/fluidBoundary/heatMassTransferCalc/FluidBoundary.java b/src/main/java/neqsim/fluidMechanics/flowNode/fluidBoundary/heatMassTransferCalc/FluidBoundary.java index e28790557..4825163ac 100644 --- a/src/main/java/neqsim/fluidMechanics/flowNode/fluidBoundary/heatMassTransferCalc/FluidBoundary.java +++ b/src/main/java/neqsim/fluidMechanics/flowNode/fluidBoundary/heatMassTransferCalc/FluidBoundary.java @@ -143,8 +143,8 @@ public FluidBoundary clone() { try { clonedSystem = (FluidBoundary) super.clone(); - } catch (Exception e) { - e.printStackTrace(System.err); + } catch (Exception ex) { + ex.printStackTrace(); } clonedSystem.interphaseSystem = interphaseSystem.clone(); diff --git a/src/main/java/neqsim/fluidMechanics/flowNode/fluidBoundary/heatMassTransferCalc/nonEquilibriumFluidBoundary/NonEquilibriumFluidBoundary.java b/src/main/java/neqsim/fluidMechanics/flowNode/fluidBoundary/heatMassTransferCalc/nonEquilibriumFluidBoundary/NonEquilibriumFluidBoundary.java index a55656ffe..9e1db0eec 100644 --- a/src/main/java/neqsim/fluidMechanics/flowNode/fluidBoundary/heatMassTransferCalc/nonEquilibriumFluidBoundary/NonEquilibriumFluidBoundary.java +++ b/src/main/java/neqsim/fluidMechanics/flowNode/fluidBoundary/heatMassTransferCalc/nonEquilibriumFluidBoundary/NonEquilibriumFluidBoundary.java @@ -104,8 +104,8 @@ public NonEquilibriumFluidBoundary clone() { try { clonedSystem = (NonEquilibriumFluidBoundary) super.clone(); - } catch (Exception e) { - e.printStackTrace(System.err); + } catch (Exception ex) { + ex.printStackTrace(); } return clonedSystem; diff --git a/src/main/java/neqsim/fluidMechanics/flowNode/fluidBoundary/heatMassTransferCalc/nonEquilibriumFluidBoundary/filmModelBoundary/KrishnaStandartFilmModel.java b/src/main/java/neqsim/fluidMechanics/flowNode/fluidBoundary/heatMassTransferCalc/nonEquilibriumFluidBoundary/filmModelBoundary/KrishnaStandartFilmModel.java index 1ffe45837..b9a562bde 100644 --- a/src/main/java/neqsim/fluidMechanics/flowNode/fluidBoundary/heatMassTransferCalc/nonEquilibriumFluidBoundary/filmModelBoundary/KrishnaStandartFilmModel.java +++ b/src/main/java/neqsim/fluidMechanics/flowNode/fluidBoundary/heatMassTransferCalc/nonEquilibriumFluidBoundary/filmModelBoundary/KrishnaStandartFilmModel.java @@ -82,8 +82,8 @@ public KrishnaStandartFilmModel clone() { try { clonedSystem = (KrishnaStandartFilmModel) super.clone(); - } catch (Exception e) { - e.printStackTrace(System.err); + } catch (Exception ex) { + ex.printStackTrace(); } return clonedSystem; diff --git a/src/main/java/neqsim/fluidMechanics/flowNode/fluidBoundary/heatMassTransferCalc/nonEquilibriumFluidBoundary/filmModelBoundary/reactiveFilmModel/ReactiveFluidBoundary.java b/src/main/java/neqsim/fluidMechanics/flowNode/fluidBoundary/heatMassTransferCalc/nonEquilibriumFluidBoundary/filmModelBoundary/reactiveFilmModel/ReactiveFluidBoundary.java index 868dbd5f3..fa2eb461a 100644 --- a/src/main/java/neqsim/fluidMechanics/flowNode/fluidBoundary/heatMassTransferCalc/nonEquilibriumFluidBoundary/filmModelBoundary/reactiveFilmModel/ReactiveFluidBoundary.java +++ b/src/main/java/neqsim/fluidMechanics/flowNode/fluidBoundary/heatMassTransferCalc/nonEquilibriumFluidBoundary/filmModelBoundary/reactiveFilmModel/ReactiveFluidBoundary.java @@ -91,8 +91,8 @@ public ReactiveFluidBoundary clone() { try { clonedSystem = (ReactiveFluidBoundary) super.clone(); - } catch (Exception e) { - e.printStackTrace(System.err); + } catch (Exception ex) { + ex.printStackTrace(); } return clonedSystem; diff --git a/src/main/java/neqsim/fluidMechanics/flowNode/multiPhaseNode/MultiPhaseFlowNode.java b/src/main/java/neqsim/fluidMechanics/flowNode/multiPhaseNode/MultiPhaseFlowNode.java index 56a8f9e16..f961351c4 100644 --- a/src/main/java/neqsim/fluidMechanics/flowNode/multiPhaseNode/MultiPhaseFlowNode.java +++ b/src/main/java/neqsim/fluidMechanics/flowNode/multiPhaseNode/MultiPhaseFlowNode.java @@ -45,8 +45,8 @@ public TwoPhaseFlowNode clone() { TwoPhaseFlowNode clonedSystem = null; try { clonedSystem = (TwoPhaseFlowNode) super.clone(); - } catch (Exception e) { - e.printStackTrace(System.err); + } catch (Exception ex) { + ex.printStackTrace(); } return clonedSystem; 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 ed6e8942e..cfbeb3850 100644 --- a/src/main/java/neqsim/fluidMechanics/flowNode/multiPhaseNode/waxNode/WaxDepositionFlowNode.java +++ b/src/main/java/neqsim/fluidMechanics/flowNode/multiPhaseNode/waxNode/WaxDepositionFlowNode.java @@ -74,8 +74,8 @@ public StratifiedFlowNode clone() { StratifiedFlowNode clonedSystem = null; try { clonedSystem = (StratifiedFlowNode) super.clone(); - } catch (Exception e) { - e.printStackTrace(System.err); + } catch (Exception ex) { + ex.printStackTrace(); } return clonedSystem; diff --git a/src/main/java/neqsim/fluidMechanics/flowNode/onePhaseNode/onePhaseFlowNode.java b/src/main/java/neqsim/fluidMechanics/flowNode/onePhaseNode/onePhaseFlowNode.java index 644a37cab..27e02b15d 100644 --- a/src/main/java/neqsim/fluidMechanics/flowNode/onePhaseNode/onePhaseFlowNode.java +++ b/src/main/java/neqsim/fluidMechanics/flowNode/onePhaseNode/onePhaseFlowNode.java @@ -50,8 +50,8 @@ public onePhaseFlowNode clone() { onePhaseFlowNode clonedSystem = null; try { clonedSystem = (onePhaseFlowNode) super.clone(); - } catch (Exception e) { - e.printStackTrace(System.err); + } catch (Exception ex) { + ex.printStackTrace(); } return clonedSystem; diff --git a/src/main/java/neqsim/fluidMechanics/flowNode/onePhaseNode/onePhasePipeFlowNode/onePhasePipeFlowNode.java b/src/main/java/neqsim/fluidMechanics/flowNode/onePhaseNode/onePhasePipeFlowNode/onePhasePipeFlowNode.java index 9734f37e3..45fbeb0cf 100644 --- a/src/main/java/neqsim/fluidMechanics/flowNode/onePhaseNode/onePhasePipeFlowNode/onePhasePipeFlowNode.java +++ b/src/main/java/neqsim/fluidMechanics/flowNode/onePhaseNode/onePhasePipeFlowNode/onePhasePipeFlowNode.java @@ -50,8 +50,8 @@ public onePhasePipeFlowNode clone() { onePhasePipeFlowNode clonedSystem = null; try { clonedSystem = (onePhasePipeFlowNode) super.clone(); - } catch (Exception e) { - e.printStackTrace(System.err); + } catch (Exception ex) { + ex.printStackTrace(); } return clonedSystem; } diff --git a/src/main/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/TwoPhaseFlowNode.java b/src/main/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/TwoPhaseFlowNode.java index 0b49722ef..097c35c9a 100644 --- a/src/main/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/TwoPhaseFlowNode.java +++ b/src/main/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/TwoPhaseFlowNode.java @@ -55,8 +55,8 @@ public TwoPhaseFlowNode clone() { TwoPhaseFlowNode clonedSystem = null; try { clonedSystem = (TwoPhaseFlowNode) super.clone(); - } catch (Exception e) { - e.printStackTrace(System.err); + } catch (Exception ex) { + ex.printStackTrace(); } // clonedSystem.molarMassTransferFlux = (double[]) diff --git a/src/main/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhasePipeFlowNode/AnnularFlow.java b/src/main/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhasePipeFlowNode/AnnularFlow.java index 877c4b87b..854743585 100644 --- a/src/main/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhasePipeFlowNode/AnnularFlow.java +++ b/src/main/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhasePipeFlowNode/AnnularFlow.java @@ -78,8 +78,8 @@ public AnnularFlow clone() { AnnularFlow clonedSystem = null; try { clonedSystem = (AnnularFlow) super.clone(); - } catch (Exception e) { - e.printStackTrace(System.err); + } catch (Exception ex) { + ex.printStackTrace(); } return clonedSystem; } diff --git a/src/main/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhasePipeFlowNode/BubbleFlowNode.java b/src/main/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhasePipeFlowNode/BubbleFlowNode.java index 48acc46c1..a654e4a4b 100644 --- a/src/main/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhasePipeFlowNode/BubbleFlowNode.java +++ b/src/main/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhasePipeFlowNode/BubbleFlowNode.java @@ -92,8 +92,8 @@ public BubbleFlowNode clone() { BubbleFlowNode clonedSystem = null; try { clonedSystem = (BubbleFlowNode) super.clone(); - } catch (Exception e) { - e.printStackTrace(System.err); + } catch (Exception ex) { + ex.printStackTrace(); } return clonedSystem; 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 270a55785..54e621bd1 100644 --- a/src/main/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhasePipeFlowNode/DropletFlowNode.java +++ b/src/main/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhasePipeFlowNode/DropletFlowNode.java @@ -93,8 +93,8 @@ public DropletFlowNode clone() { DropletFlowNode clonedSystem = null; try { clonedSystem = (DropletFlowNode) super.clone(); - } catch (Exception e) { - e.printStackTrace(System.err); + } catch (Exception ex) { + ex.printStackTrace(); } return clonedSystem; diff --git a/src/main/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhasePipeFlowNode/StratifiedFlowNode.java b/src/main/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhasePipeFlowNode/StratifiedFlowNode.java index 75ef5bb33..28042f22b 100644 --- a/src/main/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhasePipeFlowNode/StratifiedFlowNode.java +++ b/src/main/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhasePipeFlowNode/StratifiedFlowNode.java @@ -72,8 +72,8 @@ public StratifiedFlowNode clone() { StratifiedFlowNode clonedSystem = null; try { clonedSystem = (StratifiedFlowNode) super.clone(); - } catch (Exception e) { - e.printStackTrace(System.err); + } catch (Exception ex) { + ex.printStackTrace(); } return clonedSystem; diff --git a/src/main/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhaseReactorFlowNode/TwoPhasePackedBedFlowNode.java b/src/main/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhaseReactorFlowNode/TwoPhasePackedBedFlowNode.java index 0be0d035c..b9781e7c5 100644 --- a/src/main/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhaseReactorFlowNode/TwoPhasePackedBedFlowNode.java +++ b/src/main/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhaseReactorFlowNode/TwoPhasePackedBedFlowNode.java @@ -73,8 +73,8 @@ public TwoPhasePackedBedFlowNode clone() { TwoPhasePackedBedFlowNode clonedSystem = null; try { clonedSystem = (TwoPhasePackedBedFlowNode) super.clone(); - } catch (Exception e) { - e.printStackTrace(System.err); + } catch (Exception ex) { + ex.printStackTrace(); } return clonedSystem; 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 401c4a699..d5d372794 100644 --- a/src/main/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhaseReactorFlowNode/TwoPhaseTrayTowerFlowNode.java +++ b/src/main/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhaseReactorFlowNode/TwoPhaseTrayTowerFlowNode.java @@ -73,8 +73,8 @@ public TwoPhaseTrayTowerFlowNode clone() { TwoPhaseTrayTowerFlowNode clonedSystem = null; try { clonedSystem = (TwoPhaseTrayTowerFlowNode) super.clone(); - } catch (Exception e) { - e.printStackTrace(System.err); + } catch (Exception ex) { + ex.printStackTrace(); } return clonedSystem; 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 2606304c3..0853fa277 100644 --- a/src/main/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhaseStirredCellNode/StirredCellNode.java +++ b/src/main/java/neqsim/fluidMechanics/flowNode/twoPhaseNode/twoPhaseStirredCellNode/StirredCellNode.java @@ -97,8 +97,8 @@ public StirredCellNode clone() { StirredCellNode clonedSystem = null; try { clonedSystem = (StirredCellNode) super.clone(); - } catch (Exception e) { - e.printStackTrace(System.err); + } catch (Exception ex) { + ex.printStackTrace(); } return clonedSystem; 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 b831a380b..3f53f74db 100644 --- a/src/main/java/neqsim/fluidMechanics/flowSolver/onePhaseFlowSolver/onePhasePipeFlowSolver/OnePhaseFixedStaggeredGrid.java +++ b/src/main/java/neqsim/fluidMechanics/flowSolver/onePhaseFlowSolver/onePhasePipeFlowSolver/OnePhaseFixedStaggeredGrid.java @@ -78,8 +78,8 @@ public OnePhaseFixedStaggeredGrid clone() { OnePhaseFixedStaggeredGrid clonedSystem = null; try { clonedSystem = (OnePhaseFixedStaggeredGrid) super.clone(); - } catch (Exception e) { - e.printStackTrace(System.err); + } catch (Exception ex) { + ex.printStackTrace(); } return clonedSystem; diff --git a/src/main/java/neqsim/fluidMechanics/flowSolver/onePhaseFlowSolver/onePhasePipeFlowSolver/OnePhasePipeFlowSolver.java b/src/main/java/neqsim/fluidMechanics/flowSolver/onePhaseFlowSolver/onePhasePipeFlowSolver/OnePhasePipeFlowSolver.java index e89f38318..44d4dafaf 100644 --- a/src/main/java/neqsim/fluidMechanics/flowSolver/onePhaseFlowSolver/onePhasePipeFlowSolver/OnePhasePipeFlowSolver.java +++ b/src/main/java/neqsim/fluidMechanics/flowSolver/onePhaseFlowSolver/onePhasePipeFlowSolver/OnePhasePipeFlowSolver.java @@ -76,8 +76,8 @@ public OnePhasePipeFlowSolver clone() { OnePhasePipeFlowSolver clonedSystem = null; try { clonedSystem = (OnePhasePipeFlowSolver) super.clone(); - } catch (Exception e) { - e.printStackTrace(System.err); + } catch (Exception ex) { + ex.printStackTrace(); } return clonedSystem; diff --git a/src/main/java/neqsim/fluidMechanics/flowSolver/twoPhaseFlowSolver/stirredCellSolver/StirredCellSolver.java b/src/main/java/neqsim/fluidMechanics/flowSolver/twoPhaseFlowSolver/stirredCellSolver/StirredCellSolver.java index 6dec43139..c1c6891cd 100644 --- a/src/main/java/neqsim/fluidMechanics/flowSolver/twoPhaseFlowSolver/stirredCellSolver/StirredCellSolver.java +++ b/src/main/java/neqsim/fluidMechanics/flowSolver/twoPhaseFlowSolver/stirredCellSolver/StirredCellSolver.java @@ -85,8 +85,8 @@ public TwoPhaseFixedStaggeredGridSolver clone() { TwoPhaseFixedStaggeredGridSolver clonedSystem = null; try { clonedSystem = (TwoPhaseFixedStaggeredGridSolver) super.clone(); - } catch (Exception e) { - e.printStackTrace(System.err); + } catch (Exception ex) { + ex.printStackTrace(); } return clonedSystem; } diff --git a/src/main/java/neqsim/fluidMechanics/flowSolver/twoPhaseFlowSolver/twoPhasePipeFlowSolver/TwoPhaseFixedStaggeredGridSolver.java b/src/main/java/neqsim/fluidMechanics/flowSolver/twoPhaseFlowSolver/twoPhasePipeFlowSolver/TwoPhaseFixedStaggeredGridSolver.java index dc84877dc..dd3ef7066 100644 --- a/src/main/java/neqsim/fluidMechanics/flowSolver/twoPhaseFlowSolver/twoPhasePipeFlowSolver/TwoPhaseFixedStaggeredGridSolver.java +++ b/src/main/java/neqsim/fluidMechanics/flowSolver/twoPhaseFlowSolver/twoPhasePipeFlowSolver/TwoPhaseFixedStaggeredGridSolver.java @@ -83,8 +83,8 @@ public TwoPhaseFixedStaggeredGridSolver clone() { TwoPhaseFixedStaggeredGridSolver clonedSystem = null; try { clonedSystem = (TwoPhaseFixedStaggeredGridSolver) super.clone(); - } catch (Exception e) { - e.printStackTrace(System.err); + } catch (Exception ex) { + ex.printStackTrace(); } return clonedSystem; } diff --git a/src/main/java/neqsim/fluidMechanics/flowSolver/twoPhaseFlowSolver/twoPhasePipeFlowSolver/TwoPhasePipeFlowSolver.java b/src/main/java/neqsim/fluidMechanics/flowSolver/twoPhaseFlowSolver/twoPhasePipeFlowSolver/TwoPhasePipeFlowSolver.java index 4952116b0..4a8c17a4a 100644 --- a/src/main/java/neqsim/fluidMechanics/flowSolver/twoPhaseFlowSolver/twoPhasePipeFlowSolver/TwoPhasePipeFlowSolver.java +++ b/src/main/java/neqsim/fluidMechanics/flowSolver/twoPhaseFlowSolver/twoPhasePipeFlowSolver/TwoPhasePipeFlowSolver.java @@ -82,8 +82,8 @@ public TwoPhasePipeFlowSolver clone() { TwoPhasePipeFlowSolver clonedSystem = null; try { clonedSystem = (TwoPhasePipeFlowSolver) super.clone(); - } catch (Exception e) { - e.printStackTrace(System.err); + } catch (Exception ex) { + ex.printStackTrace(); } return clonedSystem; diff --git a/src/main/java/neqsim/fluidMechanics/geometryDefinitions/GeometryDefinition.java b/src/main/java/neqsim/fluidMechanics/geometryDefinitions/GeometryDefinition.java index 8b19e21dd..9034a1bfc 100644 --- a/src/main/java/neqsim/fluidMechanics/geometryDefinitions/GeometryDefinition.java +++ b/src/main/java/neqsim/fluidMechanics/geometryDefinitions/GeometryDefinition.java @@ -70,7 +70,6 @@ public void setWall(Wall wall) { private SurroundingEnvironment surroundingEnvironment = new SurroundingEnvironmentBaseClass(); /** - * * *

* Constructor for GeometryDefinition. *

@@ -110,8 +109,8 @@ public GeometryDefinitionInterface clone() { GeometryDefinitionInterface clonedGeometry = null; try { clonedGeometry = (GeometryDefinition) super.clone(); - } catch (Exception e) { - e.printStackTrace(System.err); + } catch (Exception ex) { + ex.printStackTrace(); } return clonedGeometry; diff --git a/src/main/java/neqsim/fluidMechanics/geometryDefinitions/internalGeometry/packings/Packing.java b/src/main/java/neqsim/fluidMechanics/geometryDefinitions/internalGeometry/packings/Packing.java index b7b947fad..13abb14ec 100644 --- a/src/main/java/neqsim/fluidMechanics/geometryDefinitions/internalGeometry/packings/Packing.java +++ b/src/main/java/neqsim/fluidMechanics/geometryDefinitions/internalGeometry/packings/Packing.java @@ -51,8 +51,8 @@ public Packing(String name) { System.out.println("packing ok"); } - catch (Exception e) { - String err = e.toString(); + catch (Exception ex) { + String err = ex.toString(); System.out.println(err); } } @@ -80,8 +80,8 @@ public Packing(String name, String material, int size) { System.out.println("packing ok"); } - catch (Exception e) { - String err = e.toString(); + catch (Exception ex) { + String err = ex.toString(); System.out.println(err); } } diff --git a/src/main/java/neqsim/fluidMechanics/geometryDefinitions/pipe/PipeData.java b/src/main/java/neqsim/fluidMechanics/geometryDefinitions/pipe/PipeData.java index f4796f8c9..08b47a8fe 100644 --- a/src/main/java/neqsim/fluidMechanics/geometryDefinitions/pipe/PipeData.java +++ b/src/main/java/neqsim/fluidMechanics/geometryDefinitions/pipe/PipeData.java @@ -60,8 +60,8 @@ public PipeData clone() { PipeData clonedPipe = null; try { clonedPipe = (PipeData) super.clone(); - } catch (Exception e) { - e.printStackTrace(System.err); + } catch (Exception ex) { + ex.printStackTrace(); } return clonedPipe; } diff --git a/src/main/java/neqsim/fluidMechanics/geometryDefinitions/reactor/ReactorData.java b/src/main/java/neqsim/fluidMechanics/geometryDefinitions/reactor/ReactorData.java index d4724fe60..7905c6894 100644 --- a/src/main/java/neqsim/fluidMechanics/geometryDefinitions/reactor/ReactorData.java +++ b/src/main/java/neqsim/fluidMechanics/geometryDefinitions/reactor/ReactorData.java @@ -124,8 +124,8 @@ public ReactorData clone() { ReactorData clonedPipe = null; try { clonedPipe = (ReactorData) super.clone(); - } catch (Exception e) { - e.printStackTrace(System.err); + } catch (Exception ex) { + ex.printStackTrace(); } return clonedPipe; diff --git a/src/main/java/neqsim/fluidMechanics/geometryDefinitions/stirredCell/StirredCell.java b/src/main/java/neqsim/fluidMechanics/geometryDefinitions/stirredCell/StirredCell.java index 2fb2062a6..4b275766d 100644 --- a/src/main/java/neqsim/fluidMechanics/geometryDefinitions/stirredCell/StirredCell.java +++ b/src/main/java/neqsim/fluidMechanics/geometryDefinitions/stirredCell/StirredCell.java @@ -55,8 +55,8 @@ public StirredCell clone() { StirredCell clonedPipe = null; try { clonedPipe = (StirredCell) super.clone(); - } catch (Exception e) { - e.printStackTrace(System.err); + } catch (Exception ex) { + ex.printStackTrace(); } return clonedPipe; } 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 4d5a567cf..95d529b21 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 @@ -113,7 +113,7 @@ public void calcPoints(String name) { * neqsim.dataPresentation.visAD.visAd2D.visAd2dBaseClass("title[1]", "title[2]"); * ((neqsim.dataPresentation.visAD.visAd2D.visAd2dBaseClass) plot) .setLineXYVals(xPlace, * points[0]); ((neqsim.dataPresentation.visAD.visAd2D.visAd2dBaseClass) plot).setXYVals(xPlace, - * points[0]); } } catch (Exception e) { System.out.println(e.toString()); + * points[0]); } } catch (Exception ex) { System.out.println(ex.toString()); * System.out.println("plotting failed"); } */ } @@ -148,7 +148,7 @@ public void displayResult(String name) { * neqsim.dataPresentation.visAD.visAd2D.visAd2dBaseClass("title[1]", "title[2]"); * ((neqsim.dataPresentation.visAD.visAd2D.visAd2dBaseClass) plot) .setLineXYVals(xPlace, * points[0]); ((neqsim.dataPresentation.visAD.visAd2D.visAd2dBaseClass) plot).setXYVals(xPlace, - * points[0]); } plot.init(); } catch (Exception e) { System.out.println(e.toString()); + * points[0]); } plot.init(); } catch (Exception ex) { System.out.println(ex.toString()); * System.out.println("plotting failed"); } */ } 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 d6cf0b2ce..994da2acf 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 @@ -142,7 +142,7 @@ public void displayResult(String name) { // plot.init(); // } // catch(Exception e){ - // System.out.println(e.toString()); + // System.out.println(ex.toString()); // System.out.println("plotting failed"); // } } diff --git a/src/main/java/neqsim/fluidMechanics/util/parameterFitting/masstransfer/MassTransferFunction.java b/src/main/java/neqsim/fluidMechanics/util/parameterFitting/masstransfer/MassTransferFunction.java index ced5f06d8..ca92bda9b 100644 --- a/src/main/java/neqsim/fluidMechanics/util/parameterFitting/masstransfer/MassTransferFunction.java +++ b/src/main/java/neqsim/fluidMechanics/util/parameterFitting/masstransfer/MassTransferFunction.java @@ -9,35 +9,35 @@ * @version $Id: $Id */ public class MassTransferFunction extends - neqsim.statistics.parameterFitting.nonLinearParameterFitting.LevenbergMarquardtFunction { - /** - *

- * Constructor for MassTransferFunction. - *

- */ - public MassTransferFunction() { - params = new double[1]; - } + neqsim.statistics.parameterFitting.nonLinearParameterFitting.LevenbergMarquardtFunction { + /** + *

+ * Constructor for MassTransferFunction. + *

+ */ + public MassTransferFunction() { + params = new double[1]; + } - /** {@inheritDoc} */ - @Override - public double calcValue(double[] dependentValues) { - system.setTemperature(dependentValues[0]); - system.init(0); - system.init(1); - try { - thermoOps.bubblePointPressureFlash(false); - } catch (Exception e) { - System.out.println(e.toString()); - } - return Math.log(system.getPressure()); + /** {@inheritDoc} */ + @Override + public double calcValue(double[] dependentValues) { + system.setTemperature(dependentValues[0]); + system.init(0); + system.init(1); + try { + thermoOps.bubblePointPressureFlash(false); + } catch (Exception ex) { + System.out.println(ex.toString()); } + return Math.log(system.getPressure()); + } - /** {@inheritDoc} */ - @Override - public void setFittingParams(int i, double value) { - params[i] = value; - system.getPhases()[0].getComponents()[i].setAcentricFactor(value); - system.getPhases()[1].getComponents()[i].setAcentricFactor(value); - } + /** {@inheritDoc} */ + @Override + public void setFittingParams(int i, double value) { + params[i] = value; + system.getPhases()[0].getComponents()[i].setAcentricFactor(value); + system.getPhases()[1].getComponents()[i].setAcentricFactor(value); + } } diff --git a/src/main/java/neqsim/fluidMechanics/util/parameterFitting/masstransfer/TestMassTransfer.java b/src/main/java/neqsim/fluidMechanics/util/parameterFitting/masstransfer/TestMassTransfer.java index a25d472fc..c18f7ba99 100644 --- a/src/main/java/neqsim/fluidMechanics/util/parameterFitting/masstransfer/TestMassTransfer.java +++ b/src/main/java/neqsim/fluidMechanics/util/parameterFitting/masstransfer/TestMassTransfer.java @@ -18,57 +18,57 @@ * @version $Id: $Id */ public class TestMassTransfer { - /** - *

- * main. - *

- * - * @param args an array of {@link java.lang.String} objects - */ - @SuppressWarnings("unused") - public static void main(String[] args) { - ArrayList sampleList = new ArrayList(); + /** + *

+ * main. + *

+ * + * @param args an array of {@link java.lang.String} objects + */ + @SuppressWarnings("unused") + public static void main(String[] args) { + ArrayList sampleList = new ArrayList(); - // inserting samples from database - NeqSimDataBase database = new NeqSimDataBase(); - ResultSet dataSet = database.getResultSet( - "SELECT * FROM purecomponentvapourpressures WHERE ComponentName='water' AND VapourPressure<100"); + // inserting samples from database + NeqSimDataBase database = new NeqSimDataBase(); + ResultSet dataSet = database.getResultSet( + "SELECT * FROM purecomponentvapourpressures WHERE ComponentName='water' AND VapourPressure<100"); - try { - System.out.println("adding...."); - while (dataSet.next()) { - MassTransferFunction function = new MassTransferFunction(); - double guess[] = {0.3311}; - double bound[][] = {{0, 1.0},}; - function.setInitialGuess(guess); - SystemInterface testSystem = new SystemSrkEos(280, 0.001); - testSystem.addComponent(dataSet.getString("ComponentName"), 100.0); - double sample1[] = {Double.parseDouble(dataSet.getString("Temperature"))}; - double vappres = Double.parseDouble(dataSet.getString("VapourPressure")); - double standardDeviation1[] = {0.15}; - SampleValue sample = new SampleValue(Math.log(vappres), - Double.parseDouble(dataSet.getString("StandardDeviation")), sample1, - standardDeviation1); - sample.setFunction(function); - function.setInitialGuess(guess); - // function.setBounds(bound); - sample.setThermodynamicSystem(testSystem); - sample.setReference(dataSet.getString("Reference")); - sampleList.add(sample); - } - } catch (Exception e) { - System.out.println("database error" + e); - } + try { + System.out.println("adding...."); + while (dataSet.next()) { + MassTransferFunction function = new MassTransferFunction(); + double guess[] = {0.3311}; + double bound[][] = {{0, 1.0},}; + function.setInitialGuess(guess); + SystemInterface testSystem = new SystemSrkEos(280, 0.001); + testSystem.addComponent(dataSet.getString("ComponentName"), 100.0); + double sample1[] = {Double.parseDouble(dataSet.getString("Temperature"))}; + double vappres = Double.parseDouble(dataSet.getString("VapourPressure")); + double standardDeviation1[] = {0.15}; + SampleValue sample = new SampleValue(Math.log(vappres), + Double.parseDouble(dataSet.getString("StandardDeviation")), sample1, + standardDeviation1); + sample.setFunction(function); + function.setInitialGuess(guess); + // function.setBounds(bound); + sample.setThermodynamicSystem(testSystem); + sample.setReference(dataSet.getString("Reference")); + sampleList.add(sample); + } + } catch (Exception ex) { + System.out.println("database error" + ex); + } - SampleSet sampleSet = new SampleSet(sampleList); + SampleSet sampleSet = new SampleSet(sampleList); - LevenbergMarquardt optim = new LevenbergMarquardt(); - optim.setSampleSet(sampleSet); + LevenbergMarquardt optim = new LevenbergMarquardt(); + optim.setSampleSet(sampleSet); - // do simulations - optim.solve(); - // optim.runMonteCarloSimulation(50); - // optim.displayCurveFit(); - // optim.writeToTextFile("c:/test.txt"); - } + // do simulations + optim.solve(); + // optim.runMonteCarloSimulation(50); + // optim.displayCurveFit(); + // optim.writeToTextFile("c:/test.txt"); + } }