diff --git a/src/main/java/neqsim/processSimulation/measurementDevice/simpleFlowRegime/SevereSlugAnalyser.java b/src/main/java/neqsim/processSimulation/measurementDevice/simpleFlowRegime/SevereSlugAnalyser.java index 01aff422e6..3edfe01d38 100644 --- a/src/main/java/neqsim/processSimulation/measurementDevice/simpleFlowRegime/SevereSlugAnalyser.java +++ b/src/main/java/neqsim/processSimulation/measurementDevice/simpleFlowRegime/SevereSlugAnalyser.java @@ -1,4 +1,5 @@ package neqsim.processSimulation.measurementDevice.simpleFlowRegime; + import java.util.Arrays; import java.util.Collections; import org.apache.logging.log4j.LogManager; @@ -9,406 +10,454 @@ import neqsim.thermodynamicOperations.ThermodynamicOperations; /** - *
SevereSlugAnalyser class.
+ *+ * SevereSlugAnalyser class. + *
* * @author ASMF * @version $Id: $Id */ public class SevereSlugAnalyser extends MeasurementDeviceBaseClass { static Logger logger = LogManager.getLogger(SevereSlugAnalyser.class); - FluidSevereSlug fluidSevereS; - Pipe pipe; - SevereSlugAnalyser severeSlug; - Stream streamS; - - - final double gravAcc = neqsim.thermo.ThermodynamicConstantsInterface.gravity; - - //Severe slug problem - private double simulationTime = 200; - private double usl = 3.0; - private double usg = 0.5; - private double outletPressure = 100000.0; - private double temperature = 20.0; - private int numberOfTimeSteps = 20000; - private double internalDiameter = 0.0; - private double leftLength = 0.0; - private double rightLength = 0.0; - private double angle = 0.0; - - // These variables should not be changed by the user I guess. - // But this can be done if the user has advanced knowledge about the problem. - double alfaRiser = 0.0; // gas fraction in the riser - double z = 0.0001; // some initial value to start the calculation - double lambdaStagnant = 0.0; - double uLevel = 0.0;// some initial value to start the calculation - double valveConstant = 0.0; - double normalPressure = 100000.0; - final double pi = neqsim.thermo.ThermodynamicConstantsInterface.pi; - - double[] resPres; - double[] resTime; - double[] resLiqHoldUpRiser; - double[] resLiqHeight; - double[] resMixVelocity; - double[] usgMap; - double[] uslMap; - double slugValue; - - //Simulation variables (calculated variables) - double deltaT; - double driftVel; - double flowDistCoeff; - double mixDensity; - double pressure; - double slugLength; - double transVel; - double Um; - double UmOld; - double UsgL; - double UslL; - double UsgR; - double UslR; - double U; - double Re; - double lambda; - double friction; - double frictionStagnant; - double frictionValve; - double frictionTot; - double gravL; - double gravR; - double gravity; - double alfaRiserOld; - double zOld; - double Lg; - double pressureOld; - double alfaLeft; - double gasDensity; - double n; - double gamma1; - double gamma2; - double gamma; - double holdUp1; - double holdUp2; - double holdUp; - double function2; - double function1; - - - double iter; - - String flowPattern; - - // This constructor is used for the "default" values - SevereSlugAnalyser(){ - this.setSuperficialGasVelocity(usl); - this.setSuperficialGasVelocity(usg); - this.setOutletPressure(outletPressure); - this.setTemperature(temperature); - this.setSimulationTime(simulationTime); - this.setNumberOfTimeSteps(numberOfTimeSteps); - - } - - // This constructor is used for the user input of superficial liquid and gas velocities, - // and the rest will be the default values - SevereSlugAnalyser(double usl, double usg){ - this.setSuperficialLiquidVelocity(usl); - this.setSuperficialGasVelocity(usg); - this.setOutletPressure(outletPressure); - this.setTemperature(temperature); - this.setSimulationTime(simulationTime); - this.setNumberOfTimeSteps(numberOfTimeSteps); - } - - // This constructor is used for the user input of superficial liquid and gas velocities, outletPressure, - // temperature, simulationTime, numberOfTimeSteps - // and the rest will be the default values - SevereSlugAnalyser(double usl, double usg, double outletPressure, double temperature, double simulationTime, int numberOfTimeSteps){ - this.setSuperficialLiquidVelocity(usl); - this.setSuperficialGasVelocity(usg); - this.setOutletPressure(outletPressure); - this.setTemperature(temperature); - this.setSimulationTime(simulationTime); - this.setNumberOfTimeSteps(numberOfTimeSteps); - } + FluidSevereSlug fluidSevereS; + Pipe pipe; + SevereSlugAnalyser severeSlug; + Stream streamS; + + + final double gravAcc = neqsim.thermo.ThermodynamicConstantsInterface.gravity; + + // Severe slug problem + private double simulationTime = 200; + private double usl = 3.0; + private double usg = 0.5; + private double outletPressure = 100000.0; + private double temperature = 20.0; + private int numberOfTimeSteps = 20000; + private double internalDiameter = 0.0; + private double leftLength = 0.0; + private double rightLength = 0.0; + private double angle = 0.0; + + // These variables should not be changed by the user I guess. + // But this can be done if the user has advanced knowledge about the problem. + double alfaRiser = 0.0; // gas fraction in the riser + double z = 0.0001; // some initial value to start the calculation + double lambdaStagnant = 0.0; + double uLevel = 0.0;// some initial value to start the calculation + double valveConstant = 0.0; + double normalPressure = 100000.0; + final double pi = neqsim.thermo.ThermodynamicConstantsInterface.pi; + + double[] resPres; + double[] resTime; + double[] resLiqHoldUpRiser; + double[] resLiqHeight; + double[] resMixVelocity; + double[] usgMap; + double[] uslMap; + double slugValue; + + // Simulation variables (calculated variables) + double deltaT; + double driftVel; + double flowDistCoeff; + double mixDensity; + double pressure; + double slugLength; + double transVel; + double Um; + double UmOld; + double UsgL; + double UslL; + double UsgR; + double UslR; + double U; + double Re; + double lambda; + double friction; + double frictionStagnant; + double frictionValve; + double frictionTot; + double gravL; + double gravR; + double gravity; + double alfaRiserOld; + double zOld; + double Lg; + double pressureOld; + double alfaLeft; + double gasDensity; + double n; + double gamma1; + double gamma2; + double gamma; + double holdUp1; + double holdUp2; + double holdUp; + double function2; + double function1; + + + double iter; + + String flowPattern; + + // This constructor is used for the "default" values + SevereSlugAnalyser() { + this.setSuperficialGasVelocity(usl); + this.setSuperficialGasVelocity(usg); + this.setOutletPressure(outletPressure); + this.setTemperature(temperature); + this.setSimulationTime(simulationTime); + this.setNumberOfTimeSteps(numberOfTimeSteps); - SevereSlugAnalyser(SystemInterface fluid, Pipe pipe, double outletPressure, double temperature, double simulationTime, int numberOfTimeSteps){ - ThermodynamicOperations ops = new ThermodynamicOperations(fluid); - ops.TPflash(); - fluid.initProperties(); - if (fluid.getNumberOfPhases() == 2){ - usl = fluid.getPhase(1).getFlowRate("m3/sec") / pipe.getArea(); - } - else{ - usl = fluid.getPhase(1).getFlowRate("m3/sec") / pipe.getArea() + fluid.getPhase(2).getFlowRate("m3/sec") / pipe.getArea(); - } - this.setSuperficialLiquidVelocity(usl); - usg = fluid.getPhase(0).getFlowRate("m3/sec") / pipe.getArea(); - this.setSuperficialGasVelocity(usg); - this.setOutletPressure(outletPressure); - this.setTemperature(temperature); - this.setSimulationTime(simulationTime); - this.setNumberOfTimeSteps(numberOfTimeSteps); - } + } - SevereSlugAnalyser(Stream stream, double internalDiameter, double leftLength, double rightLength, double angle, double outletPressure, double temperature, double simulationTime, int numberOfTimeSteps){ - pipe = new Pipe(internalDiameter, leftLength, rightLength, angle); - streamS = stream; - SystemInterface fluid = stream.getThermoSystem(); - ThermodynamicOperations ops = new ThermodynamicOperations(fluid); - ops.TPflash(); - fluid.initProperties(); - if (fluid.getNumberOfPhases() == 2){ - usl = fluid.getPhase(1).getFlowRate("m3/sec") / pipe.getArea(); - } - else{ - usl = fluid.getPhase(1).getFlowRate("m3/sec") / pipe.getArea() + fluid.getPhase(2).getFlowRate("m3/sec") / pipe.getArea(); - } - fluidSevereS = new FluidSevereSlug(fluid); - usg = fluid.getPhase(0).getFlowRate("m3/sec") / pipe.getArea(); + // This constructor is used for the user input of superficial liquid and gas velocities, + // and the rest will be the default values + SevereSlugAnalyser(double usl, double usg) { + this.setSuperficialLiquidVelocity(usl); + this.setSuperficialGasVelocity(usg); + this.setOutletPressure(outletPressure); + this.setTemperature(temperature); + this.setSimulationTime(simulationTime); + this.setNumberOfTimeSteps(numberOfTimeSteps); + } - severeSlug = new SevereSlugAnalyser(usl, usg, outletPressure, temperature, simulationTime, - numberOfTimeSteps); - } + // This constructor is used for the user input of superficial liquid and gas velocities, + // outletPressure, + // temperature, simulationTime, numberOfTimeSteps + // and the rest will be the default values + SevereSlugAnalyser(double usl, double usg, double outletPressure, double temperature, + double simulationTime, int numberOfTimeSteps) { + this.setSuperficialLiquidVelocity(usl); + this.setSuperficialGasVelocity(usg); + this.setOutletPressure(outletPressure); + this.setTemperature(temperature); + this.setSimulationTime(simulationTime); + this.setNumberOfTimeSteps(numberOfTimeSteps); + } - SevereSlugAnalyser(Stream stream, double internalDiameter, double leftLength, - double rightLength, double angle, double simulationTime, int numberOfTimeSteps) { - this(stream, internalDiameter, leftLength, rightLength, angle, stream.getPressure("Pa"), - stream.getTemperature("C"), simulationTime, numberOfTimeSteps); - } + SevereSlugAnalyser(SystemInterface fluid, Pipe pipe, double outletPressure, double temperature, + double simulationTime, int numberOfTimeSteps) { + ThermodynamicOperations ops = new ThermodynamicOperations(fluid); + ops.TPflash(); + fluid.initProperties(); + if (fluid.getNumberOfPhases() == 2) { + usl = fluid.getPhase(1).getFlowRate("m3/sec") / pipe.getArea(); + } else { + usl = fluid.getPhase(1).getFlowRate("m3/sec") / pipe.getArea() + + fluid.getPhase(2).getFlowRate("m3/sec") / pipe.getArea(); + } + this.setSuperficialLiquidVelocity(usl); + usg = fluid.getPhase(0).getFlowRate("m3/sec") / pipe.getArea(); + this.setSuperficialGasVelocity(usg); + this.setOutletPressure(outletPressure); + this.setTemperature(temperature); + this.setSimulationTime(simulationTime); + this.setNumberOfTimeSteps(numberOfTimeSteps); + } + + SevereSlugAnalyser(Stream stream, double internalDiameter, double leftLength, double rightLength, + double angle, double outletPressure, double temperature, double simulationTime, + int numberOfTimeSteps) { + pipe = new Pipe(internalDiameter, leftLength, rightLength, angle); + streamS = stream; + SystemInterface fluid = stream.getThermoSystem(); + ThermodynamicOperations ops = new ThermodynamicOperations(fluid); + ops.TPflash(); + fluid.initProperties(); + if (fluid.getNumberOfPhases() == 2) { + usl = fluid.getPhase(1).getFlowRate("m3/sec") / pipe.getArea(); + } else { + usl = fluid.getPhase(1).getFlowRate("m3/sec") / pipe.getArea() + + fluid.getPhase(2).getFlowRate("m3/sec") / pipe.getArea(); + } + fluidSevereS = new FluidSevereSlug(fluid); + usg = fluid.getPhase(0).getFlowRate("m3/sec") / pipe.getArea(); + + severeSlug = new SevereSlugAnalyser(usl, usg, outletPressure, temperature, simulationTime, + numberOfTimeSteps); + } - SevereSlugAnalyser(Stream stream, double internalDiameter, double leftLength, - double rightLength, double angle) { + SevereSlugAnalyser(Stream stream, double internalDiameter, double leftLength, double rightLength, + double angle, double simulationTime, int numberOfTimeSteps) { this(stream, internalDiameter, leftLength, rightLength, angle, stream.getPressure("Pa"), - stream.getTemperature("C"), 500.0, 50000); -} + stream.getTemperature("C"), simulationTime, numberOfTimeSteps); + } - SevereSlugAnalyser(double outletPressure, double temperature, double simulationTime, int numberOfTimeSteps){ - this.setSuperficialLiquidVelocity(usl); - this.setSuperficialGasVelocity(usg); - this.setOutletPressure(outletPressure); - this.setTemperature(temperature); - this.setSimulationTime(simulationTime); - this.setNumberOfTimeSteps(numberOfTimeSteps); - } + SevereSlugAnalyser(Stream stream, double internalDiameter, double leftLength, double rightLength, + double angle) { + this(stream, internalDiameter, leftLength, rightLength, angle, stream.getPressure("Pa"), + stream.getTemperature("C"), 500.0, 50000); + } + SevereSlugAnalyser(double outletPressure, double temperature, double simulationTime, + int numberOfTimeSteps) { + this.setSuperficialLiquidVelocity(usl); + this.setSuperficialGasVelocity(usg); + this.setOutletPressure(outletPressure); + this.setTemperature(temperature); + this.setSimulationTime(simulationTime); + this.setNumberOfTimeSteps(numberOfTimeSteps); + } - // Encapsulation - // 1. Superficial Liquid Velocity Encapsulation - /** - *setSuperficialLiquidVelocity.
- * - * @param usl a double - */ - public void setSuperficialLiquidVelocity(double usl) { - this.usl = usl; - } - - /** - *getSuperficialLiquidVelocity.
- * - * @return a double - */ - public double getSuperficialLiquidVelocity() { - return usl; - } - - // 2. Superficial Gas Velocity Encapsulation - /** - *setSuperficialGasVelocity.
- * - * @param usg a double - */ - public void setSuperficialGasVelocity(double usg) { - this.usg = usg; - } - - /** - *getSuperficialGasVelocity.
- * - * @return a double - */ - public double getSuperficialGasVelocity() { - return usg; - } - - /** - *Getter for the field flowPattern
.
Getter for the field slugValue
.
+ * setSuperficialLiquidVelocity. + *
+ * + * @param usl a double + */ + public void setSuperficialLiquidVelocity(double usl) { + this.usl = usl; + } - // 3. Pipe Outlet Pressure Encapsulation - /** - *Setter for the field outletPressure
.
Getter for the field outletPressure
.
Setter for the field temperature
.
Getter for the field temperature
.
Setter for the field numberOfTimeSteps
.
Getter for the field numberOfTimeSteps
.
Setter for the field simulationTime
.
Getter for the field simulationTime
.
gasConst.
- * - * @param fluid a {@link neqsim.processSimulation.measurementDevice.simpleFlowRegime.FluidSevereSlug} object - * @return a double - */ - public double gasConst(FluidSevereSlug fluid) { - return 8.314 / fluid.getMolecularWeight() * (273.15 + temperature); - } - - //Declare the variables for resuts after creating an object Severe slug with required number of steps. - - /** - *slugHoldUp.
- * - * @param pipe a {@link neqsim.processSimulation.measurementDevice.simpleFlowRegime.Pipe} object - * @param severeSlug a {@link neqsim.processSimulation.measurementDevice.simpleFlowRegime.SevereSlugAnalyser} object - * @return a double - */ - public double slugHoldUp (Pipe pipe, SevereSlugAnalyser severeSlug){ - double Udrift; - double C0 = 1.2; - double Umix; - - Umix = severeSlug.getSuperficialGasVelocity() + severeSlug.getSuperficialLiquidVelocity(); - Udrift = Math.sqrt(gravAcc*pipe.getInternalDiameter()); - holdUp = 1 - severeSlug.getSuperficialGasVelocity()/(C0 * Umix + Udrift); - return holdUp; - } + /** + *+ * getSuperficialLiquidVelocity. + *
+ * + * @return a double + */ + public double getSuperficialLiquidVelocity() { + return usl; + } + + // 2. Superficial Gas Velocity Encapsulation + /** + *+ * setSuperficialGasVelocity. + *
+ * + * @param usg a double + */ + public void setSuperficialGasVelocity(double usg) { + this.usg = usg; + } + + /** + *+ * getSuperficialGasVelocity. + *
+ * + * @return a double + */ + public double getSuperficialGasVelocity() { + return usg; + } + + /** + *
+ * Getter for the field flowPattern
.
+ *
+ * Getter for the field slugValue
.
+ *
+ * Setter for the field outletPressure
.
+ *
+ * Getter for the field outletPressure
.
+ *
+ * Setter for the field temperature
.
+ *
+ * Getter for the field temperature
.
+ *
+ * Setter for the field numberOfTimeSteps
.
+ *
+ * Getter for the field numberOfTimeSteps
.
+ *
+ * Setter for the field simulationTime
.
+ *
+ * Getter for the field simulationTime
.
+ *
stratifiedHoldUp.
+ *+ * gasConst. + *
+ * + * @param fluid a + * {@link neqsim.processSimulation.measurementDevice.simpleFlowRegime.FluidSevereSlug} + * object + * @return a double + */ + public double gasConst(FluidSevereSlug fluid) { + return 8.314 / fluid.getMolecularWeight() * (273.15 + temperature); + } + + // Declare the variables for resuts after creating an object Severe slug with required number of + // steps. + + /** + *+ * slugHoldUp. + *
* - * @param fluid a {@link neqsim.processSimulation.measurementDevice.simpleFlowRegime.FluidSevereSlug} object * @param pipe a {@link neqsim.processSimulation.measurementDevice.simpleFlowRegime.Pipe} object - * @param severeSlug a {@link neqsim.processSimulation.measurementDevice.simpleFlowRegime.SevereSlugAnalyser} object + * @param severeSlug a + * {@link neqsim.processSimulation.measurementDevice.simpleFlowRegime.SevereSlugAnalyser} + * object * @return a double */ - public double stratifiedHoldUp (FluidSevereSlug fluid, Pipe pipe, SevereSlugAnalyser severeSlug){ - Re = fluid.getLiqDensity()*severeSlug.getSuperficialLiquidVelocity()*pipe.getInternalDiameter()/(fluid.getliqVisc()); + public double slugHoldUp(Pipe pipe, SevereSlugAnalyser severeSlug) { + double Udrift; + double C0 = 1.2; + double Umix; + + Umix = severeSlug.getSuperficialGasVelocity() + severeSlug.getSuperficialLiquidVelocity(); + Udrift = Math.sqrt(gravAcc * pipe.getInternalDiameter()); + holdUp = 1 - severeSlug.getSuperficialGasVelocity() / (C0 * Umix + Udrift); + return holdUp; + } + + /** + *+ * stratifiedHoldUp. + *
+ * + * @param fluid a + * {@link neqsim.processSimulation.measurementDevice.simpleFlowRegime.FluidSevereSlug} + * object + * @param pipe a {@link neqsim.processSimulation.measurementDevice.simpleFlowRegime.Pipe} object + * @param severeSlug a + * {@link neqsim.processSimulation.measurementDevice.simpleFlowRegime.SevereSlugAnalyser} + * object + * @return a double + */ + public double stratifiedHoldUp(FluidSevereSlug fluid, Pipe pipe, SevereSlugAnalyser severeSlug) { + Re = fluid.getLiqDensity() * severeSlug.getSuperficialLiquidVelocity() + * pipe.getInternalDiameter() / (fluid.getliqVisc()); lambda = Math.max(0.34 * Math.pow(Re, -0.25), 64 / Re); - if (0.34 * Math.pow(Re, -0.25) > 64 / Re){ + if (0.34 * Math.pow(Re, -0.25) > 64 / Re) { n = 0.25; - } - else{ - n = 1; + } else { + n = 1; } - friction=0.5*lambda*Math.pow(severeSlug.getSuperficialLiquidVelocity(),2)/(gravAcc*Math.sin(pipe.getAngle("Radian"))*pipe.getInternalDiameter()); + friction = 0.5 * lambda * Math.pow(severeSlug.getSuperficialLiquidVelocity(), 2) + / (gravAcc * Math.sin(pipe.getAngle("Radian")) * pipe.getInternalDiameter()); gamma1 = 0.1; gamma2 = 2.2; iter = 0; - while(Math.abs(gamma2 - gamma1) > 1e-5 && iter < 200){ + while (Math.abs(gamma2 - gamma1) > 1e-5 && iter < 200) { - holdUp2 = (gamma2 - 0.5*Math.sin(2*gamma2))/(pi); - function2 = Math.pow(holdUp2,3)*Math.pow((pi/gamma2),(n+1))-friction; + holdUp2 = (gamma2 - 0.5 * Math.sin(2 * gamma2)) / (pi); + function2 = Math.pow(holdUp2, 3) * Math.pow((pi / gamma2), (n + 1)) - friction; - holdUp1 = (gamma1 - 0.5*Math.sin(2*gamma1))/(pi); - function1 = Math.pow(holdUp1,3)*Math.pow((pi/gamma1),(n+1))-friction; + holdUp1 = (gamma1 - 0.5 * Math.sin(2 * gamma1)) / (pi); + function1 = Math.pow(holdUp1, 3) * Math.pow((pi / gamma1), (n + 1)) - friction; - gamma = gamma2 - function2*(gamma2 - gamma1)/(function2 - function1); - if (gamma < 0){ - if (gamma2 != 0.1) - { + gamma = gamma2 - function2 * (gamma2 - gamma1) / (function2 - function1); + if (gamma < 0) { + if (gamma2 != 0.1) { gamma = 0.1; - } - else{ + } else { gamma = 0.2; } } - if (gamma > 3.00){ - if (gamma2 != 2.99) - { + if (gamma > 3.00) { + if (gamma2 != 2.99) { gamma = 2.99; - } - else{ + } else { gamma = 2.97; } } - + gamma1 = gamma2; gamma2 = gamma; iter = iter + 1; @@ -416,346 +465,388 @@ public double stratifiedHoldUp (FluidSevereSlug fluid, Pipe pipe, SevereSlugAnal if (iter == 199) { logger.debug("Could not find solution for stratified flow holdup"); - } - else{ - holdUp = (gamma - 0.5*Math.sin(2*gamma))/(pi); + } else { + holdUp = (gamma - 0.5 * Math.sin(2 * gamma)) / (pi); } return holdUp; -} - - // Passing 3 objects as input parameters (fluid, pipe, severeSlug) - /** - *runSevereSlug.
- * - * @param fluid a {@link neqsim.processSimulation.measurementDevice.simpleFlowRegime.FluidSevereSlug} object - * @param pipe a {@link neqsim.processSimulation.measurementDevice.simpleFlowRegime.Pipe} object - * @param severeSlug a {@link neqsim.processSimulation.measurementDevice.simpleFlowRegime.SevereSlugAnalyser} object - */ - public void runSevereSlug(FluidSevereSlug fluid, Pipe pipe, SevereSlugAnalyser severeSlug){ - - resPres = new double[severeSlug.getNumberOfTimeSteps()]; - resTime = new double[severeSlug.getNumberOfTimeSteps()]; - resLiqHoldUpRiser = new double[severeSlug.getNumberOfTimeSteps()]; - resLiqHeight = new double[severeSlug.getNumberOfTimeSteps()]; - resMixVelocity = new double[severeSlug.getNumberOfTimeSteps()]; - - deltaT = 0.001; //severeSlug.getSimulationTime() / severeSlug.getNumberOfTimeSteps(); - mixDensity = fluid.getLiqDensity(); - pressure = severeSlug.getOutletPressure() + mixDensity * severeSlug.gravAcc * pipe.getRightLength(); // Initial condition - Um = severeSlug.getSuperficialGasVelocity(); - holdUp = severeSlug.stratifiedHoldUp(fluid, pipe, severeSlug); - driftVel = 0.35 * Math.sqrt(gravAcc * pipe.getInternalDiameter()); // Drift velocity for the vertical flows - alfaLeft = 1 - holdUp; - - for(int i = 0; i < severeSlug.numberOfTimeSteps; i++) - - { - slugLength = -z + pipe.getRightLength() * (1 - alfaRiser); //Slug Length - Re = fluid.getLiqDensity() * Math.abs(Um) * pipe.getInternalDiameter() / fluid.getliqVisc(); // Reynolds number - lambda = Math.max(0.34 * Math.pow(Re, -0.25), 64 / Re); // friction factor - friction = 0.5 * lambda * fluid.getLiqDensity()* Um * Math.abs(Um) * slugLength / pipe.getInternalDiameter(); // frictional pressure loss - //Oscillation Friction - frictionStagnant = 0.5 * lambdaStagnant * fluid.getLiqDensity() * uLevel * Math.abs(uLevel) * slugLength / pipe.getInternalDiameter(); - //Valve Friction - frictionValve = valveConstant * fluid.getLiqDensity() * Um * Math.abs(Um); - //Total Friction - friction = friction + frictionStagnant + frictionValve; - // Gravity - gravL = -fluid.getLiqDensity() * Math.abs(z) * gravAcc * Math.sin((pipe.getAngle("Radian"))); - gravR = mixDensity * gravAcc * pipe.getRightLength(); - gravity = gravL + gravR; - - // Momentum Balance - UmOld = Um; - Um = UmOld + deltaT * ((pressure - severeSlug.outletPressure) - friction - gravity) - / (-z * fluid.getLiqDensity() + pipe.getRightLength() * mixDensity); - - // Slip Relation: Calculate translational velocity - if (Re < 2300) { - flowDistCoeff = 2; - } else { - flowDistCoeff = 1.2; - } - - transVel = flowDistCoeff * Um + driftVel; - // State Equation - // All cases, Case 1: Open Bend; Case 2: Blocked Bend; Case 3: Backflow - UsgL = (Um - severeSlug.getSuperficialLiquidVelocity()) * ((Um > 0) ? 1 : 0) * ((z > 0) ? 1 : 0); - - UslL = ( severeSlug.getSuperficialLiquidVelocity() * ((z > 0) ? 1 : 0) + Um * ((z < 0) ? 1 : 0) ) * ((Um > 0) ? 1 : 0) + - Um* ((Um < 0) ? 1 : 0); - - UsgR = (alfaRiser * transVel * ((z > 0) ? 1 : 0) + Um * ((z < 0) ? 1 : 0)) * ((Um > 0) ? 1 : 0) + Um * ((Um < 0) ? 1 : 0); - UslR = (Um - alfaRiser * transVel) * ((Um > 0) ? 1 : 0) * ((z > 0) ? 1 : 0); - - U = UsgL - UsgR - UslL + UslR; - - // Riser vapour fraction - alfaRiserOld = alfaRiser; - alfaRiser = alfaRiserOld + 0.5 * deltaT * U / (pipe.getRightLength()); - alfaRiser = Math.max(0.0, alfaRiser); - alfaRiser = Math.min(1.0, alfaRiser); - - // Level - uLevel = (-severeSlug.getSuperficialLiquidVelocity() + Um); - zOld = z; - z = zOld + deltaT * uLevel; - z = ((z < 0) ? 1 : 0) * z + ((z > 0) ? 1 : 0) * 0.0001; - uLevel = uLevel * ((z < 0) ? 1 : 0); - - Lg = pipe.getLeftLength() + z; - pressureOld = pressure; - pressure = pressureOld + deltaT * (severeSlug.getSuperficialGasVelocity() * normalPressure - UsgL * pressureOld) / (Lg*alfaLeft) - deltaT *(pressureOld * uLevel) / (Lg*alfaLeft); - - gasDensity = pressure / (fluid.getGasConstant()*(273.15 + severeSlug.getTemperature())); - mixDensity = alfaRiser * gasDensity + (1 - alfaRiser) * fluid.getLiqDensity(); - - resPres[i] = pressure/100000; - resTime[i] = i*deltaT; - resLiqHoldUpRiser[i] = (1-alfaRiser); - resLiqHeight[i] = z; - resMixVelocity[i] = Um; - - } - } + } - /** - *checkFlowRegime.
- * - * @param fluid a {@link neqsim.processSimulation.measurementDevice.simpleFlowRegime.FluidSevereSlug} object - * @param pipe a {@link neqsim.processSimulation.measurementDevice.simpleFlowRegime.Pipe} object - * @param severeSlug a {@link neqsim.processSimulation.measurementDevice.simpleFlowRegime.SevereSlugAnalyser} object - * @return a {@link java.lang.String} object - */ - public String checkFlowRegime(FluidSevereSlug fluid, Pipe pipe, SevereSlugAnalyser severeSlug){ - Double[] halfRes =new Double[severeSlug.getNumberOfTimeSteps()/2]; - severeSlug.runSevereSlug(fluid, pipe, severeSlug); - double sum = 0; - for (int i = severeSlug.numberOfTimeSteps / 2; i < severeSlug.numberOfTimeSteps; i++) { - sum = sum + severeSlug.resPres[i]; - halfRes[i - severeSlug.numberOfTimeSteps / 2] = severeSlug.resPres[i]; - } - double meanValue = sum / ((double) numberOfTimeSteps/2); - double max = Collections.max(Arrays.asList(halfRes)); - slugValue = (max/meanValue) - 1; - double stratifiedHoldUp = stratifiedHoldUp (fluid, pipe, severeSlug); - logger.debug(stratifiedHoldUp); - - double slugHoldUp = slugHoldUp(pipe,severeSlug); - logger.debug(slugHoldUp); - logger.debug("The severe slug value is " + slugValue); - if (slugValue > 0.1 && slugHoldUp > stratifiedHoldUp){ - flowPattern = "Severe Slug"; - } - else if(slugValue > 0.05 && slugHoldUp > stratifiedHoldUp){ - flowPattern = "Severe Slug 2. Small pressure variations"; + // Passing 3 objects as input parameters (fluid, pipe, severeSlug) + /** + *+ * runSevereSlug. + *
+ * + * @param fluid a + * {@link neqsim.processSimulation.measurementDevice.simpleFlowRegime.FluidSevereSlug} + * object + * @param pipe a {@link neqsim.processSimulation.measurementDevice.simpleFlowRegime.Pipe} object + * @param severeSlug a + * {@link neqsim.processSimulation.measurementDevice.simpleFlowRegime.SevereSlugAnalyser} + * object + */ + public void runSevereSlug(FluidSevereSlug fluid, Pipe pipe, SevereSlugAnalyser severeSlug) { + + resPres = new double[severeSlug.getNumberOfTimeSteps()]; + resTime = new double[severeSlug.getNumberOfTimeSteps()]; + resLiqHoldUpRiser = new double[severeSlug.getNumberOfTimeSteps()]; + resLiqHeight = new double[severeSlug.getNumberOfTimeSteps()]; + resMixVelocity = new double[severeSlug.getNumberOfTimeSteps()]; + + deltaT = 0.001; // severeSlug.getSimulationTime() / severeSlug.getNumberOfTimeSteps(); + mixDensity = fluid.getLiqDensity(); + pressure = + severeSlug.getOutletPressure() + mixDensity * severeSlug.gravAcc * pipe.getRightLength(); // Initial + // condition + Um = severeSlug.getSuperficialGasVelocity(); + holdUp = severeSlug.stratifiedHoldUp(fluid, pipe, severeSlug); + driftVel = 0.35 * Math.sqrt(gravAcc * pipe.getInternalDiameter()); // Drift velocity for the + // vertical flows + alfaLeft = 1 - holdUp; + + for (int i = 0; i < severeSlug.numberOfTimeSteps; i++) + + { + slugLength = -z + pipe.getRightLength() * (1 - alfaRiser); // Slug Length + Re = fluid.getLiqDensity() * Math.abs(Um) * pipe.getInternalDiameter() / fluid.getliqVisc(); // Reynolds + // number + lambda = Math.max(0.34 * Math.pow(Re, -0.25), 64 / Re); // friction factor + friction = 0.5 * lambda * fluid.getLiqDensity() * Um * Math.abs(Um) * slugLength + / pipe.getInternalDiameter(); // frictional pressure loss + // Oscillation Friction + frictionStagnant = 0.5 * lambdaStagnant * fluid.getLiqDensity() * uLevel * Math.abs(uLevel) + * slugLength / pipe.getInternalDiameter(); + // Valve Friction + frictionValve = valveConstant * fluid.getLiqDensity() * Um * Math.abs(Um); + // Total Friction + friction = friction + frictionStagnant + frictionValve; + // Gravity + gravL = -fluid.getLiqDensity() * Math.abs(z) * gravAcc * Math.sin((pipe.getAngle("Radian"))); + gravR = mixDensity * gravAcc * pipe.getRightLength(); + gravity = gravL + gravR; + + // Momentum Balance + UmOld = Um; + Um = UmOld + deltaT * ((pressure - severeSlug.outletPressure) - friction - gravity) + / (-z * fluid.getLiqDensity() + pipe.getRightLength() * mixDensity); + + // Slip Relation: Calculate translational velocity + if (Re < 2300) { + flowDistCoeff = 2; + } else { + flowDistCoeff = 1.2; } - else{ - if (slugHoldUp+ * checkFlowRegime. + *
+ * + * @param fluid a + * {@link neqsim.processSimulation.measurementDevice.simpleFlowRegime.FluidSevereSlug} + * object + * @param pipe a {@link neqsim.processSimulation.measurementDevice.simpleFlowRegime.Pipe} object + * @param severeSlug a + * {@link neqsim.processSimulation.measurementDevice.simpleFlowRegime.SevereSlugAnalyser} + * object + * @return a {@link java.lang.String} object + */ + public String checkFlowRegime(FluidSevereSlug fluid, Pipe pipe, SevereSlugAnalyser severeSlug) { + Double[] halfRes = new Double[severeSlug.getNumberOfTimeSteps() / 2]; + severeSlug.runSevereSlug(fluid, pipe, severeSlug); + double sum = 0; + for (int i = severeSlug.numberOfTimeSteps / 2; i < severeSlug.numberOfTimeSteps; i++) { + sum = sum + severeSlug.resPres[i]; + halfRes[i - severeSlug.numberOfTimeSteps / 2] = severeSlug.resPres[i]; + } + double meanValue = sum / ((double) numberOfTimeSteps / 2); + double max = Collections.max(Arrays.asList(halfRes)); + slugValue = (max / meanValue) - 1; + double stratifiedHoldUp = stratifiedHoldUp(fluid, pipe, severeSlug); + logger.debug(stratifiedHoldUp); + + double slugHoldUp = slugHoldUp(pipe, severeSlug); + logger.debug(slugHoldUp); + logger.debug("The severe slug value is " + slugValue); + if (slugValue > 0.1 && slugHoldUp > stratifiedHoldUp) { + flowPattern = "Severe Slug"; + } else if (slugValue > 0.05 && slugHoldUp > stratifiedHoldUp) { + flowPattern = "Severe Slug 2. Small pressure variations"; + } else { + if (slugHoldUp < stratifiedHoldUp) { + flowPattern = "Slug Flow"; + } else { + if (stratifiedHoldUp < 0.1) { + flowPattern = "Liquid droplets flow"; + } + if (stratifiedHoldUp > 0.9) { + flowPattern = "Gas droplets flow"; } - else{ - if(stratifiedHoldUp < 0.1) - { - flowPattern = "Liquid droplets flow"; - } - if(stratifiedHoldUp > 0.9) - { - flowPattern = "Gas droplets flow"; - } - if(stratifiedHoldUp > 0.1 && stratifiedHoldUp < 0.9) { - flowPattern = "Stratified Flow"; - } + if (stratifiedHoldUp > 0.1 && stratifiedHoldUp < 0.9) { + flowPattern = "Stratified Flow"; } } - logger.debug("Simulated flow regime is then: " + flowPattern); - return flowPattern; } + logger.debug("Simulated flow regime is then: " + flowPattern); + return flowPattern; + } - /** - *getMeasuredValue.
- * - * @return a double - */ - public double getMeasuredValue() { - SystemInterface fluid = streamS.getThermoSystem(); - ThermodynamicOperations ops = new ThermodynamicOperations(fluid); - ops.TPflash(); - fluid.initProperties(); - if (fluid.getNumberOfPhases() == 2){ - usl = fluid.getPhase(1).getFlowRate("m3/sec") / pipe.getArea(); - } - else{ - usl = fluid.getPhase(1).getFlowRate("m3/sec") / pipe.getArea() + fluid.getPhase(2).getFlowRate("m3/sec") / pipe.getArea(); - } - fluidSevereS = new FluidSevereSlug(fluid); - usg = fluid.getPhase(0).getFlowRate("m3/sec") / pipe.getArea(); - severeSlug = new SevereSlugAnalyser(usl, usg,outletPressure, temperature, simulationTime, numberOfTimeSteps); - checkFlowRegime(fluidSevereS, pipe, severeSlug); - return slugValue; - } + /** + *+ * getMeasuredValue. + *
+ * + * @return a double + */ + public double getMeasuredValue() { + SystemInterface fluid = streamS.getThermoSystem(); + ThermodynamicOperations ops = new ThermodynamicOperations(fluid); + ops.TPflash(); + fluid.initProperties(); + if (fluid.getNumberOfPhases() == 2) { + usl = fluid.getPhase(1).getFlowRate("m3/sec") / pipe.getArea(); + } else { + usl = fluid.getPhase(1).getFlowRate("m3/sec") / pipe.getArea() + + fluid.getPhase(2).getFlowRate("m3/sec") / pipe.getArea(); + } + fluidSevereS = new FluidSevereSlug(fluid); + usg = fluid.getPhase(0).getFlowRate("m3/sec") / pipe.getArea(); + severeSlug = new SevereSlugAnalyser(usl, usg, outletPressure, temperature, simulationTime, + numberOfTimeSteps); + checkFlowRegime(fluidSevereS, pipe, severeSlug); + return slugValue; + } - /** - *getPredictedFlowRegime.
- * - * @return a {@link java.lang.String} object - */ - public String getPredictedFlowRegime() { - logger.debug(angle); - SystemInterface fluid = streamS.getThermoSystem(); - ThermodynamicOperations ops = new ThermodynamicOperations(fluid); - ops.TPflash(); - fluid.initProperties(); - if (fluid.getNumberOfPhases() == 1){ - flowPattern = "Single Phase"; - } - else if(pipe.getAngle("Radian") <= 0.0){ - flowPattern = "Regime cannot be detected (angle < or = 0.0). Severe slug is not possible"; - } - else{ - if (fluid.getNumberOfPhases() == 2){ + /** + *+ * getPredictedFlowRegime. + *
+ * + * @return a {@link java.lang.String} object + */ + public String getPredictedFlowRegime() { + logger.debug(angle); + SystemInterface fluid = streamS.getThermoSystem(); + ThermodynamicOperations ops = new ThermodynamicOperations(fluid); + ops.TPflash(); + fluid.initProperties(); + if (fluid.getNumberOfPhases() == 1) { + flowPattern = "Single Phase"; + } else if (pipe.getAngle("Radian") <= 0.0) { + flowPattern = "Regime cannot be detected (angle < or = 0.0). Severe slug is not possible"; + } else { + if (fluid.getNumberOfPhases() == 2) { usl = fluid.getPhase(1).getFlowRate("m3/sec") / pipe.getArea(); - } - else{ - usl = fluid.getPhase(1).getFlowRate("m3/sec") / pipe.getArea() + fluid.getPhase(2).getFlowRate("m3/sec") / pipe.getArea(); + } else { + usl = fluid.getPhase(1).getFlowRate("m3/sec") / pipe.getArea() + + fluid.getPhase(2).getFlowRate("m3/sec") / pipe.getArea(); } fluidSevereS = new FluidSevereSlug(fluid); usg = fluid.getPhase(0).getFlowRate("m3/sec") / pipe.getArea(); - severeSlug = new SevereSlugAnalyser(usl, usg,outletPressure, temperature, simulationTime, numberOfTimeSteps); + severeSlug = new SevereSlugAnalyser(usl, usg, outletPressure, temperature, simulationTime, + numberOfTimeSteps); checkFlowRegime(fluidSevereS, pipe, severeSlug); } - return flowPattern; - } + return flowPattern; + } - /** - *getMeasuredValue.
- * - * @param fluid a {@link neqsim.processSimulation.measurementDevice.simpleFlowRegime.FluidSevereSlug} object - * @param pipe a {@link neqsim.processSimulation.measurementDevice.simpleFlowRegime.Pipe} object - * @param severeSlug a {@link neqsim.processSimulation.measurementDevice.simpleFlowRegime.SevereSlugAnalyser} object - * @return a double - */ - public double getMeasuredValue(FluidSevereSlug fluid, Pipe pipe, SevereSlugAnalyser severeSlug) { - checkFlowRegime(fluid, pipe, severeSlug); - return slugValue; - } + /** + *+ * getMeasuredValue. + *
+ * + * @param fluid a + * {@link neqsim.processSimulation.measurementDevice.simpleFlowRegime.FluidSevereSlug} + * object + * @param pipe a {@link neqsim.processSimulation.measurementDevice.simpleFlowRegime.Pipe} object + * @param severeSlug a + * {@link neqsim.processSimulation.measurementDevice.simpleFlowRegime.SevereSlugAnalyser} + * object + * @return a double + */ + public double getMeasuredValue(FluidSevereSlug fluid, Pipe pipe, SevereSlugAnalyser severeSlug) { + checkFlowRegime(fluid, pipe, severeSlug); + return slugValue; + } - /** - *getPredictedFlowRegime.
- * - * @param fluid a {@link neqsim.processSimulation.measurementDevice.simpleFlowRegime.FluidSevereSlug} object - * @param pipe a {@link neqsim.processSimulation.measurementDevice.simpleFlowRegime.Pipe} object - * @param severeSlug a {@link neqsim.processSimulation.measurementDevice.simpleFlowRegime.SevereSlugAnalyser} object - * @return a {@link java.lang.String} object - */ - public String getPredictedFlowRegime(FluidSevereSlug fluid, Pipe pipe, SevereSlugAnalyser severeSlug) { - checkFlowRegime(fluid, pipe, severeSlug); - return flowPattern; - } + /** + *+ * getPredictedFlowRegime. + *
+ * + * @param fluid a + * {@link neqsim.processSimulation.measurementDevice.simpleFlowRegime.FluidSevereSlug} + * object + * @param pipe a {@link neqsim.processSimulation.measurementDevice.simpleFlowRegime.Pipe} object + * @param severeSlug a + * {@link neqsim.processSimulation.measurementDevice.simpleFlowRegime.SevereSlugAnalyser} + * object + * @return a {@link java.lang.String} object + */ + public String getPredictedFlowRegime(FluidSevereSlug fluid, Pipe pipe, + SevereSlugAnalyser severeSlug) { + checkFlowRegime(fluid, pipe, severeSlug); + return flowPattern; + } - /** - *main.
- * - * @param args an array of {@link java.lang.String} objects - */ - public static void main(String args[]){ - neqsim.thermo.system.SystemInterface testSystem = - new neqsim.thermo.system.SystemSrkEos((273.15 + 15.0), 10); - testSystem.addComponent("methane", 0.015, "MSm^3/day"); - testSystem.addComponent("n-heptane", 0.0055, "MSm^3/day"); - testSystem.setMixingRule(2); - testSystem.init(0); - Stream inputStream = new Stream("inputStream", testSystem); - SevereSlugAnalyser mySevereSlug4= new SevereSlugAnalyser (inputStream, 0.05, 167, 7.7, 2,100000.0,20.0, 200.0,20000); - logger.debug(inputStream.getFlowRate("kg/sec")); - mySevereSlug4.getPredictedFlowRegime(); - // inputStream.setFlowRate(0.00001, "MSm^3/day"); - // System.out.println(inputStream.getFlowRate("kg/sec")); - // mySevereSlug4.getPredictedFlowRegime(); - - } + /** + *+ * main. + *
+ * + * @param args an array of {@link java.lang.String} objects + */ + public static void main(String args[]) { + neqsim.thermo.system.SystemInterface testSystem = + new neqsim.thermo.system.SystemSrkEos((273.15 + 15.0), 10); + testSystem.addComponent("methane", 0.015, "MSm^3/day"); + testSystem.addComponent("n-heptane", 0.0055, "MSm^3/day"); + testSystem.setMixingRule(2); + testSystem.init(0); + Stream inputStream = new Stream("inputStream", testSystem); + SevereSlugAnalyser mySevereSlug4 = + new SevereSlugAnalyser(inputStream, 0.05, 167, 7.7, 2, 100000.0, 20.0, 200.0, 20000); + logger.debug(inputStream.getFlowRate("kg/sec")); + mySevereSlug4.getPredictedFlowRegime(); + // inputStream.setFlowRate(0.00001, "MSm^3/day"); + // System.out.println(inputStream.getFlowRate("kg/sec")); + // mySevereSlug4.getPredictedFlowRegime(); + + } -// To be implemented - // public void buildFlowMap(double ugmax, double ulmax, int numberOfStepsMap, FluidSevereSlug fluid, Pipe pipe, SevereSlug severeSlug){ - // String stability1; - // String stability2; - // for (double usl = 0.01; usl < ulmax; usl = usl + ulmax/numberOfStepsMap) { - // severeSlug.setSuperficialLiquidVelocity(usl); - // double usg1 = 0.01; - // double usg2 = ugmax; - // double usg_sol; - // iter = 0; - - - // while(Math.abs(usg1 - usg2) > 1e-5 && iter < 200){ - - // severeSlug.setSuperficialGasVelocity(usg1); - // severeSlug.checkFlowRegime(fluid, pipe, severeSlug); - // function1 = severeSlug.slugValue - 0.05; - - // severeSlug.setSuperficialGasVelocity(usg2); - // checkFlowRegime(fluid, pipe, severeSlug); - // function2 = severeSlug.slugValue - 0.05; - - // usg_sol = usg2 - function2*(usg2 - usg1)/(function2 - function1); - - // if (usg_sol < 0){ - // if (usg2 != 0.01) - // { - // usg2 = 0.01; - // } - // else{ - // usg2 = ugmax/2; - // } - // } - // if (usg_sol > ugmax){ - // if (usg_sol != ugmax-0.01) - // { - // usg2 = ugmax-0.01; - // } - // else{ - // usg2 = 0.02; - // } - // } - - // usg1 = usg2; - // usg2 = usg; - // iter = iter + 1; - // } - - // if (iter == 199){ - // System.out.println("Could not find the border"); - // } - // else{ - - // } - - // severeSlug.setSuperficialLiquidVelocity(usl); - // severeSlug.setSuperficialGasVelocity(0.01); - // String flowPattern1 = severeSlug.checkFlowRegime(fluid, pipe, severeSlug); - // severeSlug.setSuperficialGasVelocity(ugmax); - // String flowPattern2 = severeSlug.checkFlowRegime(fluid, pipe, severeSlug); - // if (flowPattern1 == "Severe Slug" || flowPattern1 == "Severe Slug 2. Small pressure variations"){ - // stability1 = "Not stable"; - // } - // else{ - // stability1 = "Stable"; - // } - // if (flowPattern2 == "Severe Slug" || flowPattern2 == "Severe Slug 2. Small pressure variations"){ - // stability2 = "Not stable"; - // } - // else{ - // stability2 = "Stable"; - // } - // if (flowPattern1 != flowPattern2){ - - // } - - //} - - //} + // To be implemented + // public void buildFlowMap(double ugmax, double ulmax, int numberOfStepsMap, FluidSevereSlug + // fluid, Pipe pipe, SevereSlug severeSlug){ + // String stability1; + // String stability2; + // for (double usl = 0.01; usl < ulmax; usl = usl + ulmax/numberOfStepsMap) { + // severeSlug.setSuperficialLiquidVelocity(usl); + // double usg1 = 0.01; + // double usg2 = ugmax; + // double usg_sol; + // iter = 0; + + + // while(Math.abs(usg1 - usg2) > 1e-5 && iter < 200){ + + // severeSlug.setSuperficialGasVelocity(usg1); + // severeSlug.checkFlowRegime(fluid, pipe, severeSlug); + // function1 = severeSlug.slugValue - 0.05; + + // severeSlug.setSuperficialGasVelocity(usg2); + // checkFlowRegime(fluid, pipe, severeSlug); + // function2 = severeSlug.slugValue - 0.05; + + // usg_sol = usg2 - function2*(usg2 - usg1)/(function2 - function1); + + // if (usg_sol < 0){ + // if (usg2 != 0.01) + // { + // usg2 = 0.01; + // } + // else{ + // usg2 = ugmax/2; + // } + // } + // if (usg_sol > ugmax){ + // if (usg_sol != ugmax-0.01) + // { + // usg2 = ugmax-0.01; + // } + // else{ + // usg2 = 0.02; + // } + // } + + // usg1 = usg2; + // usg2 = usg; + // iter = iter + 1; + // } + + // if (iter == 199){ + // System.out.println("Could not find the border"); + // } + // else{ + + // } + + // severeSlug.setSuperficialLiquidVelocity(usl); + // severeSlug.setSuperficialGasVelocity(0.01); + // String flowPattern1 = severeSlug.checkFlowRegime(fluid, pipe, severeSlug); + // severeSlug.setSuperficialGasVelocity(ugmax); + // String flowPattern2 = severeSlug.checkFlowRegime(fluid, pipe, severeSlug); + // if (flowPattern1 == "Severe Slug" || flowPattern1 == "Severe Slug 2. Small pressure + // variations"){ + // stability1 = "Not stable"; + // } + // else{ + // stability1 = "Stable"; + // } + // if (flowPattern2 == "Severe Slug" || flowPattern2 == "Severe Slug 2. Small pressure + // variations"){ + // stability2 = "Not stable"; + // } + // else{ + // stability2 = "Stable"; + // } + // if (flowPattern1 != flowPattern2){ + + // } + + // } + + // } - } +} diff --git a/src/main/java/neqsim/processSimulation/processEquipment/pump/PumpChart.java b/src/main/java/neqsim/processSimulation/processEquipment/pump/PumpChart.java index 70240e9028..890d2a3a96 100644 --- a/src/main/java/neqsim/processSimulation/processEquipment/pump/PumpChart.java +++ b/src/main/java/neqsim/processSimulation/processEquipment/pump/PumpChart.java @@ -20,346 +20,340 @@ * @version $Id: $Id */ public class PumpChart implements PumpChartInterface, java.io.Serializable { - private static final long serialVersionUID = 1000; - static Logger logger = LogManager.getLogger(PumpChart.class); - ArrayList- * Constructor for PumpChart. - *
- */ - public PumpChart() {} - - /** {@inheritDoc} */ - @Override - public void addCurve(double speed, double[] flow, double[] head, double[] efficiency) { - PumpCurve curve = new PumpCurve(speed, flow, head, efficiency); - chartValues.add(curve); + private static final long serialVersionUID = 1000; + static Logger logger = LogManager.getLogger(PumpChart.class); + ArrayList+ * Constructor for PumpChart. + *
+ */ + public PumpChart() {} + + /** {@inheritDoc} */ + @Override + public void addCurve(double speed, double[] flow, double[] head, double[] efficiency) { + PumpCurve curve = new PumpCurve(speed, flow, head, efficiency); + chartValues.add(curve); + } + + /** {@inheritDoc} */ + @Override + public void setCurves(double[] chartConditions, double[] speed, double[][] flow, double[][] head, + double[][] efficiency) { + this.speed = speed; + this.head = head; + this.efficiency = efficiency; + this.flow = flow; + + this.redhead = new double[head.length][head[0].length]; + this.redEfficiency = new double[efficiency.length][efficiency[0].length]; + this.redflow = new double[flow.length][flow[0].length]; + + for (int i = 0; i < speed.length; i++) { + if (speed[i] > maxSpeedCurve) { + maxSpeedCurve = speed[i]; + } + if (speed[i] < minSpeedCurve) { + minSpeedCurve = speed[i]; + } + PumpCurve curve = new PumpCurve(speed[i], flow[i], head[i], efficiency[i]); + chartValues.add(curve); + for (int j = 0; j < flow[i].length; j++) { + redflow[i][j] = flow[i][j] / speed[i]; + redEfficiency[i][j] = efficiency[i][j]; + redhead[i][j] = head[i][j] / speed[i] / speed[i]; + reducedHeadFitter.add(redflow[i][j], redhead[i][j]); + reducedEfficiencyFitter.add(redflow[i][j], redEfficiency[i][j]); + // todo: MLLU: not correct. speed[0] should be the requested speed + double flowFanLaw = flow[i][j] * speed[i] / speed[0]; + fanLawCorrectionFitter.add(speed[i] / speed[0], flow[i][j] / flowFanLaw); + } } - /** {@inheritDoc} */ - @Override - public void setCurves(double[] chartConditions, double[] speed, double[][] flow, - double[][] head, double[][] efficiency) { - this.speed = speed; - this.head = head; - this.efficiency = efficiency; - this.flow = flow; - - this.redhead = new double[head.length][head[0].length]; - this.redEfficiency = new double[efficiency.length][efficiency[0].length]; - this.redflow = new double[flow.length][flow[0].length]; - - for (int i = 0; i < speed.length; i++) { - if (speed[i] > maxSpeedCurve) - maxSpeedCurve = speed[i]; - if (speed[i] < minSpeedCurve) - minSpeedCurve = speed[i]; - PumpCurve curve = new PumpCurve(speed[i], flow[i], head[i], efficiency[i]); - chartValues.add(curve); - for (int j = 0; j < flow[i].length; j++) { - redflow[i][j] = flow[i][j] / speed[i]; - redEfficiency[i][j] = efficiency[i][j]; - redhead[i][j] = head[i][j] / speed[i] / speed[i]; - reducedHeadFitter.add(redflow[i][j], redhead[i][j]); - reducedEfficiencyFitter.add(redflow[i][j], redEfficiency[i][j]); - double flowFanLaw = flow[i][j] * speed[i] / speed[0]; // MLLU: not correct. speed[0] - // should be the - // requested speed - fanLawCorrectionFitter.add(speed[i] / speed[0], flow[i][j] / flowFanLaw); - } - } - - referenceSpeed = (maxSpeedCurve + minSpeedCurve) / 2.0; - - PolynomialCurveFitter fitter = PolynomialCurveFitter.create(2); - - reducedHeadFitterFunc = new PolynomialFunction(fitter.fit(reducedHeadFitter.toList())); - reducedEfficiencyFunc = - new PolynomialFunction(fitter.fit(reducedEfficiencyFitter.toList())); - fanLawCorrectionFunc = new PolynomialFunction(fitter.fit(fanLawCorrectionFitter.toList())); - setUsePumpChart(true); - } - - /** - *- * fitReducedCurve. - *
- */ - public void fitReducedCurve() {} - - /** {@inheritDoc} */ - @Override - public double getHead(double flow, double speed) { - return reducedHeadFitterFunc.value(flow / speed) * speed * speed; - } - - /** {@inheritDoc} */ - @Override - public double getEfficiency(double flow, double speed) { - return reducedEfficiencyFunc.value(flow / speed); - } - - /** {@inheritDoc} */ - @Override - public int getSpeed(double flow, double head) { - int iter = 1; - double error = 1.0, derrordspeed = 1.0; - double newspeed = referenceSpeed; - double newhead = 0.0; - double oldspeed = newspeed + 1.0; - double oldhead = getHead(flow, oldspeed); - double olderror = oldhead - head; - do { - iter++; - newhead = getHead(flow, newspeed); - error = newhead - head; - derrordspeed = (error - olderror) / (newspeed - oldspeed); - newspeed -= error / derrordspeed; - // System.out.println("speed " + newspeed); - } while (Math.abs(error) > 1e-6 && iter < 100); - - // change speed to minimize - // Math.abs(head - reducedHeadFitterFunc.value(flow / speed) * speed * speed); - return (int) Math.round(newspeed); - } - - /** - *- * efficiency. - *
- * - * @param flow a double - * @param speed a double - * @return a double - */ - public double efficiency(double flow, double speed) { - return 100.0; - } - - /** - *- * checkSurge1. - *
- * - * @param flow a double - * @param head a double - * @return a boolean - */ - public boolean checkSurge1(double flow, double head) { - return false; - } - - /** - *- * checkSurge2. - *
- * - * @param flow a double - * @param speed a double - * @return a boolean - */ - public boolean checkSurge2(double flow, double speed) { - return false; - } - - /** - *- * checkStoneWall. - *
- * - * @param flow a double - * @param speed a double - * @return a boolean - */ - public boolean checkStoneWall(double flow, double speed) { - return false; - } - - /** {@inheritDoc} */ - @Override - public void setReferenceConditions(double refMW, double refTemperature, double refPressure, - double refZ) { - this.refMW = refMW; - this.refTemperature = refTemperature; - this.refPressure = refPressure; - this.refZ = refZ; - } - - /** - *- * main. - *
- * - * @param args an array of {@link java.lang.String} objects - */ - public static void main(String[] args) { - SystemInterface testFluid = new SystemSrkEos(298.15, 50.0); - testFluid.addComponent("water", 1.0); - testFluid.setTemperature(20.0, "C"); - testFluid.setPressure(1.0, "bara"); - testFluid.setTotalFlowRate(1000.0, "kg/hr"); - - Stream stream_1 = new Stream("Stream1", testFluid); - - Pump pump1 = new Pump("pump1", stream_1); - pump1.setOutletPressure(100.0); - // comp1.getAntiSurge().setActive(true); - pump1.setSpeed(12918); - - double[] chartConditions = new double[] {0.3, 1.0, 1.0, 1.0}; - // double[] speed = new double[] { 1000.0, 2000.0, 3000.0, 4000.0 }; - // double[][] flow = new double[][] { { 453.2, 600.0, 750.0, 800.0 }, { 453.2, - // 600.0, 750.0, 800.0 - // }, { 453.2, 600.0, 750.0, 800.0 }, { 453.2, 600.0, 750.0, 800.0 } }; - // double[][] head = new double[][] { { 10000.0, 9000.0, 8000.0, 7500.0 }, { - // 10000.0, 9000.0, 8000.0, 7500.0 }, { 10000.0, 9000.0, 8000.0, 7500.0 }, { - // 10000.0, 9000.0, 8000.0, 7500.0 } }; - // double[][] polyEff = new double[][] { { - // 90.0, 91.0, 89.0, 88.0 }, { 90.0, 91.0, 89.0, 88.0 }, { 90.0, 91.0, 89.0, - // 88.1 }, { 90.0, 91.0, 89.0, 88.1 } }; - - 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}}; - 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[][] efficiency = 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}}; - - pump1.getPumpChart().setCurves(chartConditions, speed, flow, head, efficiency); - pump1.getPumpChart().setHeadUnit("kJ/kg"); - - neqsim.processSimulation.processSystem.ProcessSystem operations = - new neqsim.processSimulation.processSystem.ProcessSystem(); - operations.add(stream_1); - operations.add(pump1); - operations.run(); - - System.out.println("pump power " + pump1.getPower()); - } - - /** {@inheritDoc} */ - @Override - public boolean isUsePumpChart() { - return usePumpChart; - } - - /** {@inheritDoc} */ - @Override - public void setUsePumpChart(boolean usePumpChart) { - this.usePumpChart = usePumpChart; - } - - /** {@inheritDoc} */ - @Override - public String getHeadUnit() { - return headUnit; - } - - /** {@inheritDoc} */ - @Override - public void setHeadUnit(String headUnit) { - this.headUnit = headUnit; - } - - /** {@inheritDoc} */ - @Override - public boolean useRealKappa() { - return useRealKappa; - } - - /** {@inheritDoc} */ - @Override - public void setUseRealKappa(boolean useRealKappa) { - this.useRealKappa = useRealKappa; - } - - /** {@inheritDoc} */ - @Override - public void plot() { - neqsim.dataPresentation.JFreeChart.graph2b graph = - new neqsim.dataPresentation.JFreeChart.graph2b(flow, head, - Arrays.stream(speed).mapToObj(String::valueOf).toArray(String[]::new), - "head vs flow", "flow", "head"); - graph.setVisible(true); - neqsim.dataPresentation.JFreeChart.graph2b graph2 = - new neqsim.dataPresentation.JFreeChart.graph2b(flow, efficiency, - Arrays.stream(speed).mapToObj(String::valueOf).toArray(String[]::new), - "eff vs flow", "flow", "eff"); - graph2.setVisible(true); - neqsim.dataPresentation.JFreeChart.graph2b graph3 = - new neqsim.dataPresentation.JFreeChart.graph2b(redflow, redhead, - Arrays.stream(speed).mapToObj(String::valueOf).toArray(String[]::new), - "red head vs red flow", "red flow", "red head"); - graph3.setVisible(true); - neqsim.dataPresentation.JFreeChart.graph2b graph4 = - new neqsim.dataPresentation.JFreeChart.graph2b(redflow, efficiency, - Arrays.stream(speed).mapToObj(String::valueOf).toArray(String[]::new), - "red eff vs red dflow", "red flow", "red eff"); - graph4.setVisible(true); - } + referenceSpeed = (maxSpeedCurve + minSpeedCurve) / 2.0; + + PolynomialCurveFitter fitter = PolynomialCurveFitter.create(2); + + reducedHeadFitterFunc = new PolynomialFunction(fitter.fit(reducedHeadFitter.toList())); + reducedEfficiencyFunc = new PolynomialFunction(fitter.fit(reducedEfficiencyFitter.toList())); + fanLawCorrectionFunc = new PolynomialFunction(fitter.fit(fanLawCorrectionFitter.toList())); + setUsePumpChart(true); + } + + /** + *+ * fitReducedCurve. + *
+ */ + public void fitReducedCurve() {} + + /** {@inheritDoc} */ + @Override + public double getHead(double flow, double speed) { + return reducedHeadFitterFunc.value(flow / speed) * speed * speed; + } + + /** {@inheritDoc} */ + @Override + public double getEfficiency(double flow, double speed) { + return reducedEfficiencyFunc.value(flow / speed); + } + + /** {@inheritDoc} */ + @Override + public int getSpeed(double flow, double head) { + int iter = 1; + double error = 1.0; + double derrordspeed = 1.0; + double newspeed = referenceSpeed; + double newhead = 0.0; + double oldspeed = newspeed + 1.0; + double oldhead = getHead(flow, oldspeed); + double olderror = oldhead - head; + do { + iter++; + newhead = getHead(flow, newspeed); + error = newhead - head; + derrordspeed = (error - olderror) / (newspeed - oldspeed); + newspeed -= error / derrordspeed; + // System.out.println("speed " + newspeed); + } while (Math.abs(error) > 1e-6 && iter < 100); + + // change speed to minimize + // Math.abs(head - reducedHeadFitterFunc.value(flow / speed) * speed * speed); + return (int) Math.round(newspeed); + } + + /** + *+ * efficiency. + *
+ * + * @param flow a double + * @param speed a double + * @return a double + */ + public double efficiency(double flow, double speed) { + return 100.0; + } + + /** + *+ * checkSurge1. + *
+ * + * @param flow a double + * @param head a double + * @return a boolean + */ + public boolean checkSurge1(double flow, double head) { + return false; + } + + /** + *+ * checkSurge2. + *
+ * + * @param flow a double + * @param speed a double + * @return a boolean + */ + public boolean checkSurge2(double flow, double speed) { + return false; + } + + /** + *+ * checkStoneWall. + *
+ * + * @param flow a double + * @param speed a double + * @return a boolean + */ + public boolean checkStoneWall(double flow, double speed) { + return false; + } + + /** {@inheritDoc} */ + @Override + public void setReferenceConditions(double refMW, double refTemperature, double refPressure, + double refZ) { + this.refMW = refMW; + this.refTemperature = refTemperature; + this.refPressure = refPressure; + this.refZ = refZ; + } + + /** + *+ * main. + *
+ * + * @param args an array of {@link java.lang.String} objects + */ + public static void main(String[] args) { + SystemInterface testFluid = new SystemSrkEos(298.15, 50.0); + testFluid.addComponent("water", 1.0); + testFluid.setTemperature(20.0, "C"); + testFluid.setPressure(1.0, "bara"); + testFluid.setTotalFlowRate(1000.0, "kg/hr"); + + Stream stream_1 = new Stream("Stream1", testFluid); + + Pump pump1 = new Pump("pump1", stream_1); + pump1.setOutletPressure(100.0); + // comp1.getAntiSurge().setActive(true); + pump1.setSpeed(12918); + + double[] chartConditions = new double[] {0.3, 1.0, 1.0, 1.0}; + // double[] speed = new double[] { 1000.0, 2000.0, 3000.0, 4000.0 }; + // double[][] flow = new double[][] { { 453.2, 600.0, 750.0, 800.0 }, { 453.2, + // 600.0, 750.0, 800.0 + // }, { 453.2, 600.0, 750.0, 800.0 }, { 453.2, 600.0, 750.0, 800.0 } }; + // double[][] head = new double[][] { { 10000.0, 9000.0, 8000.0, 7500.0 }, { + // 10000.0, 9000.0, 8000.0, 7500.0 }, { 10000.0, 9000.0, 8000.0, 7500.0 }, { + // 10000.0, 9000.0, 8000.0, 7500.0 } }; + // double[][] polyEff = new double[][] { { + // 90.0, 91.0, 89.0, 88.0 }, { 90.0, 91.0, 89.0, 88.0 }, { 90.0, 91.0, 89.0, + // 88.1 }, { 90.0, 91.0, 89.0, 88.1 } }; + + 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}}; + 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[][] efficiency = 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}}; + + pump1.getPumpChart().setCurves(chartConditions, speed, flow, head, efficiency); + pump1.getPumpChart().setHeadUnit("kJ/kg"); + + neqsim.processSimulation.processSystem.ProcessSystem operations = + new neqsim.processSimulation.processSystem.ProcessSystem(); + operations.add(stream_1); + operations.add(pump1); + operations.run(); + + System.out.println("pump power " + pump1.getPower()); + } + + /** {@inheritDoc} */ + @Override + public boolean isUsePumpChart() { + return usePumpChart; + } + + /** {@inheritDoc} */ + @Override + public void setUsePumpChart(boolean usePumpChart) { + this.usePumpChart = usePumpChart; + } + + /** {@inheritDoc} */ + @Override + public String getHeadUnit() { + return headUnit; + } + + /** {@inheritDoc} */ + @Override + public void setHeadUnit(String headUnit) { + this.headUnit = headUnit; + } + + /** {@inheritDoc} */ + @Override + public boolean useRealKappa() { + return useRealKappa; + } + + /** {@inheritDoc} */ + @Override + public void setUseRealKappa(boolean useRealKappa) { + this.useRealKappa = useRealKappa; + } + + /** {@inheritDoc} */ + @Override + public void plot() { + neqsim.dataPresentation.JFreeChart.graph2b graph = + new neqsim.dataPresentation.JFreeChart.graph2b(flow, head, + Arrays.stream(speed).mapToObj(String::valueOf).toArray(String[]::new), "head vs flow", + "flow", "head"); + graph.setVisible(true); + neqsim.dataPresentation.JFreeChart.graph2b graph2 = + new neqsim.dataPresentation.JFreeChart.graph2b(flow, efficiency, + Arrays.stream(speed).mapToObj(String::valueOf).toArray(String[]::new), "eff vs flow", + "flow", "eff"); + graph2.setVisible(true); + neqsim.dataPresentation.JFreeChart.graph2b graph3 = + new neqsim.dataPresentation.JFreeChart.graph2b(redflow, redhead, + Arrays.stream(speed).mapToObj(String::valueOf).toArray(String[]::new), + "red head vs red flow", "red flow", "red head"); + graph3.setVisible(true); + neqsim.dataPresentation.JFreeChart.graph2b graph4 = + new neqsim.dataPresentation.JFreeChart.graph2b(redflow, efficiency, + Arrays.stream(speed).mapToObj(String::valueOf).toArray(String[]::new), + "red eff vs red dflow", "red flow", "red eff"); + graph4.setVisible(true); + } } diff --git a/src/main/java/neqsim/thermo/system/SystemInterface.java b/src/main/java/neqsim/thermo/system/SystemInterface.java index 19f07b59b0..3893a7613d 100644 --- a/src/main/java/neqsim/thermo/system/SystemInterface.java +++ b/src/main/java/neqsim/thermo/system/SystemInterface.java @@ -2530,7 +2530,7 @@ public void addCharacterized(String[] charNames, double[] charFlowrate, double[] double[] relativedensity); /** - * Get normal liquid density of fluid. + * Get ideal liquid density of fluid in given unit. * * @param unit {@link java.lang.String} Supported units are kg/m3 and gr/cm3 * @return a double diff --git a/src/main/java/neqsim/thermo/system/SystemThermo.java b/src/main/java/neqsim/thermo/system/SystemThermo.java index a86c71e1ee..48d7570907 100644 --- a/src/main/java/neqsim/thermo/system/SystemThermo.java +++ b/src/main/java/neqsim/thermo/system/SystemThermo.java @@ -66,8 +66,7 @@ abstract class SystemThermo implements SystemInterface { protected double criticalPressure = 0; private double totalNumberOfMoles = 0; public String componentNameTag = ""; - protected neqsim.thermo.characterization.WaxCharacterise waxCharacterisation = null; // new - // WaxCharacterise(this); + protected neqsim.thermo.characterization.WaxCharacterise waxCharacterisation = null; protected double[] beta = new double[6]; protected int a; @@ -3091,7 +3090,9 @@ public double getMass(String unit) { /** * {@inheritDoc} * + ** need to call initPhysicalProperties() before this method is called + *
*/ @Override public double getCorrectedVolume() { @@ -5094,8 +5095,10 @@ public SystemProperties getProperties() { /** - * @param molefractions - * @param type + * Wrapper function for addComponent to set fluid type and specify mole fractions. + * + * @param molefractions Component mole fraction of each component. + * @param type Type of fluid. Supports "PlusFluid", "Plus" and default. */ private void setMolarFractions(double[] molefractions, String type) { double totalFlow = getTotalNumberOfMoles(); @@ -5226,11 +5229,7 @@ public void addOilFractions(String[] charNames, double[] charFlowrate, double[] } - /** - * {@inheritDoc} - * - * Return normal liquid density of fluid in given unit. - */ + /** {@inheritDoc} */ public double getIdealLiquidDensity(String unit) { double normalLiquidDensity = 0.0; double molarMass = getMolarMass();