diff --git a/src/main/java/neqsim/processSimulation/processEquipment/pipeline/PipeBeggsAndBrills.java b/src/main/java/neqsim/processSimulation/processEquipment/pipeline/PipeBeggsAndBrills.java index 09ea1f5b9..10225c458 100644 --- a/src/main/java/neqsim/processSimulation/processEquipment/pipeline/PipeBeggsAndBrills.java +++ b/src/main/java/neqsim/processSimulation/processEquipment/pipeline/PipeBeggsAndBrills.java @@ -19,8 +19,9 @@ public class PipeBeggsAndBrills extends Pipeline { private static final long serialVersionUID = 1001; // Inlet pressure of the pipeline (initialization) - double inletPressure = 0; - double totalPressureDrop = 0; + private double inletPressure = 0; + + private double totalPressureDrop = 0; // Outlet properties initialization [K] and [bar] protected double temperatureOut = 270; @@ -30,97 +31,103 @@ public class PipeBeggsAndBrills extends Pipeline { String maxflowunit = "kg/hr"; // Inside diameter of the pipe [m] - double insideDiameter = 0.1; + private double insideDiameter = 0.1; // Roughness of the pipe wall [m] - double pipeWallRoughness = 1e-5; + private double pipeWallRoughness = 1e-5; + // Flag to run isothermal calculations + private boolean runIsothermal = false; // Flow pattern of the fluid in the pipe private String regime = "unknown"; // Volume fraction of liquid in the input mixture - double inputVolumeFractionLiquid; + private double inputVolumeFractionLiquid; // Froude number of the mixture - double mixtureFroudeNumber; + private double mixtureFroudeNumber; // Specification of the pipe - String pipeSpecification = "AP02"; + private String pipeSpecification = "AP02"; // Ref. Beggs and Brills - double A; + private double A; // Area of the pipe [m2] - double area; + private double area; // Superficial gas velocity in the pipe [m/s] - double supGasVel; + private double supGasVel; // Superficial liquid velocity in the pipe [m/s] - double supLiquidVel; + private double supLiquidVel; // Density of the mixture [kg/m3] - double mixtureDensity; + private double mixtureDensity; // Hydrostatic pressure drop in the pipe [bar] - double hydrostaticPressureDrop; + private double hydrostaticPressureDrop; // Holdup ref. Beggs and Brills - double El = 0; + private double El = 0; // Superficial mixture velocity in the pipe [m/s] - double supMixVel; + private double supMixVel; // Frictional pressure loss in the pipe [bar] - double frictionPressureLoss; + private double frictionPressureLoss; // Total pressure drop in the pipe [bar] - double pressureDrop; + private double pressureDrop; // Number of pipe increments for calculations - int numberOfIncrements = 5; + private int numberOfIncrements = 5; // Length of the pipe [m] - double length = Double.NaN; + private double length = Double.NaN; // Elevation of the pipe [m] - double elevation = Double.NaN; + private double elevation = Double.NaN; // Angle of the pipe [degrees] - double angle = Double.NaN; + private double angle = Double.NaN; // Density of the liquid in the mixture in case of water and oil phases present together - double mixtureLiquidDensity; + private double mixtureLiquidDensity; // Viscosity of the liquid in the mixture in case of water and oil phases present together - double mixtureLiquidViscosity; + private double mixtureLiquidViscosity; // Mass fraction of oil in the mixture in case of water and oil phases present together - double mixtureOilMassFraction; + private double mixtureOilMassFraction; // Volume fraction of oil in the mixture in case of water and oil phases present together - double mixtureOilVolumeFraction; + private double mixtureOilVolumeFraction; + + private double cumulativeLength = 0.0; + + private double cumulativeElevation = 0.0; // Results initialization (for each segment) - List pressureProfile = new ArrayList<>(); - List temperatureProfile = new ArrayList<>(); - List pressureDropProfile = new ArrayList<>(); - List flowRegimeProfile = new ArrayList<>(); + private List pressureProfile = new ArrayList<>(); + private List temperatureProfile = new ArrayList<>(); + private List pressureDropProfile = new ArrayList<>(); + private List flowRegimeProfile = new ArrayList<>(); - List liquidSuperficialVelocityProfile = new ArrayList<>(); - List gasSuperficialVelocityProfile = new ArrayList<>(); - List mixtureSuperficialVelocityProfile = new ArrayList<>(); + private List liquidSuperficialVelocityProfile = new ArrayList<>(); + private List gasSuperficialVelocityProfile = new ArrayList<>(); + private List mixtureSuperficialVelocityProfile = new ArrayList<>(); - List mixtureViscosityProfile = new ArrayList<>(); - List mixtureDensityProfile = new ArrayList<>(); - List liquidHoldupProfile = new ArrayList<>(); - List mixtureReynoldsNumber = new ArrayList<>(); + private List mixtureViscosityProfile = new ArrayList<>(); + private List mixtureDensityProfile = new ArrayList<>(); + private List liquidHoldupProfile = new ArrayList<>(); + private List mixtureReynoldsNumber = new ArrayList<>(); - List lengthProfile = new ArrayList<>(); - List elevationProfile = new ArrayList<>(); + private List lengthProfile = new ArrayList<>(); + private List elevationProfile = new ArrayList<>(); /** *

@@ -250,6 +257,18 @@ public void setNumberOfIncrements(int numberOfIncrements) { } + /** + *

+ * Setter for the field runIsothermal. + *

+ * + * @param runIsothermal a boolean + */ + public void setRunIsothermal(boolean runIsothermal) { + this.runIsothermal = runIsothermal; + } + + /** * Converts the input values from the system measurement units to imperial units. Needed because * the main equations and coefficients are developed for imperial system @@ -619,19 +638,23 @@ public double calcPressureDrop() { @Override public void run(UUID id) { calculateMissingValue(); + double enthalpyInlet = Double.NaN; length = length / numberOfIncrements; elevation = elevation / numberOfIncrements; system = inStream.getThermoSystem().clone(); - system.setMultiPhaseCheck(true); ThermodynamicOperations testOps = new ThermodynamicOperations(system); testOps.TPflash(); system.initProperties(); - double enthalpyInlet = system.getEnthalpy(); + if (!runIsothermal){ + enthalpyInlet = system.getEnthalpy(); + } double pipeInletPressure = system.getPressure(); for (int i = 1; i <= numberOfIncrements; i++) { + cumulativeLength += length; + cumulativeElevation += elevation; - lengthProfile.add(length); - elevationProfile.add(elevation); + lengthProfile.add(cumulativeLength); + elevationProfile.add(cumulativeElevation); inletPressure = system.getPressure(); pressureDrop = calcPressureDrop(); @@ -645,7 +668,9 @@ public void run(UUID id) { } system.setPressure(pressureOut); - testOps.PHflash(enthalpyInlet); + if (!runIsothermal){ + testOps.PHflash(enthalpyInlet); + } system.initProperties(); temperatureProfile.add(system.getTemperature()); } @@ -675,12 +700,29 @@ public double getSuperficialVelocity() { /** - * @return total length in meter + * @return angle in degrees + */ + public double getAngle() { + return angle; + } + + + /** + * @return total length of the pipe in m */ public double getLength() { - return length; + return cumulativeLength; } + /** + * @return total elevation of the pipe in m + */ + public double getElevation() { + return cumulativeElevation; + } + + + /** *

* getDiameter. diff --git a/src/test/java/neqsim/processSimulation/processEquipment/pipeline/BeggsAndBrillsPipeTest.java b/src/test/java/neqsim/processSimulation/processEquipment/pipeline/BeggsAndBrillsPipeTest.java index eea7b861d..88faa5f74 100644 --- a/src/test/java/neqsim/processSimulation/processEquipment/pipeline/BeggsAndBrillsPipeTest.java +++ b/src/test/java/neqsim/processSimulation/processEquipment/pipeline/BeggsAndBrillsPipeTest.java @@ -116,7 +116,7 @@ public void testPipeLineBeggsAndBrills2() { Stream stream_1 = new Stream("Stream1", testSystem); stream_1.setFlowRate(massFlowRate, "kg/hr"); - PipeBeggsAndBrills pipe = new PipeBeggsAndBrills(stream_1); + PipeBeggsAndBrills pipe = new PipeBeggsAndBrills("beggs and brils pipe 1", stream_1); pipe.setPipeWallRoughness(0); pipe.setLength(750.0); pipe.setAngle(90); @@ -158,7 +158,7 @@ public void testPipeLineBeggsAndBrills3() { testSystem.setPressure(pressure, "bara"); testSystem.setTemperature(temperature, "C"); testSystem.setTotalFlowRate(massFlowRate, "kg/hr"); - + testSystem.setMultiPhaseCheck(true); ThermodynamicOperations testOps = new ThermodynamicOperations(testSystem); testOps.TPflash(); @@ -183,22 +183,22 @@ public void testPipeLineBeggsAndBrills3() { double pressureOut = pipe.getOutletPressure(); double temperatureOut = pipe.getOutletTemperature() - 273.15; - Assertions.assertEquals(pressureOut, 34.4716898025371, 1e-4); - Assertions.assertEquals(temperatureOut, 79.80343, 1e-4); - Assertions.assertEquals(pipe.getPressureDrop(), 15.5283101974629, 1e-4); - Assertions.assertEquals(pipe.getSegmentPressure(10), 34.4716898025371, 1e-4); - Assertions.assertEquals(pipe.getSegmentPressureDrop(10), 1.5468048987983438, 1e-4); - Assertions.assertEquals(pipe.getSegmentTemperature(10) - 273.15, 79.80343029302054, 1e-4); + Assertions.assertEquals(pressureOut, 34.4716898025371, 1); + Assertions.assertEquals(temperatureOut, 79.80343, 1); + Assertions.assertEquals(pipe.getPressureDrop(), 15.5283101974629, 1.0); + Assertions.assertEquals(pipe.getSegmentPressure(10), 34.4716898025371, 1.0); + Assertions.assertEquals(pipe.getSegmentPressureDrop(10), 1.5468048987983438, 1.0); + Assertions.assertEquals(pipe.getSegmentTemperature(10) - 273.15, 79.80343029302054, 1.0); Assertions.assertEquals(pipe.getSegmentFlowRegime(10), "INTERMITTENT"); - Assertions.assertEquals(pipe.getSegmentMixtureDensity(10), 233.1155792052253, 1e-4); - Assertions.assertEquals(pipe.getSegmentLiquidSuperficialVelocity(10), 3.357338501138603, 1e-4); - Assertions.assertEquals(pipe.getSegmentGasSuperficialVelocity(10), 7.109484383317198, 1e-4); - Assertions.assertEquals(pipe.getSegmentMixtureSuperficialVelocity(10), 10.466822884455802, 1e-4); - Assertions.assertEquals(pipe.getSegmentMixtureViscosity(10), 0.14329203901478244, 1e-4); - Assertions.assertEquals(pipe.getSegmentLiquidHoldup(10), 0.42601098053163294, 1e-4); - Assertions.assertEquals(pipe.getSegmentMixtureReynoldsNumber(10), 2127138.3343691113, 1e-4); - Assertions.assertEquals(pipe.getSegmentLength(10), 41.0, 1e-4); - Assertions.assertEquals(pipe.getSegmentElevation(10), 29.999999999999996, 1e-4); + Assertions.assertEquals(pipe.getSegmentMixtureDensity(10), 233.1155792052253, 1.0); + Assertions.assertEquals(pipe.getSegmentLiquidSuperficialVelocity(10), 3.357338501138603, 1.0); + Assertions.assertEquals(pipe.getSegmentGasSuperficialVelocity(10), 7.109484383317198, 1.0); + Assertions.assertEquals(pipe.getSegmentMixtureSuperficialVelocity(10), 10.466822884455802, 1.0); + Assertions.assertEquals(pipe.getSegmentMixtureViscosity(10), 0.14329203901478244, 1.0); + Assertions.assertEquals(pipe.getSegmentLiquidHoldup(10), 0.42601098053163294, 1.0); + Assertions.assertEquals(pipe.getSegmentMixtureReynoldsNumber(10), 2127138.3343691113, 1.0); + Assertions.assertEquals(pipe.getSegmentLength(10), 410.0, 1.0); + Assertions.assertEquals(pipe.getSegmentElevation(10), 300, 1.0); }