From da485d0129aa233cfe91bb7ec25ed01e64e1d179 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=85smund=20V=C3=A5ge=20Fannemel?= <34712686+asmfstatoil@users.noreply.github.com> Date: Fri, 22 Nov 2024 12:37:40 +0100 Subject: [PATCH] refact: use getComponent when getting 1 comp (#1187) * refact: use getComponent when getting 1 comp --- .../ChemicalReactionOperations.java | 16 +- .../chemicalreaction/ChemicalReaction.java | 2 +- .../ChemicalReactionList.java | 8 +- .../fluidmechanics/flownode/FlowNode.java | 12 +- .../heatmasstransfercalc/FluidBoundary.java | 12 +- .../FluidBoundarySolver.java | 16 +- .../NonEquilibriumFluidBoundary.java | 82 ++++----- .../KrishnaStandartFilmModel.java | 17 +- .../ReactiveFluidBoundary.java | 78 ++++---- .../EnhancementFactorAlg.java | 10 +- .../multiphasenode/MultiPhaseFlowNode.java | 2 +- .../onephasenode/onePhaseFlowNode.java | 4 +- .../twophasenode/TwoPhaseFlowNode.java | 2 +- .../OnePhaseFixedStaggeredGrid.java | 14 +- .../stirredcellsolver/StirredCellSolver.java | 16 +- .../TwoPhaseFixedStaggeredGridSolver.java | 12 +- .../fluidmechanics/flowsystem/FlowSystem.java | 2 +- .../OnePhasePipeFlowNodeVisualization.java | 2 +- .../TwoPhaseFlowNodeVisualization.java | 8 +- .../nonlinearsolver/SysNewtonRhapson.java | 52 +++--- .../CorrespondingStatesDiffusivity.java | 8 +- .../diffusivity/Diffusivity.java | 8 +- .../FrictionTheoryViscosityMethod.java | 10 +- .../viscosity/Viscosity.java | 34 ++-- .../GasPhysicalPropertyMethod.java | 15 +- .../conductivity/ChungConductivityMethod.java | 36 ++-- .../density/Density.java | 6 +- .../diffusivity/Diffusivity.java | 8 +- .../viscosity/ChungViscosityMethod.java | 37 ++-- .../conductivity/Conductivity.java | 16 +- .../density/Costald.java | 28 +-- .../density/Density.java | 6 +- .../diffusivity/Diffusivity.java | 13 +- .../diffusivity/SiddiqiLucasMethod.java | 12 +- .../viscosity/Viscosity.java | 40 ++-- .../density/Density.java | 6 +- .../PhysicalPropertyMixingRule.java | 6 +- .../chungmethod/ChungFunction.java | 4 +- .../linearliquidmodel/ViscosityFunction.java | 4 +- .../equipment/absorber/SimpleTEGAbsorber.java | 24 +-- .../absorber/WaterStripperColumn.java | 27 ++- .../equipment/compressor/Compressor.java | 10 +- .../equipment/expander/ExpanderOld.java | 7 +- .../neqsim/process/equipment/mixer/Mixer.java | 4 +- .../process/equipment/mixer/StaticMixer.java | 10 +- .../equipment/mixer/StaticNeqMixer.java | 10 +- .../equipment/mixer/StaticPhaseMixer.java | 10 +- .../neqsim/process/equipment/pump/Pump.java | 7 +- src/main/java/neqsim/standards/Standard.java | 17 +- .../standards/gasquality/Draft_GERG2004.java | 9 +- .../gasquality/Standard_ISO6976.java | 9 +- .../neqsim/thermo/ThermodynamicModelTest.java | 92 +++++----- .../thermo/component/ComponentGEWilson.java | 1 + .../ComponentModifiedFurstElectrolyteEos.java | 26 +-- ...entModifiedFurstElectrolyteEosMod2004.java | 23 ++- .../neqsim/thermo/mixingrule/CPAMixing.java | 42 +++-- .../thermo/mixingrule/EosMixingRules.java | 110 +++++------ .../thermo/phase/PhaseDesmukhMather.java | 17 +- .../neqsim/thermo/phase/PhaseDuanSun.java | 14 +- .../java/neqsim/thermo/phase/PhaseGENRTL.java | 10 +- .../thermo/phase/PhaseGENRTLmodifiedHV.java | 20 +- .../thermo/phase/PhaseGENRTLmodifiedWS.java | 20 +- .../neqsim/thermo/phase/PhaseGEUnifac.java | 10 +- .../thermo/phase/PhaseGEUnifacPSRK.java | 10 +- .../thermo/phase/PhaseGEUnifacUMRPRU.java | 21 ++- .../neqsim/thermo/phase/PhaseGEUniquac.java | 10 +- .../neqsim/thermo/phase/PhaseGEWilson.java | 10 +- .../neqsim/thermo/system/SystemThermo.java | 173 +++++++++--------- .../ChemicalEquilibrium.java | 4 +- .../flashops/Flash.java | 18 +- .../flashops/SolidFlash.java | 2 +- .../flashops/SolidFlash1.java | 4 +- .../flashops/SolidFlash12.java | 4 +- .../flashops/SysNewtonRhapsonPHflash.java | 40 ++-- .../flashops/SysNewtonRhapsonTPflash.java | 30 +-- .../flashops/SysNewtonRhapsonTPflashNew.java | 48 ++--- .../flashops/TPflash.java | 12 +- .../flashops/TPgradientFlash.java | 16 +- .../flashops/TPmultiflash.java | 146 ++++++++------- .../flashops/TPmultiflashWAX.java | 64 ++++--- .../flashops/TPmultiflash_1.java | 52 +++--- .../BubblePointPressureFlash.java | 60 +++--- .../BubblePointPressureFlashDer.java | 72 ++++---- .../BubblePointTemperatureFlash.java | 44 ++--- .../BubblePointTemperatureNoDer.java | 54 +++--- .../saturationops/ConstantDutyFlash.java | 32 ++-- .../ConstantDutyPressureFlash.java | 28 +-- .../ConstantDutyTemperatureFlash.java | 34 ++-- .../saturationops/CricondebarFlash.java | 38 ++-- .../saturationops/CricondenBarTemp.java | 33 ++-- .../saturationops/CricondenBarTemp1.java | 33 ++-- .../saturationops/DewPointPressureFlash.java | 46 +++-- .../DewPointTemperatureFlash.java | 54 +++--- .../DewPointTemperatureFlashDer.java | 64 +++---- .../flashops/saturationops/FreezeOut.java | 6 +- .../FreezingPointTemperatureFlash.java | 6 +- .../FreezingPointTemperatureFlashOld.java | 20 +- .../FreezingPointTemperatureFlashTR.java | 17 +- .../flashops/saturationops/FugTestConstP.java | 6 +- .../HCdewPointPressureFlash.java | 46 +++-- .../WaterDewPointTemperatureFlash.java | 19 +- .../CricondenBarFlash.java | 31 ++-- .../CricondenThermFlash.java | 31 ++-- .../PTphaseEnvelope.java | 52 +++--- .../PTphaseEnvelope1.java | 2 +- .../PTphaseEnvelopeMay.java | 52 +++--- .../PTphaseEnvelopeNew2.java | 52 +++--- .../SysNewtonRhapsonPhaseEnvelope.java | 103 +++++------ .../SysNewtonRhapsonPhaseEnvelope2.java | 48 +++-- .../reactivecurves/PloadingCurve.java | 6 +- .../reactivecurves/PloadingCurve2.java | 8 +- 111 files changed, 1446 insertions(+), 1508 deletions(-) diff --git a/src/main/java/neqsim/chemicalreactions/ChemicalReactionOperations.java b/src/main/java/neqsim/chemicalreactions/ChemicalReactionOperations.java index 27e85b0b4b..466278c6f4 100644 --- a/src/main/java/neqsim/chemicalreactions/ChemicalReactionOperations.java +++ b/src/main/java/neqsim/chemicalreactions/ChemicalReactionOperations.java @@ -6,6 +6,11 @@ package neqsim.chemicalreactions; +import java.util.HashSet; +import java.util.Iterator; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import Jama.Matrix; import neqsim.chemicalreactions.chemicalequilibrium.ChemicalEquilibrium; import neqsim.chemicalreactions.chemicalequilibrium.LinearProgrammingChemicalEquilibrium; import neqsim.chemicalreactions.chemicalreaction.ChemicalReactionList; @@ -14,13 +19,6 @@ import neqsim.thermo.phase.PhaseInterface; import neqsim.thermo.system.SystemInterface; -import java.util.HashSet; -import java.util.Iterator; - -import Jama.Matrix; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; - /** *

* ChemicalReactionOperations class. @@ -178,9 +176,9 @@ public void setReactiveComponents() { String name = componentNames[j]; for (int i = 0; i < allComponentNames.length; i++) { if (name.equals(allComponentNames[i])) { - components[k++] = system.getPhase(phase).getComponents()[j]; + components[k++] = system.getPhase(phase).getComponent(j); // System.out.println("reactive comp " + - // system.getPhases()[1].getComponents()[j].getName()); + // system.getPhases()[1].getComponent(j).getName()); } } } diff --git a/src/main/java/neqsim/chemicalreactions/chemicalreaction/ChemicalReaction.java b/src/main/java/neqsim/chemicalreactions/chemicalreaction/ChemicalReaction.java index 7994fbba68..b5253dc69c 100644 --- a/src/main/java/neqsim/chemicalreactions/chemicalreaction/ChemicalReaction.java +++ b/src/main/java/neqsim/chemicalreactions/chemicalreaction/ChemicalReaction.java @@ -256,7 +256,7 @@ public void initMoleNumbers(PhaseInterface phase, ComponentInterface[] component for (int i = 0; i < names.length; i++) { for (int j = 0; j < components.length; j++) { // System.out.println("names: " + names[i] + " " + - // system.getPhases()[0].getComponents()[j].getName()); + // system.getPhases()[0].getComponent(j).getName()); if (this.names[i].equals(components[j].getName())) { for (int k = 0; k < Amatrix.length; k++) { tempAmatrix.set(k, i, Amatrix[k][j]); diff --git a/src/main/java/neqsim/chemicalreactions/chemicalreaction/ChemicalReactionList.java b/src/main/java/neqsim/chemicalreactions/chemicalreaction/ChemicalReactionList.java index 049e782be4..1f272c8e5b 100644 --- a/src/main/java/neqsim/chemicalreactions/chemicalreaction/ChemicalReactionList.java +++ b/src/main/java/neqsim/chemicalreactions/chemicalreaction/ChemicalReactionList.java @@ -346,14 +346,14 @@ public void calcReacMatrix(PhaseInterface phase) { while (e.hasNext()) { reaction = e.next(); for (int j = 0; j < reaction.getNames().length; j++) { - if (phase.getComponents()[i].getName().equals(reaction.getNames()[j])) { + if (phase.getComponent(i).getName().equals(reaction.getNames()[j])) { for (int k = 0; k < phase.getNumberOfComponents(); k++) { for (int o = 0; o < reaction.getNames().length; o++) { - if (phase.getComponents()[k].getName().equals(reaction.getNames()[o])) { + if (phase.getComponent(k).getName().equals(reaction.getNames()[o])) { // System.out.println("comp1 " + - // system.getPhases()[1].getComponents()[i].getComponentName() + + // system.getPhases()[1].getComponent(i).getComponentName() + // " comp2 " - // +system.getPhases()[1].getComponents()[k].getComponentName() + // +system.getPhases()[1].getComponent(k).getComponentName() // ); tempReacMatrix[i][k] = reaction.getRateFactor(phase); tempStocMatrix[i][k] = -reaction.getStocCoefs()[o]; diff --git a/src/main/java/neqsim/fluidmechanics/flownode/FlowNode.java b/src/main/java/neqsim/fluidmechanics/flownode/FlowNode.java index a02d6ecbc0..0c3dd962c0 100644 --- a/src/main/java/neqsim/fluidmechanics/flownode/FlowNode.java +++ b/src/main/java/neqsim/fluidmechanics/flownode/FlowNode.java @@ -668,27 +668,27 @@ public String[][] createTable(String name) { FieldPosition test = new FieldPosition(0); for (int i = 0; i < bulkSystem.getNumberOfPhases(); i++) { for (int j = 0; j < bulkSystem.getPhases()[0].getNumberOfComponents(); j++) { - table[j + 1][0] = bulkSystem.getPhases()[0].getComponents()[j].getName(); + table[j + 1][0] = bulkSystem.getPhases()[0].getComponent(j).getName(); buf = new StringBuffer(); table[j + 1][i + 1] = - nf.format(bulkSystem.getPhase(bulkSystem.getPhaseIndex(i)).getComponents()[j].getx(), - buf, test).toString(); + nf.format(bulkSystem.getPhase(bulkSystem.getPhaseIndex(i)).getComponent(j).getx(), buf, + test).toString(); table[j + 1][4] = "[-] bulk"; } for (int j = 0; j < bulkSystem.getPhases()[0].getNumberOfComponents(); j++) { table[j + bulkSystem.getPhases()[0].getNumberOfComponents() + 2][0] = - getInterphaseSystem().getPhases()[0].getComponents()[j].getName(); + getInterphaseSystem().getPhases()[0].getComponent(j).getName(); buf = new StringBuffer(); table[j + bulkSystem.getPhases()[0].getNumberOfComponents() + 2][i + 1] = nf.format(getInterphaseSystem().getPhase(getInterphaseSystem().getPhaseIndex(i)) - .getComponents()[j].getx(), buf, test).toString(); + .getComponent(j).getx(), buf, test).toString(); table[j + bulkSystem.getPhases()[0].getNumberOfComponents() + 2][4] = "[-] interface"; } for (int j = 0; j < bulkSystem.getPhases()[0].getNumberOfComponents(); j++) { table[j + 2 * bulkSystem.getPhases()[0].getNumberOfComponents() + 3][0] = - bulkSystem.getPhases()[0].getComponents()[j].getName(); + bulkSystem.getPhases()[0].getComponent(j).getName(); buf = new StringBuffer(); table[j + 2 * bulkSystem.getPhases()[0].getNumberOfComponents() + 3][i + 1] = nf.format(getFluidBoundary().getInterphaseMolarFlux(j), buf, test).toString(); 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 4569787fbc..38c5132bdd 100644 --- a/src/main/java/neqsim/fluidmechanics/flownode/fluidboundary/heatmasstransfercalc/FluidBoundary.java +++ b/src/main/java/neqsim/fluidmechanics/flownode/fluidboundary/heatmasstransfercalc/FluidBoundary.java @@ -252,7 +252,7 @@ public void calcFluxTypeCorrectionMatrix(int phase, int k) { temp = (i == k) ? 1.0 : 0.0; fluxTypeCorrectionMatrixV[phase].set(i, 0, temp); sum += fluxTypeCorrectionMatrixV[phase].get(i, 0) - * bulkSystem.getPhases()[phase].getComponents()[i].getx(); + * bulkSystem.getPhases()[phase].getComponent(i).getx(); } sum += fluxTypeCorrectionMatrixV[phase] @@ -283,8 +283,8 @@ public void calcNonIdealCorrections(int phase) { for (int j = 0; j < bulkSystem.getPhases()[phase].getNumberOfComponents() - 1; j++) { temp = (i == j) ? 1.0 : 0.0; nonIdealCorrections[phase].set(i, j, - temp + bulkSystem.getPhases()[phase].getComponents()[i].getx() - * bulkSystem.getPhases()[phase].getComponents()[i].getdfugdn(j) + temp + bulkSystem.getPhases()[phase].getComponent(i).getx() + * bulkSystem.getPhases()[phase].getComponent(i).getdfugdn(j) * bulkSystem.getPhases()[phase].getNumberOfMolesInPhase()); // her må det fylles inn } @@ -440,7 +440,7 @@ public String[][] createTable(String name) { for (int i = 0; i < bulkSystem.getNumberOfPhases(); i++) { for (int j = 0; j < bulkSystem.getPhases()[0].getNumberOfComponents(); j++) { table[j + 1][0] = - "eff. mass trans coef. " + bulkSystem.getPhases()[0].getComponents()[j].getName(); + "eff. mass trans coef. " + bulkSystem.getPhases()[0].getComponent(j).getName(); buf = new StringBuffer(); table[j + 1][i + 1] = nf.format(getEffectiveMassTransferCoefficient(i, j), buf, test).toString(); @@ -450,7 +450,7 @@ public String[][] createTable(String name) { getEnhancementFactor().calcEnhancementVec(i); for (int j = 0; j < bulkSystem.getPhases()[0].getNumberOfComponents(); j++) { table[j + bulkSystem.getPhases()[0].getNumberOfComponents() + 2][0] = - "enhancement " + getInterphaseSystem().getPhases()[0].getComponents()[j].getName(); + "enhancement " + getInterphaseSystem().getPhases()[0].getComponent(j).getName(); buf = new StringBuffer(); table[j + bulkSystem.getPhases()[0].getNumberOfComponents() + 2][i + 1] = nf.format(getEnhancementFactor().getEnhancementVec(j), buf, test).toString(); @@ -460,7 +460,7 @@ public String[][] createTable(String name) { getBulkSystem().getPhase(i).getPhysicalProperties().calcEffectiveDiffusionCoefficients(); for (int j = 0; j < bulkSystem.getPhases()[0].getNumberOfComponents(); j++) { table[j + 2 * bulkSystem.getPhases()[0].getNumberOfComponents() + 3][0] = - "schmidt " + bulkSystem.getPhases()[0].getComponents()[j].getName(); + "schmidt " + bulkSystem.getPhases()[0].getComponent(j).getName(); buf = new StringBuffer(); table[j + 2 * bulkSystem.getPhases()[0].getNumberOfComponents() + 3][i + 1] = nf.format( getBulkSystem().getPhase(i).getPhysicalProperties().getEffectiveSchmidtNumber(j), buf, diff --git a/src/main/java/neqsim/fluidmechanics/flownode/fluidboundary/heatmasstransfercalc/finitevolumeboundary/fluidboundarysolver/FluidBoundarySolver.java b/src/main/java/neqsim/fluidmechanics/flownode/fluidboundary/heatmasstransfercalc/finitevolumeboundary/fluidboundarysolver/FluidBoundarySolver.java index a581b86f24..928e6f1ec4 100644 --- a/src/main/java/neqsim/fluidmechanics/flownode/fluidboundary/heatmasstransfercalc/finitevolumeboundary/fluidboundarysolver/FluidBoundarySolver.java +++ b/src/main/java/neqsim/fluidmechanics/flownode/fluidboundary/heatmasstransfercalc/finitevolumeboundary/fluidboundarysolver/FluidBoundarySolver.java @@ -97,24 +97,24 @@ public void initProfiles() { for (int j = 0; j < boundary.getNode(0).getBulkSystem().getPhases()[0] .getNumberOfComponents(); j++) { double xbulk = - boundary.getFluidBoundary().getBulkSystem().getPhases()[1].getComponents()[j].getx(); + boundary.getFluidBoundary().getBulkSystem().getPhases()[1].getComponent(j).getx(); double xinterphase = - boundary.getFluidBoundary().getInterphaseSystem().getPhases()[1].getComponents()[j] + boundary.getFluidBoundary().getInterphaseSystem().getPhases()[1].getComponent(j) .getx(); double dx = xinterphase - xbulk; - double last = boundary.getNode(i).getBulkSystem().getPhases()[1].getComponents()[j].getx(); + double last = boundary.getNode(i).getBulkSystem().getPhases()[1].getComponent(j).getx(); if (reactive) { - boundary.getNode(i + 1).getBulkSystem().getPhases()[1].getComponents()[j].setx(last - dx + boundary.getNode(i + 1).getBulkSystem().getPhases()[1].getComponent(j).setx(last - dx - reacRates.get(j, 0) / boundary.getNode(i).getBulkSystem().getPhases()[1].getPhysicalProperties() .getEffectiveDiffusionCoefficient(j) * Math.pow(boundary.getNodeLength(), 2.0)); } else { - boundary.getNode(i + 1).getBulkSystem().getPhases()[1].getComponents()[j] + boundary.getNode(i + 1).getBulkSystem().getPhases()[1].getComponent(j) .setx(xinterphase - dx * ((double) (i + 1) / boundary.getNumberOfNodes())); } System.out.println("x comp " + reactive + " " - + boundary.getNode(i).getBulkSystem().getPhases()[1].getComponents()[j].getx()); + + boundary.getNode(i).getBulkSystem().getPhases()[1].getComponent(j).getx()); } } } @@ -130,7 +130,7 @@ public void initMatrix() { // pipe.getNode(i).init(); for (int i = 0; i < boundary.getNumberOfNodes(); i++) { solMatrix[j].set(i, 0, - boundary.getNode(i).getBulkSystem().getPhases()[1].getComponents()[j].getx()); + boundary.getNode(i).getBulkSystem().getPhases()[1].getComponent(j).getx()); } } } @@ -146,7 +146,7 @@ public void initComposition(int iter) { for (int j = 0; j < boundary.getNumberOfNodes(); j++) { for (int p = 0; p < boundary.getNode(0).getBulkSystem().getPhases()[0] .getNumberOfComponents(); p++) { - boundary.getNode(j).getBulkSystem().getPhases()[1].getComponents()[p] + boundary.getNode(j).getBulkSystem().getPhases()[1].getComponent(p) .setx(solMatrix[p].get(j, 0)); } boundary.getNode(j).getBulkSystem().getPhases()[0].normalize(); 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 c98b4f8dd6..f9c9b4d046 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 @@ -114,12 +114,12 @@ public void setfvecMassTrans() { double sumy = 0; for (int i = 0; i < bulkSystem.getPhases()[0].getNumberOfComponents(); i++) { fvec.set(i, 0, Math - .log((interphaseSystem.getPhases()[0].getComponents()[i].getFugacityCoefficient() - * interphaseSystem.getPhases()[0].getComponents()[i].getx())) - - Math.log((interphaseSystem.getPhases()[1].getComponents()[i].getFugacityCoefficient() - * interphaseSystem.getPhases()[1].getComponents()[i].getx()))); - sumx += interphaseSystem.getPhases()[0].getComponents()[i].getx(); - sumy += interphaseSystem.getPhases()[1].getComponents()[i].getx(); + .log((interphaseSystem.getPhases()[0].getComponent(i).getFugacityCoefficient() + * interphaseSystem.getPhases()[0].getComponent(i).getx())) + - Math.log((interphaseSystem.getPhases()[1].getComponent(i).getFugacityCoefficient() + * interphaseSystem.getPhases()[1].getComponent(i).getx()))); + sumx += interphaseSystem.getPhases()[0].getComponent(i).getx(); + sumy += interphaseSystem.getPhases()[1].getComponent(i).getx(); } fvec.set(bulkSystem.getPhases()[0].getNumberOfComponents() - 1, 0, 1.0 - sumx); fvec.set(bulkSystem.getPhases()[0].getNumberOfComponents(), 0, 1.0 - sumy); @@ -154,12 +154,12 @@ public void setfvecMassTrans2() { double sumy = 0.0; for (int i = 0; i < bulkSystem.getPhases()[0].getNumberOfComponents(); i++) { fvec.set(i, 0, Math - .log((interphaseSystem.getPhases()[0].getComponents()[i].getFugacityCoefficient() - * interphaseSystem.getPhases()[0].getComponents()[i].getx())) - - Math.log((interphaseSystem.getPhases()[1].getComponents()[i].getFugacityCoefficient() - * interphaseSystem.getPhases()[1].getComponents()[i].getx()))); - sumx += interphaseSystem.getPhases()[1].getComponents()[i].getx(); - sumy += interphaseSystem.getPhases()[0].getComponents()[i].getx(); + .log((interphaseSystem.getPhases()[0].getComponent(i).getFugacityCoefficient() + * interphaseSystem.getPhases()[0].getComponent(i).getx())) + - Math.log((interphaseSystem.getPhases()[1].getComponent(i).getFugacityCoefficient() + * interphaseSystem.getPhases()[1].getComponent(i).getx()))); + sumx += interphaseSystem.getPhases()[1].getComponent(i).getx(); + sumy += interphaseSystem.getPhases()[0].getComponent(i).getx(); } fvec.set(bulkSystem.getPhases()[0].getNumberOfComponents(), 0, 1.0 - sumx); @@ -171,12 +171,12 @@ public void setfvecMassTrans2() { Matrix y = new Matrix(1, bulkSystem.getPhases()[0].getNumberOfComponents() - 1); for (int i = 0; i < bulkSystem.getPhases()[0].getNumberOfComponents() - 1; i++) { - dy.set(0, i, (bulkSystem.getPhases()[0].getComponents()[i].getx() - - interphaseSystem.getPhases()[0].getComponents()[i].getx())); - dx.set(0, i, (bulkSystem.getPhases()[1].getComponents()[i].getx() - - interphaseSystem.getPhases()[1].getComponents()[i].getx())); - y.set(0, i, (bulkSystem.getPhases()[0].getComponents()[i].getx())); - x.set(0, i, (bulkSystem.getPhases()[1].getComponents()[i].getx())); + dy.set(0, i, (bulkSystem.getPhases()[0].getComponent(i).getx() + - interphaseSystem.getPhases()[0].getComponent(i).getx())); + dx.set(0, i, (bulkSystem.getPhases()[1].getComponent(i).getx() + - interphaseSystem.getPhases()[1].getComponent(i).getx())); + y.set(0, i, (bulkSystem.getPhases()[0].getComponent(i).getx())); + x.set(0, i, (bulkSystem.getPhases()[1].getComponent(i).getx())); } Matrix fluxX = totalMassTransferCoefficientMatrix[1].times(dx.transpose()) @@ -234,11 +234,11 @@ public void setJacMassTrans() { for (int i = 0; i < bulkSystem.getPhases()[0].getNumberOfComponents() - 1; i++) { for (int j = 0; j < bulkSystem.getPhases()[0].getNumberOfComponents(); j++) { dij = i == j ? 1.0 : 0.0; // Kroneckers delta - tempJ = dij * 1.0 / interphaseSystem.getPhases()[0].getComponents()[i].getx() - + interphaseSystem.getPhases()[0].getComponents()[i].getdfugdx(j); + tempJ = dij * 1.0 / interphaseSystem.getPhases()[0].getComponent(i).getx() + + interphaseSystem.getPhases()[0].getComponent(i).getdfugdx(j); // tempJ= - // dij*interphaseSystem.getPhases()[0].getComponents()[i].getFugacityCoefficient()+interphaseSystem.getPhases()[0].getComponents()[i].getx()*interphaseSystem.getPhases()[0].getComponents()[i].getdfugdx(j); + // dij*interphaseSystem.getPhases()[0].getComponent(i).getFugacityCoefficient()+interphaseSystem.getPhases()[0].getComponent(i).getx()*interphaseSystem.getPhases()[0].getComponent(i).getdfugdx(j); Jac.set(i, j, tempJ); } } @@ -255,11 +255,11 @@ public void setJacMassTrans() { for (int i = 0; i < bulkSystem.getPhases()[0].getNumberOfComponents() - 1; i++) { for (int j = 0; j < bulkSystem.getPhases()[0].getNumberOfComponents(); j++) { dij = i == j ? 1.0 : 0.0; // Kroneckers delta - tempJ = dij * 1.0 / interphaseSystem.getPhases()[1].getComponents()[i].getx() - + interphaseSystem.getPhases()[1].getComponents()[i].getdfugdx(j); + tempJ = dij * 1.0 / interphaseSystem.getPhases()[1].getComponent(i).getx() + + interphaseSystem.getPhases()[1].getComponent(i).getdfugdx(j); // tempJ= - // dij*interphaseSystem.getPhases()[1].getComponents()[i].getFugacityCoefficient()+interphaseSystem.getPhases()[1].getComponents()[i].getx()*interphaseSystem.getPhases()[1].getComponents()[i].getdfugdx(j); + // dij*interphaseSystem.getPhases()[1].getComponent(i).getFugacityCoefficient()+interphaseSystem.getPhases()[1].getComponent(i).getx()*interphaseSystem.getPhases()[1].getComponent(i).getdfugdx(j); Jac.set(i, j + bulkSystem.getPhases()[0].getNumberOfComponents(), -tempJ); } } @@ -303,8 +303,8 @@ public void setJacMassTrans2() { for (int i = 0; i < bulkSystem.getPhases()[0].getNumberOfComponents(); i++) { for (int j = 0; j < bulkSystem.getPhases()[0].getNumberOfComponents(); j++) { dij = i == j ? 1.0 : 0.0; // Kroneckers delta - tempJ = dij * 1.0 / interphaseSystem.getPhases()[0].getComponents()[i].getx() - + interphaseSystem.getPhases()[0].getComponents()[i].getdfugdx(j); + tempJ = dij * 1.0 / interphaseSystem.getPhases()[0].getComponent(i).getx() + + interphaseSystem.getPhases()[0].getComponent(i).getdfugdx(j); Jac.set(i, j, tempJ); } } @@ -321,8 +321,8 @@ public void setJacMassTrans2() { for (int i = 0; i < bulkSystem.getPhases()[0].getNumberOfComponents(); i++) { for (int j = 0; j < bulkSystem.getPhases()[0].getNumberOfComponents(); j++) { dij = i == j ? 1.0 : 0.0; // Kroneckers delta - tempJ = dij * 1.0 / interphaseSystem.getPhases()[1].getComponents()[i].getx() - + interphaseSystem.getPhases()[1].getComponents()[i].getdfugdx(j); + tempJ = dij * 1.0 / interphaseSystem.getPhases()[1].getComponent(i).getx() + + interphaseSystem.getPhases()[1].getComponent(i).getdfugdx(j); Jac.set(i, j + bulkSystem.getPhases()[0].getNumberOfComponents(), -tempJ); } } @@ -390,9 +390,9 @@ public void setJacMassTrans2() { */ public void setuMassTrans() { for (int i = 0; i < bulkSystem.getPhases()[0].getNumberOfComponents(); i++) { - uMassTrans.set(i, 0, interphaseSystem.getPhases()[0].getComponents()[i].getx()); + uMassTrans.set(i, 0, interphaseSystem.getPhases()[0].getComponent(i).getx()); uMassTrans.set(i + bulkSystem.getPhases()[0].getNumberOfComponents(), 0, - interphaseSystem.getPhases()[1].getComponents()[i].getx()); + interphaseSystem.getPhases()[1].getComponent(i).getx()); } for (int i = 2 * bulkSystem.getPhases()[0].getNumberOfComponents(); i < 3 @@ -408,8 +408,8 @@ public void setuMassTrans() { */ public void updateMassTrans() { for (int i = 0; i < bulkSystem.getPhases()[0].getNumberOfComponents(); i++) { - interphaseSystem.getPhases()[0].getComponents()[i].setx(uMassTrans.get(i, 0)); - interphaseSystem.getPhases()[1].getComponents()[i] + interphaseSystem.getPhases()[0].getComponent(i).setx(uMassTrans.get(i, 0)); + interphaseSystem.getPhases()[1].getComponent(i) .setx(uMassTrans.get(i + bulkSystem.getPhases()[0].getNumberOfComponents(), 0)); } @@ -426,10 +426,10 @@ public void updateMassTrans() { */ public void calcMolFractionDifference() { for (int i = 0; i < getBulkSystem().getPhases()[0].getNumberOfComponents() - 1; i++) { - molFractionDifference[0][i] = bulkSystem.getPhases()[0].getComponents()[i].getx() - - interphaseSystem.getPhases()[0].getComponents()[i].getx(); - molFractionDifference[1][i] = bulkSystem.getPhases()[1].getComponents()[i].getx() - - interphaseSystem.getPhases()[1].getComponents()[i].getx(); + molFractionDifference[0][i] = bulkSystem.getPhases()[0].getComponent(i).getx() + - interphaseSystem.getPhases()[0].getComponent(i).getx(); + molFractionDifference[1][i] = bulkSystem.getPhases()[1].getComponent(i).getx() + - interphaseSystem.getPhases()[1].getComponent(i).getx(); } } @@ -467,7 +467,7 @@ public void calcHeatTransferCorrection(int phase) { } else { temp += nFlux.get(i, 0) * getBulkSystem().getPhases()[phase].getCp() / getBulkSystem().getPhases()[phase].getNumberOfMolesInPhase() - / heatTransferCoefficient[phase]; // bulkSystem.getPhases()[0].getComponents()[i].getNumberOfMolesInPhase()* + / heatTransferCoefficient[phase]; // bulkSystem.getPhases()[0].getComponent(i).getNumberOfMolesInPhase()* } } // System.out.println("temp eat " + temp); @@ -510,12 +510,12 @@ public void heatTransSolve() { iter++; dhtot = 0.0; for (int i = 0; i < bulkSystem.getPhases()[0].getNumberOfComponents(); i++) { - dhtot += nFlux.get(i, 0) * (bulkSystem.getPhases()[0].getComponents()[i] + dhtot += nFlux.get(i, 0) * (bulkSystem.getPhases()[0].getComponent(i) .getEnthalpy(bulkSystem.getPhases()[0].getTemperature()) - / bulkSystem.getPhases()[0].getComponents()[i].getNumberOfMolesInPhase() - - bulkSystem.getPhases()[1].getComponents()[i] + / bulkSystem.getPhases()[0].getComponent(i).getNumberOfMolesInPhase() + - bulkSystem.getPhases()[1].getComponent(i) .getEnthalpy(bulkSystem.getPhases()[1].getTemperature()) - / bulkSystem.getPhases()[1].getComponents()[i].getNumberOfMolesInPhase()); + / bulkSystem.getPhases()[1].getComponent(i).getNumberOfMolesInPhase()); } // System.out.println("dhtot " + dhtot + " heat coef " + // heatTransferCoefficient[0]); 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 20aae3ed9e..ffaa6ce4db 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 @@ -141,18 +141,18 @@ public double calcMassTransferCoefficients(int phase) { double tempVar = 0; for (int j = 0; j < getBulkSystem().getPhases()[phase].getNumberOfComponents(); j++) { if (i != j) { - tempVar += getBulkSystem().getPhases()[phase].getComponents()[j].getx() + tempVar += getBulkSystem().getPhases()[phase].getComponent(j).getx() / binaryMassTransferCoefficient[phase][i][j]; } if (j < n) { massTransferCoefficientMatrix[phase].set(i, j, - -getBulkSystem().getPhases()[phase].getComponents()[i].getx() + -getBulkSystem().getPhases()[phase].getComponent(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() + tempVar + getBulkSystem().getPhases()[phase].getComponent(i).getx() / binaryMassTransferCoefficient[phase][i][n]); } massTransferCoefficientMatrix[phase] = massTransferCoefficientMatrix[phase].inverse(); @@ -178,11 +178,12 @@ public void calcPhiMatrix(int phase) { * 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, 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, 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 fba1e17e3e..b7cbdcb1e5 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 @@ -98,12 +98,12 @@ public void setfvecMassTrans() { double sumy = 0; for (int i = 0; i < bulkSystem.getPhases()[0].getNumberOfMolecularComponents(); i++) { fvec.set(i, 0, Math - .log((interphaseSystem.getPhases()[0].getComponents()[i].getFugacityCoefficient() - * interphaseSystem.getPhases()[0].getComponents()[i].getx())) - - Math.log((interphaseSystem.getPhases()[1].getComponents()[i].getFugacityCoefficient() - * interphaseSystem.getPhases()[1].getComponents()[i].getx()))); - sumx += interphaseSystem.getPhases()[0].getComponents()[i].getx(); - sumy += interphaseSystem.getPhases()[1].getComponents()[i].getx(); + .log((interphaseSystem.getPhases()[0].getComponent(i).getFugacityCoefficient() + * interphaseSystem.getPhases()[0].getComponent(i).getx())) + - Math.log((interphaseSystem.getPhases()[1].getComponent(i).getFugacityCoefficient() + * interphaseSystem.getPhases()[1].getComponent(i).getx()))); + sumx += interphaseSystem.getPhases()[0].getComponent(i).getx(); + sumy += interphaseSystem.getPhases()[1].getComponent(i).getx(); } fvec.set(bulkSystem.getPhases()[0].getNumberOfMolecularComponents() - 1, 0, 1 - sumx); fvec.set(bulkSystem.getPhases()[0].getNumberOfMolecularComponents(), 0, 1 - sumy); @@ -136,12 +136,12 @@ public void setfvecMassTrans2() { double sumy = 0.0; for (int i = 0; i < bulkSystem.getPhases()[0].getNumberOfMolecularComponents(); i++) { fvec.set(i, 0, Math - .log((interphaseSystem.getPhases()[0].getComponents()[i].getFugacityCoefficient() - * interphaseSystem.getPhases()[0].getComponents()[i].getx())) - - Math.log((interphaseSystem.getPhases()[1].getComponents()[i].getFugacityCoefficient() - * interphaseSystem.getPhases()[1].getComponents()[i].getx()))); - sumx += interphaseSystem.getPhases()[1].getComponents()[i].getx(); - sumy += interphaseSystem.getPhases()[0].getComponents()[i].getx(); + .log((interphaseSystem.getPhases()[0].getComponent(i).getFugacityCoefficient() + * interphaseSystem.getPhases()[0].getComponent(i).getx())) + - Math.log((interphaseSystem.getPhases()[1].getComponent(i).getFugacityCoefficient() + * interphaseSystem.getPhases()[1].getComponent(i).getx()))); + sumx += interphaseSystem.getPhases()[1].getComponent(i).getx(); + sumy += interphaseSystem.getPhases()[0].getComponent(i).getx(); } fvec.set(bulkSystem.getPhases()[0].getNumberOfMolecularComponents(), 0, 1.0 - sumx); @@ -153,12 +153,12 @@ public void setfvecMassTrans2() { Matrix y = new Matrix(1, bulkSystem.getPhases()[0].getNumberOfMolecularComponents() - 1); for (int i = 0; i < bulkSystem.getPhases()[0].getNumberOfMolecularComponents() - 1; i++) { - dy.set(0, i, (bulkSystem.getPhases()[0].getComponents()[i].getx() - - interphaseSystem.getPhases()[0].getComponents()[i].getx())); - dx.set(0, i, (bulkSystem.getPhases()[1].getComponents()[i].getx() - - interphaseSystem.getPhases()[1].getComponents()[i].getx())); - y.set(0, i, (bulkSystem.getPhases()[0].getComponents()[i].getx())); - x.set(0, i, (bulkSystem.getPhases()[1].getComponents()[i].getx())); + dy.set(0, i, (bulkSystem.getPhases()[0].getComponent(i).getx() + - interphaseSystem.getPhases()[0].getComponent(i).getx())); + dx.set(0, i, (bulkSystem.getPhases()[1].getComponent(i).getx() + - interphaseSystem.getPhases()[1].getComponent(i).getx())); + y.set(0, i, (bulkSystem.getPhases()[0].getComponent(i).getx())); + x.set(0, i, (bulkSystem.getPhases()[1].getComponent(i).getx())); } Matrix fluxX = totalMassTransferCoefficientMatrix[1].times(dx.transpose()) @@ -216,11 +216,11 @@ public void setJacMassTrans() { for (int i = 0; i < bulkSystem.getPhases()[0].getNumberOfMolecularComponents() - 1; i++) { for (int j = 0; j < bulkSystem.getPhases()[0].getNumberOfMolecularComponents(); j++) { dij = i == j ? 1.0 : 0.0; // Kroneckers delta - tempJ = dij * 1.0 / interphaseSystem.getPhases()[0].getComponents()[i].getx() - + interphaseSystem.getPhases()[0].getComponents()[i].getdfugdx(j); + tempJ = dij * 1.0 / interphaseSystem.getPhases()[0].getComponent(i).getx() + + interphaseSystem.getPhases()[0].getComponent(i).getdfugdx(j); // tempJ= - // dij*interphaseSystem.getPhases()[0].getComponents()[i].getFugacityCoefficient()+interphaseSystem.getPhases()[0].getComponents()[i].getx()*interphaseSystem.getPhases()[0].getComponents()[i].getdfugdx(j); + // dij*interphaseSystem.getPhases()[0].getComponent(i).getFugacityCoefficient()+interphaseSystem.getPhases()[0].getComponent(i).getx()*interphaseSystem.getPhases()[0].getComponent(i).getdfugdx(j); Jac.set(i, j, tempJ); } } @@ -237,11 +237,11 @@ public void setJacMassTrans() { for (int i = 0; i < bulkSystem.getPhases()[0].getNumberOfMolecularComponents() - 1; i++) { for (int j = 0; j < bulkSystem.getPhases()[0].getNumberOfMolecularComponents(); j++) { dij = i == j ? 1.0 : 0.0; // Kroneckers delta - tempJ = dij * 1.0 / interphaseSystem.getPhases()[1].getComponents()[i].getx() - + interphaseSystem.getPhases()[1].getComponents()[i].getdfugdx(j); + tempJ = dij * 1.0 / interphaseSystem.getPhases()[1].getComponent(i).getx() + + interphaseSystem.getPhases()[1].getComponent(i).getdfugdx(j); // tempJ= - // dij*interphaseSystem.getPhases()[1].getComponents()[i].getFugacityCoefficient()+interphaseSystem.getPhases()[1].getComponents()[i].getx()*interphaseSystem.getPhases()[1].getComponents()[i].getdfugdx(j); + // dij*interphaseSystem.getPhases()[1].getComponent(i).getFugacityCoefficient()+interphaseSystem.getPhases()[1].getComponent(i).getx()*interphaseSystem.getPhases()[1].getComponent(i).getdfugdx(j); Jac.set(i, j + bulkSystem.getPhases()[0].getNumberOfMolecularComponents(), -tempJ); } } @@ -282,8 +282,8 @@ public void setJacMassTrans2() { for (int i = 0; i < bulkSystem.getPhases()[0].getNumberOfMolecularComponents(); i++) { for (int j = 0; j < bulkSystem.getPhases()[0].getNumberOfMolecularComponents(); j++) { dij = i == j ? 1.0 : 0.0; // Kroneckers delta - tempJ = dij * 1.0 / interphaseSystem.getPhases()[0].getComponents()[i].getx() - + interphaseSystem.getPhases()[0].getComponents()[i].getdfugdx(j); + tempJ = dij * 1.0 / interphaseSystem.getPhases()[0].getComponent(i).getx() + + interphaseSystem.getPhases()[0].getComponent(i).getdfugdx(j); Jac.set(i, j, tempJ); } } @@ -300,8 +300,8 @@ public void setJacMassTrans2() { for (int i = 0; i < bulkSystem.getPhases()[0].getNumberOfMolecularComponents(); i++) { for (int j = 0; j < bulkSystem.getPhases()[0].getNumberOfMolecularComponents(); j++) { dij = i == j ? 1.0 : 0.0; // Kroneckers delta - tempJ = dij * 1.0 / interphaseSystem.getPhases()[1].getComponents()[i].getx() - + interphaseSystem.getPhases()[1].getComponents()[i].getdfugdx(j); + tempJ = dij * 1.0 / interphaseSystem.getPhases()[1].getComponent(i).getx() + + interphaseSystem.getPhases()[1].getComponent(i).getdfugdx(j); Jac.set(i, j + bulkSystem.getPhases()[0].getNumberOfMolecularComponents(), -tempJ); } } @@ -368,9 +368,9 @@ public void setJacMassTrans2() { public void setuMassTrans() { for (int i = 0; i < bulkSystem.getPhases()[0].getNumberOfMolecularComponents(); i++) { // System.out.println("i"); - uMassTrans.set(i, 0, interphaseSystem.getPhases()[0].getComponents()[i].getx()); + uMassTrans.set(i, 0, interphaseSystem.getPhases()[0].getComponent(i).getx()); uMassTrans.set(i + bulkSystem.getPhases()[0].getNumberOfMolecularComponents(), 0, - interphaseSystem.getPhases()[1].getComponents()[i].getx()); + interphaseSystem.getPhases()[1].getComponent(i).getx()); } for (int i = 2 * bulkSystem.getPhases()[0].getNumberOfMolecularComponents(); i < 3 @@ -384,8 +384,8 @@ public void setuMassTrans() { @Override public void updateMassTrans() { for (int i = 0; i < bulkSystem.getPhases()[0].getNumberOfMolecularComponents(); i++) { - interphaseSystem.getPhases()[0].getComponents()[i].setx(uMassTrans.get(i, 0)); - interphaseSystem.getPhases()[1].getComponents()[i] + interphaseSystem.getPhases()[0].getComponent(i).setx(uMassTrans.get(i, 0)); + interphaseSystem.getPhases()[1].getComponent(i) .setx(uMassTrans.get(i + bulkSystem.getPhases()[0].getNumberOfMolecularComponents(), 0)); } @@ -400,10 +400,10 @@ public void updateMassTrans() { @Override public void calcMolFractionDifference() { for (int i = 0; i < getBulkSystem().getPhases()[0].getNumberOfMolecularComponents() - 1; i++) { - molFractionDifference[0][i] = bulkSystem.getPhases()[0].getComponents()[i].getx() - - interphaseSystem.getPhases()[0].getComponents()[i].getx(); - molFractionDifference[1][i] = bulkSystem.getPhases()[1].getComponents()[i].getx() - - interphaseSystem.getPhases()[1].getComponents()[i].getx(); + molFractionDifference[0][i] = bulkSystem.getPhases()[0].getComponent(i).getx() + - interphaseSystem.getPhases()[0].getComponent(i).getx(); + molFractionDifference[1][i] = bulkSystem.getPhases()[1].getComponent(i).getx() + - interphaseSystem.getPhases()[1].getComponent(i).getx(); } } @@ -422,7 +422,7 @@ public void calcHeatTransferCoefficients(int phase) { public void calcHeatTransferCorrection(int phase) { double temp = 0; for (int i = 0; i < bulkSystem.getPhases()[0].getNumberOfMolecularComponents(); i++) { - temp += bulkSystem.getPhases()[0].getComponents()[i].getNumberOfMolesInPhase() + temp += bulkSystem.getPhases()[0].getComponent(i).getNumberOfMolesInPhase() * getBulkSystem().getPhases()[phase].getCp() / heatTransferCoefficient[phase]; } heatTransferCorrection[phase] = temp; @@ -456,9 +456,9 @@ public void heatTransSolve() { do { dhtot = 0.0; for (int i = 0; i < bulkSystem.getPhases()[0].getNumberOfMolecularComponents(); i++) { - dhtot += nFlux.get(i, 0) * (bulkSystem.getPhases()[0].getComponents()[i] + dhtot += nFlux.get(i, 0) * (bulkSystem.getPhases()[0].getComponent(i) .getEnthalpy(bulkSystem.getPhases()[0].getTemperature()) - - bulkSystem.getPhases()[1].getComponents()[i] + - bulkSystem.getPhases()[1].getComponent(i) .getEnthalpy(bulkSystem.getPhases()[1].getTemperature())); } diff --git a/src/main/java/neqsim/fluidmechanics/flownode/fluidboundary/heatmasstransfercalc/nonequilibriumfluidboundary/filmmodelboundary/reactivefilmmodel/enhancementfactor/EnhancementFactorAlg.java b/src/main/java/neqsim/fluidmechanics/flownode/fluidboundary/heatmasstransfercalc/nonequilibriumfluidboundary/filmmodelboundary/reactivefilmmodel/enhancementfactor/EnhancementFactorAlg.java index ac87c055ff..0a608b271a 100644 --- a/src/main/java/neqsim/fluidmechanics/flownode/fluidboundary/heatmasstransfercalc/nonequilibriumfluidboundary/filmmodelboundary/reactivefilmmodel/enhancementfactor/EnhancementFactorAlg.java +++ b/src/main/java/neqsim/fluidmechanics/flownode/fluidboundary/heatmasstransfercalc/nonequilibriumfluidboundary/filmmodelboundary/reactivefilmmodel/enhancementfactor/EnhancementFactorAlg.java @@ -75,18 +75,18 @@ public void calcEnhancementVec(int phase) { // enhancementFactor[phase].set(i,j, 1.0); // else{ // double pseudoReacRate = - // reacMatrix[i][j]*fluidBoundary.getBulkSystem().getPhases()[phase].getComponents()[j].getx()*fluidBoundary.getBulkSystem().getPhases()[phase].getDensity()/fluidBoundary.getBulkSystem().getPhases()[phase].getMolarMass()*Math.abs(stocMatrix[i][i]); + // reacMatrix[i][j]*fluidBoundary.getBulkSystem().getPhases()[phase].getComponent(j).getx()*fluidBoundary.getBulkSystem().getPhases()[phase].getDensity()/fluidBoundary.getBulkSystem().getPhases()[phase].getMolarMass()*Math.abs(stocMatrix[i][i]); // hattaNumber[phase].set(i,j,Math.sqrt(pseudoReacRate*fluidBoundary.getBulkSystem().getPhases()[phase].getPhysicalProperties().getEffectiveDiffusionCoefficient(i))/fluidBoundary.getBinaryMassTransferCoefficient(phase,i,j)); // double phiVal = 1.0 + // (fluidBoundary.getBulkSystem().getPhases()[phase].getPhysicalProperties().getEffectiveDiffusionCoefficient(j)/fluidBoundary.getBulkSystem().getPhases()[phase].getPhysicalProperties().getEffectiveDiffusionCoefficient(i))* // (stocMatrix[i][i]/stocMatrix[i][j]) * - // (fluidBoundary.getBulkSystem().getPhases()[phase].getComponents()[j].getx()*fluidBoundary.getBulkSystem().getPhases()[phase].getDensity()/fluidBoundary.getBulkSystem().getPhases()[phase].getMolarMass())/ - // (fluidBoundary.getInterphaseSystem().getPhases()[phase].getComponents()[i].getx()*fluidBoundary.getInterphaseSystem().getPhases()[phase].getDensity()/fluidBoundary.getInterphaseSystem().getPhases()[phase].getMolarMass()); + // (fluidBoundary.getBulkSystem().getPhases()[phase].getComponent(j).getx()*fluidBoundary.getBulkSystem().getPhases()[phase].getDensity()/fluidBoundary.getBulkSystem().getPhases()[phase].getMolarMass())/ + // (fluidBoundary.getInterphaseSystem().getPhases()[phase].getComponent(i).getx()*fluidBoundary.getInterphaseSystem().getPhases()[phase].getDensity()/fluidBoundary.getInterphaseSystem().getPhases()[phase].getMolarMass()); // System.out.println("components " + - // fluidBoundary.getBulkSystem().getPhases()[phase].getComponents()[i].getComponentName() + // fluidBoundary.getBulkSystem().getPhases()[phase].getComponent(i).getComponentName() // + " " + - // fluidBoundary.getBulkSystem().getPhases()[phase].getComponents()[j].getComponentName()); + // fluidBoundary.getBulkSystem().getPhases()[phase].getComponent(j).getComponentName()); // System.out.println("hatta : " + hattaNumber[phase].get(i,j)); // System.out.println("phi : " + phiVal); diff --git a/src/main/java/neqsim/fluidmechanics/flownode/multiphasenode/MultiPhaseFlowNode.java b/src/main/java/neqsim/fluidmechanics/flownode/multiphasenode/MultiPhaseFlowNode.java index ff89d7726d..85ec50594c 100644 --- a/src/main/java/neqsim/fluidmechanics/flownode/multiphasenode/MultiPhaseFlowNode.java +++ b/src/main/java/neqsim/fluidmechanics/flownode/multiphasenode/MultiPhaseFlowNode.java @@ -206,7 +206,7 @@ public void updateMolarFlow() { for (int phase = 0; phase < 2; phase++) { for (int i = 0; i < getBulkSystem().getPhases()[0].getNumberOfComponents(); i++) { getBulkSystem().getPhases()[phase].addMoles(i, - (getBulkSystem().getPhases()[phase].getComponents()[i].getx() * (molarFlowRate[phase] + (getBulkSystem().getPhases()[phase].getComponent(i).getx() * (molarFlowRate[phase] - getBulkSystem().getPhases()[phase].getNumberOfMolesInPhase()))); } } diff --git a/src/main/java/neqsim/fluidmechanics/flownode/onephasenode/onePhaseFlowNode.java b/src/main/java/neqsim/fluidmechanics/flownode/onephasenode/onePhaseFlowNode.java index a158d05ad7..4d2603309a 100644 --- a/src/main/java/neqsim/fluidmechanics/flownode/onephasenode/onePhaseFlowNode.java +++ b/src/main/java/neqsim/fluidmechanics/flownode/onephasenode/onePhaseFlowNode.java @@ -61,7 +61,7 @@ public onePhaseFlowNode clone() { @Override public void increaseMolarRate(double moles) { for (int i = 0; i < getBulkSystem().getPhases()[0].getNumberOfComponents(); i++) { - double diff = (getBulkSystem().getPhases()[0].getComponents()[i].getx() + double diff = (getBulkSystem().getPhases()[0].getComponent(i).getx() * (molarFlowRate[0] - getBulkSystem().getPhases()[0].getNumberOfMolesInPhase())); getBulkSystem().addComponent(getBulkSystem().getPhase(0).getComponent(i).getComponentName(), diff); @@ -87,7 +87,7 @@ public void initFlowCalc() { @Override public void updateMolarFlow() { for (int i = 0; i < getBulkSystem().getPhases()[0].getNumberOfComponents(); i++) { - double diff = (getBulkSystem().getPhases()[0].getComponents()[i].getx() + double diff = (getBulkSystem().getPhases()[0].getComponent(i).getx() * (molarFlowRate[0] - getBulkSystem().getPhases()[0].getNumberOfMolesInPhase())); getBulkSystem().addComponent(getBulkSystem().getPhase(0).getComponent(i).getComponentName(), diff); diff --git a/src/main/java/neqsim/fluidmechanics/flownode/twophasenode/TwoPhaseFlowNode.java b/src/main/java/neqsim/fluidmechanics/flownode/twophasenode/TwoPhaseFlowNode.java index ee486cf2d6..1054f6b849 100644 --- a/src/main/java/neqsim/fluidmechanics/flownode/twophasenode/TwoPhaseFlowNode.java +++ b/src/main/java/neqsim/fluidmechanics/flownode/twophasenode/TwoPhaseFlowNode.java @@ -228,7 +228,7 @@ public void updateMolarFlow() { for (int i = 0; i < getBulkSystem().getPhases()[0].getNumberOfComponents(); i++) { if (molarFlowRate[phase] > 1e-100) { getBulkSystem().getPhases()[phase].addMoles(i, - (getBulkSystem().getPhases()[phase].getComponents()[i].getx() * (molarFlowRate[phase] + (getBulkSystem().getPhases()[phase].getComponent(i).getx() * (molarFlowRate[phase] - getBulkSystem().getPhases()[phase].getNumberOfMolesInPhase()))); } } 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 80c256f2e5..198da3b5d6 100644 --- a/src/main/java/neqsim/fluidmechanics/flowsolver/onephaseflowsolver/onephasepipeflowsolver/OnePhaseFixedStaggeredGrid.java +++ b/src/main/java/neqsim/fluidmechanics/flowsolver/onephaseflowsolver/onephasepipeflowsolver/OnePhaseFixedStaggeredGrid.java @@ -184,8 +184,8 @@ public void initMatrix() { for (int j = 0; j < pipe.getNode(i).getBulkSystem().getPhases()[0] .getNumberOfComponents(); j++) { sol4Matrix[j].set(i, 0, - pipe.getNode(i).getBulkSystem().getPhases()[0].getComponents()[j].getx() - * pipe.getNode(i).getBulkSystem().getPhases()[0].getComponents()[j].getMolarMass() + pipe.getNode(i).getBulkSystem().getPhases()[0].getComponent(j).getx() + * pipe.getNode(i).getBulkSystem().getPhases()[0].getComponent(j).getMolarMass() / pipe.getNode(i).getBulkSystem().getPhases()[0].getMolarMass()); } } @@ -283,10 +283,10 @@ public void initComposition(int iter) { for (int j = 1; j < numberOfNodes; j++) { for (int p = 0; p < pipe.getNode(0).getBulkSystem().getPhases()[0] .getNumberOfComponents(); p++) { - pipe.getNode(j).getBulkSystem().getPhases()[0].getComponents()[p].setx( + pipe.getNode(j).getBulkSystem().getPhases()[0].getComponent(p).setx( sol4Matrix[p].get(j, 0) * pipe.getNode(j).getBulkSystem().getPhases()[0].getMolarMass() - / pipe.getNode(j).getBulkSystem().getPhases()[0].getComponents()[p].getMolarMass()); - // pipe.getNode(j).getBulkSystem().getPhases()[0].getComponents()[p].getx() + + / pipe.getNode(j).getBulkSystem().getPhases()[0].getComponent(p).getMolarMass()); + // pipe.getNode(j).getBulkSystem().getPhases()[0].getComponent(p).getx() + // 0.5*diff4Matrix[p].get(j,0)); } @@ -690,8 +690,8 @@ public void initFinalResults() { for (int j = 0; j < pipe.getNode(i).getBulkSystem().getPhases()[0] .getNumberOfComponents(); j++) { oldComposition[j][i] = sol4Matrix[j].get(i, 0); - // pipe.getNode(i).getBulkSystem().getPhases()[0].getComponents()[j].getx() * - // pipe.getNode(i).getBulkSystem().getPhases()[0].getComponents()[j].getMolarMass() / + // pipe.getNode(i).getBulkSystem().getPhases()[0].getComponent(j).getx() * + // pipe.getNode(i).getBulkSystem().getPhases()[0].getComponent(j).getMolarMass() / // pipe.getNode(i).getBulkSystem().getPhases()[0].getMolarMass(); } } 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 6dbcf74143..d9611c235a 100644 --- a/src/main/java/neqsim/fluidmechanics/flowsolver/twophaseflowsolver/stirredcellsolver/StirredCellSolver.java +++ b/src/main/java/neqsim/fluidmechanics/flowsolver/twophaseflowsolver/stirredcellsolver/StirredCellSolver.java @@ -151,13 +151,13 @@ public void initProfiles() { pipe.getNode(i + 1).initFlowCalc(); System.out.println( - "x " + pipe.getNode(i - 1).getBulkSystem().getPhases()[1].getComponents()[0].getx()); + "x " + pipe.getNode(i - 1).getBulkSystem().getPhases()[1].getComponent(0).getx()); System.out.println( - "x " + pipe.getNode(i - 1).getBulkSystem().getPhases()[1].getComponents()[1].getx()); + "x " + pipe.getNode(i - 1).getBulkSystem().getPhases()[1].getComponent(1).getx()); System.out.println( - "y " + pipe.getNode(i - 1).getBulkSystem().getPhases()[0].getComponents()[0].getx()); + "y " + pipe.getNode(i - 1).getBulkSystem().getPhases()[0].getComponent(0).getx()); System.out.println( - "y " + pipe.getNode(i - 1).getBulkSystem().getPhases()[0].getComponents()[1].getx()); + "y " + pipe.getNode(i - 1).getBulkSystem().getPhases()[0].getComponent(1).getx()); } pipe.getNode(numberOfNodes - 1).init(); pipe.getNode(numberOfNodes - 1).calcFluxes(); @@ -194,8 +194,8 @@ public void initMatrix() { for (int j = 0; j < pipe.getNode(i).getBulkSystem().getPhases()[0] .getNumberOfComponents(); j++) { solMolFracMatrix[phase][j].set(i, 0, - pipe.getNode(i).getBulkSystem().getPhases()[phase].getComponents()[j].getx() - * pipe.getNode(i).getBulkSystem().getPhases()[phase].getComponents()[j] + pipe.getNode(i).getBulkSystem().getPhases()[phase].getComponent(j).getx() + * pipe.getNode(i).getBulkSystem().getPhases()[phase].getComponent(j) .getMolarMass() / pipe.getNode(i).getBulkSystem().getPhases()[phase].getMolarMass()); } @@ -303,14 +303,14 @@ public void initComposition(int phase, int comp) { * pipe.getNode(j).getBulkSystem().getPhases()[phase].getMolarMass() / pipe.getNode(j).getBulkSystem().getPhases()[phase].getComponents()[comp] .getMolarMass()); - // pipe.getNode(j).getBulkSystem().getPhases()[0].getComponents()[p].getx() + + // pipe.getNode(j).getBulkSystem().getPhases()[0].getComponent(p).getx() + // 0.5*diff4Matrix[p].get(j,0)); } double xSum = 0.0; for (int i = 0; i < pipe.getNode(j).getBulkSystem().getPhases()[phase].getNumberOfComponents() - 1; i++) { - xSum += pipe.getNode(j).getBulkSystem().getPhases()[phase].getComponents()[i].getx(); + xSum += pipe.getNode(j).getBulkSystem().getPhases()[phase].getComponent(i).getx(); } pipe.getNode(j).getBulkSystem().getPhases()[phase] 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 9bbee4dff9..c3154f411b 100644 --- a/src/main/java/neqsim/fluidmechanics/flowsolver/twophaseflowsolver/twophasepipeflowsolver/TwoPhaseFixedStaggeredGridSolver.java +++ b/src/main/java/neqsim/fluidmechanics/flowsolver/twophaseflowsolver/twophasepipeflowsolver/TwoPhaseFixedStaggeredGridSolver.java @@ -215,8 +215,8 @@ public void initMatrix() { for (int j = 0; j < pipe.getNode(i).getBulkSystem().getPhases()[0] .getNumberOfComponents(); j++) { solMolFracMatrix[phase][j].set(i, 0, - pipe.getNode(i).getBulkSystem().getPhases()[phase].getComponents()[j].getx() - * pipe.getNode(i).getBulkSystem().getPhases()[phase].getComponents()[j] + pipe.getNode(i).getBulkSystem().getPhases()[phase].getComponent(j).getx() + * pipe.getNode(i).getBulkSystem().getPhases()[phase].getComponent(j) .getMolarMass() / pipe.getNode(i).getBulkSystem().getPhases()[phase].getMolarMass()); } @@ -324,14 +324,14 @@ public void initComposition(int phase, int comp) { * pipe.getNode(j).getBulkSystem().getPhases()[phase].getMolarMass() / pipe.getNode(j).getBulkSystem().getPhases()[phase].getComponents()[comp] .getMolarMass()); - // pipe.getNode(j).getBulkSystem().getPhases()[0].getComponents()[p].getx() + // pipe.getNode(j).getBulkSystem().getPhases()[0].getComponent(p).getx() // + 0.5*diff4Matrix[p].get(j,0)); } double xSum = 0.0; for (int i = 0; i < pipe.getNode(j).getBulkSystem().getPhases()[phase].getNumberOfComponents() - 1; i++) { - xSum += pipe.getNode(j).getBulkSystem().getPhases()[phase].getComponents()[i].getx(); + xSum += pipe.getNode(j).getBulkSystem().getPhases()[phase].getComponent(i).getx(); } pipe.getNode(j).getBulkSystem().getPhases()[phase] @@ -961,8 +961,8 @@ public void initFinalResults(int phase) { for (int j = 0; j < pipe.getNode(i).getBulkSystem().getPhases()[0] .getNumberOfComponents(); j++) { oldComposition[phase][j][i] = xNew[phase][j][i]; - // pipe.getNode(i).getBulkSystem().getPhases()[0].getComponents()[j].getx() * - // pipe.getNode(i).getBulkSystem().getPhases()[0].getComponents()[j].getMolarMass() / + // pipe.getNode(i).getBulkSystem().getPhases()[0].getComponent(j).getx() * + // pipe.getNode(i).getBulkSystem().getPhases()[0].getComponent(j).getMolarMass() / // pipe.getNode(i).getBulkSystem().getPhases()[0].getMolarMass(); } } diff --git a/src/main/java/neqsim/fluidmechanics/flowsystem/FlowSystem.java b/src/main/java/neqsim/fluidmechanics/flowsystem/FlowSystem.java index 9c9fbeee55..31e43cffaf 100644 --- a/src/main/java/neqsim/fluidmechanics/flowsystem/FlowSystem.java +++ b/src/main/java/neqsim/fluidmechanics/flowsystem/FlowSystem.java @@ -311,7 +311,7 @@ public void print() { + flowNode[i].getMassFlowRate(0) + " velocity: " + flowNode[i].getVelocity() + " reynolds number " + flowNode[i].getReynoldsNumber() + " friction : " + flowNode[i].getWallFrictionFactor() + " x1 : " - + flowNode[i].getBulkSystem().getPhases()[0].getComponents()[1].getx()); + + flowNode[i].getBulkSystem().getPhases()[0].getComponent(1).getx()); } } diff --git a/src/main/java/neqsim/fluidmechanics/util/fluidmechanicsvisualization/flownodevisualization/onephaseflownodevisualization/onephasepipeflownodevisualization/OnePhasePipeFlowNodeVisualization.java b/src/main/java/neqsim/fluidmechanics/util/fluidmechanicsvisualization/flownodevisualization/onephaseflownodevisualization/onephasepipeflownodevisualization/OnePhasePipeFlowNodeVisualization.java index 5cd56b5941..72fe0f7dc5 100644 --- a/src/main/java/neqsim/fluidmechanics/util/fluidmechanicsvisualization/flownodevisualization/onephaseflownodevisualization/onephasepipeflownodevisualization/OnePhasePipeFlowNodeVisualization.java +++ b/src/main/java/neqsim/fluidmechanics/util/fluidmechanicsvisualization/flownodevisualization/onephaseflownodevisualization/onephasepipeflownodevisualization/OnePhasePipeFlowNodeVisualization.java @@ -32,7 +32,7 @@ public void setData(FlowNodeInterface node) { bulkComposition = new double[2][node.getBulkSystem().getPhases()[0].getNumberOfComponents()]; for (int i = 0; i < node.getBulkSystem().getPhases()[0].getNumberOfComponents(); i++) { - bulkComposition[0][i] = node.getBulkSystem().getPhases()[0].getComponents()[i].getx(); + bulkComposition[0][i] = node.getBulkSystem().getPhases()[0].getComponent(i).getx(); } } } diff --git a/src/main/java/neqsim/fluidmechanics/util/fluidmechanicsvisualization/flownodevisualization/twophaseflownodevisualization/TwoPhaseFlowNodeVisualization.java b/src/main/java/neqsim/fluidmechanics/util/fluidmechanicsvisualization/flownodevisualization/twophaseflownodevisualization/TwoPhaseFlowNodeVisualization.java index c58c8eca73..262652a756 100644 --- a/src/main/java/neqsim/fluidmechanics/util/fluidmechanicsvisualization/flownodevisualization/twophaseflownodevisualization/TwoPhaseFlowNodeVisualization.java +++ b/src/main/java/neqsim/fluidmechanics/util/fluidmechanicsvisualization/flownodevisualization/twophaseflownodevisualization/TwoPhaseFlowNodeVisualization.java @@ -33,8 +33,8 @@ public void setData(FlowNodeInterface node) { molarFlux = new double[2][node.getBulkSystem().getPhases()[0].getNumberOfComponents()]; for (int i = 0; i < node.getBulkSystem().getPhases()[0].getNumberOfComponents(); i++) { - bulkComposition[0][i] = node.getBulkSystem().getPhases()[0].getComponents()[i].getx(); - bulkComposition[1][i] = node.getBulkSystem().getPhases()[1].getComponents()[i].getx(); + bulkComposition[0][i] = node.getBulkSystem().getPhases()[0].getComponent(i).getx(); + bulkComposition[1][i] = node.getBulkSystem().getPhases()[1].getComponent(i).getx(); effectiveMassTransferCoefficient[1][i] = node.getFluidBoundary().getEffectiveMassTransferCoefficient(1, i); effectiveMassTransferCoefficient[0][i] = @@ -43,9 +43,9 @@ public void setData(FlowNodeInterface node) { effectiveSchmidtNumber[1][i] = node.getEffectiveSchmidtNumber(1, i); // System.out.println("sc " + effectiveSchmidtNumber[1][i]); interfaceComposition[0][i] = - node.getFluidBoundary().getInterphaseSystem().getPhases()[0].getComponents()[i].getx(); + node.getFluidBoundary().getInterphaseSystem().getPhases()[0].getComponent(i).getx(); interfaceComposition[1][i] = - node.getFluidBoundary().getInterphaseSystem().getPhases()[1].getComponents()[i].getx(); + node.getFluidBoundary().getInterphaseSystem().getPhases()[1].getComponent(i).getx(); molarFlux[0][i] = node.getFluidBoundary().getInterphaseMolarFlux(i); molarFlux[1][i] = node.getFluidBoundary().getInterphaseMolarFlux(i); } diff --git a/src/main/java/neqsim/mathlib/nonlinearsolver/SysNewtonRhapson.java b/src/main/java/neqsim/mathlib/nonlinearsolver/SysNewtonRhapson.java index 45f7f193e3..25789e61ba 100644 --- a/src/main/java/neqsim/mathlib/nonlinearsolver/SysNewtonRhapson.java +++ b/src/main/java/neqsim/mathlib/nonlinearsolver/SysNewtonRhapson.java @@ -85,13 +85,13 @@ public SysNewtonRhapson(SystemInterface system, int numberOfPhases, int numberOf public void setfvec() { for (int i = 0; i < numberOfComponents; i++) { fvec.set(i, 0, - u.get(i, 0) + Math.log(system.getPhases()[1].getComponents()[i].getFugacityCoefficient() - / system.getPhases()[0].getComponents()[i].getFugacityCoefficient())); + u.get(i, 0) + Math.log(system.getPhases()[1].getComponent(i).getFugacityCoefficient() + / system.getPhases()[0].getComponent(i).getFugacityCoefficient())); } double fsum = 0.0; for (int i = 0; i < numberOfComponents; i++) { - fsum = fsum + system.getPhases()[1].getComponents()[i].getx() - - system.getPhases()[0].getComponents()[i].getx(); + fsum = fsum + system.getPhases()[1].getComponent(i).getx() + - system.getPhases()[0].getComponent(i).getx(); } fvec.set(numberOfComponents, 0, fsum); fvec.set(numberOfComponents + 1, 0, 0.0); @@ -109,17 +109,17 @@ public void findSpecEqInit() { int speceqmin = 0; for (int i = 0; i < numberOfComponents; i++) { - if (system.getPhases()[0].getComponents()[i] - .getTC() > system.getPhases()[0].getComponents()[speceq].getTC()) { - speceq = system.getPhases()[0].getComponents()[i].getComponentNumber(); + if (system.getPhases()[0].getComponent(i).getTC() > system.getPhases()[0].getComponent(speceq) + .getTC()) { + speceq = system.getPhases()[0].getComponent(i).getComponentNumber(); } - if (system.getPhases()[0].getComponents()[i] - .getTC() < system.getPhases()[0].getComponents()[speceq].getTC()) { - speceqmin = system.getPhases()[0].getComponents()[i].getComponentNumber(); + if (system.getPhases()[0].getComponent(i).getTC() < system.getPhases()[0].getComponent(speceq) + .getTC()) { + speceqmin = system.getPhases()[0].getComponent(i).getComponentNumber(); } } - avscp = (system.getPhases()[0].getComponents()[speceq].getTC() - - system.getPhases()[0].getComponents()[speceqmin].getTC()) / 2000; + avscp = (system.getPhases()[0].getComponent(speceq).getTC() + - system.getPhases()[0].getComponent(speceqmin).getTC()) / 2000; System.out.println("avscp: " + avscp); dTmax = avscp * 3; dPmax = avscp * 1.5; @@ -153,26 +153,26 @@ public void setJac() { double tempJ = 0.0; int nofc = numberOfComponents; for (int i = 0; i < numberOfComponents; i++) { - dxidlnk[i] = -system.getBeta() * system.getPhases()[0].getComponents()[i].getx() - * system.getPhases()[1].getComponents()[i].getx() - / system.getPhases()[0].getComponents()[i].getz(); - dyidlnk[i] = system.getPhases()[1].getComponents()[i].getx() - + system.getPhases()[0].getComponents()[i].getK() * dxidlnk[i]; + dxidlnk[i] = -system.getBeta() * system.getPhases()[0].getComponent(i).getx() + * system.getPhases()[1].getComponent(i).getx() + / system.getPhases()[0].getComponent(i).getz(); + dyidlnk[i] = system.getPhases()[1].getComponent(i).getx() + + system.getPhases()[0].getComponent(i).getK() * dxidlnk[i]; // System.out.println("dxidlnk("+i+") "+dxidlnk[i]); // System.out.println("dyidlnk("+i+") "+dyidlnk[i]); } for (int i = 0; i < numberOfComponents; i++) { for (int j = 0; j < numberOfComponents; j++) { dij = i == j ? 1.0 : 0.0; // Kroneckers delta - tempJ = dij + system.getPhases()[1].getComponents()[i].getdfugdx(j) * dyidlnk[j] - - system.getPhases()[0].getComponents()[i].getdfugdx(j) * dxidlnk[j]; + tempJ = dij + system.getPhases()[1].getComponent(i).getdfugdx(j) * dyidlnk[j] + - system.getPhases()[0].getComponent(i).getdfugdx(j) * dxidlnk[j]; Jac.set(i, j, tempJ); } - tempJ = system.getTemperature() * (system.getPhases()[1].getComponents()[i].getdfugdt() - - system.getPhases()[0].getComponents()[i].getdfugdt()); + tempJ = system.getTemperature() * (system.getPhases()[1].getComponent(i).getdfugdt() + - system.getPhases()[0].getComponent(i).getdfugdt()); Jac.set(i, nofc, tempJ); - tempJ = system.getPressure() * (system.getPhases()[1].getComponents()[i].getdfugdp() - - system.getPhases()[0].getComponents()[i].getdfugdp()); + tempJ = system.getPressure() * (system.getPhases()[1].getComponent(i).getdfugdp() + - system.getPhases()[0].getComponent(i).getdfugdp()); Jac.set(i, nofc + 1, tempJ); Jac.set(nofc, i, dyidlnk[i] - dxidlnk[i]); } @@ -186,7 +186,7 @@ public void setJac() { */ public void setu() { for (int i = 0; i < numberOfComponents; i++) { - u.set(i, 0, Math.log(system.getPhases()[0].getComponents()[i].getK())); + u.set(i, 0, Math.log(system.getPhases()[0].getComponent(i).getK())); } u.set(numberOfComponents, 0, Math.log(system.getTemperature())); u.set(numberOfComponents + 1, 0, Math.log(system.getPressure())); @@ -199,8 +199,8 @@ public void setu() { */ public void init() { for (int i = 0; i < numberOfComponents; i++) { - system.getPhases()[0].getComponents()[i].setK(Math.exp(u.get(i, 0))); - system.getPhases()[1].getComponents()[i].setK(Math.exp(u.get(i, 0))); + system.getPhases()[0].getComponent(i).setK(Math.exp(u.get(i, 0))); + system.getPhases()[1].getComponent(i).setK(Math.exp(u.get(i, 0))); } system.setTemperature(Math.exp(u.get(numberOfComponents, 0))); system.setPressure(Math.exp(u.get(numberOfComponents + 1, 0))); diff --git a/src/main/java/neqsim/physicalproperties/methods/commonphasephysicalproperties/diffusivity/CorrespondingStatesDiffusivity.java b/src/main/java/neqsim/physicalproperties/methods/commonphasephysicalproperties/diffusivity/CorrespondingStatesDiffusivity.java index 90aca812ac..6f6018617f 100644 --- a/src/main/java/neqsim/physicalproperties/methods/commonphasephysicalproperties/diffusivity/CorrespondingStatesDiffusivity.java +++ b/src/main/java/neqsim/physicalproperties/methods/commonphasephysicalproperties/diffusivity/CorrespondingStatesDiffusivity.java @@ -36,10 +36,10 @@ public double calcBinaryDiffusionCoefficient(int i, int j, int method) { if (phase.getPhase().getType() == PhaseType.LIQUID) { binaryDiffusionCoefficients[i][j] = 1.0e-4 * 9.89e-8 * Math.pow(phase.getViscosity() * 1e3, -0.907) - * Math.pow(1.0 / phase.getPhase().getComponents()[i].getNormalLiquidDensity() - * phase.getPhase().getComponents()[i].getMolarMass() * 1000, -0.45) - * Math.pow(1.0 / phase.getPhase().getComponents()[j].getNormalLiquidDensity() - * phase.getPhase().getComponents()[j].getMolarMass() * 1000, 0.265) + * Math.pow(1.0 / phase.getPhase().getComponent(i).getNormalLiquidDensity() + * phase.getPhase().getComponent(i).getMolarMass() * 1000, -0.45) + * Math.pow(1.0 / phase.getPhase().getComponent(j).getNormalLiquidDensity() + * phase.getPhase().getComponent(j).getMolarMass() * 1000, 0.265) * phase.getPhase().getTemperature(); // System.out.println("liq diffusivity " +binaryDiffusionCoefficients[i][j] // ); diff --git a/src/main/java/neqsim/physicalproperties/methods/commonphasephysicalproperties/diffusivity/Diffusivity.java b/src/main/java/neqsim/physicalproperties/methods/commonphasephysicalproperties/diffusivity/Diffusivity.java index 2a279b0acd..2fa6d305ce 100644 --- a/src/main/java/neqsim/physicalproperties/methods/commonphasephysicalproperties/diffusivity/Diffusivity.java +++ b/src/main/java/neqsim/physicalproperties/methods/commonphasephysicalproperties/diffusivity/Diffusivity.java @@ -89,10 +89,10 @@ public void calcEffectiveDiffusionCoefficients() { if (i == j) { continue; } else { - sum += phase.getPhase().getComponents()[j].getx() / binaryDiffusionCoefficients[i][j]; + sum += phase.getPhase().getComponent(j).getx() / binaryDiffusionCoefficients[i][j]; } } - effectiveDiffusionCoefficient[i] = (1.0 - phase.getPhase().getComponents()[i].getx()) / sum; + effectiveDiffusionCoefficient[i] = (1.0 - phase.getPhase().getComponent(i).getx()) / sum; } } @@ -113,8 +113,8 @@ public double getEffectiveDiffusionCoefficient(int i) { public double getMaxwellStefanBinaryDiffusionCoefficient(int i, int j) { /* * double temp = (i==j)? 1.0: 0.0; double nonIdealCorrection = temp + - * gasPhase.getPhase().getComponents()[i].getx() * - * gasPhase.getPhase().getComponents()[i].getdfugdn(j) * + * gasPhase.getPhase().getComponent(i).getx() * + * gasPhase.getPhase().getComponent(i).getdfugdn(j) * * gasPhase.getPhase().getNumberOfMolesInPhase(); if (Double.isNaN(nonIdealCorrection)) * nonIdealCorrection=1.0; return binaryDiffusionCoefficients[i][j]/nonIdealCorrection; // shuld * be divided by non ideality factor diff --git a/src/main/java/neqsim/physicalproperties/methods/commonphasephysicalproperties/viscosity/FrictionTheoryViscosityMethod.java b/src/main/java/neqsim/physicalproperties/methods/commonphasephysicalproperties/viscosity/FrictionTheoryViscosityMethod.java index c14cf4ae7e..84c54b952a 100644 --- a/src/main/java/neqsim/physicalproperties/methods/commonphasephysicalproperties/viscosity/FrictionTheoryViscosityMethod.java +++ b/src/main/java/neqsim/physicalproperties/methods/commonphasephysicalproperties/viscosity/FrictionTheoryViscosityMethod.java @@ -211,10 +211,10 @@ public void initChungPureComponentViscosity() { double E = 2.16178; double F = 2.43787; for (int i = 0; i < phase.getPhase().getNumberOfComponents(); i++) { - Fc[i] = 1.0 - 0.2756 * phase.getPhase().getComponents()[i].getAcentricFactor(); + Fc[i] = 1.0 - 0.2756 * phase.getPhase().getComponent(i).getAcentricFactor(); tempVar = - 1.2593 * phase.getPhase().getTemperature() / phase.getPhase().getComponents()[i].getTC(); + 1.2593 * phase.getPhase().getTemperature() / phase.getPhase().getComponent(i).getTC(); // eq. 9.4.3 TPoLG double varLast = -6.435e-4 * Math.pow(tempVar, 0.14874) * Math.sin(18.0323 * Math.pow(tempVar, -0.76830) - 7.27371); @@ -223,11 +223,11 @@ public void initChungPureComponentViscosity() { + E / Math.exp(F * tempVar) + varLast; // double critVol = 0.000235751e6+ - // 1e4*3.4277*(phase.getPhase().getComponents()[i].getPC()/(R*phase.getPhase().getComponents()[i].getTC())); - double critVol = phase.getPhase().getPhase().getComponents()[i].getCriticalVolume(); + // 1e4*3.4277*(phase.getPhase().getComponent(i).getPC()/(R*phase.getPhase().getComponent(i).getTC())); + double critVol = phase.getPhase().getPhase().getComponent(i).getCriticalVolume(); pureComponentViscosity[i] = 40.785 - * Math.sqrt(phase.getPhase().getComponents()[i].getMolarMass() * 1000.0 + * Math.sqrt(phase.getPhase().getComponent(i).getMolarMass() * 1000.0 * phase.getPhase().getTemperature()) / (Math.pow(critVol, 2.0 / 3.0) * omegaVisc[i]) * Fc[i]; // logger.info("visk " + pureComponentViscosity[i]); diff --git a/src/main/java/neqsim/physicalproperties/methods/commonphasephysicalproperties/viscosity/Viscosity.java b/src/main/java/neqsim/physicalproperties/methods/commonphasephysicalproperties/viscosity/Viscosity.java index 7dc3e76f77..3981f8a968 100644 --- a/src/main/java/neqsim/physicalproperties/methods/commonphasephysicalproperties/viscosity/Viscosity.java +++ b/src/main/java/neqsim/physicalproperties/methods/commonphasephysicalproperties/viscosity/Viscosity.java @@ -37,36 +37,36 @@ public Viscosity(PhysicalProperties phase) { public void calcPureComponentViscosity() { pureComponentViscosity = new double[phase.getPhase().getNumberOfComponents()]; for (int i = 0; i < phase.getPhase().getNumberOfComponents(); i++) { - if (phase.getPhase().getTemperature() > phase.getPhase().getComponents()[i].getTC()) { + if (phase.getPhase().getTemperature() > phase.getPhase().getComponent(i).getTC()) { pureComponentViscosity[i] = 5.0e-1; - } else if (phase.getPhase().getComponents()[i].getLiquidViscosityModel() == 1) { + } else if (phase.getPhase().getComponent(i).getLiquidViscosityModel() == 1) { pureComponentViscosity[i] = - phase.getPhase().getComponents()[i].getLiquidViscosityParameter(0) + phase.getPhase().getComponent(i).getLiquidViscosityParameter(0) * Math.pow(phase.getPhase().getTemperature(), - phase.getPhase().getComponents()[i].getLiquidViscosityParameter(1)); - } else if (phase.getPhase().getComponents()[i].getLiquidViscosityModel() == 2) { - } else if (phase.getPhase().getComponents()[i].getLiquidViscosityModel() == 3) { + phase.getPhase().getComponent(i).getLiquidViscosityParameter(1)); + } else if (phase.getPhase().getComponent(i).getLiquidViscosityModel() == 2) { + } else if (phase.getPhase().getComponent(i).getLiquidViscosityModel() == 3) { pureComponentViscosity[i] = - Math.exp(phase.getPhase().getComponents()[i].getLiquidViscosityParameter(0) - + phase.getPhase().getComponents()[i].getLiquidViscosityParameter(1) + Math.exp(phase.getPhase().getComponent(i).getLiquidViscosityParameter(0) + + phase.getPhase().getComponent(i).getLiquidViscosityParameter(1) / phase.getPhase().getTemperature() - + phase.getPhase().getComponents()[i].getLiquidViscosityParameter(2) + + phase.getPhase().getComponent(i).getLiquidViscosityParameter(2) * phase.getPhase().getTemperature() - + phase.getPhase().getComponents()[i].getLiquidViscosityParameter(3) + + phase.getPhase().getComponent(i).getLiquidViscosityParameter(3) * Math.pow(phase.getPhase().getTemperature(), 2)); - } else if (phase.getPhase().getComponents()[i].getLiquidViscosityModel() == 4) { + } else if (phase.getPhase().getComponent(i).getLiquidViscosityModel() == 4) { pureComponentViscosity[i] = Math.pow(10, - phase.getPhase().getComponents()[i].getLiquidViscosityParameter(0) + phase.getPhase().getComponent(i).getLiquidViscosityParameter(0) * (1.0 / phase.getPhase().getTemperature() - - 1.0 / phase.getPhase().getComponents()[i].getLiquidViscosityParameter(1))); - // phase.getPhase().getComponents()[i].getLiquidViscosityParameter(2) * - // phase.getPhase().getTemperature()+phase.getPhase().getComponents()[i].getLiquidViscosityParameter(3) + - 1.0 / phase.getPhase().getComponent(i).getLiquidViscosityParameter(1))); + // phase.getPhase().getComponent(i).getLiquidViscosityParameter(2) * + // phase.getPhase().getTemperature()+phase.getPhase().getComponent(i).getLiquidViscosityParameter(3) // / - // phase.getPhase().getTemperature()+phase.getPhase().getComponents()[i].getLiquidViscosityParameter(3) + // phase.getPhase().getTemperature()+phase.getPhase().getComponent(i).getLiquidViscosityParameter(3) // * Math.pow(phase.getPhase().getTemperature(),2)); } else { // System.out.println("no pure component viscosity model defined for component " - // + phase.getPhase().getComponents()[i].getComponentName()); + // + phase.getPhase().getComponent(i).getComponentName()); pureComponentViscosity[i] = 7.0e-1; } pureComponentViscosity[i] *= ((getViscosityPressureCorrection(i) + 1.0) / 2.0); diff --git a/src/main/java/neqsim/physicalproperties/methods/gasphysicalproperties/GasPhysicalPropertyMethod.java b/src/main/java/neqsim/physicalproperties/methods/gasphysicalproperties/GasPhysicalPropertyMethod.java index 8fd20b1b75..d883dfc411 100644 --- a/src/main/java/neqsim/physicalproperties/methods/gasphysicalproperties/GasPhysicalPropertyMethod.java +++ b/src/main/java/neqsim/physicalproperties/methods/gasphysicalproperties/GasPhysicalPropertyMethod.java @@ -38,17 +38,14 @@ public GasPhysicalPropertyMethod(PhysicalProperties gasPhase) { for (int i = 0; i < gasPhase.getPhase().getNumberOfComponents(); i++) { for (int j = 0; j < gasPhase.getPhase().getNumberOfComponents(); j++) { binaryMolecularMass[i][j] = - 2.0 * Math - .pow( - (1.0 / gasPhase.getPhase().getComponents()[i].getMolarMass() / 1000.0 - + 1.0 / gasPhase.getPhase().getComponents()[j].getMolarMass() / 1000.0), - -1.0); + 2.0 * Math.pow((1.0 / gasPhase.getPhase().getComponent(i).getMolarMass() / 1000.0 + + 1.0 / gasPhase.getPhase().getComponent(j).getMolarMass() / 1000.0), -1.0); binaryMolecularDiameter[i][j] = - (gasPhase.getPhase().getComponents()[i].getLennardJonesMolecularDiameter() - + gasPhase.getPhase().getComponents()[j].getLennardJonesMolecularDiameter()) / 2.0; + (gasPhase.getPhase().getComponent(i).getLennardJonesMolecularDiameter() + + gasPhase.getPhase().getComponent(j).getLennardJonesMolecularDiameter()) / 2.0; binaryEnergyParameter[i][j] = - Math.pow(gasPhase.getPhase().getComponents()[i].getLennardJonesEnergyParameter() - * gasPhase.getPhase().getComponents()[j].getLennardJonesEnergyParameter(), 0.5); + Math.pow(gasPhase.getPhase().getComponent(i).getLennardJonesEnergyParameter() + * gasPhase.getPhase().getComponent(j).getLennardJonesEnergyParameter(), 0.5); } } } diff --git a/src/main/java/neqsim/physicalproperties/methods/gasphysicalproperties/conductivity/ChungConductivityMethod.java b/src/main/java/neqsim/physicalproperties/methods/gasphysicalproperties/conductivity/ChungConductivityMethod.java index 99b318f0d3..3e359b4418 100644 --- a/src/main/java/neqsim/physicalproperties/methods/gasphysicalproperties/conductivity/ChungConductivityMethod.java +++ b/src/main/java/neqsim/physicalproperties/methods/gasphysicalproperties/conductivity/ChungConductivityMethod.java @@ -39,18 +39,16 @@ public double calcConductivity() { for (int j = 0; j < gasPhase.getPhase().getNumberOfComponents(); j++) { // Aij from Mason Saxena method double Aij = 1.0 - * Math - .pow( - 1.0 + Math.sqrt(pureComponentConductivity[i] / pureComponentConductivity[j]) - * Math.pow(gasPhase.getPhase().getComponents()[i].getMolarMass() - / gasPhase.getPhase().getComponents()[j].getMolarMass(), 1.0 / 4.0), - 2.0) - / Math.sqrt(8.0 * (1.0 + gasPhase.getPhase().getComponents()[i].getMolarMass() - / gasPhase.getPhase().getComponents()[j].getMolarMass())); - tempVar += gasPhase.getPhase().getComponents()[j].getx() * Aij; + * Math.pow(1.0 + Math.sqrt(pureComponentConductivity[i] / pureComponentConductivity[j]) + * Math.pow(gasPhase.getPhase().getComponent(i).getMolarMass() + / gasPhase.getPhase().getComponent(j).getMolarMass(), 1.0 / 4.0), + 2.0) + / Math.sqrt(8.0 * (1.0 + gasPhase.getPhase().getComponent(i).getMolarMass() + / gasPhase.getPhase().getComponent(j).getMolarMass())); + tempVar += gasPhase.getPhase().getComponent(j).getx() * Aij; } conductivity += - gasPhase.getPhase().getComponents()[i].getx() * pureComponentConductivity[i] / tempVar; + gasPhase.getPhase().getComponent(i).getx() * pureComponentConductivity[i] / tempVar; } // System.out.println("conductivity " + conductivity); return conductivity; @@ -70,22 +68,20 @@ public void calcPureComponentConductivity() { for (int i = 0; i < gasPhase.getPhase().getNumberOfComponents(); i++) { // pure component conductivity tempVar2 = - gasPhase.getPhase().getComponents()[i].getCv0(gasPhase.getPhase().getTemperature()) / R + gasPhase.getPhase().getComponent(i).getCv0(gasPhase.getPhase().getTemperature()) / R - 1.5; - tempBeta = 0.7862 - 0.7109 * gasPhase.getPhase().getComponents()[i].getAcentricFactor() - + 1.3168 * Math.pow(gasPhase.getPhase().getComponents()[i].getAcentricFactor(), 2.0); + tempBeta = 0.7862 - 0.7109 * gasPhase.getPhase().getComponent(i).getAcentricFactor() + + 1.3168 * Math.pow(gasPhase.getPhase().getComponent(i).getAcentricFactor(), 2.0); tempZ = 2.0 + 10.5 * Math.pow( - gasPhase.getPhase().getTemperature() / gasPhase.getPhase().getComponents()[i].getTC(), - 2.0); + gasPhase.getPhase().getTemperature() / gasPhase.getPhase().getComponent(i).getTC(), 2.0); tempAlpha = 1.0 + tempVar2 * ((0.215 + 0.28288 * tempVar2 - 1.061 * tempBeta + 0.26665 * tempZ) / (0.6366 + tempBeta * tempZ + 1.061 * tempVar2 * tempBeta)); - pureComponentConductivity[i] = 1.0 / gasPhase.getPhase().getComponents()[i].getMolarMass() + pureComponentConductivity[i] = 1.0 / gasPhase.getPhase().getComponent(i).getMolarMass() * gasPhase.getPureComponentViscosity(i) * 1e-7 - * gasPhase.getPhase().getComponents()[i].getCv0(gasPhase.getPhase().getTemperature()) - * 3.75 * tempAlpha - / (gasPhase.getPhase().getComponents()[i].getCv0(gasPhase.getPhase().getTemperature()) - / R); + * gasPhase.getPhase().getComponent(i).getCv0(gasPhase.getPhase().getTemperature()) * 3.75 + * tempAlpha + / (gasPhase.getPhase().getComponent(i).getCv0(gasPhase.getPhase().getTemperature()) / R); if (pureComponentConductivity[i] < 1e-50) { pureComponentConductivity[i] = 1e-50; } diff --git a/src/main/java/neqsim/physicalproperties/methods/gasphysicalproperties/density/Density.java b/src/main/java/neqsim/physicalproperties/methods/gasphysicalproperties/density/Density.java index f8c7821373..2540f633cb 100644 --- a/src/main/java/neqsim/physicalproperties/methods/gasphysicalproperties/density/Density.java +++ b/src/main/java/neqsim/physicalproperties/methods/gasphysicalproperties/density/Density.java @@ -55,9 +55,9 @@ public double calcDensity() { double tempVar = 0.0; if (gasPhase.getPhase().useVolumeCorrection()) { for (int i = 0; i < gasPhase.getPhase().getNumberOfComponents(); i++) { - tempVar += gasPhase.getPhase().getComponents()[i].getx() - * (gasPhase.getPhase().getComponents()[i].getVolumeCorrection() - + gasPhase.getPhase().getComponents()[i].getVolumeCorrectionT() + tempVar += gasPhase.getPhase().getComponent(i).getx() + * (gasPhase.getPhase().getComponent(i).getVolumeCorrection() + + gasPhase.getPhase().getComponent(i).getVolumeCorrectionT() * (gasPhase.getPhase().getTemperature() - 288.15)); } } diff --git a/src/main/java/neqsim/physicalproperties/methods/gasphysicalproperties/diffusivity/Diffusivity.java b/src/main/java/neqsim/physicalproperties/methods/gasphysicalproperties/diffusivity/Diffusivity.java index 6f2d5902dc..bd6fce823c 100644 --- a/src/main/java/neqsim/physicalproperties/methods/gasphysicalproperties/diffusivity/Diffusivity.java +++ b/src/main/java/neqsim/physicalproperties/methods/gasphysicalproperties/diffusivity/Diffusivity.java @@ -111,11 +111,11 @@ public void calcEffectiveDiffusionCoefficients() { for (int j = 0; j < gasPhase.getPhase().getNumberOfComponents(); j++) { if (i == j) { } else { - sum += gasPhase.getPhase().getComponents()[j].getx() / binaryDiffusionCoefficients[i][j]; + sum += gasPhase.getPhase().getComponent(j).getx() / binaryDiffusionCoefficients[i][j]; } } effectiveDiffusionCoefficient[i] = - (1.0 - gasPhase.getPhase().getComponents()[i].getx()) / sum; + (1.0 - gasPhase.getPhase().getComponent(i).getx()) / sum; } } @@ -136,8 +136,8 @@ public double getEffectiveDiffusionCoefficient(int i) { public double getMaxwellStefanBinaryDiffusionCoefficient(int i, int j) { /* * double temp = (i==j)? 1.0: 0.0; double nonIdealCorrection = temp + - * gasPhase.getPhase().getComponents()[i].getx() * - * gasPhase.getPhase().getComponents()[i].getdfugdn(j) * + * gasPhase.getPhase().getComponent(i).getx() * + * gasPhase.getPhase().getComponent(i).getdfugdn(j) * * gasPhase.getPhase().getNumberOfMolesInPhase(); if (Double.isNaN(nonIdealCorrection)) * nonIdealCorrection=1.0; return binaryDiffusionCoefficients[i][j]/nonIdealCorrection; // shuld * be divided by non ideality factor diff --git a/src/main/java/neqsim/physicalproperties/methods/gasphysicalproperties/viscosity/ChungViscosityMethod.java b/src/main/java/neqsim/physicalproperties/methods/gasphysicalproperties/viscosity/ChungViscosityMethod.java index 328784d668..b728e89e0a 100644 --- a/src/main/java/neqsim/physicalproperties/methods/gasphysicalproperties/viscosity/ChungViscosityMethod.java +++ b/src/main/java/neqsim/physicalproperties/methods/gasphysicalproperties/viscosity/ChungViscosityMethod.java @@ -64,16 +64,15 @@ public double calcViscosity() { for (int j = 0; j < gasPhase.getPhase().getNumberOfComponents(); j++) { tempVar2 = Math .pow(1.0 + Math.sqrt(pureComponentViscosity[i] / pureComponentViscosity[j]) - * Math.pow(gasPhase.getPhase().getComponents()[j].getMolarMass() - / gasPhase.getPhase().getComponents()[i].getMolarMass(), 0.25), + * Math.pow(gasPhase.getPhase().getComponent(j).getMolarMass() + / gasPhase.getPhase().getComponent(i).getMolarMass(), 0.25), 2.0) - / Math.pow(8.0 * (1.0 + gasPhase.getPhase().getComponents()[i].getMolarMass() - / gasPhase.getPhase().getComponents()[j].getMolarMass()), 0.5); - tempVar += gasPhase.getPhase().getComponents()[j].getx() * tempVar2; + / Math.pow(8.0 * (1.0 + gasPhase.getPhase().getComponent(i).getMolarMass() + / gasPhase.getPhase().getComponent(j).getMolarMass()), 0.5); + tempVar += gasPhase.getPhase().getComponent(j).getx() * tempVar2; } - viscosity += - gasPhase.getPhase().getComponents()[i].getx() * pureComponentViscosity[i] / tempVar; + viscosity += gasPhase.getPhase().getComponent(i).getx() * pureComponentViscosity[i] / tempVar; } viscosity *= 1.0e-7; // N-sek/m2 return viscosity; @@ -107,31 +106,31 @@ public void initChungPureComponentViscosity() { double chungviskstar = 0; for (int i = 0; i < gasPhase.getPhase().getNumberOfComponents(); i++) { // eq. 9-4.11 TPoLG - relativeViscosity[i] = 131.3 * gasPhase.getPhase().getComponents()[i].getDebyeDipoleMoment() - / Math.sqrt(gasPhase.getPhase().getComponents()[i].getCriticalVolume() - * gasPhase.getPhase().getComponents()[i].getTC()); + relativeViscosity[i] = 131.3 * gasPhase.getPhase().getComponent(i).getDebyeDipoleMoment() + / Math.sqrt(gasPhase.getPhase().getComponent(i).getCriticalVolume() + * gasPhase.getPhase().getComponent(i).getTC()); // eq. 9-4.10 TPoLG - Fc[i] = 1.0 - 0.2756 * gasPhase.getPhase().getComponents()[i].getAcentricFactor() + Fc[i] = 1.0 - 0.2756 * gasPhase.getPhase().getComponent(i).getAcentricFactor() + 0.059035 * Math.pow(relativeViscosity[i], 4) - + gasPhase.getPhase().getComponents()[i].getViscosityCorrectionFactor(); + + gasPhase.getPhase().getComponent(i).getViscosityCorrectionFactor(); for (int j = 0; j < 10; j++) { // Table 9-5 TPoLG chungE[j] = chungHPcoefs[j][0] - + chungHPcoefs[j][1] * gasPhase.getPhase().getComponents()[i].getAcentricFactor() + + chungHPcoefs[j][1] * gasPhase.getPhase().getComponent(i).getAcentricFactor() + chungHPcoefs[j][2] * Math.pow(relativeViscosity[i], 4) + chungHPcoefs[j][3] - * gasPhase.getPhase().getComponents()[i].getViscosityCorrectionFactor(); + * gasPhase.getPhase().getComponent(i).getViscosityCorrectionFactor(); } // eq. 9-4.8 TPoLG (The properties of Liquids and Gases) tempVar = 1.2593 * gasPhase.getPhase().getTemperature() - / gasPhase.getPhase().getComponents()[i].getTC(); + / gasPhase.getPhase().getComponent(i).getTC(); // eq. 9.4.3 TPoLG omegaVisc[i] = A * Math.pow(tempVar, -B) + C * Math.exp(-D * tempVar) + E * Math.exp(-F * tempVar); // eq. 9-6.18 TPoLG chungy = 0.1 / (gasPhase.getPhase().getMolarVolume()) - * gasPhase.getPhase().getComponents()[i].getCriticalVolume() / 6.0; + * gasPhase.getPhase().getComponent(i).getCriticalVolume() / 6.0; // eq. 9-6.19 TPoLG chungG1 = (1.0 - 0.5 * chungy) / Math.pow((1.0 - chungy), 3.0); // eq. 9-6.20 TPoLG @@ -146,9 +145,9 @@ public void initChungPureComponentViscosity() { Math.sqrt(tempVar) / omegaVisc[i] * (Fc[i] * (1.0 / chungG2 + chungE[5] * chungy)) + chungviskstartstar; pureComponentViscosity[i] = chungviskstar * 36.344 - * Math.pow(gasPhase.getPhase().getComponents()[i].getMolarMass() * 1000.0 - * gasPhase.getPhase().getComponents()[i].getTC(), 0.5) - / (Math.pow(gasPhase.getPhase().getPhase().getComponents()[i].getCriticalVolume(), + * Math.pow(gasPhase.getPhase().getComponent(i).getMolarMass() * 1000.0 + * gasPhase.getPhase().getComponent(i).getTC(), 0.5) + / (Math.pow(gasPhase.getPhase().getPhase().getComponent(i).getCriticalVolume(), 2.0 / 3.0)); } } diff --git a/src/main/java/neqsim/physicalproperties/methods/liquidphysicalproperties/conductivity/Conductivity.java b/src/main/java/neqsim/physicalproperties/methods/liquidphysicalproperties/conductivity/Conductivity.java index ee0f2b82f8..ef534f0dfd 100644 --- a/src/main/java/neqsim/physicalproperties/methods/liquidphysicalproperties/conductivity/Conductivity.java +++ b/src/main/java/neqsim/physicalproperties/methods/liquidphysicalproperties/conductivity/Conductivity.java @@ -65,16 +65,16 @@ public double calcConductivity() { /* * tempVar2 = Math .pow(1.0 + Math .sqrt(pureComponentConductivity[i] / * pureComponentConductivity[j]) - * Math.pow(liquidPhase.getPhase().getComponents()[j].getMolarMass() / - * liquidPhase.getPhase().getComponents()[i].getMolarMass(), 0.25), 2.0) / Math.pow(8.0 (1.0 - * + liquidPhase.getPhase().getComponents()[i].getMolarMass() / - * liquidPhase.getPhase().getComponents()[j].getMolarMass()), 0.5); + * Math.pow(liquidPhase.getPhase().getComponent(j).getMolarMass() / + * liquidPhase.getPhase().getComponent(i).getMolarMass(), 0.25), 2.0) / Math.pow(8.0 (1.0 + + * liquidPhase.getPhase().getComponent(i).getMolarMass() / + * liquidPhase.getPhase().getComponent(j).getMolarMass()), 0.5); */ } double wigthFraci = liquidPhase.getPhase().getWtFrac(i); conductivity += wigthFraci * pureComponentConductivity[i]; // tempVar; // conductivity = conductivity + - // liquidPhase.getPhase().getComponents()[i].getx() * + // liquidPhase.getPhase().getComponent(i).getx() * // pureComponentConductivity[i]; ///tempVar; } @@ -90,10 +90,10 @@ public void calcPureComponentConductivity() { for (int i = 0; i < liquidPhase.getPhase().getNumberOfComponents(); i++) { // pure component conductivity pureComponentConductivity[i] = - liquidPhase.getPhase().getComponents()[i].getLiquidConductivityParameter(0) - + liquidPhase.getPhase().getComponents()[i].getLiquidConductivityParameter(1) + liquidPhase.getPhase().getComponent(i).getLiquidConductivityParameter(0) + + liquidPhase.getPhase().getComponent(i).getLiquidConductivityParameter(1) * liquidPhase.getPhase().getTemperature() - + liquidPhase.getPhase().getComponents()[i].getLiquidConductivityParameter(2) + + liquidPhase.getPhase().getComponent(i).getLiquidConductivityParameter(2) * Math.pow(liquidPhase.getPhase().getTemperature(), 2.0); if (pureComponentConductivity[i] < 0) { pureComponentConductivity[i] = 1e-10; diff --git a/src/main/java/neqsim/physicalproperties/methods/liquidphysicalproperties/density/Costald.java b/src/main/java/neqsim/physicalproperties/methods/liquidphysicalproperties/density/Costald.java index 2557810003..e83a047267 100644 --- a/src/main/java/neqsim/physicalproperties/methods/liquidphysicalproperties/density/Costald.java +++ b/src/main/java/neqsim/physicalproperties/methods/liquidphysicalproperties/density/Costald.java @@ -86,26 +86,26 @@ public double calcDensity() { if (liquidPhase.getPhase().useVolumeCorrection()) { for (int i = 0; i < liquidPhase.getPhase().getNumberOfComponents(); i++) { - ascFactMix += Math.sqrt(liquidPhase.getPhase().getComponents()[i].getAcentricFactor()) - * (liquidPhase.getPhase().getComponents()[i].getx()); + ascFactMix += Math.sqrt(liquidPhase.getPhase().getComponent(i).getAcentricFactor()) + * (liquidPhase.getPhase().getComponent(i).getx()); - criticalVolumeMix1 += liquidPhase.getPhase().getComponents()[i].getCriticalVolume() - * liquidPhase.getPhase().getComponents()[i].getx(); + criticalVolumeMix1 += liquidPhase.getPhase().getComponent(i).getCriticalVolume() + * liquidPhase.getPhase().getComponent(i).getx(); criticalVolumeMix2 += - Math.pow(liquidPhase.getPhase().getComponents()[i].getCriticalVolume(), 0.6666) - * liquidPhase.getPhase().getComponents()[i].getx(); + Math.pow(liquidPhase.getPhase().getComponent(i).getCriticalVolume(), 0.6666) + * liquidPhase.getPhase().getComponent(i).getx(); criticalVolumeMix3 += - Math.pow(liquidPhase.getPhase().getComponents()[i].getCriticalVolume(), 0.33333) - * liquidPhase.getPhase().getComponents()[i].getx(); + Math.pow(liquidPhase.getPhase().getComponent(i).getCriticalVolume(), 0.33333) + * liquidPhase.getPhase().getComponent(i).getx(); criticalTemperature1 += Math - .sqrt(liquidPhase.getPhase().getComponents()[i].getTC() - * liquidPhase.getPhase().getComponents()[i].getCriticalVolume()) - * liquidPhase.getPhase().getComponents()[i].getx(); + .sqrt(liquidPhase.getPhase().getComponent(i).getTC() + * liquidPhase.getPhase().getComponent(i).getCriticalVolume()) + * liquidPhase.getPhase().getComponent(i).getx(); /* - * tempVar += liquidPhase.getPhase().getComponents()[i].getx() - * (liquidPhase.getPhase().getComponents()[i].getVolumeCorrection() + - * liquidPhase.getPhase().getComponents()[i].getVolumeCorrectionT() + * tempVar += liquidPhase.getPhase().getComponent(i).getx() + * (liquidPhase.getPhase().getComponent(i).getVolumeCorrection() + + * liquidPhase.getPhase().getComponent(i).getVolumeCorrectionT() * (liquidPhase.getPhase().getTemperature() - 288.15)); */ } diff --git a/src/main/java/neqsim/physicalproperties/methods/liquidphysicalproperties/density/Density.java b/src/main/java/neqsim/physicalproperties/methods/liquidphysicalproperties/density/Density.java index d891dee534..cbe28174eb 100644 --- a/src/main/java/neqsim/physicalproperties/methods/liquidphysicalproperties/density/Density.java +++ b/src/main/java/neqsim/physicalproperties/methods/liquidphysicalproperties/density/Density.java @@ -55,9 +55,9 @@ public double calcDensity() { double tempVar = 0.0; if (liquidPhase.getPhase().useVolumeCorrection()) { for (int i = 0; i < liquidPhase.getPhase().getNumberOfComponents(); i++) { - tempVar += liquidPhase.getPhase().getComponents()[i].getx() - * (liquidPhase.getPhase().getComponents()[i].getVolumeCorrection() - + liquidPhase.getPhase().getComponents()[i].getVolumeCorrectionT() + tempVar += liquidPhase.getPhase().getComponent(i).getx() + * (liquidPhase.getPhase().getComponent(i).getVolumeCorrection() + + liquidPhase.getPhase().getComponent(i).getVolumeCorrectionT() * (liquidPhase.getPhase().getTemperature() - 288.15)); } } diff --git a/src/main/java/neqsim/physicalproperties/methods/liquidphysicalproperties/diffusivity/Diffusivity.java b/src/main/java/neqsim/physicalproperties/methods/liquidphysicalproperties/diffusivity/Diffusivity.java index b50b2dc0f6..ec36626704 100644 --- a/src/main/java/neqsim/physicalproperties/methods/liquidphysicalproperties/diffusivity/Diffusivity.java +++ b/src/main/java/neqsim/physicalproperties/methods/liquidphysicalproperties/diffusivity/Diffusivity.java @@ -68,9 +68,9 @@ public double[][] calcDiffusionCoefficients(int binaryDiffusionCoefficientMethod for (int j = 0; j < liquidPhase.getPhase().getNumberOfComponents(); j++) { if (i != j) { binaryDiffusionCoefficients[i][j] = Math.pow(binaryDiffusionCoefficients[i][j], - liquidPhase.getPhase().getComponents()[j].getx()) + liquidPhase.getPhase().getComponent(j).getx()) * Math.pow(binaryDiffusionCoefficients[j][i], - liquidPhase.getPhase().getComponents()[i].getx()); + liquidPhase.getPhase().getComponent(i).getx()); } // System.out.println("diff liq " + binaryDiffusionCoefficients[i][j] ); } @@ -88,12 +88,11 @@ public void calcEffectiveDiffusionCoefficients() { for (int j = 0; j < liquidPhase.getPhase().getNumberOfComponents(); j++) { if (i == j) { } else { - sum += - liquidPhase.getPhase().getComponents()[j].getx() / binaryDiffusionCoefficients[i][j]; + sum += liquidPhase.getPhase().getComponent(j).getx() / binaryDiffusionCoefficients[i][j]; } } effectiveDiffusionCoefficient[i] = - (1.0 - liquidPhase.getPhase().getComponents()[i].getx()) / sum; + (1.0 - liquidPhase.getPhase().getComponent(i).getx()) / sum; } } @@ -113,8 +112,8 @@ public double getEffectiveDiffusionCoefficient(int i) { @Override public double getFickBinaryDiffusionCoefficient(int i, int j) { double temp = (i == j) ? 1.0 : 0.0; - double nonIdealCorrection = temp + liquidPhase.getPhase().getComponents()[i].getx() - * liquidPhase.getPhase().getComponents()[i].getdfugdn(j) + double nonIdealCorrection = temp + liquidPhase.getPhase().getComponent(i).getx() + * liquidPhase.getPhase().getComponent(i).getdfugdn(j) * liquidPhase.getPhase().getNumberOfMolesInPhase(); if (Double.isNaN(nonIdealCorrection)) { nonIdealCorrection = 1.0; diff --git a/src/main/java/neqsim/physicalproperties/methods/liquidphysicalproperties/diffusivity/SiddiqiLucasMethod.java b/src/main/java/neqsim/physicalproperties/methods/liquidphysicalproperties/diffusivity/SiddiqiLucasMethod.java index 12157e6705..b91e3fb37d 100644 --- a/src/main/java/neqsim/physicalproperties/methods/liquidphysicalproperties/diffusivity/SiddiqiLucasMethod.java +++ b/src/main/java/neqsim/physicalproperties/methods/liquidphysicalproperties/diffusivity/SiddiqiLucasMethod.java @@ -33,8 +33,8 @@ public double calcBinaryDiffusionCoefficient(int i, int j, int method) { // remember this is the Maxwell-Stefan diffusion coefficients binaryDiffusionCoefficients[i][j] = 1.0e-4 * 2.98e-7 * Math.pow(liquidPhase.getPureComponentViscosity(j), -1.026) - * Math.pow(1.0 / liquidPhase.getPhase().getComponents()[i].getNormalLiquidDensity() - * liquidPhase.getPhase().getComponents()[i].getMolarMass() * 1000, -0.5473) + * Math.pow(1.0 / liquidPhase.getPhase().getComponent(i).getNormalLiquidDensity() + * liquidPhase.getPhase().getComponent(i).getMolarMass() * 1000, -0.5473) * liquidPhase.getPhase().getTemperature(); return binaryDiffusionCoefficients[i][j]; } @@ -56,10 +56,10 @@ public double calcBinaryDiffusionCoefficient2(int i, int j, int method) { // remember this is the Maxwell-Stefan diffusion coefficients binaryDiffusionCoefficients[i][j] = 1.0e-4 * 9.89e-8 * Math.pow(liquidPhase.getPureComponentViscosity(j), -0.907) - * Math.pow(1.0 / liquidPhase.getPhase().getComponents()[i].getNormalLiquidDensity() - * liquidPhase.getPhase().getComponents()[i].getMolarMass() * 1000, -0.45) - * Math.pow(1.0 / liquidPhase.getPhase().getComponents()[j].getNormalLiquidDensity() - * liquidPhase.getPhase().getComponents()[j].getMolarMass() * 1000, 0.265) + * Math.pow(1.0 / liquidPhase.getPhase().getComponent(i).getNormalLiquidDensity() + * liquidPhase.getPhase().getComponent(i).getMolarMass() * 1000, -0.45) + * Math.pow(1.0 / liquidPhase.getPhase().getComponent(j).getNormalLiquidDensity() + * liquidPhase.getPhase().getComponent(j).getMolarMass() * 1000, 0.265) * liquidPhase.getPhase().getTemperature(); return binaryDiffusionCoefficients[i][j]; } diff --git a/src/main/java/neqsim/physicalproperties/methods/liquidphysicalproperties/viscosity/Viscosity.java b/src/main/java/neqsim/physicalproperties/methods/liquidphysicalproperties/viscosity/Viscosity.java index 6e5f42766c..5e10ed5cc5 100644 --- a/src/main/java/neqsim/physicalproperties/methods/liquidphysicalproperties/viscosity/Viscosity.java +++ b/src/main/java/neqsim/physicalproperties/methods/liquidphysicalproperties/viscosity/Viscosity.java @@ -56,7 +56,7 @@ public double calcViscosity() { // method og Grunberg and Nissan [87] for (int i = 0; i < liquidPhase.getPhase().getNumberOfComponents(); i++) { tempVar += liquidPhase.getPhase().getWtFrac(i) * Math.log(pureComponentViscosity[i]); - // tempVar += liquidPhase.getPhase().getComponents()[i].getx() * + // tempVar += liquidPhase.getPhase().getComponent(i).getx() * // Math.log(pureComponentViscosity[i]); } tempVar2 = 0; @@ -71,7 +71,7 @@ public double calcViscosity() { } // if(i!=j) tempVar2 += - // liquidPhase.getPhase().getComponents()[i].getx()*liquidPhase.getPhase().getComponents()[j].getx()*liquidPhase.getMixingRule().getViscosityGij(i,j); + // liquidPhase.getPhase().getComponent(i).getx()*liquidPhase.getPhase().getComponent(j).getx()*liquidPhase.getMixingRule().getViscosityGij(i,j); } } double viscosity = Math.exp(tempVar + tempVar2) / 1.0e3; // N-sek/m2 @@ -86,36 +86,36 @@ public double calcViscosity() { public void calcPureComponentViscosity() { pureComponentViscosity = new double[liquidPhase.getPhase().getNumberOfComponents()]; for (int i = 0; i < liquidPhase.getPhase().getNumberOfComponents(); i++) { - if (liquidPhase.getPhase().getTemperature() > liquidPhase.getPhase().getComponents()[i] + if (liquidPhase.getPhase().getTemperature() > liquidPhase.getPhase().getComponent(i) .getTC()) { pureComponentViscosity[i] = 5.0e-1; - } else if (liquidPhase.getPhase().getComponents()[i].getLiquidViscosityModel() == 1) { + } else if (liquidPhase.getPhase().getComponent(i).getLiquidViscosityModel() == 1) { pureComponentViscosity[i] = - liquidPhase.getPhase().getComponents()[i].getLiquidViscosityParameter(0) + liquidPhase.getPhase().getComponent(i).getLiquidViscosityParameter(0) * Math.pow(liquidPhase.getPhase().getTemperature(), - liquidPhase.getPhase().getComponents()[i].getLiquidViscosityParameter(1)); - } else if (liquidPhase.getPhase().getComponents()[i].getLiquidViscosityModel() == 2) { + liquidPhase.getPhase().getComponent(i).getLiquidViscosityParameter(1)); + } else if (liquidPhase.getPhase().getComponent(i).getLiquidViscosityModel() == 2) { pureComponentViscosity[i] = - Math.exp(liquidPhase.getPhase().getComponents()[i].getLiquidViscosityParameter(0) - + liquidPhase.getPhase().getComponents()[i].getLiquidViscosityParameter(1) + Math.exp(liquidPhase.getPhase().getComponent(i).getLiquidViscosityParameter(0) + + liquidPhase.getPhase().getComponent(i).getLiquidViscosityParameter(1) / liquidPhase.getPhase().getTemperature()); - } else if (liquidPhase.getPhase().getComponents()[i].getLiquidViscosityModel() == 3) { + } else if (liquidPhase.getPhase().getComponent(i).getLiquidViscosityModel() == 3) { pureComponentViscosity[i] = - Math.exp(liquidPhase.getPhase().getComponents()[i].getLiquidViscosityParameter(0) - + liquidPhase.getPhase().getComponents()[i].getLiquidViscosityParameter(1) + Math.exp(liquidPhase.getPhase().getComponent(i).getLiquidViscosityParameter(0) + + liquidPhase.getPhase().getComponent(i).getLiquidViscosityParameter(1) / liquidPhase.getPhase().getTemperature() - + liquidPhase.getPhase().getComponents()[i].getLiquidViscosityParameter(2) + + liquidPhase.getPhase().getComponent(i).getLiquidViscosityParameter(2) * liquidPhase.getPhase().getTemperature() - + liquidPhase.getPhase().getComponents()[i].getLiquidViscosityParameter(3) + + liquidPhase.getPhase().getComponent(i).getLiquidViscosityParameter(3) * Math.pow(liquidPhase.getPhase().getTemperature(), 2)); - } else if (liquidPhase.getPhase().getComponents()[i].getLiquidViscosityModel() == 4) { - pureComponentViscosity[i] = Math.pow(10, liquidPhase.getPhase().getComponents()[i] - .getLiquidViscosityParameter(0) - * (1.0 / liquidPhase.getPhase().getTemperature() - - 1.0 / liquidPhase.getPhase().getComponents()[i].getLiquidViscosityParameter(1))); // liquidPhase.getPhase().getComponents()[i].getLiquidViscosityParameter(2)*liquidPhase.getPhase().getTemperature()+liquidPhase.getPhase().getComponents()[i].getLiquidViscosityParameter(3)/liquidPhase.getPhase().getTemperature()+liquidPhase.getPhase().getComponents()[i].getLiquidViscosityParameter(3)*Math.pow(liquidPhase.getPhase().getTemperature(),2)); + } else if (liquidPhase.getPhase().getComponent(i).getLiquidViscosityModel() == 4) { + pureComponentViscosity[i] = Math.pow(10, + liquidPhase.getPhase().getComponent(i).getLiquidViscosityParameter(0) + * (1.0 / liquidPhase.getPhase().getTemperature() + - 1.0 / liquidPhase.getPhase().getComponent(i).getLiquidViscosityParameter(1))); // liquidPhase.getPhase().getComponent(i).getLiquidViscosityParameter(2)*liquidPhase.getPhase().getTemperature()+liquidPhase.getPhase().getComponent(i).getLiquidViscosityParameter(3)/liquidPhase.getPhase().getTemperature()+liquidPhase.getPhase().getComponent(i).getLiquidViscosityParameter(3)*Math.pow(liquidPhase.getPhase().getTemperature(),2)); } else { // System.out.println("no pure component viscosity model defined for component " - // + liquidPhase.getPhase().getComponents()[i].getComponentName()); + // + liquidPhase.getPhase().getComponent(i).getComponentName()); pureComponentViscosity[i] = 7.0e-1; } pureComponentViscosity[i] *= ((getViscosityPressureCorrection(i) + 1.0) / 2.0); diff --git a/src/main/java/neqsim/physicalproperties/methods/solidphysicalproperties/density/Density.java b/src/main/java/neqsim/physicalproperties/methods/solidphysicalproperties/density/Density.java index 83a485e1a7..2aa4d68fa5 100644 --- a/src/main/java/neqsim/physicalproperties/methods/solidphysicalproperties/density/Density.java +++ b/src/main/java/neqsim/physicalproperties/methods/solidphysicalproperties/density/Density.java @@ -55,9 +55,9 @@ public double calcDensity() { double tempVar = 0.0; if (solidPhase.getPhase().useVolumeCorrection()) { for (int i = 0; i < solidPhase.getPhase().getNumberOfComponents(); i++) { - tempVar += solidPhase.getPhase().getComponents()[i].getx() - * (solidPhase.getPhase().getComponents()[i].getVolumeCorrection() - + solidPhase.getPhase().getComponents()[i].getVolumeCorrectionT() + tempVar += solidPhase.getPhase().getComponent(i).getx() + * (solidPhase.getPhase().getComponent(i).getVolumeCorrection() + + solidPhase.getPhase().getComponent(i).getVolumeCorrectionT() * (solidPhase.getPhase().getTemperature() - 288.15)); } } diff --git a/src/main/java/neqsim/physicalproperties/mixingrule/PhysicalPropertyMixingRule.java b/src/main/java/neqsim/physicalproperties/mixingrule/PhysicalPropertyMixingRule.java index e8a0c76c2e..019deda316 100644 --- a/src/main/java/neqsim/physicalproperties/mixingrule/PhysicalPropertyMixingRule.java +++ b/src/main/java/neqsim/physicalproperties/mixingrule/PhysicalPropertyMixingRule.java @@ -85,7 +85,7 @@ public void initMixingRules(PhaseInterface phase) { if (phase.getComponent(l).isIsTBPfraction() || phase.getComponent(l).getIonicCharge() != 0) { break; } - String component_name = phase.getComponents()[l].getComponentName(); + String component_name = phase.getComponent(l).getComponentName(); for (int k = l; k < phase.getNumberOfComponents(); k++) { if (k == l || phase.getComponent(k).getIonicCharge() != 0 || phase.getComponent(k).isIsTBPfraction()) { @@ -96,8 +96,8 @@ public void initMixingRules(PhaseInterface phase) { new neqsim.util.database.NeqSimDataBase(); java.sql.ResultSet dataSet = database.getResultSet("SELECT gijvisc FROM inter WHERE (COMP1='" + component_name - + "' AND COMP2='" + phase.getComponents()[k].getComponentName() - + "') OR (COMP1='" + phase.getComponents()[k].getComponentName() + + "' AND COMP2='" + phase.getComponent(k).getComponentName() + + "') OR (COMP1='" + phase.getComponent(k).getComponentName() + "' AND COMP2='" + component_name + "')")) { if (dataSet.next()) { Gij[l][k] = Double.parseDouble(dataSet.getString("gijvisc")); diff --git a/src/main/java/neqsim/physicalproperties/util/parameterfitting/purecomponentparameterfitting/purecompviscosity/chungmethod/ChungFunction.java b/src/main/java/neqsim/physicalproperties/util/parameterfitting/purecomponentparameterfitting/purecompviscosity/chungmethod/ChungFunction.java index 898330a554..40281c2780 100644 --- a/src/main/java/neqsim/physicalproperties/util/parameterfitting/purecomponentparameterfitting/purecompviscosity/chungmethod/ChungFunction.java +++ b/src/main/java/neqsim/physicalproperties/util/parameterfitting/purecomponentparameterfitting/purecompviscosity/chungmethod/ChungFunction.java @@ -33,7 +33,7 @@ public double calcValue(double[] dependentValues) { @Override public void setFittingParams(int i, double value) { params[i] = value; - system.getPhases()[0].getComponents()[i].setViscosityAssociationFactor(value); - system.getPhases()[1].getComponents()[i].setViscosityAssociationFactor(value); + system.getPhases()[0].getComponent(i).setViscosityAssociationFactor(value); + system.getPhases()[1].getComponent(i).setViscosityAssociationFactor(value); } } diff --git a/src/main/java/neqsim/physicalproperties/util/parameterfitting/purecomponentparameterfitting/purecompviscosity/linearliquidmodel/ViscosityFunction.java b/src/main/java/neqsim/physicalproperties/util/parameterfitting/purecomponentparameterfitting/purecompviscosity/linearliquidmodel/ViscosityFunction.java index 024fcc2d23..ba51ae0576 100644 --- a/src/main/java/neqsim/physicalproperties/util/parameterfitting/purecomponentparameterfitting/purecompviscosity/linearliquidmodel/ViscosityFunction.java +++ b/src/main/java/neqsim/physicalproperties/util/parameterfitting/purecomponentparameterfitting/purecompviscosity/linearliquidmodel/ViscosityFunction.java @@ -36,7 +36,7 @@ public double calcValue(double[] dependentValues) { @Override public void setFittingParams(int i, double value) { params[i] = value; - system.getPhases()[0].getComponents()[0].setLiquidViscosityParameter(value, i); - system.getPhases()[1].getComponents()[0].setLiquidViscosityParameter(value, i); + system.getPhases()[0].getComponent(0).setLiquidViscosityParameter(value, i); + system.getPhases()[1].getComponent(0).setLiquidViscosityParameter(value, i); } } diff --git a/src/main/java/neqsim/process/equipment/absorber/SimpleTEGAbsorber.java b/src/main/java/neqsim/process/equipment/absorber/SimpleTEGAbsorber.java index 8fa4aa4d9f..198dbd30aa 100644 --- a/src/main/java/neqsim/process/equipment/absorber/SimpleTEGAbsorber.java +++ b/src/main/java/neqsim/process/equipment/absorber/SimpleTEGAbsorber.java @@ -74,8 +74,7 @@ public void addStream(StreamInterface newStream) { * addGasInStream. *

* - * @param newStream a {@link neqsim.process.equipment.stream.StreamInterface} - * object + * @param newStream a {@link neqsim.process.equipment.stream.StreamInterface} object */ public void addGasInStream(StreamInterface newStream) { // TODO: fail if gasInStream is not null? @@ -89,8 +88,7 @@ public void addGasInStream(StreamInterface newStream) { * addSolventInStream. *

* - * @param newStream a {@link neqsim.process.equipment.stream.StreamInterface} - * object + * @param newStream a {@link neqsim.process.equipment.stream.StreamInterface} object */ public void addSolventInStream(StreamInterface newStream) { // TODO: fail if solventInStream is not null? @@ -105,8 +103,7 @@ public void addSolventInStream(StreamInterface newStream) { * replaceSolventInStream. *

* - * @param newStream a {@link neqsim.process.equipment.stream.StreamInterface} - * object + * @param newStream a {@link neqsim.process.equipment.stream.StreamInterface} object */ public void replaceSolventInStream(StreamInterface newStream) { // TODO: fails if solventStreamNumber is 0, i.e. no solventinstream set? @@ -133,19 +130,19 @@ public void mixStream() { .getNumberOfComponents(); i++) { boolean gotComponent = false; String componentName = - streams.get(k).getThermoSystem().getPhases()[0].getComponents()[i].getName(); + streams.get(k).getThermoSystem().getPhases()[0].getComponent(i).getName(); // System.out.println("adding: " + componentName); double moles = - streams.get(k).getThermoSystem().getPhases()[0].getComponents()[i].getNumberOfmoles(); + streams.get(k).getThermoSystem().getPhases()[0].getComponent(i).getNumberOfmoles(); // System.out.println("moles: " + moles + " " + // mixedStream.getThermoSystem().getPhases()[0].getNumberOfComponents()); for (int p = 0; p < mixedStream.getThermoSystem().getPhases()[0] .getNumberOfComponents(); p++) { - if (mixedStream.getThermoSystem().getPhases()[0].getComponents()[p].getName() + if (mixedStream.getThermoSystem().getPhases()[0].getComponent(p).getName() .equals(componentName)) { gotComponent = true; - compName = streams.get(0).getThermoSystem().getPhases()[0].getComponents()[p] + compName = streams.get(0).getThermoSystem().getPhases()[0].getComponent(p) .getComponentName(); } } @@ -451,10 +448,10 @@ public void displayResult() { for (int i = 0; i < thermoSystem.getNumberOfPhases(); i++) { for (int j = 0; j < thermoSystem.getPhases()[0].getNumberOfComponents(); j++) { - table[j + 1][0] = thermoSystem.getPhases()[0].getComponents()[j].getName(); + table[j + 1][0] = thermoSystem.getPhases()[0].getComponent(j).getName(); buf = new StringBuffer(); table[j + 1][i + 1] = - nf.format(thermoSystem.getPhases()[i].getComponents()[j].getx(), buf, test).toString(); + nf.format(thermoSystem.getPhases()[i].getComponent(j).getx(), buf, test).toString(); table[j + 1][4] = "[-]"; } buf = new StringBuffer(); @@ -554,8 +551,7 @@ public StreamInterface getSolventOutStream() { * Setter for the field solventOutStream. *

* - * @param solventOutStream a - * {@link neqsim.process.equipment.stream.StreamInterface} object + * @param solventOutStream a {@link neqsim.process.equipment.stream.StreamInterface} object */ public void setSolventOutStream(StreamInterface solventOutStream) { this.solventOutStream = solventOutStream; diff --git a/src/main/java/neqsim/process/equipment/absorber/WaterStripperColumn.java b/src/main/java/neqsim/process/equipment/absorber/WaterStripperColumn.java index f744fe87f9..9d8e74bc32 100644 --- a/src/main/java/neqsim/process/equipment/absorber/WaterStripperColumn.java +++ b/src/main/java/neqsim/process/equipment/absorber/WaterStripperColumn.java @@ -76,8 +76,7 @@ public void addStream(StreamInterface newStream) { * addGasInStream. *

* - * @param newStream a {@link neqsim.process.equipment.stream.StreamInterface} - * object + * @param newStream a {@link neqsim.process.equipment.stream.StreamInterface} object */ public void addGasInStream(StreamInterface newStream) { gasInStream = newStream; @@ -90,8 +89,7 @@ public void addGasInStream(StreamInterface newStream) { * addSolventInStream. *

* - * @param newStream a {@link neqsim.process.equipment.stream.StreamInterface} - * object + * @param newStream a {@link neqsim.process.equipment.stream.StreamInterface} object */ public void addSolventInStream(StreamInterface newStream) { solventInStream = newStream; @@ -105,8 +103,7 @@ public void addSolventInStream(StreamInterface newStream) { * replaceSolventInStream. *

* - * @param newStream a {@link neqsim.process.equipment.stream.StreamInterface} - * object + * @param newStream a {@link neqsim.process.equipment.stream.StreamInterface} object */ public void replaceSolventInStream(StreamInterface newStream) { solventInStream = newStream; @@ -132,20 +129,20 @@ public void mixStream() { .getNumberOfComponents(); i++) { boolean gotComponent = false; String componentName = - streams.get(k).getThermoSystem().getPhases()[0].getComponents()[i].getName(); + streams.get(k).getThermoSystem().getPhases()[0].getComponent(i).getName(); // System.out.println("adding: " + componentName); double moles = - streams.get(k).getThermoSystem().getPhases()[0].getComponents()[i].getNumberOfmoles(); + streams.get(k).getThermoSystem().getPhases()[0].getComponent(i).getNumberOfmoles(); // System.out.println("moles: " + moles + " " + // mixedStream.getThermoSystem().getPhases()[0].getNumberOfComponents()); for (int p = 0; p < mixedStream.getThermoSystem().getPhases()[0] .getNumberOfComponents(); p++) { - if (mixedStream.getThermoSystem().getPhases()[0].getComponents()[p].getName() + if (mixedStream.getThermoSystem().getPhases()[0].getComponent(p).getName() .equals(componentName)) { gotComponent = true; - compName = streams.get(0).getThermoSystem().getPhases()[0].getComponents()[p] + compName = streams.get(0).getThermoSystem().getPhases()[0].getComponent(p) .getComponentName(); } } @@ -403,10 +400,10 @@ public void displayResult() { for (int i = 0; i < thermoSystem.getNumberOfPhases(); i++) { for (int j = 0; j < thermoSystem.getPhases()[0].getNumberOfComponents(); j++) { - table[j + 1][0] = thermoSystem.getPhases()[0].getComponents()[j].getName(); + table[j + 1][0] = thermoSystem.getPhases()[0].getComponent(j).getName(); buf = new StringBuffer(); table[j + 1][i + 1] = - nf.format(thermoSystem.getPhases()[i].getComponents()[j].getx(), buf, test).toString(); + nf.format(thermoSystem.getPhases()[i].getComponent(j).getx(), buf, test).toString(); table[j + 1][4] = "[-]"; } buf = new StringBuffer(); @@ -508,8 +505,7 @@ public void setWaterDewPointTemperature(double waterDewPointTemperature, double * Setter for the field gasOutStream. *

* - * @param gasOutStream a {@link neqsim.process.equipment.stream.StreamInterface} - * object + * @param gasOutStream a {@link neqsim.process.equipment.stream.StreamInterface} object */ public void setGasOutStream(StreamInterface gasOutStream) { this.gasOutStream = gasOutStream; @@ -531,8 +527,7 @@ public StreamInterface getSolventOutStream() { * Setter for the field solventOutStream. *

* - * @param solventOutStream a - * {@link neqsim.process.equipment.stream.StreamInterface} object + * @param solventOutStream a {@link neqsim.process.equipment.stream.StreamInterface} object */ public void setSolventOutStream(StreamInterface solventOutStream) { this.solventOutStream = solventOutStream; diff --git a/src/main/java/neqsim/process/equipment/compressor/Compressor.java b/src/main/java/neqsim/process/equipment/compressor/Compressor.java index 664ba91e4e..45e1415558 100644 --- a/src/main/java/neqsim/process/equipment/compressor/Compressor.java +++ b/src/main/java/neqsim/process/equipment/compressor/Compressor.java @@ -767,11 +767,10 @@ public void displayResult() { for (int i = 0; i < getThermoSystem().getNumberOfPhases(); i++) { for (int j = 0; j < getThermoSystem().getPhases()[0].getNumberOfComponents(); j++) { - table[j + 1][0] = getThermoSystem().getPhases()[0].getComponents()[j].getName(); + table[j + 1][0] = getThermoSystem().getPhases()[0].getComponent(j).getName(); buf = new StringBuffer(); - table[j + 1][i + 1] = - nf.format(getThermoSystem().getPhases()[i].getComponents()[j].getx(), buf, test) - .toString(); + table[j + 1][i + 1] = nf + .format(getThermoSystem().getPhases()[i].getComponent(j).getx(), buf, test).toString(); table[j + 1][4] = "[-]"; } buf = new StringBuffer(); @@ -1477,8 +1476,7 @@ public double getActualCompressionRatio() { public void setCompressorChartType(String type) { if (type.equals("simple") || type.equals("fan law")) { compressorChart = new CompressorChart(); - } - else if (type.equals("interpolate")) { + } else if (type.equals("interpolate")) { compressorChart = new CompressorChartAlternativeMapLookup(); } else if (type.equals("interpolate and extrapolate")) { compressorChart = new CompressorChartAlternativeMapLookupExtrapolate(); diff --git a/src/main/java/neqsim/process/equipment/expander/ExpanderOld.java b/src/main/java/neqsim/process/equipment/expander/ExpanderOld.java index 19323c99a3..89905e79eb 100644 --- a/src/main/java/neqsim/process/equipment/expander/ExpanderOld.java +++ b/src/main/java/neqsim/process/equipment/expander/ExpanderOld.java @@ -48,8 +48,7 @@ public ExpanderOld(String name) { *

* * @param name name of expander - * @param inletStream a {@link neqsim.process.equipment.stream.StreamInterface} - * object + * @param inletStream a {@link neqsim.process.equipment.stream.StreamInterface} object */ public ExpanderOld(String name, StreamInterface inletStream) { this(name); @@ -117,10 +116,10 @@ public void displayResult() { for (int i = 0; i < thermoSystem.getNumberOfPhases(); i++) { for (int j = 0; j < thermoSystem.getPhases()[0].getNumberOfComponents(); j++) { - table[j + 1][0] = thermoSystem.getPhases()[0].getComponents()[j].getName(); + table[j + 1][0] = thermoSystem.getPhases()[0].getComponent(j).getName(); buf = new StringBuffer(); table[j + 1][i + 1] = - nf.format(thermoSystem.getPhases()[i].getComponents()[j].getx(), buf, test).toString(); + nf.format(thermoSystem.getPhases()[i].getComponent(j).getx(), buf, test).toString(); table[j + 1][4] = "[-]"; } buf = new StringBuffer(); diff --git a/src/main/java/neqsim/process/equipment/mixer/Mixer.java b/src/main/java/neqsim/process/equipment/mixer/Mixer.java index 62a2953d69..4bcd20f348 100644 --- a/src/main/java/neqsim/process/equipment/mixer/Mixer.java +++ b/src/main/java/neqsim/process/equipment/mixer/Mixer.java @@ -276,10 +276,10 @@ public void displayResult() { for (int i = 0; i < thermoSystem.getNumberOfPhases(); i++) { for (int j = 0; j < thermoSystem.getPhases()[0].getNumberOfComponents(); j++) { - table[j + 1][0] = thermoSystem.getPhases()[0].getComponents()[j].getName(); + table[j + 1][0] = thermoSystem.getPhases()[0].getComponent(j).getName(); buf = new StringBuffer(); table[j + 1][i + 1] = - nf.format(thermoSystem.getPhases()[i].getComponents()[j].getx(), buf, test).toString(); + nf.format(thermoSystem.getPhases()[i].getComponent(j).getx(), buf, test).toString(); table[j + 1][4] = "[-]"; } buf = new StringBuffer(); diff --git a/src/main/java/neqsim/process/equipment/mixer/StaticMixer.java b/src/main/java/neqsim/process/equipment/mixer/StaticMixer.java index cb908579ae..912eecd3eb 100644 --- a/src/main/java/neqsim/process/equipment/mixer/StaticMixer.java +++ b/src/main/java/neqsim/process/equipment/mixer/StaticMixer.java @@ -41,20 +41,20 @@ public void mixStream() { .getNumberOfComponents(); i++) { boolean gotComponent = false; String componentName = - streams.get(k).getThermoSystem().getPhases()[0].getComponents()[i].getName(); + streams.get(k).getThermoSystem().getPhases()[0].getComponent(i).getName(); // System.out.println("adding: " + componentName); double moles = - streams.get(k).getThermoSystem().getPhases()[0].getComponents()[i].getNumberOfmoles(); + streams.get(k).getThermoSystem().getPhases()[0].getComponent(i).getNumberOfmoles(); // System.out.println("moles: " + moles + " " + // mixedStream.getThermoSystem().getPhases()[0].getNumberOfComponents()); for (int p = 0; p < mixedStream.getThermoSystem().getPhases()[0] .getNumberOfComponents(); p++) { - if (mixedStream.getThermoSystem().getPhases()[0].getComponents()[p].getName() + if (mixedStream.getThermoSystem().getPhases()[0].getComponent(p).getName() .equals(componentName)) { gotComponent = true; - index = streams.get(0).getThermoSystem().getPhases()[0].getComponents()[p] + index = streams.get(0).getThermoSystem().getPhases()[0].getComponent(p) .getComponentNumber(); - compName = streams.get(0).getThermoSystem().getPhases()[0].getComponents()[p] + compName = streams.get(0).getThermoSystem().getPhases()[0].getComponent(p) .getComponentName(); } } diff --git a/src/main/java/neqsim/process/equipment/mixer/StaticNeqMixer.java b/src/main/java/neqsim/process/equipment/mixer/StaticNeqMixer.java index b89db56d1c..ff5c18a77e 100644 --- a/src/main/java/neqsim/process/equipment/mixer/StaticNeqMixer.java +++ b/src/main/java/neqsim/process/equipment/mixer/StaticNeqMixer.java @@ -43,24 +43,24 @@ public void mixStream() { .getNumberOfComponents(); i++) { boolean gotComponent = false; String componentName = - streams.get(k).getThermoSystem().getPhases()[0].getComponents()[i].getName(); + streams.get(k).getThermoSystem().getPhases()[0].getComponent(i).getName(); System.out.println("adding: " + componentName); int numberOfPhases = streams.get(k).getThermoSystem().getNumberOfPhases(); double[] moles = new double[numberOfPhases]; // her maa man egentlig sjekke at phase typen er den samme !!! antar at begge er // to fase elle gass - tofase for (int p = 0; p < numberOfPhases; p++) { - moles[p] = streams.get(k).getThermoSystem().getPhases()[p].getComponents()[i] + moles[p] = streams.get(k).getThermoSystem().getPhases()[p].getComponent(i) .getNumberOfMolesInPhase(); } for (int p = 0; p < mixedStream.getThermoSystem().getPhases()[0] .getNumberOfComponents(); p++) { - if (mixedStream.getThermoSystem().getPhases()[0].getComponents()[p].getName() + if (mixedStream.getThermoSystem().getPhases()[0].getComponent(p).getName() .equals(componentName)) { gotComponent = true; - index = streams.get(0).getThermoSystem().getPhases()[0].getComponents()[p] + index = streams.get(0).getThermoSystem().getPhases()[0].getComponent(p) .getComponentNumber(); - compName = streams.get(0).getThermoSystem().getPhases()[0].getComponents()[p] + compName = streams.get(0).getThermoSystem().getPhases()[0].getComponent(p) .getComponentName(); } } diff --git a/src/main/java/neqsim/process/equipment/mixer/StaticPhaseMixer.java b/src/main/java/neqsim/process/equipment/mixer/StaticPhaseMixer.java index 7325f6cee5..ec1fa64769 100644 --- a/src/main/java/neqsim/process/equipment/mixer/StaticPhaseMixer.java +++ b/src/main/java/neqsim/process/equipment/mixer/StaticPhaseMixer.java @@ -36,7 +36,7 @@ public void mixStream() { .getNumberOfComponents(); i++) { boolean gotComponent = false; String componentName = - streams.get(k).getThermoSystem().getPhases()[0].getComponents()[i].getName(); + streams.get(k).getThermoSystem().getPhases()[0].getComponent(i).getName(); System.out.println("adding: " + componentName); int numberOfPhases = streams.get(k).getThermoSystem().getNumberOfPhases(); double[] moles = new double[numberOfPhases]; @@ -45,7 +45,7 @@ public void mixStream() { // her maa man egentlig sjekke at phase typen er den samme !!! antar at begge er // to fase elle gass - tofase for (int p = 0; p < numberOfPhases; p++) { - moles[p] = streams.get(k).getThermoSystem().getPhase(p).getComponents()[i] + moles[p] = streams.get(k).getThermoSystem().getPhase(p).getComponent(i) .getNumberOfMolesInPhase(); phaseType[p] = streams.get(k).getThermoSystem().getPhase(p).getType(); } @@ -57,12 +57,12 @@ public void mixStream() { for (int p = 0; p < mixedStream.getThermoSystem().getPhases()[0] .getNumberOfComponents(); p++) { - if (mixedStream.getThermoSystem().getPhases()[0].getComponents()[p].getName() + if (mixedStream.getThermoSystem().getPhases()[0].getComponent(p).getName() .equals(componentName)) { gotComponent = true; - index = streams.get(0).getThermoSystem().getPhases()[0].getComponents()[p] + index = streams.get(0).getThermoSystem().getPhases()[0].getComponent(p) .getComponentNumber(); - compName = streams.get(0).getThermoSystem().getPhases()[0].getComponents()[p] + compName = streams.get(0).getThermoSystem().getPhases()[0].getComponent(p) .getComponentName(); } } diff --git a/src/main/java/neqsim/process/equipment/pump/Pump.java b/src/main/java/neqsim/process/equipment/pump/Pump.java index 227e7e1cd8..43568fab0e 100644 --- a/src/main/java/neqsim/process/equipment/pump/Pump.java +++ b/src/main/java/neqsim/process/equipment/pump/Pump.java @@ -58,8 +58,7 @@ public Pump(String name) { *

* * @param name name of pump - * @param inletStream a {@link neqsim.process.equipment.stream.StreamInterface} - * object + * @param inletStream a {@link neqsim.process.equipment.stream.StreamInterface} object */ public Pump(String name, StreamInterface inletStream) { super(name, inletStream); @@ -214,10 +213,10 @@ public void displayResult() { for (int i = 0; i < thermoSystem.getNumberOfPhases(); i++) { for (int j = 0; j < thermoSystem.getPhases()[0].getNumberOfComponents(); j++) { - table[j + 1][0] = thermoSystem.getPhases()[0].getComponents()[j].getName(); + table[j + 1][0] = thermoSystem.getPhases()[0].getComponent(j).getName(); buf = new StringBuffer(); table[j + 1][i + 1] = - nf.format(thermoSystem.getPhases()[i].getComponents()[j].getx(), buf, test).toString(); + nf.format(thermoSystem.getPhases()[i].getComponent(j).getx(), buf, test).toString(); table[j + 1][4] = "[-]"; } buf = new StringBuffer(); diff --git a/src/main/java/neqsim/standards/Standard.java b/src/main/java/neqsim/standards/Standard.java index a26a2bb8a5..85f6983496 100644 --- a/src/main/java/neqsim/standards/Standard.java +++ b/src/main/java/neqsim/standards/Standard.java @@ -42,7 +42,7 @@ public abstract class Standard extends NamedBaseClass implements StandardInterfa /** * Constructor for Standard. * - * @param name name of standard + * @param name name of standard * @param description description */ public Standard(String name, String description) { @@ -53,8 +53,8 @@ public Standard(String name, String description) { /** * Constructor for Standard. * - * @param name name of standard - * @param thermoSyst input fluid + * @param name name of standard + * @param thermoSyst input fluid * @param description description of standard */ public Standard(String name, String description, SystemInterface thermoSyst) { @@ -141,12 +141,11 @@ public String[][] createTable(String name) { FieldPosition test = new FieldPosition(0); for (int i = 0; i < thermoSystem.getNumberOfPhases(); i++) { for (int j = 0; j < thermoSystem.getPhases()[0].getNumberOfComponents(); j++) { - table[j + 1][0] = thermoSystem.getPhases()[0].getComponents()[j].getName(); + table[j + 1][0] = thermoSystem.getPhases()[0].getComponent(j).getName(); buf = new StringBuffer(); - table[j + 1][i + 1] = nf - .format(thermoSystem.getPhase(thermoSystem.getPhaseIndex(i)).getComponents()[j].getx(), - buf, test) - .toString(); + table[j + 1][i + 1] = + nf.format(thermoSystem.getPhase(thermoSystem.getPhaseIndex(i)).getComponent(j).getx(), + buf, test).toString(); table[j + 1][4] = "[-]"; } } @@ -163,7 +162,7 @@ public void display(String name) { Container dialogContentPane = dialog.getContentPane(); dialogContentPane.setLayout(new BorderLayout()); - String[] names = { "", "Phase 1", "Phase 2", "Phase 3", "Unit" }; + String[] names = {"", "Phase 1", "Phase 2", "Phase 3", "Unit"}; String[][] table = createTable(name); JTable Jtab = new JTable(table, names); JScrollPane scrollpane = new JScrollPane(Jtab); diff --git a/src/main/java/neqsim/standards/gasquality/Draft_GERG2004.java b/src/main/java/neqsim/standards/gasquality/Draft_GERG2004.java index 43f58ad0f4..9254e8136f 100644 --- a/src/main/java/neqsim/standards/gasquality/Draft_GERG2004.java +++ b/src/main/java/neqsim/standards/gasquality/Draft_GERG2004.java @@ -137,12 +137,11 @@ public String[][] createTable(String name) { FieldPosition test = new FieldPosition(0); for (int i = 0; i < thermoSystem.getNumberOfPhases(); i++) { for (int j = 0; j < thermoSystem.getPhases()[0].getNumberOfComponents(); j++) { - table[j + 1][0] = thermoSystem.getPhases()[0].getComponents()[j].getName(); + table[j + 1][0] = thermoSystem.getPhases()[0].getComponent(j).getName(); buf = new StringBuffer(); - table[j + 1][i + 1] = nf - .format(thermoSystem.getPhase(thermoSystem.getPhaseIndex(i)).getComponents()[j].getx(), - buf, test) - .toString(); + table[j + 1][i + 1] = + nf.format(thermoSystem.getPhase(thermoSystem.getPhaseIndex(i)).getComponent(j).getx(), + buf, test).toString(); table[j + 1][4] = "[-]"; } diff --git a/src/main/java/neqsim/standards/gasquality/Standard_ISO6976.java b/src/main/java/neqsim/standards/gasquality/Standard_ISO6976.java index a1b6ca2960..4198aee662 100644 --- a/src/main/java/neqsim/standards/gasquality/Standard_ISO6976.java +++ b/src/main/java/neqsim/standards/gasquality/Standard_ISO6976.java @@ -452,12 +452,11 @@ public String[][] createTable(String name) { } for (int i = 0; i < thermoSystem.getNumberOfPhases(); i++) { for (int j = 0; j < thermoSystem.getPhases()[0].getNumberOfComponents(); j++) { - table[j + 1][0] = thermoSystem.getPhases()[0].getComponents()[j].getName(); + table[j + 1][0] = thermoSystem.getPhases()[0].getComponent(j).getName(); buf = new StringBuffer(); - table[j + 1][i + 1] = nf - .format(thermoSystem.getPhase(thermoSystem.getPhaseIndex(i)).getComponents()[j].getx(), - buf, test) - .toString(); + table[j + 1][i + 1] = + nf.format(thermoSystem.getPhase(thermoSystem.getPhaseIndex(i)).getComponent(j).getx(), + buf, test).toString(); table[j + 1][4] = "[-]"; } diff --git a/src/main/java/neqsim/thermo/ThermodynamicModelTest.java b/src/main/java/neqsim/thermo/ThermodynamicModelTest.java index e9853dc03a..5e73f4c988 100644 --- a/src/main/java/neqsim/thermo/ThermodynamicModelTest.java +++ b/src/main/java/neqsim/thermo/ThermodynamicModelTest.java @@ -81,10 +81,10 @@ public boolean checkFugacityCoefficients() { double temp1 = 0; for (int j = 0; j < system.getNumberOfPhases(); j++) { for (int i = 0; i < system.getPhase(j).getNumberOfComponents(); i++) { - temp1 += system.getPhase(j).getComponents()[i].getNumberOfMolesInPhase() - * Math.log(system.getPhase(j).getComponents()[i].getFugacityCoefficient()); - // temp2 += system.getPhase(j).getComponents()[i].getNumberOfMolesInPhase() - // * Math.log(system.getPhase(j).getComponents()[i].getFugacityCoefficient()); + temp1 += system.getPhase(j).getComponent(i).getNumberOfMolesInPhase() + * Math.log(system.getPhase(j).getComponent(i).getFugacityCoefficient()); + // temp2 += system.getPhase(j).getComponent(i).getNumberOfMolesInPhase() + // * Math.log(system.getPhase(j).getComponent(i).getFugacityCoefficient()); } temp1 -= system.getPhase(j).getGresTP() / (R * system.getTemperature()); } @@ -124,20 +124,20 @@ public boolean checkFugacityCoefficientsDn() { temp1 = 0; // temp2 = 0; // temp1 += - // Math.log(system.getPhases()[0].getComponents()[j].getFugacityCoefficient()); + // Math.log(system.getPhases()[0].getComponent(j).getFugacityCoefficient()); // temp2 += - // Math.log(system.getPhases()[1].getComponents()[j].getFugacityCoefficient()); + // Math.log(system.getPhases()[1].getComponent(j).getFugacityCoefficient()); for (int i = 0; i < system.getPhase(k).getNumberOfComponents(); i++) { - temp1 += system.getPhase(k).getComponents()[i].getNumberOfMolesInPhase() - * system.getPhase(k).getComponents()[i].getdfugdn(j); - // temp2 += system.getPhases()[1].getComponents()[i].getNumberOfMolesInPhase() - // * system.getPhases()[1].getComponents()[i].getdfugdn(j); + temp1 += system.getPhase(k).getComponent(i).getNumberOfMolesInPhase() + * system.getPhase(k).getComponent(i).getdfugdn(j); + // temp2 += system.getPhases()[1].getComponent(i).getNumberOfMolesInPhase() + // * system.getPhases()[1].getComponent(i).getdfugdn(j); // logger.info("fug " + - // system.getPhases()[1].getComponents()[i].getNumberOfMolesInPhase()*system.getPhases()[1].getComponents()[i].getdfugdn(j)); + // system.getPhases()[1].getComponent(i).getNumberOfMolesInPhase()*system.getPhases()[1].getComponent(i).getdfugdn(j)); } // logger.info("test fugdn gas : " + j + " " + temp1 + " name " + - // system.getPhases()[0].getComponents()[j].getComponentName()); + // system.getPhases()[0].getComponent(j).getComponentName()); // logger.info("test fugdn liq : " + j + " " + temp2); } } @@ -167,14 +167,14 @@ public boolean checkFugacityCoefficientsDn2() { temp1 = 0; // temp2 = 0; // temp1 += - // Math.log(system.getPhases()[0].getComponents()[j].getFugacityCoefficient()); + // Math.log(system.getPhases()[0].getComponent(j).getFugacityCoefficient()); // temp2 += - // Math.log(system.getPhases()[1].getComponents()[j].getFugacityCoefficient()); + // Math.log(system.getPhases()[1].getComponent(j).getFugacityCoefficient()); for (int i = 0; i < system.getPhase(k).getNumberOfComponents(); i++) { - temp1 += system.getPhase(k).getComponents()[i].getdfugdn(j) - - system.getPhase(k).getComponents()[j].getdfugdn(i); - // temp2 += system.getPhases()[1].getComponents()[i].getdfugdn(j) - // - system.getPhases()[1].getComponents()[j].getdfugdn(i); + temp1 += system.getPhase(k).getComponent(i).getdfugdn(j) + - system.getPhase(k).getComponent(j).getdfugdn(i); + // temp2 += system.getPhases()[1].getComponent(i).getdfugdn(j) + // - system.getPhases()[1].getComponent(j).getdfugdn(i); } // sum += Math.abs(temp1) + Math.abs(temp2); // logger.info("test fugdn gas : " + j + " " + temp1); @@ -207,8 +207,8 @@ public boolean checkFugacityCoefficientsDP() { double sum = 0; for (int j = 0; j < system.getNumberOfPhases(); j++) { for (int i = 0; i < system.getPhase(j).getNumberOfComponents(); i++) { - temp1 += system.getPhase(j).getComponents()[i].getNumberOfMolesInPhase() - * system.getPhase(j).getComponents()[i].getdfugdp(); + temp1 += system.getPhase(j).getComponent(i).getNumberOfMolesInPhase() + * system.getPhase(j).getComponent(i).getdfugdp(); } temp1 -= (system.getPhase(j).getZ() - 1.0) * system.getPhase(j).getNumberOfMolesInPhase() / system.getPhase(j).getPressure(); @@ -238,10 +238,10 @@ public boolean checkFugacityCoefficientsDT() { double sum = 0; for (int j = 0; j < system.getNumberOfPhases(); j++) { for (int i = 0; i < system.getPhase(j).getNumberOfComponents(); i++) { - temp1 += system.getPhase(j).getComponents()[i].getNumberOfMolesInPhase() - * system.getPhase(j).getComponents()[i].getdfugdt(); - // temp2 += system.getPhases()[1].getComponents()[i].getNumberOfMolesInPhase() - // * system.getPhases()[1].getComponents()[i].getdfugdt(); + temp1 += system.getPhase(j).getComponent(i).getNumberOfMolesInPhase() + * system.getPhase(j).getComponent(i).getdfugdt(); + // temp2 += system.getPhases()[1].getComponent(i).getNumberOfMolesInPhase() + // * system.getPhases()[1].getComponent(i).getdfugdt(); } temp1 += system.getPhase(j).getHresTP() / (R * Math.pow(system.getTemperature(), 2.0)); // temp2 += system.getPhases()[1].getHresTP() / (R * Math.pow(system.getTemperature(), 2.0)); @@ -279,13 +279,13 @@ public boolean checkNumerically() { system.init(3); for (int i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { - gasnumericDfugdt[0][i] = system.getPhases()[0].getComponents()[i].getdfugdt(); - gasnumericDfugdp[0][i] = system.getPhases()[0].getComponents()[i].getdfugdp(); - liqnumericDfugdt[0][i] = system.getPhases()[1].getComponents()[i].getdfugdt(); - liqnumericDfugdp[0][i] = system.getPhases()[1].getComponents()[i].getdfugdp(); + gasnumericDfugdt[0][i] = system.getPhases()[0].getComponent(i).getdfugdt(); + gasnumericDfugdp[0][i] = system.getPhases()[0].getComponent(i).getdfugdp(); + liqnumericDfugdt[0][i] = system.getPhases()[1].getComponent(i).getdfugdt(); + liqnumericDfugdp[0][i] = system.getPhases()[1].getComponent(i).getdfugdp(); for (int k = 0; k < system.getPhases()[0].getNumberOfComponents(); k++) { - gasnumericDfugdn[0][i][k] = system.getPhases()[0].getComponents()[i].getdfugdn(k); - liqnumericDfugdn[0][i][k] = system.getPhases()[1].getComponents()[i].getdfugdn(k); + gasnumericDfugdn[0][i][k] = system.getPhases()[0].getComponent(i).getdfugdn(k); + liqnumericDfugdn[0][i][k] = system.getPhases()[1].getComponent(i).getdfugdn(k); } } @@ -294,16 +294,16 @@ public boolean checkNumerically() { system.init(3); for (int i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { - gasfug[0][i] = Math.log(system.getPhases()[0].getComponents()[i].getFugacityCoefficient()); - liqfug[0][i] = Math.log(system.getPhases()[1].getComponents()[i].getFugacityCoefficient()); + gasfug[0][i] = Math.log(system.getPhases()[0].getComponent(i).getFugacityCoefficient()); + liqfug[0][i] = Math.log(system.getPhases()[1].getComponent(i).getFugacityCoefficient()); } system.setTemperature(system.getTemperature() - 2 * dt); system.init(3); for (int i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { - gasfug[1][i] = Math.log(system.getPhases()[0].getComponents()[i].getFugacityCoefficient()); - liqfug[1][i] = Math.log(system.getPhases()[1].getComponents()[i].getFugacityCoefficient()); + gasfug[1][i] = Math.log(system.getPhases()[0].getComponent(i).getFugacityCoefficient()); + liqfug[1][i] = Math.log(system.getPhases()[1].getComponent(i).getFugacityCoefficient()); } for (int i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { @@ -327,16 +327,16 @@ public boolean checkNumerically() { system.init(3); for (int i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { - gasfug[0][i] = Math.log(system.getPhases()[0].getComponents()[i].getFugacityCoefficient()); - liqfug[0][i] = Math.log(system.getPhases()[1].getComponents()[i].getFugacityCoefficient()); + gasfug[0][i] = Math.log(system.getPhases()[0].getComponent(i).getFugacityCoefficient()); + liqfug[0][i] = Math.log(system.getPhases()[1].getComponent(i).getFugacityCoefficient()); } system.setPressure(system.getPressure() - 2 * dp); system.init(3); for (int i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { - gasfug[1][i] = Math.log(system.getPhases()[0].getComponents()[i].getFugacityCoefficient()); - liqfug[1][i] = Math.log(system.getPhases()[1].getComponents()[i].getFugacityCoefficient()); + gasfug[1][i] = Math.log(system.getPhases()[0].getComponent(i).getFugacityCoefficient()); + liqfug[1][i] = Math.log(system.getPhases()[1].getComponent(i).getFugacityCoefficient()); } for (int i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { @@ -357,12 +357,12 @@ public boolean checkNumerically() { for (int phase = 0; phase < 2; phase++) { for (int k = 0; k < system.getPhases()[0].getNumberOfComponents(); k++) { - double dn = system.getPhases()[phase].getComponents()[k].getNumberOfMolesInPhase() / 1.0e5; - logger.info( - "component name " + system.getPhases()[phase].getComponents()[k].getComponentName()); + double dn = system.getPhases()[phase].getComponent(k).getNumberOfMolesInPhase() / 1.0e5; + logger + .info("component name " + system.getPhases()[phase].getComponent(k).getComponentName()); logger.info("dn " + dn); // logger.info("component name " + - // system.getPhases()[phase].getComponents()[k].getComponentName()); + // system.getPhases()[phase].getComponent(k).getComponentName()); // logger.info("dn " + dn); if (dn < 1e-12) { dn = 1e-12; @@ -374,9 +374,9 @@ public boolean checkNumerically() { for (int i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { // gasfug[0][i] = - // Math.log(system.getPhases()[0].getComponents()[i].getFugacityCoefficient()); + // Math.log(system.getPhases()[0].getComponent(i).getFugacityCoefficient()); liqfug[0][i] = - Math.log(system.getPhases()[phase].getComponents()[i].getFugacityCoefficient()); + Math.log(system.getPhases()[phase].getComponent(i).getFugacityCoefficient()); } system.addComponent(k, -2.0 * dn, phase); @@ -386,9 +386,9 @@ public boolean checkNumerically() { for (int i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { // gasfug[1][i] = - // Math.log(system.getPhases()[0].getComponents()[i].getFugacityCoefficient()); + // Math.log(system.getPhases()[0].getComponent(i).getFugacityCoefficient()); liqfug[1][i] = - Math.log(system.getPhases()[phase].getComponents()[i].getFugacityCoefficient()); + Math.log(system.getPhases()[phase].getComponent(i).getFugacityCoefficient()); } for (int i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { diff --git a/src/main/java/neqsim/thermo/component/ComponentGEWilson.java b/src/main/java/neqsim/thermo/component/ComponentGEWilson.java index 6d5aaf3455..4de3d69bcd 100644 --- a/src/main/java/neqsim/thermo/component/ComponentGEWilson.java +++ b/src/main/java/neqsim/thermo/component/ComponentGEWilson.java @@ -71,6 +71,7 @@ public double getGamma(PhaseInterface phase, int numberOfComponents, double temp public double getGamma(PhaseInterface phase, int numberOfComponents, double temperature, double pressure, PhaseType pt, double[][] HValpha, double[][] HVgij, double[][] intparam, String[][] mixRule) { + return 0.0; } diff --git a/src/main/java/neqsim/thermo/component/ComponentModifiedFurstElectrolyteEos.java b/src/main/java/neqsim/thermo/component/ComponentModifiedFurstElectrolyteEos.java index 38fab3bfb1..6d89916fdf 100644 --- a/src/main/java/neqsim/thermo/component/ComponentModifiedFurstElectrolyteEos.java +++ b/src/main/java/neqsim/thermo/component/ComponentModifiedFurstElectrolyteEos.java @@ -234,7 +234,7 @@ public double dAlphaLRdndn(int j, PhaseInterface phase, int numberOfComponents, * temperature) * diElectricdn * ((ComponentModifiedFurstElectrolyteEos) ((PhaseModifiedFurstElectrolyteEos) phase) - .getComponents()[j]).getDiElectricConstantdn() + .getComponent(j)).getDiElectricConstantdn() - electronCharge * electronCharge * avagadroNumber / (vacumPermittivity * Math.pow(((PhaseModifiedFurstElectrolyteEos) phase).getDiElectricConstant(), 2.0) @@ -368,12 +368,12 @@ public double dFLRdNdN(int j, PhaseInterface phase, int numberOfComponents, doub double pressure) { return ((PhaseModifiedFurstElectrolyteEos) phase).dFdAlphaLRdX() * XLRi * ((ComponentModifiedFurstElectrolyteEos) ((PhaseModifiedFurstElectrolyteEos) phase) - .getComponents()[j]).getAlphai() + .getComponent(j)).getAlphai() + ((PhaseModifiedFurstElectrolyteEos) phase).dFdAlphaLR() * dAlphaLRdndn(j, phase, numberOfComponents, temperature, pressure) + ((PhaseModifiedFurstElectrolyteEos) phase).dFdAlphaLRdX() * alphai * ((ComponentModifiedFurstElectrolyteEos) ((PhaseModifiedFurstElectrolyteEos) phase) - .getComponents()[j]).getXLRi(); + .getComponent(j)).getXLRi(); } /** @@ -448,7 +448,7 @@ public double calcSolventdiElectricdn(PhaseInterface phase, int numberOfComponen public double calcSolventdiElectricdndn(int j, PhaseInterface phase, int numberOfComponents, double temperature, double pressure) { if (getIonicCharge() != 0 - || ((PhaseModifiedFurstElectrolyteEos) phase).getComponents()[j].getIonicCharge() != 0) { + || ((PhaseModifiedFurstElectrolyteEos) phase).getComponent(j).getIonicCharge() != 0) { return 0.0; } double ans2 = 0.0; @@ -459,7 +459,7 @@ public double calcSolventdiElectricdndn(int j, PhaseInterface phase, int numberO } // return 0.0; return -getDiElectricConstant(temperature) / (ans2 * ans2) - - ((PhaseModifiedFurstElectrolyteEos) phase).getComponents()[j] + - ((PhaseModifiedFurstElectrolyteEos) phase).getComponent(j) .getDiElectricConstant(temperature) / (ans2 * ans2) + 2.0 * ((PhaseModifiedFurstElectrolyteEos) phase).getSolventDiElectricConstant() / (ans2 * ans2); @@ -553,17 +553,17 @@ public double calcdiElectricdndV(PhaseInterface phase, int numberOfComponents, d public double calcdiElectricdndn(int j, PhaseInterface phase, int numberOfComponents, double temperature, double pressure) { double dYdf = ((ComponentModifiedFurstElectrolyteEos) ((PhaseModifiedFurstElectrolyteEos) phase) - .getComponents()[j]).getSolventDiElectricConstantdn(); + .getComponent(j)).getSolventDiElectricConstantdn(); double dXdfdfj = getEpsIonici() * -3.0 / 2.0 / Math.pow(((PhaseModifiedFurstElectrolyteEos) phase).getEpsIonic() / 2.0 + 1.0, 2.0); double dXdf = ((ComponentModifiedFurstElectrolyteEos) ((PhaseModifiedFurstElectrolyteEos) phase) - .getComponents()[j]).getEpsIonici() * getEpsIonici() * 3.0 / 2.0 + .getComponent(j)).getEpsIonici() * getEpsIonici() * 3.0 / 2.0 / Math.pow(((PhaseModifiedFurstElectrolyteEos) phase).getEpsIonic() / 2.0 + 1.0, 3.0); double d1 = ((PhaseModifiedFurstElectrolyteEos) phase).getSolventDiElectricConstant(); double d2 = ((ComponentModifiedFurstElectrolyteEos) ((PhaseModifiedFurstElectrolyteEos) phase) - .getComponents()[j]).getEpsIonici() * -3.0 / 2.0 + .getComponent(j)).getEpsIonici() * -3.0 / 2.0 / Math.pow(((PhaseModifiedFurstElectrolyteEos) phase).getEpsIonic() / 2.0 + 1.0, 2.0); double d5 = getSolventDiElectricConstantdn(); @@ -710,10 +710,10 @@ public double dFSR2dNdN(int j, PhaseInterface phase, int numberOfComponents, dou double pressure) { return ((PhaseModifiedFurstElectrolyteEos) phase).FSR2epseps() * epsi * ((ComponentModifiedFurstElectrolyteEos) ((PhaseModifiedFurstElectrolyteEos) phase) - .getComponents()[j]).getEpsi() + .getComponent(j)).getEpsi() + ((PhaseModifiedFurstElectrolyteEos) phase).FSR2epsW() * Wi * ((ComponentModifiedFurstElectrolyteEos) ((PhaseModifiedFurstElectrolyteEos) phase) - .getComponents()[j]).getEpsi() + .getComponent(j)).getEpsi() + ((PhaseModifiedFurstElectrolyteEos) phase).FSR2W() * ((PhaseModifiedFurstElectrolyteEos) phase).calcWij(componentNumber, j, phase, temperature, pressure, numberOfComponents) @@ -854,13 +854,13 @@ public double dFBorndNdN(int j, PhaseInterface phase, int numberOfComponents, do double pressure) { return ((PhaseModifiedFurstElectrolyteEos) phase).FBornDD() * solventdiElectricdn * ((ComponentModifiedFurstElectrolyteEos) ((PhaseModifiedFurstElectrolyteEos) phase) - .getComponents()[j]).getSolventDiElectricConstantdn() + .getComponent(j)).getSolventDiElectricConstantdn() + ((PhaseModifiedFurstElectrolyteEos) phase).FBornDX() * XBorni * ((ComponentModifiedFurstElectrolyteEos) ((PhaseModifiedFurstElectrolyteEos) phase) - .getComponents()[j]).getSolventDiElectricConstantdn() + .getComponent(j)).getSolventDiElectricConstantdn() + ((PhaseModifiedFurstElectrolyteEos) phase).FBornDX() * solventdiElectricdn * ((ComponentModifiedFurstElectrolyteEos) ((PhaseModifiedFurstElectrolyteEos) phase) - .getComponents()[j]).getXBorni() + .getComponent(j)).getXBorni() + ((PhaseModifiedFurstElectrolyteEos) phase).FBornD() * calcSolventdiElectricdndn(j, phase, numberOfComponents, temperature, pressure); } diff --git a/src/main/java/neqsim/thermo/component/ComponentModifiedFurstElectrolyteEosMod2004.java b/src/main/java/neqsim/thermo/component/ComponentModifiedFurstElectrolyteEosMod2004.java index 7adbd089dc..edaf843f6c 100644 --- a/src/main/java/neqsim/thermo/component/ComponentModifiedFurstElectrolyteEosMod2004.java +++ b/src/main/java/neqsim/thermo/component/ComponentModifiedFurstElectrolyteEosMod2004.java @@ -229,7 +229,7 @@ public double dAlphaLRdndn(int j, PhaseInterface phase, int numberOfComponents, * temperature) * diElectricdn * ((ComponentModifiedFurstElectrolyteEosMod2004) ((PhaseModifiedFurstElectrolyteEosMod2004) phase) - .getComponents()[j]).getDiElectricConstantdn() + .getComponent(j)).getDiElectricConstantdn() - electronCharge * electronCharge * avagadroNumber / (vacumPermittivity * Math.pow( @@ -364,12 +364,12 @@ public double dFLRdNdN(int j, PhaseInterface phase, int numberOfComponents, doub double pressure) { return ((PhaseModifiedFurstElectrolyteEosMod2004) phase).dFdAlphaLRdX() * XLRi * ((ComponentModifiedFurstElectrolyteEosMod2004) ((PhaseModifiedFurstElectrolyteEosMod2004) phase) - .getComponents()[j]).getAlphai() + .getComponent(j)).getAlphai() + ((PhaseModifiedFurstElectrolyteEosMod2004) phase).dFdAlphaLR() * dAlphaLRdndn(j, phase, numberOfComponents, temperature, pressure) + ((PhaseModifiedFurstElectrolyteEosMod2004) phase).dFdAlphaLRdX() * alphai * ((ComponentModifiedFurstElectrolyteEosMod2004) ((PhaseModifiedFurstElectrolyteEosMod2004) phase) - .getComponents()[j]).getXLRi(); + .getComponent(j)).getXLRi(); } /** @@ -442,9 +442,8 @@ public double calcSolventdiElectricdn(PhaseInterface phase, int numberOfComponen */ public double calcSolventdiElectricdndn(int j, PhaseInterface phase, int numberOfComponents, double temperature, double pressure) { - if (getIonicCharge() != 0 - || ((PhaseModifiedFurstElectrolyteEosMod2004) phase).getComponents()[j] - .getIonicCharge() != 0) { + if (getIonicCharge() != 0 || ((PhaseModifiedFurstElectrolyteEosMod2004) phase).getComponent(j) + .getIonicCharge() != 0) { } /* * double ans2 = 0.0; for (int i = 0; i < numberOfComponents; i++) { if @@ -454,7 +453,7 @@ public double calcSolventdiElectricdndn(int j, PhaseInterface phase, int numberO return 0.0; // return -getDiElectricConstant(temperature)/(ans2*ans2) - // ((ComponentModifiedFurstElectrolyteEosMod2004)((PhaseModifiedFurstElectrolyteEosMod2004) - // phase).getComponents()[j]).getDiElectricConstant(temperature)/(ans2*ans2) + + // phase).getComponent(j)).getDiElectricConstant(temperature)/(ans2*ans2) + // 2.0*((PhaseModifiedFurstElectrolyteEosMod2004) // phase).getSolventDiElectricConstant()/(ans2*ans2); } @@ -550,20 +549,20 @@ public double calcdiElectricdndn(int j, PhaseInterface phase, int numberOfCompon double temperature, double pressure) { double dYdf = ((ComponentModifiedFurstElectrolyteEosMod2004) ((PhaseModifiedFurstElectrolyteEosMod2004) phase) - .getComponents()[j]).getSolventDiElectricConstantdn(); + .getComponent(j)).getSolventDiElectricConstantdn(); double dXdfdfj = getEpsIonici() * -3.0 / 2.0 / Math .pow(((PhaseModifiedFurstElectrolyteEosMod2004) phase).getEpsIonic() / 2.0 + 1.0, 2.0); double dXdf = ((ComponentModifiedFurstElectrolyteEosMod2004) ((PhaseModifiedFurstElectrolyteEosMod2004) phase) - .getComponents()[j]).getEpsIonici() * getEpsIonici() * 3.0 / 2.0 + .getComponent(j)).getEpsIonici() * getEpsIonici() * 3.0 / 2.0 / Math.pow(((PhaseModifiedFurstElectrolyteEosMod2004) phase).getEpsIonic() / 2.0 + 1.0, 3.0); double d1 = ((PhaseModifiedFurstElectrolyteEosMod2004) phase).getSolventDiElectricConstant(); double d2 = ((ComponentModifiedFurstElectrolyteEosMod2004) ((PhaseModifiedFurstElectrolyteEosMod2004) phase) - .getComponents()[j]).getEpsIonici() * -3.0 / 2.0 + .getComponent(j)).getEpsIonici() * -3.0 / 2.0 / Math.pow(((PhaseModifiedFurstElectrolyteEosMod2004) phase).getEpsIonic() / 2.0 + 1.0, 2.0); double d5 = getSolventDiElectricConstantdn(); @@ -712,10 +711,10 @@ public double dFSR2dNdN(int j, PhaseInterface phase, int numberOfComponents, dou double pressure) { return ((PhaseModifiedFurstElectrolyteEosMod2004) phase).FSR2epseps() * epsi * ((ComponentModifiedFurstElectrolyteEosMod2004) ((PhaseModifiedFurstElectrolyteEosMod2004) phase) - .getComponents()[j]).getEpsi() + .getComponent(j)).getEpsi() + ((PhaseModifiedFurstElectrolyteEosMod2004) phase).FSR2epsW() * Wi * ((ComponentModifiedFurstElectrolyteEosMod2004) ((PhaseModifiedFurstElectrolyteEosMod2004) phase) - .getComponents()[j]).getEpsi() + .getComponent(j)).getEpsi() + ((PhaseModifiedFurstElectrolyteEosMod2004) phase).FSR2W() * ((PhaseModifiedFurstElectrolyteEosMod2004) phase).calcWij(componentNumber, j, phase, temperature, pressure, numberOfComponents) diff --git a/src/main/java/neqsim/thermo/mixingrule/CPAMixing.java b/src/main/java/neqsim/thermo/mixingrule/CPAMixing.java index 8c1c7eead3..c9fe704ef2 100644 --- a/src/main/java/neqsim/thermo/mixingrule/CPAMixing.java +++ b/src/main/java/neqsim/thermo/mixingrule/CPAMixing.java @@ -275,8 +275,9 @@ public double calcDeltadN(int derivativeComp, int siteNumber1, int siteNumber2, public double calcDeltadT(int siteNumber1, int siteNumber2, int compnumb1, int compnumb2, PhaseInterface phase, double temperature, double pressure, int numbcomp) { if (assosSchemeType[compnumb1][compnumb2] == 0) { - double derivative1 = -getCrossAssociationEnergy(compnumb2, compnumb2, phase, temperature, - pressure, numbcomp) / (R * phase.getTemperature() * phase.getTemperature()) + double derivative1 = + -getCrossAssociationEnergy(compnumb2, compnumb2, phase, temperature, pressure, numbcomp) + / (R * phase.getTemperature() * phase.getTemperature()) * (Math.exp(getCrossAssociationEnergy(compnumb2, compnumb2, phase, temperature, pressure, numbcomp) / (R * phase.getTemperature()))) * (((ComponentEosInterface) phase.getComponent(compnumb2)).getb() @@ -293,8 +294,9 @@ public double calcDeltadT(int siteNumber1, int siteNumber2, int compnumb1, int c numbcomp) * ((PhaseCPAInterface) phase).getGcpa(); - double derivative2 = -getCrossAssociationEnergy(compnumb1, compnumb1, phase, temperature, - pressure, numbcomp) / (R * phase.getTemperature() * phase.getTemperature()) + double derivative2 = + -getCrossAssociationEnergy(compnumb1, compnumb1, phase, temperature, pressure, numbcomp) + / (R * phase.getTemperature() * phase.getTemperature()) * (Math.exp(getCrossAssociationEnergy(compnumb1, compnumb1, phase, temperature, pressure, numbcomp) / (R * phase.getTemperature()))) * (((ComponentEosInterface) phase.getComponent(compnumb1)).getb() @@ -320,7 +322,8 @@ public double calcDeltadT(int siteNumber1, int siteNumber2, int compnumb1, int c -getCrossAssociationEnergy(compnumb1, compnumb2, phase, temperature, pressure, numbcomp) / (R * phase.getTemperature() * phase.getTemperature()); return ((PhaseCPAInterface) phase).getCrossAssosiationScheme(compnumb1, compnumb2, - siteNumber1, siteNumber2) * derivative + siteNumber1, siteNumber2) + * derivative * (Math.exp(getCrossAssociationEnergy(compnumb1, compnumb2, phase, temperature, pressure, numbcomp) / (R * phase.getTemperature())) - 1.0) * (((ComponentEosInterface) phase.getComponent(compnumb1)).getb() @@ -362,7 +365,8 @@ public double calcDeltadTdV(int siteNumber1, int siteNumber2, int compnumb1, int -getCrossAssociationEnergy(compnumb1, compnumb2, phase, temperature, pressure, numbcomp) / (R * phase.getTemperature() * phase.getTemperature()); return ((PhaseCPAInterface) phase).getCrossAssosiationScheme(compnumb1, compnumb2, - siteNumber1, siteNumber2) * derivative + siteNumber1, siteNumber2) + * derivative * Math.exp(getCrossAssociationEnergy(compnumb1, compnumb2, phase, temperature, pressure, numbcomp) / (R * phase.getTemperature())) * (((ComponentEosInterface) phase.getComponent(compnumb1)).getb() @@ -384,8 +388,9 @@ public double calcDeltadTdT(int siteNumber1, int siteNumber2, int compnumb1, int deltaj = calcDelta(compnumb2, compnumb2, phase, temperature, pressure, numbcomp); } - double dDeltaidT = -getCrossAssociationEnergy(compnumb1, compnumb1, phase, temperature, - pressure, numbcomp) / (R * phase.getTemperature() * phase.getTemperature()) + double dDeltaidT = + -getCrossAssociationEnergy(compnumb1, compnumb1, phase, temperature, pressure, numbcomp) + / (R * phase.getTemperature() * phase.getTemperature()) * (Math.exp(getCrossAssociationEnergy(compnumb1, compnumb1, phase, temperature, pressure, numbcomp) / (R * phase.getTemperature()))) * (((ComponentEosInterface) phase.getComponent(compnumb1)).getb() @@ -393,8 +398,9 @@ public double calcDeltadTdT(int siteNumber1, int siteNumber2, int compnumb1, int / 2.0 * getCrossAssociationVolume(compnumb1, compnumb1, phase, temperature, pressure, numbcomp) * ((PhaseCPAInterface) phase).getGcpa(); - double dDeltajdT = -getCrossAssociationEnergy(compnumb2, compnumb2, phase, temperature, - pressure, numbcomp) / (R * phase.getTemperature() * phase.getTemperature()) + double dDeltajdT = + -getCrossAssociationEnergy(compnumb2, compnumb2, phase, temperature, pressure, numbcomp) + / (R * phase.getTemperature() * phase.getTemperature()) * (Math.exp(getCrossAssociationEnergy(compnumb2, compnumb2, phase, temperature, pressure, numbcomp) / (R * phase.getTemperature()))) * (((ComponentEosInterface) phase.getComponent(compnumb2)).getb() @@ -455,7 +461,8 @@ public double calcDeltadTdT(int siteNumber1, int siteNumber2, int compnumb1, int / (R * phase.getTemperature() * phase.getTemperature() * phase.getTemperature()); return ((PhaseCPAInterface) phase).getCrossAssosiationScheme(compnumb1, compnumb2, - siteNumber1, siteNumber2) * derivative1 * derivative1 + siteNumber1, siteNumber2) + * derivative1 * derivative1 * Math.exp(getCrossAssociationEnergy(compnumb1, compnumb2, phase, temperature, pressure, numbcomp) / (R * phase.getTemperature())) * (((ComponentEosInterface) phase.getComponent(compnumb1)).getb() @@ -464,7 +471,8 @@ public double calcDeltadTdT(int siteNumber1, int siteNumber2, int compnumb1, int * getCrossAssociationVolume(compnumb1, compnumb2, phase, temperature, pressure, numbcomp) * ((PhaseCPAInterface) phase).getGcpa() + ((PhaseCPAInterface) phase).getCrossAssosiationScheme(compnumb1, compnumb2, siteNumber1, - siteNumber2) * derivative2 + siteNumber2) + * derivative2 * Math.exp(getCrossAssociationEnergy(compnumb1, compnumb2, phase, temperature, pressure, numbcomp) / (R * phase.getTemperature())) * (((ComponentEosInterface) phase.getComponent(compnumb1)).getb() @@ -602,7 +610,7 @@ public CPAMixingInterface getMixingRule(int i, PhaseInterface phase) { cpaEpsCross = new double[phase.getNumberOfComponents()][phase.getNumberOfComponents()]; for (int k = 0; k < phase.getNumberOfComponents(); k++) { - String component_name = phase.getComponents()[k].getComponentName(); + String component_name = phase.getComponent(k).getComponentName(); java.sql.ResultSet dataSet = null; for (int l = k; l < phase.getNumberOfComponents(); l++) { @@ -614,13 +622,13 @@ public CPAMixingInterface getMixingRule(int i, PhaseInterface phase) { // database = new util.database.NeqSimDataBase(); if (NeqSimDataBase.createTemporaryTables()) { dataSet = database.getResultSet("SELECT * FROM intertemp WHERE (comp1='" - + component_name + "' AND comp2='" + phase.getComponents()[l].getComponentName() - + "') OR (comp1='" + phase.getComponents()[l].getComponentName() + "' AND comp2='" + + component_name + "' AND comp2='" + phase.getComponent(l).getComponentName() + + "') OR (comp1='" + phase.getComponent(l).getComponentName() + "' AND comp2='" + component_name + "')"); } else { dataSet = database.getResultSet("SELECT * FROM inter WHERE (comp1='" + component_name - + "' AND comp2='" + phase.getComponents()[l].getComponentName() + "') OR (comp1='" - + phase.getComponents()[l].getComponentName() + "' AND comp2='" + component_name + + "' AND comp2='" + phase.getComponent(l).getComponentName() + "') OR (comp1='" + + phase.getComponent(l).getComponentName() + "' AND comp2='" + component_name + "')"); } if (dataSet.next()) { diff --git a/src/main/java/neqsim/thermo/mixingrule/EosMixingRules.java b/src/main/java/neqsim/thermo/mixingrule/EosMixingRules.java index 6284f98f59..7bc3b401d2 100644 --- a/src/main/java/neqsim/thermo/mixingrule/EosMixingRules.java +++ b/src/main/java/neqsim/thermo/mixingrule/EosMixingRules.java @@ -1106,7 +1106,7 @@ public double calcAi(int compNumb, PhaseInterface phase, double temperature, dou ComponentEosInterface[] compArray = (ComponentEosInterface[]) phase.getcomponentArray(); aij = compArray[compNumb].getaT() / compArray[compNumb].getb(); A = getB() * (aij - R * temperature - * Math.log(((ComponentGEInterface) gePhase.getComponents()[compNumb]).getGamma()) / hwfc); + * Math.log(((ComponentGEInterface) gePhase.getComponent(compNumb)).getGamma()) / hwfc); A += getA() * calcBi(compNumb, phase, temperature, pressure, numbcomp) / getB(); // System.out.println("Ai HV : " + A); @@ -1122,11 +1122,10 @@ public double calcAiT(int compNumb, PhaseInterface phase, double temperature, do A = getB() * (compArray[compNumb].getaDiffT() / compArray[compNumb].getb() - - R * Math.log(((ComponentGEInterface) gePhase.getComponents()[compNumb]).getGamma()) + - R * Math.log(((ComponentGEInterface) gePhase.getComponent(compNumb)).getGamma()) / hwfc - R * temperature - * ((ComponentGEInterface) gePhase.getComponents()[compNumb]).getlnGammadt() - / hwfc) + * ((ComponentGEInterface) gePhase.getComponent(compNumb)).getlnGammadt() / hwfc) + compArray[compNumb].getb() * calcAT(phase, temperature, pressure, numbcomp) / getB(); // 0.5/Math.sqrt(compArray[compNumb].getaT()*compArray[j].getaT())*(compArray[compNumb].getaT() // * compArray[j].getaDiffT() +compArray[j].getaT() * @@ -1144,10 +1143,8 @@ public double calcAT(PhaseInterface phase, double temperature, double pressure, for (int i = 0; i < numbcomp; i++) { A += compArray[i].getNumberOfMolesInPhase() * (compArray[i].getaDiffT() / compArray[i].getb() - - R * Math.log(((ComponentGEInterface) gePhase.getComponents()[i]).getGamma()) - / hwfc - - R * temperature - * ((ComponentGEInterface) gePhase.getComponents()[i]).getlnGammadt() + - R * Math.log(((ComponentGEInterface) gePhase.getComponent(i)).getGamma()) / hwfc + - R * temperature * ((ComponentGEInterface) gePhase.getComponent(i)).getlnGammadt() / Math.log(2.0)); // ....); // 0.5/Math.sqrt(compArray[compNumb].getaT()*compArray[j].getaT())*(compArray[compNumb].getaT() @@ -1166,10 +1163,9 @@ public double calcAij(int compNumb, int compNumbj, PhaseInterface phase, double ComponentEosInterface[] compArray = (ComponentEosInterface[]) phase.getcomponentArray(); double aij = compArray[compNumbj].getb() * (compArray[compNumb].getaT() / compArray[compNumb].getb() - R * temperature - * Math.log(((ComponentGEInterface) gePhase.getComponents()[compNumb]).getGamma()) - / hwfc) + * Math.log(((ComponentGEInterface) gePhase.getComponent(compNumb)).getGamma()) / hwfc) - getB() * R * temperature / hwfc - * ((ComponentGEInterface) gePhase.getComponents()[compNumb]).getlnGammadn(compNumbj) + * ((ComponentGEInterface) gePhase.getComponent(compNumb)).getlnGammadn(compNumbj) + compArray[compNumb].getb() * (compArray[compNumbj].getaT() / compArray[compNumbj].getb() - R * temperature * Math.log(((ComponentGEInterface) gePhase.getComponents()[compNumbj]).getGamma()) @@ -1361,21 +1357,20 @@ public void init(PhaseInterface phase, double temperature, double pressure, int alpha_mix = 0.0; dadt = 0.0; for (int i = 0; i < numbcomp; i++) { - term = qPure[i] - + hwfc * Math.log(((ComponentGEInterface) gePhase.getComponents()[i]).getGamma()); - alpha_mix += phase.getComponents()[i].getNumberOfMolesInPhase() + term = + qPure[i] + hwfc * Math.log(((ComponentGEInterface) gePhase.getComponent(i)).getGamma()); + alpha_mix += phase.getComponent(i).getNumberOfMolesInPhase() / phase.getNumberOfMolesInPhase() * term; ader[i] = term; compArray[i].setAder(ader[i]); if (phase.getInitType() > 1) { - term = qPuredT[i] - + hwfc * ((ComponentGEInterface) gePhase.getComponents()[i]).getlnGammadt(); + term = + qPuredT[i] + hwfc * ((ComponentGEInterface) gePhase.getComponent(i)).getlnGammadt(); dubdert += (qPuredTdT[i] - + hwfc * ((ComponentGEInterface) gePhase.getComponents()[i]).getlnGammadtdt()) - * phase.getComponents()[i].getNumberOfMolesInPhase() - / phase.getNumberOfMolesInPhase(); - dadt += term * phase.getComponents()[i].getNumberOfMolesInPhase() + + hwfc * ((ComponentGEInterface) gePhase.getComponent(i)).getlnGammadtdt()) + * phase.getComponent(i).getNumberOfMolesInPhase() / phase.getNumberOfMolesInPhase(); + dadt += term * phase.getComponent(i).getNumberOfMolesInPhase() / phase.getNumberOfMolesInPhase(); adert[i] = term; compArray[i].setdAdTdn(adert[i]); @@ -1387,7 +1382,7 @@ public void init(PhaseInterface phase, double temperature, double pressure, int if (phase.getInitType() > 2) { for (int i = 0; i < numbcomp; i++) { for (int j = 0; j < numbcomp; j++) { - ad2[i][j] = hwfc * ((ComponentGEInterface) gePhase.getComponents()[i]).getlnGammadn(j); + ad2[i][j] = hwfc * ((ComponentGEInterface) gePhase.getComponent(i)).getlnGammadn(j); compArray[i].setdAdndn(j, ad2[i][j]); } } @@ -1664,23 +1659,22 @@ public void init(PhaseInterface phase, double temperature, double pressure, int double sd2 = (2 * hex - cpex * temperature) / Math.pow(temperature, 3.0); double cnt2 = 0.0; for (int i = 0; i < numbcomp; i++) { - cnt2 += phase.getComponents()[i].getNumberOfMolesInPhase() / phase.getNumberOfMolesInPhase() + cnt2 += phase.getComponent(i).getNumberOfMolesInPhase() / phase.getNumberOfMolesInPhase() * qPuredTdT[i]; // second part } alpha_mix = 0.0; dadt = 0.0; for (int i = 0; i < numbcomp; i++) { - term = qPure[i] - + hwfc * Math.log(((ComponentGEInterface) gePhase.getComponents()[i]).getGamma()); - alpha_mix += phase.getComponents()[i].getNumberOfMolesInPhase() + term = + qPure[i] + hwfc * Math.log(((ComponentGEInterface) gePhase.getComponent(i)).getGamma()); + alpha_mix += phase.getComponent(i).getNumberOfMolesInPhase() / phase.getNumberOfMolesInPhase() * term; ader[i] = term; compArray[i].setAder(ader[i]); - term = - qPuredT[i] + hwfc * ((ComponentGEInterface) gePhase.getComponents()[i]).getlnGammadt(); - dadt += term * phase.getComponents()[i].getNumberOfMolesInPhase() + term = qPuredT[i] + hwfc * ((ComponentGEInterface) gePhase.getComponent(i)).getlnGammadt(); + dadt += term * phase.getComponent(i).getNumberOfMolesInPhase() / phase.getNumberOfMolesInPhase(); adert[i] = term; compArray[i].setdAdTdn(adert[i]); @@ -1689,7 +1683,7 @@ public void init(PhaseInterface phase, double temperature, double pressure, int // TODO implment hex and Cpex and set dAdTdT for (int i = 0; i < numbcomp; i++) { for (int j = 0; j < numbcomp; j++) { - ad2[i][j] = hwfc * ((ComponentGEInterface) gePhase.getComponents()[i]).getlnGammadn(j); + ad2[i][j] = hwfc * ((ComponentGEInterface) gePhase.getComponent(i)).getlnGammadn(j); compArray[i].setdAdndn(j, ad2[i][j]); } } @@ -1707,11 +1701,10 @@ public void init(PhaseInterface phase, double temperature, double pressure, int double ssi = 0.0; for (int j = 0; j < numbcomp; j++) { ssi += (1.0 - WSintparam[i][j]) * (abft2[i] + abft2[j]) - * phase.getComponents()[j].getNumberOfMolesInPhase() - / phase.getNumberOfMolesInPhase(); + * phase.getComponent(j).getNumberOfMolesInPhase() / phase.getNumberOfMolesInPhase(); } - dd2 += phase.getComponents()[i].getNumberOfMolesInPhase() / phase.getNumberOfMolesInPhase() - * ssi; + dd2 += + phase.getComponent(i).getNumberOfMolesInPhase() / phase.getNumberOfMolesInPhase() * ssi; } dd2 = 0.5 * dd2; @@ -1731,20 +1724,19 @@ public void init(PhaseInterface phase, double temperature, double pressure, int for (int i = 0; i < numbcomp; i++) { double ss = 0.0; for (int j = 0; j < numbcomp; j++) { - ss += qf2[j][i] * phase.getComponents()[j].getNumberOfMolesInPhase() + ss += qf2[j][i] * phase.getComponent(j).getNumberOfMolesInPhase() / phase.getNumberOfMolesInPhase(); } qf1[i] = ss; - Q += phase.getComponents()[i].getNumberOfMolesInPhase() / phase.getNumberOfMolesInPhase() - * ss; + Q += phase.getComponent(i).getNumberOfMolesInPhase() / phase.getNumberOfMolesInPhase() * ss; double sst = 0.0; for (int j = 0; j < numbcomp; j++) { - sst += qft[j][i] * phase.getComponents()[j].getNumberOfMolesInPhase() + sst += qft[j][i] * phase.getComponent(j).getNumberOfMolesInPhase() / phase.getNumberOfMolesInPhase(); } QFTD[i] = sst; - QT += phase.getComponents()[i].getNumberOfMolesInPhase() / phase.getNumberOfMolesInPhase() - * sst; + QT += + phase.getComponent(i).getNumberOfMolesInPhase() / phase.getNumberOfMolesInPhase() * sst; } double d_mix = 0.5 * Q; double d_mixt = 0.5 * QT; @@ -2135,7 +2127,7 @@ public EosMixingRulesInterface getMixingRule(int i, PhaseInterface phase) { String component_name = phase.getComponent(k).getComponentName(); for (int l = k; l < phase.getNumberOfComponents(); l++) { - String component_name2 = phase.getComponents()[l].getComponentName(); + String component_name2 = phase.getComponent(l).getComponentName(); if (k == l) { classicOrHV[k][l] = "Classic"; classicOrWS[k][l] = "Classic"; @@ -2289,20 +2281,16 @@ public EosMixingRulesInterface getMixingRule(int i, PhaseInterface phase) { // +component_name2 + " and " + // component_name+ " to " + // intparam[k][l]); - } else if ((component_name.equals("CO2") - && phase.getComponents()[l].isIsTBPfraction()) - || (component_name2.equals("CO2") - && phase.getComponents()[k].isIsTBPfraction())) { + } else if ((component_name.equals("CO2") && phase.getComponent(l).isIsTBPfraction()) + || (component_name2.equals("CO2") && phase.getComponent(k).isIsTBPfraction())) { intparam[k][l] = 0.1; } else if ((component_name.equals("nitrogen") - && phase.getComponents()[l].isIsTBPfraction()) + && phase.getComponent(l).isIsTBPfraction()) || (component_name2.equals("nitrogen") - && phase.getComponents()[k].isIsTBPfraction())) { + && phase.getComponent(k).isIsTBPfraction())) { intparam[k][l] = 0.08; - } else if ((component_name.equals("water") - && phase.getComponents()[l].isIsTBPfraction()) - || (component_name2.equals("water") - && phase.getComponents()[k].isIsTBPfraction())) { + } else if ((component_name.equals("water") && phase.getComponent(l).isIsTBPfraction()) + || (component_name2.equals("water") && phase.getComponent(k).isIsTBPfraction())) { intparam[k][l] = 0.2; if (phase.getClass().getName().equals("neqsim.thermo.phase.PhaseSrkCPA") @@ -2311,8 +2299,8 @@ public EosMixingRulesInterface getMixingRule(int i, PhaseInterface phase) { .equals("neqsim.thermo.phase.PhaseElectrolyteCPAstatoil")) { // intparam[k][l] = -0.0685; // taken from Riaz et a. 2012 - double molmassPC = phase.getComponents()[l].getMolarMass(); - if (phase.getComponents()[k].isIsTBPfraction()) { + double molmassPC = phase.getComponent(l).getMolarMass(); + if (phase.getComponent(k).isIsTBPfraction()) { molmassPC = phase.getComponents()[k].getMolarMass(); } double intparamkPC = -0.1533 * Math.log(1000.0 * molmassPC) + 0.7055; @@ -2321,8 +2309,7 @@ public EosMixingRulesInterface getMixingRule(int i, PhaseInterface phase) { intparamT[k][l] = 0.0; } - } else if ((component_name.equals("MEG") - && phase.getComponents()[l].isIsTBPfraction()) + } else if ((component_name.equals("MEG") && phase.getComponent(l).isIsTBPfraction()) || (component_name2.equals("MEG") && phase.getComponents()[k].isIsTBPfraction())) { intparam[k][l] = 0.2; @@ -2330,7 +2317,7 @@ public EosMixingRulesInterface getMixingRule(int i, PhaseInterface phase) { || phase.getClass().getName().equals("neqsim.thermo.phase.PhaseSrkCPAs") || phase.getClass().getName() .equals("neqsim.thermo.phase.PhaseElectrolyteCPAstatoil")) { - double molmassPC = phase.getComponents()[l].getMolarMass(); + double molmassPC = phase.getComponent(l).getMolarMass(); if (phase.getComponents()[k].isIsTBPfraction()) { molmassPC = phase.getComponents()[k].getMolarMass(); } @@ -2341,7 +2328,7 @@ public EosMixingRulesInterface getMixingRule(int i, PhaseInterface phase) { intparamT[k][l] = 0.0; } } else if ((component_name.equals("ethanol") - && phase.getComponents()[l].isIsTBPfraction()) + && phase.getComponent(l).isIsTBPfraction()) || (component_name2.equals("ethanol") && phase.getComponents()[k].isIsTBPfraction())) { intparam[k][l] = 0.0; @@ -2352,12 +2339,12 @@ public EosMixingRulesInterface getMixingRule(int i, PhaseInterface phase) { intparam[k][l] = -0.05; intparamT[k][l] = 0.0; if (phase.getComponents()[k].getMolarMass() > (200.0 / 1000.0) - || phase.getComponents()[l].getMolarMass() > (200.0 / 1000.0)) { + || phase.getComponent(l).getMolarMass() > (200.0 / 1000.0)) { intparam[k][l] = -0.1; } } } else if ((component_name.equals("methanol") - && phase.getComponents()[l].isIsTBPfraction()) + && phase.getComponent(l).isIsTBPfraction()) || (component_name2.equals("methanol") && phase.getComponents()[k].isIsTBPfraction())) { intparam[k][l] = 0.0; @@ -2368,12 +2355,11 @@ public EosMixingRulesInterface getMixingRule(int i, PhaseInterface phase) { intparam[k][l] = -0.1; intparamT[k][l] = 0.0; if (phase.getComponents()[k].getMolarMass() > (200.0 / 1000.0) - || phase.getComponents()[l].getMolarMass() > (200.0 / 1000.0)) { + || phase.getComponent(l).getMolarMass() > (200.0 / 1000.0)) { intparam[k][l] = -0.2; } } - } else if ((component_name.equals("TEG") - && phase.getComponents()[l].isIsTBPfraction()) + } else if ((component_name.equals("TEG") && phase.getComponent(l).isIsTBPfraction()) || (component_name2.equals("TEG") && phase.getComponents()[k].isIsTBPfraction())) { intparam[k][l] = 0.12; @@ -2384,7 +2370,7 @@ public EosMixingRulesInterface getMixingRule(int i, PhaseInterface phase) { intparam[k][l] = 0.12; intparamT[k][l] = 0.0; } - } else if ((component_name.equals("S8") && phase.getComponents()[l].isIsTBPfraction()) + } else if ((component_name.equals("S8") && phase.getComponent(l).isIsTBPfraction()) || (component_name2.equals("S8") && phase.getComponents()[k].isIsTBPfraction())) { intparam[k][l] = 0.05; } else { diff --git a/src/main/java/neqsim/thermo/phase/PhaseDesmukhMather.java b/src/main/java/neqsim/thermo/phase/PhaseDesmukhMather.java index 040b066716..b58c31f07c 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseDesmukhMather.java +++ b/src/main/java/neqsim/thermo/phase/PhaseDesmukhMather.java @@ -28,8 +28,7 @@ public class PhaseDesmukhMather extends PhaseGE { * Constructor for PhaseDesmukhMather. *

*/ - public PhaseDesmukhMather() { - } + public PhaseDesmukhMather() {} /** {@inheritDoc} */ @Override @@ -58,25 +57,25 @@ public void setMixingRule(int type) { this.bij = new double[numberOfComponents][numberOfComponents]; try (neqsim.util.database.NeqSimDataBase database = new neqsim.util.database.NeqSimDataBase()) { for (int k = 0; k < getNumberOfComponents(); k++) { - String component_name = getComponents()[k].getComponentName(); + String component_name = getComponent(k).getComponentName(); for (int l = k; l < getNumberOfComponents(); l++) { if (k == l) { - if (getComponents()[l].getComponentName().equals("MDEA") - && getComponents()[k].getComponentName().equals("MDEA")) { + if (getComponent(l).getComponentName().equals("MDEA") + && getComponent(k).getComponentName().equals("MDEA")) { aij[k][l] = -0.0828487; this.aij[l][k] = this.aij[k][l]; } } else { try (java.sql.ResultSet dataSet = database.getResultSet("SELECT * FROM inter WHERE (comp1='" + component_name - + "' AND comp2='" + getComponents()[l].getComponentName() + "') OR (comp1='" - + getComponents()[l].getComponentName() + "' AND comp2='" + component_name + + "' AND comp2='" + getComponent(l).getComponentName() + "') OR (comp1='" + + getComponent(l).getComponentName() + "' AND comp2='" + component_name + "')");) { dataSet.next(); // if - // (dataSet.getString("comp1").trim().equals(getComponents()[l].getComponentName())) { + // (dataSet.getString("comp1").trim().equals(getComponent(l).getComponentName())) { // templ = k; // tempk = l; // } @@ -199,7 +198,7 @@ public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, double temperature, double pressure, PhaseType pt) { GE = 0; for (int i = 0; i < numberOfComponents; i++) { - GE += phase.getComponents()[i].getx() * Math.log(((ComponentDesmukhMather) componentArray[i]) + GE += phase.getComponent(i).getx() * Math.log(((ComponentDesmukhMather) componentArray[i]) .getGamma(phase, numberOfComponents, temperature, pressure, pt)); } return R * temperature * numberOfMolesInPhase * GE; diff --git a/src/main/java/neqsim/thermo/phase/PhaseDuanSun.java b/src/main/java/neqsim/thermo/phase/PhaseDuanSun.java index 6d2383f632..31c4c078d3 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseDuanSun.java +++ b/src/main/java/neqsim/thermo/phase/PhaseDuanSun.java @@ -84,18 +84,18 @@ public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, // salinity=salinity+phase.getComponent("Na+").getNumberOfMolesInPhase()/(phase.getComponent("water").getNumberOfmoles()*phase.getComponent("water").getMolarMass()); // for (int i=2;igetVCommontemp.

+ *

+ * getVCommontemp. + *

* * @return a double */ @@ -91,7 +92,9 @@ public double getVCommontemp() { } /** - *

getFCommontemp.

+ *

+ * getFCommontemp. + *

* * @return a double */ @@ -123,7 +126,7 @@ public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, double temperature, double pressure, PhaseType pt) { double GE = 0.0; calcCommontemp(phase, numberOfComponents, temperature, pressure, pt); - // ((ComponentGEUnifacUMRPRU) phase.getComponents()[0]).commonInit(phase, numberOfComponents, + // ((ComponentGEUnifacUMRPRU) phase.getComponent(0)).commonInit(phase, numberOfComponents, // temperature, pressure, pt); initQmix(); @@ -131,7 +134,7 @@ public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, initQmixdN(); } for (int i = 0; i < numberOfComponents; i++) { - GE += phase.getComponents()[i].getx() * Math.log(((ComponentGEUniquac) componentArray[i]) + GE += phase.getComponent(i).getx() * Math.log(((ComponentGEUniquac) componentArray[i]) .getGamma(phase, numberOfComponents, temperature, pressure, pt)); } return R * phase.getTemperature() * phase.getNumberOfMolesInPhase() * GE; diff --git a/src/main/java/neqsim/thermo/phase/PhaseGEUniquac.java b/src/main/java/neqsim/thermo/phase/PhaseGEUniquac.java index 4180b1b6c3..00959506ef 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseGEUniquac.java +++ b/src/main/java/neqsim/thermo/phase/PhaseGEUniquac.java @@ -58,10 +58,10 @@ public PhaseGEUniquac(PhaseInterface phase, double[][] alpha, double[][] Dij, St this.intparam = intparam; for (int i = 0; i < alpha[0].length; i++) { numberOfComponents++; - componentArray[i] = new ComponentGEUniquac(phase.getComponents()[i].getName(), - phase.getComponents()[i].getNumberOfmoles(), - phase.getComponents()[i].getNumberOfMolesInPhase(), - phase.getComponents()[i].getComponentNumber()); + componentArray[i] = new ComponentGEUniquac(phase.getComponent(i).getName(), + phase.getComponent(i).getNumberOfmoles(), + phase.getComponent(i).getNumberOfMolesInPhase(), + phase.getComponent(i).getComponentNumber()); } } @@ -110,7 +110,7 @@ public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, double temperature, double pressure, PhaseType pt) { GE = 0; for (int i = 0; i < numberOfComponents; i++) { - GE += phase.getComponents()[i].getx() + GE += phase.getComponent(i).getx() * Math.log(((ComponentGEInterface) componentArray[i]).getGamma(phase, numberOfComponents, temperature, pressure, pt, alpha, Dij, intparam, mixRule)); } diff --git a/src/main/java/neqsim/thermo/phase/PhaseGEWilson.java b/src/main/java/neqsim/thermo/phase/PhaseGEWilson.java index 7689a045fe..44bfd0a935 100644 --- a/src/main/java/neqsim/thermo/phase/PhaseGEWilson.java +++ b/src/main/java/neqsim/thermo/phase/PhaseGEWilson.java @@ -43,10 +43,10 @@ public PhaseGEWilson(PhaseInterface phase, double[][] alpha, double[][] Dij, Str componentArray = new ComponentGEWilson[alpha[0].length]; for (int i = 0; i < alpha[0].length; i++) { numberOfComponents++; - componentArray[i] = new ComponentGEWilson(phase.getComponents()[i].getName(), - phase.getComponents()[i].getNumberOfmoles(), - phase.getComponents()[i].getNumberOfMolesInPhase(), - phase.getComponents()[i].getComponentNumber()); + componentArray[i] = new ComponentGEWilson(phase.getComponent(i).getName(), + phase.getComponent(i).getNumberOfmoles(), + phase.getComponent(i).getNumberOfMolesInPhase(), + phase.getComponent(i).getComponentNumber()); } } @@ -101,7 +101,7 @@ public double getExcessGibbsEnergy(PhaseInterface phase, int numberOfComponents, double temperature, double pressure, PhaseType pt) { GE = 0; for (int i = 0; i < numberOfComponents; i++) { - GE += phase.getComponents()[i].getx() + GE += phase.getComponent(i).getx() * Math.log(((ComponentGEWilson) componentArray[i]).getWilsonActivityCoefficient(phase)); } diff --git a/src/main/java/neqsim/thermo/system/SystemThermo.java b/src/main/java/neqsim/thermo/system/SystemThermo.java index 4a14072afe..35628ba1be 100644 --- a/src/main/java/neqsim/thermo/system/SystemThermo.java +++ b/src/main/java/neqsim/thermo/system/SystemThermo.java @@ -1219,15 +1219,15 @@ public final void calc_x_y() { for (int i = 0; i < numberOfComponents; i++) { if (j == 0) { getPhase(j).getComponent(i) - .setx(getPhase(0).getComponent(i).getK() * getPhase(j).getComponents()[i].getz() + .setx(getPhase(0).getComponent(i).getK() * getPhase(j).getComponent(i).getz() / (1 - beta[phaseIndex[0]] + beta[phaseIndex[0]] * getPhase(0).getComponent(i).getK())); } else if (j == 1) { getPhase(j).getComponent(i).setx(getPhase(0).getComponent(i).getz() / (1.0 - beta[phaseIndex[0]] + beta[phaseIndex[0]] * getPhase(0).getComponent(i).getK())); } - // phaseArray[j].getComponents()[i].setx(phaseArray[0].getComponents()[i].getx() - // / phaseArray[0].getComponents()[i].getK()); + // phaseArray[j].getComponent(i).setx(phaseArray[0].getComponent(i).getx() + // / phaseArray[0].getComponent(i).getK()); // System.out.println("comp: " + j + i + " " + c[j][i].getx()); } getPhase(j).normalize(); @@ -1240,16 +1240,17 @@ public final void calc_x_y_nonorm() { for (int j = 0; j < numberOfPhases; j++) { for (int i = 0; i < numberOfComponents; i++) { if (j == 0) { - getPhase(j).getComponents()[i].setx(getPhase(j).getComponents()[i].getK() - * getPhase(j).getComponents()[i].getz() / (1 - beta[phaseIndex[0]] - + beta[phaseIndex[0]] * getPhase(0).getComponents()[i].getK())); + getPhase(j).getComponent(i) + .setx(getPhase(j).getComponent(i).getK() * getPhase(j).getComponent(i).getz() + / (1 - beta[phaseIndex[0]] + + beta[phaseIndex[0]] * getPhase(0).getComponent(i).getK())); } if (j == 1) { - getPhase(j).getComponents()[i].setx(getPhase(0).getComponents()[i].getz() / (1.0 - - beta[phaseIndex[0]] + beta[phaseIndex[0]] * getPhase(0).getComponents()[i].getK())); + getPhase(j).getComponent(i).setx(getPhase(0).getComponent(i).getz() / (1.0 + - beta[phaseIndex[0]] + beta[phaseIndex[0]] * getPhase(0).getComponent(i).getK())); } - // phaseArray[j].getComponents()[i].setx(phaseArray[0].getComponents()[i].getx() - // / phaseArray[0].getComponents()[i].getK()); + // phaseArray[j].getComponent(i).setx(phaseArray[0].getComponent(i).getx() + // / phaseArray[0].getComponent(i).getK()); // System.out.println("comp: " + j + i + " " + c[j][i].getx()); } // getPhase(j).normalize(); @@ -1459,7 +1460,7 @@ public String[][] createTable(String name) { java.text.FieldPosition test = new java.text.FieldPosition(0); for (int j = 0; j < getPhases()[0].getNumberOfComponents(); j++) { buf = new StringBuffer(); - table[j + 1][1] = nf.format(getPhase(0).getComponents()[j].getz(), buf, test).toString(); + table[j + 1][1] = nf.format(getPhase(0).getComponent(j).getz(), buf, test).toString(); } buf = new StringBuffer(); table[getPhases()[0].getNumberOfComponents() + 4][1] = @@ -1473,10 +1474,9 @@ public String[][] createTable(String name) { for (int i = 0; i < numberOfPhases; i++) { for (int j = 0; j < getPhases()[0].getNumberOfComponents(); j++) { - table[j + 1][0] = getPhases()[0].getComponents()[j].getName(); + table[j + 1][0] = getPhases()[0].getComponent(j).getName(); buf = new StringBuffer(); - table[j + 1][i + 2] = - nf.format(getPhase(i).getComponents()[j].getx(), buf, test).toString(); + table[j + 1][i + 2] = nf.format(getPhase(i).getComponent(j).getx(), buf, test).toString(); table[j + 1][6] = "[mole fraction]"; } @@ -1971,10 +1971,10 @@ public SystemInterface getEmptySystemClone() { for (int j = 0; j < getMaxNumberOfPhases(); j++) { phaseNumber = j; for (int i = 0; i < getPhase(j).getNumberOfComponents(); i++) { - newSystem.getPhase(j).getComponents()[i].setNumberOfmoles( - getPhase(phaseNumber).getComponents()[i].getNumberOfMolesInPhase() / 1.0e30); - newSystem.getPhase(j).getComponents()[i].setNumberOfMolesInPhase( - getPhase(phaseNumber).getComponents()[i].getNumberOfMolesInPhase() / 1.0e30); + newSystem.getPhase(j).getComponent(i).setNumberOfmoles( + getPhase(phaseNumber).getComponent(i).getNumberOfMolesInPhase() / 1.0e30); + newSystem.getPhase(j).getComponent(i).setNumberOfMolesInPhase( + getPhase(phaseNumber).getComponent(i).getNumberOfMolesInPhase() / 1.0e30); } } @@ -2477,7 +2477,7 @@ public double getMolarMass() { double tempVar = 0; for (int i = 0; i < phaseArray[0].getNumberOfComponents(); i++) { tempVar += - phaseArray[0].getComponents()[i].getz() * phaseArray[0].getComponents()[i].getMolarMass(); + phaseArray[0].getComponent(i).getz() * phaseArray[0].getComponent(i).getMolarMass(); } return tempVar; } @@ -3171,9 +3171,9 @@ public final void init_x_y() { // x = 0; // z = 0; for (int i = 0; i < numberOfComponents; i++) { - getPhase(j).getComponents()[i] - .setz(getPhase(j).getComponents()[i].getNumberOfmoles() / getTotalNumberOfMoles()); - getPhase(j).getComponents()[i].setx(getPhase(j).getComponents()[i].getNumberOfMolesInPhase() + getPhase(j).getComponent(i) + .setz(getPhase(j).getComponent(i).getNumberOfmoles() / getTotalNumberOfMoles()); + getPhase(j).getComponent(i).setx(getPhase(j).getComponent(i).getNumberOfMolesInPhase() / getPhase(j).getNumberOfMolesInPhase()); } getPhase(j).normalize(); @@ -3212,7 +3212,7 @@ public void initAnalytic(int type) { for (int i = 0; i < numberOfPhases; i++) { if (isPhase(i)) { for (int j = 0; j < numberOfComponents; j++) { - getPhase(i).getComponents()[j].fugcoef(getPhase(i)); + getPhase(i).getComponent(j).fugcoef(getPhase(i)); } } } @@ -3223,9 +3223,9 @@ public void initAnalytic(int type) { if (isPhase(i)) { for (int j = 0; j < numberOfComponents; j++) { // TODO: only runs two calculations init == 3 runs three - getPhase(i).getComponents()[j].fugcoefDiffTempNumeric(getPhase(i), numberOfComponents, + getPhase(i).getComponent(j).fugcoefDiffTempNumeric(getPhase(i), numberOfComponents, getPhase(i).getTemperature(), getPhase(i).getPressure()); - getPhase(i).getComponents()[j].fugcoefDiffPresNumeric(getPhase(i), numberOfComponents, + getPhase(i).getComponent(j).fugcoefDiffPresNumeric(getPhase(i), numberOfComponents, getPhase(i).getTemperature(), getPhase(i).getPressure()); } } @@ -3235,8 +3235,8 @@ public void initAnalytic(int type) { for (int i = 0; i < numberOfPhases; i++) { if (isPhase(i)) { for (int j = 0; j < numberOfComponents; j++) { - getPhase(i).getComponents()[j].logfugcoefdT(getPhase(i)); - getPhase(i).getComponents()[j].logfugcoefdP(getPhase(i)); + getPhase(i).getComponent(j).logfugcoefdT(getPhase(i)); + getPhase(i).getComponent(j).logfugcoefdP(getPhase(i)); } } } @@ -3245,7 +3245,7 @@ public void initAnalytic(int type) { for (int i = 0; i < numberOfPhases; i++) { if (isPhase(i)) { for (int j = 0; j < numberOfComponents; j++) { - getPhase(i).getComponents()[j].logfugcoefdN(getPhase(i)); + getPhase(i).getComponent(j).logfugcoefdN(getPhase(i)); } } } @@ -3281,20 +3281,20 @@ public void initAnalytic(int type, int phase) { phaseType[phaseIndex[phase]], beta[phaseIndex[phase]]); if (type > 0) { for (int j = 0; j < numberOfComponents; j++) { - getPhase(phase).getComponents()[j].fugcoef(getPhase(phase)); + getPhase(phase).getComponent(j).fugcoef(getPhase(phase)); } } if (type > 1) { for (int j = 0; j < numberOfComponents; j++) { - getPhase(phase).getComponents()[j].logfugcoefdT(getPhase(phase)); - getPhase(phase).getComponents()[j].logfugcoefdP(getPhase(phase)); + getPhase(phase).getComponent(j).logfugcoefdT(getPhase(phase)); + getPhase(phase).getComponent(j).logfugcoefdP(getPhase(phase)); } } if (type > 2) { for (int j = 0; j < numberOfComponents; j++) { - getPhase(phase).getComponents()[j].logfugcoefdT(getPhase(phase)); - getPhase(phase).getComponents()[j].logfugcoefdP(getPhase(phase)); - getPhase(phase).getComponents()[j].logfugcoefdN(getPhase(phase)); + getPhase(phase).getComponent(j).logfugcoefdT(getPhase(phase)); + getPhase(phase).getComponent(j).logfugcoefdP(getPhase(phase)); + getPhase(phase).getComponent(j).logfugcoefdN(getPhase(phase)); } } } @@ -3340,20 +3340,20 @@ public void initNumeric() { init(1); for (int i = 0; i < getPhases()[0].getNumberOfComponents(); i++) { - gasfug[0][i] = Math.log(getPhases()[0].getComponents()[i].getFugacityCoefficient()); - liqfug[0][i] = Math.log(getPhases()[1].getComponents()[i].getFugacityCoefficient()); + gasfug[0][i] = Math.log(getPhases()[0].getComponent(i).getFugacityCoefficient()); + liqfug[0][i] = Math.log(getPhases()[1].getComponent(i).getFugacityCoefficient()); } setTemperature(getTemperature() - 2 * dt); init(1); for (int i = 0; i < getPhases()[0].getNumberOfComponents(); i++) { - gasfug[1][i] = Math.log(getPhases()[0].getComponents()[i].getFugacityCoefficient()); - liqfug[1][i] = Math.log(getPhases()[1].getComponents()[i].getFugacityCoefficient()); + gasfug[1][i] = Math.log(getPhases()[0].getComponent(i).getFugacityCoefficient()); + liqfug[1][i] = Math.log(getPhases()[1].getComponent(i).getFugacityCoefficient()); gasnumericDfugdt[0][i] = (gasfug[0][i] - gasfug[1][i]) / (2 * dt); liqnumericDfugdt[0][i] = (liqfug[0][i] - liqfug[1][i]) / (2 * dt); - phaseArray[0].getComponents()[i].setdfugdt(gasnumericDfugdt[0][i]); - phaseArray[1].getComponents()[i].setdfugdt(liqnumericDfugdt[0][i]); + phaseArray[0].getComponent(i).setdfugdt(gasnumericDfugdt[0][i]); + phaseArray[1].getComponent(i).setdfugdt(liqnumericDfugdt[0][i]); } setTemperature(getTemperature() + dt); @@ -3363,20 +3363,20 @@ public void initNumeric() { init(1); for (int i = 0; i < getPhases()[0].getNumberOfComponents(); i++) { - gasfug[0][i] = Math.log(getPhases()[0].getComponents()[i].getFugacityCoefficient()); - liqfug[0][i] = Math.log(getPhases()[1].getComponents()[i].getFugacityCoefficient()); + gasfug[0][i] = Math.log(getPhases()[0].getComponent(i).getFugacityCoefficient()); + liqfug[0][i] = Math.log(getPhases()[1].getComponent(i).getFugacityCoefficient()); } setPressure(getPressure() - 2 * dp); init(1); for (int i = 0; i < getPhases()[0].getNumberOfComponents(); i++) { - gasfug[1][i] = Math.log(getPhases()[0].getComponents()[i].getFugacityCoefficient()); - liqfug[1][i] = Math.log(getPhases()[1].getComponents()[i].getFugacityCoefficient()); + gasfug[1][i] = Math.log(getPhases()[0].getComponent(i).getFugacityCoefficient()); + liqfug[1][i] = Math.log(getPhases()[1].getComponent(i).getFugacityCoefficient()); gasnumericDfugdp[0][i] = (gasfug[0][i] - gasfug[1][i]) / (2 * dp); liqnumericDfugdp[0][i] = (liqfug[0][i] - liqfug[1][i]) / (2 * dp); - phaseArray[0].getComponents()[i].setdfugdp(gasnumericDfugdp[0][i]); - phaseArray[1].getComponents()[i].setdfugdp(liqnumericDfugdp[0][i]); + phaseArray[0].getComponent(i).setdfugdp(gasnumericDfugdp[0][i]); + phaseArray[1].getComponent(i).setdfugdp(liqnumericDfugdp[0][i]); } setPressure(getPressure() + dp); @@ -3384,7 +3384,7 @@ public void initNumeric() { for (int phase = 0; phase < 2; phase++) { for (int k = 0; k < getPhases()[0].getNumberOfComponents(); k++) { - double dn = getPhases()[phase].getComponents()[k].getNumberOfMolesInPhase() / 1.0e6; + double dn = getPhases()[phase].getComponent(k).getNumberOfMolesInPhase() / 1.0e6; if (dn < 1e-12) { dn = 1e-12; } @@ -3395,7 +3395,7 @@ public void initNumeric() { init(1); for (int i = 0; i < getPhases()[0].getNumberOfComponents(); i++) { - liqfug[0][i] = Math.log(getPhases()[phase].getComponents()[i].getFugacityCoefficient()); + liqfug[0][i] = Math.log(getPhases()[phase].getComponent(i).getFugacityCoefficient()); } addComponent(k, -2.0 * dn, phase); @@ -3405,22 +3405,22 @@ public void initNumeric() { for (int i = 0; i < getPhases()[0].getNumberOfComponents(); i++) { // gasfug[1][i] = - // Math.log(getPhases()[0].getComponents()[i].getFugacityCoefficient()); - liqfug[1][i] = Math.log(getPhases()[phase].getComponents()[i].getFugacityCoefficient()); + // Math.log(getPhases()[0].getComponent(i).getFugacityCoefficient()); + liqfug[1][i] = Math.log(getPhases()[phase].getComponent(i).getFugacityCoefficient()); } for (int i = 0; i < getPhases()[0].getNumberOfComponents(); i++) { if (phase == 0) { gasnumericDfugdn[0][k][i] = (liqfug[0][i] - liqfug[1][i]) / (2 * dn); - phaseArray[0].getComponents()[i].setdfugdn(k, gasnumericDfugdn[0][k][i]); - phaseArray[0].getComponents()[i].setdfugdx(k, + phaseArray[0].getComponent(i).setdfugdn(k, gasnumericDfugdn[0][k][i]); + phaseArray[0].getComponent(i).setdfugdx(k, gasnumericDfugdn[0][k][i] * phaseArray[0].getNumberOfMolesInPhase()); } if (phase == 1) { liqnumericDfugdn[0][k][i] = (liqfug[0][i] - liqfug[1][i]) / (2 * dn); - phaseArray[1].getComponents()[i].setdfugdn(k, liqnumericDfugdn[0][k][i]); - phaseArray[1].getComponents()[i].setdfugdx(k, + phaseArray[1].getComponent(i).setdfugdn(k, liqnumericDfugdn[0][k][i]); + phaseArray[1].getComponent(i).setdfugdx(k, liqnumericDfugdn[0][k][i] * phaseArray[1].getNumberOfMolesInPhase()); } } @@ -3464,16 +3464,16 @@ public void initNumeric(int type, int phasen) { init(1); for (int i = 0; i < getPhases()[0].getNumberOfComponents(); i++) { - gasfug[0][i] = Math.log(getPhases()[0].getComponents()[i].getFugacityCoefficient()); - liqfug[0][i] = Math.log(getPhases()[1].getComponents()[i].getFugacityCoefficient()); + gasfug[0][i] = Math.log(getPhases()[0].getComponent(i).getFugacityCoefficient()); + liqfug[0][i] = Math.log(getPhases()[1].getComponent(i).getFugacityCoefficient()); } setTemperature(getTemperature() - 2 * dt); init(1); for (int i = 0; i < getPhases()[0].getNumberOfComponents(); i++) { - gasfug[1][i] = Math.log(getPhases()[0].getComponents()[i].getFugacityCoefficient()); - liqfug[1][i] = Math.log(getPhases()[1].getComponents()[i].getFugacityCoefficient()); + gasfug[1][i] = Math.log(getPhases()[0].getComponent(i).getFugacityCoefficient()); + liqfug[1][i] = Math.log(getPhases()[1].getComponent(i).getFugacityCoefficient()); } for (int i = 0; i < getPhases()[0].getNumberOfComponents(); i++) { @@ -3488,16 +3488,16 @@ public void initNumeric(int type, int phasen) { init(1); for (int i = 0; i < getPhases()[0].getNumberOfComponents(); i++) { - gasfug[0][i] = Math.log(getPhases()[0].getComponents()[i].getFugacityCoefficient()); - liqfug[0][i] = Math.log(getPhases()[1].getComponents()[i].getFugacityCoefficient()); + gasfug[0][i] = Math.log(getPhases()[0].getComponent(i).getFugacityCoefficient()); + liqfug[0][i] = Math.log(getPhases()[1].getComponent(i).getFugacityCoefficient()); } setPressure(getPressure() - 2 * dp); init(1); for (int i = 0; i < getPhases()[0].getNumberOfComponents(); i++) { - gasfug[1][i] = Math.log(getPhases()[0].getComponents()[i].getFugacityCoefficient()); - liqfug[1][i] = Math.log(getPhases()[1].getComponents()[i].getFugacityCoefficient()); + gasfug[1][i] = Math.log(getPhases()[0].getComponent(i).getFugacityCoefficient()); + liqfug[1][i] = Math.log(getPhases()[1].getComponent(i).getFugacityCoefficient()); } for (int i = 0; i < getPhases()[0].getNumberOfComponents(); i++) { @@ -3511,7 +3511,7 @@ public void initNumeric(int type, int phasen) { if (type == 3) { for (int phase = 0; phase < 2; phase++) { for (int k = 0; k < getPhases()[0].getNumberOfComponents(); k++) { - double dn = getPhases()[phase].getComponents()[k].getNumberOfMolesInPhase() / 1.0e6; + double dn = getPhases()[phase].getComponent(k).getNumberOfMolesInPhase() / 1.0e6; addComponent(k, dn, phase); // initBeta(); @@ -3519,8 +3519,7 @@ public void initNumeric(int type, int phasen) { init(1); for (int i = 0; i < getPhases()[0].getNumberOfComponents(); i++) { - liqfug[0][i] = - Math.log(getPhases()[phase].getComponents()[i].getFugacityCoefficient()); + liqfug[0][i] = Math.log(getPhases()[phase].getComponent(i).getFugacityCoefficient()); } addComponent(k, -2.0 * dn, phase); @@ -3530,9 +3529,8 @@ public void initNumeric(int type, int phasen) { for (int i = 0; i < getPhases()[0].getNumberOfComponents(); i++) { // gasfug[1][i] = - // Math.log(getPhases()[0].getComponents()[i].getFugacityCoefficient()); - liqfug[1][i] = - Math.log(getPhases()[phase].getComponents()[i].getFugacityCoefficient()); + // Math.log(getPhases()[0].getComponent(i).getFugacityCoefficient()); + liqfug[1][i] = Math.log(getPhases()[phase].getComponent(i).getFugacityCoefficient()); } addComponent(k, dn, phase); init_x_y(); @@ -3584,8 +3582,8 @@ public final void initTotalNumberOfMoles(double change) { // System.out.println("total moles: " + totalNumberOfMoles); for (int j = 0; j < numberOfPhases; j++) { for (int i = 0; i < numberOfComponents; i++) { - getPhase(j).getComponents()[i] - .setNumberOfmoles(phaseArray[phaseIndex[0]].getComponents()[i].getNumberOfmoles()); + getPhase(j).getComponent(i) + .setNumberOfmoles(phaseArray[phaseIndex[0]].getComponent(i).getNumberOfmoles()); } } } @@ -3767,12 +3765,12 @@ public SystemInterface phaseToSystem(int phaseNumber1, int phaseNumber2) { for (int j = 0; j < getMaxNumberOfPhases(); j++) { for (int i = 0; i < getPhase(j).getNumberOfComponents(); i++) { - newSystem.getPhases()[j].getComponents()[i] - .setNumberOfmoles(getPhase(phaseNumber1).getComponents()[i].getNumberOfMolesInPhase() - + getPhase(phaseNumber2).getComponents()[i].getNumberOfMolesInPhase()); - newSystem.getPhases()[j].getComponents()[i].setNumberOfMolesInPhase( - getPhase(phaseNumber1).getComponents()[i].getNumberOfMolesInPhase() - + getPhase(phaseNumber2).getComponents()[i].getNumberOfMolesInPhase()); + newSystem.getPhases()[j].getComponent(i) + .setNumberOfmoles(getPhase(phaseNumber1).getComponent(i).getNumberOfMolesInPhase() + + getPhase(phaseNumber2).getComponent(i).getNumberOfMolesInPhase()); + newSystem.getPhases()[j].getComponent(i).setNumberOfMolesInPhase( + getPhase(phaseNumber1).getComponent(i).getNumberOfMolesInPhase() + + getPhase(phaseNumber2).getComponent(i).getNumberOfMolesInPhase()); } } @@ -3793,8 +3791,7 @@ public SystemInterface phaseToSystem(int phaseNumber1, int phaseNumber2) { public SystemInterface phaseToSystem(PhaseInterface newPhase) { // TODO: other phaseToSystem functions returns clones. for (int i = 0; i < newPhase.getNumberOfComponents(); i++) { - newPhase.getComponents()[i] - .setNumberOfmoles(newPhase.getComponents()[i].getNumberOfMolesInPhase()); + newPhase.getComponent(i).setNumberOfmoles(newPhase.getComponent(i).getNumberOfMolesInPhase()); } for (int i = 0; i < getMaxNumberOfPhases(); i++) { @@ -3962,9 +3959,8 @@ public void removePhase(int specPhase) { for (int j = 0; j < numberOfPhases; j++) { for (int i = 0; i < numberOfComponents; i++) { - getPhase(j).getComponents()[i] - .setNumberOfmoles(getPhase(j).getComponents()[i].getNumberOfmoles() - - getPhase(specPhase).getComponents()[i].getNumberOfMolesInPhase()); + getPhase(j).getComponent(i).setNumberOfmoles(getPhase(j).getComponent(i).getNumberOfmoles() + - getPhase(specPhase).getComponent(i).getNumberOfMolesInPhase()); } } @@ -4040,7 +4036,7 @@ public void reset() { public void reset_x_y() { for (int j = 0; j < numberOfPhases; j++) { for (int i = 0; i < numberOfComponents; i++) { - getPhase(j).getComponents()[i].setx(phaseArray[phaseIndex[0]].getComponents()[i].getz()); + getPhase(j).getComponent(i).setx(phaseArray[phaseIndex[0]].getComponent(i).getz()); } } } @@ -4252,16 +4248,15 @@ public void setAllComponentsInPhase(int phase) { for (int i = 0; i < numberOfComponents; i++) { if (phase != k) { // System.out.println("moles of comp: " + i + " " + - // phaseArray[k].getComponents()[i].getNumberOfMolesInPhase()); + // phaseArray[k].getComponent(i).getNumberOfMolesInPhase()); phaseArray[phase].addMoles(i, - (phaseArray[k].getComponents()[i].getNumberOfMolesInPhase() * (1.0 - 0.01))); + (phaseArray[k].getComponent(i).getNumberOfMolesInPhase() * (1.0 - 0.01))); phaseArray[k].addMoles(i, - -(phaseArray[k].getComponents()[i].getNumberOfMolesInPhase() * (1.0 - 0.01))); - phaseArray[k].getComponents()[i] - .setx(phaseArray[k].getComponents()[i].getNumberOfMolesInPhase() - / phaseArray[k].getNumberOfMolesInPhase()); + -(phaseArray[k].getComponent(i).getNumberOfMolesInPhase() * (1.0 - 0.01))); + phaseArray[k].getComponent(i).setx(phaseArray[k].getComponent(i).getNumberOfMolesInPhase() + / phaseArray[k].getNumberOfMolesInPhase()); // System.out.println("moles of comp after: " + i + " " + - // phaseArray[k].getComponents()[i].getNumberOfMolesInPhase()); + // phaseArray[k].getComponent(i).getNumberOfMolesInPhase()); } } } diff --git a/src/main/java/neqsim/thermodynamicoperations/chemicalequilibrium/ChemicalEquilibrium.java b/src/main/java/neqsim/thermodynamicoperations/chemicalequilibrium/ChemicalEquilibrium.java index 15834326b0..a352bdf0c2 100644 --- a/src/main/java/neqsim/thermodynamicoperations/chemicalequilibrium/ChemicalEquilibrium.java +++ b/src/main/java/neqsim/thermodynamicoperations/chemicalequilibrium/ChemicalEquilibrium.java @@ -52,14 +52,14 @@ public void run() { double xchem[] = new double[system.getPhases()[phase].getNumberOfComponents()]; for (int i = 0; i < system.getPhases()[phase].getNumberOfComponents(); i++) { - xchem[i] = system.getPhases()[phase].getComponents()[i].getx(); + xchem[i] = system.getPhases()[phase].getComponent(i).getx(); } system.init(1); system.getChemicalReactionOperations().solveChemEq(phase); for (int i = 0; i < system.getPhases()[phase].getNumberOfComponents(); i++) { - chemdev += Math.abs(xchem[i] - system.getPhases()[phase].getComponents()[i].getx()); + chemdev += Math.abs(xchem[i] - system.getPhases()[phase].getComponent(i).getx()); } } } while (Math.abs(chemdev) > 1e-4 && iter < 100); diff --git a/src/main/java/neqsim/thermodynamicoperations/flashops/Flash.java b/src/main/java/neqsim/thermodynamicoperations/flashops/Flash.java index fe7f75cb38..2b05682a3d 100644 --- a/src/main/java/neqsim/thermodynamicoperations/flashops/Flash.java +++ b/src/main/java/neqsim/thermodynamicoperations/flashops/Flash.java @@ -290,19 +290,15 @@ public void stabilityAnalysis() throws neqsim.util.exception.IsNaNException, if (((tm[0] < -1e-4) || (tm[1] < -1e-4)) && !(Double.isNaN(tm[0]) || (Double.isNaN(tm[1])))) { for (int i = 0; i < clonedSystem.getPhases()[0].getNumberOfComponents(); i++) { - if (system.getPhases()[1].getComponents()[i].getx() < 1e-100) { + if (system.getPhases()[1].getComponent(i).getx() < 1e-100) { continue; } if (tm[0] < -1e-4) { - system.getPhases()[1].getComponents()[i] - .setK((Wi[0][i] / sumw[0]) / (Wi[1][i] / sumw[1])); - system.getPhases()[0].getComponents()[i] - .setK((Wi[0][i] / sumw[0]) / (Wi[1][i] / sumw[1])); + system.getPhases()[1].getComponent(i).setK((Wi[0][i] / sumw[0]) / (Wi[1][i] / sumw[1])); + system.getPhases()[0].getComponent(i).setK((Wi[0][i] / sumw[0]) / (Wi[1][i] / sumw[1])); } else if (tm[1] < -1e-4) { - system.getPhases()[1].getComponents()[i] - .setK((Wi[0][i] / sumw[0]) / (Wi[1][i] / sumw[1])); - system.getPhases()[0].getComponents()[i] - .setK((Wi[0][i] / sumw[0]) / (Wi[1][i] / sumw[1])); + system.getPhases()[1].getComponent(i).setK((Wi[0][i] / sumw[0]) / (Wi[1][i] / sumw[1])); + system.getPhases()[0].getComponent(i).setK((Wi[0][i] / sumw[0]) / (Wi[1][i] / sumw[1])); } else { logger.info("error in stability anlysis"); system.init(0); @@ -398,7 +394,7 @@ public void solidPhaseFlash() { for (int k = 0; k < system.getPhase(0).getNumberOfComponents(); k++) { if (system.getPhase(0).getComponent(k).doSolidCheck()) { - tempVar[k] = system.getPhase(0).getComponents()[k].getz(); + tempVar[k] = system.getPhase(0).getComponent(k).getz(); for (int i = 0; i < system.getNumberOfPhases() - 1; i++) { tempVar[k] -= system.getBeta(i) * system.getPhases()[3].getComponent(k).getFugacityCoefficient() @@ -410,7 +406,7 @@ public void solidPhaseFlash() { solid = k; frac = tempVar[k]; for (int p = 0; p < system.getPhases()[0].getNumberOfComponents(); p++) { - system.getPhases()[3].getComponents()[p].setx(1.0e-20); + system.getPhases()[3].getComponent(p).setx(1.0e-20); } system.getPhases()[3].getComponents()[solid].setx(1.0); } diff --git a/src/main/java/neqsim/thermodynamicoperations/flashops/SolidFlash.java b/src/main/java/neqsim/thermodynamicoperations/flashops/SolidFlash.java index 453cbb9272..b8711ad3b7 100644 --- a/src/main/java/neqsim/thermodynamicoperations/flashops/SolidFlash.java +++ b/src/main/java/neqsim/thermodynamicoperations/flashops/SolidFlash.java @@ -163,7 +163,7 @@ public double calcQ() { Q = betaTotal; for (int i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { - Q -= Math.log(E[i]) * system.getPhase(0).getComponents()[i].getz(); + Q -= Math.log(E[i]) * system.getPhase(0).getComponent(i).getz(); } for (int k = 0; k < system.getNumberOfPhases() - 1; k++) { diff --git a/src/main/java/neqsim/thermodynamicoperations/flashops/SolidFlash1.java b/src/main/java/neqsim/thermodynamicoperations/flashops/SolidFlash1.java index bfc4862b9f..5318749879 100644 --- a/src/main/java/neqsim/thermodynamicoperations/flashops/SolidFlash1.java +++ b/src/main/java/neqsim/thermodynamicoperations/flashops/SolidFlash1.java @@ -132,7 +132,7 @@ public double calcQ() { Q = betaTotal; for (int i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { if (i != solidIndex) { - Q -= Math.log(E[i]) * system.getPhase(0).getComponents()[i].getz(); + Q -= Math.log(E[i]) * system.getPhase(0).getComponent(i).getz(); } } for (int i = 0; i < solidsNumber; i++) { @@ -452,7 +452,7 @@ public int checkAndAddSolidPhase() { .getTriplePointTemperature()) { solidCandidate[k] = 0; } else { - solidCandidate[k] = system.getPhase(0).getComponents()[k].getz(); + solidCandidate[k] = system.getPhase(0).getComponent(k).getz(); system.getPhases()[3].getComponent(k).setx(1.0); for (int i = 0; i < system.getNumberOfPhases(); i++) { // double e = system.getBeta(i)* diff --git a/src/main/java/neqsim/thermodynamicoperations/flashops/SolidFlash12.java b/src/main/java/neqsim/thermodynamicoperations/flashops/SolidFlash12.java index f9b8b4da0b..6ab902d50f 100644 --- a/src/main/java/neqsim/thermodynamicoperations/flashops/SolidFlash12.java +++ b/src/main/java/neqsim/thermodynamicoperations/flashops/SolidFlash12.java @@ -136,7 +136,7 @@ public double calcQ() { Q = betaTotal; for (int i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { if (i != solidIndex) { - Q -= Math.log(E[i]) * system.getPhase(0).getComponents()[i].getz(); + Q -= Math.log(E[i]) * system.getPhase(0).getComponent(i).getz(); } } @@ -336,7 +336,7 @@ public int checkAndAddSolidPhase() { .getTriplePointTemperature()) { solidCandidate[k] = -10; } else { - solidCandidate[k] = system.getPhase(0).getComponents()[k].getz(); + solidCandidate[k] = system.getPhase(0).getComponent(k).getz(); system.getPhases()[3].getComponent(k).setx(1.0); for (int i = 0; i < system.getNumberOfPhases(); i++) { diff --git a/src/main/java/neqsim/thermodynamicoperations/flashops/SysNewtonRhapsonPHflash.java b/src/main/java/neqsim/thermodynamicoperations/flashops/SysNewtonRhapsonPHflash.java index 04146f4764..70d511a7a0 100644 --- a/src/main/java/neqsim/thermodynamicoperations/flashops/SysNewtonRhapsonPHflash.java +++ b/src/main/java/neqsim/thermodynamicoperations/flashops/SysNewtonRhapsonPHflash.java @@ -117,10 +117,10 @@ public void setSpec(double spec) { */ public void setfvec() { for (int i = 0; i < numberOfComponents; i++) { - fvec.set(i, 0, Math.log(system.getPhases()[0].getComponents()[i].getFugacityCoefficient()) - + Math.log(system.getPhases()[0].getComponents()[i].getx()) - - Math.log(system.getPhases()[1].getComponents()[i].getFugacityCoefficient()) - - Math.log(system.getPhases()[1].getComponents()[i].getx())); + fvec.set(i, 0, Math.log(system.getPhases()[0].getComponent(i).getFugacityCoefficient()) + + Math.log(system.getPhases()[0].getComponent(i).getx()) + - Math.log(system.getPhases()[1].getComponent(i).getFugacityCoefficient()) + - Math.log(system.getPhases()[1].getComponent(i).getx())); } double rP = 0.0; double rT = 0.0; @@ -151,11 +151,11 @@ public void setJac() { for (int j = 0; j < numberOfComponents; j++) { dij = i == j ? 1.0 : 0.0; // Kroneckers delta tempJ = 1.0 / system.getBeta() - * (dij / system.getPhases()[0].getComponents()[i].getx() - 1.0 - + system.getPhases()[0].getComponents()[i].getdfugdx(j)) + * (dij / system.getPhases()[0].getComponent(i).getx() - 1.0 + + system.getPhases()[0].getComponent(i).getdfugdx(j)) + 1.0 / (1.0 - system.getBeta()) - * (dij / system.getPhases()[1].getComponents()[i].getx() - 1.0 - + system.getPhases()[1].getComponents()[i].getdfugdx(j)); + * (dij / system.getPhases()[1].getComponent(i).getx() - 1.0 + + system.getPhases()[1].getComponent(i).getdfugdx(j)); Jac.set(i, j, tempJ); } } @@ -164,10 +164,10 @@ public void setJac() { double[] gP = new double[numberOfComponents]; for (int i = 0; i < numberOfComponents; i++) { - gT[i] = system.getTemperature() * (system.getPhases()[0].getComponents()[i].getdfugdt() - - system.getPhases()[1].getComponents()[i].getdfugdt()); - gP[i] = system.getPressure() * (system.getPhases()[0].getComponents()[i].getdfugdp() - - system.getPhases()[1].getComponents()[i].getdfugdp()); + gT[i] = system.getTemperature() * (system.getPhases()[0].getComponent(i).getdfugdt() + - system.getPhases()[1].getComponent(i).getdfugdt()); + gP[i] = system.getPressure() * (system.getPhases()[0].getComponent(i).getdfugdp() + - system.getPhases()[1].getComponent(i).getdfugdp()); Jac.set(numberOfComponents, i, gT[i]); Jac.set(i, numberOfComponents, gT[i]); @@ -215,14 +215,14 @@ public void init() { for (int i = 0; i < numberOfComponents; i++) { double v = 0.0; double l = 0.0; - v = system.getPhases()[0].getComponents()[i].getx() * system.getBeta() + u.get(i, 0); - l = system.getPhases()[0].getComponents()[i].getz() - v; - system.getPhases()[0].getComponents()[i].setx(v / system.getBeta()); - system.getPhases()[1].getComponents()[i].setx(l / (1.0 - system.getBeta())); - system.getPhases()[1].getComponents()[i].setK(system.getPhases()[0].getComponents()[i].getx() - / system.getPhases()[1].getComponents()[i].getx()); - system.getPhases()[0].getComponents()[i] - .setK(system.getPhases()[1].getComponents()[i].getK()); + v = system.getPhases()[0].getComponent(i).getx() * system.getBeta() + u.get(i, 0); + l = system.getPhases()[0].getComponent(i).getz() - v; + system.getPhases()[0].getComponent(i).setx(v / system.getBeta()); + system.getPhases()[1].getComponent(i).setx(l / (1.0 - system.getBeta())); + system.getPhases()[1].getComponent(i).setK(system.getPhases()[0].getComponent(i).getx() + / system.getPhases()[1].getComponent(i).getx()); + system.getPhases()[0].getComponent(i) + .setK(system.getPhases()[1].getComponent(i).getK()); } // dt = Math.exp(u.get(numberOfComponents+1,0)) - system.getTemperature(); diff --git a/src/main/java/neqsim/thermodynamicoperations/flashops/SysNewtonRhapsonTPflash.java b/src/main/java/neqsim/thermodynamicoperations/flashops/SysNewtonRhapsonTPflash.java index f264028d7f..0a7b24dbca 100644 --- a/src/main/java/neqsim/thermodynamicoperations/flashops/SysNewtonRhapsonTPflash.java +++ b/src/main/java/neqsim/thermodynamicoperations/flashops/SysNewtonRhapsonTPflash.java @@ -73,10 +73,10 @@ public SysNewtonRhapsonTPflash(SystemInterface system, int numberOfPhases, public void setfvec() { for (int i = 0; i < numberOfComponents; i++) { fvec.set(i, 0, - Math.log(system.getPhase(0).getComponents()[i].getFugacityCoefficient() - * system.getPhase(0).getComponents()[i].getx() * system.getPressure()) - - Math.log(system.getPhase(1).getComponents()[i].getFugacityCoefficient() - * system.getPhase(1).getComponents()[i].getx() * system.getPressure())); + Math.log(system.getPhase(0).getComponent(i).getFugacityCoefficient() + * system.getPhase(0).getComponent(i).getx() * system.getPressure()) + - Math.log(system.getPhase(1).getComponent(i).getFugacityCoefficient() + * system.getPhase(1).getComponent(i).getx() * system.getPressure())); } } @@ -94,10 +94,10 @@ public void setJac() { for (int j = 0; j < numberOfComponents; j++) { dij = i == j ? 1.0 : 0.0; // Kroneckers delta tempJ = 1.0 / system.getBeta() - * (dij / system.getPhase(0).getComponents()[i].getx() - 1.0 - + system.getPhase(0).getComponents()[i].getdfugdx(j)) - + 1.0 / (1.0 - system.getBeta()) * (dij / system.getPhase(1).getComponents()[i].getx() - - 1.0 + system.getPhase(1).getComponents()[i].getdfugdx(j)); + * (dij / system.getPhase(0).getComponent(i).getx() - 1.0 + + system.getPhase(0).getComponent(i).getdfugdx(j)) + + 1.0 / (1.0 - system.getBeta()) * (dij / system.getPhase(1).getComponent(i).getx() + - 1.0 + system.getPhase(1).getComponent(i).getdfugdx(j)); Jac.set(i, j, tempJ); } } @@ -110,7 +110,7 @@ public void setJac() { */ public void setu() { for (int i = 0; i < numberOfComponents; i++) { - u.set(i, 0, system.getBeta() * system.getPhase(0).getComponents()[i].getx()); + u.set(i, 0, system.getBeta() * system.getPhase(0).getComponent(i).getx()); } } @@ -128,12 +128,12 @@ public void init() { system.setBeta(temp); for (int i = 0; i < numberOfComponents; i++) { - system.getPhase(0).getComponents()[i].setx(u.get(i, 0) / system.getBeta()); - system.getPhase(1).getComponents()[i].setx( - (system.getPhase(0).getComponents()[i].getz() - u.get(i, 0)) / (1.0 - system.getBeta())); - system.getPhase(0).getComponents()[i].setK(system.getPhase(0).getComponents()[i].getx() - / system.getPhase(1).getComponents()[i].getx()); - system.getPhase(1).getComponents()[i].setK(system.getPhase(0).getComponents()[i].getK()); + system.getPhase(0).getComponent(i).setx(u.get(i, 0) / system.getBeta()); + system.getPhase(1).getComponent(i).setx( + (system.getPhase(0).getComponent(i).getz() - u.get(i, 0)) / (1.0 - system.getBeta())); + system.getPhase(0).getComponent(i).setK(system.getPhase(0).getComponent(i).getx() + / system.getPhase(1).getComponent(i).getx()); + system.getPhase(1).getComponent(i).setK(system.getPhase(0).getComponent(i).getK()); } system.init(3); diff --git a/src/main/java/neqsim/thermodynamicoperations/flashops/SysNewtonRhapsonTPflashNew.java b/src/main/java/neqsim/thermodynamicoperations/flashops/SysNewtonRhapsonTPflashNew.java index b55d421e08..8dcc7eec6c 100644 --- a/src/main/java/neqsim/thermodynamicoperations/flashops/SysNewtonRhapsonTPflashNew.java +++ b/src/main/java/neqsim/thermodynamicoperations/flashops/SysNewtonRhapsonTPflashNew.java @@ -78,14 +78,14 @@ public SysNewtonRhapsonTPflashNew(SystemInterface system, int numberOfPhases, public void setfvec() { for (int i = 0; i < numberOfComponents; i++) { fvec.set(i, 0, - u.get(i, 0) + Math.log(system.getPhases()[1].getComponents()[i].getFugacityCoefficient() - / system.getPhases()[0].getComponents()[i].getFugacityCoefficient())); + u.get(i, 0) + Math.log(system.getPhases()[1].getComponent(i).getFugacityCoefficient() + / system.getPhases()[0].getComponent(i).getFugacityCoefficient())); } double fsum = 0.0; for (int i = 0; i < numberOfComponents; i++) { - fsum = fsum + system.getPhases()[1].getComponents()[i].getx() - - system.getPhases()[0].getComponents()[i].getx(); + fsum = fsum + system.getPhases()[1].getComponent(i).getx() + - system.getPhases()[0].getComponent(i).getx(); } fvec.set(numberOfComponents, 0, fsum); // fvec.print(0,20); @@ -110,21 +110,21 @@ public void setJac() { double sumdxidbeta = 0; int nofc = numberOfComponents; for (int i = 0; i < numberOfComponents; i++) { - dxidlnk[i] = -system.getBeta() * system.getPhases()[0].getComponents()[i].getx() - * system.getPhases()[1].getComponents()[i].getx() - / system.getPhases()[0].getComponents()[i].getz(); - dyidlnk[i] = system.getPhases()[1].getComponents()[i].getx() - + system.getPhases()[0].getComponents()[i].getK() * dxidlnk[i]; - - dyidbeta[i] = (system.getPhases()[0].getComponents()[i].getK() - * system.getPhases()[0].getComponents()[i].getz() - * (1 - system.getPhases()[0].getComponents()[i].getK())) + dxidlnk[i] = -system.getBeta() * system.getPhases()[0].getComponent(i).getx() + * system.getPhases()[1].getComponent(i).getx() + / system.getPhases()[0].getComponent(i).getz(); + dyidlnk[i] = system.getPhases()[1].getComponent(i).getx() + + system.getPhases()[0].getComponent(i).getK() * dxidlnk[i]; + + dyidbeta[i] = (system.getPhases()[0].getComponent(i).getK() + * system.getPhases()[0].getComponent(i).getz() + * (1 - system.getPhases()[0].getComponent(i).getK())) / Math.pow(1 - system.getBeta() - + system.getBeta() * system.getPhases()[0].getComponents()[i].getK(), 2); - dxidbeta[i] = (system.getPhases()[0].getComponents()[i].getz() - * (1 - system.getPhases()[0].getComponents()[i].getK())) + + system.getBeta() * system.getPhases()[0].getComponent(i).getK(), 2); + dxidbeta[i] = (system.getPhases()[0].getComponent(i).getz() + * (1 - system.getPhases()[0].getComponent(i).getK())) / Math.pow(1 - system.getBeta() - + system.getBeta() * system.getPhases()[0].getComponents()[i].getK(), 2); + + system.getBeta() * system.getPhases()[0].getComponent(i).getK(), 2); sumdyidbeta += dyidbeta[i]; sumdxidbeta += dxidbeta[i]; @@ -133,12 +133,12 @@ public void setJac() { for (int i = 0; i < numberOfComponents; i++) { for (int j = 0; j < numberOfComponents; j++) { dij = i == j ? 1.0 : 0.0; // Kroneckers delta - tempJ = dij + system.getPhases()[1].getComponents()[i].getdfugdx(j) * dyidlnk[j] - - system.getPhases()[0].getComponents()[i].getdfugdx(j) * dxidlnk[j]; + tempJ = dij + system.getPhases()[1].getComponent(i).getdfugdx(j) * dyidlnk[j] + - system.getPhases()[0].getComponent(i).getdfugdx(j) * dxidlnk[j]; Jac.set(i, j, tempJ); } - Jac.set(i, nofc, system.getPhases()[1].getComponents()[i].getdfugdx(i) * dyidbeta[i] - - system.getPhases()[0].getComponents()[i].getdfugdx(i) * dxidbeta[i]); + Jac.set(i, nofc, system.getPhases()[1].getComponent(i).getdfugdx(i) * dyidbeta[i] + - system.getPhases()[0].getComponent(i).getdfugdx(i) * dxidbeta[i]); Jac.set(nofc, i, dyidlnk[i] - dxidlnk[i]); } @@ -152,7 +152,7 @@ public void setJac() { */ public void setu() { for (int i = 0; i < numberOfComponents; i++) { - u.set(i, 0, Math.log(system.getPhases()[0].getComponents()[i].getK())); + u.set(i, 0, Math.log(system.getPhases()[0].getComponent(i).getK())); } u.set(numberOfComponents, 0, system.getBeta()); @@ -165,8 +165,8 @@ public void setu() { */ public void init() { for (int i = 0; i < numberOfComponents; i++) { - system.getPhases()[0].getComponents()[i].setK(Math.exp(u.get(i, 0))); - system.getPhases()[1].getComponents()[i].setK(Math.exp(u.get(i, 0))); + system.getPhases()[0].getComponent(i).setK(Math.exp(u.get(i, 0))); + system.getPhases()[1].getComponent(i).setK(Math.exp(u.get(i, 0))); } system.setBeta(u.get(numberOfComponents, 0)); system.calc_x_y(); diff --git a/src/main/java/neqsim/thermodynamicoperations/flashops/TPflash.java b/src/main/java/neqsim/thermodynamicoperations/flashops/TPflash.java index a720e9582a..bbf462682c 100644 --- a/src/main/java/neqsim/thermodynamicoperations/flashops/TPflash.java +++ b/src/main/java/neqsim/thermodynamicoperations/flashops/TPflash.java @@ -164,7 +164,7 @@ public void setNewK() { lnOldOldK[i] = lnOldK[i]; lnOldK[i] = lnK[i]; lnK[i] = Math.log(system.getPhase(1).getComponent(i).getFugacityCoefficient()) - - Math.log(system.getPhase(0).getComponents()[i].getFugacityCoefficient()); + - Math.log(system.getPhase(0).getComponent(i).getFugacityCoefficient()); oldoldDeltalnK[i] = lnOldOldK[i] - lnOldOldOldK[i]; oldDeltalnK[i] = lnOldK[i] - lnOldOldK[i]; @@ -180,8 +180,8 @@ public void setNewK() { public void resetK() { for (i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { lnK[i] = lnOldK[i]; - system.getPhase(0).getComponents()[i].setK(Math.exp(lnK[i])); - system.getPhase(1).getComponents()[i].setK(Math.exp(lnK[i])); + system.getPhase(0).getComponent(i).setK(Math.exp(lnK[i])); + system.getPhase(1).getComponent(i).setK(Math.exp(lnK[i])); } try { RachfordRice rachfordRice = new RachfordRice(); @@ -307,11 +307,11 @@ public void run() { if (system.getComponent(i).getz() > 1e-50) { tpdy += system.getPhase(0).getComponent(i).getx() * (Math.log(system.getPhase(0).getComponent(i).getFugacityCoefficient()) - + Math.log(system.getPhase(0).getComponents()[i].getx()) - minGibsPhaseLogZ[i] + + Math.log(system.getPhase(0).getComponent(i).getx()) - minGibsPhaseLogZ[i] - minGibsLogFugCoef[i]); tpdx += system.getPhase(1).getComponent(i).getx() * (Math.log(system.getPhase(1).getComponent(i).getFugacityCoefficient()) - + Math.log(system.getPhase(1).getComponents()[i].getx()) - minGibsPhaseLogZ[i] + + Math.log(system.getPhase(1).getComponent(i).getx()) - minGibsPhaseLogZ[i] - minGibsLogFugCoef[i]); } } @@ -328,7 +328,7 @@ public void run() { } } else if (tpdy < 0) { for (i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { - system.getPhase(0).getComponents()[i].setK(Math + system.getPhase(0).getComponent(i).setK(Math .exp(minGibsLogFugCoef[i] - Math.log(system.getPhase(0).getComponent(i).getFugacityCoefficient())) * presdiff); diff --git a/src/main/java/neqsim/thermodynamicoperations/flashops/TPgradientFlash.java b/src/main/java/neqsim/thermodynamicoperations/flashops/TPgradientFlash.java index 9c72f4e170..0a56483354 100644 --- a/src/main/java/neqsim/thermodynamicoperations/flashops/TPgradientFlash.java +++ b/src/main/java/neqsim/thermodynamicoperations/flashops/TPgradientFlash.java @@ -69,8 +69,8 @@ public void setfvec() { fvec.set(i, 0, logTerm - - Math.log(tempSystem.getPhases()[0].getComponents()[i].getFugacityCoefficient() - * tempSystem.getPhases()[0].getComponents()[i].getx() * tempSystem.getPressure()) + - Math.log(tempSystem.getPhases()[0].getComponent(i).getFugacityCoefficient() + * tempSystem.getPhases()[0].getComponent(i).getx() * tempSystem.getPressure()) - molarMassTerm); sumx += componentX; } @@ -89,13 +89,13 @@ public void setJac() { for (int j = 0; j < numComponents; j++) { double dij = (i == j) ? 1.0 : 0.0; // Kronecker delta double fugacityCoeff = - localSystem.getPhases()[0].getComponents()[i].getFugacityCoefficient(); - double componentX = localSystem.getPhases()[0].getComponents()[i].getx(); + localSystem.getPhases()[0].getComponent(i).getFugacityCoefficient(); + double componentX = localSystem.getPhases()[0].getComponent(i).getx(); double pressure = localSystem.getPressure(); double tempJ = 1.0 / (fugacityCoeff * componentX * pressure) * (fugacityCoeff * dij * pressure - + localSystem.getPhases()[0].getComponents()[i].getdfugdx(j) * componentX + + localSystem.getPhases()[0].getComponent(i).getdfugdx(j) * componentX * pressure); Jac.set(i, j, tempJ); } @@ -107,12 +107,12 @@ public void setJac() { } for (int i = 0; i < numComponents; i++) { - double fugacityCoeff = localSystem.getPhases()[0].getComponents()[i].getFugacityCoefficient(); - double componentX = localSystem.getPhases()[0].getComponents()[i].getx(); + double fugacityCoeff = localSystem.getPhases()[0].getComponent(i).getFugacityCoefficient(); + double componentX = localSystem.getPhases()[0].getComponent(i).getx(); double pressure = localSystem.getPressure(); double tempJ = 1.0 / (fugacityCoeff * componentX * pressure) - * (localSystem.getPhases()[0].getComponents()[i].getdfugdp() * componentX * pressure + * (localSystem.getPhases()[0].getComponent(i).getdfugdp() * componentX * pressure + fugacityCoeff * componentX); Jac.set(i, numComponents, tempJ); } diff --git a/src/main/java/neqsim/thermodynamicoperations/flashops/TPmultiflash.java b/src/main/java/neqsim/thermodynamicoperations/flashops/TPmultiflash.java index e6adca918c..235f1ecc46 100644 --- a/src/main/java/neqsim/thermodynamicoperations/flashops/TPmultiflash.java +++ b/src/main/java/neqsim/thermodynamicoperations/flashops/TPmultiflash.java @@ -94,17 +94,17 @@ public void setXY() { for (int k = 0; k < system.getNumberOfPhases(); k++) { for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { if (system.getPhase(0).getComponent(i).getz() > 1e-100) { - system.getPhase(k).getComponents()[i].setx(system.getPhase(0).getComponents()[i].getz() + system.getPhase(k).getComponent(i).setx(system.getPhase(0).getComponent(i).getz() / Erow[i] / system.getPhase(k).getComponent(i).getFugacityCoefficient()); } if (system.getPhase(0).getComponent(i).getIonicCharge() != 0 && system.getPhase(k).getType() != PhaseType.AQUEOUS) { - system.getPhase(k).getComponents()[i].setx(1e-50); + system.getPhase(k).getComponent(i).setx(1e-50); } if (system.getPhase(0).getComponent(i).getIonicCharge() != 0 && system.getPhase(k).getType() == PhaseType.AQUEOUS) { - system.getPhase(k).getComponents()[i] - .setx(system.getPhase(k).getComponents()[i].getNumberOfmoles() + system.getPhase(k).getComponent(i) + .setx(system.getPhase(k).getComponent(i).getNumberOfmoles() / system.getPhase(k).getNumberOfMolesInPhase()); } } @@ -263,7 +263,7 @@ public void stabilityAnalysis() { * system.getPhase(0).getNumberOfComponents(); j++) { numb = i == j ? 1.0 : 1.0e-12; // set to 0 * by Even Solbraa 23.01.2013 - chaged back to 1.0e-12 27.04.13 if * (system.getPhase(0).getComponent(j).getz() < 1e-100) { numb = 0; } ( - * clonedSystem.get(i)).getPhase(1).getComponents()[j].setx(numb); } if + * clonedSystem.get(i)).getPhase(1).getComponent(j).setx(numb); } if * (system.getPhase(0).getComponent(i).getIonicCharge() == 0) { ( clonedSystem.get(i)).init(1); * } } */ @@ -274,25 +274,25 @@ public void stabilityAnalysis() { * minimumGibbsEnergySystem.getPhase(0).getNumberOfComponents(); k++) { for (int i = 0; i < * minimumGibbsEnergySystem.getPhase(0).getNumberOfComponents(); i++) { if (!(( * clonedSystem.get(k)) == null)) { sumw[k] += ( - * clonedSystem.get(k)).getPhase(1).getComponents()[i].getx(); } } } + * clonedSystem.get(k)).getPhase(1).getComponent(i).getx(); } } } * * for (int k = 0; k < minimumGibbsEnergySystem.getPhase(0).getNumberOfComponents(); k++) { for * (int i = 0; i < minimumGibbsEnergySystem.getPhase(0).getNumberOfComponents(); i++) { if (!(( * clonedSystem.get(k)) == null) && system.getPhase(0).getComponent(k).getx() > 1e-100) { ( - * clonedSystem.get(k)).getPhase(1).getComponents()[i].setx(( - * clonedSystem.get(k)).getPhase(1).getComponents()[i].getx() / sumw[0]); } logger.info("x: " + - * ( clonedSystem.get(k)).getPhase(0).getComponents()[i].getx()); } if + * clonedSystem.get(k)).getPhase(1).getComponent(i).setx(( + * clonedSystem.get(k)).getPhase(1).getComponent(i).getx() / sumw[0]); } logger.info("x: " + ( + * clonedSystem.get(k)).getPhase(0).getComponent(i).getx()); } if * (system.getPhase(0).getComponent(k).getx() > 1e-100) { d[k] = - * Math.log(system.getPhase(0).getComponents()[k].getx()) + - * system.getPhase(0).getComponents()[k].getLogFugacityCoefficient(); + * Math.log(system.getPhase(0).getComponent(k).getx()) + + * system.getPhase(0).getComponent(k).getLogFugacityCoefficient(); * if(minimumGibbsEnergySystem.getPhases()[lowestGibbsEnergyPhase].getComponents * ()[k].getIonicCharge()!=0) d[k]=0; } //logger.info("dk: " + d[k]); } */ for (int k = 0; k < minimumGibbsEnergySystem.getPhase(0).getNumberOfComponents(); k++) { if (system.getPhase(0).getComponent(k).getx() > 1e-100) { - d[k] = Math.log(system.getPhase(0).getComponents()[k].getx()) - + system.getPhase(0).getComponents()[k].getLogFugacityCoefficient(); - // if(minimumGibbsEnergySystem.getPhases()[lowestGibbsEnergyPhase].getComponents()[k].getIonicCharge()!=0) + d[k] = Math.log(system.getPhase(0).getComponent(k).getx()) + + system.getPhase(0).getComponent(k).getLogFugacityCoefficient(); + // if(minimumGibbsEnergySystem.getPhases()[lowestGibbsEnergyPhase].getComponent(k).getIonicCharge()!=0) // d[k]=0; } } @@ -357,7 +357,7 @@ public void stabilityAnalysis() { if (clonedSystem.get(0).isPhase(1)) { try { - clonedSystem.get(0).getPhase(1).getComponents()[cc].setx(nomb); + clonedSystem.get(0).getPhase(1).getComponent(cc).setx(nomb); } catch (Exception ex) { logger.warn(ex.getMessage()); } @@ -411,11 +411,11 @@ public void stabilityAnalysis() { for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { // oldlogw[i] = logWi[i]; if (!Double.isInfinite( - clonedSystem.get(0).getPhase(1).getComponents()[i].getLogFugacityCoefficient()) + clonedSystem.get(0).getPhase(1).getComponent(i).getLogFugacityCoefficient()) && system.getPhase(0).getComponent(i).getx() > 1e-100) { - logWi[i] = d[i] - clonedSystem.get(0).getPhase(1).getComponents()[i] - .getLogFugacityCoefficient(); - if (clonedSystem.get(0).getPhase(1).getComponents()[i].getIonicCharge() != 0) { + logWi[i] = d[i] + - clonedSystem.get(0).getPhase(1).getComponent(i).getLogFugacityCoefficient(); + if (clonedSystem.get(0).getPhase(1).getComponent(i).getIonicCharge() != 0) { logWi[i] = -1000.0; } } @@ -456,16 +456,15 @@ public void stabilityAnalysis() { for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { if (system.getPhase(0).getComponent(i).getz() > 1e-100) { - f.set(i, 0, - Math.sqrt(Wi[j][i]) - * (Math.log(Wi[j][i]) + clonedSystem.get(0).getPhases()[1].getComponents()[i] - .getLogFugacityCoefficient() - d[i])); + f.set(i, 0, Math.sqrt(Wi[j][i]) * (Math.log(Wi[j][i]) + + clonedSystem.get(0).getPhases()[1].getComponent(i).getLogFugacityCoefficient() + - d[i])); } for (int k = 0; k < clonedSystem.get(0).getPhases()[0].getNumberOfComponents(); k++) { double kronDelt = (i == k) ? 1.0 : 0.0; if (system.getPhase(0).getComponent(i).getz() > 1e-100) { df.set(i, k, kronDelt + Math.sqrt(Wi[j][k] * Wi[j][i]) - * clonedSystem.get(0).getPhases()[1].getComponents()[i].getdfugdn(k)); + * clonedSystem.get(0).getPhases()[1].getComponent(i).getdfugdn(k)); // * clonedSystem.getPhases()[j].getNumberOfMolesInPhase()); } else { df.set(i, k, 0); @@ -508,10 +507,10 @@ public void stabilityAnalysis() { for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { if (system.getPhase(0).getComponent(i).getx() > 1e-100) { - clonedSystem.get(0).getPhase(1).getComponents()[i].setx(Math.exp(logWi[i]) / sumw[j]); + clonedSystem.get(0).getPhase(1).getComponent(i).setx(Math.exp(logWi[i]) / sumw[j]); } if (system.getPhase(0).getComponent(i).getIonicCharge() != 0) { - clonedSystem.get(0).getPhase(1).getComponents()[i].setx(1e-50); + clonedSystem.get(0).getPhase(1).getComponent(i).setx(1e-50); } } } while ((Math.abs(err) > 1e-9 || err > errOld) && iter < maxiter); @@ -525,7 +524,7 @@ public void stabilityAnalysis() { if (system.getPhase(0).getComponent(i).getx() > 1e-100) { tm[j] -= Math.exp(logWi[i]); } - x[j][i] = clonedSystem.get(0).getPhase(1).getComponents()[i].getx(); + x[j][i] = clonedSystem.get(0).getPhase(1).getComponent(i).getx(); // logger.info("txji: " + x[j][i]); xTrivialCheck0 += Math.abs(x[j][i] - system.getPhase(0).getComponent(i).getx()); @@ -552,7 +551,7 @@ public void stabilityAnalysis() { system.addPhase(); unstabcomp = k; for (int i = 0; i < system.getPhase(1).getNumberOfComponents(); i++) { - system.getPhase(system.getNumberOfPhases() - 1).getComponents()[i].setx(x[k][i]); + system.getPhase(system.getNumberOfPhases() - 1).getComponent(i).setx(x[k][i]); } system.getPhases()[system.getNumberOfPhases() - 1].normalize(); multiPhaseTest = true; @@ -614,7 +613,7 @@ public void stabilityAnalysis3() { * system.getPhase(0).getNumberOfComponents(); j++) { numb = i == j ? 1.0 : 1.0e-12; // set to 0 * by Even Solbraa 23.01.2013 - chaged back to 1.0e-12 27.04.13 if * (system.getPhase(0).getComponent(j).getz() < 1e-100) { numb = 0; } ( - * clonedSystem.get(i)).getPhase(1).getComponents()[j].setx(numb); } if + * clonedSystem.get(i)).getPhase(1).getComponent(j).setx(numb); } if * (system.getPhase(0).getComponent(i).getIonicCharge() == 0) { ( clonedSystem.get(i)).init(1); * } } */ @@ -625,25 +624,25 @@ public void stabilityAnalysis3() { * minimumGibbsEnergySystem.getPhase(0).getNumberOfComponents(); k++) { for (int i = 0; i < * minimumGibbsEnergySystem.getPhase(0).getNumberOfComponents(); i++) { if (!(( * clonedSystem.get(k)) == null)) { sumw[k] += ( - * clonedSystem.get(k)).getPhase(1).getComponents()[i].getx(); } } } + * clonedSystem.get(k)).getPhase(1).getComponent(i).getx(); } } } * * for (int k = 0; k < minimumGibbsEnergySystem.getPhase(0).getNumberOfComponents(); k++) { for * (int i = 0; i < minimumGibbsEnergySystem.getPhase(0).getNumberOfComponents(); i++) { if (!(( * clonedSystem.get(k)) == null) && system.getPhase(0).getComponent(k).getx() > 1e-100) { ( - * clonedSystem.get(k)).getPhase(1).getComponents()[i].setx(( - * clonedSystem.get(k)).getPhase(1).getComponents()[i].getx() / sumw[0]); } logger.info("x: " + - * ( clonedSystem.get(k)).getPhase(0).getComponents()[i].getx()); } if + * clonedSystem.get(k)).getPhase(1).getComponent(i).setx(( + * clonedSystem.get(k)).getPhase(1).getComponent(i).getx() / sumw[0]); } logger.info("x: " + ( + * clonedSystem.get(k)).getPhase(0).getComponent(i).getx()); } if * (system.getPhase(0).getComponent(k).getx() > 1e-100) { d[k] = - * Math.log(system.getPhase(0).getComponents()[k].getx()) + - * system.getPhase(0).getComponents()[k].getLogFugacityCoefficient(); + * Math.log(system.getPhase(0).getComponent(k).getx()) + + * system.getPhase(0).getComponent(k).getLogFugacityCoefficient(); * if(minimumGibbsEnergySystem.getPhases()[lowestGibbsEnergyPhase].getComponents * ()[k].getIonicCharge()!=0) d[k]=0; } //logger.info("dk: " + d[k]); } */ for (int k = 0; k < minimumGibbsEnergySystem.getPhase(0).getNumberOfComponents(); k++) { if (system.getPhase(0).getComponent(k).getx() > 1e-100) { - d[k] = Math.log(system.getPhase(0).getComponents()[k].getx()) - + system.getPhase(0).getComponents()[k].getLogFugacityCoefficient(); - // if(minimumGibbsEnergySystem.getPhases()[lowestGibbsEnergyPhase].getComponents()[k].getIonicCharge()!=0) + d[k] = Math.log(system.getPhase(0).getComponent(k).getx()) + + system.getPhase(0).getComponent(k).getLogFugacityCoefficient(); + // if(minimumGibbsEnergySystem.getPhases()[lowestGibbsEnergyPhase].getComponent(k).getIonicCharge()!=0) // d[k]=0; } } @@ -708,7 +707,7 @@ public void stabilityAnalysis3() { if (clonedSystem.get(0).isPhase(1)) { try { - clonedSystem.get(0).getPhase(1).getComponents()[cc].setx(nomb); + clonedSystem.get(0).getPhase(1).getComponent(cc).setx(nomb); } catch (Exception ex) { logger.warn(ex.getMessage()); } @@ -762,11 +761,11 @@ public void stabilityAnalysis3() { for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { // oldlogw[i] = logWi[i]; if (!Double.isInfinite( - clonedSystem.get(0).getPhase(1).getComponents()[i].getLogFugacityCoefficient()) + clonedSystem.get(0).getPhase(1).getComponent(i).getLogFugacityCoefficient()) && system.getPhase(0).getComponent(i).getx() > 1e-100) { - logWi[i] = d[i] - clonedSystem.get(0).getPhase(1).getComponents()[i] - .getLogFugacityCoefficient(); - if (clonedSystem.get(0).getPhase(1).getComponents()[i].getIonicCharge() != 0) { + logWi[i] = d[i] + - clonedSystem.get(0).getPhase(1).getComponent(i).getLogFugacityCoefficient(); + if (clonedSystem.get(0).getPhase(1).getComponent(i).getIonicCharge() != 0) { logWi[i] = -1000.0; } } @@ -807,16 +806,15 @@ public void stabilityAnalysis3() { for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { if (system.getPhase(0).getComponent(i).getz() > 1e-100) { - f.set(i, 0, - Math.sqrt(Wi[j][i]) - * (Math.log(Wi[j][i]) + clonedSystem.get(0).getPhases()[1].getComponents()[i] - .getLogFugacityCoefficient() - d[i])); + f.set(i, 0, Math.sqrt(Wi[j][i]) * (Math.log(Wi[j][i]) + + clonedSystem.get(0).getPhases()[1].getComponent(i).getLogFugacityCoefficient() + - d[i])); } for (int k = 0; k < clonedSystem.get(0).getPhases()[0].getNumberOfComponents(); k++) { double kronDelt = (i == k) ? 1.0 : 0.0; if (system.getPhase(0).getComponent(i).getz() > 1e-100) { df.set(i, k, kronDelt + Math.sqrt(Wi[j][k] * Wi[j][i]) - * clonedSystem.get(0).getPhases()[1].getComponents()[i].getdfugdn(k)); + * clonedSystem.get(0).getPhases()[1].getComponent(i).getdfugdn(k)); // * clonedSystem.getPhases()[j].getNumberOfMolesInPhase()); } else { df.set(i, k, 0); @@ -859,10 +857,10 @@ public void stabilityAnalysis3() { for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { if (system.getPhase(0).getComponent(i).getx() > 1e-100) { - clonedSystem.get(0).getPhase(1).getComponents()[i].setx(Math.exp(logWi[i]) / sumw[j]); + clonedSystem.get(0).getPhase(1).getComponent(i).setx(Math.exp(logWi[i]) / sumw[j]); } if (system.getPhase(0).getComponent(i).getIonicCharge() != 0) { - clonedSystem.get(0).getPhase(1).getComponents()[i].setx(1e-50); + clonedSystem.get(0).getPhase(1).getComponent(i).setx(1e-50); } } } while ((Math.abs(err) > 1e-9 || err > errOld) && iter < maxiter); @@ -876,7 +874,7 @@ public void stabilityAnalysis3() { if (system.getPhase(0).getComponent(i).getx() > 1e-100) { tm[j] -= Math.exp(logWi[i]); } - x[j][i] = clonedSystem.get(0).getPhase(1).getComponents()[i].getx(); + x[j][i] = clonedSystem.get(0).getPhase(1).getComponent(i).getx(); // logger.info("txji: " + x[j][i]); xTrivialCheck0 += Math.abs(x[j][i] - system.getPhase(0).getComponent(i).getx()); @@ -903,7 +901,7 @@ public void stabilityAnalysis3() { system.addPhase(); unstabcomp = k; for (int i = 0; i < system.getPhase(1).getNumberOfComponents(); i++) { - system.getPhase(system.getNumberOfPhases() - 1).getComponents()[i].setx(x[k][i]); + system.getPhase(system.getNumberOfPhases() - 1).getComponent(i).setx(x[k][i]); } system.getPhases()[system.getNumberOfPhases() - 1].normalize(); multiPhaseTest = true; @@ -969,7 +967,7 @@ public void stabilityAnalysis2() { if (system.getPhase(0).getComponent(j).getz() < 1e-100) { numb = 0; } - (clonedSystem.get(i)).getPhase(1).getComponents()[j].setx(numb); + (clonedSystem.get(i)).getPhase(1).getComponent(j).setx(numb); } if (system.getPhase(0).getComponent(i).getIonicCharge() == 0) { (clonedSystem.get(i)).init(1); @@ -982,7 +980,7 @@ public void stabilityAnalysis2() { for (int k = 0; k < minimumGibbsEnergySystem.getPhase(0).getNumberOfComponents(); k++) { for (int i = 0; i < minimumGibbsEnergySystem.getPhase(0).getNumberOfComponents(); i++) { if (!((clonedSystem.get(k)) == null)) { - sumw[k] += (clonedSystem.get(k)).getPhase(1).getComponents()[i].getx(); + sumw[k] += (clonedSystem.get(k)).getPhase(1).getComponent(i).getx(); } } } @@ -991,16 +989,16 @@ public void stabilityAnalysis2() { for (int i = 0; i < minimumGibbsEnergySystem.getPhase(0).getNumberOfComponents(); i++) { if (!((clonedSystem.get(k)) == null) && system.getPhase(0).getComponent(k).getx() > 1e-100) { - (clonedSystem.get(k)).getPhase(1).getComponents()[i] - .setx((clonedSystem.get(k)).getPhase(1).getComponents()[i].getx() / sumw[0]); + (clonedSystem.get(k)).getPhase(1).getComponent(i) + .setx((clonedSystem.get(k)).getPhase(1).getComponent(i).getx() / sumw[0]); } // logger.info("x: " + ( - // clonedSystem.get(k)).getPhase(0).getComponents()[i].getx()); + // clonedSystem.get(k)).getPhase(0).getComponent(i).getx()); } if (system.getPhase(0).getComponent(k).getx() > 1e-100) { - d[k] = Math.log(system.getPhase(0).getComponents()[k].getx()) - + system.getPhase(0).getComponents()[k].getLogFugacityCoefficient(); - // if(minimumGibbsEnergySystem.getPhases()[lowestGibbsEnergyPhase].getComponents()[k].getIonicCharge()!=0) + d[k] = Math.log(system.getPhase(0).getComponent(k).getx()) + + system.getPhase(0).getComponent(k).getLogFugacityCoefficient(); + // if(minimumGibbsEnergySystem.getPhases()[lowestGibbsEnergyPhase].getComponent(k).getIonicCharge()!=0) // d[k]=0; } // logger.info("dk: " + d[k]); @@ -1100,11 +1098,11 @@ public void stabilityAnalysis2() { for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { // oldlogw[i] = logWi[i]; if (!Double.isInfinite( - (clonedSystem.get(j)).getPhase(1).getComponents()[i].getLogFugacityCoefficient()) + (clonedSystem.get(j)).getPhase(1).getComponent(i).getLogFugacityCoefficient()) && system.getPhase(0).getComponent(i).getx() > 1e-100) { - logWi[i] = d[i] - (clonedSystem.get(j)).getPhase(1).getComponents()[i] - .getLogFugacityCoefficient(); - if ((clonedSystem.get(j)).getPhase(1).getComponents()[i].getIonicCharge() != 0) { + logWi[i] = d[i] + - (clonedSystem.get(j)).getPhase(1).getComponent(i).getLogFugacityCoefficient(); + if ((clonedSystem.get(j)).getPhase(1).getComponent(i).getIonicCharge() != 0) { logWi[i] = -1000.0; } } @@ -1140,15 +1138,15 @@ public void stabilityAnalysis2() { for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { if (system.getPhase(0).getComponent(i).getz() > 1e-100) { - f.set(i, 0, Math.sqrt(Wi[j][i]) - * (Math.log(Wi[j][i]) + (clonedSystem.get(j)).getPhases()[1].getComponents()[i] - .getLogFugacityCoefficient() - d[i])); + f.set(i, 0, Math.sqrt(Wi[j][i]) * (Math.log(Wi[j][i]) + + (clonedSystem.get(j)).getPhases()[1].getComponent(i).getLogFugacityCoefficient() + - d[i])); } for (int k = 0; k < (clonedSystem.get(j)).getPhases()[0].getNumberOfComponents(); k++) { double kronDelt = (i == k) ? 1.0 : 0.0; if (system.getPhase(0).getComponent(i).getz() > 1e-100) { df.set(i, k, kronDelt + Math.sqrt(Wi[j][k] * Wi[j][i]) - * (clonedSystem.get(j)).getPhases()[1].getComponents()[i].getdfugdn(k)); + * (clonedSystem.get(j)).getPhases()[1].getComponent(i).getdfugdn(k)); // * // clonedSystem.getPhases()[j].getNumberOfMolesInPhase()); } else { @@ -1186,10 +1184,10 @@ public void stabilityAnalysis2() { for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { if (system.getPhase(0).getComponent(i).getx() > 1e-100) { - (clonedSystem.get(j)).getPhase(1).getComponents()[i].setx(Math.exp(logWi[i]) / sumw[j]); + (clonedSystem.get(j)).getPhase(1).getComponent(i).setx(Math.exp(logWi[i]) / sumw[j]); } if (system.getPhase(0).getComponent(i).getIonicCharge() != 0) { - (clonedSystem.get(j)).getPhase(1).getComponents()[i].setx(1e-50); + (clonedSystem.get(j)).getPhase(1).getComponent(i).setx(1e-50); } } } while ((Math.abs(err) > 1e-9 || err > errOld) && iter < 200); @@ -1208,7 +1206,7 @@ public void stabilityAnalysis2() { if (system.getPhase(0).getComponent(i).getx() > 1e-100) { tm[j] -= Math.exp(logWi[i]); } - x[j][i] = (clonedSystem.get(j)).getPhase(1).getComponents()[i].getx(); + x[j][i] = (clonedSystem.get(j)).getPhase(1).getComponent(i).getx(); // logger.info("txji: " + x[j][i]); xTrivialCheck0 += Math.abs(x[j][i] - system.getPhase(0).getComponent(i).getx()); @@ -1235,7 +1233,7 @@ public void stabilityAnalysis2() { system.addPhase(); unstabcomp = k; for (int i = 0; i < system.getPhase(1).getNumberOfComponents(); i++) { - system.getPhase(system.getNumberOfPhases() - 1).getComponents()[i].setx(x[k][i]); + system.getPhase(system.getNumberOfPhases() - 1).getComponent(i).setx(x[k][i]); } system.getPhases()[system.getNumberOfPhases() - 1].normalize(); multiPhaseTest = true; @@ -1303,7 +1301,7 @@ public void run() { double[] xchem = new double[system.getPhase(phase).getNumberOfComponents()]; for (i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { - xchem[i] = system.getPhase(phase).getComponents()[i].getx(); + xchem[i] = system.getPhase(phase).getComponent(i).getx(); } system.init(1); @@ -1311,7 +1309,7 @@ public void run() { .solveChemEq(system.getPhaseNumberOfPhase("aqueous"), 1); for (i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { - chemdev += Math.abs(xchem[i] - system.getPhase(phase).getComponents()[i].getx()); + chemdev += Math.abs(xchem[i] - system.getPhase(phase).getComponent(i).getx()); } // logger.info("chemdev: " + chemdev); } diff --git a/src/main/java/neqsim/thermodynamicoperations/flashops/TPmultiflashWAX.java b/src/main/java/neqsim/thermodynamicoperations/flashops/TPmultiflashWAX.java index 0f8e14f9fa..3649b0d0a9 100644 --- a/src/main/java/neqsim/thermodynamicoperations/flashops/TPmultiflashWAX.java +++ b/src/main/java/neqsim/thermodynamicoperations/flashops/TPmultiflashWAX.java @@ -66,21 +66,21 @@ public void setXY() { for (int k = 0; k < system.getNumberOfPhases(); k++) { for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { if (system.getPhase(0).getComponent(i).getz() > 1e-100) { - system.getPhase(k).getComponents()[i].setx(system.getPhase(0).getComponents()[i].getz() - / E[i] / system.getPhase(k).getComponents()[i].getFugacityCoefficient()); + system.getPhase(k).getComponent(i).setx(system.getPhase(0).getComponent(i).getz() / E[i] + / system.getPhase(k).getComponent(i).getFugacityCoefficient()); } if (system.getPhase(0).getComponent(i).getIonicCharge() != 0 && system.getPhase(k).getType() != PhaseType.AQUEOUS) { - system.getPhase(k).getComponents()[i].setx(1e-50); + system.getPhase(k).getComponent(i).setx(1e-50); } if (system.getPhase(0).getComponent(i).getIonicCharge() != 0 && system.getPhase(k).getType() == PhaseType.AQUEOUS) { - system.getPhase(k).getComponents()[i] - .setx(system.getPhase(k).getComponents()[i].getNumberOfmoles() + system.getPhase(k).getComponent(i) + .setx(system.getPhase(k).getComponent(i).getNumberOfmoles() / system.getPhase(k).getNumberOfMolesInPhase()); } if (system.hasPhaseType("wax")) { - system.getPhaseOfType("wax").getComponents()[i].setx(0); + system.getPhaseOfType("wax").getComponent(i).setx(0); } } system.getPhase(k).normalize(); @@ -98,7 +98,7 @@ public void calcE() { for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { for (int k = 0; k < system.getNumberOfPhases(); k++) { E[i] += system.getPhase(k).getBeta() - / system.getPhase(k).getComponents()[i].getFugacityCoefficient(); + / system.getPhase(k).getComponent(i).getFugacityCoefficient(); } } } @@ -124,14 +124,14 @@ public double calcQ() { this.calcE(); for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { - Q -= Math.log(E[i]) * system.getPhase(0).getComponents()[i].getz(); + Q -= Math.log(E[i]) * system.getPhase(0).getComponent(i).getz(); } for (int k = 0; k < system.getNumberOfPhases(); k++) { dQdbeta[k] = 1.0; for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { - dQdbeta[k] -= system.getPhase(0).getComponents()[i].getz() * 1.0 / E[i] - / system.getPhase(k).getComponents()[i].getFugacityCoefficient(); + dQdbeta[k] -= system.getPhase(0).getComponent(i).getz() * 1.0 / E[i] + / system.getPhase(k).getComponent(i).getFugacityCoefficient(); } } @@ -139,9 +139,9 @@ public double calcQ() { for (int j = 0; j < system.getNumberOfPhases(); j++) { Qmatrix[i][j] = 0; for (int k = 0; k < system.getPhase(0).getNumberOfComponents(); k++) { - Qmatrix[i][j] += system.getPhase(0).getComponents()[k].getz() - / (E[k] * E[k] * system.getPhase(j).getComponents()[k].getFugacityCoefficient() - * system.getPhase(i).getComponents()[k].getFugacityCoefficient()); + Qmatrix[i][j] += system.getPhase(0).getComponent(k).getz() + / (E[k] * E[k] * system.getPhase(j).getComponent(k).getFugacityCoefficient() + * system.getPhase(i).getComponent(k).getFugacityCoefficient()); } if (i == j) { Qmatrix[i][j] += 1e-10; @@ -239,7 +239,7 @@ public void stabilityAnalysis() { if (system.getPhase(0).getComponent(j).getz() < 1e-100) { numb = 0; } - (clonedSystem.get(i)).getPhase(waxphasenumber).getComponents()[j].setx(numb); + (clonedSystem.get(i)).getPhase(waxphasenumber).getComponent(j).setx(numb); } if (system.getPhase(0).getComponent(i).getIonicCharge() == 0) { (clonedSystem.get(i)).init(1); @@ -250,10 +250,10 @@ public void stabilityAnalysis() { // logger.info("low gibbs phase " + lowestGibbsEnergyPhase); for (int k = 0; k < minimumGibbsEnergySystem.getPhase(0).getNumberOfComponents(); k++) { - // sumz += minimumGibbsEnergySystem.getPhase(0).getComponents()[k].getz(); + // sumz += minimumGibbsEnergySystem.getPhase(0).getComponent(k).getz(); for (int i = 0; i < minimumGibbsEnergySystem.getPhase(0).getNumberOfComponents(); i++) { if (!((clonedSystem.get(k)) == null)) { - sumw[k] += (clonedSystem.get(k)).getPhase(waxphasenumber).getComponents()[i].getx(); + sumw[k] += (clonedSystem.get(k)).getPhase(waxphasenumber).getComponent(i).getx(); } } } @@ -262,17 +262,17 @@ public void stabilityAnalysis() { for (int i = 0; i < minimumGibbsEnergySystem.getPhase(0).getNumberOfComponents(); i++) { if (!((clonedSystem.get(k)) == null) && system.getPhase(0).getComponent(k).getx() > 1e-100) { - (clonedSystem.get(k)).getPhase(waxphasenumber).getComponents()[i].setx( - (clonedSystem.get(k)).getPhase(waxphasenumber).getComponents()[i].getx() / sumw[0]); + (clonedSystem.get(k)).getPhase(waxphasenumber).getComponent(i).setx( + (clonedSystem.get(k)).getPhase(waxphasenumber).getComponent(i).getx() / sumw[0]); // logger.info("x: " + ( - // clonedSystem.get(k)).getPhase(0).getComponents()[i].getx()); + // clonedSystem.get(k)).getPhase(0).getComponent(i).getx()); } } if (system.getPhase(0).getComponent(k).getx() > 1e-100) { d[k] = Math.log( - minimumGibbsEnergySystem.getPhases()[lowestGibbsEnergyPhase].getComponents()[k].getx()) - + minimumGibbsEnergySystem.getPhases()[lowestGibbsEnergyPhase].getComponents()[k] + minimumGibbsEnergySystem.getPhases()[lowestGibbsEnergyPhase].getComponent(k).getx()) + + minimumGibbsEnergySystem.getPhases()[lowestGibbsEnergyPhase].getComponent(k) .getLogFugacityCoefficient(); } } @@ -335,14 +335,12 @@ public void stabilityAnalysis() { for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { oldlogw[i] = logWi[i]; - if (!Double - .isInfinite(Math.log((clonedSystem.get(j)).getPhase(waxphasenumber).getComponents()[i] - .getLogFugacityCoefficient())) + if (!Double.isInfinite(Math.log((clonedSystem.get(j)).getPhase(waxphasenumber) + .getComponent(i).getLogFugacityCoefficient())) && system.getPhase(0).getComponent(i).getx() > 1e-100) { - logWi[i] = - d[i] - Math.log((clonedSystem.get(j)).getPhase(waxphasenumber).getComponents()[i] - .getFugacityCoefficient()); - if ((clonedSystem.get(j)).getPhase(1).getComponents()[i].getIonicCharge() != 0) { + logWi[i] = d[i] - Math.log((clonedSystem.get(j)).getPhase(waxphasenumber) + .getComponent(i).getFugacityCoefficient()); + if ((clonedSystem.get(j)).getPhase(1).getComponent(i).getIonicCharge() != 0) { logWi[i] = -1000.0; } } @@ -357,7 +355,7 @@ public void stabilityAnalysis() { } for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { - (clonedSystem.get(j)).getPhase(waxphasenumber).getComponents()[i] + (clonedSystem.get(j)).getPhase(waxphasenumber).getComponent(i) .setx(Math.exp(logWi[i]) / sumw[j]); } } while (Math.abs(err) > 1e-9 && iter < 100); @@ -366,7 +364,7 @@ public void stabilityAnalysis() { for (int i = 0; i < system.getPhase(1).getNumberOfComponents(); i++) { tm[j] -= Math.exp(logWi[i]); - x[j][i] = (clonedSystem.get(j)).getPhase(waxphasenumber).getComponents()[i].getx(); + x[j][i] = (clonedSystem.get(j)).getPhase(waxphasenumber).getComponent(i).getx(); // logger.info("txji: " + x[j][i]); } if (iter >= 99) { @@ -386,7 +384,7 @@ public void stabilityAnalysis() { system.setPhaseIndex(system.getNumberOfPhases() - 1, waxphasenumber); unstabcomp = k; for (int i = 0; i < system.getPhase(1).getNumberOfComponents(); i++) { - system.getPhase(system.getNumberOfPhases() - 1).getComponents()[i].setx(x[k][i]); + system.getPhase(system.getNumberOfPhases() - 1).getComponent(i).setx(x[k][i]); } multiPhaseTest = true; system.setBeta(system.getNumberOfPhases() - 1, @@ -445,14 +443,14 @@ public void run() { double[] xchem = new double[system.getPhase(phase).getNumberOfComponents()]; for (i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { - xchem[i] = system.getPhase(phase).getComponents()[i].getx(); + xchem[i] = system.getPhase(phase).getComponent(i).getx(); } system.init(1); system.getChemicalReactionOperations().solveChemEq(phase, 1); for (i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { - chemdev += Math.abs(xchem[i] - system.getPhase(phase).getComponents()[i].getx()); + chemdev += Math.abs(xchem[i] - system.getPhase(phase).getComponent(i).getx()); } logger.info("chemdev: " + chemdev); } diff --git a/src/main/java/neqsim/thermodynamicoperations/flashops/TPmultiflash_1.java b/src/main/java/neqsim/thermodynamicoperations/flashops/TPmultiflash_1.java index f86dfb337c..f9ea63a9f5 100644 --- a/src/main/java/neqsim/thermodynamicoperations/flashops/TPmultiflash_1.java +++ b/src/main/java/neqsim/thermodynamicoperations/flashops/TPmultiflash_1.java @@ -69,9 +69,8 @@ public void calcMultiPhaseBeta() {} public void setXY() { for (int k = 0; k < system.getNumberOfPhases(); k++) { for (int i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { - system.getPhases()[k].getComponents()[i] - .setx(system.getPhases()[k].getComponents()[i].getz() / E[i] - / system.getPhases()[k].getComponents()[i].getFugacityCoefficient()); + system.getPhases()[k].getComponent(i).setx(system.getPhases()[k].getComponent(i).getz() + / E[i] / system.getPhases()[k].getComponent(i).getFugacityCoefficient()); } } } @@ -87,7 +86,7 @@ public void calcE() { for (int i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { for (int k = 0; k < system.getNumberOfPhases(); k++) { E[i] += system.getPhases()[k].getBeta() - / system.getPhases()[k].getComponents()[i].getFugacityCoefficient(); + / system.getPhases()[k].getComponent(i).getFugacityCoefficient(); } } } @@ -113,14 +112,14 @@ public double calcQ() { this.calcE(); for (int i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { - Q -= Math.log(E[i]) * system.getPhases()[0].getComponents()[i].getz(); + Q -= Math.log(E[i]) * system.getPhases()[0].getComponent(i).getz(); } for (int k = 0; k < system.getNumberOfPhases(); k++) { dQdbeta[k] = 1.0; for (int i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { - dQdbeta[k] -= system.getPhases()[0].getComponents()[i].getz() * 1.0 / E[i] - / system.getPhases()[k].getComponents()[i].getFugacityCoefficient(); + dQdbeta[k] -= system.getPhases()[0].getComponent(i).getz() * 1.0 / E[i] + / system.getPhases()[k].getComponent(i).getFugacityCoefficient(); } } @@ -128,9 +127,9 @@ public double calcQ() { for (int j = 0; j < system.getNumberOfPhases(); j++) { Qmatrix[i][j] = 0; for (int k = 0; k < system.getPhases()[0].getNumberOfComponents(); k++) { - Qmatrix[i][j] += system.getPhases()[0].getComponents()[k].getz() - / (E[k] * E[k] * system.getPhases()[j].getComponents()[k].getFugacityCoefficient() - * system.getPhases()[i].getComponents()[k].getFugacityCoefficient()); + Qmatrix[i][j] += system.getPhases()[0].getComponent(k).getz() + / (E[k] * E[k] * system.getPhases()[j].getComponent(k).getFugacityCoefficient() + * system.getPhases()[i].getComponent(k).getFugacityCoefficient()); } } } @@ -205,7 +204,7 @@ public void stabilityAnalysis() { (clonedSystem.get(i)).init(0); for (int j = 0; j < system.getPhases()[1].getNumberOfComponents(); j++) { numb = i == j ? 1.0 : 1.0e-3; - (clonedSystem.get(i)).getPhases()[1].getComponents()[j].setx(numb); + (clonedSystem.get(i)).getPhases()[1].getComponent(j).setx(numb); } (clonedSystem.get(i)).init(1); } @@ -215,22 +214,22 @@ public void stabilityAnalysis() { // logger.info("low gibbs phase " + lowestGibbsEnergyPhase); for (int k = 0; k < minimumGibbsEnergySystem.getPhases()[1].getNumberOfComponents(); k++) { - // sumz += minimumGibbsEnergySystem.getPhases()[1].getComponents()[k].getz(); + // sumz += minimumGibbsEnergySystem.getPhases()[1].getComponent(k).getz(); for (int i = 0; i < minimumGibbsEnergySystem.getPhases()[1].getNumberOfComponents(); i++) { - sumw[k] += (clonedSystem.get(k)).getPhases()[1].getComponents()[i].getx(); + sumw[k] += (clonedSystem.get(k)).getPhases()[1].getComponent(i).getx(); } } for (int k = 0; k < minimumGibbsEnergySystem.getPhases()[1].getNumberOfComponents(); k++) { for (int i = 0; i < minimumGibbsEnergySystem.getPhases()[1].getNumberOfComponents(); i++) { - (clonedSystem.get(k)).getPhases()[1].getComponents()[i] - .setx((clonedSystem.get(k)).getPhases()[1].getComponents()[i].getx() / sumw[0]); + (clonedSystem.get(k)).getPhases()[1].getComponent(i) + .setx((clonedSystem.get(k)).getPhases()[1].getComponent(i).getx() / sumw[0]); // logger.info("x: " + ( - // clonedSystem.get(k)).getPhases()[0].getComponents()[i].getx()); + // clonedSystem.get(k)).getPhases()[0].getComponent(i).getx()); } - d[k] = Math.log( - minimumGibbsEnergySystem.getPhases()[lowestGibbsEnergyPhase].getComponents()[k].getx()) - + Math.log(minimumGibbsEnergySystem.getPhases()[lowestGibbsEnergyPhase].getComponents()[k] + d[k] = Math + .log(minimumGibbsEnergySystem.getPhases()[lowestGibbsEnergyPhase].getComponent(k).getx()) + + Math.log(minimumGibbsEnergySystem.getPhases()[lowestGibbsEnergyPhase].getComponent(k) .getFugacityCoefficient()); // logger.info("dk: " + d[k]); } @@ -245,8 +244,8 @@ public void stabilityAnalysis() { (clonedSystem.get(j)).init(1); for (int i = 0; i < system.getPhases()[1].getNumberOfComponents(); i++) { oldlogw[i] = logWi[i]; - logWi[i] = d[i] - Math.log( - (clonedSystem.get(j)).getPhases()[1].getComponents()[i].getFugacityCoefficient()); + logWi[i] = d[i] - Math + .log((clonedSystem.get(j)).getPhases()[1].getComponent(i).getFugacityCoefficient()); err += Math.abs(logWi[i] - oldlogw[i]); Wi[j][i] = Math.exp(logWi[i]); } @@ -258,8 +257,7 @@ public void stabilityAnalysis() { } for (int i = 0; i < system.getPhases()[1].getNumberOfComponents(); i++) { - (clonedSystem.get(j)).getPhases()[1].getComponents()[i] - .setx(Math.exp(logWi[i]) / sumw[j]); + (clonedSystem.get(j)).getPhases()[1].getComponent(i).setx(Math.exp(logWi[i]) / sumw[j]); } } while (Math.abs(err) > 1e-9); @@ -267,7 +265,7 @@ public void stabilityAnalysis() { for (int i = 0; i < system.getPhases()[1].getNumberOfComponents(); i++) { tm[j] -= Math.exp(logWi[i]); - x[j][i] = (clonedSystem.get(j)).getPhases()[1].getComponents()[i].getx(); + x[j][i] = (clonedSystem.get(j)).getPhases()[1].getComponent(i).getx(); // logger.info("txji: " + x[j][i]); } logger.info("tm: " + tm[j]); @@ -278,7 +276,7 @@ public void stabilityAnalysis() { system.addPhase(); unstabcomp = k; for (int i = 0; i < system.getPhases()[1].getNumberOfComponents(); i++) { - system.getPhases()[2].getComponents()[i].setx(x[k][i]); + system.getPhases()[2].getComponent(i).setx(x[k][i]); } multiPhaseTest = true; system.setBeta(system.getNumberOfPhases() - 1, @@ -309,14 +307,14 @@ public void run() { double[] xchem = new double[system.getPhases()[phase].getNumberOfComponents()]; for (i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { - xchem[i] = system.getPhases()[phase].getComponents()[i].getx(); + xchem[i] = system.getPhases()[phase].getComponent(i).getx(); } system.init(1); system.getChemicalReactionOperations().solveChemEq(phase, 1); for (i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { - chemdev += Math.abs(xchem[i] - system.getPhases()[phase].getComponents()[i].getx()); + chemdev += Math.abs(xchem[i] - system.getPhases()[phase].getComponent(i).getx()); } logger.info("chemdev: " + chemdev); } diff --git a/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/BubblePointPressureFlash.java b/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/BubblePointPressureFlash.java index 9127cd85d6..134fd39c10 100644 --- a/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/BubblePointPressureFlash.java +++ b/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/BubblePointPressureFlash.java @@ -56,20 +56,20 @@ public void run() { } for (int i = 0; i < system.getPhases()[1].getNumberOfComponents(); i++) { - system.getPhases()[1].getComponents()[i] - .setx(system.getPhases()[0].getComponents()[i].getz()); - if (system.getPhases()[0].getComponents()[i].getIonicCharge() != 0) { - system.getPhases()[0].getComponents()[i].setx(1e-40); + system.getPhases()[1].getComponent(i) + .setx(system.getPhases()[0].getComponent(i).getz()); + if (system.getPhases()[0].getComponent(i).getIonicCharge() != 0) { + system.getPhases()[0].getComponent(i).setx(1e-40); } else { - system.getPhases()[0].getComponents()[i] - .setx(system.getPhases()[0].getComponents()[i].getK() - * system.getPhases()[1].getComponents()[i].getz()); + system.getPhases()[0].getComponent(i) + .setx(system.getPhases()[0].getComponent(i).getK() + * system.getPhases()[1].getComponent(i).getz()); } } ytotal = 0.0; for (int i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { - ytotal += system.getPhases()[0].getComponents()[i].getx(); + ytotal += system.getPhases()[0].getComponent(i).getx(); } double ktot = 0.0; @@ -82,41 +82,41 @@ public void run() { do { iterations++; for (int i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { - system.getPhases()[0].getComponents()[i] - .setx(system.getPhases()[0].getComponents()[i].getx() / ytotal); + system.getPhases()[0].getComponent(i) + .setx(system.getPhases()[0].getComponent(i).getx() / ytotal); } system.init(3); oldPres = system.getPressure(); ktot = 0.0; for (int i = 0; i < system.getPhases()[1].getNumberOfComponents(); i++) { do { - yold = system.getPhases()[0].getComponents()[i].getx(); + yold = system.getPhases()[0].getComponent(i).getx(); if (!Double.isNaN(Math.exp( - Math.log(system.getPhases()[1].getComponents()[i].getFugacityCoefficient()) - Math - .log(system.getPhases()[0].getComponents()[i].getFugacityCoefficient())))) { + Math.log(system.getPhases()[1].getComponent(i).getFugacityCoefficient()) - Math + .log(system.getPhases()[0].getComponent(i).getFugacityCoefficient())))) { if (system.getPhase(0).getComponent(i).getIonicCharge() != 0) { - system.getPhases()[0].getComponents()[i].setK(1e-40); + system.getPhases()[0].getComponent(i).setK(1e-40); } else { - system.getPhases()[0].getComponents()[i].setK(Math.exp(Math - .log(system.getPhases()[1].getComponents()[i].getFugacityCoefficient()) - - Math.log(system.getPhases()[0].getComponents()[i].getFugacityCoefficient()))); + system.getPhases()[0].getComponent(i).setK(Math.exp(Math + .log(system.getPhases()[1].getComponent(i).getFugacityCoefficient()) + - Math.log(system.getPhases()[0].getComponent(i).getFugacityCoefficient()))); } } - system.getPhases()[1].getComponents()[i] - .setK(system.getPhases()[0].getComponents()[i].getK()); - system.getPhases()[0].getComponents()[i] - .setx(system.getPhases()[0].getComponents()[i].getK() - * system.getPhases()[1].getComponents()[i].getz()); + system.getPhases()[1].getComponent(i) + .setK(system.getPhases()[0].getComponent(i).getK()); + system.getPhases()[0].getComponent(i) + .setx(system.getPhases()[0].getComponent(i).getK() + * system.getPhases()[1].getComponent(i).getz()); // logger.info("y err " + - // Math.abs(system.getPhases()[0].getComponents()[i].getx()-yold)); - } while (Math.abs(system.getPhases()[0].getComponents()[i].getx() - yold) / yold > 1e-8); - ktot += Math.abs(system.getPhases()[1].getComponents()[i].getK() - 1.0); + // Math.abs(system.getPhases()[0].getComponent(i).getx()-yold)); + } while (Math.abs(system.getPhases()[0].getComponent(i).getx() - yold) / yold > 1e-8); + ktot += Math.abs(system.getPhases()[1].getComponent(i).getK() - 1.0); } for (int i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { - if (!Double.isNaN(system.getPhases()[0].getComponents()[i].getK())) { - system.getPhases()[0].getComponents()[i] - .setx(system.getPhases()[0].getComponents()[i].getK() - * system.getPhases()[1].getComponents()[i].getz()); + if (!Double.isNaN(system.getPhases()[0].getComponent(i).getK())) { + system.getPhases()[0].getComponent(i) + .setx(system.getPhases()[0].getComponent(i).getK() + * system.getPhases()[1].getComponent(i).getz()); } else { system.init(0); logger.error("k err. : nan"); @@ -125,7 +125,7 @@ public void run() { ytotal = 0.0; for (int i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { - ytotal += system.getPhases()[0].getComponents()[i].getx(); + ytotal += system.getPhases()[0].getComponent(i).getx(); } // zlogger.info("ytot " + ytotal + " pres " + system.getPressure()); diff --git a/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/BubblePointPressureFlashDer.java b/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/BubblePointPressureFlashDer.java index b68c6e8d34..7f4e10c471 100644 --- a/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/BubblePointPressureFlashDer.java +++ b/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/BubblePointPressureFlashDer.java @@ -56,20 +56,20 @@ public void run() { } for (int i = 0; i < system.getPhases()[1].getNumberOfComponents(); i++) { - system.getPhases()[1].getComponents()[i] - .setx(system.getPhases()[0].getComponents()[i].getz()); - if (system.getPhases()[0].getComponents()[i].getIonicCharge() != 0) { - system.getPhases()[0].getComponents()[i].setx(1e-40); + system.getPhases()[1].getComponent(i) + .setx(system.getPhases()[0].getComponent(i).getz()); + if (system.getPhases()[0].getComponent(i).getIonicCharge() != 0) { + system.getPhases()[0].getComponent(i).setx(1e-40); } else { - system.getPhases()[0].getComponents()[i] - .setx(system.getPhases()[0].getComponents()[i].getK() - * system.getPhases()[1].getComponents()[i].getz()); + system.getPhases()[0].getComponent(i) + .setx(system.getPhases()[0].getComponent(i).getK() + * system.getPhases()[1].getComponent(i).getz()); } } ytotal = 0.0; for (int i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { - ytotal += system.getPhases()[0].getComponents()[i].getx(); + ytotal += system.getPhases()[0].getComponent(i).getx(); } double ktot = 0.0; @@ -82,41 +82,41 @@ public void run() { do { iterations++; for (int i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { - system.getPhases()[0].getComponents()[i] - .setx(system.getPhases()[0].getComponents()[i].getx() / ytotal); + system.getPhases()[0].getComponent(i) + .setx(system.getPhases()[0].getComponent(i).getx() / ytotal); } system.init(1); oldPres = system.getPressure(); ktot = 0.0; for (int i = 0; i < system.getPhases()[1].getNumberOfComponents(); i++) { do { - yold = system.getPhases()[0].getComponents()[i].getx(); + yold = system.getPhases()[0].getComponent(i).getx(); if (!Double.isNaN(Math.exp( - Math.log(system.getPhases()[1].getComponents()[i].getFugacityCoefficient()) - Math - .log(system.getPhases()[0].getComponents()[i].getFugacityCoefficient())))) { + Math.log(system.getPhases()[1].getComponent(i).getFugacityCoefficient()) - Math + .log(system.getPhases()[0].getComponent(i).getFugacityCoefficient())))) { if (system.getPhase(0).getComponent(i).getIonicCharge() != 0) { - system.getPhases()[0].getComponents()[i].setK(1e-40); + system.getPhases()[0].getComponent(i).setK(1e-40); } else { - system.getPhases()[0].getComponents()[i].setK(Math.exp(Math - .log(system.getPhases()[1].getComponents()[i].getFugacityCoefficient()) - - Math.log(system.getPhases()[0].getComponents()[i].getFugacityCoefficient()))); + system.getPhases()[0].getComponent(i).setK(Math.exp(Math + .log(system.getPhases()[1].getComponent(i).getFugacityCoefficient()) + - Math.log(system.getPhases()[0].getComponent(i).getFugacityCoefficient()))); } } - system.getPhases()[1].getComponents()[i] - .setK(system.getPhases()[0].getComponents()[i].getK()); - system.getPhases()[0].getComponents()[i] - .setx(system.getPhases()[0].getComponents()[i].getK() - * system.getPhases()[1].getComponents()[i].getz()); + system.getPhases()[1].getComponent(i) + .setK(system.getPhases()[0].getComponent(i).getK()); + system.getPhases()[0].getComponent(i) + .setx(system.getPhases()[0].getComponent(i).getK() + * system.getPhases()[1].getComponent(i).getz()); // logger.info("y err " + - // Math.abs(system.getPhases()[0].getComponents()[i].getx()-yold)); - } while (Math.abs(system.getPhases()[0].getComponents()[i].getx() - yold) / yold > 1e-8); - ktot += Math.abs(system.getPhases()[1].getComponents()[i].getK() - 1.0); + // Math.abs(system.getPhases()[0].getComponent(i).getx()-yold)); + } while (Math.abs(system.getPhases()[0].getComponent(i).getx() - yold) / yold > 1e-8); + ktot += Math.abs(system.getPhases()[1].getComponent(i).getK() - 1.0); } for (int i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { - if (!Double.isNaN(system.getPhases()[0].getComponents()[i].getK())) { - system.getPhases()[0].getComponents()[i] - .setx(system.getPhases()[0].getComponents()[i].getK() - * system.getPhases()[1].getComponents()[i].getz()); + if (!Double.isNaN(system.getPhases()[0].getComponent(i).getK())) { + system.getPhases()[0].getComponent(i) + .setx(system.getPhases()[0].getComponent(i).getK() + * system.getPhases()[1].getComponent(i).getz()); } else { system.init(0); logger.error("K error : nan"); @@ -127,14 +127,14 @@ public void run() { deriv = 0.0; funk = 0.0; for (int i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { - ytotal += system.getPhases()[0].getComponents()[i].getx(); + ytotal += system.getPhases()[0].getComponent(i).getx(); // Following lines added by Neeraj - funk += system.getPhases()[1].getComponents()[i].getx() - * system.getPhases()[1].getComponents()[i].getK(); - deriv += system.getPhases()[1].getComponents()[i].getx() - * system.getPhases()[1].getComponents()[i].getK() - * (system.getPhases()[1].getComponents()[i].logfugcoefdP(this.system.getPhase(1)) - - system.getPhases()[0].getComponents()[i].logfugcoefdP(this.system.getPhase(0))); + funk += system.getPhases()[1].getComponent(i).getx() + * system.getPhases()[1].getComponent(i).getK(); + deriv += system.getPhases()[1].getComponent(i).getx() + * system.getPhases()[1].getComponent(i).getK() + * (system.getPhases()[1].getComponent(i).logfugcoefdP(this.system.getPhase(1)) + - system.getPhases()[0].getComponent(i).logfugcoefdP(this.system.getPhase(0))); } // logger.info("ytot " + ytotal + " pres " + system.getPressure()); diff --git a/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/BubblePointTemperatureFlash.java b/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/BubblePointTemperatureFlash.java index 6d99c94800..1fde945f61 100644 --- a/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/BubblePointTemperatureFlash.java +++ b/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/BubblePointTemperatureFlash.java @@ -38,10 +38,10 @@ public void run() { double funk = 0; for (int i = 0; i < system.getPhases()[1].getNumberOfComponents(); i++) { - system.getPhases()[1].getComponents()[i] - .setx(system.getPhases()[0].getComponents()[i].getz()); - system.getPhases()[0].getComponents()[i].setx(system.getPhases()[0].getComponents()[i].getK() - * system.getPhases()[1].getComponents()[i].getx()); + system.getPhases()[1].getComponent(i) + .setx(system.getPhases()[0].getComponent(i).getz()); + system.getPhases()[0].getComponent(i).setx(system.getPhases()[0].getComponent(i).getK() + * system.getPhases()[1].getComponent(i).getx()); } system.setNumberOfPhases(2); do { @@ -55,26 +55,26 @@ public void run() { do { iterations++; - yold = system.getPhases()[0].getComponents()[i].getx(); - system.getPhases()[0].getComponents()[i] - .setK(system.getPhases()[1].getComponents()[i].getFugacityCoefficient() - / system.getPhases()[0].getComponents()[i].getFugacityCoefficient()); - system.getPhases()[1].getComponents()[i] - .setK(system.getPhases()[0].getComponents()[i].getK()); - system.getPhases()[0].getComponents()[i] - .setx(system.getPhases()[1].getComponents()[i].getx() - * system.getPhases()[1].getComponents()[i].getFugacityCoefficient() - / system.getPhases()[0].getComponents()[i].getFugacityCoefficient()); - } while ((Math.abs(yold - system.getPhases()[1].getComponents()[i].getx()) > 1e-10) + yold = system.getPhases()[0].getComponent(i).getx(); + system.getPhases()[0].getComponent(i) + .setK(system.getPhases()[1].getComponent(i).getFugacityCoefficient() + / system.getPhases()[0].getComponent(i).getFugacityCoefficient()); + system.getPhases()[1].getComponent(i) + .setK(system.getPhases()[0].getComponent(i).getK()); + system.getPhases()[0].getComponent(i) + .setx(system.getPhases()[1].getComponent(i).getx() + * system.getPhases()[1].getComponent(i).getFugacityCoefficient() + / system.getPhases()[0].getComponent(i).getFugacityCoefficient()); + } while ((Math.abs(yold - system.getPhases()[1].getComponent(i).getx()) > 1e-10) && (iterations < maxNumberOfIterations)); - ytotal += system.getPhases()[0].getComponents()[i].getx(); - funk += system.getPhases()[1].getComponents()[i].getx() - * system.getPhases()[1].getComponents()[i].getK(); - deriv += system.getPhases()[1].getComponents()[i].getx() - * system.getPhases()[1].getComponents()[i].getK() - * (system.getPhases()[1].getComponents()[i].getdfugdt() - - system.getPhases()[0].getComponents()[i].getdfugdt()); + ytotal += system.getPhases()[0].getComponent(i).getx(); + funk += system.getPhases()[1].getComponent(i).getx() + * system.getPhases()[1].getComponent(i).getK(); + deriv += system.getPhases()[1].getComponent(i).getx() + * system.getPhases()[1].getComponent(i).getK() + * (system.getPhases()[1].getComponent(i).getdfugdt() + - system.getPhases()[0].getComponent(i).getdfugdt()); } // logger.info("FUNK: " + funk); diff --git a/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/BubblePointTemperatureNoDer.java b/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/BubblePointTemperatureNoDer.java index ebab18e97d..3e7cd91a72 100644 --- a/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/BubblePointTemperatureNoDer.java +++ b/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/BubblePointTemperatureNoDer.java @@ -66,19 +66,17 @@ public void run() { } for (int i = 0; i < system.getPhases()[1].getNumberOfComponents(); i++) { - system.getPhases()[1].getComponents()[i] - .setx(system.getPhases()[0].getComponents()[i].getz()); - if (system.getPhases()[0].getComponents()[i].getIonicCharge() != 0) { - system.getPhases()[0].getComponents()[i].setx(1e-40); + system.getPhases()[1].getComponent(i).setx(system.getPhases()[0].getComponent(i).getz()); + if (system.getPhases()[0].getComponent(i).getIonicCharge() != 0) { + system.getPhases()[0].getComponent(i).setx(1e-40); } else { - system.getPhases()[0].getComponents()[i] - .setx(system.getPhases()[0].getComponents()[i].getK() - * system.getPhases()[1].getComponents()[i].getz()); + system.getPhases()[0].getComponent(i).setx(system.getPhases()[0].getComponent(i).getK() + * system.getPhases()[1].getComponent(i).getz()); } } ytotal = 0.0; for (int i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { - ytotal += system.getPhases()[0].getComponents()[i].getx(); + ytotal += system.getPhases()[0].getComponent(i).getx(); } double oldTemp = 10.0; @@ -86,8 +84,8 @@ public void run() { do { iterations++; for (int i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { - system.getPhases()[0].getComponents()[i] - .setx(system.getPhases()[0].getComponents()[i].getx() / ytotal); + system.getPhases()[0].getComponent(i) + .setx(system.getPhases()[0].getComponent(i).getx() / ytotal); } if (system.isChemicalSystem() && (iterations % 2) == 0) { system.getChemicalReactionOperations().solveChemEq(1); @@ -97,28 +95,26 @@ public void run() { ktot = 0.0; for (int i = 0; i < system.getPhases()[1].getNumberOfComponents(); i++) { do { - yold = system.getPhases()[0].getComponents()[i].getx(); + yold = system.getPhases()[0].getComponent(i).getx(); if (system.getPhase(0).getComponent(i).getIonicCharge() != 0) { - system.getPhases()[0].getComponents()[i].setK(1e-40); + system.getPhases()[0].getComponent(i).setK(1e-40); } else { - system.getPhases()[0].getComponents()[i].setK( - Math.exp(Math.log(system.getPhases()[1].getComponents()[i].getFugacityCoefficient()) - - Math.log(system.getPhases()[0].getComponents()[i].getFugacityCoefficient()))); + system.getPhases()[0].getComponent(i).setK( + Math.exp(Math.log(system.getPhases()[1].getComponent(i).getFugacityCoefficient()) + - Math.log(system.getPhases()[0].getComponent(i).getFugacityCoefficient()))); } - system.getPhases()[1].getComponents()[i] - .setK(system.getPhases()[0].getComponents()[i].getK()); - system.getPhases()[0].getComponents()[i] - .setx(system.getPhases()[0].getComponents()[i].getK() - * system.getPhases()[1].getComponents()[i].getz()); + system.getPhases()[1].getComponent(i).setK(system.getPhases()[0].getComponent(i).getK()); + system.getPhases()[0].getComponent(i).setx(system.getPhases()[0].getComponent(i).getK() + * system.getPhases()[1].getComponent(i).getz()); // logger.info("y err " + - // Math.abs(system.getPhases()[0].getComponents()[i].getx()-yold)); - } while (Math.abs(system.getPhases()[0].getComponents()[i].getx() - yold) > 1e-4); + // Math.abs(system.getPhases()[0].getComponent(i).getx()-yold)); + } while (Math.abs(system.getPhases()[0].getComponent(i).getx() - yold) > 1e-4); - ktot += Math.abs(system.getPhases()[1].getComponents()[i].getK() - 1.0); + ktot += Math.abs(system.getPhases()[1].getComponent(i).getK() - 1.0); } ytotal = 0.0; for (int i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { - ytotal += system.getPhases()[0].getComponents()[i].getx(); + ytotal += system.getPhases()[0].getComponent(i).getx(); } if (ytotal > 1.2) { ytotal = 1.2; @@ -133,10 +129,10 @@ public void run() { system .setTemperature(system.getTemperature() + 0.1 * system.getTemperature() * (1.0 - ytotal)); // for (int i=0;i 1e-9) @@ -148,8 +144,8 @@ public void run() { setSuperCritical(true); } if (system.getPhase(0).getNumberOfComponents() == 1 - && Math.abs(system.getPhases()[1].getComponents()[0].getFugacityCoefficient() - / system.getPhases()[0].getComponents()[0].getFugacityCoefficient() - 1.0) < 1e-20) { + && Math.abs(system.getPhases()[1].getComponent(0).getFugacityCoefficient() + / system.getPhases()[0].getComponent(0).getFugacityCoefficient() - 1.0) < 1e-20) { setSuperCritical(true); } } diff --git a/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/ConstantDutyFlash.java b/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/ConstantDutyFlash.java index 54c0ff42b1..a98cf1bc39 100644 --- a/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/ConstantDutyFlash.java +++ b/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/ConstantDutyFlash.java @@ -80,12 +80,12 @@ public void run() { system.init(2); for (int i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { - system.getPhases()[0].getComponents()[i] - .setK(system.getPhases()[0].getComponents()[i].getFugacityCoefficient() - / system.getPhases()[1].getComponents()[i].getFugacityCoefficient()); - system.getPhases()[1].getComponents()[i] - .setK(system.getPhases()[0].getComponents()[i].getFugacityCoefficient() - / system.getPhases()[1].getComponents()[i].getFugacityCoefficient()); + system.getPhases()[0].getComponent(i) + .setK(system.getPhases()[0].getComponent(i).getFugacityCoefficient() + / system.getPhases()[1].getComponent(i).getFugacityCoefficient()); + system.getPhases()[1].getComponent(i) + .setK(system.getPhases()[0].getComponent(i).getFugacityCoefficient() + / system.getPhases()[1].getComponent(i).getFugacityCoefficient()); } system.calc_x_y(); @@ -94,16 +94,16 @@ public void run() { deriv = 0e0; for (int i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { - dkidt = (system.getPhases()[0].getComponents()[i].getdfugdt() - - system.getPhases()[1].getComponents()[i].getdfugdt()) - * system.getPhases()[0].getComponents()[i].getK(); - dxidt = -system.getPhases()[0].getComponents()[i].getx() - * system.getPhases()[0].getComponents()[i].getx() * 1.0 - / system.getPhases()[0].getComponents()[i].getz() * system.getBeta() * dkidt; - dyidt = dkidt * system.getPhases()[0].getComponents()[i].getx() - + system.getPhases()[0].getComponents()[i].getK() * dxidt; - funk = funk + system.getPhases()[1].getComponents()[i].getx() - - system.getPhases()[0].getComponents()[i].getx(); + dkidt = (system.getPhases()[0].getComponent(i).getdfugdt() + - system.getPhases()[1].getComponent(i).getdfugdt()) + * system.getPhases()[0].getComponent(i).getK(); + dxidt = -system.getPhases()[0].getComponent(i).getx() + * system.getPhases()[0].getComponent(i).getx() * 1.0 + / system.getPhases()[0].getComponent(i).getz() * system.getBeta() * dkidt; + dyidt = dkidt * system.getPhases()[0].getComponent(i).getx() + + system.getPhases()[0].getComponent(i).getK() * dxidt; + funk = funk + system.getPhases()[1].getComponent(i).getx() + - system.getPhases()[0].getComponent(i).getx(); deriv = deriv + dyidt - dxidt; } diff --git a/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/ConstantDutyPressureFlash.java b/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/ConstantDutyPressureFlash.java index abae2b2152..16820568dd 100644 --- a/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/ConstantDutyPressureFlash.java +++ b/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/ConstantDutyPressureFlash.java @@ -47,11 +47,11 @@ public void run() { system.init(2); iterations++; for (int i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { - system.getPhases()[0].getComponents()[i] - .setK(system.getPhases()[1].getComponents()[i].getFugacityCoefficient() - / system.getPhases()[0].getComponents()[i].getFugacityCoefficient()); - system.getPhases()[1].getComponents()[i] - .setK(system.getPhases()[0].getComponents()[i].getK()); + system.getPhases()[0].getComponent(i) + .setK(system.getPhases()[1].getComponent(i).getFugacityCoefficient() + / system.getPhases()[0].getComponent(i).getFugacityCoefficient()); + system.getPhases()[1].getComponent(i) + .setK(system.getPhases()[0].getComponent(i).getK()); } system.calc_x_y_nonorm(); @@ -60,16 +60,16 @@ public void run() { deriv = 0.0; for (int i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { - dkidp = (system.getPhases()[1].getComponents()[i].getdfugdp() - - system.getPhases()[0].getComponents()[i].getdfugdp()) - * system.getPhases()[1].getComponents()[i].getK(); - dxidp = -system.getPhases()[1].getComponents()[i].getz() * system.getBeta() * dkidp + dkidp = (system.getPhases()[1].getComponent(i).getdfugdp() + - system.getPhases()[0].getComponent(i).getdfugdp()) + * system.getPhases()[1].getComponent(i).getK(); + dxidp = -system.getPhases()[1].getComponent(i).getz() * system.getBeta() * dkidp / Math.pow(1.0 - system.getBeta() - + system.getBeta() * system.getPhases()[1].getComponents()[i].getK(), 2.0); - dyidp = dkidp * system.getPhases()[1].getComponents()[i].getx() - + system.getPhases()[1].getComponents()[i].getK() * dxidp; - funk += system.getPhases()[0].getComponents()[i].getx() - - system.getPhases()[1].getComponents()[i].getx(); + + system.getBeta() * system.getPhases()[1].getComponent(i).getK(), 2.0); + dyidp = dkidp * system.getPhases()[1].getComponent(i).getx() + + system.getPhases()[1].getComponent(i).getK() * dxidp; + funk += system.getPhases()[0].getComponent(i).getx() + - system.getPhases()[1].getComponent(i).getx(); deriv += dyidp - dxidp; } diff --git a/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/ConstantDutyTemperatureFlash.java b/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/ConstantDutyTemperatureFlash.java index fd0a2af18e..5118154ed3 100644 --- a/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/ConstantDutyTemperatureFlash.java +++ b/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/ConstantDutyTemperatureFlash.java @@ -52,12 +52,12 @@ public void run() { system.init(2); for (int i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { - system.getPhases()[0].getComponents()[i] - .setK(system.getPhases()[0].getComponents()[i].getFugacityCoefficient() - / system.getPhases()[1].getComponents()[i].getFugacityCoefficient()); - system.getPhases()[1].getComponents()[i] - .setK(system.getPhases()[0].getComponents()[i].getFugacityCoefficient() - / system.getPhases()[1].getComponents()[i].getFugacityCoefficient()); + system.getPhases()[0].getComponent(i) + .setK(system.getPhases()[0].getComponent(i).getFugacityCoefficient() + / system.getPhases()[1].getComponent(i).getFugacityCoefficient()); + system.getPhases()[1].getComponent(i) + .setK(system.getPhases()[0].getComponent(i).getFugacityCoefficient() + / system.getPhases()[1].getComponent(i).getFugacityCoefficient()); } system.calc_x_y_nonorm(); @@ -66,18 +66,18 @@ public void run() { deriv = 0e0; for (int i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { - dkidt = (system.getPhases()[0].getComponents()[i].getdfugdt() - - system.getPhases()[1].getComponents()[i].getdfugdt()) - * system.getPhases()[0].getComponents()[i].getK(); - // dxidt=-system.getPhases()[0].getComponents()[i].getx() * - // system.getPhases()[0].getComponents()[i].getx()*1.0/system.getPhases()[0].getComponents()[i].getz()*system.getBeta()*dkidt; - dxidt = -system.getPhases()[0].getComponents()[i].getz() * system.getBeta() * dkidt + dkidt = (system.getPhases()[0].getComponent(i).getdfugdt() + - system.getPhases()[1].getComponent(i).getdfugdt()) + * system.getPhases()[0].getComponent(i).getK(); + // dxidt=-system.getPhases()[0].getComponent(i).getx() * + // system.getPhases()[0].getComponent(i).getx()*1.0/system.getPhases()[0].getComponent(i).getz()*system.getBeta()*dkidt; + dxidt = -system.getPhases()[0].getComponent(i).getz() * system.getBeta() * dkidt / Math.pow(1.0 - system.getBeta() - + system.getBeta() * system.getPhases()[0].getComponents()[i].getK(), 2); - dyidt = dkidt * system.getPhases()[0].getComponents()[i].getx() - + system.getPhases()[0].getComponents()[i].getK() * dxidt; - funk = funk + system.getPhases()[1].getComponents()[i].getx() - - system.getPhases()[0].getComponents()[i].getx(); + + system.getBeta() * system.getPhases()[0].getComponent(i).getK(), 2); + dyidt = dkidt * system.getPhases()[0].getComponent(i).getx() + + system.getPhases()[0].getComponent(i).getK() * dxidt; + funk = funk + system.getPhases()[1].getComponent(i).getx() + - system.getPhases()[0].getComponent(i).getx(); deriv = deriv + dyidt - dxidt; } diff --git a/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/CricondebarFlash.java b/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/CricondebarFlash.java index 517de33432..4a3b7b5997 100644 --- a/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/CricondebarFlash.java +++ b/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/CricondebarFlash.java @@ -45,20 +45,20 @@ public CricondebarFlash(SystemInterface system) { public double calcx() { double xtotal = 0; for (int i = 0; i < system.getPhases()[1].getNumberOfComponents(); i++) { - system.getPhases()[0].getComponents()[i] - .setK(Math.exp(system.getPhases()[1].getComponents()[i].getLogFugacityCoefficient() - - system.getPhases()[0].getComponents()[i].getLogFugacityCoefficient())); + system.getPhases()[0].getComponent(i) + .setK(Math.exp(system.getPhases()[1].getComponent(i).getLogFugacityCoefficient() + - system.getPhases()[0].getComponent(i).getLogFugacityCoefficient())); - system.getPhases()[1].getComponents()[i] - .setK(system.getPhases()[0].getComponents()[i].getK()); - system.getPhases()[1].getComponents()[i] - .setx(1.0 / system.getPhases()[0].getComponents()[i].getK() - * system.getPhases()[1].getComponents()[i].getz()); - // ktot += Math.abs(system.getPhases()[1].getComponents()[i].getK() - 1.0); + system.getPhases()[1].getComponent(i) + .setK(system.getPhases()[0].getComponent(i).getK()); + system.getPhases()[1].getComponent(i) + .setx(1.0 / system.getPhases()[0].getComponent(i).getK() + * system.getPhases()[1].getComponent(i).getz()); + // ktot += Math.abs(system.getPhases()[1].getComponent(i).getK() - 1.0); } xtotal = 0.0; for (int i = 0; i < system.getPhases()[1].getNumberOfComponents(); i++) { - xtotal += system.getPhases()[1].getComponents()[i].getx(); + xtotal += system.getPhases()[1].getComponent(i).getx(); } return xtotal; } @@ -249,12 +249,12 @@ public void run() { public void setfvec() { double sumxx = 0; for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { - sumxx += system.getPhases()[1].getComponents()[i].getx(); + sumxx += system.getPhases()[1].getComponent(i).getx(); fvec.set(i, 0, - Math.log(system.getPhases()[0].getComponents()[i].getFugacityCoefficient() - * system.getPhases()[0].getComponents()[i].getz() * system.getPressure()) - - Math.log(system.getPhases()[1].getComponents()[i].getFugacityCoefficient() - * system.getPhases()[1].getComponents()[i].getx() * system.getPressure())); + Math.log(system.getPhases()[0].getComponent(i).getFugacityCoefficient() + * system.getPhases()[0].getComponent(i).getz() * system.getPressure()) + - Math.log(system.getPhases()[1].getComponent(i).getFugacityCoefficient() + * system.getPhases()[1].getComponent(i).getx() * system.getPressure())); } fvec.set(system.getPhase(0).getNumberOfComponents(), 0, 1.0 - sumxx); // logger.info("sumx" + sumxx); @@ -274,8 +274,8 @@ public void setJac() { for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { for (int j = 0; j < system.getPhase(0).getNumberOfComponents(); j++) { dij = i == j ? 1.0 : 0.0; // Kroneckers delta - tempJ = -dij * 1.0 / system.getPhases()[1].getComponents()[i].getx() - - system.getPhases()[1].getComponents()[i].getdfugdx(j); + tempJ = -dij * 1.0 / system.getPhases()[1].getComponent(i).getx() + - system.getPhases()[1].getComponent(i).getdfugdx(j); Jac.set(i, j, tempJ); } } @@ -285,8 +285,8 @@ public void setJac() { } for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { Jac.set(i, system.getPhase(0).getNumberOfComponents(), - system.getPhases()[0].getComponents()[i].getdfugdp() - - system.getPhases()[1].getComponents()[i].getdfugdp()); + system.getPhases()[0].getComponent(i).getdfugdp() + - system.getPhases()[1].getComponent(i).getdfugdp()); } } diff --git a/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/CricondenBarTemp.java b/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/CricondenBarTemp.java index f9b259adc2..559502e8bb 100644 --- a/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/CricondenBarTemp.java +++ b/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/CricondenBarTemp.java @@ -72,10 +72,10 @@ public CricondenBarTemp(SystemInterface system, int numberOfPhases, int numberOf public void setfvec() { for (int i = 0; i < numberOfComponents; i++) { fvec.set(i, 0, - Math.log(system.getPhases()[0].getComponents()[i].getFugacityCoefficient() - * system.getPhases()[0].getComponents()[i].getx() * system.getPressure()) - - Math.log(system.getPhases()[1].getComponents()[i].getFugacityCoefficient() - * system.getPhases()[1].getComponents()[i].getx() * system.getPressure())); + Math.log(system.getPhases()[0].getComponent(i).getFugacityCoefficient() + * system.getPhases()[0].getComponent(i).getx() * system.getPressure()) + - Math.log(system.getPhases()[1].getComponent(i).getFugacityCoefficient() + * system.getPhases()[1].getComponent(i).getx() * system.getPressure())); } } @@ -93,11 +93,11 @@ public void setJac() { for (int j = 0; j < numberOfComponents; j++) { dij = i == j ? 1.0 : 0.0; // Kroneckers delta tempJ = 1.0 / system.getBeta() - * (dij / system.getPhases()[0].getComponents()[i].getx() - 1.0 - + system.getPhases()[0].getComponents()[i].getdfugdx(j)) + * (dij / system.getPhases()[0].getComponent(i).getx() - 1.0 + + system.getPhases()[0].getComponent(i).getdfugdx(j)) + 1.0 / (1.0 - system.getBeta()) - * (dij / system.getPhases()[1].getComponents()[i].getx() - 1.0 - + system.getPhases()[1].getComponents()[i].getdfugdx(j)); + * (dij / system.getPhases()[1].getComponent(i).getx() - 1.0 + + system.getPhases()[1].getComponent(i).getdfugdx(j)); Jac.set(i, j, tempJ); } } @@ -110,7 +110,7 @@ public void setJac() { */ public void setu() { for (int i = 0; i < numberOfComponents; i++) { - u.set(i, 0, system.getBeta() * system.getPhases()[0].getComponents()[i].getx()); + u.set(i, 0, system.getBeta() * system.getPhases()[0].getComponent(i).getx()); } } @@ -126,15 +126,16 @@ public void init() { temp += u.get(i, 0); } system.setBeta(temp); + for (int i = 0; i < numberOfComponents; i++) { - system.getPhases()[0].getComponents()[i].setx(u.get(i, 0) / system.getBeta()); - system.getPhases()[1].getComponents()[i] - .setx((system.getPhases()[0].getComponents()[i].getz() - u.get(i, 0)) + system.getPhases()[0].getComponent(i).setx(u.get(i, 0) / system.getBeta()); + system.getPhases()[1].getComponent(i) + .setx((system.getPhases()[0].getComponent(i).getz() - u.get(i, 0)) / (1.0 - system.getBeta())); - system.getPhases()[0].getComponents()[i].setK(system.getPhases()[0].getComponents()[i].getx() - / system.getPhases()[1].getComponents()[i].getx()); - system.getPhases()[1].getComponents()[i] - .setK(system.getPhases()[0].getComponents()[i].getK()); + system.getPhases()[0].getComponent(i).setK(system.getPhases()[0].getComponent(i).getx() + / system.getPhases()[1].getComponent(i).getx()); + system.getPhases()[1].getComponent(i) + .setK(system.getPhases()[0].getComponent(i).getK()); } system.init(3); diff --git a/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/CricondenBarTemp1.java b/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/CricondenBarTemp1.java index 7d021a91be..3f577362d7 100644 --- a/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/CricondenBarTemp1.java +++ b/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/CricondenBarTemp1.java @@ -79,10 +79,10 @@ public void setfvec() { * (system.getPhase(0).getComponent(i).getdfugdt() - system.getPhase(1).getComponent(i).getdfugdt()); fvec.set(i, 0, - Math.log(system.getPhase(0).getComponents()[i].getFugacityCoefficient() - * system.getPhase(0).getComponents()[i].getz() * system.getPressure()) - - Math.log(system.getPhases()[1].getComponents()[i].getFugacityCoefficient() - * system.getPhases()[1].getComponents()[i].getx() * system.getPressure())); + Math.log(system.getPhase(0).getComponent(i).getFugacityCoefficient() + * system.getPhase(0).getComponent(i).getz() * system.getPressure()) + - Math.log(system.getPhases()[1].getComponent(i).getFugacityCoefficient() + * system.getPhases()[1].getComponent(i).getx() * system.getPressure())); } fvec.set(numberOfComponents, 0, 1.0 - xtot); fvec.set(numberOfComponents + 1, 0, dQdT); @@ -105,11 +105,11 @@ public void setJac() { for (int j = 0; j < numberOfComponents; j++) { dij = i == j ? 1.0 : 0.0; // Kroneckers delta tempJ = 1.0 / system.getBeta() - * (dij / system.getPhases()[0].getComponents()[i].getx() - 1.0 - + system.getPhases()[0].getComponents()[i].getdfugdx(j)) + * (dij / system.getPhases()[0].getComponent(i).getx() - 1.0 + + system.getPhases()[0].getComponent(i).getdfugdx(j)) + 1.0 / (1.0 - system.getBeta()) - * (dij / system.getPhases()[1].getComponents()[i].getx() - 1.0 - + system.getPhases()[1].getComponents()[i].getdfugdx(j)); + * (dij / system.getPhases()[1].getComponent(i).getx() - 1.0 + + system.getPhases()[1].getComponent(i).getdfugdx(j)); Jac.set(i, j, tempJ); } } @@ -122,7 +122,7 @@ public void setJac() { */ public void setu() { for (int i = 0; i < numberOfComponents; i++) { - u.set(i, 0, system.getBeta() * system.getPhases()[0].getComponents()[i].getx()); + u.set(i, 0, system.getBeta() * system.getPhases()[0].getComponent(i).getx()); } } @@ -138,15 +138,16 @@ public void init() { temp += u.get(i, 0); } system.setBeta(temp); + for (int i = 0; i < numberOfComponents; i++) { - system.getPhases()[0].getComponents()[i].setx(u.get(i, 0) / system.getBeta()); - system.getPhases()[1].getComponents()[i] - .setx((system.getPhases()[0].getComponents()[i].getz() - u.get(i, 0)) + system.getPhases()[0].getComponent(i).setx(u.get(i, 0) / system.getBeta()); + system.getPhases()[1].getComponent(i) + .setx((system.getPhases()[0].getComponent(i).getz() - u.get(i, 0)) / (1.0 - system.getBeta())); - system.getPhases()[0].getComponents()[i].setK(system.getPhases()[0].getComponents()[i].getx() - / system.getPhases()[1].getComponents()[i].getx()); - system.getPhases()[1].getComponents()[i] - .setK(system.getPhases()[0].getComponents()[i].getK()); + system.getPhases()[0].getComponent(i).setK(system.getPhases()[0].getComponent(i).getx() + / system.getPhases()[1].getComponent(i).getx()); + system.getPhases()[1].getComponent(i) + .setK(system.getPhases()[0].getComponent(i).getK()); } system.init(3); diff --git a/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/DewPointPressureFlash.java b/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/DewPointPressureFlash.java index 9428dfeec7..5cd619b54a 100644 --- a/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/DewPointPressureFlash.java +++ b/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/DewPointPressureFlash.java @@ -48,52 +48,50 @@ public void run() { } for (int i = 0; i < system.getPhases()[1].getNumberOfComponents(); i++) { - system.getPhases()[0].getComponents()[i] - .setx(system.getPhases()[0].getComponents()[i].getz()); - if (system.getPhases()[0].getComponents()[i].getIonicCharge() != 0) { - system.getPhases()[0].getComponents()[i].setx(1e-40); + system.getPhases()[0].getComponent(i).setx(system.getPhases()[0].getComponent(i).getz()); + if (system.getPhases()[0].getComponent(i).getIonicCharge() != 0) { + system.getPhases()[0].getComponent(i).setx(1e-40); } else { - system.getPhases()[1].getComponents()[i] - .setx(1.0 / system.getPhases()[0].getComponents()[i].getK() - * system.getPhases()[1].getComponents()[i].getz()); + system.getPhases()[1].getComponent(i) + .setx(1.0 / system.getPhases()[0].getComponent(i).getK() + * system.getPhases()[1].getComponent(i).getz()); } } // system.setPressure(system.getPhases()[0].getAntoineVaporPressure(system.getTemperature())); xtotal = 0.0; for (int i = 0; i < system.getPhases()[1].getNumberOfComponents(); i++) { - xtotal += system.getPhases()[1].getComponents()[i].getx(); + xtotal += system.getPhases()[1].getComponent(i).getx(); } double ktot = 0.0; do { iterations++; for (int i = 0; i < system.getPhases()[1].getNumberOfComponents(); i++) { - system.getPhases()[1].getComponents()[i] - .setx(system.getPhases()[1].getComponents()[i].getx() / xtotal); + system.getPhases()[1].getComponent(i) + .setx(system.getPhases()[1].getComponent(i).getx() / xtotal); } system.init(1); ktot = 0.0; oldPres = system.getPressure(); for (int i = 0; i < system.getPhases()[1].getNumberOfComponents(); i++) { do { - xold = system.getPhases()[1].getComponents()[i].getx(); + xold = system.getPhases()[1].getComponent(i).getx(); if (system.getPhase(0).getComponent(i).getIonicCharge() != 0) { - system.getPhases()[0].getComponents()[i].setK(1e-40); + system.getPhases()[0].getComponent(i).setK(1e-40); } else { - system.getPhases()[0].getComponents()[i].setK( - Math.exp(Math.log(system.getPhases()[1].getComponents()[i].getFugacityCoefficient()) - - Math.log(system.getPhases()[0].getComponents()[i].getFugacityCoefficient()))); + system.getPhases()[0].getComponent(i).setK( + Math.exp(Math.log(system.getPhases()[1].getComponent(i).getFugacityCoefficient()) + - Math.log(system.getPhases()[0].getComponent(i).getFugacityCoefficient()))); } - system.getPhases()[1].getComponents()[i] - .setK(system.getPhases()[0].getComponents()[i].getK()); - system.getPhases()[1].getComponents()[i] - .setx(1.0 / system.getPhases()[0].getComponents()[i].getK() - * system.getPhases()[1].getComponents()[i].getz()); - } while (Math.abs(system.getPhases()[1].getComponents()[i].getx() - xold) > 1e-4); - ktot += Math.abs(system.getPhases()[1].getComponents()[i].getK() - 1.0); + system.getPhases()[1].getComponent(i).setK(system.getPhases()[0].getComponent(i).getK()); + system.getPhases()[1].getComponent(i) + .setx(1.0 / system.getPhases()[0].getComponent(i).getK() + * system.getPhases()[1].getComponent(i).getz()); + } while (Math.abs(system.getPhases()[1].getComponent(i).getx() - xold) > 1e-4); + ktot += Math.abs(system.getPhases()[1].getComponent(i).getK() - 1.0); } xtotal = 0.0; for (int i = 0; i < system.getPhases()[1].getNumberOfComponents(); i++) { - xtotal += system.getPhases()[1].getComponents()[i].getx(); + xtotal += system.getPhases()[1].getComponent(i).getx(); } system.setPressure(oldPres + 0.1 * (system.getPressure() / xtotal - oldPres)); // System.out.println("iter " + iterations + " pressure " @@ -102,7 +100,7 @@ public void run() { || Math.abs(oldPres - system.getPressure()) / oldPres > 1e-9) && (iterations < maxNumberOfIterations)); // System.out.println("iter " + iterations + " XTOT " +xtotal + " k " - // +system.getPhases()[1].getComponents()[0].getK()); + // +system.getPhases()[1].getComponent(0).getK()); if (Math.abs(xtotal - 1.0) >= 1e-5 || ktot < 1e-3 && system.getPhase(0).getNumberOfComponents() > 1) { setSuperCritical(true); diff --git a/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/DewPointTemperatureFlash.java b/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/DewPointTemperatureFlash.java index 0f8a75e042..19b2c30461 100644 --- a/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/DewPointTemperatureFlash.java +++ b/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/DewPointTemperatureFlash.java @@ -50,34 +50,34 @@ public void run() { } for (int i = 0; i < system.getPhases()[1].getNumberOfComponents(); i++) { - system.getPhases()[0].getComponents()[i] - .setx(system.getPhases()[0].getComponents()[i].getz()); - if (system.getPhases()[0].getComponents()[i].getIonicCharge() != 0) { - system.getPhases()[0].getComponents()[i].setx(1e-40); + system.getPhases()[0].getComponent(i) + .setx(system.getPhases()[0].getComponent(i).getz()); + if (system.getPhases()[0].getComponent(i).getIonicCharge() != 0) { + system.getPhases()[0].getComponent(i).setx(1e-40); } else { - if (system.getPhases()[1].getComponents()[i].getName().equals("water")) { - system.getPhases()[1].getComponents()[i].setx(1.0); + if (system.getPhases()[1].getComponent(i).getName().equals("water")) { + system.getPhases()[1].getComponent(i).setx(1.0); } else if (system.getPhases()[1].hasComponent("water")) { - system.getPhases()[1].getComponents()[i].setx(1.0e-10); + system.getPhases()[1].getComponent(i).setx(1.0e-10); } else { - system.getPhases()[1].getComponents()[i] - .setx(1.0 / system.getPhases()[0].getComponents()[i].getK() - * system.getPhases()[1].getComponents()[i].getz()); + system.getPhases()[1].getComponent(i) + .setx(1.0 / system.getPhases()[0].getComponent(i).getK() + * system.getPhases()[1].getComponent(i).getz()); } } } // system.setPressure(system.getPhases()[0].getAntoineVaporPressure(system.getTemperature())); xtotal = 0.0; for (int i = 0; i < system.getPhases()[1].getNumberOfComponents(); i++) { - xtotal += system.getPhases()[1].getComponents()[i].getx(); + xtotal += system.getPhases()[1].getComponent(i).getx(); } double ktot = 0.0; double oldTemperature = 0.0; double fold = 0; do { for (int i = 0; i < system.getPhases()[1].getNumberOfComponents(); i++) { - system.getPhases()[1].getComponents()[i] - .setx(system.getPhases()[1].getComponents()[i].getx() / xtotal); + system.getPhases()[1].getComponent(i) + .setx(system.getPhases()[1].getComponent(i).getx() / xtotal); } system.init(1); oldTemp = system.getTemperature(); @@ -85,25 +85,25 @@ public void run() { ktot = 0.0; for (int i = 0; i < system.getPhases()[1].getNumberOfComponents(); i++) { do { - xold = system.getPhases()[1].getComponents()[i].getx(); + xold = system.getPhases()[1].getComponent(i).getx(); if (system.getPhase(0).getComponent(i).getIonicCharge() != 0) { - system.getPhases()[0].getComponents()[i].setK(1e-40); + system.getPhases()[0].getComponent(i).setK(1e-40); } else { - system.getPhases()[0].getComponents()[i] - .setK(Math.exp(system.getPhases()[1].getComponents()[i].getLogFugacityCoefficient() - - system.getPhases()[0].getComponents()[i].getLogFugacityCoefficient())); + system.getPhases()[0].getComponent(i) + .setK(Math.exp(system.getPhases()[1].getComponent(i).getLogFugacityCoefficient() + - system.getPhases()[0].getComponent(i).getLogFugacityCoefficient())); } - system.getPhases()[1].getComponents()[i] - .setK(system.getPhases()[0].getComponents()[i].getK()); - system.getPhases()[1].getComponents()[i] - .setx(1.0 / system.getPhases()[0].getComponents()[i].getK() - * system.getPhases()[1].getComponents()[i].getz()); - } while (Math.abs(system.getPhases()[1].getComponents()[i].getx() - xold) > 1e-6); - ktot += Math.abs(system.getPhases()[1].getComponents()[i].getK() - 1.0); + system.getPhases()[1].getComponent(i) + .setK(system.getPhases()[0].getComponent(i).getK()); + system.getPhases()[1].getComponent(i) + .setx(1.0 / system.getPhases()[0].getComponent(i).getK() + * system.getPhases()[1].getComponent(i).getz()); + } while (Math.abs(system.getPhases()[1].getComponent(i).getx() - xold) > 1e-6); + ktot += Math.abs(system.getPhases()[1].getComponent(i).getK() - 1.0); } xtotal = 0.0; for (int i = 0; i < system.getPhases()[1].getNumberOfComponents(); i++) { - xtotal += system.getPhases()[1].getComponents()[i].getx(); + xtotal += system.getPhases()[1].getComponent(i).getx(); } double f = xtotal - 1.0; @@ -123,7 +123,7 @@ public void run() { } // System.out.println("temperature " + system.getTemperature()); // for (int i=0;i 1e-10) || Math.abs(oldTemp - system.getTemperature()) / oldTemp > 1e-8) diff --git a/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/DewPointTemperatureFlashDer.java b/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/DewPointTemperatureFlashDer.java index 0488807a99..2eb754f605 100644 --- a/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/DewPointTemperatureFlashDer.java +++ b/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/DewPointTemperatureFlashDer.java @@ -46,19 +46,19 @@ public void run() { } for (int i = 0; i < system.getPhases()[1].getNumberOfComponents(); i++) { - system.getPhases()[0].getComponents()[i] - .setx(system.getPhases()[0].getComponents()[i].getz()); - if (system.getPhases()[0].getComponents()[i].getIonicCharge() != 0) { - system.getPhases()[0].getComponents()[i].setx(1e-40); + system.getPhases()[0].getComponent(i) + .setx(system.getPhases()[0].getComponent(i).getz()); + if (system.getPhases()[0].getComponent(i).getIonicCharge() != 0) { + system.getPhases()[0].getComponent(i).setx(1e-40); } else { - if (system.getPhases()[1].getComponents()[i].getName().equals("water")) { - system.getPhases()[1].getComponents()[i].setx(1.0); + if (system.getPhases()[1].getComponent(i).getName().equals("water")) { + system.getPhases()[1].getComponent(i).setx(1.0); } else if (system.getPhases()[1].hasComponent("water")) { - system.getPhases()[1].getComponents()[i].setx(1.0e-10); + system.getPhases()[1].getComponent(i).setx(1.0e-10); } else { - system.getPhases()[1].getComponents()[i] - .setx(1.0 / system.getPhases()[0].getComponents()[i].getK() - * system.getPhases()[1].getComponents()[i].getz()); + system.getPhases()[1].getComponent(i) + .setx(1.0 / system.getPhases()[0].getComponent(i).getK() + * system.getPhases()[1].getComponent(i).getz()); } } } @@ -66,11 +66,11 @@ public void run() { // system.setPressure(system.getPhases()[0].getAntoineVaporPressure(system.getTemperature())); double xtotal = 0.0; for (int i = 0; i < system.getPhases()[1].getNumberOfComponents(); i++) { - xtotal += system.getPhases()[1].getComponents()[i].getx(); + xtotal += system.getPhases()[1].getComponent(i).getx(); } for (int i = 0; i < system.getPhases()[1].getNumberOfComponents(); i++) { - system.getPhases()[1].getComponents()[i] - .setx(system.getPhases()[1].getComponents()[i].getx() / xtotal); + system.getPhases()[1].getComponent(i) + .setx(system.getPhases()[1].getComponent(i).getx() / xtotal); } int iterations = 0; @@ -84,12 +84,12 @@ public void run() { xtotal = 0.0; double dfdT = 0.0; for (int i = 0; i < system.getPhases()[1].getNumberOfComponents(); i++) { - xtotal += 1.0 / system.getPhases()[0].getComponents()[i].getK() - * system.getPhases()[1].getComponents()[i].getz(); - dfdT -= 1.0 / system.getPhases()[0].getComponents()[i].getK() - * system.getPhases()[1].getComponents()[i].getz() - * (system.getPhases()[1].getComponents()[i].getdfugdt() - - system.getPhases()[0].getComponents()[i].getdfugdt()); + xtotal += 1.0 / system.getPhases()[0].getComponent(i).getK() + * system.getPhases()[1].getComponent(i).getz(); + dfdT -= 1.0 / system.getPhases()[0].getComponent(i).getK() + * system.getPhases()[1].getComponent(i).getz() + * (system.getPhases()[1].getComponent(i).getdfugdt() + - system.getPhases()[0].getComponent(i).getdfugdt()); } double f = xtotal - 1.0; // fold = f; @@ -111,29 +111,29 @@ public void run() { ktot = 0.0; for (int i = 0; i < system.getPhases()[1].getNumberOfComponents(); i++) { if (system.getPhase(0).getComponent(i).getIonicCharge() != 0) { - system.getPhases()[0].getComponents()[i].setK(1e-40); + system.getPhases()[0].getComponent(i).setK(1e-40); } else { - system.getPhases()[0].getComponents()[i] - .setK(Math.exp(system.getPhases()[1].getComponents()[i].getLogFugacityCoefficient() - - system.getPhases()[0].getComponents()[i].getLogFugacityCoefficient())); + system.getPhases()[0].getComponent(i) + .setK(Math.exp(system.getPhases()[1].getComponent(i).getLogFugacityCoefficient() + - system.getPhases()[0].getComponent(i).getLogFugacityCoefficient())); } - system.getPhases()[1].getComponents()[i] - .setK(system.getPhases()[0].getComponents()[i].getK()); - system.getPhases()[1].getComponents()[i] - .setx(1.0 / system.getPhases()[0].getComponents()[i].getK() - * system.getPhases()[1].getComponents()[i].getz()); - ktot += Math.abs(system.getPhases()[1].getComponents()[i].getK() - 1.0); + system.getPhases()[1].getComponent(i) + .setK(system.getPhases()[0].getComponent(i).getK()); + system.getPhases()[1].getComponent(i) + .setx(1.0 / system.getPhases()[0].getComponent(i).getK() + * system.getPhases()[1].getComponent(i).getz()); + ktot += Math.abs(system.getPhases()[1].getComponent(i).getK() - 1.0); } // system.init_x_y(); xtotal = 0.0; for (int i = 0; i < system.getPhases()[1].getNumberOfComponents(); i++) { - xtotal += system.getPhases()[1].getComponents()[i].getx(); + xtotal += system.getPhases()[1].getComponent(i).getx(); } // System.out.println("xtotal " + xtotal); for (int i = 0; i < system.getPhases()[1].getNumberOfComponents(); i++) { - system.getPhases()[1].getComponents()[i] - .setx(system.getPhases()[1].getComponents()[i].getx() / xtotal); + system.getPhases()[1].getComponent(i) + .setx(system.getPhases()[1].getComponent(i).getx() / xtotal); } } while (((Math.abs(xtotal - 1.0) > 1e-6) || Math.abs(oldTemp - system.getTemperature()) / oldTemp > 1e-4) diff --git a/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/FreezeOut.java b/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/FreezeOut.java index 7c6acb67b7..fcf7de0d16 100644 --- a/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/FreezeOut.java +++ b/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/FreezeOut.java @@ -71,7 +71,7 @@ public void run() { for (int k = 0; k < testSystem.getPhase(0).getNumberOfComponents(); k++) { FCompNames[k] = testSystem.getPhase(0).getComponent(k).getComponentName(); if (testSystem.getPhase(0).getComponent(k).doSolidCheck()) { - trpTemp = testSystem.getPhases()[0].getComponents()[k].getTriplePointTemperature(); + trpTemp = testSystem.getPhases()[0].getComponent(k).getTriplePointTemperature(); if (noFreezeFlash) { testSystem.setTemperature(trpTemp); logger.info("Starting at Triple point temperature " @@ -94,7 +94,7 @@ public void run() { iterations = 0; half = false; T2high = trpTemp + 0.1; - if (Math.abs(testSystem.getPhases()[0].getComponents()[k].getHsub()) < 1) { + if (Math.abs(testSystem.getPhases()[0].getComponent(k).getHsub()) < 1) { CCequation = false; } do { @@ -212,7 +212,7 @@ public void printToFile(String name) { // print line to output file pr_writer.println(FCompNames[k] + "," + java.lang.Double.toString(FCompTemp[k]) + "," + system.getPressure() + "," - + java.lang.Double.toString(system.getPhases()[0].getComponents()[k].getz())); + + java.lang.Double.toString(system.getPhases()[0].getComponent(k).getz())); pr_writer.flush(); } } catch (SecurityException ex) { diff --git a/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/FreezingPointTemperatureFlash.java b/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/FreezingPointTemperatureFlash.java index f00d49d323..a75ef13ddf 100644 --- a/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/FreezingPointTemperatureFlash.java +++ b/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/FreezingPointTemperatureFlash.java @@ -73,7 +73,7 @@ public double calcFunc() { funk = system.getPhase(0).getComponent(k).getz(); for (int i = 0; i < system.getNumberOfPhases(); i++) { funk -= system.getPhase(i).getBeta() * SolidFugCoeff - / system.getPhase(i).getComponents()[k].getFugacityCoefficient(); + / system.getPhase(i).getComponent(k).getFugacityCoefficient(); } } } @@ -124,7 +124,7 @@ public void run() { funk = system.getPhase(0).getComponent(k).getz(); for (int i = 0; i < system.getNumberOfPhases(); i++) { funk -= system.getPhase(i).getBeta() * SolidFugCoeff - / system.getPhase(i).getComponents()[k].getFugacityCoefficient(); + / system.getPhase(i).getComponent(k).getFugacityCoefficient(); } logger.info("funk " + funk); if (iterations > 1) { // && oldPhaseType == system.getPhase(0).getType()) { @@ -186,7 +186,7 @@ public void printToFile(String name, String[] FCompNames, double[] FCompTemp) { // print line to output file pr_writer.println(FCompNames[k] + "," + java.lang.Double.toString(FCompTemp[k]) + "," + system.getPressure() + "," - + java.lang.Double.toString(system.getPhases()[0].getComponents()[k].getz()) + "," + + java.lang.Double.toString(system.getPhases()[0].getComponent(k).getz()) + "," + Niterations); pr_writer.flush(); } diff --git a/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/FreezingPointTemperatureFlashOld.java b/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/FreezingPointTemperatureFlashOld.java index e8d126f97f..3e53d6bf5c 100644 --- a/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/FreezingPointTemperatureFlashOld.java +++ b/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/FreezingPointTemperatureFlashOld.java @@ -46,8 +46,7 @@ public void run() { if (system.getPhase(3).getComponent(k).fugcoef(system.getPhase(3)) < 9e4 && system.getPhase(3).getComponent(k).doSolidCheck()) { // checks if solid can be formed from component k - system - .setTemperature(system.getPhases()[0].getComponents()[k].getMeltingPointTemperature()); + system.setTemperature(system.getPhases()[0].getComponent(k).getMeltingPointTemperature()); system.init(0); system.init(1); iterations = 0; @@ -59,20 +58,19 @@ public void run() { ops.TPflash(); system.getPhase(3).getComponent(k).fugcoef(system.getPhase(3)); - funk = system.getPhases()[0].getComponents()[k].getz(); + funk = system.getPhases()[0].getComponent(k).getz(); logger.info("phase " + system.getNumberOfPhases()); for (int i = 0; i < system.getNumberOfPhases(); i++) { funk -= system.getPhases()[i].getBeta() - * system.getPhases()[3].getComponents()[k].getFugacityCoefficient() - / system.getPhases()[i].getComponents()[k].getFugacityCoefficient(); + * system.getPhases()[3].getComponent(k).getFugacityCoefficient() + / system.getPhases()[i].getComponent(k).getFugacityCoefficient(); deriv -= 0.01 * system.getPhases()[i].getBeta() - * (system.getPhases()[3].getComponents()[k].getFugacityCoefficient() - * Math.exp(system.getPhases()[i].getComponents()[k].getdfugdt()) * -1.0 - / Math.pow(system.getPhases()[i].getComponents()[k].getFugacityCoefficient(), - 2.0) - + Math.exp(system.getPhases()[3].getComponents()[k].getdfugdt()) - / system.getPhases()[i].getComponents()[k].getFugacityCoefficient()); + * (system.getPhases()[3].getComponent(k).getFugacityCoefficient() + * Math.exp(system.getPhases()[i].getComponent(k).getdfugdt()) * -1.0 + / Math.pow(system.getPhases()[i].getComponent(k).getFugacityCoefficient(), 2.0) + + Math.exp(system.getPhases()[3].getComponent(k).getdfugdt()) + / system.getPhases()[i].getComponent(k).getFugacityCoefficient()); } if (iterations >= 2) { deriv = -(funk - funkOld) / (system.getTemperature() - oldTemperature); diff --git a/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/FreezingPointTemperatureFlashTR.java b/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/FreezingPointTemperatureFlashTR.java index bc37aed7dc..ccc1cfd2c3 100644 --- a/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/FreezingPointTemperatureFlashTR.java +++ b/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/FreezingPointTemperatureFlashTR.java @@ -104,7 +104,7 @@ public void run() { } if (noFreezeFlash) { - system.setTemperature(system.getPhases()[0].getComponents()[k].getTriplePointTemperature()); + system.setTemperature(system.getPhases()[0].getComponent(k).getTriplePointTemperature()); logger.info("Starting at Triple point temperature " + system.getPhase(0).getComponent(k).getComponentName()); } else { @@ -165,16 +165,15 @@ public void run() { SolidFug = Pvapsolid / pres * Math.exp(solvol / (R * temp) * (pres - Pvapsolid)); SolVapFugCoeff = testSystem2.getPhase(0).getComponent(0).getFugacityCoefficient(); - funk = system.getPhases()[0].getComponents()[k].getz(); + funk = system.getPhases()[0].getComponent(k).getz(); for (int i = 0; i < system.getNumberOfPhases(); i++) { funk -= system.getPhases()[i].getBeta() * SolidFug * SolVapFugCoeff - / system.getPhases()[i].getComponents()[k].getFugacityCoefficient(); + / system.getPhases()[i].getComponent(k).getFugacityCoefficient(); deriv -= 0.01 * system.getPhases()[i].getBeta() * (SolidFug * SolVapFugCoeff - * Math.exp(system.getPhases()[i].getComponents()[k].getdfugdt()) * -1.0 - / Math.pow(system.getPhases()[i].getComponents()[k].getFugacityCoefficient(), 2.0) - + Math.exp(dfugdt) - / system.getPhases()[i].getComponents()[k].getFugacityCoefficient()); + * Math.exp(system.getPhases()[i].getComponent(k).getdfugdt()) * -1.0 + / Math.pow(system.getPhases()[i].getComponent(k).getFugacityCoefficient(), 2.0) + + Math.exp(dfugdt) / system.getPhases()[i].getComponent(k).getFugacityCoefficient()); } if (iterations >= 2) { deriv = -(funk - funkOld) / (system.getTemperature() - oldTemperature); @@ -193,7 +192,7 @@ public void run() { logger.info("newTEmp " + newTemp); if (newTemp > (trpTemp + 5)) { system.setTemperature( - system.getPhases()[0].getComponents()[k].getTriplePointTemperature() + 0.4); + system.getPhases()[0].getComponent(k).getTriplePointTemperature() + 0.4); } else if (newTemp < 1) { system.setTemperature(oldTemperature + 2); // } else if(newTemp=="NaN") { system.setTemperature(oldTemperature*0.9374); @@ -243,7 +242,7 @@ public void printToFile(String name) { // print line to output file pr_writer.println(FCompNames[k] + "," + java.lang.Double.toString(FCompTemp[k]) + "," + system.getPressure() + "," - + java.lang.Double.toString(system.getPhases()[0].getComponents()[k].getz()) + "," + + java.lang.Double.toString(system.getPhases()[0].getComponent(k).getz()) + "," + Niterations); pr_writer.flush(); } diff --git a/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/FugTestConstP.java b/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/FugTestConstP.java index fd4c2c3f0c..0d578c6b50 100644 --- a/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/FugTestConstP.java +++ b/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/FugTestConstP.java @@ -93,9 +93,9 @@ public void run() { for (int k = 0; k < testSystem.getPhases()[0].getNumberOfComponents(); k++) { if (testSystem.getPhase(0).getComponent(k).doSolidCheck()) { this.compName = testSystem.getPhase(0).getComponent(k).getComponentName(); - trpTemp = testSystem.getPhases()[0].getComponents()[k].getTriplePointTemperature(); + trpTemp = testSystem.getPhases()[0].getComponent(k).getTriplePointTemperature(); this.initTestSystem2(k); - if (Math.abs(testSystem.getPhases()[0].getComponents()[k].getHsub()) < 0.000001) { + if (Math.abs(testSystem.getPhases()[0].getComponent(k).getHsub()) < 0.000001) { CCequation = false; } for (int i = 0; i < 20; i++) { @@ -172,7 +172,7 @@ public void PrintToFile(String FileName) { // try (PrintWriter pr_writer = new PrintWriter(new FileWriter(myFile, true))){ // // print line to output file // pr_writer.println( - // testSystem.getPhases()[0].getComponents()[k].getComponentName()+" " + + // testSystem.getPhases()[0].getComponent(k).getComponentName()+" " + // java.lang.Double.toString(Fug[0+k*6][i])+" // "+java.lang.Double.toString(Fug[1+k*6][i])+" // "+java.lang.Double.toString(Fug[3+k*6][i]) +" "+ diff --git a/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/HCdewPointPressureFlash.java b/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/HCdewPointPressureFlash.java index cff08d8038..30f338c6fd 100644 --- a/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/HCdewPointPressureFlash.java +++ b/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/HCdewPointPressureFlash.java @@ -52,20 +52,19 @@ public void run() { } for (int i = 0; i < system.getPhases()[1].getNumberOfComponents(); i++) { - system.getPhases()[0].getComponents()[i] - .setx(system.getPhases()[0].getComponents()[i].getz()); - if (system.getPhases()[0].getComponents()[i].getIonicCharge() != 0) { - system.getPhases()[0].getComponents()[i].setx(1e-40); + system.getPhases()[0].getComponent(i).setx(system.getPhases()[0].getComponent(i).getz()); + if (system.getPhases()[0].getComponent(i).getIonicCharge() != 0) { + system.getPhases()[0].getComponent(i).setx(1e-40); } else { - system.getPhases()[1].getComponents()[i] - .setx(1.0 / system.getPhases()[0].getComponents()[i].getK() - * system.getPhases()[1].getComponents()[i].getz()); + system.getPhases()[1].getComponent(i) + .setx(1.0 / system.getPhases()[0].getComponent(i).getK() + * system.getPhases()[1].getComponent(i).getz()); } } // system.setPressure(system.getPhases()[0].getAntoineVaporPressure(system.getTemperature())); xtotal = 0.0; for (int i = 0; i < system.getPhases()[1].getNumberOfComponents(); i++) { - xtotal += system.getPhases()[1].getComponents()[i].getx(); + xtotal += system.getPhases()[1].getComponent(i).getx(); } double ktot = 0.0; double xTotOld = 0.0; @@ -73,8 +72,8 @@ public void run() { do { iterations++; for (int i = 0; i < system.getPhases()[1].getNumberOfComponents(); i++) { - system.getPhases()[1].getComponents()[i] - .setx(system.getPhases()[1].getComponents()[i].getx() / xtotal); + system.getPhases()[1].getComponent(i) + .setx(system.getPhases()[1].getComponent(i).getx() / xtotal); } system.init(1); ktot = 0.0; @@ -82,27 +81,26 @@ public void run() { oldPres = system.getPressure(); for (int i = 0; i < system.getPhases()[1].getNumberOfComponents(); i++) { do { - xold = system.getPhases()[1].getComponents()[i].getx(); + xold = system.getPhases()[1].getComponent(i).getx(); if (system.getPhase(0).getComponent(i).getIonicCharge() != 0) { - system.getPhases()[0].getComponents()[i].setK(1e-40); + system.getPhases()[0].getComponent(i).setK(1e-40); } else { - system.getPhases()[0].getComponents()[i].setK( - Math.exp(Math.log(system.getPhases()[1].getComponents()[i].getFugacityCoefficient()) - - Math.log(system.getPhases()[0].getComponents()[i].getFugacityCoefficient()))); + system.getPhases()[0].getComponent(i).setK( + Math.exp(Math.log(system.getPhases()[1].getComponent(i).getFugacityCoefficient()) + - Math.log(system.getPhases()[0].getComponent(i).getFugacityCoefficient()))); } - system.getPhases()[1].getComponents()[i] - .setK(system.getPhases()[0].getComponents()[i].getK()); - system.getPhases()[1].getComponents()[i] - .setx(1.0 / system.getPhases()[0].getComponents()[i].getK() - * system.getPhases()[1].getComponents()[i].getz()); - } while (Math.abs(system.getPhases()[1].getComponents()[i].getx() - xold) > 1e-4); - ktot += Math.abs(system.getPhases()[1].getComponents()[i].getK() - 1.0); + system.getPhases()[1].getComponent(i).setK(system.getPhases()[0].getComponent(i).getK()); + system.getPhases()[1].getComponent(i) + .setx(1.0 / system.getPhases()[0].getComponent(i).getK() + * system.getPhases()[1].getComponent(i).getz()); + } while (Math.abs(system.getPhases()[1].getComponent(i).getx() - xold) > 1e-4); + ktot += Math.abs(system.getPhases()[1].getComponent(i).getK() - 1.0); } xoldold = xTotOld; xTotOld = xtotal; xtotal = 0.0; for (int i = 0; i < system.getPhases()[1].getNumberOfComponents(); i++) { - xtotal += system.getPhases()[1].getComponents()[i].getx(); + xtotal += system.getPhases()[1].getComponent(i).getx(); } double newPres = 0; @@ -121,7 +119,7 @@ public void run() { || Math.abs(oldPres - system.getPressure()) / oldPres > 1e-9) && (iterations < maxNumberOfIterations)); // logger.info("iter " + iterations + " XTOT " +xtotal + " k " - // +system.getPhases()[1].getComponents()[0].getK()); + // +system.getPhases()[1].getComponent(0).getK()); if (Math.abs(xtotal - 1.0) >= 1e-5 || ktot < 1e-3 && system.getPhase(0).getNumberOfComponents() > 1) { setSuperCritical(true); diff --git a/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/WaterDewPointTemperatureFlash.java b/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/WaterDewPointTemperatureFlash.java index f7b4ee1cd7..accc16d319 100644 --- a/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/WaterDewPointTemperatureFlash.java +++ b/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/WaterDewPointTemperatureFlash.java @@ -45,8 +45,7 @@ public void run() { for (int k = 0; k < system.getPhases()[0].getNumberOfComponents(); k++) { if (system.getPhase(0).getComponent(k).getComponentName().equals("water") || system.getPhase(0).getComponent(k).getComponentName().equals("MEG")) { - system - .setTemperature(system.getPhases()[0].getComponents()[k].getMeltingPointTemperature()); + system.setTemperature(system.getPhases()[0].getComponent(k).getMeltingPointTemperature()); for (int l = 0; l < system.getPhases()[0].getNumberOfComponents(); l++) { system.getPhase(1).getComponent(l).setx(1e-30); // logger.info("here"); @@ -60,20 +59,20 @@ public void run() { // deriv = 0.0; iterations++; system.init(3); - funk = system.getPhases()[0].getComponents()[k].getz(); + funk = system.getPhases()[0].getComponent(k).getz(); funk -= system.getPhases()[0].getBeta() - * system.getPhases()[1].getComponents()[k].getFugacityCoefficient() - / system.getPhases()[0].getComponents()[k].getFugacityCoefficient(); + * system.getPhases()[1].getComponent(k).getFugacityCoefficient() + / system.getPhases()[0].getComponent(k).getFugacityCoefficient(); // logger.info("funk " + funk); /* * deriv -= system.getPhases()[0].getBeta() - * (system.getPhases()[1].getComponents()[k].getFugacityCoefficient() - * system.getPhases()[0].getComponents()[k].getdfugdt() * -1.0 / - * Math.pow(system.getPhases()[0].getComponents()[k] .getFugacityCoefficient(), 2.0) + - * system.getPhases()[1].getComponents()[k].getdfugdt() / - * system.getPhases()[i].getComponents()[k] .getFugacityCoefficient()); + * (system.getPhases()[1].getComponent(k).getFugacityCoefficient() + * system.getPhases()[0].getComponent(k).getdfugdt() * -1.0 / + * Math.pow(system.getPhases()[0].getComponent(k) .getFugacityCoefficient(), 2.0) + + * system.getPhases()[1].getComponent(k).getdfugdt() / + * system.getPhases()[i].getComponent(k) .getFugacityCoefficient()); * * system.setTemperature(system.getTemperature() - funk/deriv); */ diff --git a/src/main/java/neqsim/thermodynamicoperations/phaseenvelopeops/multicomponentenvelopeops/CricondenBarFlash.java b/src/main/java/neqsim/thermodynamicoperations/phaseenvelopeops/multicomponentenvelopeops/CricondenBarFlash.java index 1a78b10a6d..575c2ca997 100644 --- a/src/main/java/neqsim/thermodynamicoperations/phaseenvelopeops/multicomponentenvelopeops/CricondenBarFlash.java +++ b/src/main/java/neqsim/thermodynamicoperations/phaseenvelopeops/multicomponentenvelopeops/CricondenBarFlash.java @@ -234,7 +234,7 @@ public void setNewK() { for (int j = 0; j < numberOfComponents; j++) { double kap = system.getPhase(0).getComponent(j).getFugacityCoefficient() / system.getPhase(1).getComponent(j).getFugacityCoefficient(); - system.getPhase(0).getComponents()[j].setK(kap); + system.getPhase(0).getComponent(j).setK(kap); u.set(j, 0, kap); } } @@ -251,27 +251,26 @@ public void setNewX() { double[] yy = new double[numberOfComponents]; for (int j = 0; j < numberOfComponents; j++) { - xx[j] = system.getPhase(0).getComponents()[j].getz() + xx[j] = system.getPhase(0).getComponent(j).getz() / (1.0 - system.getBeta() + system.getBeta() * u.get(j, 0)); - yy[j] = system.getPhase(1).getComponents()[j].getz() * u.get(j, 0) + yy[j] = system.getPhase(1).getComponent(j).getz() * u.get(j, 0) / (1.0 - system.getBeta() + system.getBeta() * u.get(j, 0)); - xx[j] = system.getPhase(0).getComponents()[j].getz() / (1.0 - system.getBeta() - + system.getBeta() * system.getPhase(0).getComponents()[j].getK()); - yy[j] = system.getPhase(1).getComponents()[j].getz() - * system.getPhase(0).getComponents()[j].getK() / (1.0 - system.getBeta() - + system.getBeta() * system.getPhase(0).getComponents()[j].getK()); + xx[j] = system.getPhase(0).getComponent(j).getz() + / (1.0 - system.getBeta() + system.getBeta() * system.getPhase(0).getComponent(j).getK()); + yy[j] = system.getPhase(1).getComponent(j).getz() * system.getPhase(0).getComponent(j).getK() + / (1.0 - system.getBeta() + system.getBeta() * system.getPhase(0).getComponent(j).getK()); sumx = sumx + xx[j]; sumy = sumy + yy[j]; } for (int j = 0; j < numberOfComponents; j++) { - system.getPhase(0).getComponents()[j].setx(xx[j] / sumx); - system.getPhase(1).getComponents()[j].setx(yy[j] / sumy); + system.getPhase(0).getComponent(j).setx(xx[j] / sumx); + system.getPhase(1).getComponent(j).setx(yy[j] / sumy); - xx[j] = system.getPhase(0).getComponents()[j].getx(); - yy[j] = system.getPhase(1).getComponents()[j].getx(); + xx[j] = system.getPhase(0).getComponent(j).getx(); + yy[j] = system.getPhase(1).getComponent(j).getx(); } } @@ -327,11 +326,11 @@ public void funcP() { double xx = system.getPhase(0).getComponent(j).getx(); double yy = system.getPhase(1).getComponent(j).getx(); - double fugl = system.getPhase(0).getComponents()[j].getLogFugacityCoefficient(); - double fugv = system.getPhase(1).getComponents()[j].getLogFugacityCoefficient(); + double fugl = system.getPhase(0).getComponent(j).getLogFugacityCoefficient(); + double fugv = system.getPhase(1).getComponent(j).getLogFugacityCoefficient(); - double fugPl = system.getPhase(0).getComponents()[j].getdfugdp(); - double fugPv = system.getPhase(1).getComponents()[j].getdfugdp(); + double fugPl = system.getPhase(0).getComponent(j).getdfugdp(); + double fugPv = system.getPhase(1).getComponent(j).getdfugdp(); funcP = funcP + xx + xx * (Math.log(yy) - Math.log(xx) + fugv - fugl); dfuncdP = dfuncdP + xx * (fugPv - fugPl); diff --git a/src/main/java/neqsim/thermodynamicoperations/phaseenvelopeops/multicomponentenvelopeops/CricondenThermFlash.java b/src/main/java/neqsim/thermodynamicoperations/phaseenvelopeops/multicomponentenvelopeops/CricondenThermFlash.java index 2a4a96de4a..c2f92e698a 100644 --- a/src/main/java/neqsim/thermodynamicoperations/phaseenvelopeops/multicomponentenvelopeops/CricondenThermFlash.java +++ b/src/main/java/neqsim/thermodynamicoperations/phaseenvelopeops/multicomponentenvelopeops/CricondenThermFlash.java @@ -231,7 +231,7 @@ public void setNewK() { for (int j = 0; j < numberOfComponents; j++) { double kap = system.getPhase(0).getComponent(j).getFugacityCoefficient() / system.getPhase(1).getComponent(j).getFugacityCoefficient(); - system.getPhase(0).getComponents()[j].setK(kap); + system.getPhase(0).getComponent(j).setK(kap); u.set(j, 0, kap); } } @@ -248,27 +248,26 @@ public void setNewX() { double[] yy = new double[numberOfComponents]; for (int j = 0; j < numberOfComponents; j++) { - xx[j] = system.getPhase(0).getComponents()[j].getz() + xx[j] = system.getPhase(0).getComponent(j).getz() / (1.0 - system.getBeta() + system.getBeta() * u.get(j, 0)); - yy[j] = system.getPhase(1).getComponents()[j].getz() * u.get(j, 0) + yy[j] = system.getPhase(1).getComponent(j).getz() * u.get(j, 0) / (1.0 - system.getBeta() + system.getBeta() * u.get(j, 0)); - xx[j] = system.getPhase(0).getComponents()[j].getz() / (1.0 - system.getBeta() - + system.getBeta() * system.getPhase(0).getComponents()[j].getK()); - yy[j] = system.getPhase(1).getComponents()[j].getz() - * system.getPhase(0).getComponents()[j].getK() / (1.0 - system.getBeta() - + system.getBeta() * system.getPhase(0).getComponents()[j].getK()); + xx[j] = system.getPhase(0).getComponent(j).getz() + / (1.0 - system.getBeta() + system.getBeta() * system.getPhase(0).getComponent(j).getK()); + yy[j] = system.getPhase(1).getComponent(j).getz() * system.getPhase(0).getComponent(j).getK() + / (1.0 - system.getBeta() + system.getBeta() * system.getPhase(0).getComponent(j).getK()); sumx = sumx + xx[j]; sumy = sumy + yy[j]; } for (int j = 0; j < numberOfComponents; j++) { - system.getPhase(0).getComponents()[j].setx(xx[j] / sumx); - system.getPhase(1).getComponents()[j].setx(yy[j] / sumy); + system.getPhase(0).getComponent(j).setx(xx[j] / sumx); + system.getPhase(1).getComponent(j).setx(yy[j] / sumy); - xx[j] = system.getPhase(0).getComponents()[j].getx(); - yy[j] = system.getPhase(1).getComponents()[j].getx(); + xx[j] = system.getPhase(0).getComponent(j).getx(); + yy[j] = system.getPhase(1).getComponent(j).getx(); } } @@ -324,11 +323,11 @@ public void funcP() { double xx = system.getPhase(0).getComponent(j).getx(); double yy = system.getPhase(1).getComponent(j).getx(); - double fugl = system.getPhase(0).getComponents()[j].getLogFugacityCoefficient(); - double fugv = system.getPhase(1).getComponents()[j].getLogFugacityCoefficient(); + double fugl = system.getPhase(0).getComponent(j).getLogFugacityCoefficient(); + double fugv = system.getPhase(1).getComponent(j).getLogFugacityCoefficient(); - double fugPl = system.getPhase(0).getComponents()[j].getdfugdp(); - double fugPv = system.getPhase(1).getComponents()[j].getdfugdp(); + double fugPl = system.getPhase(0).getComponent(j).getdfugdp(); + double fugPv = system.getPhase(1).getComponent(j).getdfugdp(); funcP = funcP + xx + xx * (Math.log(yy) - Math.log(xx) + fugv - fugl); dfuncdP = dfuncdP + xx * (fugPv - fugPl); diff --git a/src/main/java/neqsim/thermodynamicoperations/phaseenvelopeops/multicomponentenvelopeops/PTphaseEnvelope.java b/src/main/java/neqsim/thermodynamicoperations/phaseenvelopeops/multicomponentenvelopeops/PTphaseEnvelope.java index 79cae01a42..a34d24dfc0 100644 --- a/src/main/java/neqsim/thermodynamicoperations/phaseenvelopeops/multicomponentenvelopeops/PTphaseEnvelope.java +++ b/src/main/java/neqsim/thermodynamicoperations/phaseenvelopeops/multicomponentenvelopeops/PTphaseEnvelope.java @@ -156,12 +156,12 @@ public void run() { continue; } if (system.getPhase(0).getComponent(i).getIonicCharge() == 0) { - if (bubblePointFirst && system.getPhase(0).getComponents()[speceq] - .getTC() > system.getPhase(0).getComponents()[i].getTC()) { + if (bubblePointFirst && system.getPhase(0).getComponent(speceq).getTC() > system.getPhase(0) + .getComponent(i).getTC()) { speceq = system.getPhase(0).getComponent(i).getComponentNumber(); } - if (!bubblePointFirst && system.getPhase(0).getComponents()[speceq] - .getTC() < system.getPhase(0).getComponents()[i].getTC()) { + if (!bubblePointFirst && system.getPhase(0).getComponent(speceq).getTC() < system + .getPhase(0).getComponent(i).getTC()) { speceq = system.getPhase(0).getComponent(i).getComponentNumber(); } } @@ -770,12 +770,12 @@ public double tempKWilson(double beta, double P) { double max = 0.; for (int i = 0; i < numberOfComponents; i++) { - if (system.getPhase(0).getComponents()[i].getTC() > max) { - max = system.getPhase(0).getComponents()[i].getTC(); + if (system.getPhase(0).getComponent(i).getTC() > max) { + max = system.getPhase(0).getComponent(i).getTC(); hc = i; } - if (system.getPhase(0).getComponents()[i].getTC() < min) { - min = system.getPhase(0).getComponents()[i].getTC(); + if (system.getPhase(0).getComponent(i).getTC() < min) { + min = system.getPhase(0).getComponent(i).getTC(); lc = i; } } @@ -784,14 +784,14 @@ public double tempKWilson(double beta, double P) { if (beta <= 0.5) { // closer to bubble point get the lightest component - initTc = system.getPhase(0).getComponents()[lc].getTC(); - initPc = system.getPhase(0).getComponents()[lc].getPC(); - initAc = system.getPhase(0).getComponents()[lc].getAcentricFactor(); + initTc = system.getPhase(0).getComponent(lc).getTC(); + initPc = system.getPhase(0).getComponent(lc).getPC(); + initAc = system.getPhase(0).getComponent(lc).getAcentricFactor(); } else { // closer to dew point get the heaviest component - initTc = system.getPhase(0).getComponents()[hc].getTC(); - initPc = system.getPhase(0).getComponents()[hc].getPC(); - initAc = system.getPhase(0).getComponents()[hc].getAcentricFactor(); + initTc = system.getPhase(0).getComponent(hc).getTC(); + initPc = system.getPhase(0).getComponent(hc).getPC(); + initAc = system.getPhase(0).getComponent(hc).getAcentricFactor(); } // initial T based on the lightest/heaviest component @@ -802,23 +802,23 @@ public double tempKWilson(double beta, double P) { initT = 0.; dinitT = 0.; for (int j = 0; j < numberOfComponents; j++) { - Kwil[j] = system.getPhase(0).getComponents()[j].getPC() / P - * Math.exp(5.373 * (1. + system.getPhase(0).getComponents()[j].getAcentricFactor()) - * (1. - system.getPhase(0).getComponents()[j].getTC() / Tstart)); - // system.getPhases()[0].getComponents()[j].setK(Kwil[j]); + Kwil[j] = system.getPhase(0).getComponent(j).getPC() / P + * Math.exp(5.373 * (1. + system.getPhase(0).getComponent(j).getAcentricFactor()) + * (1. - system.getPhase(0).getComponent(j).getTC() / Tstart)); + // system.getPhases()[0].getComponent(j).setK(Kwil[j]); } for (int j = 0; j < numberOfComponents; j++) { if (beta < 0.5) { - initT = initT + system.getPhase(0).getComponents()[j].getz() * Kwil[j]; - dinitT = dinitT + system.getPhase(0).getComponents()[j].getz() * Kwil[j] * 5.373 - * (1 + system.getPhase(0).getComponents()[j].getAcentricFactor()) - * system.getPhase(0).getComponents()[j].getTC() / (Tstart * Tstart); + initT = initT + system.getPhase(0).getComponent(j).getz() * Kwil[j]; + dinitT = dinitT + system.getPhase(0).getComponent(j).getz() * Kwil[j] * 5.373 + * (1 + system.getPhase(0).getComponent(j).getAcentricFactor()) + * system.getPhase(0).getComponent(j).getTC() / (Tstart * Tstart); } else { - initT = initT + system.getPhase(0).getComponents()[j].getz() / Kwil[j]; - dinitT = dinitT - system.getPhase(0).getComponents()[j].getz() / Kwil[j] * 5.373 - * (1 + system.getPhase(0).getComponents()[j].getAcentricFactor()) - * system.getPhase(0).getComponents()[j].getTC() / (Tstart * Tstart); + initT = initT + system.getPhase(0).getComponent(j).getz() / Kwil[j]; + dinitT = dinitT - system.getPhase(0).getComponent(j).getz() / Kwil[j] * 5.373 + * (1 + system.getPhase(0).getComponent(j).getAcentricFactor()) + * system.getPhase(0).getComponent(j).getTC() / (Tstart * Tstart); } } diff --git a/src/main/java/neqsim/thermodynamicoperations/phaseenvelopeops/multicomponentenvelopeops/PTphaseEnvelope1.java b/src/main/java/neqsim/thermodynamicoperations/phaseenvelopeops/multicomponentenvelopeops/PTphaseEnvelope1.java index 7420d5363a..58497d4249 100644 --- a/src/main/java/neqsim/thermodynamicoperations/phaseenvelopeops/multicomponentenvelopeops/PTphaseEnvelope1.java +++ b/src/main/java/neqsim/thermodynamicoperations/phaseenvelopeops/multicomponentenvelopeops/PTphaseEnvelope1.java @@ -126,7 +126,7 @@ public void run() { system.init(0); for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { if (system.getPhase(0).getComponent(i).getIonicCharge() == 0) { - if (system.getPhase(0).getComponents()[i].getTC() < system.getPhase(0).getComponents()[i] + if (system.getPhase(0).getComponent(i).getTC() < system.getPhase(0).getComponent(i) .getTC()) { speceq = system.getPhase(0).getComponent(i).getComponentNumber(); } diff --git a/src/main/java/neqsim/thermodynamicoperations/phaseenvelopeops/multicomponentenvelopeops/PTphaseEnvelopeMay.java b/src/main/java/neqsim/thermodynamicoperations/phaseenvelopeops/multicomponentenvelopeops/PTphaseEnvelopeMay.java index 77b27afec7..f75437e500 100644 --- a/src/main/java/neqsim/thermodynamicoperations/phaseenvelopeops/multicomponentenvelopeops/PTphaseEnvelopeMay.java +++ b/src/main/java/neqsim/thermodynamicoperations/phaseenvelopeops/multicomponentenvelopeops/PTphaseEnvelopeMay.java @@ -130,12 +130,12 @@ public void run() { // based on the desired first point, dew/bubble for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { if (system.getPhase(0).getComponent(i).getIonicCharge() == 0) { - if (bubblePointFirst && system.getPhase(0).getComponents()[speceq] - .getTC() > system.getPhase(0).getComponents()[i].getTC()) { + if (bubblePointFirst && system.getPhase(0).getComponent(speceq).getTC() > system + .getPhase(0).getComponent(i).getTC()) { speceq = system.getPhase(0).getComponent(i).getComponentNumber(); } - if (!bubblePointFirst && system.getPhase(0).getComponents()[speceq] - .getTC() < system.getPhase(0).getComponents()[i].getTC()) { + if (!bubblePointFirst && system.getPhase(0).getComponent(speceq).getTC() < system + .getPhase(0).getComponent(i).getTC()) { speceq = system.getPhase(0).getComponent(i).getComponentNumber(); } } @@ -692,26 +692,26 @@ public double tempKWilson(double beta, double P) { double max = 0.; for (int i = 0; i < numberOfComponents; i++) { - if (system.getPhase(0).getComponents()[i].getTC() > max) { - max = system.getPhase(0).getComponents()[i].getTC(); + if (system.getPhase(0).getComponent(i).getTC() > max) { + max = system.getPhase(0).getComponent(i).getTC(); hc = i; } - if (system.getPhase(0).getComponents()[i].getTC() < min) { - min = system.getPhase(0).getComponents()[i].getTC(); + if (system.getPhase(0).getComponent(i).getTC() < min) { + min = system.getPhase(0).getComponent(i).getTC(); lc = i; } } if (beta <= 0.5) { - initTc = system.getPhase(0).getComponents()[lc].getTC(); + initTc = system.getPhase(0).getComponent(lc).getTC(); // closer to bubble point get the lightest component - initPc = system.getPhase(0).getComponents()[lc].getPC(); - initAc = system.getPhase(0).getComponents()[lc].getAcentricFactor(); + initPc = system.getPhase(0).getComponent(lc).getPC(); + initAc = system.getPhase(0).getComponent(lc).getAcentricFactor(); } else { - initTc = system.getPhase(0).getComponents()[hc].getTC(); + initTc = system.getPhase(0).getComponent(hc).getTC(); // closer to dew point get the heaviest component - initPc = system.getPhase(0).getComponents()[hc].getPC(); - initAc = system.getPhase(0).getComponents()[hc].getAcentricFactor(); + initPc = system.getPhase(0).getComponent(hc).getPC(); + initAc = system.getPhase(0).getComponent(hc).getAcentricFactor(); } Tstart = initTc * 5.373 * (1 + initAc) / (5.373 * (1 + initAc) - Math.log(P / initPc)); // initial T based on the lighterst/heaviest component @@ -721,23 +721,23 @@ public double tempKWilson(double beta, double P) { initT = 0.; dinitT = 0.; for (int j = 0; j < numberOfComponents; j++) { - Kwil[j] = system.getPhase(0).getComponents()[j].getPC() / P - * Math.exp(5.373 * (1. + system.getPhase(0).getComponents()[j].getAcentricFactor()) - * (1. - system.getPhase(0).getComponents()[j].getTC() / Tstart)); - system.getPhases()[0].getComponents()[j].setK(Math.log(Kwil[j])); + Kwil[j] = system.getPhase(0).getComponent(j).getPC() / P + * Math.exp(5.373 * (1. + system.getPhase(0).getComponent(j).getAcentricFactor()) + * (1. - system.getPhase(0).getComponent(j).getTC() / Tstart)); + system.getPhases()[0].getComponent(j).setK(Math.log(Kwil[j])); } for (int j = 0; j < numberOfComponents; j++) { if (beta < 0.5) { - initT = initT + system.getPhase(0).getComponents()[j].getz() * Kwil[j]; - dinitT = dinitT + system.getPhase(0).getComponents()[j].getz() * Kwil[j] * 5.373 - * (1 + system.getPhase(0).getComponents()[j].getAcentricFactor()) - * system.getPhase(0).getComponents()[j].getTC() / (Tstart * Tstart); + initT = initT + system.getPhase(0).getComponent(j).getz() * Kwil[j]; + dinitT = dinitT + system.getPhase(0).getComponent(j).getz() * Kwil[j] * 5.373 + * (1 + system.getPhase(0).getComponent(j).getAcentricFactor()) + * system.getPhase(0).getComponent(j).getTC() / (Tstart * Tstart); } else { - initT = initT + system.getPhase(0).getComponents()[j].getz() / Kwil[j]; - dinitT = dinitT - system.getPhase(0).getComponents()[j].getz() / Kwil[j] * 5.373 - * (1 + system.getPhase(0).getComponents()[j].getAcentricFactor()) - * system.getPhase(0).getComponents()[j].getTC() / (Tstart * Tstart); + initT = initT + system.getPhase(0).getComponent(j).getz() / Kwil[j]; + dinitT = dinitT - system.getPhase(0).getComponent(j).getz() / Kwil[j] * 5.373 + * (1 + system.getPhase(0).getComponent(j).getAcentricFactor()) + * system.getPhase(0).getComponent(j).getTC() / (Tstart * Tstart); } } diff --git a/src/main/java/neqsim/thermodynamicoperations/phaseenvelopeops/multicomponentenvelopeops/PTphaseEnvelopeNew2.java b/src/main/java/neqsim/thermodynamicoperations/phaseenvelopeops/multicomponentenvelopeops/PTphaseEnvelopeNew2.java index cf8fb81aaf..3f42474d0b 100644 --- a/src/main/java/neqsim/thermodynamicoperations/phaseenvelopeops/multicomponentenvelopeops/PTphaseEnvelopeNew2.java +++ b/src/main/java/neqsim/thermodynamicoperations/phaseenvelopeops/multicomponentenvelopeops/PTphaseEnvelopeNew2.java @@ -156,12 +156,12 @@ public void run() { continue; } if (system.getPhase(0).getComponent(i).getIonicCharge() == 0) { - if (bubblePointFirst && system.getPhase(0).getComponents()[speceq] - .getTC() > system.getPhase(0).getComponents()[i].getTC()) { + if (bubblePointFirst && system.getPhase(0).getComponent(speceq).getTC() > system + .getPhase(0).getComponent(i).getTC()) { speceq = system.getPhase(0).getComponent(i).getComponentNumber(); } - if (!bubblePointFirst && system.getPhase(0).getComponents()[speceq] - .getTC() < system.getPhase(0).getComponents()[i].getTC()) { + if (!bubblePointFirst && system.getPhase(0).getComponent(speceq).getTC() < system + .getPhase(0).getComponent(i).getTC()) { speceq = system.getPhase(0).getComponent(i).getComponentNumber(); } } @@ -519,12 +519,12 @@ public double tempKWilson(double beta, double P) { double max = 0.; for (int i = 0; i < numberOfComponents; i++) { - if (system.getPhase(0).getComponents()[i].getTC() > max) { - max = system.getPhase(0).getComponents()[i].getTC(); + if (system.getPhase(0).getComponent(i).getTC() > max) { + max = system.getPhase(0).getComponent(i).getTC(); hc = i; } - if (system.getPhase(0).getComponents()[i].getTC() < min) { - min = system.getPhase(0).getComponents()[i].getTC(); + if (system.getPhase(0).getComponent(i).getTC() < min) { + min = system.getPhase(0).getComponent(i).getTC(); lc = i; } } @@ -533,14 +533,14 @@ public double tempKWilson(double beta, double P) { if (beta <= 0.5) { // closer to bubble point get the lightest component - initTc = system.getPhase(0).getComponents()[lc].getTC(); - initPc = system.getPhase(0).getComponents()[lc].getPC(); - initAc = system.getPhase(0).getComponents()[lc].getAcentricFactor(); + initTc = system.getPhase(0).getComponent(lc).getTC(); + initPc = system.getPhase(0).getComponent(lc).getPC(); + initAc = system.getPhase(0).getComponent(lc).getAcentricFactor(); } else { // closer to dew point get the heaviest component - initTc = system.getPhase(0).getComponents()[hc].getTC(); - initPc = system.getPhase(0).getComponents()[hc].getPC(); - initAc = system.getPhase(0).getComponents()[hc].getAcentricFactor(); + initTc = system.getPhase(0).getComponent(hc).getTC(); + initPc = system.getPhase(0).getComponent(hc).getPC(); + initAc = system.getPhase(0).getComponent(hc).getAcentricFactor(); } // initial T based on the lightest/heaviest component @@ -551,23 +551,23 @@ public double tempKWilson(double beta, double P) { initT = 0.; dinitT = 0.; for (int j = 0; j < numberOfComponents; j++) { - Kwil[j] = system.getPhase(0).getComponents()[j].getPC() / P - * Math.exp(5.373 * (1. + system.getPhase(0).getComponents()[j].getAcentricFactor()) - * (1. - system.getPhase(0).getComponents()[j].getTC() / Tstart)); - // system.getPhases()[0].getComponents()[j].setK(Kwil[j]); + Kwil[j] = system.getPhase(0).getComponent(j).getPC() / P + * Math.exp(5.373 * (1. + system.getPhase(0).getComponent(j).getAcentricFactor()) + * (1. - system.getPhase(0).getComponent(j).getTC() / Tstart)); + // system.getPhases()[0].getComponent(j).setK(Kwil[j]); } for (int j = 0; j < numberOfComponents; j++) { if (beta < 0.5) { - initT = initT + system.getPhase(0).getComponents()[j].getz() * Kwil[j]; - dinitT = dinitT + system.getPhase(0).getComponents()[j].getz() * Kwil[j] * 5.373 - * (1 + system.getPhase(0).getComponents()[j].getAcentricFactor()) - * system.getPhase(0).getComponents()[j].getTC() / (Tstart * Tstart); + initT = initT + system.getPhase(0).getComponent(j).getz() * Kwil[j]; + dinitT = dinitT + system.getPhase(0).getComponent(j).getz() * Kwil[j] * 5.373 + * (1 + system.getPhase(0).getComponent(j).getAcentricFactor()) + * system.getPhase(0).getComponent(j).getTC() / (Tstart * Tstart); } else { - initT = initT + system.getPhase(0).getComponents()[j].getz() / Kwil[j]; - dinitT = dinitT - system.getPhase(0).getComponents()[j].getz() / Kwil[j] * 5.373 - * (1 + system.getPhase(0).getComponents()[j].getAcentricFactor()) - * system.getPhase(0).getComponents()[j].getTC() / (Tstart * Tstart); + initT = initT + system.getPhase(0).getComponent(j).getz() / Kwil[j]; + dinitT = dinitT - system.getPhase(0).getComponent(j).getz() / Kwil[j] * 5.373 + * (1 + system.getPhase(0).getComponent(j).getAcentricFactor()) + * system.getPhase(0).getComponent(j).getTC() / (Tstart * Tstart); } } diff --git a/src/main/java/neqsim/thermodynamicoperations/phaseenvelopeops/multicomponentenvelopeops/SysNewtonRhapsonPhaseEnvelope.java b/src/main/java/neqsim/thermodynamicoperations/phaseenvelopeops/multicomponentenvelopeops/SysNewtonRhapsonPhaseEnvelope.java index 189d761a20..f9cf0d8c94 100644 --- a/src/main/java/neqsim/thermodynamicoperations/phaseenvelopeops/multicomponentenvelopeops/SysNewtonRhapsonPhaseEnvelope.java +++ b/src/main/java/neqsim/thermodynamicoperations/phaseenvelopeops/multicomponentenvelopeops/SysNewtonRhapsonPhaseEnvelope.java @@ -109,15 +109,14 @@ public SysNewtonRhapsonPhaseEnvelope(SystemInterface system, int numberOfPhases, public void setfvec22() { for (int i = 0; i < numberOfComponents; i++) { fvec.set(i, 0, - Math.log(system.getPhase(0).getComponents()[i].getFugacityCoefficient() - * system.getPhase(0).getComponents()[i].getx()) - - Math.log(system.getPhase(1).getComponents()[i].getFugacityCoefficient() - * system.getPhase(1).getComponents()[i].getx())); + Math.log(system.getPhase(0).getComponent(i).getFugacityCoefficient() + * system.getPhase(0).getComponent(i).getx()) + - Math.log(system.getPhase(1).getComponent(i).getFugacityCoefficient() + * system.getPhase(1).getComponent(i).getx())); } double fsum = 0.0; for (int i = 0; i < numberOfComponents; i++) { - fsum += system.getPhase(0).getComponents()[i].getx() - - system.getPhase(1).getComponents()[i].getx(); + fsum += system.getPhase(0).getComponent(i).getx() - system.getPhase(1).getComponent(i).getx(); } fvec.set(numberOfComponents, 0, fsum); fvec.set(numberOfComponents, 0, sumy - sumx); @@ -131,8 +130,8 @@ public void setfvec22() { */ public void setfvec() { for (int i = 0; i < numberOfComponents; i++) { - fvec.set(i, 0, u.get(i, 0) + system.getPhase(0).getComponents()[i].getLogFugacityCoefficient() - - system.getPhase(1).getComponents()[i].getLogFugacityCoefficient()); + fvec.set(i, 0, u.get(i, 0) + system.getPhase(0).getComponent(i).getLogFugacityCoefficient() + - system.getPhase(1).getComponent(i).getLogFugacityCoefficient()); } fvec.set(numberOfComponents, 0, sumy - sumx); fvec.set(numberOfComponents + 1, 0, u.get(speceq, 0) - specVal); @@ -155,15 +154,15 @@ public void findSpecEqInit() { if (system.getComponent(i).getz() < 1e-10) { continue; } - if (system.getPhase(0).getComponents()[i].getTC() > system.getPhase(0).getComponents()[speceq] + if (system.getPhase(0).getComponent(i).getTC() > system.getPhase(0).getComponent(speceq) .getTC()) { - speceq = system.getPhase(0).getComponents()[i].getComponentNumber(); + speceq = system.getPhase(0).getComponent(i).getComponentNumber(); specVal = u.get(i, 0); hc = i; } - if (system.getPhase(0).getComponents()[i] - .getTC() < system.getPhase(0).getComponents()[speceqmin].getTC()) { - speceqmin = system.getPhase(0).getComponents()[i].getComponentNumber(); + if (system.getPhase(0).getComponent(i).getTC() < system.getPhase(0).getComponent(speceqmin) + .getTC()) { + speceqmin = system.getPhase(0).getComponent(i).getComponentNumber(); lc = i; } } @@ -234,13 +233,13 @@ public final void calc_x_y() { for (int j = 0; j < system.getNumberOfPhases(); j++) { for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { if (j == 0) { - sumy += system.getPhase(j).getComponents()[i].getK() - * system.getPhase(j).getComponents()[i].getz() / (1.0 - system.getBeta(0) - + system.getBeta(0) * system.getPhase(0).getComponents()[i].getK()); + sumy += system.getPhase(j).getComponent(i).getK() + * system.getPhase(j).getComponent(i).getz() / (1.0 - system.getBeta(0) + + system.getBeta(0) * system.getPhase(0).getComponent(i).getK()); } if (j == 1) { - sumx += system.getPhase(0).getComponents()[i].getz() / (1.0 - system.getBeta(0) - + system.getBeta(0) * system.getPhase(0).getComponents()[i].getK()); + sumx += system.getPhase(0).getComponent(i).getz() / (1.0 - system.getBeta(0) + + system.getBeta(0) * system.getPhase(0).getComponent(i).getK()); } } } @@ -258,29 +257,28 @@ public void setJac2() { double[] dyidlnk = new double[numberOfComponents]; double tempJ = 0.0; for (int i = 0; i < numberOfComponents; i++) { - dxidlnk[i] = -system.getBeta() * system.getPhase(1).getComponents()[i].getx() - * system.getPhase(0).getComponents()[i].getx() - / system.getPhase(0).getComponents()[i].getz(); - dyidlnk[i] = system.getPhase(0).getComponents()[i].getx() - + system.getPhase(1).getComponents()[i].getK() * dxidlnk[i]; + dxidlnk[i] = -system.getBeta() * system.getPhase(1).getComponent(i).getx() + * system.getPhase(0).getComponent(i).getx() / system.getPhase(0).getComponent(i).getz(); + dyidlnk[i] = system.getPhase(0).getComponent(i).getx() + + system.getPhase(1).getComponent(i).getK() * dxidlnk[i]; } for (int i = 0; i < numberOfComponents; i++) { - double dlnxdlnK = - -1.0 / (1.0 + system.getBeta() * system.getPhase(0).getComponents()[i].getK() - - system.getBeta()) * system.getBeta() * system.getPhase(0).getComponents()[i].getK(); + double dlnxdlnK = -1.0 + / (1.0 + system.getBeta() * system.getPhase(0).getComponent(i).getK() - system.getBeta()) + * system.getBeta() * system.getPhase(0).getComponent(i).getK(); double dlnydlnK = 1.0 - 1.0 - / (system.getPhase(0).getComponents()[i].getK() * system.getBeta() + 1 - system.getBeta()) - * system.getBeta() * system.getPhase(0).getComponents()[i].getK(); + / (system.getPhase(0).getComponent(i).getK() * system.getBeta() + 1 - system.getBeta()) + * system.getBeta() * system.getPhase(0).getComponent(i).getK(); for (int j = 0; j < numberOfComponents; j++) { dij = i == j ? 1.0 : 0.0; // Kroneckers deltaget tempJ = -dij + dij * dlnydlnK - dij * dlnxdlnK; Jac.set(i, j, tempJ); } - tempJ = system.getTemperature() * (system.getPhase(0).getComponents()[i].getdfugdt() - - system.getPhase(1).getComponents()[i].getdfugdt()); + tempJ = system.getTemperature() * (system.getPhase(0).getComponent(i).getdfugdt() + - system.getPhase(1).getComponent(i).getdfugdt()); Jac.set(i, numberOfComponents, tempJ); - tempJ = system.getPressure() * (system.getPhase(0).getComponents()[i].getdfugdp() - - system.getPhase(1).getComponents()[i].getdfugdp()); + tempJ = system.getPressure() * (system.getPhase(0).getComponent(i).getdfugdp() + - system.getPhase(1).getComponent(i).getdfugdp()); Jac.set(i, numberOfComponents + 1, tempJ); Jac.set(numberOfComponents, i, dyidlnk[i] - dxidlnk[i]); } @@ -299,32 +297,31 @@ public void setJac() { double[] dyidlnk = new double[numberOfComponents]; double tempJ = 0.0; for (int i = 0; i < numberOfComponents; i++) { - dxidlnk[i] = -system.getPhase(1).getComponents()[i].getz() - * Math.pow(system.getPhase(0).getComponents()[i].getK() * system.getBeta() + 1.0 - - system.getBeta(), -2.0) - * system.getBeta() * system.getPhase(1).getComponents()[i].getK(); - dyidlnk[i] = system.getPhase(1).getComponents()[i].getz() - / (system.getPhase(0).getComponents()[i].getK() * system.getBeta() + 1.0 - - system.getBeta()) - * system.getPhase(1).getComponents()[i].getK() - - system.getPhase(0).getComponents()[i].getK() - * system.getPhase(1).getComponents()[i].getz() + dxidlnk[i] = + -system.getPhase(1).getComponent(i).getz() + * Math.pow(system.getPhase(0).getComponent(i).getK() * system.getBeta() + 1.0 + - system.getBeta(), -2.0) + * system.getBeta() * system.getPhase(1).getComponent(i).getK(); + dyidlnk[i] = system.getPhase(1).getComponent(i).getz() + / (system.getPhase(0).getComponent(i).getK() * system.getBeta() + 1.0 - system.getBeta()) + * system.getPhase(1).getComponent(i).getK() + - system.getPhase(0).getComponent(i).getK() * system.getPhase(1).getComponent(i).getz() / Math.pow(1.0 - system.getBeta() - + system.getBeta() * system.getPhase(0).getComponents()[i].getK(), 2.0) - * system.getBeta() * system.getPhase(0).getComponents()[i].getK(); + + system.getBeta() * system.getPhase(0).getComponent(i).getK(), 2.0) + * system.getBeta() * system.getPhase(0).getComponent(i).getK(); } for (int i = 0; i < numberOfComponents; i++) { for (int j = 0; j < numberOfComponents; j++) { dij = i == j ? 1.0 : 0.0; // Kroneckers delta - tempJ = dij + system.getPhase(0).getComponents()[i].getdfugdx(j) * dyidlnk[j] - - system.getPhase(1).getComponents()[i].getdfugdx(j) * dxidlnk[j]; + tempJ = dij + system.getPhase(0).getComponent(i).getdfugdx(j) * dyidlnk[j] + - system.getPhase(1).getComponent(i).getdfugdx(j) * dxidlnk[j]; Jac.set(i, j, tempJ); } - tempJ = system.getTemperature() * (system.getPhase(0).getComponents()[i].getdfugdt() - - system.getPhase(1).getComponents()[i].getdfugdt()); + tempJ = system.getTemperature() * (system.getPhase(0).getComponent(i).getdfugdt() + - system.getPhase(1).getComponent(i).getdfugdt()); Jac.set(i, numberOfComponents, tempJ); - tempJ = system.getPressure() * (system.getPhase(0).getComponents()[i].getdfugdp() - - system.getPhase(1).getComponents()[i].getdfugdp()); + tempJ = system.getPressure() * (system.getPhase(0).getComponent(i).getdfugdp() + - system.getPhase(1).getComponent(i).getdfugdp()); Jac.set(i, numberOfComponents + 1, tempJ); Jac.set(numberOfComponents, i, dyidlnk[i] - dxidlnk[i]); Jac.set(numberOfComponents + 1, i, 0.0); @@ -339,7 +336,7 @@ public void setJac() { */ public void setu() { for (int i = 0; i < numberOfComponents; i++) { - u.set(i, 0, Math.log(system.getPhase(0).getComponents()[i].getK())); + u.set(i, 0, Math.log(system.getPhase(0).getComponent(i).getK())); } u.set(numberOfComponents, 0, Math.log(system.getTemperature())); u.set(numberOfComponents + 1, 0, Math.log(system.getPressure())); @@ -352,8 +349,8 @@ public void setu() { */ public void init() { for (int i = 0; i < numberOfComponents; i++) { - system.getPhase(0).getComponents()[i].setK(Math.exp(u.get(i, 0))); - system.getPhase(1).getComponents()[i].setK(Math.exp(u.get(i, 0))); + system.getPhase(0).getComponent(i).setK(Math.exp(u.get(i, 0))); + system.getPhase(1).getComponent(i).setK(Math.exp(u.get(i, 0))); } system.setTemperature(Math.exp(u.get(numberOfComponents, 0))); system.setPressure(Math.exp(u.get(numberOfComponents + 1, 0))); diff --git a/src/main/java/neqsim/thermodynamicoperations/phaseenvelopeops/multicomponentenvelopeops/SysNewtonRhapsonPhaseEnvelope2.java b/src/main/java/neqsim/thermodynamicoperations/phaseenvelopeops/multicomponentenvelopeops/SysNewtonRhapsonPhaseEnvelope2.java index 51c8a25b3b..7ae497c7ec 100644 --- a/src/main/java/neqsim/thermodynamicoperations/phaseenvelopeops/multicomponentenvelopeops/SysNewtonRhapsonPhaseEnvelope2.java +++ b/src/main/java/neqsim/thermodynamicoperations/phaseenvelopeops/multicomponentenvelopeops/SysNewtonRhapsonPhaseEnvelope2.java @@ -88,13 +88,12 @@ public SysNewtonRhapsonPhaseEnvelope2(SystemInterface system) { public void setfvec() { for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { fvec.setEntry(i, 0, - u.getEntry(i, 0) + Math.log(system.getPhase(0).getComponents()[i].getFugacityCoefficient() - / system.getPhase(1).getComponents()[i].getFugacityCoefficient())); + u.getEntry(i, 0) + Math.log(system.getPhase(0).getComponent(i).getFugacityCoefficient() + / system.getPhase(1).getComponent(i).getFugacityCoefficient())); } double fsum = 0.0; for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { - fsum += system.getPhase(0).getComponents()[i].getx() - - system.getPhase(1).getComponents()[i].getx(); + fsum += system.getPhase(0).getComponent(i).getx() - system.getPhase(1).getComponent(i).getx(); } fvec.setEntry(system.getPhase(0).getNumberOfComponents(), 0, fsum); fvec.setEntry(system.getPhase(0).getNumberOfComponents() + 1, 0, 0); @@ -110,18 +109,18 @@ public void findSpecEqInit() { int speceqmin = 0; for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { - if (system.getPhase(0).getComponents()[i].getTC() > system.getPhase(0).getComponents()[speceq] + if (system.getPhase(0).getComponent(i).getTC() > system.getPhase(0).getComponent(speceq) .getTC()) { - speceq = system.getPhase(0).getComponents()[i].getComponentNumber(); + speceq = system.getPhase(0).getComponent(i).getComponentNumber(); } - if (system.getPhase(0).getComponents()[i] - .getTC() < system.getPhase(0).getComponents()[speceqmin].getTC()) { - speceqmin = system.getPhase(0).getComponents()[i].getComponentNumber(); + if (system.getPhase(0).getComponent(i).getTC() < system.getPhase(0).getComponent(speceqmin) + .getTC()) { + speceqmin = system.getPhase(0).getComponent(i).getComponentNumber(); } } avscp = 0.3; - // (system.getPhase(0).getComponents()[speceq].getTC() - - // system.getPhase(0).getComponents()[speceqmin].getTC()) / 300.0; + // (system.getPhase(0).getComponent(speceq).getTC() - + // system.getPhase(0).getComponent(speceqmin).getTC()) / 300.0; logger.info("avscp: " + avscp); dTmax = 10.0; // avscp*10; dPmax = 10.0; // avscp*10; @@ -158,26 +157,25 @@ public void setJac() { double tempJ = 0.0; int nofc = system.getPhase(0).getNumberOfComponents(); for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { - dxidlnk[i] = -system.getBeta() * system.getPhase(1).getComponents()[i].getx() - * system.getPhase(0).getComponents()[i].getx() - / system.getPhase(0).getComponents()[i].getz(); - dyidlnk[i] = system.getPhase(0).getComponents()[i].getx() - + system.getPhase(1).getComponents()[i].getK() * dxidlnk[i]; + dxidlnk[i] = -system.getBeta() * system.getPhase(1).getComponent(i).getx() + * system.getPhase(0).getComponent(i).getx() / system.getPhase(0).getComponent(i).getz(); + dyidlnk[i] = system.getPhase(0).getComponent(i).getx() + + system.getPhase(1).getComponent(i).getK() * dxidlnk[i]; // logger.info("dxidlnk("+i+") "+dxidlnk[i]); // logger.info("dyidlnk("+i+") "+dyidlnk[i]); } for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { for (int j = 0; j < system.getPhase(0).getNumberOfComponents(); j++) { dij = i == j ? 1.0 : 0.0; // Kroneckers delta - tempJ = dij + system.getPhase(0).getComponents()[i].getdfugdx(j) * dyidlnk[j] - - system.getPhase(1).getComponents()[i].getdfugdx(j) * dxidlnk[j]; + tempJ = dij + system.getPhase(0).getComponent(i).getdfugdx(j) * dyidlnk[j] + - system.getPhase(1).getComponent(i).getdfugdx(j) * dxidlnk[j]; Jac.setEntry(i, j, tempJ); } - tempJ = system.getTemperature() * (system.getPhase(0).getComponents()[i].getdfugdt() - - system.getPhase(1).getComponents()[i].getdfugdt()); + tempJ = system.getTemperature() * (system.getPhase(0).getComponent(i).getdfugdt() + - system.getPhase(1).getComponent(i).getdfugdt()); Jac.setEntry(i, nofc, tempJ); - tempJ = system.getPressure() * (system.getPhase(0).getComponents()[i].getdfugdp() - - system.getPhase(1).getComponents()[i].getdfugdp()); + tempJ = system.getPressure() * (system.getPhase(0).getComponent(i).getdfugdp() + - system.getPhase(1).getComponent(i).getdfugdp()); Jac.setEntry(i, nofc + 1, tempJ); Jac.setEntry(nofc, i, dyidlnk[i] - dxidlnk[i]); } @@ -191,7 +189,7 @@ public void setJac() { */ public void setu() { for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { - u.setEntry(i, 0, Math.log(system.getPhase(0).getComponents()[i].getK())); + u.setEntry(i, 0, Math.log(system.getPhase(0).getComponent(i).getK())); } u.setEntry(system.getPhase(0).getNumberOfComponents(), 0, Math.log(system.getTemperature())); u.setEntry(system.getPhase(0).getNumberOfComponents() + 1, 0, Math.log(system.getPressure())); @@ -204,8 +202,8 @@ public void setu() { */ public void init() { for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { - system.getPhase(0).getComponents()[i].setK(Math.exp(u.getEntry(i, 0))); - system.getPhase(1).getComponents()[i].setK(Math.exp(u.getEntry(i, 0))); + system.getPhase(0).getComponent(i).setK(Math.exp(u.getEntry(i, 0))); + system.getPhase(1).getComponent(i).setK(Math.exp(u.getEntry(i, 0))); } system.setTemperature(Math.exp(u.getEntry(system.getPhase(0).getNumberOfComponents(), 0))); system.setPressure(Math.exp(u.getEntry(system.getPhase(0).getNumberOfComponents() + 1, 0))); diff --git a/src/main/java/neqsim/thermodynamicoperations/phaseenvelopeops/reactivecurves/PloadingCurve.java b/src/main/java/neqsim/thermodynamicoperations/phaseenvelopeops/reactivecurves/PloadingCurve.java index 2ca085a84a..3e923d4804 100644 --- a/src/main/java/neqsim/thermodynamicoperations/phaseenvelopeops/reactivecurves/PloadingCurve.java +++ b/src/main/java/neqsim/thermodynamicoperations/phaseenvelopeops/reactivecurves/PloadingCurve.java @@ -113,11 +113,11 @@ public void run() { system.getChemicalReactionOperations().solveChemEq(1); points[0][i] = (inscr * (i - 1)) / molMDEA; - points[1][i] = (system.getPhases()[1].getComponents()[0].getFugacityCoefficient() - * system.getPhases()[1].getComponents()[0].getx() * system.getPressure()); + points[1][i] = (system.getPhases()[1].getComponent(0).getFugacityCoefficient() + * system.getPhases()[1].getComponent(0).getx() * system.getPressure()); for (int k = 0; k < system.getPhases()[1].getNumberOfComponents(); k++) { - points[k + 2][i] = system.getPhases()[1].getComponents()[k].getx(); + points[k + 2][i] = system.getPhases()[1].getComponent(k).getx(); points[k + 2 + system.getPhases()[1].getNumberOfComponents()][i] = system.getPhases()[1].getActivityCoefficient(k, 1); } diff --git a/src/main/java/neqsim/thermodynamicoperations/phaseenvelopeops/reactivecurves/PloadingCurve2.java b/src/main/java/neqsim/thermodynamicoperations/phaseenvelopeops/reactivecurves/PloadingCurve2.java index ea8342cabc..de40c8e8b9 100644 --- a/src/main/java/neqsim/thermodynamicoperations/phaseenvelopeops/reactivecurves/PloadingCurve2.java +++ b/src/main/java/neqsim/thermodynamicoperations/phaseenvelopeops/reactivecurves/PloadingCurve2.java @@ -119,7 +119,7 @@ public void run() { points[2][i] = (system.getPressure() * system.getPhase(0).getComponent(0).getx()); for (int k = 0; k < system.getPhases()[1].getNumberOfComponents(); k++) { - points[k + 3][i] = system.getPhases()[1].getComponents()[k].getx(); + points[k + 3][i] = system.getPhases()[1].getComponent(k).getx(); points[k + 3 + system.getPhases()[1].getNumberOfComponents()][i] = system.getPhase(1).getActivityCoefficient(k, 1); // ,1); } @@ -169,9 +169,9 @@ public double[][] getPoints(int i) { * file.setYvalues(points[1], "total pressure", ""); file.setYvalues(points[2], " CO2 pressure", * ""); for (int k = 0; k < system.getPhases()[1].getNumberOfComponents(); k++) { * file.setYvalues(points[k + 3], "mol frac " + - * system.getPhases()[1].getComponents()[k].getComponentName(), ""); file.setYvalues(points[k + 3 - * + system.getPhases()[1].getNumberOfComponents()], ("activity " + - * system.getPhases()[1].getComponents()[k].getComponentName()), ""); } file.createFile(); } + * system.getPhases()[1].getComponent(k).getComponentName(), ""); file.setYvalues(points[k + 3 + + * system.getPhases()[1].getNumberOfComponents()], ("activity " + + * system.getPhases()[1].getComponent(k).getComponentName()), ""); } file.createFile(); } */ /** {@inheritDoc} */