From ec36cf4134ad68158aa9ada70d13fe6dc85513c9 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 15:15:53 +0100
Subject: [PATCH] refact: getPhases()[k] -> getPhase(k)
---
.../ChemicalReactionOperations.java | 2 +-
.../ChemicalEquilibrium.java | 8 +-
.../LinearProgrammingChemicalEquilibrium.java | 2 +-
.../chemicalreaction/ChemicalReaction.java | 4 +-
.../ChemicalReactionList.java | 8 +-
.../fluidmechanics/flownode/FlowNode.java | 82 ++--
.../heatmasstransfercalc/FluidBoundary.java | 36 +-
.../EquilibriumFluidBoundary.java | 2 +-
.../FluidBoundarySolver.java | 81 ++--
.../NonEquilibriumFluidBoundary.java | 382 +++++++++---------
.../KrishnaStandartFilmModel.java | 22 +-
.../ReactiveFluidBoundary.java | 364 ++++++++---------
.../enhancementfactor/EnhancementFactor.java | 8 +-
.../InterphasePipeFlow.java | 5 +-
.../InterphaseStirredCellFlow.java | 11 +-
.../multiphasenode/MultiPhaseFlowNode.java | 74 ++--
.../waxnode/WaxDepositionFlowNode.java | 6 +-
.../onephasenode/onePhaseFlowNode.java | 34 +-
.../onePhasePipeFlowNode.java | 2 +-
.../twophasenode/TwoPhaseFlowNode.java | 88 ++--
.../twophasepipeflownode/AnnularFlow.java | 6 +-
.../twophasepipeflownode/BubbleFlowNode.java | 6 +-
.../twophasepipeflownode/DropletFlowNode.java | 6 +-
.../StratifiedFlowNode.java | 6 +-
.../TwoPhasePackedBedFlowNode.java | 20 +-
.../TwoPhaseTrayTowerFlowNode.java | 10 +-
.../StirredCellNode.java | 20 +-
.../OnePhaseFixedStaggeredGrid.java | 141 ++++---
.../OnePhasePipeFlowSolver.java | 5 +-
.../stirredcellsolver/StirredCellSolver.java | 62 ++-
.../TwoPhaseFixedStaggeredGridSolver.java | 82 ++--
.../TwoPhasePipeFlowSolver.java | 4 +-
.../fluidmechanics/flowsystem/FlowSystem.java | 6 +-
.../FlowNodeVisualization.java | 10 +-
.../OnePhasePipeFlowNodeVisualization.java | 6 +-
.../TwoPhaseFlowNodeVisualization.java | 25 +-
.../nonlinearsolver/SysNewtonRhapson.java | 47 ++-
.../FirozabadiRamleyInterfaceTension.java | 14 +-
.../ParachorSurfaceTension.java | 19 +-
.../ParachorFunction.java | 4 +-
.../chungmethod/ChungFunction.java | 6 +-
.../linearliquidmodel/ViscosityFunction.java | 6 +-
.../equipment/absorber/SimpleTEGAbsorber.java | 107 +++--
.../absorber/WaterStripperColumn.java | 107 +++--
.../equipment/compressor/Compressor.java | 245 ++++++-----
.../equipment/expander/ExpanderOld.java | 86 ++--
.../equipment/heatexchanger/Heater.java | 12 +-
.../neqsim/process/equipment/mixer/Mixer.java | 87 ++--
.../process/equipment/mixer/StaticMixer.java | 20 +-
.../equipment/mixer/StaticNeqMixer.java | 18 +-
.../equipment/mixer/StaticPhaseMixer.java | 16 +-
.../neqsim/process/equipment/pump/Pump.java | 86 ++--
.../equipment/separator/Hydrocyclone.java | 2 +-
.../equipment/separator/NeqGasScrubber.java | 8 +-
.../equipment/separator/Separator.java | 4 +-
.../separator/ThreePhaseSeparator.java | 2 +-
.../separator/TwoPhaseSeparator.java | 8 +-
.../neqsim/process/equipment/tank/Tank.java | 4 +-
src/main/java/neqsim/standards/Standard.java | 10 +-
.../standards/gasquality/Draft_GERG2004.java | 28 +-
.../gasquality/Standard_ISO6976.java | 96 +++--
.../WettedWallColumnSampleCreator.java | 6 +-
.../neqsim/thermo/ThermodynamicModelTest.java | 106 ++---
.../thermo/mixingrule/EosMixingRules.java | 2 +-
.../neqsim/thermo/system/SystemThermo.java | 262 ++++++------
.../ThermodynamicOperations.java | 2 +-
.../flashops/Flash.java | 89 ++--
.../flashops/PHflash.java | 2 +-
.../flashops/PHflashSingleComp.java | 2 +-
.../flashops/PSFlash.java | 2 +-
.../flashops/QfuncFlash.java | 15 +-
.../flashops/SolidFlash.java | 21 +-
.../flashops/SolidFlash1.java | 55 ++-
.../flashops/SolidFlash12.java | 37 +-
.../flashops/SysNewtonRhapsonPHflash.java | 8 +-
.../flashops/SysNewtonRhapsonTPflashNew.java | 52 +--
.../flashops/TPflash.java | 22 +-
.../flashops/TPgradientFlash.java | 22 +-
.../flashops/TPmultiflash.java | 128 +++---
.../flashops/TPmultiflashWAX.java | 6 +-
.../flashops/TPmultiflash_1.java | 108 ++---
.../BubblePointPressureFlash.java | 69 ++--
.../BubblePointPressureFlashDer.java | 83 ++--
.../BubblePointTemperatureFlash.java | 46 +--
.../BubblePointTemperatureNoDer.java | 61 ++-
.../saturationops/ConstantDutyFlash.java | 46 +--
.../ConstantDutyPressureFlash.java | 33 +-
.../ConstantDutyTemperatureFlash.java | 43 +-
.../saturationops/CricondebarFlash.java | 40 +-
.../saturationops/CricondenBarTemp.java | 33 +-
.../saturationops/CricondenBarTemp1.java | 29 +-
.../saturationops/DewPointPressureFlash.java | 53 ++-
.../DewPointTemperatureFlash.java | 65 ++-
.../DewPointTemperatureFlashDer.java | 76 ++--
.../flashops/saturationops/FreezeOut.java | 10 +-
.../FreezingPointTemperatureFlash.java | 14 +-
.../FreezingPointTemperatureFlashOld.java | 24 +-
.../FreezingPointTemperatureFlashTR.java | 29 +-
.../flashops/saturationops/FugTestConstP.java | 8 +-
.../HCdewPointPressureFlash.java | 53 ++-
.../SolidComplexTemperatureCalc.java | 14 +-
.../flashops/saturationops/WATcalc.java | 6 +-
.../WaterDewPointTemperatureFlash.java | 26 +-
.../PTphaseEnvelope.java | 2 +-
.../PTphaseEnvelopeMay.java | 2 +-
.../PTphaseEnvelopeNew2.java | 2 +-
.../reactivecurves/PloadingCurve.java | 30 +-
.../reactivecurves/PloadingCurve2.java | 32 +-
.../separator/ThreePhaseSeparatorTest.java | 69 ++--
.../processmodel/GlycolModulesTest.java | 56 +--
110 files changed, 2316 insertions(+), 2363 deletions(-)
diff --git a/src/main/java/neqsim/chemicalreactions/ChemicalReactionOperations.java b/src/main/java/neqsim/chemicalreactions/ChemicalReactionOperations.java
index be76c0176..faebb1a9f 100644
--- a/src/main/java/neqsim/chemicalreactions/ChemicalReactionOperations.java
+++ b/src/main/java/neqsim/chemicalreactions/ChemicalReactionOperations.java
@@ -178,7 +178,7 @@ public void setReactiveComponents() {
if (name.equals(allComponentNames[i])) {
components[k++] = system.getPhase(phase).getComponent(j);
// System.out.println("reactive comp " +
- // system.getPhases()[1].getComponent(j).getName());
+ // system.getPhase(1).getComponent(j).getName());
}
}
}
diff --git a/src/main/java/neqsim/chemicalreactions/chemicalequilibrium/ChemicalEquilibrium.java b/src/main/java/neqsim/chemicalreactions/chemicalequilibrium/ChemicalEquilibrium.java
index 62499ec23..061c4804f 100644
--- a/src/main/java/neqsim/chemicalreactions/chemicalequilibrium/ChemicalEquilibrium.java
+++ b/src/main/java/neqsim/chemicalreactions/chemicalequilibrium/ChemicalEquilibrium.java
@@ -411,10 +411,10 @@ public double step() {
return step;
} else {
// chem_pot_omega[i] = R*T*(chem_ref[i]+ Math.log(n_omega[i]/n_t) +
- // Math.log(system.getPhases()[1].getComponents()[components[i].getComponentNumber()].getFugacityCoefficient()
+ // Math.log(system.getPhase(1).getComponents()[components[i].getComponentNumber()].getFugacityCoefficient()
// / chem_pot_pure[i]));
// chem_pot[i] = R*T*(chem_ref[i] + Math.log(n_mol[i]/n_t)+
- // Math.log(system.getPhases()[1].getComponents()[components[i].getComponentNumber()].getFugacityCoefficient()
+ // Math.log(system.getPhase(1).getComponents()[components[i].getComponentNumber()].getFugacityCoefficient()
// / chem_pot_pure[i]));
if (system.getPhase(phasenumb).getComponents()[components[i].getComponentNumber()]
@@ -426,7 +426,7 @@ public double step() {
- Math.log(n_t) + logactivityVec[i]);
// system.getPhase(phasenumb).getActivityCoefficient(components[i].getComponentNumber(),components[waterNumb].getComponentNumber())));
// System.out.println("solvent activ: "+ i + " " +
- // system.getPhases()[1].getComponents()[components[i].getComponentNumber()].getFugacityCoefficient()
+ // system.getPhase(1).getComponents()[components[i].getComponentNumber()].getFugacityCoefficient()
// / chem_pot_pure[i]);
} else {
chem_pot[i] = R * system.getPhase(phasenumb).getTemperature()
@@ -436,7 +436,7 @@ public double step() {
- Math.log(n_t) + logactivityVec[i]);
// system.getPhase(phasenumb).getActivityCoefficient(components[i].getComponentNumber(),components[waterNumb].getComponentNumber())));
// System.out.println("solute activ : " + i + " " +
- // system.getPhases()[1].getComponents()[components[i].getComponentNumber()].getFugacityCoefficient()
+ // system.getPhase(1).getComponents()[components[i].getComponentNumber()].getFugacityCoefficient()
// / chem_pot_dilute[i]);
}
chem_pot_omega[i] = R * system.getPhase(phasenumb).getTemperature()
diff --git a/src/main/java/neqsim/chemicalreactions/chemicalequilibrium/LinearProgrammingChemicalEquilibrium.java b/src/main/java/neqsim/chemicalreactions/chemicalequilibrium/LinearProgrammingChemicalEquilibrium.java
index bdf101c55..b128ab060 100644
--- a/src/main/java/neqsim/chemicalreactions/chemicalequilibrium/LinearProgrammingChemicalEquilibrium.java
+++ b/src/main/java/neqsim/chemicalreactions/chemicalequilibrium/LinearProgrammingChemicalEquilibrium.java
@@ -280,7 +280,7 @@ public void changePrimaryComponents() {
*
* double[] nEts = new double[atemp.getColumnDimension()]; double totm=0.0; for(int
* k=0;k
@@ -42,9 +43,8 @@ public EnhancementFactor() {} public EnhancementFactor(FluidBoundaryInterface fluidBoundary) { this(); this.fluidBoundary = fluidBoundary; - enhancementVec = - new double[fluidBoundary.getBulkSystem().getPhases()[0].getNumberOfComponents()]; - hattaNumber = new double[fluidBoundary.getBulkSystem().getPhases()[0].getNumberOfComponents()]; + enhancementVec = new double[fluidBoundary.getBulkSystem().getPhase(0).getNumberOfComponents()]; + hattaNumber = new double[fluidBoundary.getBulkSystem().getPhase(0).getNumberOfComponents()]; } /** diff --git a/src/main/java/neqsim/fluidmechanics/flownode/fluidboundary/interphasetransportcoefficient/interphaseonephase/interphasepipeflow/InterphasePipeFlow.java b/src/main/java/neqsim/fluidmechanics/flownode/fluidboundary/interphasetransportcoefficient/interphaseonephase/interphasepipeflow/InterphasePipeFlow.java index 7196d69a0..093a56fb1 100644 --- a/src/main/java/neqsim/fluidmechanics/flownode/fluidboundary/interphasetransportcoefficient/interphaseonephase/interphasepipeflow/InterphasePipeFlow.java +++ b/src/main/java/neqsim/fluidmechanics/flownode/fluidboundary/interphasetransportcoefficient/interphaseonephase/interphasepipeflow/InterphasePipeFlow.java @@ -54,9 +54,8 @@ public double calcWallHeatTransferCoefficient(int phaseNum, double prandtlNumber if (Math.abs(node.getReynoldsNumber()) < 2000) { return 3.66 / node.getGeometry().getDiameter() * node.getBulkSystem().getPhase(phaseNum).getPhysicalProperties().getConductivity(); - } - // if turbulent - use chilton colburn analogy - else { + } else { + // if turbulent - use chilton colburn analogy double temp = node.getBulkSystem().getPhase(phaseNum).getCp() / node.getBulkSystem().getPhase(phaseNum).getMolarMass() / node.getBulkSystem().getPhase(phaseNum).getNumberOfMolesInPhase() diff --git a/src/main/java/neqsim/fluidmechanics/flownode/fluidboundary/interphasetransportcoefficient/interphasetwophase/stirredcell/InterphaseStirredCellFlow.java b/src/main/java/neqsim/fluidmechanics/flownode/fluidboundary/interphasetransportcoefficient/interphasetwophase/stirredcell/InterphaseStirredCellFlow.java index 925e31606..086986001 100644 --- a/src/main/java/neqsim/fluidmechanics/flownode/fluidboundary/interphasetransportcoefficient/interphasetwophase/stirredcell/InterphaseStirredCellFlow.java +++ b/src/main/java/neqsim/fluidmechanics/flownode/fluidboundary/interphasetransportcoefficient/interphasetwophase/stirredcell/InterphaseStirredCellFlow.java @@ -89,9 +89,12 @@ public double calcWallMassTransferCoefficient(int phaseNum, double schmidtNumber @Override public double calcInterphaseMassTransferCoefficient(int phaseNum, double schmidtNumber, FlowNodeInterface node) { - double redMassTrans = 0.0, massTrans = 0.0; + double redMassTrans = 0.0; + double massTrans = 0.0; if (phaseNum == 0) { - double c2 = 0.46, c3 = 0.68, c4 = 0.5; + double c2 = 0.46; + double c3 = 0.68; + double c4 = 0.5; redMassTrans = c2 * Math.pow(node.getReynoldsNumber(phaseNum), c3) * Math.pow(schmidtNumber, c4); // System.out.println("red gas " + @@ -102,7 +105,9 @@ public double calcInterphaseMassTransferCoefficient(int phaseNum, double schmidt / schmidtNumber / node.getGeometry().getDiameter(); } if (phaseNum == 1) { - double c2 = 0.181, c3 = 0.72, c4 = 0.33; + double c2 = 0.181; + double c3 = 0.72; + double c4 = 0.33; redMassTrans = c2 * Math.pow(node.getReynoldsNumber(phaseNum), c3) * Math.pow(schmidtNumber, c4); // System.out.println("red liq" + diff --git a/src/main/java/neqsim/fluidmechanics/flownode/multiphasenode/MultiPhaseFlowNode.java b/src/main/java/neqsim/fluidmechanics/flownode/multiphasenode/MultiPhaseFlowNode.java index c2764c2a0..315c29819 100644 --- a/src/main/java/neqsim/fluidmechanics/flownode/multiphasenode/MultiPhaseFlowNode.java +++ b/src/main/java/neqsim/fluidmechanics/flownode/multiphasenode/MultiPhaseFlowNode.java @@ -62,14 +62,14 @@ public TwoPhaseFlowNode clone() { public double initVelocity() { getBulkSystem().init(1); getBulkSystem().initPhysicalProperties(); - molarFlowRate[1] = getBulkSystem().getPhases()[1].getNumberOfMolesInPhase(); - molarFlowRate[0] = getBulkSystem().getPhases()[0].getNumberOfMolesInPhase(); - massFlowRate[1] = molarFlowRate[1] * getBulkSystem().getPhases()[1].getMolarMass(); - massFlowRate[0] = molarFlowRate[0] * getBulkSystem().getPhases()[0].getMolarMass(); + molarFlowRate[1] = getBulkSystem().getPhase(1).getNumberOfMolesInPhase(); + molarFlowRate[0] = getBulkSystem().getPhase(0).getNumberOfMolesInPhase(); + massFlowRate[1] = molarFlowRate[1] * getBulkSystem().getPhase(1).getMolarMass(); + massFlowRate[0] = molarFlowRate[0] * getBulkSystem().getPhase(0).getMolarMass(); volumetricFlowRate[0] = - massFlowRate[0] / getBulkSystem().getPhases()[0].getPhysicalProperties().getDensity(); + massFlowRate[0] / getBulkSystem().getPhase(0).getPhysicalProperties().getDensity(); volumetricFlowRate[1] = - massFlowRate[1] / getBulkSystem().getPhases()[1].getPhysicalProperties().getDensity(); + massFlowRate[1] / getBulkSystem().getPhase(1).getPhysicalProperties().getDensity(); velocity[0] = volumetricFlowRate[0] / (phaseFraction[0] * pipe.getArea()); velocity[1] = volumetricFlowRate[1] / (phaseFraction[1] * pipe.getArea()); return velocity[1]; @@ -98,27 +98,27 @@ public void initFlowCalc() { initVelocity(); init(); - double Fg = 0.5 * bulkSystem.getPhases()[0].getPhysicalProperties().getDensity() - * wallFrictionFactor[0] * Math.pow(velocity[0], 2.0) * wallContactLength[0] - / (pipe.getArea() * 4.0); - double Fl = 0.5 * bulkSystem.getPhases()[1].getPhysicalProperties().getDensity() - * wallFrictionFactor[1] * Math.pow(velocity[1], 2.0) * wallContactLength[1] - / (pipe.getArea() * 4.0); - double Fi = 0.5 * bulkSystem.getPhases()[0].getPhysicalProperties().getDensity() + double Fg = + 0.5 * bulkSystem.getPhase(0).getPhysicalProperties().getDensity() * wallFrictionFactor[0] + * Math.pow(velocity[0], 2.0) * wallContactLength[0] / (pipe.getArea() * 4.0); + double Fl = + 0.5 * bulkSystem.getPhase(1).getPhysicalProperties().getDensity() * wallFrictionFactor[1] + * Math.pow(velocity[1], 2.0) * wallContactLength[1] / (pipe.getArea() * 4.0); + double Fi = 0.5 * bulkSystem.getPhase(0).getPhysicalProperties().getDensity() * interphaseFrictionFactor[0] * Math.pow(velocity[0] - velocity[1], 2.0) * interphaseContactLength[0] / (pipe.getArea() * 4.0); f = -phaseFraction[0] * Fl + (1 - phaseFraction[0]) * Fg + Fi + (1.0 - phaseFraction[0]) * phaseFraction[0] - * (bulkSystem.getPhases()[1].getPhysicalProperties().getDensity() - - bulkSystem.getPhases()[0].getPhysicalProperties().getDensity()) + * (bulkSystem.getPhase(1).getPhysicalProperties().getDensity() + - bulkSystem.getPhase(0).getPhysicalProperties().getDensity()) * gravity * inclination; /* - * df = -Fl - Fg + (bulkSystem.getPhases()[1].getPhysicalProperties().getDensity() - - * bulkSystem.getPhases()[0].getPhysicalProperties().getDensity()) gravity * inclination - - * Math.pow(phaseFraction[0], 2.0) * (bulkSystem.getPhases()[1] + * df = -Fl - Fg + (bulkSystem.getPhase(1).getPhysicalProperties().getDensity() - + * bulkSystem.getPhase(0).getPhysicalProperties().getDensity()) gravity * inclination - + * Math.pow(phaseFraction[0], 2.0) * (bulkSystem.getPhase(1) * .getPhysicalProperties().getDensity() - - * bulkSystem.getPhases()[0].getPhysicalProperties().getDensity()) gravity * inclination; + * bulkSystem.getPhase(0).getPhysicalProperties().getDensity()) gravity * inclination; */ if (f > 0) { @@ -163,11 +163,11 @@ public double calcHydraulicDiameter() { */ public double calcReynoldNumber() { reynoldsNumber[1] = velocity[1] * hydraulicDiameter[1] - * bulkSystem.getPhases()[1].getPhysicalProperties().getDensity() - / bulkSystem.getPhases()[1].getPhysicalProperties().getViscosity(); + * bulkSystem.getPhase(1).getPhysicalProperties().getDensity() + / bulkSystem.getPhase(1).getPhysicalProperties().getViscosity(); reynoldsNumber[0] = velocity[0] * hydraulicDiameter[0] - * bulkSystem.getPhases()[0].getPhysicalProperties().getDensity() - / bulkSystem.getPhases()[0].getPhysicalProperties().getViscosity(); + * bulkSystem.getPhase(0).getPhysicalProperties().getDensity() + / bulkSystem.getPhase(0).getPhysicalProperties().getViscosity(); return reynoldsNumber[1]; } @@ -191,12 +191,12 @@ public double calcWallFrictionFactor() { /** {@inheritDoc} */ @Override public void setFluxes(double[] dn) { - for (int i = 0; i < getBulkSystem().getPhases()[0].getNumberOfComponents(); i++) { - getBulkSystem().getPhases()[0].addMoles(i, -dn[i]); - getBulkSystem().getPhases()[1].addMoles(i, +dn[i]); + for (int i = 0; i < getBulkSystem().getPhase(0).getNumberOfComponents(); i++) { + getBulkSystem().getPhase(0).addMoles(i, -dn[i]); + getBulkSystem().getPhase(1).addMoles(i, +dn[i]); - getInterphaseSystem().getPhases()[0].addMoles(i, -dn[i]); - getInterphaseSystem().getPhases()[1].addMoles(i, +dn[i]); + getInterphaseSystem().getPhase(0).addMoles(i, -dn[i]); + getInterphaseSystem().getPhase(1).addMoles(i, +dn[i]); } } @@ -204,7 +204,7 @@ public void setFluxes(double[] dn) { @Override public void updateMolarFlow() { for (int phaseNum = 0; phaseNum < 2; phaseNum++) { - for (int i = 0; i < getBulkSystem().getPhases()[0].getNumberOfComponents(); i++) { + for (int i = 0; i < getBulkSystem().getPhase(0).getNumberOfComponents(); i++) { getBulkSystem().getPhase(phaseNum).addMoles(i, (getBulkSystem().getPhase(phaseNum).getComponent(i).getx() * (molarFlowRate[phaseNum] - getBulkSystem().getPhase(phaseNum).getNumberOfMolesInPhase()))); @@ -228,14 +228,12 @@ public double calcContactLength() { @Override public void init() { super.init(); - massFlowRate[0] = - velocity[0] * getBulkSystem().getPhases()[0].getPhysicalProperties().getDensity() - * pipe.getArea() * phaseFraction[0]; - massFlowRate[1] = - velocity[1] * getBulkSystem().getPhases()[1].getPhysicalProperties().getDensity() - * pipe.getArea() * phaseFraction[1]; - molarFlowRate[0] = massFlowRate[0] / getBulkSystem().getPhases()[0].getMolarMass(); - molarFlowRate[1] = massFlowRate[1] / getBulkSystem().getPhases()[1].getMolarMass(); + massFlowRate[0] = velocity[0] * getBulkSystem().getPhase(0).getPhysicalProperties().getDensity() + * pipe.getArea() * phaseFraction[0]; + massFlowRate[1] = velocity[1] * getBulkSystem().getPhase(1).getPhysicalProperties().getDensity() + * pipe.getArea() * phaseFraction[1]; + molarFlowRate[0] = massFlowRate[0] / getBulkSystem().getPhase(0).getMolarMass(); + molarFlowRate[1] = massFlowRate[1] / getBulkSystem().getPhase(1).getMolarMass(); superficialVelocity[0] = velocity[0] * phaseFraction[0]; superficialVelocity[1] = velocity[1] * phaseFraction[1]; volumetricFlowRate[0] = superficialVelocity[0] * pipe.getArea(); @@ -332,7 +330,7 @@ public void update() { getBulkSystem().getPhase(0) .setTemperature(getBulkSystem().getPhase(0).getTemperature() + gas_dT); - for (int componentNumber = 0; componentNumber < getBulkSystem().getPhases()[0] + for (int componentNumber = 0; componentNumber < getBulkSystem().getPhase(0) .getNumberOfComponents(); componentNumber++) { double liquidMolarRate = getFluidBoundary().getInterphaseMolarFlux(componentNumber) * getInterphaseContactArea(); // getInterphaseContactLength(0)*getGeometry().getNodeLength(); diff --git a/src/main/java/neqsim/fluidmechanics/flownode/multiphasenode/waxnode/WaxDepositionFlowNode.java b/src/main/java/neqsim/fluidmechanics/flownode/multiphasenode/waxnode/WaxDepositionFlowNode.java index 572467e8e..d6670ceb2 100644 --- a/src/main/java/neqsim/fluidmechanics/flownode/multiphasenode/waxnode/WaxDepositionFlowNode.java +++ b/src/main/java/neqsim/fluidmechanics/flownode/multiphasenode/waxnode/WaxDepositionFlowNode.java @@ -104,9 +104,9 @@ public double calcContactLength() { public FlowNodeInterface getNextNode() { StratifiedFlowNode newNode = this.clone(); - for (int i = 0; i < getBulkSystem().getPhases()[0].getNumberOfComponents(); i++) { - // newNode.getBulkSystem().getPhases()[0].addMoles(i, -molarMassTransfer[i]); - // newNode.getBulkSystem().getPhases()[1].addMoles(i, +molarMassTransfer[i]); + for (int i = 0; i < getBulkSystem().getPhase(0).getNumberOfComponents(); i++) { + // newNode.getBulkSystem().getPhase(0).addMoles(i, -molarMassTransfer[i]); + // newNode.getBulkSystem().getPhase(1).addMoles(i, +molarMassTransfer[i]); } return newNode; diff --git a/src/main/java/neqsim/fluidmechanics/flownode/onephasenode/onePhaseFlowNode.java b/src/main/java/neqsim/fluidmechanics/flownode/onephasenode/onePhaseFlowNode.java index 4d2603309..a08fb4792 100644 --- a/src/main/java/neqsim/fluidmechanics/flownode/onephasenode/onePhaseFlowNode.java +++ b/src/main/java/neqsim/fluidmechanics/flownode/onephasenode/onePhaseFlowNode.java @@ -60,9 +60,9 @@ public onePhaseFlowNode clone() { /** {@inheritDoc} */ @Override public void increaseMolarRate(double moles) { - for (int i = 0; i < getBulkSystem().getPhases()[0].getNumberOfComponents(); i++) { - double diff = (getBulkSystem().getPhases()[0].getComponent(i).getx() - * (molarFlowRate[0] - getBulkSystem().getPhases()[0].getNumberOfMolesInPhase())); + for (int i = 0; i < getBulkSystem().getPhase(0).getNumberOfComponents(); i++) { + double diff = (getBulkSystem().getPhase(0).getComponent(i).getx() + * (molarFlowRate[0] - getBulkSystem().getPhase(0).getNumberOfMolesInPhase())); getBulkSystem().addComponent(getBulkSystem().getPhase(0).getComponent(i).getComponentName(), diff); } @@ -74,10 +74,10 @@ public void increaseMolarRate(double moles) { @Override public void initFlowCalc() { initBulkSystem(); - molarFlowRate[0] = getBulkSystem().getPhases()[0].getNumberOfMolesInPhase(); - massFlowRate[0] = molarFlowRate[0] * getBulkSystem().getPhases()[0].getMolarMass(); + molarFlowRate[0] = getBulkSystem().getPhase(0).getNumberOfMolesInPhase(); + massFlowRate[0] = molarFlowRate[0] * getBulkSystem().getPhase(0).getMolarMass(); volumetricFlowRate[0] = - massFlowRate[0] / getBulkSystem().getPhases()[0].getPhysicalProperties().getDensity(); + massFlowRate[0] / getBulkSystem().getPhase(0).getPhysicalProperties().getDensity(); superficialVelocity[0] = volumetricFlowRate[0] / pipe.getArea(); velocity[0] = superficialVelocity[0]; this.init(); @@ -86,9 +86,9 @@ public void initFlowCalc() { /** {@inheritDoc} */ @Override public void updateMolarFlow() { - for (int i = 0; i < getBulkSystem().getPhases()[0].getNumberOfComponents(); i++) { - double diff = (getBulkSystem().getPhases()[0].getComponent(i).getx() - * (molarFlowRate[0] - getBulkSystem().getPhases()[0].getNumberOfMolesInPhase())); + for (int i = 0; i < getBulkSystem().getPhase(0).getNumberOfComponents(); i++) { + double diff = (getBulkSystem().getPhase(0).getComponent(i).getx() + * (molarFlowRate[0] - getBulkSystem().getPhase(0).getNumberOfMolesInPhase())); getBulkSystem().addComponent(getBulkSystem().getPhase(0).getComponent(i).getComponentName(), diff); } @@ -98,11 +98,11 @@ public void updateMolarFlow() { // public double initVelocity(){ // initBulkSystem(); - // molarFlowRate[0] = getBulkSystem().getPhases()[0].getNumberOfMolesInPhase(); + // molarFlowRate[0] = getBulkSystem().getPhase(0).getNumberOfMolesInPhase(); // massFlowRate[0] = - // molarFlowRate[0]*getBulkSystem().getPhases()[0].getMolarMass(); + // molarFlowRate[0]*getBulkSystem().getPhase(0).getMolarMass(); // volumetricFlowRate[0] = - // massFlowRate[0]/getBulkSystem().getPhases()[0].getPhysicalProperties().getDensity(); + // massFlowRate[0]/getBulkSystem().getPhase(0).getPhysicalProperties().getDensity(); // superficialVelocity[0] = volumetricFlowRate[0]/pipe.getArea(); // velocity[0] = superficialVelocity[0]; // return velocity[0]; @@ -117,7 +117,7 @@ public void updateMolarFlow() { */ public double calcReynoldsNumber() { reynoldsNumber[0] = getVelocity() * pipe.getDiameter() - / getBulkSystem().getPhases()[0].getPhysicalProperties().getKinematicViscosity(); + / getBulkSystem().getPhase(0).getPhysicalProperties().getKinematicViscosity(); return reynoldsNumber[0]; } @@ -125,14 +125,14 @@ public double calcReynoldsNumber() { @Override public void init() { super.init(); - massFlowRate[0] = velocity[0] - * getBulkSystem().getPhases()[0].getPhysicalProperties().getDensity() * pipe.getArea(); + massFlowRate[0] = velocity[0] * getBulkSystem().getPhase(0).getPhysicalProperties().getDensity() + * pipe.getArea(); superficialVelocity[0] = velocity[0]; - molarFlowRate[0] = massFlowRate[0] / getBulkSystem().getPhases()[0].getMolarMass(); + molarFlowRate[0] = massFlowRate[0] / getBulkSystem().getPhase(0).getMolarMass(); volumetricFlowRate[0] = superficialVelocity[0] * pipe.getArea(); this.updateMolarFlow(); calcReynoldsNumber(); - //System.out.println("specifiedFrictionFactor " +specifiedFrictionFactor[0]); + // System.out.println("specifiedFrictionFactor " +specifiedFrictionFactor[0]); if (specifiedFrictionFactor[0] == null) { wallFrictionFactor[0] = interphaseTransportCoefficient.calcWallFrictionFactor(this); } else { diff --git a/src/main/java/neqsim/fluidmechanics/flownode/onephasenode/onephasepipeflownode/onePhasePipeFlowNode.java b/src/main/java/neqsim/fluidmechanics/flownode/onephasenode/onephasepipeflownode/onePhasePipeFlowNode.java index 5ae2b7869..13e6be14b 100644 --- a/src/main/java/neqsim/fluidmechanics/flownode/onephasenode/onephasepipeflownode/onePhasePipeFlowNode.java +++ b/src/main/java/neqsim/fluidmechanics/flownode/onephasenode/onephasepipeflownode/onePhasePipeFlowNode.java @@ -61,7 +61,7 @@ public onePhasePipeFlowNode clone() { @Override public double calcReynoldsNumber() { reynoldsNumber[0] = getVelocity() * pipe.getDiameter() - / getBulkSystem().getPhases()[0].getPhysicalProperties().getKinematicViscosity(); + / getBulkSystem().getPhase(0).getPhysicalProperties().getKinematicViscosity(); return reynoldsNumber[0]; } diff --git a/src/main/java/neqsim/fluidmechanics/flownode/twophasenode/TwoPhaseFlowNode.java b/src/main/java/neqsim/fluidmechanics/flownode/twophasenode/TwoPhaseFlowNode.java index e14c0e891..57c01dc10 100644 --- a/src/main/java/neqsim/fluidmechanics/flownode/twophasenode/TwoPhaseFlowNode.java +++ b/src/main/java/neqsim/fluidmechanics/flownode/twophasenode/TwoPhaseFlowNode.java @@ -38,13 +38,13 @@ public TwoPhaseFlowNode(SystemInterface system, GeometryDefinitionInterface pipe super(system, pipe); // gasPrandtlNumber = new - // double[getBulkSystem().getPhases()[0].getNumberOfComponents()][getBulkSystem().getPhases()[0].getNumberOfComponents()]; + // double[getBulkSystem().getPhase(0).getNumberOfComponents()][getBulkSystem().getPhase(0).getNumberOfComponents()]; // liquidPrandtlNumber = new - // double[getBulkSystem().getPhases()[0].getNumberOfComponents()][getBulkSystem().getPhases()[0].getNumberOfComponents()]; + // double[getBulkSystem().getPhase(0).getNumberOfComponents()][getBulkSystem().getPhase(0).getNumberOfComponents()]; // molarMassTransferFlux = new - // double[getBulkSystem().getPhases()[0].getNumberOfComponents()]; + // double[getBulkSystem().getPhase(0).getNumberOfComponents()]; // molarMassTransfer = new - // double[getBulkSystem().getPhases()[0].getNumberOfComponents()]; + // double[getBulkSystem().getPhase(0).getNumberOfComponents()]; getBulkSystem().initBeta(); getBulkSystem().init_x_y(); } @@ -77,14 +77,14 @@ public TwoPhaseFlowNode clone() { public double initVelocity() { getBulkSystem().init(1); getBulkSystem().initPhysicalProperties(); - molarFlowRate[1] = getBulkSystem().getPhases()[1].getNumberOfMolesInPhase(); - molarFlowRate[0] = getBulkSystem().getPhases()[0].getNumberOfMolesInPhase(); - massFlowRate[1] = molarFlowRate[1] * getBulkSystem().getPhases()[1].getMolarMass(); - massFlowRate[0] = molarFlowRate[0] * getBulkSystem().getPhases()[0].getMolarMass(); + molarFlowRate[1] = getBulkSystem().getPhase(1).getNumberOfMolesInPhase(); + molarFlowRate[0] = getBulkSystem().getPhase(0).getNumberOfMolesInPhase(); + massFlowRate[1] = molarFlowRate[1] * getBulkSystem().getPhase(1).getMolarMass(); + massFlowRate[0] = molarFlowRate[0] * getBulkSystem().getPhase(0).getMolarMass(); volumetricFlowRate[0] = - massFlowRate[0] / getBulkSystem().getPhases()[0].getPhysicalProperties().getDensity(); + massFlowRate[0] / getBulkSystem().getPhase(0).getPhysicalProperties().getDensity(); volumetricFlowRate[1] = - massFlowRate[1] / getBulkSystem().getPhases()[1].getPhysicalProperties().getDensity(); + massFlowRate[1] / getBulkSystem().getPhase(1).getPhysicalProperties().getDensity(); velocity[0] = volumetricFlowRate[0] / (phaseFraction[0] * pipe.getArea()); velocity[1] = volumetricFlowRate[1] / (phaseFraction[1] * pipe.getArea()); // System.out.println("velocity " + velocity[0] + " velocity " +velocity[1]); @@ -114,28 +114,28 @@ public void initFlowCalc() { initVelocity(); init(); - double Fg = 0.5 * bulkSystem.getPhases()[0].getPhysicalProperties().getDensity() - * wallFrictionFactor[0] * Math.pow(velocity[0], 2.0) * wallContactLength[0] - / (pipe.getArea() * 4.0); - double Fl = 0.5 * bulkSystem.getPhases()[1].getPhysicalProperties().getDensity() - * wallFrictionFactor[1] * Math.pow(velocity[1], 2.0) * wallContactLength[1] - / (pipe.getArea() * 4.0); - double Fi = 0.5 * bulkSystem.getPhases()[0].getPhysicalProperties().getDensity() + double Fg = + 0.5 * bulkSystem.getPhase(0).getPhysicalProperties().getDensity() * wallFrictionFactor[0] + * Math.pow(velocity[0], 2.0) * wallContactLength[0] / (pipe.getArea() * 4.0); + double Fl = + 0.5 * bulkSystem.getPhase(1).getPhysicalProperties().getDensity() * wallFrictionFactor[1] + * Math.pow(velocity[1], 2.0) * wallContactLength[1] / (pipe.getArea() * 4.0); + double Fi = 0.5 * bulkSystem.getPhase(0).getPhysicalProperties().getDensity() * interphaseFrictionFactor[0] * Math.pow(velocity[0] - velocity[1], 2.0) * interphaseContactLength[0] / (pipe.getArea() * 4.0); f = -phaseFraction[0] * Fl + (1 - phaseFraction[0]) * Fg + Fi + (1.0 - phaseFraction[0]) * phaseFraction[0] - * (bulkSystem.getPhases()[1].getPhysicalProperties().getDensity() - - bulkSystem.getPhases()[0].getPhysicalProperties().getDensity()) + * (bulkSystem.getPhase(1).getPhysicalProperties().getDensity() + - bulkSystem.getPhase(0).getPhysicalProperties().getDensity()) * gravity * inclination; /* - * df = -Fl - Fg + (bulkSystem.getPhases()[1].getPhysicalProperties().getDensity() - - * bulkSystem.getPhases()[0].getPhysicalProperties().getDensity()) * gravity * inclination - + * df = -Fl - Fg + (bulkSystem.getPhase(1).getPhysicalProperties().getDensity() - + * bulkSystem.getPhase(0).getPhysicalProperties().getDensity()) * gravity * inclination - * Math.pow(phaseFraction[0], 2.0) - * (bulkSystem.getPhases()[1].getPhysicalProperties().getDensity() - - * bulkSystem.getPhases()[0].getPhysicalProperties().getDensity()) gravity * inclination; + * (bulkSystem.getPhase(1).getPhysicalProperties().getDensity() - + * bulkSystem.getPhase(0).getPhysicalProperties().getDensity()) gravity * inclination; */ if (f > 0) { @@ -149,9 +149,9 @@ public void initFlowCalc() { } phaseFraction[1] = 1.0 - phaseFraction[0]; // System.out.println("f " + f + " iterations " + iterations + " beta " + phaseFraction[0]); - } + } while (Math.abs((f - fOld) / f) > 1e-8 && iterations < 100); // while (Math.abs(f) > 1e-6 && iterations < 100); - while (Math.abs((f - fOld) / f) > 1e-8 && iterations < 100); + if (iterations == 10000) { System.out.println("error in void init calc"); @@ -184,11 +184,11 @@ public double calcHydraulicDiameter() { */ public double calcReynoldNumber() { reynoldsNumber[1] = velocity[1] * hydraulicDiameter[1] - * bulkSystem.getPhases()[1].getPhysicalProperties().getDensity() - / bulkSystem.getPhases()[1].getPhysicalProperties().getViscosity(); + * bulkSystem.getPhase(1).getPhysicalProperties().getDensity() + / bulkSystem.getPhase(1).getPhysicalProperties().getViscosity(); reynoldsNumber[0] = velocity[0] * hydraulicDiameter[0] - * bulkSystem.getPhases()[0].getPhysicalProperties().getDensity() - / bulkSystem.getPhases()[0].getPhysicalProperties().getViscosity(); + * bulkSystem.getPhase(0).getPhysicalProperties().getDensity() + / bulkSystem.getPhase(0).getPhysicalProperties().getViscosity(); return reynoldsNumber[1]; } @@ -212,12 +212,12 @@ public double calcWallFrictionFactor() { /** {@inheritDoc} */ @Override public void setFluxes(double[] dn) { - for (int i = 0; i < getBulkSystem().getPhases()[0].getNumberOfComponents(); i++) { - getBulkSystem().getPhases()[0].addMoles(i, -dn[i]); - getBulkSystem().getPhases()[1].addMoles(i, +dn[i]); + for (int i = 0; i < getBulkSystem().getPhase(0).getNumberOfComponents(); i++) { + getBulkSystem().getPhase(0).addMoles(i, -dn[i]); + getBulkSystem().getPhase(1).addMoles(i, +dn[i]); - getInterphaseSystem().getPhases()[0].addMoles(i, -dn[i]); - getInterphaseSystem().getPhases()[1].addMoles(i, +dn[i]); + getInterphaseSystem().getPhase(0).addMoles(i, -dn[i]); + getInterphaseSystem().getPhase(1).addMoles(i, +dn[i]); } } @@ -225,7 +225,7 @@ public void setFluxes(double[] dn) { @Override public void updateMolarFlow() { for (int phaseNum = 0; phaseNum < 2; phaseNum++) { - for (int i = 0; i < getBulkSystem().getPhases()[0].getNumberOfComponents(); i++) { + for (int i = 0; i < getBulkSystem().getPhase(0).getNumberOfComponents(); i++) { if (molarFlowRate[phaseNum] > 1e-100) { getBulkSystem().getPhase(phaseNum).addMoles(i, (getBulkSystem().getPhase(phaseNum).getComponent(i).getx() * (molarFlowRate[phaseNum] @@ -253,14 +253,12 @@ public double calcContactLength() { @Override public void init() { super.init(); - massFlowRate[0] = - velocity[0] * getBulkSystem().getPhases()[0].getPhysicalProperties().getDensity() - * pipe.getArea() * phaseFraction[0]; - massFlowRate[1] = - velocity[1] * getBulkSystem().getPhases()[1].getPhysicalProperties().getDensity() - * pipe.getArea() * phaseFraction[1]; - molarFlowRate[0] = massFlowRate[0] / getBulkSystem().getPhases()[0].getMolarMass(); - molarFlowRate[1] = massFlowRate[1] / getBulkSystem().getPhases()[1].getMolarMass(); + massFlowRate[0] = velocity[0] * getBulkSystem().getPhase(0).getPhysicalProperties().getDensity() + * pipe.getArea() * phaseFraction[0]; + massFlowRate[1] = velocity[1] * getBulkSystem().getPhase(1).getPhysicalProperties().getDensity() + * pipe.getArea() * phaseFraction[1]; + molarFlowRate[0] = massFlowRate[0] / getBulkSystem().getPhase(0).getMolarMass(); + molarFlowRate[1] = massFlowRate[1] / getBulkSystem().getPhase(1).getMolarMass(); superficialVelocity[0] = velocity[0] * phaseFraction[0]; superficialVelocity[1] = velocity[1] * phaseFraction[1]; volumetricFlowRate[0] = superficialVelocity[0] * pipe.getArea(); @@ -376,7 +374,7 @@ public void update() { // System.out.println("liquid velocity " + getSuperficialVelocity(1)); // System.out.println("gas velocity " + getSuperficialVelocity(0)); - for (int componentNumber = 0; componentNumber < getBulkSystem().getPhases()[0] + for (int componentNumber = 0; componentNumber < getBulkSystem().getPhase(0) .getNumberOfComponents(); componentNumber++) { double liquidMolarRate = getFluidBoundary().getInterphaseMolarFlux(componentNumber) * getInterphaseContactArea(); // getInterphaseContactLength(0)*getGeometry().getNodeLength(); @@ -408,7 +406,7 @@ public void update() { * @param deltaTime a double */ public void update(double deltaTime) { - for (int componentNumber = 0; componentNumber < getBulkSystem().getPhases()[0] + for (int componentNumber = 0; componentNumber < getBulkSystem().getPhase(0) .getNumberOfComponents(); componentNumber++) { double liquidMolarRate = getFluidBoundary().getInterphaseMolarFlux(componentNumber) * getInterphaseContactArea(); // getInterphaseContactLength(0)*getGeometry().getNodeLength(); diff --git a/src/main/java/neqsim/fluidmechanics/flownode/twophasenode/twophasepipeflownode/AnnularFlow.java b/src/main/java/neqsim/fluidmechanics/flownode/twophasenode/twophasepipeflownode/AnnularFlow.java index 6084d82b8..6bee3d440 100644 --- a/src/main/java/neqsim/fluidmechanics/flownode/twophasenode/twophasepipeflownode/AnnularFlow.java +++ b/src/main/java/neqsim/fluidmechanics/flownode/twophasenode/twophasepipeflownode/AnnularFlow.java @@ -109,9 +109,9 @@ public double calcContactLength() { public FlowNodeInterface getNextNode() { AnnularFlow newNode = this.clone(); - for (int i = 0; i < getBulkSystem().getPhases()[0].getNumberOfComponents(); i++) { - // newNode.getBulkSystem().getPhases()[0].addMoles(i, -molarMassTransfer[i]); - // newNode.getBulkSystem().getPhases()[1].addMoles(i, +molarMassTransfer[i]); + for (int i = 0; i < getBulkSystem().getPhase(0).getNumberOfComponents(); i++) { + // newNode.getBulkSystem().getPhase(0).addMoles(i, -molarMassTransfer[i]); + // newNode.getBulkSystem().getPhase(1).addMoles(i, +molarMassTransfer[i]); } return newNode; } diff --git a/src/main/java/neqsim/fluidmechanics/flownode/twophasenode/twophasepipeflownode/BubbleFlowNode.java b/src/main/java/neqsim/fluidmechanics/flownode/twophasenode/twophasepipeflownode/BubbleFlowNode.java index d3e3af1cd..dddffc7d8 100644 --- a/src/main/java/neqsim/fluidmechanics/flownode/twophasenode/twophasepipeflownode/BubbleFlowNode.java +++ b/src/main/java/neqsim/fluidmechanics/flownode/twophasenode/twophasepipeflownode/BubbleFlowNode.java @@ -135,9 +135,9 @@ public double calcContactLength() { public FlowNodeInterface getNextNode() { BubbleFlowNode newNode = this.clone(); - for (int i = 0; i < getBulkSystem().getPhases()[0].getNumberOfComponents(); i++) { - // newNode.getBulkSystem().getPhases()[0].addMoles(i, -molarMassTransfer[i]); - // newNode.getBulkSystem().getPhases()[1].addMoles(i, +molarMassTransfer[i]); + for (int i = 0; i < getBulkSystem().getPhase(0).getNumberOfComponents(); i++) { + // newNode.getBulkSystem().getPhase(0).addMoles(i, -molarMassTransfer[i]); + // newNode.getBulkSystem().getPhase(1).addMoles(i, +molarMassTransfer[i]); } return newNode; diff --git a/src/main/java/neqsim/fluidmechanics/flownode/twophasenode/twophasepipeflownode/DropletFlowNode.java b/src/main/java/neqsim/fluidmechanics/flownode/twophasenode/twophasepipeflownode/DropletFlowNode.java index a1203f428..45b47cc1b 100644 --- a/src/main/java/neqsim/fluidmechanics/flownode/twophasenode/twophasepipeflownode/DropletFlowNode.java +++ b/src/main/java/neqsim/fluidmechanics/flownode/twophasenode/twophasepipeflownode/DropletFlowNode.java @@ -135,9 +135,9 @@ public double calcContactLength() { public FlowNodeInterface getNextNode() { DropletFlowNode newNode = this.clone(); - for (int i = 0; i < getBulkSystem().getPhases()[0].getNumberOfComponents(); i++) { - // newNode.getBulkSystem().getPhases()[0].addMoles(i, -molarMassTransfer[i]); - // newNode.getBulkSystem().getPhases()[1].addMoles(i, +molarMassTransfer[i]); + for (int i = 0; i < getBulkSystem().getPhase(0).getNumberOfComponents(); i++) { + // newNode.getBulkSystem().getPhase(0).addMoles(i, -molarMassTransfer[i]); + // newNode.getBulkSystem().getPhase(1).addMoles(i, +molarMassTransfer[i]); } return newNode; diff --git a/src/main/java/neqsim/fluidmechanics/flownode/twophasenode/twophasepipeflownode/StratifiedFlowNode.java b/src/main/java/neqsim/fluidmechanics/flownode/twophasenode/twophasepipeflownode/StratifiedFlowNode.java index e1dc967ba..7a590e0d3 100644 --- a/src/main/java/neqsim/fluidmechanics/flownode/twophasenode/twophasepipeflownode/StratifiedFlowNode.java +++ b/src/main/java/neqsim/fluidmechanics/flownode/twophasenode/twophasepipeflownode/StratifiedFlowNode.java @@ -107,9 +107,9 @@ public double calcContactLength() { public FlowNodeInterface getNextNode() { StratifiedFlowNode newNode = this.clone(); - for (int i = 0; i < getBulkSystem().getPhases()[0].getNumberOfComponents(); i++) { - // newNode.getBulkSystem().getPhases()[0].addMoles(i, -molarMassTransfer[i]); - // newNode.getBulkSystem().getPhases()[1].addMoles(i, +molarMassTransfer[i]); + for (int i = 0; i < getBulkSystem().getPhase(0).getNumberOfComponents(); i++) { + // newNode.getBulkSystem().getPhase(0).addMoles(i, -molarMassTransfer[i]); + // newNode.getBulkSystem().getPhase(1).addMoles(i, +molarMassTransfer[i]); } return newNode; diff --git a/src/main/java/neqsim/fluidmechanics/flownode/twophasenode/twophasereactorflownode/TwoPhasePackedBedFlowNode.java b/src/main/java/neqsim/fluidmechanics/flownode/twophasenode/twophasereactorflownode/TwoPhasePackedBedFlowNode.java index 6c698b3f4..d569fbc3a 100644 --- a/src/main/java/neqsim/fluidmechanics/flownode/twophasenode/twophasereactorflownode/TwoPhasePackedBedFlowNode.java +++ b/src/main/java/neqsim/fluidmechanics/flownode/twophasenode/twophasereactorflownode/TwoPhasePackedBedFlowNode.java @@ -110,12 +110,12 @@ public double calcHydraulicDiameter() { public double calcReynoldNumber() { reynoldsNumber[1] = getSuperficialVelocity(1) / getGeometry().getPacking().getSurfaceAreaPrVolume() - * bulkSystem.getPhases()[1].getPhysicalProperties().getDensity() - / bulkSystem.getPhases()[1].getPhysicalProperties().getViscosity(); + * bulkSystem.getPhase(1).getPhysicalProperties().getDensity() + / bulkSystem.getPhase(1).getPhysicalProperties().getViscosity(); reynoldsNumber[0] = getSuperficialVelocity(0) / getGeometry().getPacking().getSurfaceAreaPrVolume() - * bulkSystem.getPhases()[0].getPhysicalProperties().getDensity() - / bulkSystem.getPhases()[0].getPhysicalProperties().getViscosity(); + * bulkSystem.getPhase(0).getPhysicalProperties().getDensity() + / bulkSystem.getPhase(0).getPhysicalProperties().getViscosity(); System.out.println("rey liq " + reynoldsNumber[1]); System.out.println("rey gas " + reynoldsNumber[0]); return reynoldsNumber[1]; @@ -140,9 +140,9 @@ public double calcGasLiquidContactArea() { public FlowNodeInterface getNextNode() { TwoPhasePackedBedFlowNode newNode = this.clone(); - for (int i = 0; i < getBulkSystem().getPhases()[0].getNumberOfComponents(); i++) { - // newNode.getBulkSystem().getPhases()[0].addMoles(i, -molarMassTransfer[i]); - // newNode.getBulkSystem().getPhases()[1].addMoles(i, +molarMassTransfer[i]); + for (int i = 0; i < getBulkSystem().getPhase(0).getNumberOfComponents(); i++) { + // newNode.getBulkSystem().getPhase(0).addMoles(i, -molarMassTransfer[i]); + // newNode.getBulkSystem().getPhase(1).addMoles(i, +molarMassTransfer[i]); } return newNode; @@ -151,7 +151,7 @@ public FlowNodeInterface getNextNode() { /** {@inheritDoc} */ @Override public void update() { - for (int componentNumber = 0; componentNumber < getBulkSystem().getPhases()[0] + for (int componentNumber = 0; componentNumber < getBulkSystem().getPhase(0) .getNumberOfComponents(); componentNumber++) { if (componentNumber == 1) { double liquidMolarRate = @@ -237,8 +237,8 @@ public static void main(String[] args) { testSystem.addComponent("CO2", 2000.11152181, "Nlitre/min", 0); testSystem.setPhysicalPropertyModel(PhysicalPropertyModel.AMINE); testSystem.init_x_y(); - testSystem.getPhases()[1].setTemperature(313.0); - testSystem.getPhases()[0].setTemperature(325.0); + testSystem.getPhase(1).setTemperature(313.0); + testSystem.getPhase(0).setTemperature(325.0); FlowNodeInterface test = new TwoPhasePackedBedFlowNode(testSystem, pipe1); test.setLengthOfNode(0.1); diff --git a/src/main/java/neqsim/fluidmechanics/flownode/twophasenode/twophasereactorflownode/TwoPhaseTrayTowerFlowNode.java b/src/main/java/neqsim/fluidmechanics/flownode/twophasenode/twophasereactorflownode/TwoPhaseTrayTowerFlowNode.java index c04cee9a7..aef7a2f0e 100644 --- a/src/main/java/neqsim/fluidmechanics/flownode/twophasenode/twophasereactorflownode/TwoPhaseTrayTowerFlowNode.java +++ b/src/main/java/neqsim/fluidmechanics/flownode/twophasenode/twophasereactorflownode/TwoPhaseTrayTowerFlowNode.java @@ -112,9 +112,9 @@ public double calcContactLength() { public FlowNodeInterface getNextNode() { TwoPhaseTrayTowerFlowNode newNode = this.clone(); - for (int i = 0; i < getBulkSystem().getPhases()[0].getNumberOfComponents(); i++) { - // newNode.getBulkSystem().getPhases()[0].addMoles(i, -molarMassTransfer[i]); - // newNode.getBulkSystem().getPhases()[1].addMoles(i, +molarMassTransfer[i]); + for (int i = 0; i < getBulkSystem().getPhase(0).getNumberOfComponents(); i++) { + // newNode.getBulkSystem().getPhase(0).addMoles(i, -molarMassTransfer[i]); + // newNode.getBulkSystem().getPhase(1).addMoles(i, +molarMassTransfer[i]); } return newNode; @@ -156,8 +156,8 @@ public static void main(String[] args) { // testSystem.init(0); testSystem.init_x_y(); - // testSystem.getPhases()[1].setTemperature(294.0); - // testSystem.getPhases()[0].setTemperature(299.0); + // testSystem.getPhase(1).setTemperature(294.0); + // testSystem.getPhase(0).setTemperature(299.0); FlowNodeInterface test = new TwoPhaseTrayTowerFlowNode(testSystem, pipe1); test.setInterphaseModelType(1); diff --git a/src/main/java/neqsim/fluidmechanics/flownode/twophasenode/twophasestirredcellnode/StirredCellNode.java b/src/main/java/neqsim/fluidmechanics/flownode/twophasenode/twophasestirredcellnode/StirredCellNode.java index 61e93cb4d..0fc1106df 100644 --- a/src/main/java/neqsim/fluidmechanics/flownode/twophasenode/twophasestirredcellnode/StirredCellNode.java +++ b/src/main/java/neqsim/fluidmechanics/flownode/twophasenode/twophasestirredcellnode/StirredCellNode.java @@ -82,11 +82,11 @@ public double calcHydraulicDiameter() { @Override public double calcReynoldNumber() { reynoldsNumber[1] = Math.pow(stirrerDiameter[1], 2.0) * stirrerRate[1] - * bulkSystem.getPhases()[1].getPhysicalProperties().getDensity() - / bulkSystem.getPhases()[1].getPhysicalProperties().getViscosity(); + * bulkSystem.getPhase(1).getPhysicalProperties().getDensity() + / bulkSystem.getPhase(1).getPhysicalProperties().getViscosity(); reynoldsNumber[0] = Math.pow(stirrerDiameter[0], 2.0) * stirrerRate[0] - * bulkSystem.getPhases()[0].getPhysicalProperties().getDensity() - / bulkSystem.getPhases()[0].getPhysicalProperties().getViscosity(); + * bulkSystem.getPhase(0).getPhysicalProperties().getDensity() + / bulkSystem.getPhase(0).getPhysicalProperties().getViscosity(); return reynoldsNumber[1]; } @@ -137,15 +137,15 @@ public double calcGasLiquidContactArea() { /** {@inheritDoc} */ @Override public void update() { - for (int componentNumber = 0; componentNumber < getBulkSystem().getPhases()[0] + for (int componentNumber = 0; componentNumber < getBulkSystem().getPhase(0) .getNumberOfComponents(); componentNumber++) { double liquidMolarRate = getFluidBoundary().getInterphaseMolarFlux(componentNumber) * getInterphaseContactArea() * getDt(); double gasMolarRate = -getFluidBoundary().getInterphaseMolarFlux(componentNumber) * getInterphaseContactArea() * getDt(); // System.out.println("liquidMolarRate" + liquidMolarRate); - getBulkSystem().getPhases()[0].addMoles(componentNumber, gasMolarRate); - getBulkSystem().getPhases()[1].addMoles(componentNumber, liquidMolarRate); + getBulkSystem().getPhase(0).addMoles(componentNumber, gasMolarRate); + getBulkSystem().getPhase(1).addMoles(componentNumber, liquidMolarRate); } // getBulkSystem().initBeta(); getBulkSystem().init_x_y(); @@ -161,9 +161,9 @@ public void update() { @Override public FlowNodeInterface getNextNode() { StirredCellNode newNode = this.clone(); - for (int i = 0; i < getBulkSystem().getPhases()[0].getNumberOfComponents(); i++) { - // newNode.getBulkSystem().getPhases()[0].addMoles(i, -molarMassTransfer[i]); - // newNode.getBulkSystem().getPhases()[1].addMoles(i, +molarMassTransfer[i]); + for (int i = 0; i < getBulkSystem().getPhase(0).getNumberOfComponents(); i++) { + // newNode.getBulkSystem().getPhase(0).addMoles(i, -molarMassTransfer[i]); + // newNode.getBulkSystem().getPhase(1).addMoles(i, +molarMassTransfer[i]); } return newNode; } 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 198da3b5d..767c5fff6 100644 --- a/src/main/java/neqsim/fluidmechanics/flowsolver/onephaseflowsolver/onephasepipeflowsolver/OnePhaseFixedStaggeredGrid.java +++ b/src/main/java/neqsim/fluidmechanics/flowsolver/onephaseflowsolver/onephasepipeflowsolver/OnePhaseFixedStaggeredGrid.java @@ -61,14 +61,13 @@ public OnePhaseFixedStaggeredGrid( oldMass = new double[nodes]; oldComp = new double[nodes]; oldImpuls = new double[nodes]; - diff4Matrix = - new Matrix[pipe.getNode(0).getBulkSystem().getPhases()[0].getNumberOfComponents()]; + diff4Matrix = new Matrix[pipe.getNode(0).getBulkSystem().getPhase(0).getNumberOfComponents()]; oldEnergy = new double[nodes]; oldVelocity = new double[nodes]; oldDensity = new double[nodes]; oldInternalEnergy = new double[nodes]; oldComposition = - new double[pipe.getNode(0).getBulkSystem().getPhases()[0].getNumberOfComponents()][nodes]; + new double[pipe.getNode(0).getBulkSystem().getPhase(0).getNumberOfComponents()][nodes]; numberOfVelocityNodes = nodes; } @@ -107,14 +106,14 @@ public void initProfiles() { pipe.getNode(i + 1).getBulkSystem() .setTemperature((4.0 * pipe.getNode(i).calcTotalHeatTransferCoefficient(0) * (pipe.getNode(i).getGeometry().getSurroundingEnvironment().getTemperature() - - pipe.getNode(i).getBulkSystem().getPhases()[0].getTemperature()) - / (pipe.getNode(i).getBulkSystem().getPhases()[0].getCp() - / pipe.getNode(i).getBulkSystem().getPhases()[0].getNumberOfMolesInPhase() - / pipe.getNode(i).getBulkSystem().getPhases()[0].getMolarMass() + - pipe.getNode(i).getBulkSystem().getPhase(0).getTemperature()) + / (pipe.getNode(i).getBulkSystem().getPhase(0).getCp() + / pipe.getNode(i).getBulkSystem().getPhase(0).getNumberOfMolesInPhase() + / pipe.getNode(i).getBulkSystem().getPhase(0).getMolarMass() * pipe.getNode(i + 1).getVelocity() * pipe.getNode(i + 1).getGeometry().getDiameter() - * pipe.getNode(i + 1).getBulkSystem().getPhases()[0].getDensity()) - + pipe.getNode(i + 1).getBulkSystem().getPhases()[0].getJouleThomsonCoefficient() + * pipe.getNode(i + 1).getBulkSystem().getPhase(0).getDensity()) + + pipe.getNode(i + 1).getBulkSystem().getPhase(0).getJouleThomsonCoefficient() * dpdx) * (pipe.getNode(i + 1).getGeometry().getNodeLength() + pipe.getNode(i).getGeometry().getNodeLength()) @@ -132,11 +131,11 @@ public void initProfiles() { oldPres = pipe.getNode(i + 1).getBulkSystem().getPressure(); pipe.getNode(i + 1).getBulkSystem() .setPressure(-pipe.getNode(i).getWallFrictionFactor() - * pipe.getNode(i).getBulkSystem().getPhases()[0].getDensity() + * pipe.getNode(i).getBulkSystem().getPhase(0).getDensity() * pipe.getNode(i).getVelocity() * pipe.getNode(i).getVelocity() / pipe.getNode(i).getGeometry().getDiameter() / 2.0 * (pipe.getNode(i).getGeometry().getNodeLength()) / 1e5 - - gravity * pipe.getNode(i).getBulkSystem().getPhases()[0].getDensity() + - gravity * pipe.getNode(i).getBulkSystem().getPhase(0).getDensity() * (pipe.getNode(i + 1).getVerticalPositionOfNode() - pipe.getNode(i).getVerticalPositionOfNode()) / 1e5 @@ -155,7 +154,7 @@ public void initProfiles() { * System.out .println("temp : " + pipe.getNode(i + 1).getBulkSystem().getTemperature()); * System.out.println("velocity : " + pipe.getNode(i + 1).getVelocity()); * System.out.println("dpdx : " + dpdx); System.out .println("JT coeff : " + pipe.getNode(i - * + 1).getBulkSystem().getPhases()[0] .getJouleThomsonCoefficient()); + * + 1).getBulkSystem().getPhase(0) .getJouleThomsonCoefficient()); */ // setting velocities pipe.getNode(i + 1).setVelocityIn(pipe.getNode(i + 1).getVelocity()); @@ -175,18 +174,18 @@ public void initProfiles() { public void initMatrix() { for (int i = 0; i < numberOfNodes; i++) { pipe.getNode(i).init(); - double enthalpy = pipe.getNode(i).getBulkSystem().getPhases()[0].getEnthalpy() - / pipe.getNode(i).getBulkSystem().getPhases()[0].getNumberOfMolesInPhase() - / pipe.getNode(i).getBulkSystem().getPhases()[0].getMolarMass(); + double enthalpy = pipe.getNode(i).getBulkSystem().getPhase(0).getEnthalpy() + / pipe.getNode(i).getBulkSystem().getPhase(0).getNumberOfMolesInPhase() + / pipe.getNode(i).getBulkSystem().getPhase(0).getMolarMass(); solMatrix.set(i, 0, pipe.getNode(i).getVelocityIn().doubleValue()); sol3Matrix.set(i, 0, enthalpy); - sol2Matrix.set(i, 0, pipe.getNode(i).getBulkSystem().getPhases()[0].getDensity()); - for (int j = 0; j < pipe.getNode(i).getBulkSystem().getPhases()[0] + sol2Matrix.set(i, 0, pipe.getNode(i).getBulkSystem().getPhase(0).getDensity()); + for (int j = 0; j < pipe.getNode(i).getBulkSystem().getPhase(0) .getNumberOfComponents(); j++) { sol4Matrix[j].set(i, 0, - 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()); + pipe.getNode(i).getBulkSystem().getPhase(0).getComponent(j).getx() + * pipe.getNode(i).getBulkSystem().getPhase(0).getComponent(j).getMolarMass() + / pipe.getNode(i).getBulkSystem().getPhase(0).getMolarMass()); } } } @@ -204,7 +203,7 @@ public void initPressure(int iteration) { // pipe.getNode(i).getBulkSystem().getPressure()); pipe.getNode(i).getBulkSystem().setPressure( - pipe.getNode(i).getBulkSystem().getPhases()[0].getdPdrho() * diffMatrix.get(i, 0) * 1e-5 + pipe.getNode(i).getBulkSystem().getPhase(0).getdPdrho() * diffMatrix.get(i, 0) * 1e-5 + pipe.getNode(i).getBulkSystem().getPressure()); pipe.getNode(i).init(); // if(dynamic) System.out.println("i " + i +" diff 0 " +(diffMatrix.get(i, @@ -260,15 +259,15 @@ public void initTemperature(int iteration) { pipe.getNode(i).getBulkSystem() .setTemperature(pipe.getNode(i).getBulkSystem().getTemperature() + iteration * 1.0 / (10.0 + iteration) * diffMatrix.get(i, 0) - / (pipe.getNode(i).getBulkSystem().getPhases()[0].getCp() - / pipe.getNode(i).getBulkSystem().getPhases()[0].getNumberOfMolesInPhase() - / pipe.getNode(i).getBulkSystem().getPhases()[0].getMolarMass())); + / (pipe.getNode(i).getBulkSystem().getPhase(0).getCp() + / pipe.getNode(i).getBulkSystem().getPhase(0).getNumberOfMolesInPhase() + / pipe.getNode(i).getBulkSystem().getPhase(0).getMolarMass())); pipe.getNode(i).init(); // System.out.println("cp: " + - // (pipe.getNode(i).getBulkSystem().getPhases()[0].getCp() / - // pipe.getNode(i).getBulkSystem().getPhases()[0].getNumberOfMolesInPhase() / - // pipe.getNode(i).getBulkSystem().getPhases()[0].getMolarMass())); + // (pipe.getNode(i).getBulkSystem().getPhase(0).getCp() / + // pipe.getNode(i).getBulkSystem().getPhase(0).getNumberOfMolesInPhase() / + // pipe.getNode(i).getBulkSystem().getPhase(0).getMolarMass())); } } @@ -281,16 +280,16 @@ public void initTemperature(int iteration) { */ public void initComposition(int iter) { for (int j = 1; j < numberOfNodes; j++) { - for (int p = 0; p < pipe.getNode(0).getBulkSystem().getPhases()[0] + for (int p = 0; p < pipe.getNode(0).getBulkSystem().getPhase(0) .getNumberOfComponents(); p++) { - 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].getComponent(p).getMolarMass()); - // pipe.getNode(j).getBulkSystem().getPhases()[0].getComponent(p).getx() + + pipe.getNode(j).getBulkSystem().getPhase(0).getComponent(p).setx( + sol4Matrix[p].get(j, 0) * pipe.getNode(j).getBulkSystem().getPhase(0).getMolarMass() + / pipe.getNode(j).getBulkSystem().getPhase(0).getComponent(p).getMolarMass()); + // pipe.getNode(j).getBulkSystem().getPhase(0).getComponent(p).getx() + // 0.5*diff4Matrix[p].get(j,0)); } - pipe.getNode(j).getBulkSystem().getPhases()[0].normalize(); + pipe.getNode(j).getBulkSystem().getPhase(0).normalize(); pipe.getNode(j).init(); } } @@ -306,7 +305,7 @@ public void setMassConservationMatrixTDMA() { a[0] = 0; b[0] = 1.0; c[0] = 0; - SU = pipe.getNode(0).getBulkSystem().getPhases()[0].getDensity(); + SU = pipe.getNode(0).getBulkSystem().getPhase(0).getDensity(); r[0] = SU; } else { double Ae = pipe.getNode(1).getGeometry().getArea(); @@ -405,8 +404,8 @@ public void setImpulsMatrixTDMA() { double Amean = pipe.getNode(i - 1).getGeometry().getArea(); double meanDiameter = pipe.getNode(i - 1).getGeometry().getDiameter(); double meanFrik = pipe.getNode(i - 1).getWallFrictionFactor(); - double meanDensity = (pipe.getNode(i).getBulkSystem().getPhases()[0].getDensity() - + pipe.getNode(i - 1).getBulkSystem().getPhases()[0].getDensity()) / 2.0; + double meanDensity = (pipe.getNode(i).getBulkSystem().getPhase(0).getDensity() + + pipe.getNode(i - 1).getBulkSystem().getPhase(0).getDensity()) / 2.0; double oldMeanDensity = (oldDensity[i - 1] + oldDensity[i]) / 2.0; double meanVelocity = (pipe.getNode(i - 1).getVelocity() + pipe.getNode(i).getVelocity()) / 2.0; @@ -421,11 +420,11 @@ public void setImpulsMatrixTDMA() { + Amean * nodeLength * meanDensity * meanFrik / meanDiameter * meanVelocity * Math.abs(meanVelocity) / 2.0; SP = -Amean * nodeLength * meanDensity * meanFrik / meanDiameter * meanVelocity; - Fw = Aw * pipe.getNode(i - 1).getBulkSystem().getPhases()[0].getDensity() + Fw = Aw * pipe.getNode(i - 1).getBulkSystem().getPhase(0).getDensity() * (pipe.getNode(i - 1).getVelocityIn().doubleValue() + pipe.getNode(i - 1).getVelocityOut().doubleValue()) / 2.0; - Fe = Ae * pipe.getNode(i).getBulkSystem().getPhases()[0].getDensity() + Fe = Ae * pipe.getNode(i).getBulkSystem().getPhase(0).getDensity() * (pipe.getNode(i).getVelocityIn().doubleValue() + pipe.getNode(i).getVelocityOut().doubleValue()) / 2.0; @@ -452,7 +451,7 @@ public void setImpulsMatrixTDMA() { double Amean = pipe.getNode(i - 1).getGeometry().getArea(); double meanDiameter = pipe.getNode(i - 1).getGeometry().getDiameter(); double meanFrik = pipe.getNode(i - 1).getWallFrictionFactor(); - double meanDensity = pipe.getNode(i - 1).getBulkSystem().getPhases()[0].getDensity(); + double meanDensity = pipe.getNode(i - 1).getBulkSystem().getPhase(0).getDensity(); double oldMeanDensity = oldDensity[i - 1]; double meanVelocity = pipe.getNode(i - 1).getVelocity(); double vertposchange = pipe.getNode(i).getVerticalPositionOfNode() @@ -466,11 +465,11 @@ public void setImpulsMatrixTDMA() { + Amean * nodeLength * meanDensity * meanFrik / meanDiameter * meanVelocity * Math.abs(meanVelocity) / 2.0; SP = -Amean * nodeLength * meanDensity * meanFrik / meanDiameter * meanVelocity; - Fw = Aw * pipe.getNode(i - 1).getBulkSystem().getPhases()[0].getDensity() + Fw = Aw * pipe.getNode(i - 1).getBulkSystem().getPhase(0).getDensity() * (pipe.getNode(i - 1).getVelocityIn().doubleValue() + pipe.getNode(i - 1).getVelocityOut().doubleValue()) / 2.0; - Fe = Ae * pipe.getNode(i).getBulkSystem().getPhases()[0].getDensity() + Fe = Ae * pipe.getNode(i).getBulkSystem().getPhase(0).getDensity() * (pipe.getNode(i).getVelocityIn().doubleValue() + pipe.getNode(i).getVelocityOut().doubleValue()) / 2.0; @@ -500,9 +499,9 @@ public void setEnergyMatrixTDMA() { a[0] = 0; b[0] = 1.0; c[0] = 0; - double SU = pipe.getNode(0).getBulkSystem().getPhases()[0].getEnthalpy() - / pipe.getNode(0).getBulkSystem().getPhases()[0].getNumberOfMolesInPhase() - / pipe.getNode(0).getBulkSystem().getPhases()[0].getMolarMass(); + double SU = pipe.getNode(0).getBulkSystem().getPhase(0).getEnthalpy() + / pipe.getNode(0).getBulkSystem().getPhase(0).getNumberOfMolesInPhase() + / pipe.getNode(0).getBulkSystem().getPhase(0).getMolarMass(); r[0] = SU; for (int i = 1; i < numberOfNodes - 1; i++) { @@ -521,8 +520,8 @@ public void setEnergyMatrixTDMA() { - pipe.getNode(i - 1).getVerticalPositionOfNode()); SU = -pipe.getNode(i).getGeometry().getArea() * gravity - * pipe.getNode(i).getBulkSystem().getPhases()[0].getDensity() - * pipe.getNode(i).getVelocity() * vertposchange + * pipe.getNode(i).getBulkSystem().getPhase(0).getDensity() * pipe.getNode(i).getVelocity() + * vertposchange + pipe.getNode(i).getGeometry().getArea() * 4.0 * pipe.getNode(i).calcTotalHeatTransferCoefficient(0) * (pipe.getNode(i).getGeometry().getSurroundingEnvironment().getTemperature() @@ -530,9 +529,9 @@ public void setEnergyMatrixTDMA() { / (pipe.getNode(i).getGeometry().getDiameter()) * pipe.getNode(i).getGeometry().getNodeLength(); double SP = 0; - double Fw = Aw * pipe.getNode(i - 1).getBulkSystem().getPhases()[0].getDensity() + double Fw = Aw * pipe.getNode(i - 1).getBulkSystem().getPhase(0).getDensity() * pipe.getNode(i).getVelocityIn().doubleValue(); - double Fe = Ae * pipe.getNode(i).getBulkSystem().getPhases()[0].getDensity() + double Fe = Ae * pipe.getNode(i).getBulkSystem().getPhase(0).getDensity() * pipe.getNode(i).getVelocityOut().doubleValue(); if (dynamic) { @@ -569,8 +568,8 @@ public void setEnergyMatrixTDMA() { - pipe.getNode(i - 1).getVerticalPositionOfNode()); SU = -pipe.getNode(i).getGeometry().getArea() * gravity - * pipe.getNode(i).getBulkSystem().getPhases()[0].getDensity() - * pipe.getNode(i).getVelocity() * vertposchange + * pipe.getNode(i).getBulkSystem().getPhase(0).getDensity() * pipe.getNode(i).getVelocity() + * vertposchange + pipe.getNode(i).getGeometry().getArea() * 4.0 * pipe.getNode(i).calcTotalHeatTransferCoefficient(0) * (pipe.getNode(i).getGeometry().getSurroundingEnvironment().getTemperature() @@ -582,9 +581,9 @@ public void setEnergyMatrixTDMA() { // 4.0*12.0 / // (pipe.getNode(i).getGeometry().getDiameter())*pipe.getNode(i).getGeometry().getNodeLength(); - double Fw = Aw * pipe.getNode(i - 1).getBulkSystem().getPhases()[0].getDensity() + double Fw = Aw * pipe.getNode(i - 1).getBulkSystem().getPhase(0).getDensity() * pipe.getNode(i).getVelocityIn().doubleValue(); - double Fe = Ae * pipe.getNode(i).getBulkSystem().getPhases()[0].getDensity() + double Fe = Ae * pipe.getNode(i).getBulkSystem().getPhase(0).getDensity() * pipe.getNode(i).getVelocity(); if (dynamic) { @@ -613,10 +612,10 @@ public void setComponentConservationMatrix(int componentNumber) { a[0] = 0; b[0] = 1.0; c[0] = 0; - SU = pipe.getNode(0).getBulkSystem().getPhases()[0].getComponents()[componentNumber].getx() - * pipe.getNode(0).getBulkSystem().getPhases()[0].getComponents()[componentNumber] + SU = pipe.getNode(0).getBulkSystem().getPhase(0).getComponents()[componentNumber].getx() + * pipe.getNode(0).getBulkSystem().getPhase(0).getComponents()[componentNumber] .getMolarMass() - / pipe.getNode(0).getBulkSystem().getPhases()[0].getMolarMass(); + / pipe.getNode(0).getBulkSystem().getPhase(0).getMolarMass(); r[0] = SU; for (int i = 1; i < numberOfNodes - 1; i++) { @@ -624,15 +623,15 @@ public void setComponentConservationMatrix(int componentNumber) { double Aw = pipe.getNode(i - 1).getGeometry().getArea(); double Fe = pipe.getNode(i).getVelocityOut().doubleValue() - * pipe.getNode(i).getBulkSystem().getPhases()[0].getDensity() * Ae; + * pipe.getNode(i).getBulkSystem().getPhase(0).getDensity() * Ae; double Fw = pipe.getNode(i).getVelocityIn().doubleValue() - * pipe.getNode(i - 1).getBulkSystem().getPhases()[0].getDensity() * Aw; + * pipe.getNode(i - 1).getBulkSystem().getPhase(0).getDensity() * Aw; // System.out.println("vel: " + // pipe.getNode(i).getVelocityOut(phase).doubleValue() + " fe " + Fe); if (dynamic) { oldComp[i] = 1.0 / timeStep * pipe.getNode(i).getGeometry().getArea() * pipe.getNode(i).getGeometry().getNodeLength() - * pipe.getNode(i).getBulkSystem().getPhases()[0].getDensity(); + * pipe.getNode(i).getBulkSystem().getPhase(0).getDensity(); } else { oldComp[i] = 0.0; } @@ -654,14 +653,14 @@ public void setComponentConservationMatrix(int componentNumber) { double Aw = pipe.getNode(i - 1).getGeometry().getArea(); double Fe = pipe.getNode(i).getVelocity() - * pipe.getNode(i).getBulkSystem().getPhases()[0].getDensity() * Ae; + * pipe.getNode(i).getBulkSystem().getPhase(0).getDensity() * Ae; double Fw = pipe.getNode(i).getVelocityIn().doubleValue() - * pipe.getNode(i - 1).getBulkSystem().getPhases()[0].getDensity() * Aw; + * pipe.getNode(i - 1).getBulkSystem().getPhase(0).getDensity() * Aw; if (dynamic) { oldComp[i] = 1.0 / timeStep * pipe.getNode(i).getGeometry().getArea() * pipe.getNode(i).getGeometry().getNodeLength() - * pipe.getNode(i).getBulkSystem().getPhases()[0].getDensity(); + * pipe.getNode(i).getBulkSystem().getPhase(0).getDensity(); } else { oldComp[i] = 0.0; } @@ -682,17 +681,17 @@ public void setComponentConservationMatrix(int componentNumber) { public void initFinalResults() { for (int i = 0; i < numberOfNodes; i++) { oldVelocity[i] = pipe.getNode(i).getVelocityIn().doubleValue(); - oldDensity[i] = pipe.getNode(i).getBulkSystem().getPhases()[0].getDensity(); - oldInternalEnergy[i] = pipe.getNode(i).getBulkSystem().getPhases()[0].getEnthalpy() - / pipe.getNode(i).getBulkSystem().getPhases()[0].getNumberOfMolesInPhase() - / pipe.getNode(i).getBulkSystem().getPhases()[0].getMolarMass(); + oldDensity[i] = pipe.getNode(i).getBulkSystem().getPhase(0).getDensity(); + oldInternalEnergy[i] = pipe.getNode(i).getBulkSystem().getPhase(0).getEnthalpy() + / pipe.getNode(i).getBulkSystem().getPhase(0).getNumberOfMolesInPhase() + / pipe.getNode(i).getBulkSystem().getPhase(0).getMolarMass(); - for (int j = 0; j < pipe.getNode(i).getBulkSystem().getPhases()[0] + for (int j = 0; j < pipe.getNode(i).getBulkSystem().getPhase(0) .getNumberOfComponents(); j++) { oldComposition[j][i] = sol4Matrix[j].get(i, 0); - // 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(); + // pipe.getNode(i).getBulkSystem().getPhase(0).getComponent(j).getx() * + // pipe.getNode(i).getBulkSystem().getPhase(0).getComponent(j).getMolarMass() / + // pipe.getNode(i).getBulkSystem().getPhase(0).getMolarMass(); } } } @@ -705,7 +704,7 @@ public void solveTDMA() { int iterTop = 0; double maxDiff = 1.0; double diff = 0; - xNew = new double[pipe.getNode(0).getBulkSystem().getPhases()[0] + xNew = new double[pipe.getNode(0).getBulkSystem().getPhase(0) .getNumberOfComponents()][numberOfNodes]; if (!dynamic) { initProfiles(); @@ -788,7 +787,7 @@ public void solveTDMA() { iter = 0; do { iter++; - for (int p = 0; p < pipe.getNode(0).getBulkSystem().getPhases()[0] + for (int p = 0; p < pipe.getNode(0).getBulkSystem().getPhase(0) .getNumberOfComponents(); p++) { setComponentConservationMatrix(p); Matrix sol4Old = sol4Matrix[p].copy(); diff --git a/src/main/java/neqsim/fluidmechanics/flowsolver/onephaseflowsolver/onephasepipeflowsolver/OnePhasePipeFlowSolver.java b/src/main/java/neqsim/fluidmechanics/flowsolver/onephaseflowsolver/onephasepipeflowsolver/OnePhasePipeFlowSolver.java index 67d2b49e1..0b690d6cd 100644 --- a/src/main/java/neqsim/fluidmechanics/flowsolver/onephaseflowsolver/onephasepipeflowsolver/OnePhasePipeFlowSolver.java +++ b/src/main/java/neqsim/fluidmechanics/flowsolver/onephaseflowsolver/onephasepipeflowsolver/OnePhasePipeFlowSolver.java @@ -59,9 +59,8 @@ public OnePhasePipeFlowSolver(PipeFlowSystem pipe, double length, int nodes) { solMatrix = new Matrix(PbArray, 1).transpose(); sol2Matrix = new Matrix(PbArray, 1).transpose(); sol3Matrix = new Matrix(PbArray, 1).transpose(); - sol4Matrix = new Matrix[pipe.getNode(0).getBulkSystem().getPhases()[0].getNumberOfComponents()]; - for (int k = 0; k < pipe.getNode(0).getBulkSystem().getPhases()[0] - .getNumberOfComponents(); k++) { + sol4Matrix = new Matrix[pipe.getNode(0).getBulkSystem().getPhase(0).getNumberOfComponents()]; + for (int k = 0; k < pipe.getNode(0).getBulkSystem().getPhase(0).getNumberOfComponents(); k++) { sol4Matrix[k] = new Matrix(PbArray, 1).transpose(); } a = new double[nodes]; 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 89bc531d9..13df7fbf0 100644 --- a/src/main/java/neqsim/fluidmechanics/flowsolver/twophaseflowsolver/stirredcellsolver/StirredCellSolver.java +++ b/src/main/java/neqsim/fluidmechanics/flowsolver/twophaseflowsolver/stirredcellsolver/StirredCellSolver.java @@ -68,14 +68,13 @@ public StirredCellSolver(FlowSystemInterface pipe, double length, int nodes, boo oldMass = new double[2][nodes]; oldComp = new double[2][nodes]; oldImpuls = new double[2][nodes]; - diff4Matrix = - new Matrix[pipe.getNode(0).getBulkSystem().getPhases()[0].getNumberOfComponents()]; + diff4Matrix = new Matrix[pipe.getNode(0).getBulkSystem().getPhase(0).getNumberOfComponents()]; oldEnergy = new double[2][nodes]; oldVelocity = new double[2][nodes]; oldDensity = new double[2][nodes]; oldInternalEnergy = new double[2][nodes]; - oldComposition = new double[2][pipe.getNode(0).getBulkSystem().getPhases()[0] - .getNumberOfComponents()][nodes]; + oldComposition = + new double[2][pipe.getNode(0).getBulkSystem().getPhase(0).getNumberOfComponents()][nodes]; numberOfVelocityNodes = nodes; } @@ -102,9 +101,8 @@ public void initProfiles() { testOps.TPflash(); testOps.displayResult(); - double[][][] molDiff = - new double[numberOfNodes][2][pipe.getNode(0).getBulkSystem().getPhases()[0] - .getNumberOfComponents()]; + double[][][] molDiff = new double[numberOfNodes][2][pipe.getNode(0).getBulkSystem().getPhase(0) + .getNumberOfComponents()]; pipe.getNode(0).init(); pipe.getNode(0).calcFluxes(); @@ -112,7 +110,7 @@ public void initProfiles() { pipe.getNode(i).init(); pipe.getNode(i).calcFluxes(); - for (int componentNumber = 0; componentNumber < pipe.getNode(0).getBulkSystem().getPhases()[0] + for (int componentNumber = 0; componentNumber < pipe.getNode(0).getBulkSystem().getPhase(0) .getNumberOfComponents(); componentNumber++) { double liquidMolarRate = pipe.getNode(i).getFluidBoundary().getInterphaseMolarFlux(componentNumber) @@ -135,9 +133,9 @@ public void initProfiles() { molDiff[i][0][componentNumber] = molDiff[i - 1][0][componentNumber] + gasMolarRate; molDiff[i][1][componentNumber] = molDiff[i - 1][1][componentNumber] + liquidMolarRate; - pipe.getNode(i + 1).getBulkSystem().getPhases()[0].addMoles(componentNumber, + pipe.getNode(i + 1).getBulkSystem().getPhase(0).addMoles(componentNumber, molDiff[i][0][componentNumber]); - pipe.getNode(i + 1).getBulkSystem().getPhases()[1].addMoles(componentNumber, + pipe.getNode(i + 1).getBulkSystem().getPhase(1).addMoles(componentNumber, molDiff[i][1][componentNumber]); pipe.getNode(i + 1).getBulkSystem().getPhase(0) @@ -150,14 +148,14 @@ public void initProfiles() { pipe.getNode(i + 1).getBulkSystem().init_x_y(); pipe.getNode(i + 1).initFlowCalc(); - System.out.println( - "x " + pipe.getNode(i - 1).getBulkSystem().getPhases()[1].getComponent(0).getx()); - System.out.println( - "x " + pipe.getNode(i - 1).getBulkSystem().getPhases()[1].getComponent(1).getx()); - System.out.println( - "y " + pipe.getNode(i - 1).getBulkSystem().getPhases()[0].getComponent(0).getx()); - System.out.println( - "y " + pipe.getNode(i - 1).getBulkSystem().getPhases()[0].getComponent(1).getx()); + System.out + .println("x " + pipe.getNode(i - 1).getBulkSystem().getPhase(1).getComponent(0).getx()); + System.out + .println("x " + pipe.getNode(i - 1).getBulkSystem().getPhase(1).getComponent(1).getx()); + System.out + .println("y " + pipe.getNode(i - 1).getBulkSystem().getPhase(0).getComponent(0).getx()); + System.out + .println("y " + pipe.getNode(i - 1).getBulkSystem().getPhase(0).getComponent(1).getx()); } pipe.getNode(numberOfNodes - 1).init(); pipe.getNode(numberOfNodes - 1).calcFluxes(); @@ -173,12 +171,12 @@ public void initProfiles() { public void initMatrix() { for (int i = 0; i < numberOfNodes; i++) { pipe.getNode(i).init(); - double enthalpy0 = pipe.getNode(i).getBulkSystem().getPhases()[0].getEnthalpy() - / pipe.getNode(i).getBulkSystem().getPhases()[0].getNumberOfMolesInPhase() - / pipe.getNode(i).getBulkSystem().getPhases()[0].getMolarMass(); - double enthalpy1 = pipe.getNode(i).getBulkSystem().getPhases()[1].getEnthalpy() - / pipe.getNode(i).getBulkSystem().getPhases()[1].getNumberOfMolesInPhase() - / pipe.getNode(i).getBulkSystem().getPhases()[1].getMolarMass(); + double enthalpy0 = pipe.getNode(i).getBulkSystem().getPhase(0).getEnthalpy() + / pipe.getNode(i).getBulkSystem().getPhase(0).getNumberOfMolesInPhase() + / pipe.getNode(i).getBulkSystem().getPhase(0).getMolarMass(); + double enthalpy1 = pipe.getNode(i).getBulkSystem().getPhase(1).getEnthalpy() + / pipe.getNode(i).getBulkSystem().getPhase(1).getNumberOfMolesInPhase() + / pipe.getNode(i).getBulkSystem().getPhase(1).getMolarMass(); solMatrix[0].set(i, 0, pipe.getNode(i).getVelocityIn(0).doubleValue()); solMatrix[1].set(i, 0, pipe.getNode(i).getVelocityIn(1).doubleValue()); @@ -187,11 +185,11 @@ public void initMatrix() { sol3Matrix[1].set(i, 0, enthalpy1); solPhaseConsMatrix[0].set(i, 0, - pipe.getNode(i).getBulkSystem().getPhases()[0].getPhysicalProperties().getDensity()); + pipe.getNode(i).getBulkSystem().getPhase(0).getPhysicalProperties().getDensity()); solPhaseConsMatrix[1].set(i, 0, pipe.getNode(i).getPhaseFraction(1)); for (int phaseNum = 0; phaseNum < 2; phaseNum++) { - for (int j = 0; j < pipe.getNode(i).getBulkSystem().getPhases()[0] + for (int j = 0; j < pipe.getNode(i).getBulkSystem().getPhase(0) .getNumberOfComponents(); j++) { solMolFracMatrix[phaseNum][j].set(i, 0, pipe.getNode(i).getBulkSystem().getPhase(phaseNum).getComponent(j).getx() @@ -304,7 +302,7 @@ public void initComposition(int phaseNum, int comp) { * pipe.getNode(j).getBulkSystem().getPhase(phaseNum).getMolarMass() / pipe.getNode(j).getBulkSystem().getPhase(phaseNum).getComponents()[comp] .getMolarMass()); - // pipe.getNode(j).getBulkSystem().getPhases()[0].getComponent(p).getx() + + // pipe.getNode(j).getBulkSystem().getPhase(0).getComponent(p).getx() + // 0.5*diff4Matrix[p].get(j,0)); } @@ -331,12 +329,12 @@ public void initFinalResults(int phase) { for (int i = 0; i < numberOfNodes; i++) { oldVelocity[phase][i] = pipe.getNode(i).getVelocityIn().doubleValue(); oldDensity[phase][i] = - pipe.getNode(i).getBulkSystem().getPhases()[0].getPhysicalProperties().getDensity(); - oldInternalEnergy[phase][i] = pipe.getNode(i).getBulkSystem().getPhases()[0].getEnthalpy() - / pipe.getNode(i).getBulkSystem().getPhases()[0].getNumberOfMolesInPhase() - / pipe.getNode(i).getBulkSystem().getPhases()[0].getMolarMass(); + pipe.getNode(i).getBulkSystem().getPhase(0).getPhysicalProperties().getDensity(); + oldInternalEnergy[phase][i] = pipe.getNode(i).getBulkSystem().getPhase(0).getEnthalpy() + / pipe.getNode(i).getBulkSystem().getPhase(0).getNumberOfMolesInPhase() + / pipe.getNode(i).getBulkSystem().getPhase(0).getMolarMass(); - for (int j = 0; j < pipe.getNode(i).getBulkSystem().getPhases()[0] + for (int j = 0; j < pipe.getNode(i).getBulkSystem().getPhase(0) .getNumberOfComponents(); j++) { oldComposition[phase][j][i] = xNew[phase][j][i]; } 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 47cd5d93f..6aa38cb8c 100644 --- a/src/main/java/neqsim/fluidmechanics/flowsolver/twophaseflowsolver/twophasepipeflowsolver/TwoPhaseFixedStaggeredGridSolver.java +++ b/src/main/java/neqsim/fluidmechanics/flowsolver/twophaseflowsolver/twophasepipeflowsolver/TwoPhaseFixedStaggeredGridSolver.java @@ -66,14 +66,13 @@ public TwoPhaseFixedStaggeredGridSolver(FlowSystemInterface pipe, double length, oldMass = new double[2][nodes]; oldComp = new double[2][nodes]; oldImpuls = new double[2][nodes]; - diff4Matrix = - new Matrix[pipe.getNode(0).getBulkSystem().getPhases()[0].getNumberOfComponents()]; + diff4Matrix = new Matrix[pipe.getNode(0).getBulkSystem().getPhase(0).getNumberOfComponents()]; oldEnergy = new double[2][nodes]; oldVelocity = new double[2][nodes]; oldDensity = new double[2][nodes]; oldInternalEnergy = new double[2][nodes]; - oldComposition = new double[2][pipe.getNode(0).getBulkSystem().getPhases()[0] - .getNumberOfComponents()][nodes]; + oldComposition = + new double[2][pipe.getNode(0).getBulkSystem().getPhase(0).getNumberOfComponents()][nodes]; numberOfVelocityNodes = nodes; } @@ -97,9 +96,8 @@ public TwoPhaseFixedStaggeredGridSolver clone() { public void initProfiles() { // double err = 0, oldPres = 0, oldTemp = 0, dpdx = 0; - double[][][] molDiff = - new double[numberOfNodes][2][pipe.getNode(0).getBulkSystem().getPhases()[0] - .getNumberOfComponents()]; + double[][][] molDiff = new double[numberOfNodes][2][pipe.getNode(0).getBulkSystem().getPhase(0) + .getNumberOfComponents()]; pipe.getNode(0).getBulkSystem().initBeta(); pipe.getNode(0).getBulkSystem().init_x_y(); pipe.getNode(0).initFlowCalc(); @@ -126,7 +124,7 @@ public void initProfiles() { pipe.getNode(i + 1).getBulkSystem().getPhase(1) .setTemperature(pipe.getNode(i).getBulkSystem().getPhase(1).getTemperature() + liquid_dT); - for (int componentNumber = 0; componentNumber < pipe.getNode(0).getBulkSystem().getPhases()[0] + for (int componentNumber = 0; componentNumber < pipe.getNode(0).getBulkSystem().getPhase(0) .getNumberOfComponents(); componentNumber++) { double liquidMolarRate = pipe.getNode(i).getFluidBoundary().getInterphaseMolarFlux(componentNumber) @@ -140,9 +138,9 @@ public void initProfiles() { molDiff[i][0][componentNumber] = molDiff[i - 1][0][componentNumber] + gasMolarRate; molDiff[i][1][componentNumber] = molDiff[i - 1][1][componentNumber] + liquidMolarRate; - pipe.getNode(i + 1).getBulkSystem().getPhases()[0].addMoles(componentNumber, + pipe.getNode(i + 1).getBulkSystem().getPhase(0).addMoles(componentNumber, molDiff[i - 1][0][componentNumber]); - pipe.getNode(i + 1).getBulkSystem().getPhases()[1].addMoles(componentNumber, + pipe.getNode(i + 1).getBulkSystem().getPhase(1).addMoles(componentNumber, molDiff[i - 1][1][componentNumber]); } } @@ -161,22 +159,22 @@ public void initProfiles() { * getBulkSystem().getPressure())/((pipe.getNode(i+1).getGeometry(). * getNodeLength()+pipe.getNode(i).getGeometry().getNodeLength())*0.5); * pipe.getNode(i+1).getBulkSystem().setTemperature((4.0*12.0*(278.0 - - * pipe.getNode(i).getBulkSystem().getPhases()[0].getTemperature())/ - * (pipe.getNode(i+1).getBulkSystem().getPhases()[0].getCp()/pipe.getNode(i+1). - * getBulkSystem().getPhases()[0].getNumberOfMolesInPhase()/pipe.getNode(i+1). - * getBulkSystem().getPhases()[0].getMolarMass()*pipe.getNode(i+1).getVelocity() + * pipe.getNode(i).getBulkSystem().getPhase(0).getTemperature())/ + * (pipe.getNode(i+1).getBulkSystem().getPhase(0).getCp()/pipe.getNode(i+1). + * getBulkSystem().getPhase(0).getNumberOfMolesInPhase()/pipe.getNode(i+1). + * getBulkSystem().getPhase(0).getMolarMass()*pipe.getNode(i+1).getVelocity() * *pipe.getNode(i+1).getGeometry().getDiameter()*pipe.getNode(i+1). - * getBulkSystem().getPhases()[0].getDensity())+pipe.getNode(i+1).getBulkSystem( - * ).getPhases()[0].getJouleThomsonCoefficient()*dpdx)*(pipe.getNode(i+1). + * getBulkSystem().getPhase(0).getDensity())+pipe.getNode(i+1).getBulkSystem( + * ).getPhase(0).getJouleThomsonCoefficient()*dpdx)*(pipe.getNode(i+1). * getGeometry().getNodeLength()+pipe.getNode(i).getGeometry().getNodeLength())* 0.5 + * pipe.getNode(i).getBulkSystem().getTemperature()); pipe.getNode(i+1).init(); * * // setting pressures oldPres = pipe.getNode(i+1).getBulkSystem().getPressure(); * pipe.getNode(i+1).getBulkSystem().setPressure(-pipe.getNode(i). getWallFrictionFactor()* - * pipe.getNode(i).getBulkSystem().getPhases()[0].getDensity()*pipe.velocity[i]* + * pipe.getNode(i).getBulkSystem().getPhase(0).getDensity()*pipe.velocity[i]* * pipe.velocity[i]/pipe.getNode(i).getGeometry().getDiameter()/2.0*(pipe. * getNode(i).getGeometry().getNodeLength())/1e5 - - * gravity*pipe.getNode(i).getBulkSystem().getPhases()[0].getDensity()*(pipe. + * gravity*pipe.getNode(i).getBulkSystem().getPhase(0).getDensity()*(pipe. * getNode(i+1).getVerticalPositionOfNode() - pipe.getNode(i).getVerticalPositionOfNode() )/1e5 * + pipe.getNode(i).getBulkSystem().getPressure()); err = * err+(oldPres-pipe.getNode(i+1).getBulkSystem().getPressure()); pipe.getNode(i+1).init(); // @@ -194,12 +192,12 @@ public void initProfiles() { public void initMatrix() { for (int i = 0; i < numberOfNodes; i++) { pipe.getNode(i).init(); - double enthalpy0 = pipe.getNode(i).getBulkSystem().getPhases()[0].getEnthalpy() - / pipe.getNode(i).getBulkSystem().getPhases()[0].getNumberOfMolesInPhase() - / pipe.getNode(i).getBulkSystem().getPhases()[0].getMolarMass(); - double enthalpy1 = pipe.getNode(i).getBulkSystem().getPhases()[1].getEnthalpy() - / pipe.getNode(i).getBulkSystem().getPhases()[1].getNumberOfMolesInPhase() - / pipe.getNode(i).getBulkSystem().getPhases()[1].getMolarMass(); + double enthalpy0 = pipe.getNode(i).getBulkSystem().getPhase(0).getEnthalpy() + / pipe.getNode(i).getBulkSystem().getPhase(0).getNumberOfMolesInPhase() + / pipe.getNode(i).getBulkSystem().getPhase(0).getMolarMass(); + double enthalpy1 = pipe.getNode(i).getBulkSystem().getPhase(1).getEnthalpy() + / pipe.getNode(i).getBulkSystem().getPhase(1).getNumberOfMolesInPhase() + / pipe.getNode(i).getBulkSystem().getPhase(1).getMolarMass(); solMatrix[0].set(i, 0, pipe.getNode(i).getVelocityIn(0).doubleValue()); solMatrix[1].set(i, 0, pipe.getNode(i).getVelocityIn(1).doubleValue()); @@ -208,11 +206,11 @@ public void initMatrix() { sol3Matrix[1].set(i, 0, enthalpy1); solPhaseConsMatrix[0].set(i, 0, - pipe.getNode(i).getBulkSystem().getPhases()[0].getPhysicalProperties().getDensity()); + pipe.getNode(i).getBulkSystem().getPhase(0).getPhysicalProperties().getDensity()); solPhaseConsMatrix[1].set(i, 0, pipe.getNode(i).getPhaseFraction(1)); for (int phaseNum = 0; phaseNum < 2; phaseNum++) { - for (int j = 0; j < pipe.getNode(i).getBulkSystem().getPhases()[0] + for (int j = 0; j < pipe.getNode(i).getBulkSystem().getPhase(0) .getNumberOfComponents(); j++) { solMolFracMatrix[phaseNum][j].set(i, 0, pipe.getNode(i).getBulkSystem().getPhase(phaseNum).getComponent(j).getx() @@ -325,7 +323,7 @@ public void initComposition(int phaseNum, int comp) { * pipe.getNode(j).getBulkSystem().getPhase(phaseNum).getMolarMass() / pipe.getNode(j).getBulkSystem().getPhase(phaseNum).getComponents()[comp] .getMolarMass()); - // pipe.getNode(j).getBulkSystem().getPhases()[0].getComponent(p).getx() + // pipe.getNode(j).getBulkSystem().getPhase(0).getComponent(p).getx() // + 0.5*diff4Matrix[p].get(j,0)); } @@ -785,9 +783,9 @@ public void setComponentConservationMatrix2(int phaseNum, int componentNumber) { c[0] = 0; SU = pipe.getNode(0).getBulkSystem().getPhase(phaseNum).getComponents()[componentNumber].getx(); // System.out.println("phase x0: " - // +pipe.getNode(0).getBulkSystem().getPhases()[0].getComponents()[componentNumber].getx()); + // +pipe.getNode(0).getBulkSystem().getPhase(0).getComponents()[componentNumber].getx()); // System.out.println("phase x1: " - // +pipe.getNode(0).getBulkSystem().getPhases()[1].getComponents()[componentNumber].getx()); + // +pipe.getNode(0).getBulkSystem().getPhase(1).getComponents()[componentNumber].getx()); r[0] = SU; for (int i = 1; i < numberOfNodes - 1; i++) { @@ -952,17 +950,17 @@ public void initFinalResults(int phase) { for (int i = 0; i < numberOfNodes; i++) { oldVelocity[phase][i] = pipe.getNode(i).getVelocityIn().doubleValue(); oldDensity[phase][i] = - pipe.getNode(i).getBulkSystem().getPhases()[0].getPhysicalProperties().getDensity(); - oldInternalEnergy[phase][i] = pipe.getNode(i).getBulkSystem().getPhases()[0].getEnthalpy() - / pipe.getNode(i).getBulkSystem().getPhases()[0].getNumberOfMolesInPhase() - / pipe.getNode(i).getBulkSystem().getPhases()[0].getMolarMass(); + pipe.getNode(i).getBulkSystem().getPhase(0).getPhysicalProperties().getDensity(); + oldInternalEnergy[phase][i] = pipe.getNode(i).getBulkSystem().getPhase(0).getEnthalpy() + / pipe.getNode(i).getBulkSystem().getPhase(0).getNumberOfMolesInPhase() + / pipe.getNode(i).getBulkSystem().getPhase(0).getMolarMass(); - for (int j = 0; j < pipe.getNode(i).getBulkSystem().getPhases()[0] + for (int j = 0; j < pipe.getNode(i).getBulkSystem().getPhase(0) .getNumberOfComponents(); j++) { oldComposition[phase][j][i] = xNew[phase][j][i]; - // 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(); + // pipe.getNode(i).getBulkSystem().getPhase(0).getComponent(j).getx() * + // pipe.getNode(i).getBulkSystem().getPhase(0).getComponent(j).getMolarMass() / + // pipe.getNode(i).getBulkSystem().getPhase(0).getMolarMass(); } } } @@ -1000,9 +998,9 @@ public void solveTDMA() { double diff = 0; System.out.println("starting...:"); initProfiles(); - dn = new double[numberOfNodes][pipe.getNode(0).getBulkSystem().getPhases()[0] + dn = new double[numberOfNodes][pipe.getNode(0).getBulkSystem().getPhase(0) .getNumberOfComponents()]; - xNew = new double[2][pipe.getNode(0).getBulkSystem().getPhases()[0] + xNew = new double[2][pipe.getNode(0).getBulkSystem().getPhase(0) .getNumberOfComponents()][numberOfNodes]; initMatrix(); @@ -1103,8 +1101,8 @@ public void solveTDMA() { compIter++; for (int phaseNum = 0; phaseNum < 2; phaseNum++) { iter = 0; - for (int p = 0; p < pipe.getNode(0).getBulkSystem().getPhases()[0] - .getNumberOfComponents() - 1; p++) { + for (int p = 0; p < pipe.getNode(0).getBulkSystem().getPhase(0).getNumberOfComponents() + - 1; p++) { do { iter++; setComponentConservationMatrix(phaseNum, p); @@ -1137,7 +1135,7 @@ public void solveTDMA() { } while (Math.abs(maxDiff) > 1e-7 && iterTop < 1); // diffMatrix.norm2()/sol2Matrix.norm2())>0.1); for (int phaseNum = 0; phaseNum < 2; phaseNum++) { - for (int p = 0; p < pipe.getNode(0).getBulkSystem().getPhases()[0].getNumberOfComponents() + for (int p = 0; p < pipe.getNode(0).getBulkSystem().getPhase(0).getNumberOfComponents() - 1; p++) { Matrix dmat = new Matrix(xNew[phaseNum][p], 1); dmat.print(10, 10); diff --git a/src/main/java/neqsim/fluidmechanics/flowsolver/twophaseflowsolver/twophasepipeflowsolver/TwoPhasePipeFlowSolver.java b/src/main/java/neqsim/fluidmechanics/flowsolver/twophaseflowsolver/twophasepipeflowsolver/TwoPhasePipeFlowSolver.java index 3e85c7140..963496013 100644 --- a/src/main/java/neqsim/fluidmechanics/flowsolver/twophaseflowsolver/twophasepipeflowsolver/TwoPhasePipeFlowSolver.java +++ b/src/main/java/neqsim/fluidmechanics/flowsolver/twophaseflowsolver/twophasepipeflowsolver/TwoPhasePipeFlowSolver.java @@ -56,11 +56,11 @@ public TwoPhasePipeFlowSolver(FlowSystemInterface pipe, double length, int nodes sol3Matrix = new Matrix[2]; solPhaseConsMatrix = new Matrix[2]; solMolFracMatrix = - new Matrix[2][pipe.getNode(0).getBulkSystem().getPhases()[0].getNumberOfComponents()]; + new Matrix[2][pipe.getNode(0).getBulkSystem().getPhase(0).getNumberOfComponents()]; solMatrix[0] = new Matrix(PbArray, 1).transpose(); solMatrix[1] = new Matrix(PbArray, 1).transpose(); for (int phaseNum = 0; phaseNum < 2; phaseNum++) { - for (int i = 0; i < pipe.getNode(0).getBulkSystem().getPhases()[0] + for (int i = 0; i < pipe.getNode(0).getBulkSystem().getPhase(0) .getNumberOfComponents(); i++) { solMolFracMatrix[phaseNum][i] = new Matrix(PbArray, 1).transpose(); } diff --git a/src/main/java/neqsim/fluidmechanics/flowsystem/FlowSystem.java b/src/main/java/neqsim/fluidmechanics/flowsystem/FlowSystem.java index 31e43cffa..5aa2f1fee 100644 --- a/src/main/java/neqsim/fluidmechanics/flowsystem/FlowSystem.java +++ b/src/main/java/neqsim/fluidmechanics/flowsystem/FlowSystem.java @@ -306,12 +306,12 @@ public double[] getLegHeights() { public void print() { for (int i = 0; i < getTotalNumberOfNodes() - 1; i++) { System.out.println("node " + flowNode[i].getDistanceToCenterOfNode() + " pressure: " - + flowNode[i].getBulkSystem().getPhases()[0].getPressure() + " temperature: " - + flowNode[i].getBulkSystem().getPhases()[1].getTemperature() + " flow: " + + flowNode[i].getBulkSystem().getPhase(0).getPressure() + " temperature: " + + flowNode[i].getBulkSystem().getPhase(1).getTemperature() + " flow: " + flowNode[i].getMassFlowRate(0) + " velocity: " + flowNode[i].getVelocity() + " reynolds number " + flowNode[i].getReynoldsNumber() + " friction : " + flowNode[i].getWallFrictionFactor() + " x1 : " - + flowNode[i].getBulkSystem().getPhases()[0].getComponent(1).getx()); + + flowNode[i].getBulkSystem().getPhase(0).getComponent(1).getx()); } } diff --git a/src/main/java/neqsim/fluidmechanics/util/fluidmechanicsvisualization/flownodevisualization/FlowNodeVisualization.java b/src/main/java/neqsim/fluidmechanics/util/fluidmechanicsvisualization/flownodevisualization/FlowNodeVisualization.java index 181c90c7d..3a599e01a 100644 --- a/src/main/java/neqsim/fluidmechanics/util/fluidmechanicsvisualization/flownodevisualization/FlowNodeVisualization.java +++ b/src/main/java/neqsim/fluidmechanics/util/fluidmechanicsvisualization/flownodevisualization/FlowNodeVisualization.java @@ -41,17 +41,17 @@ public FlowNodeVisualization() {} /** {@inheritDoc} */ @Override public void setData(FlowNodeInterface node) { - temperature[0] = node.getBulkSystem().getPhases()[0].getTemperature(); - temperature[1] = node.getBulkSystem().getPhases()[1].getTemperature(); - pressure[0] = node.getBulkSystem().getPhases()[0].getPressure(); - pressure[1] = node.getBulkSystem().getPhases()[1].getPressure(); + temperature[0] = node.getBulkSystem().getPhase(0).getTemperature(); + temperature[1] = node.getBulkSystem().getPhase(1).getTemperature(); + pressure[0] = node.getBulkSystem().getPhase(0).getPressure(); + pressure[1] = node.getBulkSystem().getPhase(1).getPressure(); velocity[0] = node.getVelocity(0); velocity[1] = node.getVelocity(1); reynoldsNumber[0] = node.getReynoldsNumber(0); interphaseContactLength = node.getInterphaseContactLength(0); wallContactLength[0] = node.getWallContactLength(0); wallContactLength[1] = node.getWallContactLength(1); - numberOfComponents = node.getBulkSystem().getPhases()[0].getNumberOfComponents(); + numberOfComponents = node.getBulkSystem().getPhase(0).getNumberOfComponents(); nodeCenter = node.getDistanceToCenterOfNode(); } 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 72fe0f7dc..5af8a53a6 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 @@ -29,10 +29,10 @@ public OnePhasePipeFlowNodeVisualization() {} @Override public void setData(FlowNodeInterface node) { super.setData(node); - bulkComposition = new double[2][node.getBulkSystem().getPhases()[0].getNumberOfComponents()]; + bulkComposition = new double[2][node.getBulkSystem().getPhase(0).getNumberOfComponents()]; - for (int i = 0; i < node.getBulkSystem().getPhases()[0].getNumberOfComponents(); i++) { - bulkComposition[0][i] = node.getBulkSystem().getPhases()[0].getComponent(i).getx(); + for (int i = 0; i < node.getBulkSystem().getPhase(0).getNumberOfComponents(); i++) { + bulkComposition[0][i] = node.getBulkSystem().getPhase(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 262652a75..49d2dd8f3 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 @@ -23,18 +23,17 @@ public TwoPhaseFlowNodeVisualization() {} @Override public void setData(FlowNodeInterface node) { super.setData(node); - bulkComposition = new double[2][node.getBulkSystem().getPhases()[0].getNumberOfComponents()]; + bulkComposition = new double[2][node.getBulkSystem().getPhase(0).getNumberOfComponents()]; effectiveMassTransferCoefficient = - new double[2][node.getBulkSystem().getPhases()[0].getNumberOfComponents()]; + new double[2][node.getBulkSystem().getPhase(0).getNumberOfComponents()]; effectiveSchmidtNumber = - new double[2][node.getBulkSystem().getPhases()[0].getNumberOfComponents()]; - interfaceComposition = - new double[2][node.getBulkSystem().getPhases()[0].getNumberOfComponents()]; - molarFlux = new double[2][node.getBulkSystem().getPhases()[0].getNumberOfComponents()]; + new double[2][node.getBulkSystem().getPhase(0).getNumberOfComponents()]; + interfaceComposition = new double[2][node.getBulkSystem().getPhase(0).getNumberOfComponents()]; + molarFlux = new double[2][node.getBulkSystem().getPhase(0).getNumberOfComponents()]; - for (int i = 0; i < node.getBulkSystem().getPhases()[0].getNumberOfComponents(); i++) { - bulkComposition[0][i] = node.getBulkSystem().getPhases()[0].getComponent(i).getx(); - bulkComposition[1][i] = node.getBulkSystem().getPhases()[1].getComponent(i).getx(); + for (int i = 0; i < node.getBulkSystem().getPhase(0).getNumberOfComponents(); i++) { + bulkComposition[0][i] = node.getBulkSystem().getPhase(0).getComponent(i).getx(); + bulkComposition[1][i] = node.getBulkSystem().getPhase(1).getComponent(i).getx(); effectiveMassTransferCoefficient[1][i] = node.getFluidBoundary().getEffectiveMassTransferCoefficient(1, i); effectiveMassTransferCoefficient[0][i] = @@ -43,9 +42,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].getComponent(i).getx(); + node.getFluidBoundary().getInterphaseSystem().getPhase(0).getComponent(i).getx(); interfaceComposition[1][i] = - node.getFluidBoundary().getInterphaseSystem().getPhases()[1].getComponent(i).getx(); + node.getFluidBoundary().getInterphaseSystem().getPhase(1).getComponent(i).getx(); molarFlux[0][i] = node.getFluidBoundary().getInterphaseMolarFlux(i); molarFlux[1][i] = node.getFluidBoundary().getInterphaseMolarFlux(i); } @@ -55,8 +54,8 @@ public void setData(FlowNodeInterface node) { phaseFraction[0] = node.getPhaseFraction(0); phaseFraction[1] = node.getPhaseFraction(1); interfaceTemperature[0] = - node.getFluidBoundary().getInterphaseSystem().getPhases()[0].getTemperature(); + node.getFluidBoundary().getInterphaseSystem().getPhase(0).getTemperature(); interfaceTemperature[1] = - node.getFluidBoundary().getInterphaseSystem().getPhases()[1].getTemperature(); + node.getFluidBoundary().getInterphaseSystem().getPhase(1).getTemperature(); } } diff --git a/src/main/java/neqsim/mathlib/nonlinearsolver/SysNewtonRhapson.java b/src/main/java/neqsim/mathlib/nonlinearsolver/SysNewtonRhapson.java index 2d4f86719..8e30b49c7 100644 --- a/src/main/java/neqsim/mathlib/nonlinearsolver/SysNewtonRhapson.java +++ b/src/main/java/neqsim/mathlib/nonlinearsolver/SysNewtonRhapson.java @@ -86,13 +86,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].getComponent(i).getFugacityCoefficient() - / system.getPhases()[0].getComponent(i).getFugacityCoefficient())); + u.get(i, 0) + Math.log(system.getPhase(1).getComponent(i).getFugacityCoefficient() + / system.getPhase(0).getComponent(i).getFugacityCoefficient())); } double fsum = 0.0; for (int i = 0; i < numberOfComponents; i++) { - fsum = fsum + system.getPhases()[1].getComponent(i).getx() - - system.getPhases()[0].getComponent(i).getx(); + fsum = fsum + system.getPhase(1).getComponent(i).getx() + - system.getPhase(0).getComponent(i).getx(); } fvec.set(numberOfComponents, 0, fsum); fvec.set(numberOfComponents + 1, 0, 0.0); @@ -110,17 +110,17 @@ public void findSpecEqInit() { int speceqmin = 0; for (int i = 0; i < numberOfComponents; i++) { - if (system.getPhases()[0].getComponent(i).getTC() > system.getPhases()[0].getComponent(speceq) + if (system.getPhase(0).getComponent(i).getTC() > system.getPhase(0).getComponent(speceq) .getTC()) { - speceq = system.getPhases()[0].getComponent(i).getComponentNumber(); + speceq = system.getPhase(0).getComponent(i).getComponentNumber(); } - if (system.getPhases()[0].getComponent(i).getTC() < system.getPhases()[0].getComponent(speceq) + if (system.getPhase(0).getComponent(i).getTC() < system.getPhase(0).getComponent(speceq) .getTC()) { - speceqmin = system.getPhases()[0].getComponent(i).getComponentNumber(); + speceqmin = system.getPhase(0).getComponent(i).getComponentNumber(); } } - avscp = (system.getPhases()[0].getComponent(speceq).getTC() - - system.getPhases()[0].getComponent(speceqmin).getTC()) / 2000; + avscp = (system.getPhase(0).getComponent(speceq).getTC() + - system.getPhase(0).getComponent(speceqmin).getTC()) / 2000; System.out.println("avscp: " + avscp); dTmax = avscp * 3; dPmax = avscp * 1.5; @@ -154,26 +154,25 @@ public void setJac() { double tempJ = 0.0; int nofc = numberOfComponents; for (int i = 0; i < numberOfComponents; 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]; + dxidlnk[i] = -system.getBeta() * system.getPhase(0).getComponent(i).getx() + * system.getPhase(1).getComponent(i).getx() / system.getPhase(0).getComponent(i).getz(); + dyidlnk[i] = system.getPhase(1).getComponent(i).getx() + + system.getPhase(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].getComponent(i).getdfugdx(j) * dyidlnk[j] - - system.getPhases()[0].getComponent(i).getdfugdx(j) * dxidlnk[j]; + tempJ = dij + system.getPhase(1).getComponent(i).getdfugdx(j) * dyidlnk[j] + - system.getPhase(0).getComponent(i).getdfugdx(j) * dxidlnk[j]; Jac.set(i, j, tempJ); } - tempJ = system.getTemperature() * (system.getPhases()[1].getComponent(i).getdfugdt() - - system.getPhases()[0].getComponent(i).getdfugdt()); + tempJ = system.getTemperature() * (system.getPhase(1).getComponent(i).getdfugdt() + - system.getPhase(0).getComponent(i).getdfugdt()); Jac.set(i, nofc, tempJ); - tempJ = system.getPressure() * (system.getPhases()[1].getComponent(i).getdfugdp() - - system.getPhases()[0].getComponent(i).getdfugdp()); + tempJ = system.getPressure() * (system.getPhase(1).getComponent(i).getdfugdp() + - system.getPhase(0).getComponent(i).getdfugdp()); Jac.set(i, nofc + 1, tempJ); Jac.set(nofc, i, dyidlnk[i] - dxidlnk[i]); } @@ -187,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].getComponent(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())); @@ -200,8 +199,8 @@ public void setu() { */ public void init() { for (int i = 0; i < numberOfComponents; i++) { - 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.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/physicalproperties/interfaceproperties/surfacetension/FirozabadiRamleyInterfaceTension.java b/src/main/java/neqsim/physicalproperties/interfaceproperties/surfacetension/FirozabadiRamleyInterfaceTension.java index 42c5ebdbe..08faccc1d 100644 --- a/src/main/java/neqsim/physicalproperties/interfaceproperties/surfacetension/FirozabadiRamleyInterfaceTension.java +++ b/src/main/java/neqsim/physicalproperties/interfaceproperties/surfacetension/FirozabadiRamleyInterfaceTension.java @@ -41,13 +41,13 @@ public FirozabadiRamleyInterfaceTension(SystemInterface system) { @Override public double calcPureComponentSurfaceTension(int componentNumber) { return 1.0e-3 * Math - .pow(system.getPhases()[0].getComponents()[componentNumber].getParachorParameter() * 1.0e-6 - * (system.getPhases()[1].getPhysicalProperties().getDensity() - / system.getPhases()[1].getMolarMass() - * system.getPhases()[1].getComponents()[componentNumber].getx() - - system.getPhases()[0].getPhysicalProperties().getDensity() - / system.getPhases()[0].getMolarMass() - * system.getPhases()[0].getComponents()[componentNumber].getx()), + .pow(system.getPhase(0).getComponents()[componentNumber].getParachorParameter() * 1.0e-6 + * (system.getPhase(1).getPhysicalProperties().getDensity() + / system.getPhase(1).getMolarMass() + * system.getPhase(1).getComponents()[componentNumber].getx() + - system.getPhase(0).getPhysicalProperties().getDensity() + / system.getPhase(0).getMolarMass() + * system.getPhase(0).getComponents()[componentNumber].getx()), 4.0); } diff --git a/src/main/java/neqsim/physicalproperties/interfaceproperties/surfacetension/ParachorSurfaceTension.java b/src/main/java/neqsim/physicalproperties/interfaceproperties/surfacetension/ParachorSurfaceTension.java index 0e36241e7..3d8fc459a 100644 --- a/src/main/java/neqsim/physicalproperties/interfaceproperties/surfacetension/ParachorSurfaceTension.java +++ b/src/main/java/neqsim/physicalproperties/interfaceproperties/surfacetension/ParachorSurfaceTension.java @@ -40,15 +40,14 @@ public ParachorSurfaceTension(SystemInterface system) { */ @Override public double calcPureComponentSurfaceTension(int componentNumber) { - return 1.0e-3 * Math.pow(system.getPhases()[0].getComponents()[componentNumber] - .getParachorParameter() - * 1.0e-6 - * (system.getPhases()[1].getPhysicalProperties().getDensity() - / system.getPhases()[1].getMolarMass() - * system.getPhases()[1].getComponents()[componentNumber].getx() - - system.getPhases()[0].getPhysicalProperties().getDensity() - / system.getPhases()[0].getMolarMass() - * system.getPhases()[0].getComponents()[componentNumber].getx()), + return 1.0e-3 * Math + .pow(system.getPhase(0).getComponents()[componentNumber].getParachorParameter() * 1.0e-6 + * (system.getPhase(1).getPhysicalProperties().getDensity() + / system.getPhase(1).getMolarMass() + * system.getPhase(1).getComponents()[componentNumber].getx() + - system.getPhase(0).getPhysicalProperties().getDensity() + / system.getPhase(0).getMolarMass() + * system.getPhase(0).getComponents()[componentNumber].getx()), 4.0); } @@ -68,7 +67,7 @@ public double calcSurfaceTension(int interface1, int interface2) { // if(interface1>=2 || interface2>=2) return 0.0; // return 0.0; try { - for (int i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { + for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { // System.out.println("density1 parachor " + // system.getPhase(interface1).getPhysicalProperties().getDensity()); // System.out.println("density2 parachor " + diff --git a/src/main/java/neqsim/physicalproperties/util/parameterfitting/purecomponentparameterfitting/purecompinterfacetension/ParachorFunction.java b/src/main/java/neqsim/physicalproperties/util/parameterfitting/purecomponentparameterfitting/purecompinterfacetension/ParachorFunction.java index 53b513eb0..e66e48f0c 100644 --- a/src/main/java/neqsim/physicalproperties/util/parameterfitting/purecomponentparameterfitting/purecompinterfacetension/ParachorFunction.java +++ b/src/main/java/neqsim/physicalproperties/util/parameterfitting/purecomponentparameterfitting/purecompinterfacetension/ParachorFunction.java @@ -41,7 +41,7 @@ public double calcValue(double[] dependentValues) { @Override public void setFittingParams(int i, double value) { params[i] = value; - system.getPhases()[0].getComponent(0).setParachorParameter(value); - system.getPhases()[1].getComponent(0).setParachorParameter(value); + system.getPhase(0).getComponent(0).setParachorParameter(value); + system.getPhase(1).getComponent(0).setParachorParameter(value); } } 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 40281c278..98fd649a6 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 @@ -26,14 +26,14 @@ public double calcValue(double[] dependentValues) { system.setTemperature(dependentValues[0]); system.init(1); system.initPhysicalProperties(); - return system.getPhases()[1].getPhysicalProperties().getViscosity(); + return system.getPhase(1).getPhysicalProperties().getViscosity(); } /** {@inheritDoc} */ @Override public void setFittingParams(int i, double value) { params[i] = value; - system.getPhases()[0].getComponent(i).setViscosityAssociationFactor(value); - system.getPhases()[1].getComponent(i).setViscosityAssociationFactor(value); + system.getPhase(0).getComponent(i).setViscosityAssociationFactor(value); + system.getPhase(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 ba51ae057..68672bcd0 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 @@ -29,14 +29,14 @@ public ViscosityFunction() {} public double calcValue(double[] dependentValues) { system.init(1); system.initPhysicalProperties(); - return system.getPhases()[1].getPhysicalProperties().getViscosity() * 1e3; + return system.getPhase(1).getPhysicalProperties().getViscosity() * 1e3; } /** {@inheritDoc} */ @Override public void setFittingParams(int i, double value) { params[i] = value; - system.getPhases()[0].getComponent(0).setLiquidViscosityParameter(value, i); - system.getPhases()[1].getComponent(0).setLiquidViscosityParameter(value, i); + system.getPhase(0).getComponent(0).setLiquidViscosityParameter(value, i); + system.getPhase(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 198dbd30a..b0dd67a3c 100644 --- a/src/main/java/neqsim/process/equipment/absorber/SimpleTEGAbsorber.java +++ b/src/main/java/neqsim/process/equipment/absorber/SimpleTEGAbsorber.java @@ -126,24 +126,24 @@ public void mixStream() { String compName = new String(); for (int k = 1; k < streams.size(); k++) { - for (int i = 0; i < streams.get(k).getThermoSystem().getPhases()[0] + for (int i = 0; i < streams.get(k).getThermoSystem().getPhase(0) .getNumberOfComponents(); i++) { boolean gotComponent = false; String componentName = - streams.get(k).getThermoSystem().getPhases()[0].getComponent(i).getName(); + streams.get(k).getThermoSystem().getPhase(0).getComponent(i).getName(); // System.out.println("adding: " + componentName); double moles = - streams.get(k).getThermoSystem().getPhases()[0].getComponent(i).getNumberOfmoles(); + streams.get(k).getThermoSystem().getPhase(0).getComponent(i).getNumberOfmoles(); // System.out.println("moles: " + moles + " " + - // mixedStream.getThermoSystem().getPhases()[0].getNumberOfComponents()); - for (int p = 0; p < mixedStream.getThermoSystem().getPhases()[0] + // mixedStream.getThermoSystem().getPhase(0).getNumberOfComponents()); + for (int p = 0; p < mixedStream.getThermoSystem().getPhase(0) .getNumberOfComponents(); p++) { - if (mixedStream.getThermoSystem().getPhases()[0].getComponent(p).getName() + if (mixedStream.getThermoSystem().getPhase(0).getComponent(p).getName() .equals(componentName)) { gotComponent = true; - compName = streams.get(0).getThermoSystem().getPhases()[0].getComponent(p) - .getComponentName(); + compName = + streams.get(0).getThermoSystem().getPhase(0).getComponent(p).getComponentName(); } } @@ -369,14 +369,14 @@ public void run(UUID id) { // stream.getThermoSystem().display(); SystemInterface tempSystem = mixedStream.getThermoSystem().clone(); - SystemInterface gasTemp = tempSystem.phaseToSystem(tempSystem.getPhases()[0]); + SystemInterface gasTemp = tempSystem.phaseToSystem(tempSystem.getPhase(0)); gasTemp.init(2); gasOutStream.setThermoSystem(gasTemp); // System.out.println("gas total number of water " + // gasOutStream.getFluid().getPhase(0).getComponent("water").getNumberOfmoles()); tempSystem = mixedStream.getThermoSystem().clone(); - SystemInterface liqTemp = tempSystem.phaseToSystem(tempSystem.getPhases()[1]); + SystemInterface liqTemp = tempSystem.phaseToSystem(tempSystem.getPhase(1)); liqTemp.init(2); solventOutStream.setThermoSystem(liqTemp); // System.out.println("solvent total number of water " + @@ -447,74 +447,73 @@ public void displayResult() { 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].getComponent(j).getName(); + for (int j = 0; j < thermoSystem.getPhase(0).getNumberOfComponents(); j++) { + table[j + 1][0] = thermoSystem.getPhase(0).getComponent(j).getName(); buf = new StringBuffer(); table[j + 1][i + 1] = - nf.format(thermoSystem.getPhases()[i].getComponent(j).getx(), buf, test).toString(); + nf.format(thermoSystem.getPhase(i).getComponent(j).getx(), buf, test).toString(); table[j + 1][4] = "[-]"; } buf = new StringBuffer(); - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 2][0] = "Density"; - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 2][i + 1] = - nf.format(thermoSystem.getPhases()[i].getPhysicalProperties().getDensity(), buf, test) + table[thermoSystem.getPhase(0).getNumberOfComponents() + 2][0] = "Density"; + table[thermoSystem.getPhase(0).getNumberOfComponents() + 2][i + 1] = + nf.format(thermoSystem.getPhase(i).getPhysicalProperties().getDensity(), buf, test) .toString(); - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 2][4] = "[kg/m^3]"; + table[thermoSystem.getPhase(0).getNumberOfComponents() + 2][4] = "[kg/m^3]"; - // Double.longValue(thermoSystem.getPhases()[i].getBeta()); + // Double.longValue(thermoSystem.getPhase(i).getBeta()); buf = new StringBuffer(); - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 3][0] = "PhaseFraction"; - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 3][i + 1] = - nf.format(thermoSystem.getPhases()[i].getBeta(), buf, test).toString(); - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 3][4] = "[-]"; + table[thermoSystem.getPhase(0).getNumberOfComponents() + 3][0] = "PhaseFraction"; + table[thermoSystem.getPhase(0).getNumberOfComponents() + 3][i + 1] = + nf.format(thermoSystem.getPhase(i).getBeta(), buf, test).toString(); + table[thermoSystem.getPhase(0).getNumberOfComponents() + 3][4] = "[-]"; buf = new StringBuffer(); - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 4][0] = "MolarMass"; - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 4][i + 1] = - nf.format(thermoSystem.getPhases()[i].getMolarMass() * 1000, buf, test).toString(); - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 4][4] = "[kg/kmol]"; + table[thermoSystem.getPhase(0).getNumberOfComponents() + 4][0] = "MolarMass"; + table[thermoSystem.getPhase(0).getNumberOfComponents() + 4][i + 1] = + nf.format(thermoSystem.getPhase(i).getMolarMass() * 1000, buf, test).toString(); + table[thermoSystem.getPhase(0).getNumberOfComponents() + 4][4] = "[kg/kmol]"; buf = new StringBuffer(); - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 5][0] = "Cp"; - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 5][i + 1] = - nf.format((thermoSystem.getPhases()[i].getCp() - / (thermoSystem.getPhases()[i].getNumberOfMolesInPhase() - * thermoSystem.getPhases()[i].getMolarMass() * 1000)), - buf, test).toString(); - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 5][4] = "[kJ/kg*K]"; + table[thermoSystem.getPhase(0).getNumberOfComponents() + 5][0] = "Cp"; + table[thermoSystem.getPhase(0).getNumberOfComponents() + 5][i + 1] = nf.format( + (thermoSystem.getPhase(i).getCp() / (thermoSystem.getPhase(i).getNumberOfMolesInPhase() + * thermoSystem.getPhase(i).getMolarMass() * 1000)), + buf, test).toString(); + table[thermoSystem.getPhase(0).getNumberOfComponents() + 5][4] = "[kJ/kg*K]"; buf = new StringBuffer(); - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 7][0] = "Viscosity"; - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 7][i + 1] = - nf.format((thermoSystem.getPhases()[i].getPhysicalProperties().getViscosity()), buf, test) + table[thermoSystem.getPhase(0).getNumberOfComponents() + 7][0] = "Viscosity"; + table[thermoSystem.getPhase(0).getNumberOfComponents() + 7][i + 1] = + nf.format((thermoSystem.getPhase(i).getPhysicalProperties().getViscosity()), buf, test) .toString(); - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 7][4] = "[kg/m*sec]"; + table[thermoSystem.getPhase(0).getNumberOfComponents() + 7][4] = "[kg/m*sec]"; buf = new StringBuffer(); - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 8][0] = "Conductivity"; - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 8][i + 1] = nf - .format(thermoSystem.getPhases()[i].getPhysicalProperties().getConductivity(), buf, test) - .toString(); - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 8][4] = "[W/m*K]"; + table[thermoSystem.getPhase(0).getNumberOfComponents() + 8][0] = "Conductivity"; + table[thermoSystem.getPhase(0).getNumberOfComponents() + 8][i + 1] = + nf.format(thermoSystem.getPhase(i).getPhysicalProperties().getConductivity(), buf, test) + .toString(); + table[thermoSystem.getPhase(0).getNumberOfComponents() + 8][4] = "[W/m*K]"; buf = new StringBuffer(); - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 10][0] = "Pressure"; - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 10][i + 1] = - Double.toString(thermoSystem.getPhases()[i].getPressure()); - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 10][4] = "[bar]"; + table[thermoSystem.getPhase(0).getNumberOfComponents() + 10][0] = "Pressure"; + table[thermoSystem.getPhase(0).getNumberOfComponents() + 10][i + 1] = + Double.toString(thermoSystem.getPhase(i).getPressure()); + table[thermoSystem.getPhase(0).getNumberOfComponents() + 10][4] = "[bar]"; buf = new StringBuffer(); - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 11][0] = "Temperature"; - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 11][i + 1] = - Double.toString(thermoSystem.getPhases()[i].getTemperature()); - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 11][4] = "[K]"; - Double.toString(thermoSystem.getPhases()[i].getTemperature()); + table[thermoSystem.getPhase(0).getNumberOfComponents() + 11][0] = "Temperature"; + table[thermoSystem.getPhase(0).getNumberOfComponents() + 11][i + 1] = + Double.toString(thermoSystem.getPhase(i).getTemperature()); + table[thermoSystem.getPhase(0).getNumberOfComponents() + 11][4] = "[K]"; + Double.toString(thermoSystem.getPhase(i).getTemperature()); buf = new StringBuffer(); - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 13][0] = "Stream"; - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 13][i + 1] = getName(); - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 13][4] = "-"; + table[thermoSystem.getPhase(0).getNumberOfComponents() + 13][0] = "Stream"; + table[thermoSystem.getPhase(0).getNumberOfComponents() + 13][i + 1] = getName(); + table[thermoSystem.getPhase(0).getNumberOfComponents() + 13][4] = "-"; } JTable Jtab = new JTable(table, names); diff --git a/src/main/java/neqsim/process/equipment/absorber/WaterStripperColumn.java b/src/main/java/neqsim/process/equipment/absorber/WaterStripperColumn.java index 9d8e74bc3..2d5c98cf9 100644 --- a/src/main/java/neqsim/process/equipment/absorber/WaterStripperColumn.java +++ b/src/main/java/neqsim/process/equipment/absorber/WaterStripperColumn.java @@ -125,25 +125,25 @@ public void mixStream() { String compName = new String(); for (int k = 1; k < streams.size(); k++) { - for (int i = 0; i < streams.get(k).getThermoSystem().getPhases()[0] + for (int i = 0; i < streams.get(k).getThermoSystem().getPhase(0) .getNumberOfComponents(); i++) { boolean gotComponent = false; String componentName = - streams.get(k).getThermoSystem().getPhases()[0].getComponent(i).getName(); + streams.get(k).getThermoSystem().getPhase(0).getComponent(i).getName(); // System.out.println("adding: " + componentName); double moles = - streams.get(k).getThermoSystem().getPhases()[0].getComponent(i).getNumberOfmoles(); + streams.get(k).getThermoSystem().getPhase(0).getComponent(i).getNumberOfmoles(); // System.out.println("moles: " + moles + " " + - // mixedStream.getThermoSystem().getPhases()[0].getNumberOfComponents()); - for (int p = 0; p < mixedStream.getThermoSystem().getPhases()[0] + // mixedStream.getThermoSystem().getPhase(0).getNumberOfComponents()); + for (int p = 0; p < mixedStream.getThermoSystem().getPhase(0) .getNumberOfComponents(); p++) { - if (mixedStream.getThermoSystem().getPhases()[0].getComponent(p).getName() + if (mixedStream.getThermoSystem().getPhase(0).getComponent(p).getName() .equals(componentName)) { gotComponent = true; - compName = streams.get(0).getThermoSystem().getPhases()[0].getComponent(p) - .getComponentName(); + compName = + streams.get(0).getThermoSystem().getPhase(0).getComponent(p).getComponentName(); } } @@ -350,13 +350,13 @@ public void run(UUID id) { // stream.getThermoSystem().display(); SystemInterface tempSystem = mixedStream.getThermoSystem().clone(); - SystemInterface gasTemp = tempSystem.phaseToSystem(tempSystem.getPhases()[0]); + SystemInterface gasTemp = tempSystem.phaseToSystem(tempSystem.getPhase(0)); gasTemp.init(2); gasOutStream.setThermoSystem(gasTemp); gasOutStream.setCalculationIdentifier(id); tempSystem = mixedStream.getThermoSystem().clone(); - SystemInterface liqTemp = tempSystem.phaseToSystem(tempSystem.getPhases()[1]); + SystemInterface liqTemp = tempSystem.phaseToSystem(tempSystem.getPhase(1)); liqTemp.init(2); solventOutStream.setThermoSystem(liqTemp); solventOutStream.run(id); @@ -399,74 +399,73 @@ public void displayResult() { 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].getComponent(j).getName(); + for (int j = 0; j < thermoSystem.getPhase(0).getNumberOfComponents(); j++) { + table[j + 1][0] = thermoSystem.getPhase(0).getComponent(j).getName(); buf = new StringBuffer(); table[j + 1][i + 1] = - nf.format(thermoSystem.getPhases()[i].getComponent(j).getx(), buf, test).toString(); + nf.format(thermoSystem.getPhase(i).getComponent(j).getx(), buf, test).toString(); table[j + 1][4] = "[-]"; } buf = new StringBuffer(); - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 2][0] = "Density"; - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 2][i + 1] = - nf.format(thermoSystem.getPhases()[i].getPhysicalProperties().getDensity(), buf, test) + table[thermoSystem.getPhase(0).getNumberOfComponents() + 2][0] = "Density"; + table[thermoSystem.getPhase(0).getNumberOfComponents() + 2][i + 1] = + nf.format(thermoSystem.getPhase(i).getPhysicalProperties().getDensity(), buf, test) .toString(); - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 2][4] = "[kg/m^3]"; + table[thermoSystem.getPhase(0).getNumberOfComponents() + 2][4] = "[kg/m^3]"; - // Double.longValue(thermoSystem.getPhases()[i].getBeta()); + // Double.longValue(thermoSystem.getPhase(i).getBeta()); buf = new StringBuffer(); - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 3][0] = "PhaseFraction"; - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 3][i + 1] = - nf.format(thermoSystem.getPhases()[i].getBeta(), buf, test).toString(); - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 3][4] = "[-]"; + table[thermoSystem.getPhase(0).getNumberOfComponents() + 3][0] = "PhaseFraction"; + table[thermoSystem.getPhase(0).getNumberOfComponents() + 3][i + 1] = + nf.format(thermoSystem.getPhase(i).getBeta(), buf, test).toString(); + table[thermoSystem.getPhase(0).getNumberOfComponents() + 3][4] = "[-]"; buf = new StringBuffer(); - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 4][0] = "MolarMass"; - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 4][i + 1] = - nf.format(thermoSystem.getPhases()[i].getMolarMass() * 1000, buf, test).toString(); - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 4][4] = "[kg/kmol]"; + table[thermoSystem.getPhase(0).getNumberOfComponents() + 4][0] = "MolarMass"; + table[thermoSystem.getPhase(0).getNumberOfComponents() + 4][i + 1] = + nf.format(thermoSystem.getPhase(i).getMolarMass() * 1000, buf, test).toString(); + table[thermoSystem.getPhase(0).getNumberOfComponents() + 4][4] = "[kg/kmol]"; buf = new StringBuffer(); - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 5][0] = "Cp"; - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 5][i + 1] = - nf.format((thermoSystem.getPhases()[i].getCp() - / (thermoSystem.getPhases()[i].getNumberOfMolesInPhase() - * thermoSystem.getPhases()[i].getMolarMass() * 1000)), - buf, test).toString(); - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 5][4] = "[kJ/kg*K]"; + table[thermoSystem.getPhase(0).getNumberOfComponents() + 5][0] = "Cp"; + table[thermoSystem.getPhase(0).getNumberOfComponents() + 5][i + 1] = nf.format( + (thermoSystem.getPhase(i).getCp() / (thermoSystem.getPhase(i).getNumberOfMolesInPhase() + * thermoSystem.getPhase(i).getMolarMass() * 1000)), + buf, test).toString(); + table[thermoSystem.getPhase(0).getNumberOfComponents() + 5][4] = "[kJ/kg*K]"; buf = new StringBuffer(); - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 7][0] = "Viscosity"; - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 7][i + 1] = - nf.format((thermoSystem.getPhases()[i].getPhysicalProperties().getViscosity()), buf, test) + table[thermoSystem.getPhase(0).getNumberOfComponents() + 7][0] = "Viscosity"; + table[thermoSystem.getPhase(0).getNumberOfComponents() + 7][i + 1] = + nf.format((thermoSystem.getPhase(i).getPhysicalProperties().getViscosity()), buf, test) .toString(); - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 7][4] = "[kg/m*sec]"; + table[thermoSystem.getPhase(0).getNumberOfComponents() + 7][4] = "[kg/m*sec]"; buf = new StringBuffer(); - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 8][0] = "Conductivity"; - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 8][i + 1] = nf - .format(thermoSystem.getPhases()[i].getPhysicalProperties().getConductivity(), buf, test) - .toString(); - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 8][4] = "[W/m*K]"; + table[thermoSystem.getPhase(0).getNumberOfComponents() + 8][0] = "Conductivity"; + table[thermoSystem.getPhase(0).getNumberOfComponents() + 8][i + 1] = + nf.format(thermoSystem.getPhase(i).getPhysicalProperties().getConductivity(), buf, test) + .toString(); + table[thermoSystem.getPhase(0).getNumberOfComponents() + 8][4] = "[W/m*K]"; buf = new StringBuffer(); - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 10][0] = "Pressure"; - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 10][i + 1] = - Double.toString(thermoSystem.getPhases()[i].getPressure()); - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 10][4] = "[bar]"; + table[thermoSystem.getPhase(0).getNumberOfComponents() + 10][0] = "Pressure"; + table[thermoSystem.getPhase(0).getNumberOfComponents() + 10][i + 1] = + Double.toString(thermoSystem.getPhase(i).getPressure()); + table[thermoSystem.getPhase(0).getNumberOfComponents() + 10][4] = "[bar]"; buf = new StringBuffer(); - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 11][0] = "Temperature"; - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 11][i + 1] = - Double.toString(thermoSystem.getPhases()[i].getTemperature()); - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 11][4] = "[K]"; - Double.toString(thermoSystem.getPhases()[i].getTemperature()); + table[thermoSystem.getPhase(0).getNumberOfComponents() + 11][0] = "Temperature"; + table[thermoSystem.getPhase(0).getNumberOfComponents() + 11][i + 1] = + Double.toString(thermoSystem.getPhase(i).getTemperature()); + table[thermoSystem.getPhase(0).getNumberOfComponents() + 11][4] = "[K]"; + Double.toString(thermoSystem.getPhase(i).getTemperature()); buf = new StringBuffer(); - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 13][0] = "Stream"; - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 13][i + 1] = name; - table[thermoSystem.getPhases()[0].getNumberOfComponents() + 13][4] = "-"; + table[thermoSystem.getPhase(0).getNumberOfComponents() + 13][0] = "Stream"; + table[thermoSystem.getPhase(0).getNumberOfComponents() + 13][i + 1] = name; + table[thermoSystem.getPhase(0).getNumberOfComponents() + 13][4] = "-"; } JTable Jtab = new JTable(table, names); diff --git a/src/main/java/neqsim/process/equipment/compressor/Compressor.java b/src/main/java/neqsim/process/equipment/compressor/Compressor.java index e97c295d9..373ea8a6a 100644 --- a/src/main/java/neqsim/process/equipment/compressor/Compressor.java +++ b/src/main/java/neqsim/process/equipment/compressor/Compressor.java @@ -81,9 +81,8 @@ public Compressor(String name) { * Constructor for Compressor. *
* - * @param name a {@link java.lang.String} object - * @param inletStream a {@link neqsim.process.equipment.stream.StreamInterface} - * object + * @param name a {@link java.lang.String} object + * @param inletStream a {@link neqsim.process.equipment.stream.StreamInterface} object */ public Compressor(String name, StreamInterface inletStream) { this(name); @@ -95,7 +94,7 @@ public Compressor(String name, StreamInterface inletStream) { * Constructor for Compressor. * * - * @param name Name of compressor + * @param name Name of compressor * @param interpolateMapLookup a boolean */ public Compressor(String name, boolean interpolateMapLookup) { @@ -151,7 +150,7 @@ public void setOutletPressure(double pressure) { * * * @param pressure a double - * @param unit a {@link java.lang.String} object + * @param unit a {@link java.lang.String} object */ public void setOutletPressure(double pressure, String unit) { this.pressure = pressure; @@ -261,8 +260,8 @@ public double solveEfficiency(double outTemperature) { * findOutPressure. * * - * @param hinn a double - * @param hout a double + * @param hinn a double + * @param hout a double * @param polytropicEfficiency a double * @return a double */ @@ -331,7 +330,8 @@ public void run(UUID id) { polytropicHead = getPower() / getThermoSystem().getFlowRate("kg/sec") / 1000.0 * getPolytropicEfficiency(); polytropicFluidHead = polytropicHead; - polytropicHeadMeter = polytropicFluidHead * 1000.0 / ThermodynamicConstantsInterface.gravity; + polytropicHeadMeter = + polytropicFluidHead * 1000.0 / ThermodynamicConstantsInterface.gravity; return; } else { double MW = thermoSystem.getMolarMass(); @@ -347,7 +347,8 @@ public void run(UUID id) { double[] gergProps; gergProps = getThermoSystem().getPhase(0).getProperties_GERG2008(); densOutIsentropic = getThermoSystem().getPhase(0).getDensity_GERG2008(); - enthalpyOutIsentropic = gergProps[7] * getThermoSystem().getPhase(0).getNumberOfMolesInPhase(); + enthalpyOutIsentropic = + gergProps[7] * getThermoSystem().getPhase(0).getNumberOfMolesInPhase(); } thermoSystem.setTemperature(outTemperature); thermoOps.TPflash(); @@ -434,13 +435,15 @@ public void run(UUID id) { z_inlet = gergProps[1]; } - double polytropEff = getCompressorChart().getPolytropicEfficiency(actualFlowRate, currentSpeed); + double polytropEff = + getCompressorChart().getPolytropicEfficiency(actualFlowRate, currentSpeed); setPolytropicEfficiency(polytropEff / 100.0); polytropicHead = getCompressorChart().getPolytropicHead(actualFlowRate, currentSpeed); double temperature_inlet = thermoSystem.getTemperature(); double n = 1.0 / (1.0 - (kappa - 1.0) / kappa * 1.0 / (polytropEff / 100.0)); - polytropicFluidHead = (getCompressorChart().getHeadUnit().equals("meter")) ? polytropicHead / 1000.0 * 9.81 - : polytropicHead; + polytropicFluidHead = + (getCompressorChart().getHeadUnit().equals("meter")) ? polytropicHead / 1000.0 * 9.81 + : polytropicHead; double pressureRatio = Math.pow((polytropicFluidHead * 1000.0 + (n / (n - 1.0) * z_inlet * ThermodynamicConstantsInterface.R * (temperature_inlet) / MW)) / (n / (n - 1.0) * z_inlet * ThermodynamicConstantsInterface.R * (temperature_inlet) @@ -451,17 +454,18 @@ public void run(UUID id) { // Calculate the derivative of pressure with respect to speed double polytropEffDelta = getCompressorChart().getPolytropicEfficiency(actualFlowRate, currentSpeed + deltaSpeed); - double polytropicHeadDelta = getCompressorChart().getPolytropicHead(actualFlowRate, - currentSpeed + deltaSpeed); + double polytropicHeadDelta = + getCompressorChart().getPolytropicHead(actualFlowRate, currentSpeed + deltaSpeed); double nDelta = 1.0 / (1.0 - (kappa - 1.0) / kappa * 1.0 / (polytropEffDelta / 100.0)); double polytropicFluidHeadDelta = (getCompressorChart().getHeadUnit().equals("meter")) ? polytropicHeadDelta / 1000.0 * 9.81 : polytropicHeadDelta; - double pressureRatioDelta = Math.pow((polytropicFluidHeadDelta * 1000.0 + (nDelta / (nDelta - 1.0) * z_inlet - * ThermodynamicConstantsInterface.R * (temperature_inlet) / MW)) - / (nDelta / (nDelta - 1.0) * z_inlet * ThermodynamicConstantsInterface.R - * (temperature_inlet) / MW), - nDelta / (nDelta - 1.0)); + double pressureRatioDelta = + Math.pow((polytropicFluidHeadDelta * 1000.0 + (nDelta / (nDelta - 1.0) * z_inlet + * ThermodynamicConstantsInterface.R * (temperature_inlet) / MW)) + / (nDelta / (nDelta - 1.0) * z_inlet * ThermodynamicConstantsInterface.R + * (temperature_inlet) / MW), + nDelta / (nDelta - 1.0)); double pressureDelta = thermoSystem.getPressure() * pressureRatioDelta; double dPressure_dSpeed = (pressureDelta - currentPressure) / deltaSpeed; @@ -510,7 +514,8 @@ public void run(UUID id) { z_inlet = gergProps[1]; } - double polytropEff = getCompressorChart().getPolytropicEfficiency(actualFlowRate, getSpeed()); + double polytropEff = + getCompressorChart().getPolytropicEfficiency(actualFlowRate, getSpeed()); setPolytropicEfficiency(polytropEff / 100.0); polytropicHead = getCompressorChart().getPolytropicHead(actualFlowRate, getSpeed()); double temperature_inlet = thermoSystem.getTemperature(); @@ -608,9 +613,11 @@ public void run(UUID id) { } } } else if (polytropicMethod.equals("schultz")) { - double schultzX = thermoSystem.getTemperature() / thermoSystem.getVolume() * thermoSystem.getdVdTpn() - - 1.0; - double schultzY = -thermoSystem.getPressure() / thermoSystem.getVolume() * thermoSystem.getdVdPtn(); + double schultzX = + thermoSystem.getTemperature() / thermoSystem.getVolume() * thermoSystem.getdVdTpn() + - 1.0; + double schultzY = + -thermoSystem.getPressure() / thermoSystem.getVolume() * thermoSystem.getdVdPtn(); thermoSystem.setPressure(getOutletPressure(), pressureUnit); thermoOps.PSflash(entropy); thermoSystem.initProperties(); @@ -621,10 +628,11 @@ public void run(UUID id) { double[] gergProps; gergProps = getThermoSystem().getPhase(0).getProperties_GERG2008(); densOutIsentropic = getThermoSystem().getPhase(0).getDensity_GERG2008(); - enthalpyOutIsentropic = gergProps[7] * getThermoSystem().getPhase(0).getNumberOfMolesInPhase(); + enthalpyOutIsentropic = + gergProps[7] * getThermoSystem().getPhase(0).getNumberOfMolesInPhase(); } - double isenthalpicvolumeexponent = Math.log(getOutletPressure() / presinn) - / Math.log(densOutIsentropic / densInn); + double isenthalpicvolumeexponent = + Math.log(getOutletPressure() / presinn) / Math.log(densOutIsentropic / densInn); double nV = (1.0 + schultzX) / (1.0 / isenthalpicvolumeexponent * (1.0 / polytropicEfficiency + schultzX) - schultzY * (1.0 / polytropicEfficiency - 1.0)); @@ -651,10 +659,11 @@ public void run(UUID id) { double[] gergProps; gergProps = getThermoSystem().getPhase(0).getProperties_GERG2008(); densOutIsentropic = getThermoSystem().getPhase(0).getDensity_GERG2008(); - enthalpyOutIsentropic = gergProps[7] * getThermoSystem().getPhase(0).getNumberOfMolesInPhase(); + enthalpyOutIsentropic = + gergProps[7] * getThermoSystem().getPhase(0).getNumberOfMolesInPhase(); } - double isenthalpicvolumeexponent = Math.log(getOutletPressure() / presinn) - / Math.log(densOutIsentropic / densInn); + double isenthalpicvolumeexponent = + Math.log(getOutletPressure() / presinn) / Math.log(densOutIsentropic / densInn); double term = isenthalpicvolumeexponent / (isenthalpicvolumeexponent - 1.0) * (polytropicEfficiency); double term2 = 1e5 * (getOutletPressure() / densOutIsentropic - presinn / densInn); @@ -711,7 +720,8 @@ public void run(UUID id) { outStream.setThermoSystem(getThermoSystem()); outStream.setCalculationIdentifier(id); - polytropicFluidHead = getPower() / getThermoSystem().getFlowRate("kg/sec") / 1000.0 * getPolytropicEfficiency(); + polytropicFluidHead = + getPower() / getThermoSystem().getFlowRate("kg/sec") / 1000.0 * getPolytropicEfficiency(); polytropicHeadMeter = polytropicFluidHead * 1000.0 / 9.81; actualCompressionRatio = getOutletPressure() / presinn; setCalculationIdentifier(id); @@ -753,7 +763,8 @@ public void runTransient(double dt, UUID id) { thermoSystem = outStream.getThermoSystem().clone(); thermoSystem.initPhysicalProperties(PhysicalPropertyType.MASS_DENSITY); - polytropicEfficiency = compressorChart.getPolytropicEfficiency(inStream.getFlowRate("m3/hr"), speed) / 100.0; + polytropicEfficiency = + compressorChart.getPolytropicEfficiency(inStream.getFlowRate("m3/hr"), speed) / 100.0; polytropicFluidHead = head * polytropicEfficiency; dH = polytropicFluidHead * 1000.0 * thermoSystem.getMolarMass() / getPolytropicEfficiency() * inStream.getThermoSystem().getTotalNumberOfMoles(); @@ -768,17 +779,17 @@ public void runTransient(double dt, UUID id) { public void generateCompressorCurves() { double flowRef = getThermoSystem().getFlowRate("m3/hr"); double factor = flowRef / 4000.0; - double[] chartConditions = new double[] { 0.3, 1.0, 1.0, 1.0 }; - double[] speed = new double[] { 12913, 12298, 11683, 11098, 10453, 9224, 8609, 8200 }; + double[] chartConditions = new double[] {0.3, 1.0, 1.0, 1.0}; + double[] speed = new double[] {12913, 12298, 11683, 11098, 10453, 9224, 8609, 8200}; double[][] flow = new double[][] { - { 2789.1285, 3174.0375, 3689.2288, 4179.4503, 4570.2768, 4954.7728, 5246.0329, 5661.0331 }, - { 2571.1753, 2943.7254, 3440.2675, 3837.4448, 4253.0898, 4668.6643, 4997.1926, 5387.4952 }, - { 2415.3793, 2763.0706, 3141.7095, 3594.7436, 4047.6467, 4494.1889, 4853.7353, 5138.7858 }, - { 2247.2043, 2799.7342, 3178.3428, 3656.1551, 4102.778, 4394.1591, 4648.3224, 4840.4998 }, - { 2072.8397, 2463.9483, 2836.4078, 3202.5266, 3599.6333, 3978.0203, 4257.0022, 4517.345 }, - { 1835.9552, 2208.455, 2618.1322, 2940.8034, 3244.7852, 3530.1279, 3753.3738, 3895.9746 }, - { 1711.3386, 1965.8848, 2356.9431, 2685.9247, 3008.5154, 3337.2855, 3591.5092 }, - { 1636.5807, 2002.8708, 2338.0319, 2642.1245, 2896.4894, 3113.6264, 3274.8764, 3411.2977 } }; + {2789.1285, 3174.0375, 3689.2288, 4179.4503, 4570.2768, 4954.7728, 5246.0329, 5661.0331}, + {2571.1753, 2943.7254, 3440.2675, 3837.4448, 4253.0898, 4668.6643, 4997.1926, 5387.4952}, + {2415.3793, 2763.0706, 3141.7095, 3594.7436, 4047.6467, 4494.1889, 4853.7353, 5138.7858}, + {2247.2043, 2799.7342, 3178.3428, 3656.1551, 4102.778, 4394.1591, 4648.3224, 4840.4998}, + {2072.8397, 2463.9483, 2836.4078, 3202.5266, 3599.6333, 3978.0203, 4257.0022, 4517.345}, + {1835.9552, 2208.455, 2618.1322, 2940.8034, 3244.7852, 3530.1279, 3753.3738, 3895.9746}, + {1711.3386, 1965.8848, 2356.9431, 2685.9247, 3008.5154, 3337.2855, 3591.5092}, + {1636.5807, 2002.8708, 2338.0319, 2642.1245, 2896.4894, 3113.6264, 3274.8764, 3411.2977}}; for (int i = 0; i < flow.length; i++) { for (int j = 0; j < flow[i].length; j++) { @@ -786,14 +797,15 @@ public void generateCompressorCurves() { } } - double[][] head = new double[][] { { 80.0375, 78.8934, 76.2142, 71.8678, 67.0062, 60.6061, 53.0499, 39.728 }, - { 72.2122, 71.8369, 68.9009, 65.8341, 60.7167, 54.702, 47.2749, 35.7471 }, - { 65.1576, 64.5253, 62.6118, 59.1619, 54.0455, 47.0059, 39.195, 31.6387 }, - { 58.6154, 56.9627, 54.6647, 50.4462, 44.4322, 38.4144, 32.9084, 28.8109 }, - { 52.3295, 51.0573, 49.5283, 46.3326, 42.3685, 37.2502, 31.4884, 25.598 }, - { 40.6578, 39.6416, 37.6008, 34.6603, 30.9503, 27.1116, 23.2713, 20.4546 }, - { 35.2705, 34.6359, 32.7228, 31.0645, 27.0985, 22.7482, 18.0113 }, - { 32.192, 31.1756, 29.1329, 26.833, 23.8909, 21.3324, 18.7726, 16.3403 }, }; + double[][] head = + new double[][] {{80.0375, 78.8934, 76.2142, 71.8678, 67.0062, 60.6061, 53.0499, 39.728}, + {72.2122, 71.8369, 68.9009, 65.8341, 60.7167, 54.702, 47.2749, 35.7471}, + {65.1576, 64.5253, 62.6118, 59.1619, 54.0455, 47.0059, 39.195, 31.6387}, + {58.6154, 56.9627, 54.6647, 50.4462, 44.4322, 38.4144, 32.9084, 28.8109}, + {52.3295, 51.0573, 49.5283, 46.3326, 42.3685, 37.2502, 31.4884, 25.598}, + {40.6578, 39.6416, 37.6008, 34.6603, 30.9503, 27.1116, 23.2713, 20.4546}, + {35.2705, 34.6359, 32.7228, 31.0645, 27.0985, 22.7482, 18.0113}, + {32.192, 31.1756, 29.1329, 26.833, 23.8909, 21.3324, 18.7726, 16.3403},}; for (int i = 0; i < head.length; i++) { for (int j = 0; j < head[i].length; j++) { @@ -801,22 +813,22 @@ public void generateCompressorCurves() { } } double[][] polyEff = new double[][] { - { 77.2452238409573, 79.4154186459363, 80.737960012489, 80.5229826589649, 79.2210931638144, - 75.4719133864634, 69.6034181197298, 58.7322388482707 }, - { 77.0107837113504, 79.3069974136389, 80.8941189021135, 80.7190194665918, 79.5313242980328, - 75.5912622896367, 69.6846136362097, 60.0043057990909 }, - { 77.0043065299874, 79.1690958847856, 80.8038169975675, 80.6543975614197, 78.8532389102705, - 73.6664774270613, 66.2735600426727, 57.671664571658 }, - { 77.0716623789093, 80.4629750233093, 81.1390811169072, 79.6374242667478, 75.380928428817, - 69.5332969549779, 63.7997587622339, 58.8120614497758 }, - { 76.9705872525642, 79.8335492585324, 80.9468133671171, 80.5806471927835, 78.0462158225426, - 73.0403707523258, 66.5572286338589, 59.8624822515064 }, - { 77.5063036680357, 80.2056198362559, 81.0339108025933, 79.6085962687939, 76.3814534404405, - 70.8027503005902, 64.6437367160571, 60.5299349982342 }, - { 77.8175271586685, 80.065165942218, 81.0631362122632, 79.8955051771299, 76.1983240929369, - 69.289982774309, 60.8567149372229 }, - { 78.0924334304045, 80.9353551568667, 80.7904437766234, 78.8639325223295, 75.2170936751143, - 70.3105081673411, 65.5507568533569, 61.0391468300337 } }; + {77.2452238409573, 79.4154186459363, 80.737960012489, 80.5229826589649, 79.2210931638144, + 75.4719133864634, 69.6034181197298, 58.7322388482707}, + {77.0107837113504, 79.3069974136389, 80.8941189021135, 80.7190194665918, 79.5313242980328, + 75.5912622896367, 69.6846136362097, 60.0043057990909}, + {77.0043065299874, 79.1690958847856, 80.8038169975675, 80.6543975614197, 78.8532389102705, + 73.6664774270613, 66.2735600426727, 57.671664571658}, + {77.0716623789093, 80.4629750233093, 81.1390811169072, 79.6374242667478, 75.380928428817, + 69.5332969549779, 63.7997587622339, 58.8120614497758}, + {76.9705872525642, 79.8335492585324, 80.9468133671171, 80.5806471927835, 78.0462158225426, + 73.0403707523258, 66.5572286338589, 59.8624822515064}, + {77.5063036680357, 80.2056198362559, 81.0339108025933, 79.6085962687939, 76.3814534404405, + 70.8027503005902, 64.6437367160571, 60.5299349982342}, + {77.8175271586685, 80.065165942218, 81.0631362122632, 79.8955051771299, 76.1983240929369, + 69.289982774309, 60.8567149372229}, + {78.0924334304045, 80.9353551568667, 80.7904437766234, 78.8639325223295, 75.2170936751143, + 70.3105081673411, 65.5507568533569, 61.0391468300337}}; getCompressorChart().setCurves(chartConditions, speed, flow, head, polyEff); getCompressorChart().setHeadUnit("kJ/kg"); @@ -836,7 +848,7 @@ public void displayResult() { getThermoSystem().initPhysicalProperties(); String[][] table = new String[50][5]; - String[] names = { "", "Phase 1", "Phase 2", "Phase 3", "Unit" }; + String[] names = {"", "Phase 1", "Phase 2", "Phase 3", "Unit"}; table[0][0] = ""; table[0][1] = ""; table[0][2] = ""; @@ -845,68 +857,93 @@ public void displayResult() { FieldPosition test = new FieldPosition(0); 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].getComponent(j).getName(); + for (int j = 0; j < getThermoSystem().getPhase(0).getNumberOfComponents(); j++) { + table[j + 1][0] = getThermoSystem().getPhase(0).getComponent(j).getName(); buf = new StringBuffer(); - table[j + 1][i + 1] = nf - .format(getThermoSystem().getPhases()[i].getComponent(j).getx(), buf, test).toString(); + table[j + 1][i + 1] = + nf.format(getThermoSystem().getPhase(i).getComponent(j).getx(), buf, test).toString(); table[j + 1][4] = "[-]"; } buf = new StringBuffer(); - table[getThermoSystem().getPhases()[0].getNumberOfComponents() + 2][0] = "Density"; - table[getThermoSystem().getPhases()[0].getNumberOfComponents() + 2][i + 1] = nf - .format(getThermoSystem().getPhases()[i].getPhysicalProperties().getDensity(), buf, test) + table[getThermoSystem().getPhase(0).getNumberOfComponents() + 2][0] = "Density"; + table[getThermoSystem().getPhase(0).getNumberOfComponents() + 2][i + 1] = + nf.format(getThermoSystem().getPhase(i).getPhysicalProperties().getDensity(), buf, test) + .toString(); + table[getThermoSystem().getPhase(0).getNumberOfComponents() + 2][4] = "[kg/m^3]"; + + // Double.longValue(thermoSystem.getPhase(i).getBeta()); + buf = new StringBuffer(); + table[getThermoSystem().getPhase(0).getNumberOfComponents() + 3][0] = "PhaseFraction"; + table[getThermoSystem().getPhase(0).getNumberOfComponents() + 3][i + 1] = + nf.format(getThermoSystem().getPhase(i).getBeta(), buf, test).toString(); + table[getThermoSystem().getPhase(0).getNumberOfComponents() + 3][4] = "[-]"; + + buf = new StringBuffer(); + table[getThermoSystem().getPhase(0).getNumberOfComponents() + 4][0] = "MolarMass"; + table[getThermoSystem().getPhase(0).getNumberOfComponents() + 4][i + 1] = + nf.format(getThermoSystem().getPhase(i).getMolarMass() * 1000, buf, test).toString(); + table[getThermoSystem().getPhase(0).getNumberOfComponents() + 4][4] = "[kg/kmol]"; + + buf = new StringBuffer(); + table[getThermoSystem().getPhase(0).getNumberOfComponents() + 5][0] = "Cp"; + table[getThermoSystem().getPhase(0).getNumberOfComponents() + 5][i + 1] = + nf.format((getThermoSystem().getPhase(i).getCp() + / getThermoSystem().getPhase(i).getNumberOfMolesInPhase() * 1.0 + / getThermoSystem().getPhase(i).getMolarMass() * 1000), buf, test).toString(); + table[getThermoSystem().getPhase(0).getNumberOfComponents() + 5][4] = "[kJ/kg*K]"; + + buf = new StringBuffer(); + table[getThermoSystem().getPhase(0).getNumberOfComponents() + 7][0] = "Viscosity"; + table[getThermoSystem().getPhase(0).getNumberOfComponents() + 7][i + 1] = nf + .format((getThermoSystem().getPhase(i).getPhysicalProperties().getViscosity()), buf, test) .toString(); table[getThermoSystem().getPhases()[0].getNumberOfComponents() + 2][4] = "[kg/m^3]"; // Double.longValue(thermoSystem.getPhases()[i].getBeta()); buf = new StringBuffer(); table[getThermoSystem().getPhases()[0].getNumberOfComponents() + 3][0] = "PhaseFraction"; - table[getThermoSystem().getPhases()[0].getNumberOfComponents() + 3][i + 1] = nf - .format(getThermoSystem().getPhases()[i].getBeta(), buf, test).toString(); + table[getThermoSystem().getPhases()[0].getNumberOfComponents() + 3][i + 1] = + nf.format(getThermoSystem().getPhases()[i].getBeta(), buf, test).toString(); table[getThermoSystem().getPhases()[0].getNumberOfComponents() + 3][4] = "[-]"; buf = new StringBuffer(); table[getThermoSystem().getPhases()[0].getNumberOfComponents() + 4][0] = "MolarMass"; - table[getThermoSystem().getPhases()[0].getNumberOfComponents() + 4][i + 1] = nf - .format(getThermoSystem().getPhases()[i].getMolarMass() * 1000, buf, test).toString(); + table[getThermoSystem().getPhases()[0].getNumberOfComponents() + 4][i + 1] = + nf.format(getThermoSystem().getPhases()[i].getMolarMass() * 1000, buf, test).toString(); table[getThermoSystem().getPhases()[0].getNumberOfComponents() + 4][4] = "[kg/kmol]"; buf = new StringBuffer(); table[getThermoSystem().getPhases()[0].getNumberOfComponents() + 5][0] = "Cp"; - table[getThermoSystem().getPhases()[0].getNumberOfComponents() + 5][i + 1] = nf - .format((getThermoSystem().getPhases()[i].getCp() + table[getThermoSystem().getPhases()[0].getNumberOfComponents() + 5][i + 1] = + nf.format((getThermoSystem().getPhases()[i].getCp() / getThermoSystem().getPhases()[i].getNumberOfMolesInPhase() * 1.0 - / getThermoSystem().getPhases()[i].getMolarMass() * 1000), buf, test) - .toString(); + / getThermoSystem().getPhases()[i].getMolarMass() * 1000), buf, test).toString(); table[getThermoSystem().getPhases()[0].getNumberOfComponents() + 5][4] = "[kJ/kg*K]"; buf = new StringBuffer(); table[getThermoSystem().getPhases()[0].getNumberOfComponents() + 7][0] = "Viscosity"; - table[getThermoSystem().getPhases()[0].getNumberOfComponents() + 7][i + 1] = nf - .format((getThermoSystem().getPhases()[i].getPhysicalProperties().getViscosity()), buf, - test) - .toString(); + table[getThermoSystem().getPhases()[0].getNumberOfComponents() + 7][i + 1] = + nf.format((getThermoSystem().getPhases()[i].getPhysicalProperties().getViscosity()), buf, + test).toString(); table[getThermoSystem().getPhases()[0].getNumberOfComponents() + 7][4] = "[kg/m*sec]"; buf = new StringBuffer(); table[getThermoSystem().getPhases()[0].getNumberOfComponents() + 8][0] = "Conductivity"; - table[getThermoSystem().getPhases()[0].getNumberOfComponents() + 8][i + 1] = nf - .format(getThermoSystem().getPhases()[i].getPhysicalProperties().getConductivity(), buf, - test) - .toString(); + table[getThermoSystem().getPhases()[0].getNumberOfComponents() + 8][i + 1] = + nf.format(getThermoSystem().getPhases()[i].getPhysicalProperties().getConductivity(), buf, + test).toString(); table[getThermoSystem().getPhases()[0].getNumberOfComponents() + 8][4] = "[W/m*K]"; buf = new StringBuffer(); table[getThermoSystem().getPhases()[0].getNumberOfComponents() + 10][0] = "Pressure"; - table[getThermoSystem().getPhases()[0].getNumberOfComponents() + 10][i + 1] = Double - .toString(getThermoSystem().getPhases()[i].getPressure()); + table[getThermoSystem().getPhases()[0].getNumberOfComponents() + 10][i + 1] = + Double.toString(getThermoSystem().getPhases()[i].getPressure()); table[getThermoSystem().getPhases()[0].getNumberOfComponents() + 10][4] = "[bar]"; buf = new StringBuffer(); table[getThermoSystem().getPhases()[0].getNumberOfComponents() + 11][0] = "Temperature"; - table[getThermoSystem().getPhases()[0].getNumberOfComponents() + 11][i + 1] = Double - .toString(getThermoSystem().getPhases()[i].getTemperature()); + table[getThermoSystem().getPhases()[0].getNumberOfComponents() + 11][i + 1] = + Double.toString(getThermoSystem().getPhases()[i].getTemperature()); table[getThermoSystem().getPhases()[0].getNumberOfComponents() + 11][4] = "[K]"; Double.toString(getThermoSystem().getPhases()[i].getTemperature()); @@ -1008,9 +1045,7 @@ public SystemInterface getThermoSystem() { * Getter for the fieldcompressorChart
.
*
*
- * @return a
- * {@link neqsim.process.equipment.compressor.CompressorChartInterface}
- * object
+ * @return a {@link neqsim.process.equipment.compressor.CompressorChartInterface} object
*/
public CompressorChartInterface getCompressorChart() {
return compressorChart;
@@ -1021,9 +1056,7 @@ public CompressorChartInterface getCompressorChart() {
* Setter for the field compressorChart
.
*
*
- * @param compressorChart a
- * {@link neqsim.process.equipment.compressor.CompressorChart}
- * object
+ * @param compressorChart a {@link neqsim.process.equipment.compressor.CompressorChart} object
*/
public void setCompressorChart(CompressorChart compressorChart) {
this.compressorChart = compressorChart;
@@ -1087,8 +1120,7 @@ public boolean isStoneWall(double flow, double head) {
* Setter for the field antiSurge
.
*
*
- * @param antiSurge a {@link neqsim.process.equipment.compressor.AntiSurge}
- * object
+ * @param antiSurge a {@link neqsim.process.equipment.compressor.AntiSurge} object
*/
public void setAntiSurge(AntiSurge antiSurge) {
this.antiSurge = antiSurge;
@@ -1283,7 +1315,7 @@ public void setPressure(double pressure) {
*
*
* @param pressure a double
- * @param unit a {@link java.lang.String} object
+ * @param unit a {@link java.lang.String} object
*/
public void setPressure(double pressure, String unit) {
setOutletPressure(pressure);
@@ -1349,9 +1381,7 @@ public void setUseGERG2008(boolean useGERG2008) {
* Getter for the field propertyProfile
.
*
*
- * @return a
- * {@link neqsim.process.equipment.compressor.CompressorPropertyProfile}
- * object
+ * @return a {@link neqsim.process.equipment.compressor.CompressorPropertyProfile} object
*/
public CompressorPropertyProfile getPropertyProfile() {
return propertyProfile;
@@ -1362,9 +1392,8 @@ public CompressorPropertyProfile getPropertyProfile() {
* Setter for the field propertyProfile
.
*
*
- * @param propertyProfile a
- * {@link neqsim.process.equipment.compressor.CompressorPropertyProfile}
- * object
+ * @param propertyProfile a {@link neqsim.process.equipment.compressor.CompressorPropertyProfile}
+ * object
*/
public void setPropertyProfile(CompressorPropertyProfile propertyProfile) {
this.propertyProfile = propertyProfile;
diff --git a/src/main/java/neqsim/process/equipment/expander/ExpanderOld.java b/src/main/java/neqsim/process/equipment/expander/ExpanderOld.java
index 89905e79e..758e75b5e 100644
--- a/src/main/java/neqsim/process/equipment/expander/ExpanderOld.java
+++ b/src/main/java/neqsim/process/equipment/expander/ExpanderOld.java
@@ -115,72 +115,72 @@ public void displayResult() {
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].getComponent(j).getName();
+ for (int j = 0; j < thermoSystem.getPhase(0).getNumberOfComponents(); j++) {
+ table[j + 1][0] = thermoSystem.getPhase(0).getComponent(j).getName();
buf = new StringBuffer();
table[j + 1][i + 1] =
- nf.format(thermoSystem.getPhases()[i].getComponent(j).getx(), buf, test).toString();
+ nf.format(thermoSystem.getPhase(i).getComponent(j).getx(), buf, test).toString();
table[j + 1][4] = "[-]";
}
buf = new StringBuffer();
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 2][0] = "Density";
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 2][i + 1] =
- nf.format(thermoSystem.getPhases()[i].getPhysicalProperties().getDensity(), buf, test)
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 2][0] = "Density";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 2][i + 1] =
+ nf.format(thermoSystem.getPhase(i).getPhysicalProperties().getDensity(), buf, test)
.toString();
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 2][4] = "[kg/m^3]";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 2][4] = "[kg/m^3]";
- // Double.longValue(thermoSystem.getPhases()[i].getBeta());
+ // Double.longValue(thermoSystem.getPhase(i).getBeta());
buf = new StringBuffer();
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 3][0] = "PhaseFraction";
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 3][i + 1] =
- nf.format(thermoSystem.getPhases()[i].getBeta(), buf, test).toString();
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 3][4] = "[-]";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 3][0] = "PhaseFraction";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 3][i + 1] =
+ nf.format(thermoSystem.getPhase(i).getBeta(), buf, test).toString();
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 3][4] = "[-]";
buf = new StringBuffer();
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 4][0] = "MolarMass";
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 4][i + 1] =
- nf.format(thermoSystem.getPhases()[i].getMolarMass() * 1000, buf, test).toString();
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 4][4] = "[kg/kmol]";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 4][0] = "MolarMass";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 4][i + 1] =
+ nf.format(thermoSystem.getPhase(i).getMolarMass() * 1000, buf, test).toString();
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 4][4] = "[kg/kmol]";
buf = new StringBuffer();
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 5][0] = "Cp";
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 5][i + 1] =
- nf.format((thermoSystem.getPhases()[i].getCp()
- / thermoSystem.getPhases()[i].getNumberOfMolesInPhase() * 1.0
- / thermoSystem.getPhases()[i].getMolarMass() * 1000), buf, test).toString();
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 5][4] = "[kJ/kg*K]";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 5][0] = "Cp";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 5][i + 1] = nf.format(
+ (thermoSystem.getPhase(i).getCp() / thermoSystem.getPhase(i).getNumberOfMolesInPhase()
+ * 1.0 / thermoSystem.getPhase(i).getMolarMass() * 1000),
+ buf, test).toString();
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 5][4] = "[kJ/kg*K]";
buf = new StringBuffer();
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 7][0] = "Viscosity";
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 7][i + 1] =
- nf.format((thermoSystem.getPhases()[i].getPhysicalProperties().getViscosity()), buf, test)
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 7][0] = "Viscosity";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 7][i + 1] =
+ nf.format((thermoSystem.getPhase(i).getPhysicalProperties().getViscosity()), buf, test)
.toString();
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 7][4] = "[kg/m*sec]";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 7][4] = "[kg/m*sec]";
buf = new StringBuffer();
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 8][0] = "Conductivity";
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 8][i + 1] = nf
- .format(thermoSystem.getPhases()[i].getPhysicalProperties().getConductivity(), buf, test)
- .toString();
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 8][4] = "[W/m*K]";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 8][0] = "Conductivity";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 8][i + 1] =
+ nf.format(thermoSystem.getPhase(i).getPhysicalProperties().getConductivity(), buf, test)
+ .toString();
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 8][4] = "[W/m*K]";
buf = new StringBuffer();
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 10][0] = "Pressure";
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 10][i + 1] =
- Double.toString(thermoSystem.getPhases()[i].getPressure());
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 10][4] = "[bar]";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 10][0] = "Pressure";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 10][i + 1] =
+ Double.toString(thermoSystem.getPhase(i).getPressure());
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 10][4] = "[bar]";
buf = new StringBuffer();
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 11][0] = "Temperature";
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 11][i + 1] =
- Double.toString(thermoSystem.getPhases()[i].getTemperature());
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 11][4] = "[K]";
- Double.toString(thermoSystem.getPhases()[i].getTemperature());
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 11][0] = "Temperature";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 11][i + 1] =
+ Double.toString(thermoSystem.getPhase(i).getTemperature());
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 11][4] = "[K]";
+ Double.toString(thermoSystem.getPhase(i).getTemperature());
buf = new StringBuffer();
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 13][0] = "Stream";
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 13][i + 1] = name;
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 13][4] = "-";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 13][0] = "Stream";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 13][i + 1] = name;
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 13][4] = "-";
}
String[] names = {"", "Phase 1", "Phase 2", "Phase 3", "Unit"};
diff --git a/src/main/java/neqsim/process/equipment/heatexchanger/Heater.java b/src/main/java/neqsim/process/equipment/heatexchanger/Heater.java
index 636004026..407aa3ebe 100644
--- a/src/main/java/neqsim/process/equipment/heatexchanger/Heater.java
+++ b/src/main/java/neqsim/process/equipment/heatexchanger/Heater.java
@@ -27,9 +27,17 @@
public class Heater extends TwoPortEquipment implements HeaterInterface {
private static final long serialVersionUID = 1000;
- boolean setTemperature = false, setOutPressure = false;
+ boolean setTemperature = false;
+
+ boolean setOutPressure = false;
+
SystemInterface system;
- protected double temperatureOut = 0, dT = 0.0, pressureOut = 0;
+ protected double temperatureOut = 0;
+
+ protected double dT = 0.0;
+
+ protected double pressureOut = 0;
+
private boolean setEnergyInput = false;
private double energyInput = 0.0;
private double pressureDrop = 0.0;
diff --git a/src/main/java/neqsim/process/equipment/mixer/Mixer.java b/src/main/java/neqsim/process/equipment/mixer/Mixer.java
index 4bcd20f34..33f318212 100644
--- a/src/main/java/neqsim/process/equipment/mixer/Mixer.java
+++ b/src/main/java/neqsim/process/equipment/mixer/Mixer.java
@@ -275,74 +275,73 @@ public void displayResult() {
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].getComponent(j).getName();
+ for (int j = 0; j < thermoSystem.getPhase(0).getNumberOfComponents(); j++) {
+ table[j + 1][0] = thermoSystem.getPhase(0).getComponent(j).getName();
buf = new StringBuffer();
table[j + 1][i + 1] =
- nf.format(thermoSystem.getPhases()[i].getComponent(j).getx(), buf, test).toString();
+ nf.format(thermoSystem.getPhase(i).getComponent(j).getx(), buf, test).toString();
table[j + 1][4] = "[-]";
}
buf = new StringBuffer();
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 2][0] = "Density";
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 2][i + 1] =
- nf.format(thermoSystem.getPhases()[i].getPhysicalProperties().getDensity(), buf, test)
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 2][0] = "Density";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 2][i + 1] =
+ nf.format(thermoSystem.getPhase(i).getPhysicalProperties().getDensity(), buf, test)
.toString();
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 2][4] = "[kg/m^3]";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 2][4] = "[kg/m^3]";
- // Double.longValue(thermoSystem.getPhases()[i].getBeta());
+ // Double.longValue(thermoSystem.getPhase(i).getBeta());
buf = new StringBuffer();
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 3][0] = "PhaseFraction";
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 3][i + 1] =
- nf.format(thermoSystem.getPhases()[i].getBeta(), buf, test).toString();
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 3][4] = "[-]";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 3][0] = "PhaseFraction";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 3][i + 1] =
+ nf.format(thermoSystem.getPhase(i).getBeta(), buf, test).toString();
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 3][4] = "[-]";
buf = new StringBuffer();
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 4][0] = "MolarMass";
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 4][i + 1] =
- nf.format(thermoSystem.getPhases()[i].getMolarMass() * 1000, buf, test).toString();
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 4][4] = "[kg/kmol]";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 4][0] = "MolarMass";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 4][i + 1] =
+ nf.format(thermoSystem.getPhase(i).getMolarMass() * 1000, buf, test).toString();
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 4][4] = "[kg/kmol]";
buf = new StringBuffer();
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 5][0] = "Cp";
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 5][i + 1] =
- nf.format((thermoSystem.getPhases()[i].getCp()
- / (thermoSystem.getPhases()[i].getNumberOfMolesInPhase()
- * thermoSystem.getPhases()[i].getMolarMass() * 1000)),
- buf, test).toString();
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 5][4] = "[kJ/kg*K]";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 5][0] = "Cp";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 5][i + 1] = nf.format(
+ (thermoSystem.getPhase(i).getCp() / (thermoSystem.getPhase(i).getNumberOfMolesInPhase()
+ * thermoSystem.getPhase(i).getMolarMass() * 1000)),
+ buf, test).toString();
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 5][4] = "[kJ/kg*K]";
buf = new StringBuffer();
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 7][0] = "Viscosity";
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 7][i + 1] =
- nf.format((thermoSystem.getPhases()[i].getPhysicalProperties().getViscosity()), buf, test)
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 7][0] = "Viscosity";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 7][i + 1] =
+ nf.format((thermoSystem.getPhase(i).getPhysicalProperties().getViscosity()), buf, test)
.toString();
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 7][4] = "[kg/m*sec]";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 7][4] = "[kg/m*sec]";
buf = new StringBuffer();
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 8][0] = "Conductivity";
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 8][i + 1] = nf
- .format(thermoSystem.getPhases()[i].getPhysicalProperties().getConductivity(), buf, test)
- .toString();
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 8][4] = "[W/m*K]";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 8][0] = "Conductivity";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 8][i + 1] =
+ nf.format(thermoSystem.getPhase(i).getPhysicalProperties().getConductivity(), buf, test)
+ .toString();
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 8][4] = "[W/m*K]";
buf = new StringBuffer();
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 10][0] = "Pressure";
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 10][i + 1] =
- Double.toString(thermoSystem.getPhases()[i].getPressure());
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 10][4] = "[bar]";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 10][0] = "Pressure";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 10][i + 1] =
+ Double.toString(thermoSystem.getPhase(i).getPressure());
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 10][4] = "[bar]";
buf = new StringBuffer();
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 11][0] = "Temperature";
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 11][i + 1] =
- Double.toString(thermoSystem.getPhases()[i].getTemperature());
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 11][4] = "[K]";
- Double.toString(thermoSystem.getPhases()[i].getTemperature());
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 11][0] = "Temperature";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 11][i + 1] =
+ Double.toString(thermoSystem.getPhase(i).getTemperature());
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 11][4] = "[K]";
+ Double.toString(thermoSystem.getPhase(i).getTemperature());
buf = new StringBuffer();
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 13][0] = "Stream";
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 13][i + 1] = name;
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 13][4] = "-";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 13][0] = "Stream";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 13][i + 1] = name;
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 13][4] = "-";
}
String[] names = {"", "Phase 1", "Phase 2", "Phase 3", "Unit"};
diff --git a/src/main/java/neqsim/process/equipment/mixer/StaticMixer.java b/src/main/java/neqsim/process/equipment/mixer/StaticMixer.java
index 912eecd3e..fb91205a2 100644
--- a/src/main/java/neqsim/process/equipment/mixer/StaticMixer.java
+++ b/src/main/java/neqsim/process/equipment/mixer/StaticMixer.java
@@ -37,25 +37,25 @@ public void mixStream() {
int index = 0;
String compName = new String();
for (int k = 1; k < streams.size(); k++) {
- for (int i = 0; i < streams.get(k).getThermoSystem().getPhases()[0]
+ for (int i = 0; i < streams.get(k).getThermoSystem().getPhase(0)
.getNumberOfComponents(); i++) {
boolean gotComponent = false;
String componentName =
- streams.get(k).getThermoSystem().getPhases()[0].getComponent(i).getName();
+ streams.get(k).getThermoSystem().getPhase(0).getComponent(i).getName();
// System.out.println("adding: " + componentName);
double moles =
- streams.get(k).getThermoSystem().getPhases()[0].getComponent(i).getNumberOfmoles();
+ streams.get(k).getThermoSystem().getPhase(0).getComponent(i).getNumberOfmoles();
// System.out.println("moles: " + moles + " " +
- // mixedStream.getThermoSystem().getPhases()[0].getNumberOfComponents());
- for (int p = 0; p < mixedStream.getThermoSystem().getPhases()[0]
+ // mixedStream.getThermoSystem().getPhase(0).getNumberOfComponents());
+ for (int p = 0; p < mixedStream.getThermoSystem().getPhase(0)
.getNumberOfComponents(); p++) {
- if (mixedStream.getThermoSystem().getPhases()[0].getComponent(p).getName()
+ if (mixedStream.getThermoSystem().getPhase(0).getComponent(p).getName()
.equals(componentName)) {
gotComponent = true;
- index = streams.get(0).getThermoSystem().getPhases()[0].getComponent(p)
- .getComponentNumber();
- compName = streams.get(0).getThermoSystem().getPhases()[0].getComponent(p)
- .getComponentName();
+ index =
+ streams.get(0).getThermoSystem().getPhase(0).getComponent(p).getComponentNumber();
+ compName =
+ streams.get(0).getThermoSystem().getPhase(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 ff5c18a77..2b5068c61 100644
--- a/src/main/java/neqsim/process/equipment/mixer/StaticNeqMixer.java
+++ b/src/main/java/neqsim/process/equipment/mixer/StaticNeqMixer.java
@@ -39,29 +39,29 @@ public void mixStream() {
String compName = new String();
for (int k = 1; k < streams.size(); k++) {
- for (int i = 0; i < streams.get(k).getThermoSystem().getPhases()[0]
+ for (int i = 0; i < streams.get(k).getThermoSystem().getPhase(0)
.getNumberOfComponents(); i++) {
boolean gotComponent = false;
String componentName =
- streams.get(k).getThermoSystem().getPhases()[0].getComponent(i).getName();
+ streams.get(k).getThermoSystem().getPhase(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].getComponent(i)
+ moles[p] = streams.get(k).getThermoSystem().getPhase(p).getComponent(i)
.getNumberOfMolesInPhase();
}
- for (int p = 0; p < mixedStream.getThermoSystem().getPhases()[0]
+ for (int p = 0; p < mixedStream.getThermoSystem().getPhase(0)
.getNumberOfComponents(); p++) {
- if (mixedStream.getThermoSystem().getPhases()[0].getComponent(p).getName()
+ if (mixedStream.getThermoSystem().getPhase(0).getComponent(p).getName()
.equals(componentName)) {
gotComponent = true;
- index = streams.get(0).getThermoSystem().getPhases()[0].getComponent(p)
- .getComponentNumber();
- compName = streams.get(0).getThermoSystem().getPhases()[0].getComponent(p)
- .getComponentName();
+ index =
+ streams.get(0).getThermoSystem().getPhase(0).getComponent(p).getComponentNumber();
+ compName =
+ streams.get(0).getThermoSystem().getPhase(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 ec1fa6476..348ca2afa 100644
--- a/src/main/java/neqsim/process/equipment/mixer/StaticPhaseMixer.java
+++ b/src/main/java/neqsim/process/equipment/mixer/StaticPhaseMixer.java
@@ -32,11 +32,11 @@ public void mixStream() {
String compName = new String();
for (int k = 1; k < streams.size(); k++) {
- for (int i = 0; i < streams.get(k).getThermoSystem().getPhases()[0]
+ for (int i = 0; i < streams.get(k).getThermoSystem().getPhase(0)
.getNumberOfComponents(); i++) {
boolean gotComponent = false;
String componentName =
- streams.get(k).getThermoSystem().getPhases()[0].getComponent(i).getName();
+ streams.get(k).getThermoSystem().getPhase(0).getComponent(i).getName();
System.out.println("adding: " + componentName);
int numberOfPhases = streams.get(k).getThermoSystem().getNumberOfPhases();
double[] moles = new double[numberOfPhases];
@@ -55,15 +55,15 @@ public void mixStream() {
.setTemperature(streams.get(k).getThermoSystem().getTemperature());
}
- for (int p = 0; p < mixedStream.getThermoSystem().getPhases()[0]
+ for (int p = 0; p < mixedStream.getThermoSystem().getPhase(0)
.getNumberOfComponents(); p++) {
- if (mixedStream.getThermoSystem().getPhases()[0].getComponent(p).getName()
+ if (mixedStream.getThermoSystem().getPhase(0).getComponent(p).getName()
.equals(componentName)) {
gotComponent = true;
- index = streams.get(0).getThermoSystem().getPhases()[0].getComponent(p)
- .getComponentNumber();
- compName = streams.get(0).getThermoSystem().getPhases()[0].getComponent(p)
- .getComponentName();
+ index =
+ streams.get(0).getThermoSystem().getPhase(0).getComponent(p).getComponentNumber();
+ compName =
+ streams.get(0).getThermoSystem().getPhase(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 43568fab0..8d695d4ac 100644
--- a/src/main/java/neqsim/process/equipment/pump/Pump.java
+++ b/src/main/java/neqsim/process/equipment/pump/Pump.java
@@ -212,72 +212,72 @@ public void displayResult() {
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].getComponent(j).getName();
+ for (int j = 0; j < thermoSystem.getPhase(0).getNumberOfComponents(); j++) {
+ table[j + 1][0] = thermoSystem.getPhase(0).getComponent(j).getName();
buf = new StringBuffer();
table[j + 1][i + 1] =
- nf.format(thermoSystem.getPhases()[i].getComponent(j).getx(), buf, test).toString();
+ nf.format(thermoSystem.getPhase(i).getComponent(j).getx(), buf, test).toString();
table[j + 1][4] = "[-]";
}
buf = new StringBuffer();
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 2][0] = "Density";
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 2][i + 1] =
- nf.format(thermoSystem.getPhases()[i].getPhysicalProperties().getDensity(), buf, test)
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 2][0] = "Density";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 2][i + 1] =
+ nf.format(thermoSystem.getPhase(i).getPhysicalProperties().getDensity(), buf, test)
.toString();
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 2][4] = "[kg/m^3]";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 2][4] = "[kg/m^3]";
- // Double.longValue(thermoSystem.getPhases()[i].getBeta());
+ // Double.longValue(thermoSystem.getPhase(i).getBeta());
buf = new StringBuffer();
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 3][0] = "PhaseFraction";
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 3][i + 1] =
- nf.format(thermoSystem.getPhases()[i].getBeta(), buf, test).toString();
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 3][4] = "[-]";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 3][0] = "PhaseFraction";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 3][i + 1] =
+ nf.format(thermoSystem.getPhase(i).getBeta(), buf, test).toString();
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 3][4] = "[-]";
buf = new StringBuffer();
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 4][0] = "MolarMass";
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 4][i + 1] =
- nf.format(thermoSystem.getPhases()[i].getMolarMass() * 1000, buf, test).toString();
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 4][4] = "[kg/kmol]";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 4][0] = "MolarMass";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 4][i + 1] =
+ nf.format(thermoSystem.getPhase(i).getMolarMass() * 1000, buf, test).toString();
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 4][4] = "[kg/kmol]";
buf = new StringBuffer();
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 5][0] = "Cp";
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 5][i + 1] =
- nf.format((thermoSystem.getPhases()[i].getCp()
- / thermoSystem.getPhases()[i].getNumberOfMolesInPhase() * 1.0
- / thermoSystem.getPhases()[i].getMolarMass() * 1000), buf, test).toString();
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 5][4] = "[kJ/kg*K]";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 5][0] = "Cp";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 5][i + 1] = nf.format(
+ (thermoSystem.getPhase(i).getCp() / thermoSystem.getPhase(i).getNumberOfMolesInPhase()
+ * 1.0 / thermoSystem.getPhase(i).getMolarMass() * 1000),
+ buf, test).toString();
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 5][4] = "[kJ/kg*K]";
buf = new StringBuffer();
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 7][0] = "Viscosity";
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 7][i + 1] =
- nf.format((thermoSystem.getPhases()[i].getPhysicalProperties().getViscosity()), buf, test)
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 7][0] = "Viscosity";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 7][i + 1] =
+ nf.format((thermoSystem.getPhase(i).getPhysicalProperties().getViscosity()), buf, test)
.toString();
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 7][4] = "[kg/m*sec]";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 7][4] = "[kg/m*sec]";
buf = new StringBuffer();
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 8][0] = "Conductivity";
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 8][i + 1] = nf
- .format(thermoSystem.getPhases()[i].getPhysicalProperties().getConductivity(), buf, test)
- .toString();
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 8][4] = "[W/m*K]";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 8][0] = "Conductivity";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 8][i + 1] =
+ nf.format(thermoSystem.getPhase(i).getPhysicalProperties().getConductivity(), buf, test)
+ .toString();
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 8][4] = "[W/m*K]";
buf = new StringBuffer();
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 10][0] = "Pressure";
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 10][i + 1] =
- Double.toString(thermoSystem.getPhases()[i].getPressure());
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 10][4] = "[bar]";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 10][0] = "Pressure";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 10][i + 1] =
+ Double.toString(thermoSystem.getPhase(i).getPressure());
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 10][4] = "[bar]";
buf = new StringBuffer();
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 11][0] = "Temperature";
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 11][i + 1] =
- Double.toString(thermoSystem.getPhases()[i].getTemperature());
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 11][4] = "[K]";
- Double.toString(thermoSystem.getPhases()[i].getTemperature());
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 11][0] = "Temperature";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 11][i + 1] =
+ Double.toString(thermoSystem.getPhase(i).getTemperature());
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 11][4] = "[K]";
+ Double.toString(thermoSystem.getPhase(i).getTemperature());
buf = new StringBuffer();
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 13][0] = "Stream";
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 13][i + 1] = name;
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 13][4] = "-";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 13][0] = "Stream";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 13][i + 1] = name;
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 13][4] = "-";
}
JTable Jtab = new JTable(table, names);
diff --git a/src/main/java/neqsim/process/equipment/separator/Hydrocyclone.java b/src/main/java/neqsim/process/equipment/separator/Hydrocyclone.java
index 357ee7201..8eeb3424b 100644
--- a/src/main/java/neqsim/process/equipment/separator/Hydrocyclone.java
+++ b/src/main/java/neqsim/process/equipment/separator/Hydrocyclone.java
@@ -52,7 +52,7 @@ public void setInletStream(StreamInterface inletStream) {
super.setInletStream(inletStream);
thermoSystem = inletStream.getThermoSystem().clone();
- waterSystem = thermoSystem.phaseToSystem(thermoSystem.getPhases()[1]);
+ waterSystem = thermoSystem.phaseToSystem(thermoSystem.getPhase(1));
waterOutStream = new Stream("waterOutStream", waterSystem);
}
diff --git a/src/main/java/neqsim/process/equipment/separator/NeqGasScrubber.java b/src/main/java/neqsim/process/equipment/separator/NeqGasScrubber.java
index 0a63d3a72..c1541bf20 100644
--- a/src/main/java/neqsim/process/equipment/separator/NeqGasScrubber.java
+++ b/src/main/java/neqsim/process/equipment/separator/NeqGasScrubber.java
@@ -74,11 +74,11 @@ public void setInletStream(StreamInterface inletStream) {
this.inletStream = inletStream;
thermoSystem = inletStream.getThermoSystem().clone();
- gasSystem = thermoSystem.phaseToSystem(thermoSystem.getPhases()[0]);
+ gasSystem = thermoSystem.phaseToSystem(thermoSystem.getPhase(0));
gasOutStream = new Stream("gasOutStream", gasSystem);
thermoSystem = inletStream.getThermoSystem().clone();
- liquidSystem = thermoSystem.phaseToSystem(thermoSystem.getPhases()[1]);
+ liquidSystem = thermoSystem.phaseToSystem(thermoSystem.getPhase(1));
liquidOutStream = new Stream("liquidOutStream", liquidSystem);
}
@@ -121,12 +121,12 @@ public StreamInterface getLiquid() {
@Override
public void run(UUID id) {
thermoSystem = inletStream.getThermoSystem().clone();
- gasSystem = thermoSystem.phaseToSystem(thermoSystem.getPhases()[0]);
+ gasSystem = thermoSystem.phaseToSystem(thermoSystem.getPhase(0));
gasSystem.setNumberOfPhases(1);
gasOutStream.setThermoSystem(gasSystem);
thermoSystem = inletStream.getThermoSystem().clone();
- liquidSystem = thermoSystem.phaseToSystem(thermoSystem.getPhases()[1]);
+ liquidSystem = thermoSystem.phaseToSystem(thermoSystem.getPhase(1));
liquidSystem.setNumberOfPhases(1);
liquidOutStream.setThermoSystem(liquidSystem);
setCalculationIdentifier(id);
diff --git a/src/main/java/neqsim/process/equipment/separator/Separator.java b/src/main/java/neqsim/process/equipment/separator/Separator.java
index e78983e8e..9712b56ca 100644
--- a/src/main/java/neqsim/process/equipment/separator/Separator.java
+++ b/src/main/java/neqsim/process/equipment/separator/Separator.java
@@ -122,11 +122,11 @@ public void initMechanicalDesign() {
public void setInletStream(StreamInterface inletStream) {
inletStreamMixer.addStream(inletStream);
thermoSystem = inletStream.getThermoSystem().clone();
- gasSystem = thermoSystem.phaseToSystem(thermoSystem.getPhases()[0]);
+ gasSystem = thermoSystem.phaseToSystem(thermoSystem.getPhase(0));
gasOutStream = new Stream("gasOutStream", gasSystem);
thermoSystem = inletStream.getThermoSystem().clone();
- liquidSystem = thermoSystem.phaseToSystem(thermoSystem.getPhases()[1]);
+ liquidSystem = thermoSystem.phaseToSystem(thermoSystem.getPhase(1));
liquidOutStream = new Stream("liquidOutStream", liquidSystem);
}
diff --git a/src/main/java/neqsim/process/equipment/separator/ThreePhaseSeparator.java b/src/main/java/neqsim/process/equipment/separator/ThreePhaseSeparator.java
index f10c38358..d7c9c2c17 100644
--- a/src/main/java/neqsim/process/equipment/separator/ThreePhaseSeparator.java
+++ b/src/main/java/neqsim/process/equipment/separator/ThreePhaseSeparator.java
@@ -113,7 +113,7 @@ public void setInletStream(StreamInterface inletStream) {
super.setInletStream(inletStream);
thermoSystem = inletStream.getThermoSystem().clone();
- waterSystem = thermoSystem.phaseToSystem(thermoSystem.getPhases()[1]);
+ waterSystem = thermoSystem.phaseToSystem(thermoSystem.getPhase(1));
waterOutStream = new Stream("waterOutStream", waterSystem);
}
diff --git a/src/main/java/neqsim/process/equipment/separator/TwoPhaseSeparator.java b/src/main/java/neqsim/process/equipment/separator/TwoPhaseSeparator.java
index d3c53f311..417e2962f 100644
--- a/src/main/java/neqsim/process/equipment/separator/TwoPhaseSeparator.java
+++ b/src/main/java/neqsim/process/equipment/separator/TwoPhaseSeparator.java
@@ -55,11 +55,11 @@ public void setInletStream(StreamInterface inletStream) {
this.inletStream = inletStream;
thermoSystem = inletStream.getThermoSystem().clone();
- gasSystem = thermoSystem.phaseToSystem(thermoSystem.getPhases()[0]);
+ gasSystem = thermoSystem.phaseToSystem(thermoSystem.getPhase(0));
gasOutStream = new Stream("gasOutStream", gasSystem);
thermoSystem = inletStream.getThermoSystem().clone();
- liquidSystem = thermoSystem.phaseToSystem(thermoSystem.getPhases()[1]);
+ liquidSystem = thermoSystem.phaseToSystem(thermoSystem.getPhase(1));
liquidOutStream = new Stream("liquidOutStream", liquidSystem);
}
@@ -91,12 +91,12 @@ public StreamInterface getLiquid() {
@Override
public void run(UUID id) {
thermoSystem = inletStream.getThermoSystem().clone();
- gasSystem = thermoSystem.phaseToSystem(thermoSystem.getPhases()[0]);
+ gasSystem = thermoSystem.phaseToSystem(thermoSystem.getPhase(0));
gasSystem.setNumberOfPhases(1);
gasOutStream.setThermoSystem(gasSystem);
thermoSystem = inletStream.getThermoSystem().clone();
- liquidSystem = thermoSystem.phaseToSystem(thermoSystem.getPhases()[1]);
+ liquidSystem = thermoSystem.phaseToSystem(thermoSystem.getPhase(1));
liquidSystem.setNumberOfPhases(1);
liquidOutStream.setThermoSystem(liquidSystem);
setCalculationIdentifier(id);
diff --git a/src/main/java/neqsim/process/equipment/tank/Tank.java b/src/main/java/neqsim/process/equipment/tank/Tank.java
index b87ecacf3..999476d47 100644
--- a/src/main/java/neqsim/process/equipment/tank/Tank.java
+++ b/src/main/java/neqsim/process/equipment/tank/Tank.java
@@ -79,11 +79,11 @@ public Tank(String name, StreamInterface inletStream) {
public void setInletStream(StreamInterface inletStream) {
inletStreamMixer.addStream(inletStream);
thermoSystem = inletStream.getThermoSystem().clone();
- gasSystem = thermoSystem.phaseToSystem(thermoSystem.getPhases()[0]);
+ gasSystem = thermoSystem.phaseToSystem(thermoSystem.getPhase(0));
gasOutStream = new Stream("gasOutStream", gasSystem);
thermoSystem = inletStream.getThermoSystem().clone();
- liquidSystem = thermoSystem.phaseToSystem(thermoSystem.getPhases()[1]);
+ liquidSystem = thermoSystem.phaseToSystem(thermoSystem.getPhase(1));
liquidOutStream = new Stream("liquidOutStream", liquidSystem);
}
diff --git a/src/main/java/neqsim/standards/Standard.java b/src/main/java/neqsim/standards/Standard.java
index 85f698349..0de05e0da 100644
--- a/src/main/java/neqsim/standards/Standard.java
+++ b/src/main/java/neqsim/standards/Standard.java
@@ -123,12 +123,12 @@ public String[][] createTable(String name) {
nf.setMaximumFractionDigits(5);
nf.applyPattern("#.#####E0");
- int rows = thermoSystem.getPhases()[0].getNumberOfComponents() + 30;
+ int rows = thermoSystem.getPhase(0).getNumberOfComponents() + 30;
String[][] table = new String[rows][6];
// String[] names = {"", "Phase 1", "Phase 2", "Phase 3", "Unit"};
- table[0][0] = ""; // getPhases()[0].getType(); //"";
+ table[0][0] = ""; // getPhase(0).getType(); //"";
- for (int i = 0; i < thermoSystem.getPhases()[0].getNumberOfComponents() + 30; i++) {
+ for (int i = 0; i < thermoSystem.getPhase(0).getNumberOfComponents() + 30; i++) {
for (int j = 0; j < 6; j++) {
table[i][j] = "";
}
@@ -140,8 +140,8 @@ public String[][] createTable(String name) {
StringBuffer buf = new StringBuffer();
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].getComponent(j).getName();
+ for (int j = 0; j < thermoSystem.getPhase(0).getNumberOfComponents(); j++) {
+ table[j + 1][0] = thermoSystem.getPhase(0).getComponent(j).getName();
buf = new StringBuffer();
table[j + 1][i + 1] =
nf.format(thermoSystem.getPhase(thermoSystem.getPhaseIndex(i)).getComponent(j).getx(),
diff --git a/src/main/java/neqsim/standards/gasquality/Draft_GERG2004.java b/src/main/java/neqsim/standards/gasquality/Draft_GERG2004.java
index 9254e8136..7b0a4807c 100644
--- a/src/main/java/neqsim/standards/gasquality/Draft_GERG2004.java
+++ b/src/main/java/neqsim/standards/gasquality/Draft_GERG2004.java
@@ -118,13 +118,13 @@ public String[][] createTable(String name) {
return table;
}
- rows = thermoSystem.getPhases()[0].getNumberOfComponents() + 30;
+ rows = thermoSystem.getPhase(0).getNumberOfComponents() + 30;
String[][] table = new String[rows][6];
// String[] names = {"", "Phase 1", "Phase 2", "Phase 3", "Unit"};
- table[0][0] = ""; // getPhases()[0].getType(); //"";
+ table[0][0] = ""; // getPhase(0).getType(); //"";
- for (int i = 0; i < thermoSystem.getPhases()[0].getNumberOfComponents() + 30; i++) {
+ for (int i = 0; i < thermoSystem.getPhase(0).getNumberOfComponents() + 30; i++) {
for (int j = 0; j < 6; j++) {
table[i][j] = "";
}
@@ -136,8 +136,8 @@ public String[][] createTable(String name) {
StringBuffer buf = new StringBuffer();
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].getComponent(j).getName();
+ for (int j = 0; j < thermoSystem.getPhase(0).getNumberOfComponents(); j++) {
+ table[j + 1][0] = thermoSystem.getPhase(0).getComponent(j).getName();
buf = new StringBuffer();
table[j + 1][i + 1] =
nf.format(thermoSystem.getPhase(thermoSystem.getPhaseIndex(i)).getComponent(j).getx(),
@@ -146,10 +146,10 @@ public String[][] createTable(String name) {
}
buf = new StringBuffer();
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 3][0] = "Compressibility Factor";
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 3][i + 1] =
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 3][0] = "Compressibility Factor";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 3][i + 1] =
nf.format(thermoSystem.getPhase(i).getZ());
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 3][4] = "[-]";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 3][4] = "[-]";
buf = new StringBuffer();
table[thermoSystem.getPhase(thermoSystem.getPhaseIndex(i)).getNumberOfComponents() + 4][0] =
@@ -197,16 +197,16 @@ public String[][] createTable(String name) {
"[kJ/kg*K]";
buf = new StringBuffer();
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 10][0] = "Pressure";
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 10][i + 1] =
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 10][0] = "Pressure";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 10][i + 1] =
Double.toString(thermoSystem.getPhase(thermoSystem.getPhaseIndex(i)).getPressure());
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 10][4] = "[bar]";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 10][4] = "[bar]";
buf = new StringBuffer();
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 11][0] = "Temperature";
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 11][i + 1] =
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 11][0] = "Temperature";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 11][i + 1] =
Double.toString(thermoSystem.getPhase(thermoSystem.getPhaseIndex(i)).getTemperature());
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 11][4] = "[K]";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 11][4] = "[K]";
Double.toString(thermoSystem.getPhase(thermoSystem.getPhaseIndex(i)).getTemperature());
}
diff --git a/src/main/java/neqsim/standards/gasquality/Standard_ISO6976.java b/src/main/java/neqsim/standards/gasquality/Standard_ISO6976.java
index 4198aee66..473eb3f1e 100644
--- a/src/main/java/neqsim/standards/gasquality/Standard_ISO6976.java
+++ b/src/main/java/neqsim/standards/gasquality/Standard_ISO6976.java
@@ -367,6 +367,12 @@ public double getValue(String returnParameter, String returnUnit) {
}
}
+ /** {@inheritDoc} */
+ @Override
+ public double getValue(String returnParameter) {
+ return getValue(returnParameter, "");
+ }
+
/**
*
* checkReferenceCondition.
@@ -385,12 +391,6 @@ public void checkReferenceCondition() {
}
}
- /** {@inheritDoc} */
- @Override
- public double getValue(String returnParameter) {
- return getValue(returnParameter, "");
- }
-
/** {@inheritDoc} */
@Override
public String getUnit(String returnParameter) {
@@ -424,13 +424,13 @@ public String[][] createTable(String name) {
return table;
}
- rows = thermoSystem.getPhases()[0].getNumberOfComponents() + 30;
+ rows = thermoSystem.getPhase(0).getNumberOfComponents() + 30;
String[][] table = new String[rows][6];
// String[] names = { "", "Phase 1", "Phase 2", "Phase 3", "Unit" };
- table[0][0] = ""; // getPhases()[0].getType(); //"";
+ table[0][0] = ""; // getPhase(0).getType(); //"";
- for (int i = 0; i < thermoSystem.getPhases()[0].getNumberOfComponents() + 30; i++) {
+ for (int i = 0; i < thermoSystem.getPhase(0).getNumberOfComponents() + 30; i++) {
for (int j = 0; j < 6; j++) {
table[i][j] = "";
}
@@ -451,8 +451,8 @@ public String[][] createTable(String name) {
referenceTypeUnit = "mol";
}
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].getComponent(j).getName();
+ for (int j = 0; j < thermoSystem.getPhase(0).getNumberOfComponents(); j++) {
+ table[j + 1][0] = thermoSystem.getPhase(0).getComponent(j).getName();
buf = new StringBuffer();
table[j + 1][i + 1] =
nf.format(thermoSystem.getPhase(thermoSystem.getPhaseIndex(i)).getComponent(j).getx(),
@@ -461,77 +461,75 @@ public String[][] createTable(String name) {
}
buf = new StringBuffer();
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 3][0] = "Compressibility Factor";
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 3][i + 1] =
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 3][0] = "Compressibility Factor";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 3][i + 1] =
nf.format(getValue("CompressionFactor"));
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 3][4] = "[-]";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 3][4] = "[-]";
buf = new StringBuffer();
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 4][0] =
- "Superior Calorific Value";
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 4][i + 1] =
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 4][0] = "Superior Calorific Value";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 4][i + 1] =
nf.format(getValue("SuperiorCalorificValue"));
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 4][4] =
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 4][4] =
"[kJ/" + referenceTypeUnit + "]";
buf = new StringBuffer();
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 5][0] =
- "Inferior Calorific Value";
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 5][i + 1] =
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 5][0] = "Inferior Calorific Value";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 5][i + 1] =
nf.format(getValue("InferiorCalorificValue"));
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 5][4] =
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 5][4] =
"[kJ/" + referenceTypeUnit + "]";
buf = new StringBuffer();
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 6][0] = "Superior Wobbe Index";
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 6][i + 1] =
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 6][0] = "Superior Wobbe Index";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 6][i + 1] =
nf.format(getValue("SuperiorWobbeIndex") / 3600.0);
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 6][4] =
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 6][4] =
"[kWh/" + referenceTypeUnit + "]";
buf = new StringBuffer();
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 7][0] = "Superior Wobbe Index";
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 7][i + 1] =
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 7][0] = "Superior Wobbe Index";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 7][i + 1] =
nf.format(getValue("SuperiorWobbeIndex"));
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 7][4] =
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 7][4] =
"[kJ/" + referenceTypeUnit + "]";
buf = new StringBuffer();
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 8][0] = "Inferior Wobbe Index";
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 8][i + 1] =
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 8][0] = "Inferior Wobbe Index";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 8][i + 1] =
nf.format(getValue("InferiorWobbeIndex"));
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 8][4] =
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 8][4] =
"[kJ/" + referenceTypeUnit + "]";
buf = new StringBuffer();
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 9][0] = "Relative Density";
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 9][i + 1] =
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 9][0] = "Relative Density";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 9][i + 1] =
nf.format(getValue("RelativeDensity"));
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 9][4] = "[-]";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 9][4] = "[-]";
buf = new StringBuffer();
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 10][0] = "Molar Mass";
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 10][i + 1] =
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 10][0] = "Molar Mass";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 10][i + 1] =
nf.format(getValue("MolarMass"));
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 10][4] = "[gr/mol]";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 10][4] = "[gr/mol]";
buf = new StringBuffer();
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 11][0] = "Density";
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 11][i + 1] =
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 11][0] = "Density";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 11][i + 1] =
nf.format(getValue("DensityReal"));
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 11][4] = "[kg/m^3]";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 11][4] = "[kg/m^3]";
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 13][0] =
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 13][0] =
"Reference Temperature Combustion";
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 13][i + 1] =
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 13][i + 1] =
Double.toString(getEnergyRefT());
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 13][4] = "[C]";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 13][4] = "[C]";
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 14][0] =
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 14][0] =
"Reference Temperature Volume";
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 14][i + 1] =
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 14][i + 1] =
Double.toString(getVolRefT());
- table[thermoSystem.getPhases()[0].getNumberOfComponents() + 14][4] = "[C]";
+ table[thermoSystem.getPhase(0).getNumberOfComponents() + 14][4] = "[C]";
}
resultTable = table;
@@ -624,7 +622,7 @@ public ArrayList
@@ -35,8 +33,8 @@ public QfuncFlash() { *
* * @param system a {@link neqsim.thermo.system.SystemInterface} object - * @param Hspec a double - * @param type a int + * @param Hspec a double + * @param type a int */ public QfuncFlash(SystemInterface system, double Hspec, int type) { this.system = system; @@ -77,7 +75,8 @@ public double calcdQdT() { * @return a double */ public double solveQ() { - double oldTemp = 1.0 / system.getTemperature(), nyTemp = 1.0 / system.getTemperature(); + double oldTemp = 1.0 / system.getTemperature(); + double nyTemp = 1.0 / system.getTemperature(); double iterations = 1; do { iterations++; @@ -95,8 +94,8 @@ public double solveQ() { public void run() { tpFlash.run(); logger.info("entropy: " + system.getEntropy()); - SysNewtonRhapsonPHflash secondOrderSolver = new SysNewtonRhapsonPHflash(system, 2, - system.getPhases()[0].getNumberOfComponents(), type); + SysNewtonRhapsonPHflash secondOrderSolver = + new SysNewtonRhapsonPHflash(system, 2, system.getPhase(0).getNumberOfComponents(), type); secondOrderSolver.setSpec(Hspec); secondOrderSolver.solve(1); } diff --git a/src/main/java/neqsim/thermodynamicoperations/flashops/SolidFlash.java b/src/main/java/neqsim/thermodynamicoperations/flashops/SolidFlash.java index b8711ad3b..6ee6611a1 100644 --- a/src/main/java/neqsim/thermodynamicoperations/flashops/SolidFlash.java +++ b/src/main/java/neqsim/thermodynamicoperations/flashops/SolidFlash.java @@ -76,7 +76,7 @@ public void calcMultiPhaseBeta() {} */ public void setXY() { for (int k = 0; k < system.getNumberOfPhases() - 1; k++) { - for (int i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { + for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { system.getPhase(k).getComponent(i).setx(system.getPhase(0).getComponent(i).getz() / E[i] / system.getPhase(k).getComponent(i).getFugacityCoefficient()); /* @@ -98,7 +98,7 @@ public void setXY() { public void checkX() { for (int k = 0; k < system.getNumberOfPhases() - 1; k++) { double x = 0.0; - for (int i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { + for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { x += system.getPhase(k).getComponent(i).getx(); } // logger.info("x tot " + x + " PHASE " + k); @@ -123,9 +123,9 @@ public void checkX() { * */ public void calcE() { - E = new double[system.getPhases()[0].getNumberOfComponents()]; + E = new double[system.getPhase(0).getNumberOfComponents()]; - for (int i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { + for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { E[i] = 0.0; for (int k = 0; k < system.getNumberOfPhases() - 1; k++) { E[i] += system.getBeta(k) / system.getPhase(k).getComponent(i).getFugacityCoefficient(); @@ -137,7 +137,7 @@ public void calcE() { // system.getBeta(system.getNumberOfPhases()-1) / // system.getPhase(3).getComponent(solidComponent).getFugacityCoefficient(); E[solidComponent] = system.getPhase(0).getComponent(solidComponent).getz() - / system.getPhases()[3].getComponents()[solidComponent].getFugacityCoefficient(); + / system.getPhase(3).getComponents()[solidComponent].getFugacityCoefficient(); // logger.info("Ei " +E[solidComponent]); // logger.info("fug " // +system.getPhase(3).getComponent(solidComponent).getFugacityCoefficient()); @@ -162,15 +162,14 @@ public double calcQ() { } Q = betaTotal; - for (int i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { + for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { Q -= Math.log(E[i]) * system.getPhase(0).getComponent(i).getz(); } for (int k = 0; k < system.getNumberOfPhases() - 1; k++) { - dQdbeta[k] = - 1.0 - system.getPhases()[3].getComponents()[solidComponent].getFugacityCoefficient() - / system.getPhase(k).getComponent(solidComponent).getFugacityCoefficient(); - for (int i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { + dQdbeta[k] = 1.0 - system.getPhase(3).getComponents()[solidComponent].getFugacityCoefficient() + / system.getPhase(k).getComponent(solidComponent).getFugacityCoefficient(); + for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { if (i != solidComponent) { dQdbeta[k] -= system.getPhase(0).getComponent(i).getz() * 1.0 / E[i] / system.getPhase(k).getComponent(i).getFugacityCoefficient(); @@ -184,7 +183,7 @@ public double calcQ() { if (i != j) { Qmatrix[i][j] = 0; } - for (int k = 0; k < system.getPhases()[0].getNumberOfComponents(); k++) { + for (int k = 0; k < system.getPhase(0).getNumberOfComponents(); k++) { if (k != solidComponent) { Qmatrix[i][j] += system.getPhase(0).getComponent(k).getz() / (E[k] * E[k] * system.getPhase(j).getComponent(k).getFugacityCoefficient() diff --git a/src/main/java/neqsim/thermodynamicoperations/flashops/SolidFlash1.java b/src/main/java/neqsim/thermodynamicoperations/flashops/SolidFlash1.java index 531874987..7844b5595 100644 --- a/src/main/java/neqsim/thermodynamicoperations/flashops/SolidFlash1.java +++ b/src/main/java/neqsim/thermodynamicoperations/flashops/SolidFlash1.java @@ -55,13 +55,13 @@ public void calcMultiPhaseBeta() {} */ public void setXY() { for (int k = 0; k < system.getNumberOfPhases() - solidsNumber; k++) { - for (int i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { + for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { if (i != solidIndex) { system.getPhase(k).getComponent(i).setx(system.getPhase(0).getComponent(i).getz() / E[i] / system.getPhase(k).getComponent(i).getFugacityCoefficient()); } else { system.getPhase(k).getComponent(i) - .setx(system.getPhases()[3].getComponent(i).getFugacityCoefficient() + .setx(system.getPhase(3).getComponent(i).getFugacityCoefficient() / system.getPhase(k).getComponent(i).getFugacityCoefficient()); } } @@ -76,7 +76,7 @@ public void setXY() { public void checkX() { for (int k = 0; k < system.getNumberOfPhases() - 1; k++) { double x = 0.0; - for (int i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { + for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { x += system.getPhase(k).getComponent(i).getx(); } // logger.info("x tot " + x + " PHASE " + k); @@ -101,9 +101,9 @@ public void checkX() { * */ public void calcE() { - E = new double[system.getPhases()[0].getNumberOfComponents()]; + E = new double[system.getPhase(0).getNumberOfComponents()]; - for (int i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { + for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { E[i] = 0.0; for (int k = 0; k < system.getNumberOfPhases() - solidsNumber; k++) { E[i] += system.getBeta(k) / system.getPhase(k).getComponent(i).getFugacityCoefficient(); @@ -130,7 +130,7 @@ public double calcQ() { } Q = betaTotal; - for (int i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { + for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { if (i != solidIndex) { Q -= Math.log(E[i]) * system.getPhase(0).getComponent(i).getz(); } @@ -138,10 +138,10 @@ public double calcQ() { for (int i = 0; i < solidsNumber; i++) { Q += system.getPhase(0).getComponent(solidIndex).getz() * (1 - Math.log(system.getPhase(0).getComponent(solidIndex).getz() - / system.getPhases()[3].getComponent(solidIndex).getFugacityCoefficient())); + / system.getPhase(3).getComponent(solidIndex).getFugacityCoefficient())); for (int j = 0; j < system.getNumberOfPhases() - solidsNumber; j++) { Q -= system.getBeta(j) - * system.getPhases()[3].getComponent(solidIndex).getFugacityCoefficient() + * system.getPhase(3).getComponent(solidIndex).getFugacityCoefficient() / system.getPhase(j).getComponent(solidIndex).getFugacityCoefficient(); } } @@ -156,9 +156,9 @@ public double calcQ() { public void calcQbeta() { for (int k = 0; k < system.getNumberOfPhases() - solidsNumber; k++) { dQdbeta[k] = 1.0; - for (int i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { + for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { if (i == solidIndex) { - dQdbeta[k] -= system.getPhases()[3].getComponents()[solidIndex].getFugacityCoefficient() + dQdbeta[k] -= system.getPhase(3).getComponents()[solidIndex].getFugacityCoefficient() / system.getPhase(k).getComponent(solidIndex).getFugacityCoefficient(); } else { dQdbeta[k] -= system.getPhase(0).getComponent(i).getz() / E[i] @@ -180,9 +180,9 @@ public void calcGradientAndHesian() { for (int k = 0; k < system.getNumberOfPhases() - solidsNumber; k++) { dQdbeta[k] = 1.0; - for (int i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { + for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { if (i == solidIndex) { - dQdbeta[k] -= system.getPhases()[3].getComponent(solidIndex).getFugacityCoefficient() + dQdbeta[k] -= system.getPhase(3).getComponent(solidIndex).getFugacityCoefficient() / system.getPhase(k).getComponent(solidIndex).getFugacityCoefficient(); } else { dQdbeta[k] -= system.getPhase(0).getComponent(i).getz() / E[i] @@ -194,7 +194,7 @@ public void calcGradientAndHesian() { for (int i = 0; i < system.getNumberOfPhases() - solidsNumber; i++) { Qmatrix[i][i] = 0; for (int j = 0; j < system.getNumberOfPhases() - solidsNumber; j++) { - for (int k = 0; k < system.getPhases()[0].getNumberOfComponents(); k++) { + for (int k = 0; k < system.getPhase(0).getNumberOfComponents(); k++) { if (k != solidIndex) { Qmatrix[i][j] += system.getPhase(0).getComponent(k).getz() / (E[k] * E[k] * system.getPhase(j).getComponent(k).getFugacityCoefficient() @@ -364,9 +364,9 @@ public double calcSolidBeta() { // double beta = 1.0; for (int i = 0; i < system.getNumberOfPhases() - solidsNumber; i++) { if (FluidPhaseActiveDescriptors[i] == 1) { - tempVar -= system.getBeta(i) - * system.getPhases()[3].getComponent(solidIndex).getFugacityCoefficient() - / system.getPhase(i).getComponent(solidIndex).getFugacityCoefficient(); + tempVar -= + system.getBeta(i) * system.getPhase(3).getComponent(solidIndex).getFugacityCoefficient() + / system.getPhase(i).getComponent(solidIndex).getFugacityCoefficient(); // beta -= system.getBeta(i); } } @@ -398,7 +398,7 @@ public void run() { } if (system.getPhase(0).getNumberOfComponents() == 1) { system.init(1); - if (system.getPhase(0).getFugacity(0) > system.getPhases()[3].getFugacity(0)) { + if (system.getPhase(0).getFugacity(0) > system.getPhase(3).getFugacity(0)) { system.setPhaseIndex(0, 3); } else { } @@ -445,7 +445,7 @@ public void run() { * @return a int */ public int checkAndAddSolidPhase() { - double[] solidCandidate = new double[system.getPhases()[0].getNumberOfComponents()]; + double[] solidCandidate = new double[system.getPhase(0).getNumberOfComponents()]; for (int k = 0; k < system.getPhase(0).getNumberOfComponents(); k++) { if (system.getTemperature() > system.getPhase(0).getComponent(k) @@ -453,13 +453,13 @@ public int checkAndAddSolidPhase() { solidCandidate[k] = 0; } else { solidCandidate[k] = system.getPhase(0).getComponent(k).getz(); - system.getPhases()[3].getComponent(k).setx(1.0); + system.getPhase(3).getComponent(k).setx(1.0); for (int i = 0; i < system.getNumberOfPhases(); i++) { // double e = system.getBeta(i)* - // system.getPhases()[3].getComponent(k).fugcoef(system.getPhases()[3]); - solidCandidate[k] -= system.getBeta(i) - * system.getPhases()[3].getComponent(k).fugcoef(system.getPhases()[3]) - / system.getPhase(i).getComponent(k).getFugacityCoefficient(); + // system.getPhase(3).getComponent(k).fugcoef(system.getPhase(3)); + solidCandidate[k] -= + system.getBeta(i) * system.getPhase(3).getComponent(k).fugcoef(system.getPhase(3)) + / system.getPhase(i).getComponent(k).getFugacityCoefficient(); } } } @@ -468,12 +468,12 @@ public int checkAndAddSolidPhase() { totalSolidFrac = 0; for (int i = 0; i < solidCandidate.length; i++) { if (solidCandidate[i] > 1e-20) { - system.getPhases()[3].getComponent(i).setx(1.0); + system.getPhase(3).getComponent(i).setx(1.0); solidIndex = i; solidsNumber++; totalSolidFrac += solidCandidate[i]; } else { - system.getPhases()[3].getComponent(i).setx(0.0); + system.getPhase(3).getComponent(i).setx(0.0); } } for (int i = oldSolidsNumber; i < solidsNumber; i++) { @@ -513,9 +513,8 @@ public double solvebeta1() { iter++; solidCandidate = system.getPhase(0).getComponents()[solidIndex].getz(); for (int i = 0; i < system.getNumberOfPhases(); i++) { - solidCandidate -= - system.getPhases()[3].getComponent(solidIndex).fugcoef(system.getPhases()[3]) - / system.getPhase(i).getComponent(solidIndex).getFugacityCoefficient(); + solidCandidate -= system.getPhase(3).getComponent(solidIndex).fugcoef(system.getPhase(3)) + / system.getPhase(i).getComponent(solidIndex).getFugacityCoefficient(); } double dsoliddn = (solidCandidate - solidCandidateOld) / dn; dn = -0.5 * solidCandidate / dsoliddn; diff --git a/src/main/java/neqsim/thermodynamicoperations/flashops/SolidFlash12.java b/src/main/java/neqsim/thermodynamicoperations/flashops/SolidFlash12.java index 6ab902d50..889b33343 100644 --- a/src/main/java/neqsim/thermodynamicoperations/flashops/SolidFlash12.java +++ b/src/main/java/neqsim/thermodynamicoperations/flashops/SolidFlash12.java @@ -59,13 +59,13 @@ public void calcMultiPhaseBeta() {} */ public void setXY() { for (int k = 0; k < system.getNumberOfPhases() - solidsNumber; k++) { - for (int i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { + for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { if (i != solidIndex) { system.getPhase(k).getComponent(i).setx(system.getPhase(0).getComponent(i).getz() / E[i] / system.getPhase(k).getComponent(i).getFugacityCoefficient()); } else { system.getPhase(k).getComponent(i) - .setx(system.getPhases()[3].getComponent(i).getFugacityCoefficient() + .setx(system.getPhase(3).getComponent(i).getFugacityCoefficient() / system.getPhase(k).getComponent(i).getFugacityCoefficient()); } } @@ -80,7 +80,7 @@ public void setXY() { public void checkX() { for (int k = 0; k < system.getNumberOfPhases() - 1; k++) { double x = 0.0; - for (int i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { + for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { x += system.getPhase(k).getComponent(i).getx(); } logger.info("x tot " + x + " PHASE " + k); @@ -105,9 +105,9 @@ public void checkX() { * */ public void calcE() { - E = new double[system.getPhases()[0].getNumberOfComponents()]; + E = new double[system.getPhase(0).getNumberOfComponents()]; - for (int i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { + for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { E[i] = 0.0; for (int k = 0; k < system.getNumberOfPhases() - solidsNumber; k++) { E[i] += system.getBeta(k) / system.getPhase(k).getComponent(i).getFugacityCoefficient(); @@ -134,7 +134,7 @@ public double calcQ() { } Q = betaTotal; - for (int i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { + for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { if (i != solidIndex) { Q -= Math.log(E[i]) * system.getPhase(0).getComponent(i).getz(); } @@ -143,19 +143,19 @@ public double calcQ() { for (int i = 0; i < solidsNumber; i++) { Q += system.getPhase(0).getComponent(solidIndex).getz() * (1 - Math.log(system.getPhase(0).getComponent(solidIndex).getz() - / system.getPhases()[3].getComponent(solidIndex).getFugacityCoefficient())); + / system.getPhase(3).getComponent(solidIndex).getFugacityCoefficient())); for (int j = 0; j < system.getNumberOfPhases() - solidsNumber; j++) { Q -= system.getBeta(j) - * system.getPhases()[3].getComponent(solidIndex).getFugacityCoefficient() + * system.getPhase(3).getComponent(solidIndex).getFugacityCoefficient() / system.getPhase(j).getComponent(solidIndex).getFugacityCoefficient(); } } for (int k = 0; k < system.getNumberOfPhases() - solidsNumber; k++) { dQdbeta[k] = 1.0; - for (int i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { + for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { if (i == solidIndex) { - dQdbeta[k] -= system.getPhases()[3].getComponents()[solidIndex].getFugacityCoefficient() + dQdbeta[k] -= system.getPhase(3).getComponents()[solidIndex].getFugacityCoefficient() / system.getPhase(k).getComponent(solidIndex).getFugacityCoefficient(); } else { dQdbeta[k] -= system.getPhase(0).getComponent(i).getz() / E[i] @@ -167,7 +167,7 @@ public double calcQ() { for (int i = 0; i < system.getNumberOfPhases() - solidsNumber; i++) { for (int j = 0; j < system.getNumberOfPhases() - solidsNumber; j++) { Qmatrix[i][j] = 0.0; - for (int k = 0; k < system.getPhases()[0].getNumberOfComponents(); k++) { + for (int k = 0; k < system.getPhase(0).getNumberOfComponents(); k++) { if (k != solidIndex) { Qmatrix[i][j] += system.getPhase(0).getComponent(k).getz() / (E[k] * E[k] * system.getPhase(j).getComponent(k).getFugacityCoefficient() @@ -329,7 +329,7 @@ public void run() { * @return a int */ public int checkAndAddSolidPhase() { - double[] solidCandidate = new double[system.getPhases()[0].getNumberOfComponents()]; + double[] solidCandidate = new double[system.getPhase(0).getNumberOfComponents()]; for (int k = 0; k < system.getPhase(0).getNumberOfComponents(); k++) { if (system.getTemperature() > system.getPhase(0).getComponent(k) @@ -337,10 +337,10 @@ public int checkAndAddSolidPhase() { solidCandidate[k] = -10; } else { solidCandidate[k] = system.getPhase(0).getComponent(k).getz(); - system.getPhases()[3].getComponent(k).setx(1.0); + system.getPhase(3).getComponent(k).setx(1.0); for (int i = 0; i < system.getNumberOfPhases(); i++) { - solidCandidate[k] -= system.getPhases()[3].getComponent(k).fugcoef(system.getPhases()[3]) + solidCandidate[k] -= system.getPhase(3).getComponent(k).fugcoef(system.getPhase(3)) / system.getPhase(i).getComponent(k).getFugacityCoefficient(); } } @@ -348,11 +348,11 @@ public int checkAndAddSolidPhase() { for (int i = 0; i < solidCandidate.length; i++) { if (solidCandidate[i] > 0.0) { - system.getPhases()[3].getComponent(i).setx(1.0); + system.getPhase(3).getComponent(i).setx(1.0); solidIndex = i; solidsNumber++; } else { - system.getPhases()[3].getComponent(i).setx(0.0); + system.getPhase(3).getComponent(i).setx(0.0); } } @@ -392,9 +392,8 @@ public double solvebeta1() { iter++; solidCandidate = system.getPhase(0).getComponents()[solidIndex].getz(); for (int i = 0; i < system.getNumberOfPhases(); i++) { - solidCandidate -= - system.getPhases()[3].getComponent(solidIndex).fugcoef(system.getPhases()[3]) - / system.getPhase(i).getComponent(solidIndex).getFugacityCoefficient(); + solidCandidate -= system.getPhase(3).getComponent(solidIndex).fugcoef(system.getPhase(3)) + / system.getPhase(i).getComponent(solidIndex).getFugacityCoefficient(); } double dsoliddn = (solidCandidate - solidCandidateOld) / dn; dn = -0.5 * solidCandidate / dsoliddn; diff --git a/src/main/java/neqsim/thermodynamicoperations/flashops/SysNewtonRhapsonPHflash.java b/src/main/java/neqsim/thermodynamicoperations/flashops/SysNewtonRhapsonPHflash.java index d3a44c37e..40bf2ec01 100644 --- a/src/main/java/neqsim/thermodynamicoperations/flashops/SysNewtonRhapsonPHflash.java +++ b/src/main/java/neqsim/thermodynamicoperations/flashops/SysNewtonRhapsonPHflash.java @@ -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].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()); + gT[i] = system.getTemperature() * (system.getPhase(0).getComponent(i).getdfugdt() + - system.getPhase(1).getComponent(i).getdfugdt()); + gP[i] = system.getPressure() * (system.getPhase(0).getComponent(i).getdfugdp() + - system.getPhase(1).getComponent(i).getdfugdp()); Jac.set(numberOfComponents, i, gT[i]); Jac.set(i, numberOfComponents, gT[i]); diff --git a/src/main/java/neqsim/thermodynamicoperations/flashops/SysNewtonRhapsonTPflashNew.java b/src/main/java/neqsim/thermodynamicoperations/flashops/SysNewtonRhapsonTPflashNew.java index 8dcc7eec6..d8e5901f6 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].getComponent(i).getFugacityCoefficient() - / system.getPhases()[0].getComponent(i).getFugacityCoefficient())); + u.get(i, 0) + Math.log(system.getPhase(1).getComponent(i).getFugacityCoefficient() + / system.getPhase(0).getComponent(i).getFugacityCoefficient())); } double fsum = 0.0; for (int i = 0; i < numberOfComponents; i++) { - fsum = fsum + system.getPhases()[1].getComponent(i).getx() - - system.getPhases()[0].getComponent(i).getx(); + fsum = fsum + system.getPhase(1).getComponent(i).getx() + - system.getPhase(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].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].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].getComponent(i).getK(), 2); + dxidlnk[i] = -system.getBeta() * system.getPhase(0).getComponent(i).getx() + * system.getPhase(1).getComponent(i).getx() / system.getPhase(0).getComponent(i).getz(); + dyidlnk[i] = system.getPhase(1).getComponent(i).getx() + + system.getPhase(0).getComponent(i).getK() * dxidlnk[i]; + + dyidbeta[i] = + (system.getPhase(0).getComponent(i).getK() * system.getPhase(0).getComponent(i).getz() + * (1 - system.getPhase(0).getComponent(i).getK())) + / Math.pow(1 - system.getBeta() + + system.getBeta() * system.getPhase(0).getComponent(i).getK(), 2); + dxidbeta[i] = (system.getPhase(0).getComponent(i).getz() + * (1 - system.getPhase(0).getComponent(i).getK())) + / Math.pow( + 1 - system.getBeta() + system.getBeta() * system.getPhase(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].getComponent(i).getdfugdx(j) * dyidlnk[j] - - system.getPhases()[0].getComponent(i).getdfugdx(j) * dxidlnk[j]; + tempJ = dij + system.getPhase(1).getComponent(i).getdfugdx(j) * dyidlnk[j] + - system.getPhase(0).getComponent(i).getdfugdx(j) * dxidlnk[j]; Jac.set(i, j, tempJ); } - Jac.set(i, nofc, system.getPhases()[1].getComponent(i).getdfugdx(i) * dyidbeta[i] - - system.getPhases()[0].getComponent(i).getdfugdx(i) * dxidbeta[i]); + Jac.set(i, nofc, system.getPhase(1).getComponent(i).getdfugdx(i) * dyidbeta[i] + - system.getPhase(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].getComponent(i).getK())); + u.set(i, 0, Math.log(system.getPhase(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].getComponent(i).setK(Math.exp(u.get(i, 0))); - system.getPhases()[1].getComponent(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.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 eeb6aca42..4991f3f97 100644 --- a/src/main/java/neqsim/thermodynamicoperations/flashops/TPflash.java +++ b/src/main/java/neqsim/thermodynamicoperations/flashops/TPflash.java @@ -40,13 +40,13 @@ public TPflash() {} */ public TPflash(SystemInterface system) { this.system = system; - lnOldOldOldK = new double[system.getPhases()[0].getNumberOfComponents()]; - lnOldOldK = new double[system.getPhases()[0].getNumberOfComponents()]; - lnOldK = new double[system.getPhases()[0].getNumberOfComponents()]; - lnK = new double[system.getPhases()[0].getNumberOfComponents()]; - oldoldDeltalnK = new double[system.getPhases()[0].getNumberOfComponents()]; - oldDeltalnK = new double[system.getPhases()[0].getNumberOfComponents()]; - deltalnK = new double[system.getPhases()[0].getNumberOfComponents()]; + lnOldOldOldK = new double[system.getPhase(0).getNumberOfComponents()]; + lnOldOldK = new double[system.getPhase(0).getNumberOfComponents()]; + lnOldK = new double[system.getPhase(0).getNumberOfComponents()]; + lnK = new double[system.getPhase(0).getNumberOfComponents()]; + oldoldDeltalnK = new double[system.getPhase(0).getNumberOfComponents()]; + oldDeltalnK = new double[system.getPhase(0).getNumberOfComponents()]; + deltalnK = new double[system.getPhase(0).getNumberOfComponents()]; } /** @@ -303,7 +303,7 @@ public void run() { tpdy = -1.0; dgonRT = -1.0; } else { - for (i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { + for (i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { if (system.getComponent(i).getz() > 1e-50) { tpdy += system.getPhase(0).getComponent(i).getx() * (Math.log(system.getPhase(0).getComponent(i).getFugacityCoefficient()) @@ -320,7 +320,7 @@ public void run() { if (dgonRT > 0) { if (tpdx < 0) { - for (i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { + for (i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { system.getPhase(0).getComponent(i) .setK(Math.exp(Math.log(system.getPhase(1).getComponent(i).getFugacityCoefficient()) - minGibsLogFugCoef[i]) * presdiff); @@ -403,8 +403,8 @@ public void run() { } else if (iterations >= newtonLimit && Math .abs(system.getPhase(0).getPressure() - system.getPhase(1).getPressure()) < 1e-5) { if (iterations == newtonLimit) { - secondOrderSolver = new SysNewtonRhapsonTPflash(system, 2, - system.getPhases()[0].getNumberOfComponents()); + secondOrderSolver = + new SysNewtonRhapsonTPflash(system, 2, system.getPhase(0).getNumberOfComponents()); } try { deviation = secondOrderSolver.solve(); diff --git a/src/main/java/neqsim/thermodynamicoperations/flashops/TPgradientFlash.java b/src/main/java/neqsim/thermodynamicoperations/flashops/TPgradientFlash.java index f6b608a9f..6db71251c 100644 --- a/src/main/java/neqsim/thermodynamicoperations/flashops/TPgradientFlash.java +++ b/src/main/java/neqsim/thermodynamicoperations/flashops/TPgradientFlash.java @@ -71,8 +71,8 @@ public void setfvec() { fvec.set(i, 0, logTerm - - Math.log(tempSystem.getPhases()[0].getComponent(i).getFugacityCoefficient() - * tempSystem.getPhases()[0].getComponent(i).getx() * tempSystem.getPressure()) + - Math.log(tempSystem.getPhase(0).getComponent(i).getFugacityCoefficient() + * tempSystem.getPhase(0).getComponent(i).getx() * tempSystem.getPressure()) - molarMassTerm); sumx += componentX; } @@ -90,15 +90,13 @@ public void setJac() { for (int i = 0; i < numComponents; i++) { for (int j = 0; j < numComponents; j++) { double dij = (i == j) ? 1.0 : 0.0; // Kronecker delta - double fugacityCoeff = - localSystem.getPhases()[0].getComponent(i).getFugacityCoefficient(); - double componentX = localSystem.getPhases()[0].getComponent(i).getx(); + double fugacityCoeff = localSystem.getPhase(0).getComponent(i).getFugacityCoefficient(); + double componentX = localSystem.getPhase(0).getComponent(i).getx(); double pressure = localSystem.getPressure(); - double tempJ = 1.0 / (fugacityCoeff * componentX * pressure) - * (fugacityCoeff * dij * pressure - + localSystem.getPhases()[0].getComponent(i).getdfugdx(j) * componentX - * pressure); + double tempJ = + 1.0 / (fugacityCoeff * componentX * pressure) * (fugacityCoeff * dij * pressure + + localSystem.getPhase(0).getComponent(i).getdfugdx(j) * componentX * pressure); Jac.set(i, j, tempJ); } } @@ -109,12 +107,12 @@ public void setJac() { } for (int i = 0; i < numComponents; i++) { - double fugacityCoeff = localSystem.getPhases()[0].getComponent(i).getFugacityCoefficient(); - double componentX = localSystem.getPhases()[0].getComponent(i).getx(); + double fugacityCoeff = localSystem.getPhase(0).getComponent(i).getFugacityCoefficient(); + double componentX = localSystem.getPhase(0).getComponent(i).getx(); double pressure = localSystem.getPressure(); double tempJ = 1.0 / (fugacityCoeff * componentX * pressure) - * (localSystem.getPhases()[0].getComponent(i).getdfugdp() * componentX * pressure + * (localSystem.getPhase(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 4ed67c1c1..ddcc724ce 100644 --- a/src/main/java/neqsim/thermodynamicoperations/flashops/TPmultiflash.java +++ b/src/main/java/neqsim/thermodynamicoperations/flashops/TPmultiflash.java @@ -233,14 +233,14 @@ public void stabilityAnalysis() { double[][] Wi = new double[system.getPhase(0).getNumberOfComponents()][system.getPhase(0) .getNumberOfComponents()]; - double[] deltalogWi = new double[system.getPhases()[0].getNumberOfComponents()]; - double[] oldDeltalogWi = new double[system.getPhases()[0].getNumberOfComponents()]; - double[] oldoldDeltalogWi = new double[system.getPhases()[0].getNumberOfComponents()]; + double[] deltalogWi = new double[system.getPhase(0).getNumberOfComponents()]; + double[] oldDeltalogWi = new double[system.getPhase(0).getNumberOfComponents()]; + double[] oldoldDeltalogWi = new double[system.getPhase(0).getNumberOfComponents()]; double[] sumw = new double[system.getPhase(0).getNumberOfComponents()]; double err = 0; double[] oldlogw = new double[system.getPhase(0).getNumberOfComponents()]; - double[] oldoldlogw = new double[system.getPhases()[0].getNumberOfComponents()]; - double[] oldoldoldlogw = new double[system.getPhases()[0].getNumberOfComponents()]; + double[] oldoldlogw = new double[system.getPhase(0).getNumberOfComponents()]; + double[] oldoldoldlogw = new double[system.getPhase(0).getNumberOfComponents()]; double[] d = new double[system.getPhase(0).getNumberOfComponents()]; double[][] x = new double[system.getPhase(0).getNumberOfComponents()][system.getPhase(0) .getNumberOfComponents()]; @@ -285,14 +285,14 @@ public void stabilityAnalysis() { * (system.getPhase(0).getComponent(k).getx() > 1e-100) { d[k] = * Math.log(system.getPhase(0).getComponent(k).getx()) + * system.getPhase(0).getComponent(k).getLogFugacityCoefficient(); - * if(minimumGibbsEnergySystem.getPhases()[lowestGibbsEnergyPhase].getComponents + * if(minimumGibbsEnergySystem.getPhase(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).getComponent(k).getx()) + system.getPhase(0).getComponent(k).getLogFugacityCoefficient(); - // if(minimumGibbsEnergySystem.getPhases()[lowestGibbsEnergyPhase].getComponent(k).getIonicCharge()!=0) + // if(minimumGibbsEnergySystem.getPhase(lowestGibbsEnergyPhase).getComponent(k).getIonicCharge()!=0) // d[k]=0; } } @@ -429,7 +429,7 @@ public void stabilityAnalysis() { } } } else { - SimpleMatrix f = new SimpleMatrix(system.getPhases()[0].getNumberOfComponents(), 1); + SimpleMatrix f = new SimpleMatrix(system.getPhase(0).getNumberOfComponents(), 1); SimpleMatrix df = null; SimpleMatrix identitytimesConst = null; // if (!secondOrderStabilityAnalysis) { @@ -441,34 +441,35 @@ public void stabilityAnalysis() { oldDeltalogWi[i] = oldlogw[i] - oldoldlogw[i]; } clonedSystem.get(0).init(3, 1); - alpha = new double[clonedSystem.get(0).getPhases()[0].getNumberOfComponents()]; - df = new SimpleMatrix(system.getPhases()[0].getNumberOfComponents(), - system.getPhases()[0].getNumberOfComponents()); - identitytimesConst = SimpleMatrix.identity(system.getPhases()[0].getNumberOfComponents()); + alpha = new double[clonedSystem.get(0).getPhase(0).getNumberOfComponents()]; + df = new SimpleMatrix(system.getPhase(0).getNumberOfComponents(), + system.getPhase(0).getNumberOfComponents()); + identitytimesConst = SimpleMatrix.identity(system.getPhase(0).getNumberOfComponents()); // , - // system.getPhases()[0].getNumberOfComponents()); + // system.getPhase(0).getNumberOfComponents()); // secondOrderStabilityAnalysis = true; // } - for (int i = 0; i < clonedSystem.get(0).getPhases()[0].getNumberOfComponents(); i++) { + for (int i = 0; i < clonedSystem.get(0).getPhase(0).getNumberOfComponents(); i++) { alpha[i] = 2.0 * Math.sqrt(Wi[j][i]); } 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].getComponent(i).getLogFugacityCoefficient() - - d[i])); + f.set(i, 0, + Math.sqrt(Wi[j][i]) * (Math.log(Wi[j][i]) + + clonedSystem.get(0).getPhase(1).getComponent(i).getLogFugacityCoefficient() + - d[i])); } - for (int k = 0; k < clonedSystem.get(0).getPhases()[0].getNumberOfComponents(); k++) { + for (int k = 0; k < clonedSystem.get(0).getPhase(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].getComponent(i).getdfugdn(k)); - // * clonedSystem.getPhases()[j].getNumberOfMolesInPhase()); + * clonedSystem.get(0).getPhase(1).getComponent(i).getdfugdn(k)); + // * clonedSystem.getPhase(j).getNumberOfMolesInPhase()); } else { df.set(i, k, 0); - // * clonedSystem.getPhases()[j].getNumberOfMolesInPhase()); + // * clonedSystem.getPhase(j).getNumberOfMolesInPhase()); } } } @@ -553,7 +554,7 @@ public void stabilityAnalysis() { for (int i = 0; i < system.getPhase(1).getNumberOfComponents(); i++) { system.getPhase(system.getNumberOfPhases() - 1).getComponent(i).setx(x[k][i]); } - system.getPhases()[system.getNumberOfPhases() - 1].normalize(); + system.getPhase(system.getNumberOfPhases() - 1).normalize(); multiPhaseTest = true; system.setBeta(system.getNumberOfPhases() - 1, system.getPhase(0).getComponent(unstabcomp).getz()); @@ -583,14 +584,14 @@ public void stabilityAnalysis3() { double[][] Wi = new double[system.getPhase(0).getNumberOfComponents()][system.getPhase(0) .getNumberOfComponents()]; - double[] deltalogWi = new double[system.getPhases()[0].getNumberOfComponents()]; - double[] oldDeltalogWi = new double[system.getPhases()[0].getNumberOfComponents()]; - double[] oldoldDeltalogWi = new double[system.getPhases()[0].getNumberOfComponents()]; + double[] deltalogWi = new double[system.getPhase(0).getNumberOfComponents()]; + double[] oldDeltalogWi = new double[system.getPhase(0).getNumberOfComponents()]; + double[] oldoldDeltalogWi = new double[system.getPhase(0).getNumberOfComponents()]; double[] sumw = new double[system.getPhase(0).getNumberOfComponents()]; double err = 0; double[] oldlogw = new double[system.getPhase(0).getNumberOfComponents()]; - double[] oldoldlogw = new double[system.getPhases()[0].getNumberOfComponents()]; - double[] oldoldoldlogw = new double[system.getPhases()[0].getNumberOfComponents()]; + double[] oldoldlogw = new double[system.getPhase(0).getNumberOfComponents()]; + double[] oldoldoldlogw = new double[system.getPhase(0).getNumberOfComponents()]; double[] d = new double[system.getPhase(0).getNumberOfComponents()]; double[][] x = new double[system.getPhase(0).getNumberOfComponents()][system.getPhase(0) .getNumberOfComponents()]; @@ -635,14 +636,14 @@ public void stabilityAnalysis3() { * (system.getPhase(0).getComponent(k).getx() > 1e-100) { d[k] = * Math.log(system.getPhase(0).getComponent(k).getx()) + * system.getPhase(0).getComponent(k).getLogFugacityCoefficient(); - * if(minimumGibbsEnergySystem.getPhases()[lowestGibbsEnergyPhase].getComponents + * if(minimumGibbsEnergySystem.getPhase(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).getComponent(k).getx()) + system.getPhase(0).getComponent(k).getLogFugacityCoefficient(); - // if(minimumGibbsEnergySystem.getPhases()[lowestGibbsEnergyPhase].getComponent(k).getIonicCharge()!=0) + // if(minimumGibbsEnergySystem.getPhase(lowestGibbsEnergyPhase).getComponent(k).getIonicCharge()!=0) // d[k]=0; } } @@ -779,7 +780,7 @@ public void stabilityAnalysis3() { } } } else { - SimpleMatrix f = new SimpleMatrix(system.getPhases()[0].getNumberOfComponents(), 1); + SimpleMatrix f = new SimpleMatrix(system.getPhase(0).getNumberOfComponents(), 1); SimpleMatrix df = null; SimpleMatrix identitytimesConst = null; // if (!secondOrderStabilityAnalysis) { @@ -791,34 +792,35 @@ public void stabilityAnalysis3() { oldDeltalogWi[i] = oldlogw[i] - oldoldlogw[i]; } clonedSystem.get(0).init(3, 1); - alpha = new double[clonedSystem.get(0).getPhases()[0].getNumberOfComponents()]; - df = new SimpleMatrix(system.getPhases()[0].getNumberOfComponents(), - system.getPhases()[0].getNumberOfComponents()); - identitytimesConst = SimpleMatrix.identity(system.getPhases()[0].getNumberOfComponents()); + alpha = new double[clonedSystem.get(0).getPhase(0).getNumberOfComponents()]; + df = new SimpleMatrix(system.getPhase(0).getNumberOfComponents(), + system.getPhase(0).getNumberOfComponents()); + identitytimesConst = SimpleMatrix.identity(system.getPhase(0).getNumberOfComponents()); // , - // system.getPhases()[0].getNumberOfComponents()); + // system.getPhase(0).getNumberOfComponents()); // secondOrderStabilityAnalysis = true; // } - for (int i = 0; i < clonedSystem.get(0).getPhases()[0].getNumberOfComponents(); i++) { + for (int i = 0; i < clonedSystem.get(0).getPhase(0).getNumberOfComponents(); i++) { alpha[i] = 2.0 * Math.sqrt(Wi[j][i]); } 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].getComponent(i).getLogFugacityCoefficient() - - d[i])); + f.set(i, 0, + Math.sqrt(Wi[j][i]) * (Math.log(Wi[j][i]) + + clonedSystem.get(0).getPhase(1).getComponent(i).getLogFugacityCoefficient() + - d[i])); } - for (int k = 0; k < clonedSystem.get(0).getPhases()[0].getNumberOfComponents(); k++) { + for (int k = 0; k < clonedSystem.get(0).getPhase(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].getComponent(i).getdfugdn(k)); - // * clonedSystem.getPhases()[j].getNumberOfMolesInPhase()); + * clonedSystem.get(0).getPhase(1).getComponent(i).getdfugdn(k)); + // * clonedSystem.getPhase(j).getNumberOfMolesInPhase()); } else { df.set(i, k, 0); - // * clonedSystem.getPhases()[j].getNumberOfMolesInPhase()); + // * clonedSystem.getPhase(j).getNumberOfMolesInPhase()); } } } @@ -903,7 +905,7 @@ public void stabilityAnalysis3() { for (int i = 0; i < system.getPhase(1).getNumberOfComponents(); i++) { system.getPhase(system.getNumberOfPhases() - 1).getComponent(i).setx(x[k][i]); } - system.getPhases()[system.getNumberOfPhases() - 1].normalize(); + system.getPhase(system.getNumberOfPhases() - 1).normalize(); multiPhaseTest = true; system.setBeta(system.getNumberOfPhases() - 1, system.getPhase(0).getComponent(unstabcomp).getz()); @@ -933,14 +935,14 @@ public void stabilityAnalysis2() { double[][] Wi = new double[system.getPhase(0).getNumberOfComponents()][system.getPhase(0) .getNumberOfComponents()]; - double[] deltalogWi = new double[system.getPhases()[0].getNumberOfComponents()]; - double[] oldDeltalogWi = new double[system.getPhases()[0].getNumberOfComponents()]; - double[] oldoldDeltalogWi = new double[system.getPhases()[0].getNumberOfComponents()]; + double[] deltalogWi = new double[system.getPhase(0).getNumberOfComponents()]; + double[] oldDeltalogWi = new double[system.getPhase(0).getNumberOfComponents()]; + double[] oldoldDeltalogWi = new double[system.getPhase(0).getNumberOfComponents()]; double[] sumw = new double[system.getPhase(0).getNumberOfComponents()]; double err = 0; double[] oldlogw = new double[system.getPhase(0).getNumberOfComponents()]; - double[] oldoldlogw = new double[system.getPhases()[0].getNumberOfComponents()]; - double[] oldoldoldlogw = new double[system.getPhases()[0].getNumberOfComponents()]; + double[] oldoldlogw = new double[system.getPhase(0).getNumberOfComponents()]; + double[] oldoldoldlogw = new double[system.getPhase(0).getNumberOfComponents()]; double[] d = new double[system.getPhase(0).getNumberOfComponents()]; double[][] x = new double[system.getPhase(0).getNumberOfComponents()][system.getPhase(0) .getNumberOfComponents()]; @@ -998,7 +1000,7 @@ public void stabilityAnalysis2() { if (system.getPhase(0).getComponent(k).getx() > 1e-100) { d[k] = Math.log(system.getPhase(0).getComponent(k).getx()) + system.getPhase(0).getComponent(k).getLogFugacityCoefficient(); - // if(minimumGibbsEnergySystem.getPhases()[lowestGibbsEnergyPhase].getComponent(k).getIonicCharge()!=0) + // if(minimumGibbsEnergySystem.getPhase(lowestGibbsEnergyPhase).getComponent(k).getIonicCharge()!=0) // d[k]=0; } // logger.info("dk: " + d[k]); @@ -1112,7 +1114,7 @@ public void stabilityAnalysis2() { } } } else { - SimpleMatrix f = new SimpleMatrix(system.getPhases()[0].getNumberOfComponents(), 1); + SimpleMatrix f = new SimpleMatrix(system.getPhase(0).getNumberOfComponents(), 1); SimpleMatrix df = null; SimpleMatrix identitytimesConst = null; // if (!secondOrderStabilityAnalysis) { @@ -1124,35 +1126,35 @@ public void stabilityAnalysis2() { oldDeltalogWi[i] = oldlogw[i] - oldoldlogw[i]; } (clonedSystem.get(j)).init(3, 1); - alpha = new double[(clonedSystem.get(j)).getPhases()[0].getNumberOfComponents()]; - df = new SimpleMatrix(system.getPhases()[0].getNumberOfComponents(), - system.getPhases()[0].getNumberOfComponents()); - identitytimesConst = SimpleMatrix.identity(system.getPhases()[0].getNumberOfComponents()); - // , system.getPhases()[0].getNumberOfComponents()); + alpha = new double[(clonedSystem.get(j)).getPhase(0).getNumberOfComponents()]; + df = new SimpleMatrix(system.getPhase(0).getNumberOfComponents(), + system.getPhase(0).getNumberOfComponents()); + identitytimesConst = SimpleMatrix.identity(system.getPhase(0).getNumberOfComponents()); + // , system.getPhase(0).getNumberOfComponents()); // secondOrderStabilityAnalysis = true; // } - for (int i = 0; i < (clonedSystem.get(j)).getPhases()[0].getNumberOfComponents(); i++) { + for (int i = 0; i < (clonedSystem.get(j)).getPhase(0).getNumberOfComponents(); i++) { alpha[i] = 2.0 * Math.sqrt(Wi[j][i]); } 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].getComponent(i).getLogFugacityCoefficient() + + (clonedSystem.get(j)).getPhase(1).getComponent(i).getLogFugacityCoefficient() - d[i])); } - for (int k = 0; k < (clonedSystem.get(j)).getPhases()[0].getNumberOfComponents(); k++) { + for (int k = 0; k < (clonedSystem.get(j)).getPhase(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].getComponent(i).getdfugdn(k)); + * (clonedSystem.get(j)).getPhase(1).getComponent(i).getdfugdn(k)); // * - // clonedSystem.getPhases()[j].getNumberOfMolesInPhase()); + // clonedSystem.getPhase(j).getNumberOfMolesInPhase()); } else { df.set(i, k, 0); // * - // clonedSystem.getPhases()[j].getNumberOfMolesInPhase()); + // clonedSystem.getPhase(j).getNumberOfMolesInPhase()); } } } @@ -1235,7 +1237,7 @@ public void stabilityAnalysis2() { for (int i = 0; i < system.getPhase(1).getNumberOfComponents(); i++) { system.getPhase(system.getNumberOfPhases() - 1).getComponent(i).setx(x[k][i]); } - system.getPhases()[system.getNumberOfPhases() - 1].normalize(); + system.getPhase(system.getNumberOfPhases() - 1).normalize(); multiPhaseTest = true; system.setBeta(system.getNumberOfPhases() - 1, system.getPhase(0).getComponent(unstabcomp).getz()); diff --git a/src/main/java/neqsim/thermodynamicoperations/flashops/TPmultiflashWAX.java b/src/main/java/neqsim/thermodynamicoperations/flashops/TPmultiflashWAX.java index b8ab9e936..fcec2899d 100644 --- a/src/main/java/neqsim/thermodynamicoperations/flashops/TPmultiflashWAX.java +++ b/src/main/java/neqsim/thermodynamicoperations/flashops/TPmultiflashWAX.java @@ -270,9 +270,9 @@ public void stabilityAnalysis() { } if (system.getPhase(0).getComponent(k).getx() > 1e-100) { - d[k] = Math.log( - minimumGibbsEnergySystem.getPhases()[lowestGibbsEnergyPhase].getComponent(k).getx()) - + minimumGibbsEnergySystem.getPhases()[lowestGibbsEnergyPhase].getComponent(k) + d[k] = Math + .log(minimumGibbsEnergySystem.getPhase(lowestGibbsEnergyPhase).getComponent(k).getx()) + + minimumGibbsEnergySystem.getPhase(lowestGibbsEnergyPhase).getComponent(k) .getLogFugacityCoefficient(); } } diff --git a/src/main/java/neqsim/thermodynamicoperations/flashops/TPmultiflash_1.java b/src/main/java/neqsim/thermodynamicoperations/flashops/TPmultiflash_1.java index 456276f26..8aaa61f1d 100644 --- a/src/main/java/neqsim/thermodynamicoperations/flashops/TPmultiflash_1.java +++ b/src/main/java/neqsim/thermodynamicoperations/flashops/TPmultiflash_1.java @@ -68,9 +68,9 @@ 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].getComponent(i).setx(system.getPhases()[k].getComponent(i).getz() - / E[i] / system.getPhases()[k].getComponent(i).getFugacityCoefficient()); + for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { + system.getPhase(k).getComponent(i).setx(system.getPhase(k).getComponent(i).getz() / E[i] + / system.getPhase(k).getComponent(i).getFugacityCoefficient()); } } } @@ -81,12 +81,12 @@ public void setXY() { * */ public void calcE() { - E = new double[system.getPhases()[0].getNumberOfComponents()]; + E = new double[system.getPhase(0).getNumberOfComponents()]; - for (int i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { + for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { for (int k = 0; k < system.getNumberOfPhases(); k++) { - E[i] += system.getPhases()[k].getBeta() - / system.getPhases()[k].getComponent(i).getFugacityCoefficient(); + E[i] += system.getPhase(k).getBeta() + / system.getPhase(k).getComponent(i).getFugacityCoefficient(); } } } @@ -105,31 +105,31 @@ public double calcQ() { Qmatrix = new double[system.getNumberOfPhases()][system.getNumberOfPhases()]; for (int k = 0; k < system.getNumberOfPhases(); k++) { - betaTotal += system.getPhases()[k].getBeta(); + betaTotal += system.getPhase(k).getBeta(); } Q = betaTotal; this.calcE(); - for (int i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { - Q -= Math.log(E[i]) * system.getPhases()[0].getComponent(i).getz(); + for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { + 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.getPhases()[0].getNumberOfComponents(); i++) { - dQdbeta[k] -= system.getPhases()[0].getComponent(i).getz() * 1.0 / E[i] - / system.getPhases()[k].getComponent(i).getFugacityCoefficient(); + for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { + dQdbeta[k] -= system.getPhase(0).getComponent(i).getz() * 1.0 / E[i] + / system.getPhase(k).getComponent(i).getFugacityCoefficient(); } } for (int i = 0; i < system.getNumberOfPhases(); i++) { 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].getComponent(k).getz() - / (E[k] * E[k] * system.getPhases()[j].getComponent(k).getFugacityCoefficient() - * system.getPhases()[i].getComponent(k).getFugacityCoefficient()); + for (int k = 0; k < system.getPhase(0).getNumberOfComponents(); k++) { + 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()); } } } @@ -150,7 +150,7 @@ public void solveBeta() { do { iter++; for (int k = 0; k < system.getNumberOfPhases(); k++) { - oldBeta[k] = system.getPhases()[k].getBeta(); + oldBeta[k] = system.getPhase(k).getBeta(); } calcQ(); @@ -183,14 +183,14 @@ public void solveBeta() { /** {@inheritDoc} */ @Override public void stabilityAnalysis() { - double[] logWi = new double[system.getPhases()[1].getNumberOfComponents()]; - double[][] Wi = new double[system.getPhases()[1].getNumberOfComponents()][system.getPhases()[0] + double[] logWi = new double[system.getPhase(1).getNumberOfComponents()]; + double[][] Wi = new double[system.getPhase(1).getNumberOfComponents()][system.getPhase(0) .getNumberOfComponents()]; - double[] sumw = new double[system.getPhases()[1].getNumberOfComponents()]; + double[] sumw = new double[system.getPhase(1).getNumberOfComponents()]; double err = 0; - double[] oldlogw = new double[system.getPhases()[1].getNumberOfComponents()]; - double[] d = new double[system.getPhases()[1].getNumberOfComponents()]; - double[][] x = new double[system.getPhases()[1].getNumberOfComponents()][system.getPhases()[0] + double[] oldlogw = new double[system.getPhase(1).getNumberOfComponents()]; + double[] d = new double[system.getPhase(1).getNumberOfComponents()]; + double[][] x = new double[system.getPhase(1).getNumberOfComponents()][system.getPhase(0) .getNumberOfComponents()]; SystemInterface minimumGibbsEnergySystem; @@ -198,13 +198,13 @@ public void stabilityAnalysis() { minimumGibbsEnergySystem = system.clone(); - for (int i = 0; i < system.getPhases()[1].getNumberOfComponents(); i++) { + for (int i = 0; i < system.getPhase(1).getNumberOfComponents(); i++) { double numb = 0; clonedSystem.add(system.clone()); (clonedSystem.get(i)).init(0); - for (int j = 0; j < system.getPhases()[1].getNumberOfComponents(); j++) { + for (int j = 0; j < system.getPhase(1).getNumberOfComponents(); j++) { numb = i == j ? 1.0 : 1.0e-3; - (clonedSystem.get(i)).getPhases()[1].getComponent(j).setx(numb); + (clonedSystem.get(i)).getPhase(1).getComponent(j).setx(numb); } (clonedSystem.get(i)).init(1); } @@ -213,70 +213,70 @@ public void stabilityAnalysis() { // logger.info("low gibbs phase " + lowestGibbsEnergyPhase); - for (int k = 0; k < minimumGibbsEnergySystem.getPhases()[1].getNumberOfComponents(); k++) { - // sumz += minimumGibbsEnergySystem.getPhases()[1].getComponent(k).getz(); - for (int i = 0; i < minimumGibbsEnergySystem.getPhases()[1].getNumberOfComponents(); i++) { - sumw[k] += (clonedSystem.get(k)).getPhases()[1].getComponent(i).getx(); + for (int k = 0; k < minimumGibbsEnergySystem.getPhase(1).getNumberOfComponents(); k++) { + // sumz += minimumGibbsEnergySystem.getPhase(1).getComponent(k).getz(); + for (int i = 0; i < minimumGibbsEnergySystem.getPhase(1).getNumberOfComponents(); i++) { + sumw[k] += (clonedSystem.get(k)).getPhase(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].getComponent(i) - .setx((clonedSystem.get(k)).getPhases()[1].getComponent(i).getx() / sumw[0]); + for (int k = 0; k < minimumGibbsEnergySystem.getPhase(1).getNumberOfComponents(); k++) { + for (int i = 0; i < minimumGibbsEnergySystem.getPhase(1).getNumberOfComponents(); i++) { + (clonedSystem.get(k)).getPhase(1).getComponent(i) + .setx((clonedSystem.get(k)).getPhase(1).getComponent(i).getx() / sumw[0]); // logger.info("x: " + ( - // clonedSystem.get(k)).getPhases()[0].getComponent(i).getx()); + // clonedSystem.get(k)).getPhase(0).getComponent(i).getx()); } - d[k] = Math - .log(minimumGibbsEnergySystem.getPhases()[lowestGibbsEnergyPhase].getComponent(k).getx()) - + Math.log(minimumGibbsEnergySystem.getPhases()[lowestGibbsEnergyPhase].getComponent(k) - .getFugacityCoefficient()); + d[k] = + Math.log(minimumGibbsEnergySystem.getPhase(lowestGibbsEnergyPhase).getComponent(k).getx()) + + Math.log(minimumGibbsEnergySystem.getPhase(lowestGibbsEnergyPhase).getComponent(k) + .getFugacityCoefficient()); // logger.info("dk: " + d[k]); } - for (int j = 0; j < minimumGibbsEnergySystem.getPhases()[1].getNumberOfComponents(); j++) { + for (int j = 0; j < minimumGibbsEnergySystem.getPhase(1).getNumberOfComponents(); j++) { logWi[j] = 1; } - for (int j = 0; j < system.getPhases()[1].getNumberOfComponents(); j++) { + for (int j = 0; j < system.getPhase(1).getNumberOfComponents(); j++) { do { err = 0; (clonedSystem.get(j)).init(1); - for (int i = 0; i < system.getPhases()[1].getNumberOfComponents(); i++) { + for (int i = 0; i < system.getPhase(1).getNumberOfComponents(); i++) { oldlogw[i] = logWi[i]; logWi[i] = d[i] - Math - .log((clonedSystem.get(j)).getPhases()[1].getComponent(i).getFugacityCoefficient()); + .log((clonedSystem.get(j)).getPhase(1).getComponent(i).getFugacityCoefficient()); err += Math.abs(logWi[i] - oldlogw[i]); Wi[j][i] = Math.exp(logWi[i]); } // logger.info("err: " + err); sumw[j] = 0; - for (int i = 0; i < system.getPhases()[1].getNumberOfComponents(); i++) { + for (int i = 0; i < system.getPhase(1).getNumberOfComponents(); i++) { sumw[j] += Math.exp(logWi[i]); } - for (int i = 0; i < system.getPhases()[1].getNumberOfComponents(); i++) { - (clonedSystem.get(j)).getPhases()[1].getComponent(i).setx(Math.exp(logWi[i]) / sumw[j]); + for (int i = 0; i < system.getPhase(1).getNumberOfComponents(); i++) { + (clonedSystem.get(j)).getPhase(1).getComponent(i).setx(Math.exp(logWi[i]) / sumw[j]); } } while (Math.abs(err) > 1e-9); tm[j] = 1.0; - for (int i = 0; i < system.getPhases()[1].getNumberOfComponents(); i++) { + for (int i = 0; i < system.getPhase(1).getNumberOfComponents(); i++) { tm[j] -= Math.exp(logWi[i]); - x[j][i] = (clonedSystem.get(j)).getPhases()[1].getComponent(i).getx(); + x[j][i] = (clonedSystem.get(j)).getPhase(1).getComponent(i).getx(); // logger.info("txji: " + x[j][i]); } logger.info("tm: " + tm[j]); } int unstabcomp = 0; - for (int k = 0; k < system.getPhases()[1].getNumberOfComponents(); k++) { + for (int k = 0; k < system.getPhase(1).getNumberOfComponents(); k++) { if (tm[k] < -1e-8 && !(Double.isNaN(tm[k]))) { system.addPhase(); unstabcomp = k; - for (int i = 0; i < system.getPhases()[1].getNumberOfComponents(); i++) { - system.getPhases()[2].getComponent(i).setx(x[k][i]); + for (int i = 0; i < system.getPhase(1).getNumberOfComponents(); i++) { + system.getPhase(2).getComponent(i).setx(x[k][i]); } multiPhaseTest = true; system.setBeta(system.getNumberOfPhases() - 1, @@ -306,14 +306,14 @@ public void run() { chemdev = 0.0; double[] xchem = new double[system.getPhase(phaseNum).getNumberOfComponents()]; - for (i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { + for (i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { xchem[i] = system.getPhase(phaseNum).getComponent(i).getx(); } system.init(1); system.getChemicalReactionOperations().solveChemEq(phaseNum, 1); - for (i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { + for (i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { chemdev += Math.abs(xchem[i] - system.getPhase(phaseNum).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 134fd39c1..b902cba2a 100644 --- a/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/BubblePointPressureFlash.java +++ b/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/BubblePointPressureFlash.java @@ -55,21 +55,19 @@ public void run() { system.getChemicalReactionOperations().solveChemEq(1, 1); } - for (int i = 0; i < system.getPhases()[1].getNumberOfComponents(); i++) { - 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); + for (int i = 0; i < system.getPhase(1).getNumberOfComponents(); i++) { + system.getPhase(1).getComponent(i).setx(system.getPhase(0).getComponent(i).getz()); + if (system.getPhase(0).getComponent(i).getIonicCharge() != 0) { + system.getPhase(0).getComponent(i).setx(1e-40); } else { - system.getPhases()[0].getComponent(i) - .setx(system.getPhases()[0].getComponent(i).getK() - * system.getPhases()[1].getComponent(i).getz()); + system.getPhase(0).getComponent(i).setx( + system.getPhase(0).getComponent(i).getK() * system.getPhase(1).getComponent(i).getz()); } } ytotal = 0.0; - for (int i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { - ytotal += system.getPhases()[0].getComponent(i).getx(); + for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { + ytotal += system.getPhase(0).getComponent(i).getx(); } double ktot = 0.0; @@ -81,42 +79,39 @@ public void run() { iterations = 0; do { iterations++; - for (int i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { - system.getPhases()[0].getComponent(i) - .setx(system.getPhases()[0].getComponent(i).getx() / ytotal); + for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { + system.getPhase(0).getComponent(i) + .setx(system.getPhase(0).getComponent(i).getx() / ytotal); } system.init(3); oldPres = system.getPressure(); ktot = 0.0; - for (int i = 0; i < system.getPhases()[1].getNumberOfComponents(); i++) { + for (int i = 0; i < system.getPhase(1).getNumberOfComponents(); i++) { do { - yold = system.getPhases()[0].getComponent(i).getx(); - if (!Double.isNaN(Math.exp( - Math.log(system.getPhases()[1].getComponent(i).getFugacityCoefficient()) - Math - .log(system.getPhases()[0].getComponent(i).getFugacityCoefficient())))) { + yold = system.getPhase(0).getComponent(i).getx(); + if (!Double.isNaN( + Math.exp(Math.log(system.getPhase(1).getComponent(i).getFugacityCoefficient()) + - Math.log(system.getPhase(0).getComponent(i).getFugacityCoefficient())))) { if (system.getPhase(0).getComponent(i).getIonicCharge() != 0) { - system.getPhases()[0].getComponent(i).setK(1e-40); + system.getPhase(0).getComponent(i).setK(1e-40); } else { - 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.getPhase(0).getComponent(i).setK( + Math.exp(Math.log(system.getPhase(1).getComponent(i).getFugacityCoefficient()) + - Math.log(system.getPhase(0).getComponent(i).getFugacityCoefficient()))); } } - 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()); + system.getPhase(1).getComponent(i).setK(system.getPhase(0).getComponent(i).getK()); + system.getPhase(0).getComponent(i).setx(system.getPhase(0).getComponent(i).getK() + * system.getPhase(1).getComponent(i).getz()); // logger.info("y err " + - // 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); + // Math.abs(system.getPhase(0).getComponent(i).getx()-yold)); + } while (Math.abs(system.getPhase(0).getComponent(i).getx() - yold) / yold > 1e-8); + ktot += Math.abs(system.getPhase(1).getComponent(i).getK() - 1.0); } - for (int i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { - 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()); + for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { + if (!Double.isNaN(system.getPhase(0).getComponent(i).getK())) { + system.getPhase(0).getComponent(i).setx(system.getPhase(0).getComponent(i).getK() + * system.getPhase(1).getComponent(i).getz()); } else { system.init(0); logger.error("k err. : nan"); @@ -124,8 +119,8 @@ public void run() { } ytotal = 0.0; - for (int i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { - ytotal += system.getPhases()[0].getComponent(i).getx(); + for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { + ytotal += system.getPhase(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 7f4e10c47..30c47b07e 100644 --- a/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/BubblePointPressureFlashDer.java +++ b/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/BubblePointPressureFlashDer.java @@ -55,21 +55,19 @@ public void run() { system.getChemicalReactionOperations().solveChemEq(1, 0); } - for (int i = 0; i < system.getPhases()[1].getNumberOfComponents(); i++) { - 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); + for (int i = 0; i < system.getPhase(1).getNumberOfComponents(); i++) { + system.getPhase(1).getComponent(i).setx(system.getPhase(0).getComponent(i).getz()); + if (system.getPhase(0).getComponent(i).getIonicCharge() != 0) { + system.getPhase(0).getComponent(i).setx(1e-40); } else { - system.getPhases()[0].getComponent(i) - .setx(system.getPhases()[0].getComponent(i).getK() - * system.getPhases()[1].getComponent(i).getz()); + system.getPhase(0).getComponent(i).setx( + system.getPhase(0).getComponent(i).getK() * system.getPhase(1).getComponent(i).getz()); } } ytotal = 0.0; - for (int i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { - ytotal += system.getPhases()[0].getComponent(i).getx(); + for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { + ytotal += system.getPhase(0).getComponent(i).getx(); } double ktot = 0.0; @@ -81,42 +79,39 @@ public void run() { iterations = 0; do { iterations++; - for (int i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { - system.getPhases()[0].getComponent(i) - .setx(system.getPhases()[0].getComponent(i).getx() / ytotal); + for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { + system.getPhase(0).getComponent(i) + .setx(system.getPhase(0).getComponent(i).getx() / ytotal); } system.init(1); oldPres = system.getPressure(); ktot = 0.0; - for (int i = 0; i < system.getPhases()[1].getNumberOfComponents(); i++) { + for (int i = 0; i < system.getPhase(1).getNumberOfComponents(); i++) { do { - yold = system.getPhases()[0].getComponent(i).getx(); - if (!Double.isNaN(Math.exp( - Math.log(system.getPhases()[1].getComponent(i).getFugacityCoefficient()) - Math - .log(system.getPhases()[0].getComponent(i).getFugacityCoefficient())))) { + yold = system.getPhase(0).getComponent(i).getx(); + if (!Double.isNaN( + Math.exp(Math.log(system.getPhase(1).getComponent(i).getFugacityCoefficient()) + - Math.log(system.getPhase(0).getComponent(i).getFugacityCoefficient())))) { if (system.getPhase(0).getComponent(i).getIonicCharge() != 0) { - system.getPhases()[0].getComponent(i).setK(1e-40); + system.getPhase(0).getComponent(i).setK(1e-40); } else { - 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.getPhase(0).getComponent(i).setK( + Math.exp(Math.log(system.getPhase(1).getComponent(i).getFugacityCoefficient()) + - Math.log(system.getPhase(0).getComponent(i).getFugacityCoefficient()))); } } - 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()); + system.getPhase(1).getComponent(i).setK(system.getPhase(0).getComponent(i).getK()); + system.getPhase(0).getComponent(i).setx(system.getPhase(0).getComponent(i).getK() + * system.getPhase(1).getComponent(i).getz()); // logger.info("y err " + - // 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); + // Math.abs(system.getPhase(0).getComponent(i).getx()-yold)); + } while (Math.abs(system.getPhase(0).getComponent(i).getx() - yold) / yold > 1e-8); + ktot += Math.abs(system.getPhase(1).getComponent(i).getK() - 1.0); } - for (int i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { - 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()); + for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { + if (!Double.isNaN(system.getPhase(0).getComponent(i).getK())) { + system.getPhase(0).getComponent(i).setx(system.getPhase(0).getComponent(i).getK() + * system.getPhase(1).getComponent(i).getz()); } else { system.init(0); logger.error("K error : nan"); @@ -126,21 +121,21 @@ public void run() { ytotal = 0.0; deriv = 0.0; funk = 0.0; - for (int i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { - ytotal += system.getPhases()[0].getComponent(i).getx(); + for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { + ytotal += system.getPhase(0).getComponent(i).getx(); // Following lines added by Neeraj - 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))); + funk += + system.getPhase(1).getComponent(i).getx() * system.getPhase(1).getComponent(i).getK(); + deriv += + system.getPhase(1).getComponent(i).getx() * system.getPhase(1).getComponent(i).getK() + * (system.getPhase(1).getComponent(i).logfugcoefdP(this.system.getPhase(1)) + - system.getPhase(0).getComponent(i).logfugcoefdP(this.system.getPhase(0))); } // logger.info("ytot " + ytotal + " pres " + system.getPressure()); // system.getPhase(0).normalize(); // logger.info("deriv - // "+system.getPhases()[0].getComponents()[3].logfugcoefdP(this.system.getPhase(0))); + // "+system.getPhase(0).getComponents()[3].logfugcoefdP(this.system.getPhase(0))); // logger.info("ytot "+ytotal); if (ytotal > 1.5) { ytotal = 1.5; diff --git a/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/BubblePointTemperatureFlash.java b/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/BubblePointTemperatureFlash.java index 1fde945f6..de47a4af6 100644 --- a/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/BubblePointTemperatureFlash.java +++ b/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/BubblePointTemperatureFlash.java @@ -37,11 +37,10 @@ public void run() { double deriv = 0; double funk = 0; - for (int i = 0; i < system.getPhases()[1].getNumberOfComponents(); i++) { - 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()); + for (int i = 0; i < system.getPhase(1).getNumberOfComponents(); i++) { + system.getPhase(1).getComponent(i).setx(system.getPhase(0).getComponent(i).getz()); + system.getPhase(0).getComponent(i).setx( + system.getPhase(0).getComponent(i).getK() * system.getPhase(1).getComponent(i).getx()); } system.setNumberOfPhases(2); do { @@ -51,30 +50,29 @@ public void run() { deriv = 0; ytotal = 0; system.init(2); - for (int i = 0; i < system.getPhases()[1].getNumberOfComponents(); i++) { + for (int i = 0; i < system.getPhase(1).getNumberOfComponents(); i++) { do { iterations++; - 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) + yold = system.getPhase(0).getComponent(i).getx(); + system.getPhase(0).getComponent(i) + .setK(system.getPhase(1).getComponent(i).getFugacityCoefficient() + / system.getPhase(0).getComponent(i).getFugacityCoefficient()); + system.getPhase(1).getComponent(i).setK(system.getPhase(0).getComponent(i).getK()); + system.getPhase(0).getComponent(i) + .setx(system.getPhase(1).getComponent(i).getx() + * system.getPhase(1).getComponent(i).getFugacityCoefficient() + / system.getPhase(0).getComponent(i).getFugacityCoefficient()); + } while ((Math.abs(yold - system.getPhase(1).getComponent(i).getx()) > 1e-10) && (iterations < maxNumberOfIterations)); - 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()); + ytotal += system.getPhase(0).getComponent(i).getx(); + funk += + system.getPhase(1).getComponent(i).getx() * system.getPhase(1).getComponent(i).getK(); + deriv += + system.getPhase(1).getComponent(i).getx() * system.getPhase(1).getComponent(i).getK() + * (system.getPhase(1).getComponent(i).getdfugdt() + - system.getPhase(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 3e7cd91a7..60a8462e0 100644 --- a/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/BubblePointTemperatureNoDer.java +++ b/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/BubblePointTemperatureNoDer.java @@ -65,27 +65,26 @@ public void run() { system.getChemicalReactionOperations().solveChemEq(1); } - for (int i = 0; i < system.getPhases()[1].getNumberOfComponents(); i++) { - 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); + for (int i = 0; i < system.getPhase(1).getNumberOfComponents(); i++) { + system.getPhase(1).getComponent(i).setx(system.getPhase(0).getComponent(i).getz()); + if (system.getPhase(0).getComponent(i).getIonicCharge() != 0) { + system.getPhase(0).getComponent(i).setx(1e-40); } else { - system.getPhases()[0].getComponent(i).setx(system.getPhases()[0].getComponent(i).getK() - * system.getPhases()[1].getComponent(i).getz()); + system.getPhase(0).getComponent(i).setx( + system.getPhase(0).getComponent(i).getK() * system.getPhase(1).getComponent(i).getz()); } } ytotal = 0.0; - for (int i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { - ytotal += system.getPhases()[0].getComponent(i).getx(); + for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { + ytotal += system.getPhase(0).getComponent(i).getx(); } double oldTemp = 10.0; double ktot = 0.0; do { iterations++; - for (int i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { - system.getPhases()[0].getComponent(i) - .setx(system.getPhases()[0].getComponent(i).getx() / ytotal); + for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { + system.getPhase(0).getComponent(i).setx(system.getPhase(0).getComponent(i).getx() / ytotal); } if (system.isChemicalSystem() && (iterations % 2) == 0) { system.getChemicalReactionOperations().solveChemEq(1); @@ -93,28 +92,28 @@ public void run() { system.init(1); oldTemp = system.getTemperature(); ktot = 0.0; - for (int i = 0; i < system.getPhases()[1].getNumberOfComponents(); i++) { + for (int i = 0; i < system.getPhase(1).getNumberOfComponents(); i++) { do { - yold = system.getPhases()[0].getComponent(i).getx(); + yold = system.getPhase(0).getComponent(i).getx(); if (system.getPhase(0).getComponent(i).getIonicCharge() != 0) { - system.getPhases()[0].getComponent(i).setK(1e-40); + system.getPhase(0).getComponent(i).setK(1e-40); } else { - 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.getPhase(0).getComponent(i) + .setK(Math.exp(Math.log(system.getPhase(1).getComponent(i).getFugacityCoefficient()) + - Math.log(system.getPhase(0).getComponent(i).getFugacityCoefficient()))); } - 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()); + system.getPhase(1).getComponent(i).setK(system.getPhase(0).getComponent(i).getK()); + system.getPhase(0).getComponent(i).setx(system.getPhase(0).getComponent(i).getK() + * system.getPhase(1).getComponent(i).getz()); // logger.info("y err " + - // Math.abs(system.getPhases()[0].getComponent(i).getx()-yold)); - } while (Math.abs(system.getPhases()[0].getComponent(i).getx() - yold) > 1e-4); + // Math.abs(system.getPhase(0).getComponent(i).getx()-yold)); + } while (Math.abs(system.getPhase(0).getComponent(i).getx() - yold) > 1e-4); - ktot += Math.abs(system.getPhases()[1].getComponent(i).getK() - 1.0); + ktot += Math.abs(system.getPhase(1).getComponent(i).getK() - 1.0); } ytotal = 0.0; - for (int i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) { - ytotal += system.getPhases()[0].getComponent(i).getx(); + for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) { + ytotal += system.getPhase(0).getComponent(i).getx(); } if (ytotal > 1.2) { ytotal = 1.2; @@ -128,11 +127,11 @@ public void run() { // 0.05*(1.0/ytotal*system.getTemperature()-system.getTemperature())); system .setTemperature(system.getTemperature() + 0.1 * system.getTemperature() * (1.0 - ytotal)); - // for (int i=0;i
@@ -51,13 +50,13 @@ public void run() {
// system.setBeta(beta+0.65);
system.init(2);
- for (int i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) {
- 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());
+ for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) {
+ system.getPhase(0).getComponent(i)
+ .setK(system.getPhase(0).getComponent(i).getFugacityCoefficient()
+ / system.getPhase(1).getComponent(i).getFugacityCoefficient());
+ system.getPhase(1).getComponent(i)
+ .setK(system.getPhase(0).getComponent(i).getFugacityCoefficient()
+ / system.getPhase(1).getComponent(i).getFugacityCoefficient());
}
system.calc_x_y_nonorm();
@@ -65,19 +64,19 @@ public void run() {
funk = 0e0;
deriv = 0e0;
- for (int i = 0; i < system.getPhases()[0].getNumberOfComponents(); i++) {
- 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].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();
+ for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) {
+ dkidt = (system.getPhase(0).getComponent(i).getdfugdt()
+ - system.getPhase(1).getComponent(i).getdfugdt())
+ * system.getPhase(0).getComponent(i).getK();
+ // dxidt=-system.getPhase(0).getComponent(i).getx() *
+ // system.getPhase(0).getComponent(i).getx()*1.0/system.getPhase(0).getComponent(i).getz()*system.getBeta()*dkidt;
+ dxidt = -system.getPhase(0).getComponent(i).getz() * system.getBeta() * dkidt / Math.pow(
+ 1.0 - system.getBeta() + system.getBeta() * system.getPhase(0).getComponent(i).getK(),
+ 2);
+ dyidt = dkidt * system.getPhase(0).getComponent(i).getx()
+ + system.getPhase(0).getComponent(i).getK() * dxidt;
+ funk = funk + system.getPhase(1).getComponent(i).getx()
+ - system.getPhase(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 4a3b7b599..7698184a6 100644
--- a/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/CricondebarFlash.java
+++ b/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/CricondebarFlash.java
@@ -44,21 +44,19 @@ public CricondebarFlash(SystemInterface system) {
*/
public double calcx() {
double xtotal = 0;
- for (int i = 0; i < system.getPhases()[1].getNumberOfComponents(); i++) {
- system.getPhases()[0].getComponent(i)
- .setK(Math.exp(system.getPhases()[1].getComponent(i).getLogFugacityCoefficient()
- - system.getPhases()[0].getComponent(i).getLogFugacityCoefficient()));
+ for (int i = 0; i < system.getPhase(1).getNumberOfComponents(); i++) {
+ system.getPhase(0).getComponent(i)
+ .setK(Math.exp(system.getPhase(1).getComponent(i).getLogFugacityCoefficient()
+ - system.getPhase(0).getComponent(i).getLogFugacityCoefficient()));
- 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.getPhase(1).getComponent(i).setK(system.getPhase(0).getComponent(i).getK());
+ system.getPhase(1).getComponent(i).setx(1.0 / system.getPhase(0).getComponent(i).getK()
+ * system.getPhase(1).getComponent(i).getz());
+ // ktot += Math.abs(system.getPhase(1).getComponent(i).getK() - 1.0);
}
xtotal = 0.0;
- for (int i = 0; i < system.getPhases()[1].getNumberOfComponents(); i++) {
- xtotal += system.getPhases()[1].getComponent(i).getx();
+ for (int i = 0; i < system.getPhase(1).getNumberOfComponents(); i++) {
+ xtotal += system.getPhase(1).getComponent(i).getx();
}
return xtotal;
}
@@ -249,12 +247,12 @@ public void run() {
public void setfvec() {
double sumxx = 0;
for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) {
- sumxx += system.getPhases()[1].getComponent(i).getx();
+ sumxx += system.getPhase(1).getComponent(i).getx();
fvec.set(i, 0,
- 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()));
+ Math.log(system.getPhase(0).getComponent(i).getFugacityCoefficient()
+ * system.getPhase(0).getComponent(i).getz() * system.getPressure())
+ - Math.log(system.getPhase(1).getComponent(i).getFugacityCoefficient()
+ * system.getPhase(1).getComponent(i).getx() * system.getPressure()));
}
fvec.set(system.getPhase(0).getNumberOfComponents(), 0, 1.0 - sumxx);
// logger.info("sumx" + sumxx);
@@ -274,8 +272,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].getComponent(i).getx()
- - system.getPhases()[1].getComponent(i).getdfugdx(j);
+ tempJ = -dij * 1.0 / system.getPhase(1).getComponent(i).getx()
+ - system.getPhase(1).getComponent(i).getdfugdx(j);
Jac.set(i, j, tempJ);
}
}
@@ -285,8 +283,8 @@ public void setJac() {
}
for (int i = 0; i < system.getPhase(0).getNumberOfComponents(); i++) {
Jac.set(i, system.getPhase(0).getNumberOfComponents(),
- system.getPhases()[0].getComponent(i).getdfugdp()
- - system.getPhases()[1].getComponent(i).getdfugdp());
+ system.getPhase(0).getComponent(i).getdfugdp()
+ - system.getPhase(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 559502e8b..0af7a39e8 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].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()));
+ 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()));
}
}
@@ -93,11 +93,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.getPhases()[0].getComponent(i).getx() - 1.0
- + system.getPhases()[0].getComponent(i).getdfugdx(j))
- + 1.0 / (1.0 - system.getBeta())
- * (dij / system.getPhases()[1].getComponent(i).getx() - 1.0
- + system.getPhases()[1].getComponent(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 +109,7 @@ public void setJac() {
*/
public void setu() {
for (int i = 0; i < numberOfComponents; i++) {
- u.set(i, 0, system.getBeta() * system.getPhases()[0].getComponent(i).getx());
+ u.set(i, 0, system.getBeta() * system.getPhase(0).getComponent(i).getx());
}
}
@@ -128,14 +127,12 @@ public void init() {
system.setBeta(temp);
for (int i = 0; i < numberOfComponents; i++) {
- 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].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.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/saturationops/CricondenBarTemp1.java b/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/CricondenBarTemp1.java
index 3f577362d..fa0ecebc8 100644
--- a/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/CricondenBarTemp1.java
+++ b/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/CricondenBarTemp1.java
@@ -81,8 +81,8 @@ public void setfvec() {
fvec.set(i, 0,
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()));
+ - Math.log(system.getPhase(1).getComponent(i).getFugacityCoefficient()
+ * system.getPhase(1).getComponent(i).getx() * system.getPressure()));
}
fvec.set(numberOfComponents, 0, 1.0 - xtot);
fvec.set(numberOfComponents + 1, 0, dQdT);
@@ -105,11 +105,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.getPhases()[0].getComponent(i).getx() - 1.0
- + system.getPhases()[0].getComponent(i).getdfugdx(j))
- + 1.0 / (1.0 - system.getBeta())
- * (dij / system.getPhases()[1].getComponent(i).getx() - 1.0
- + system.getPhases()[1].getComponent(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);
}
}
@@ -122,7 +121,7 @@ public void setJac() {
*/
public void setu() {
for (int i = 0; i < numberOfComponents; i++) {
- u.set(i, 0, system.getBeta() * system.getPhases()[0].getComponent(i).getx());
+ u.set(i, 0, system.getBeta() * system.getPhase(0).getComponent(i).getx());
}
}
@@ -140,14 +139,12 @@ public void init() {
system.setBeta(temp);
for (int i = 0; i < numberOfComponents; i++) {
- 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].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.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/saturationops/DewPointPressureFlash.java b/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/DewPointPressureFlash.java
index 5cd619b54..ffa857d6b 100644
--- a/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/DewPointPressureFlash.java
+++ b/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/DewPointPressureFlash.java
@@ -47,51 +47,48 @@ public void run() {
system.getChemicalReactionOperations().solveChemEq(1);
}
- for (int i = 0; i < system.getPhases()[1].getNumberOfComponents(); i++) {
- 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);
+ for (int i = 0; i < system.getPhase(1).getNumberOfComponents(); i++) {
+ system.getPhase(0).getComponent(i).setx(system.getPhase(0).getComponent(i).getz());
+ if (system.getPhase(0).getComponent(i).getIonicCharge() != 0) {
+ system.getPhase(0).getComponent(i).setx(1e-40);
} else {
- system.getPhases()[1].getComponent(i)
- .setx(1.0 / system.getPhases()[0].getComponent(i).getK()
- * system.getPhases()[1].getComponent(i).getz());
+ system.getPhase(1).getComponent(i).setx(1.0 / system.getPhase(0).getComponent(i).getK()
+ * system.getPhase(1).getComponent(i).getz());
}
}
- // system.setPressure(system.getPhases()[0].getAntoineVaporPressure(system.getTemperature()));
+ // system.setPressure(system.getPhase(0).getAntoineVaporPressure(system.getTemperature()));
xtotal = 0.0;
- for (int i = 0; i < system.getPhases()[1].getNumberOfComponents(); i++) {
- xtotal += system.getPhases()[1].getComponent(i).getx();
+ for (int i = 0; i < system.getPhase(1).getNumberOfComponents(); i++) {
+ xtotal += system.getPhase(1).getComponent(i).getx();
}
double ktot = 0.0;
do {
iterations++;
- for (int i = 0; i < system.getPhases()[1].getNumberOfComponents(); i++) {
- system.getPhases()[1].getComponent(i)
- .setx(system.getPhases()[1].getComponent(i).getx() / xtotal);
+ for (int i = 0; i < system.getPhase(1).getNumberOfComponents(); i++) {
+ system.getPhase(1).getComponent(i).setx(system.getPhase(1).getComponent(i).getx() / xtotal);
}
system.init(1);
ktot = 0.0;
oldPres = system.getPressure();
- for (int i = 0; i < system.getPhases()[1].getNumberOfComponents(); i++) {
+ for (int i = 0; i < system.getPhase(1).getNumberOfComponents(); i++) {
do {
- xold = system.getPhases()[1].getComponent(i).getx();
+ xold = system.getPhase(1).getComponent(i).getx();
if (system.getPhase(0).getComponent(i).getIonicCharge() != 0) {
- system.getPhases()[0].getComponent(i).setK(1e-40);
+ system.getPhase(0).getComponent(i).setK(1e-40);
} else {
- 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.getPhase(0).getComponent(i)
+ .setK(Math.exp(Math.log(system.getPhase(1).getComponent(i).getFugacityCoefficient())
+ - Math.log(system.getPhase(0).getComponent(i).getFugacityCoefficient())));
}
- 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);
+ system.getPhase(1).getComponent(i).setK(system.getPhase(0).getComponent(i).getK());
+ system.getPhase(1).getComponent(i).setx(1.0 / system.getPhase(0).getComponent(i).getK()
+ * system.getPhase(1).getComponent(i).getz());
+ } while (Math.abs(system.getPhase(1).getComponent(i).getx() - xold) > 1e-4);
+ ktot += Math.abs(system.getPhase(1).getComponent(i).getK() - 1.0);
}
xtotal = 0.0;
- for (int i = 0; i < system.getPhases()[1].getNumberOfComponents(); i++) {
- xtotal += system.getPhases()[1].getComponent(i).getx();
+ for (int i = 0; i < system.getPhase(1).getNumberOfComponents(); i++) {
+ xtotal += system.getPhase(1).getComponent(i).getx();
}
system.setPressure(oldPres + 0.1 * (system.getPressure() / xtotal - oldPres));
// System.out.println("iter " + iterations + " pressure "
@@ -100,7 +97,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].getComponent(0).getK());
+ // +system.getPhase(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 19b2c3046..08ea040c0 100644
--- a/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/DewPointTemperatureFlash.java
+++ b/src/main/java/neqsim/thermodynamicoperations/flashops/saturationops/DewPointTemperatureFlash.java
@@ -49,61 +49,56 @@ public void run() {
system.getChemicalReactionOperations().solveChemEq(1);
}
- for (int i = 0; i < system.getPhases()[1].getNumberOfComponents(); i++) {
- 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);
+ for (int i = 0; i < system.getPhase(1).getNumberOfComponents(); i++) {
+ system.getPhase(0).getComponent(i).setx(system.getPhase(0).getComponent(i).getz());
+ if (system.getPhase(0).getComponent(i).getIonicCharge() != 0) {
+ system.getPhase(0).getComponent(i).setx(1e-40);
} else {
- 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].getComponent(i).setx(1.0e-10);
+ if (system.getPhase(1).getComponent(i).getName().equals("water")) {
+ system.getPhase(1).getComponent(i).setx(1.0);
+ } else if (system.getPhase(1).hasComponent("water")) {
+ system.getPhase(1).getComponent(i).setx(1.0e-10);
} else {
- system.getPhases()[1].getComponent(i)
- .setx(1.0 / system.getPhases()[0].getComponent(i).getK()
- * system.getPhases()[1].getComponent(i).getz());
+ system.getPhase(1).getComponent(i).setx(1.0 / system.getPhase(0).getComponent(i).getK()
+ * system.getPhase(1).getComponent(i).getz());
}
}
}
- // system.setPressure(system.getPhases()[0].getAntoineVaporPressure(system.getTemperature()));
+ // system.setPressure(system.getPhase(0).getAntoineVaporPressure(system.getTemperature()));
xtotal = 0.0;
- for (int i = 0; i < system.getPhases()[1].getNumberOfComponents(); i++) {
- xtotal += system.getPhases()[1].getComponent(i).getx();
+ for (int i = 0; i < system.getPhase(1).getNumberOfComponents(); i++) {
+ xtotal += system.getPhase(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].getComponent(i)
- .setx(system.getPhases()[1].getComponent(i).getx() / xtotal);
+ for (int i = 0; i < system.getPhase(1).getNumberOfComponents(); i++) {
+ system.getPhase(1).getComponent(i).setx(system.getPhase(1).getComponent(i).getx() / xtotal);
}
system.init(1);
oldTemp = system.getTemperature();
iterations++;
ktot = 0.0;
- for (int i = 0; i < system.getPhases()[1].getNumberOfComponents(); i++) {
+ for (int i = 0; i < system.getPhase(1).getNumberOfComponents(); i++) {
do {
- xold = system.getPhases()[1].getComponent(i).getx();
+ xold = system.getPhase(1).getComponent(i).getx();
if (system.getPhase(0).getComponent(i).getIonicCharge() != 0) {
- system.getPhases()[0].getComponent(i).setK(1e-40);
+ system.getPhase(0).getComponent(i).setK(1e-40);
} else {
- system.getPhases()[0].getComponent(i)
- .setK(Math.exp(system.getPhases()[1].getComponent(i).getLogFugacityCoefficient()
- - system.getPhases()[0].getComponent(i).getLogFugacityCoefficient()));
+ system.getPhase(0).getComponent(i)
+ .setK(Math.exp(system.getPhase(1).getComponent(i).getLogFugacityCoefficient()
+ - system.getPhase(0).getComponent(i).getLogFugacityCoefficient()));
}
- 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);
+ system.getPhase(1).getComponent(i).setK(system.getPhase(0).getComponent(i).getK());
+ system.getPhase(1).getComponent(i).setx(1.0 / system.getPhase(0).getComponent(i).getK()
+ * system.getPhase(1).getComponent(i).getz());
+ } while (Math.abs(system.getPhase(1).getComponent(i).getx() - xold) > 1e-6);
+ ktot += Math.abs(system.getPhase(1).getComponent(i).getK() - 1.0);
}
xtotal = 0.0;
- for (int i = 0; i < system.getPhases()[1].getNumberOfComponents(); i++) {
- xtotal += system.getPhases()[1].getComponent(i).getx();
+ for (int i = 0; i < system.getPhase(1).getNumberOfComponents(); i++) {
+ xtotal += system.getPhase(1).getComponent(i).getx();
}
double f = xtotal - 1.0;
@@ -122,8 +117,8 @@ public void run() {
.setTemperature(system.getTemperature() - iterations / (iterations + 10.0) * f / dfdT);
}
// System.out.println("temperature " + system.getTemperature());
- // for (int i=0;i