Class PipeBeggsAndBrills
- All Implemented Interfaces:
Serializable, Runnable, PipeLineInterface, ProcessEquipmentInterface, TwoPortInterface, SimulationInterface, NamedInterface
This class implements the Beggs and Brill (1973) correlation for pressure drop and liquid holdup prediction in multiphase pipeline flow. It supports both single-phase and multiphase (gas-liquid) flow in horizontal, inclined, and vertical pipes.
Reference
Beggs, H.D. and Brill, J.P., "A Study of Two-Phase Flow in Inclined Pipes", Journal of Petroleum Technology, May 1973, pp. 607-617. SPE-4007-PA.
Calculation Modes
The pipeline supports two primary calculation modes via PipeBeggsAndBrills.CalculationMode:
- CALCULATE_OUTLET_PRESSURE (default) - Given inlet conditions and flow rate, calculate the outlet pressure
- CALCULATE_FLOW_RATE - Given inlet and outlet pressures, calculate the flow rate using iterative methods
Flow Regime Determination
The Beggs and Brill correlation classifies flow into four regimes based on the Froude number (Fr) and input liquid volume fraction (λL):
- SEGREGATED - Stratified, wavy, or annular flow where phases are separated
- INTERMITTENT - Plug or slug flow with alternating liquid slugs and gas pockets
- DISTRIBUTED - Bubble or mist flow where one phase is dispersed in the other
- TRANSITION - Flow in transition zone between segregated and intermittent
- SINGLE_PHASE - Only gas or only liquid present
Flow regime boundaries are defined by correlations L1-L4:
L1 = 316 × λL^0.302 L2 = 0.0009252 × λL^(-2.4684) L3 = 0.1 × λL^(-1.4516) L4 = 0.5 × λL^(-6.738)
Pressure Drop Calculation
Total pressure drop consists of three components:
ΔP_total = ΔP_friction + ΔP_hydrostatic + ΔP_acceleration
where:
- Friction pressure drop - Uses two-phase friction factor with slip correction
- Hydrostatic pressure drop - Based on mixture density and elevation change
- Acceleration pressure drop - Usually negligible, included in friction term
Liquid Holdup Calculation
Liquid holdup (EL) is calculated based on flow regime:
- Segregated: EL = 0.98 × λL^0.4846 / Fr^0.0868
- Intermittent: EL = 0.845 × λL^0.5351 / Fr^0.0173
- Distributed: EL = 1.065 × λL^0.5824 / Fr^0.0609
Inclination correction factor (Bθ) is applied for non-horizontal pipes.
Friction Factor Calculation
The friction factor is calculated using:
- Laminar (Re < 2300): f = 64/Re
- Transition (2300-4000): Linear interpolation
- Turbulent (Re > 4000): Haaland equation
Two-phase friction factor: f_tp = f × exp(S), where S is a slip correction factor.
Heat Transfer Modes
The pipeline supports five heat transfer calculation modes via PipeBeggsAndBrills.HeatTransferMode:
- ADIABATIC - No heat transfer (Q=0). Temperature changes only from Joule-Thomson effect.
- ISOTHERMAL - Constant temperature along the pipe (outlet T = inlet T).
- SPECIFIED_U - Use a user-specified overall heat transfer coefficient (U-value).
- ESTIMATED_INNER_H - Calculate inner h from flow conditions using Gnielinski correlation for turbulent flow, use as U.
- DETAILED_U - Calculate inner h from flow, then compute overall U including pipe wall conduction, insulation (if present), and outer convection resistances.
NTU-Effectiveness Method
Heat transfer is calculated using the analytical NTU (Number of Transfer Units) method:
NTU = U × A / (ṁ × Cp) T_out = T_wall + (T_in - T_wall) × exp(-NTU)
This provides an exact analytical solution for constant wall temperature boundary conditions.
Inner Heat Transfer Coefficient
For ESTIMATED_INNER_H and DETAILED_U modes, the inner convective heat transfer coefficient is calculated using:
- Laminar flow (Re < 2300): Nu = 3.66 (fully developed pipe flow)
- Transition (2300 < Re < 3000): Linear interpolation
- Turbulent flow (Re > 3000): Gnielinski correlation: Nu = (f/8)(Re-1000)Pr / [1 + 12.7(f/8)^0.5(Pr^(2/3)-1)]
- Two-phase flow: Shah/Martinelli enhancement factor applied
Overall U-Value (DETAILED_U mode)
The overall heat transfer coefficient includes thermal resistances in series:
1/U = 1/h_inner + R_wall + R_insulation + 1/h_outer R_wall = r_i × ln(r_o/r_i) / k_wall R_insulation = r_i × ln(r_ins/r_o) / k_ins
where:
- h_inner = inner convective coefficient from flow calculation
- R_wall = pipe wall conductive resistance (cylindrical geometry)
- R_insulation = insulation layer resistance (if thickness > 0)
- h_outer = outer convective coefficient (e.g., seawater ~500 W/(m²·K))
Energy Equation Components
The energy balance can include three optional components:
- Wall heat transfer - Heat exchange with surroundings using NTU-effectiveness method
- Joule-Thomson effect - Temperature change due to gas expansion (cooling): ΔT_JT = -μ_JT × ΔP
- Friction heating - Viscous dissipation adding energy to the fluid: Q_friction = ΔP_friction × V̇
Joule-Thomson Coefficient
The JT coefficient is calculated from rigorous thermodynamics (mass-weighted average across phases). Typical values:
- Methane: ~4×10⁻⁶ K/Pa (0.4 K/bar)
- Natural gas: 3-5×10⁻⁶ K/Pa
- CO₂: ~10⁻⁵ K/Pa (1 K/bar)
Usage Examples
Example 1: Basic Horizontal Pipeline
// Create fluid system
SystemInterface fluid = new SystemSrkEos(303.15, 50.0);
fluid.addComponent("methane", 0.9);
fluid.addComponent("ethane", 0.1);
fluid.setMixingRule("classic");
// Create inlet stream
Stream inlet = new Stream("inlet", fluid);
inlet.setFlowRate(50000, "kg/hr");
inlet.run();
// Create pipeline
PipeBeggsAndBrills pipe = new PipeBeggsAndBrills("pipeline", inlet);
pipe.setDiameter(0.2032); // 8 inch
pipe.setLength(10000.0); // 10 km
pipe.setElevation(0.0); // horizontal
pipe.setNumberOfIncrements(20);
pipe.run();
System.out.println("Pressure drop: " + pipe.getPressureDrop() + " bar");
System.out.println("Flow regime: " + pipe.getFlowRegime());
Example 2: Pipeline with Heat Transfer
// Hot fluid in cold environment
PipeBeggsAndBrills pipe = new PipeBeggsAndBrills("subsea_pipe", hotStream);
pipe.setDiameter(0.1524); // 6 inch
pipe.setLength(5000.0); // 5 km
pipe.setElevation(0.0); // horizontal
pipe.setConstantSurfaceTemperature(5.0, "C"); // Sea temperature
pipe.setHeatTransferCoefficient(25.0); // W/(m²·K) - SPECIFIED_U mode
pipe.run();
System.out.println("Inlet T: " + pipe.getInletStream().getTemperature("C") + " °C");
System.out.println("Outlet T: " + pipe.getOutletStream().getTemperature("C") + " °C");
Example 3: Detailed U-Value with Insulation
pipe.setConstantSurfaceTemperature(5.0, "C"); // Seawater
pipe.setOuterHeatTransferCoefficient(500.0); // Seawater forced convection
pipe.setPipeWallThermalConductivity(45.0); // Carbon steel
pipe.setInsulation(0.05, 0.04); // 50mm foam, k=0.04 W/(m·K)
pipe.setHeatTransferMode(HeatTransferMode.DETAILED_U);
pipe.run();
Example 4: Inclined Pipeline (Riser)
// Vertical riser
PipeBeggsAndBrills riser = new PipeBeggsAndBrills("riser", feedStream);
riser.setDiameter(0.1524); // 6 inch
riser.setLength(500.0); // 500 m length
riser.setElevation(500.0); // 500 m vertical rise
riser.setAngle(90.0); // Vertical
riser.run();
System.out.println("Hydrostatic head: " + riser.getSegmentPressure(0)
- riser.getSegmentPressure(riser.getNumberOfIncrements()) + " bar");
Example 5: Adiabatic with Joule-Thomson Effect
// High-pressure gas expansion
pipe.setHeatTransferMode(HeatTransferMode.ADIABATIC);
pipe.setIncludeJouleThomsonEffect(true);
pipe.run();
// For natural gas with ~20 bar pressure drop:
// Expected JT cooling: ~8-10 K
Example 6: Calculate Flow Rate from Pressures
pipe.setCalculationMode(CalculationMode.CALCULATE_FLOW_RATE);
pipe.setSpecifiedOutletPressure(40.0, "bara"); // Target outlet pressure
pipe.setMaxFlowIterations(50);
pipe.setFlowConvergenceTolerance(1e-4);
pipe.run();
System.out.println("Calculated flow: " + pipe.getOutletStream().getFlowRate("kg/hr") + " kg/hr");
Transient Simulation
The class supports transient (time-dependent) simulation using the runTransient() method.
This solves the time-dependent mass, momentum, and energy conservation equations using an
explicit finite difference scheme.
Typical Parameter Values
| Environment | h [W/(m²·K)] |
|---|---|
| Still air (natural convection) | 5-25 |
| Forced air | 25-250 |
| Still water | 100-500 |
| Seawater (flowing) | 500-1000 |
| Buried in soil | 1-5 |
| Material | k [W/(m·K)] |
|---|---|
| Carbon steel | 45-50 |
| Stainless steel | 15-20 |
| Mineral wool insulation | 0.03-0.05 |
| Polyurethane foam | 0.02-0.03 |
| Concrete coating | 1.0-1.5 |
- Version:
- $Id: $Id
- Author:
- Even Solbraa, Sviatoslav Eroshkin
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumCalculation modes for pipeline simulation.static enumFlow regimes available in Beggs and Brill correlations.static enumHeat transfer calculation modes for pipeline thermal modeling. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate doubleprivate doubleprivate doubleprivate double(package private) double(package private) doubleprivate doubleprivate doubleprivate double(package private) doubleprivate double(package private) double(package private) doubleprivate doubleprivate List<PipeBeggsAndBrills.FlowRegime> (package private) doubleprivate double(package private) doubleprivate double(package private) doubleprivate doubleprivate booleanprivate booleanprivate doubleprivate doubleprivate doubleprivate doubleprivate double(package private) int(package private) double(package private) doubleprivate int(package private) Stringprivate static final doubleprivate static final doubleprivate doubleprivate doubleprivate doubleprivate doubleprivate doubleprivate double(package private) doubleprivate double(package private) doubleprivate intprivate doubleprivate Stringprivate Booleanprivate doubleprivate doubleprivate double(package private) doubleprivate doubleprotected double(package private) double(package private) doubleprivate PipeBeggsAndBrills.FlowRegime(package private) double(package private) doubleprivate booleanprivate booleanprivate boolean(package private) doubleprivate doubleprivate static final longprivate doubleprivate Stringprivate doubleprivate doubleprivate doubleprotected double(package private) double(package private) double(package private) doubleprivate doubleprivate doubleprivate doubleprivate boolean(package private) double(package private) doubleFields inherited from class Pipeline
equilibriumHeatTransfer, equilibriumMassTransfer, fileName, flowPattern, legHeights, legPositions, logger, numberOfLegs, numberOfNodesInLeg, outerHeatTransferCoeffs, outerTemperature, pipe, pipeDiameters, pipelineMechanicalDesign, system, times, wallHeatTransferCoeffsFields inherited from class TwoPortEquipment
inStream, outStreamFields inherited from class ProcessEquipmentBaseClass
conditionAnalysisMessage, energyStream, hasController, isSolved, properties, reportFields inherited from class SimulationBaseClass
calcIdentifier, calculateSteadyState, timeFields inherited from class NamedBaseClass
name -
Constructor Summary
ConstructorsConstructorDescriptionPipeBeggsAndBrills(String name) Constructor for PipeBeggsAndBrills.PipeBeggsAndBrills(String name, StreamInterface inStream) Constructor for PipeBeggsAndBrills. -
Method Summary
Modifier and TypeMethodDescriptioncalcFlowRegime.doublecalcFrictionPressureLoss.private doublecalcGnielinskiNu(double Re, double Pr) Calculates the Nusselt number using the Gnielinski correlation for turbulent pipe flow.doublecalcHeatBalance(double enthalpy, SystemInterface system, ThermodynamicOperations testOps) Calculates the heat balance for the given system.doublecalcHydrostaticPressureDifference.private doublecalcOverallHeatTransferCoefficient(double innerHTC) Calculates the overall heat transfer coefficient including inner convection, pipe wall conduction, insulation (if present), and outer convection.doublecalcPressureDrop.doubleCalculates the temperature difference between the outlet and inlet of the system.private doublecalcTransientFrictionPressureDrop(double velocity, double density, double viscosity, double segmentLength) Calculates friction pressure drop for transient simulation.private doublecalcTransientHydrostaticPressureDrop(double density, double elevationChange) Calculates hydrostatic pressure drop for transient simulation.private doublecalcTwoPhaseHeatTransferCoefficient(SystemInterface system, double singlePhaseHTC) Calculates the two-phase heat transfer coefficient using Shah correlation.private doubleCalculates the angle based on the length and elevation.private doubleCalculates the elevation based on the length and angle.private doubleCalculates the length based on the elevation and angle.voidcalculateMissingValue.voidConverts the input values from the system measurement units to imperial units.voidConverts the input values from imperial units to the system measurement units.voiddisplayResult.private voiddoubleEstimates the inner heat transfer coefficient for the given system.doublegetAngle()Getter for the fieldangle.Gets the current calculation mode.doublegetDiameter.doubleGetter for the fieldelevation.Getter for the fieldelevationProfile.getFlowRegime.Getter for the fieldflowRegimeProfile.Getter for the fieldgasSuperficialVelocityProfile.doubleGetter for the fieldheatTransferCoefficient.Gets the current heat transfer calculation mode.Getter for the fieldincrementsProfile.doublegetInletSuperficialVelocity.doubleGets the insulation thermal conductivity.doubleGets the insulation thickness.doubleGetter for the fieldLastSegmentPressureDrop.doubleGetter for the fieldlength.Getter for the fieldlengthProfile.Getter for the fieldliquidDensityProfile.Getter for the fieldliquidHoldupProfile.Getter for the fieldliquidSuperficialVelocityProfile.Getter for the fieldmixtureDensityProfile.Getter for the fieldmixtureReynoldsNumber.Getter for the fieldmixtureSuperficialVelocityProfile.Getter for the fieldmixtureViscosityProfile.intgetNumberOfIncrements.doubleGets the outer (external) heat transfer coefficient.doublegetOutletSuperficialVelocity.doubleGets the pipe wall thermal conductivity.doubleGetter for the fieldtotalPressureDrop.Get Pressure drop profile.Getter for the fieldPressureProfile.getSegmentElevation(int index) getSegmentElevation.getSegmentFlowRegime(int index) getSegmentFlowRegime.getSegmentGasSuperficialVelocity(int index) getSegmentGasSuperficialVelocity.getSegmentLength(int index) getSegmentLength.getSegmentLiquidDensity(int index) getSegmentLiquidDensity.getSegmentLiquidHoldup(int index) getSegmentLiquidHoldup.getSegmentLiquidSuperficialVelocity(int index) getSegmentLiquidSuperficialVelocity.getSegmentMixtureDensity(int index) getSegmentMixtureDensity.getSegmentMixtureReynoldsNumber(int index) getSegmentMixtureReynoldsNumber.getSegmentMixtureSuperficialVelocity(int index) getSegmentMixtureSuperficialVelocity.getSegmentMixtureViscosity(int index) getSegmentMixtureViscosity.getSegmentPressure(int index) getSegmentPressure.getSegmentPressureDrop(int index) getSegmentPressureDrop.getSegmentTemperature(int index) getSegmentTemperature.doubleGets the specified outlet pressure.Gets the specified outlet pressure unit.Getter for the fieldtemperatureProfile.getThermoSystem.doublegetThickness.private voidbooleanGets whether friction heating is included in energy calculations.booleanGets whether Joule-Thomson effect is included in energy calculations.booleanDeprecated.voidIn this method all thermodynamic and unit operations will be calculated in a steady state calculation.voidrunTransient(double dt, UUID id) runTransientprivate voidRun pipeline calculation with specified flow rate (calculate outlet pressure).private voidRun pipeline calculation with specified outlet pressure (calculate flow rate).voidsetAngle(double angle) Setter for the fieldangle.voidSets the calculation mode for the pipeline.voidsetConstantSurfaceTemperature(double temperature, String unit) Setter for the fieldconstantSurfaceTemperature.voidsetDiameter(double diameter) setDiameter.voidsetElevation(double elevation) Setter for the fieldelevation.voidsetFlowConvergenceTolerance(double tolerance) Sets the convergence tolerance for flow rate calculation when outlet pressure is specified.voidsetHeatTransferCoefficient(double heatTransferCoefficient) Sets the overall heat transfer coefficient (U-value) and switches to SPECIFIED_U mode.voidSets the heat transfer calculation mode.voidsetIncludeFrictionHeating(boolean include) Sets whether to include friction heating in energy calculations.voidsetIncludeJouleThomsonEffect(boolean include) Sets whether to include Joule-Thomson effect in energy calculations.voidsetInsulation(double thickness, double conductivity) Sets the insulation layer properties.voidsetLength(double length) Setter for the fieldlength.voidsetMaxFlowIterations(int maxIterations) Sets the maximum number of iterations for flow rate calculation when outlet pressure is specified.voidsetNumberOfIncrements(int numberOfIncrements) Setter for the fieldnumberOfIncrements.voidsetOuterHeatTransferCoefficient(double coefficient) Sets the outer (external) heat transfer coefficient for calculating overall U-value.voidsetOutletPressure(double pressure) Sets the specified outlet pressure and switches to flow rate calculation mode.voidsetOutletPressure(double pressure, String unit) Sets the specified outlet pressure with unit and switches to flow rate calculation mode.voidsetPipeSpecification(double nominalDiameter, String pipeSec) Setter for the fieldpipeSpecification.voidsetPipeWallRoughness(double pipeWallRoughness) Setter for the fieldpipeWallRoughness.voidsetPipeWallThermalConductivity(double conductivity) Sets the pipe wall thermal conductivity.voidsetRunIsothermal(boolean runIsothermal) Deprecated.voidsetThickness(double pipeThickness) setThickness.voidsetUseOverallHeatTransferCoefficient(boolean use) Deprecated.UsesetHeatTransferMode(HeatTransferMode)insteadtoJson()Serializes the Process Equipment along with its state to a JSON string.toJson(ReportConfig cfg) Serializes the Process Equipment with configurable level of detail.private doubletryCalculatePressure(double flowRate, String flowUnit, UUID id) Helper method to calculate outlet pressure for a given flow rate, handling exceptions when pressure goes negative (indicating flow rate is too high).Methods inherited from class Pipeline
getCapacityDuty, getCapacityMax, getEntropyProduction, getMechanicalDesign, getOutletPressure, getPipe, getSuperficialVelocity, getTimes, initMechanicalDesign, setEquilibriumHeatTransfer, setEquilibriumMassTransfer, setHeightProfile, setInitialFlowPattern, setLegPositions, setNumberOfLegs, setNumberOfNodesInLeg, setOuterTemperatures, setOutputFileName, setPipeDiameters, setPipeOuterHeatTransferCoefficients, setPipeWallHeatTransferCoefficients, setPipeWallRoughness, setTimeSeriesMethods inherited from class TwoPortEquipment
getInletPressure, getInletStream, getInletTemperature, getMassBalance, getOutletPressure, getOutletStream, getOutletTemperature, setInletPressure, setInletStream, setInletTemperature, setOutletStream, setOutletTemperature, validateSetupMethods inherited from class ProcessEquipmentBaseClass
copy, equals, getConditionAnalysisMessage, getController, getEnergyStream, getExergyChange, getMassBalance, getMinimumFlow, getPressure, getPressure, getProperty, getReport_json, getResultTable, getSpecification, getTemperature, getTemperature, hashCode, isActive, isActive, isSetEnergyStream, reportResults, run_step, runConditionAnalysis, setController, setEnergyStream, setEnergyStream, setFlowValveController, setMinimumFlow, setPressure, setRegulatorOutSignal, setSpecification, setTemperature, solvedMethods inherited from class SimulationBaseClass
getCalculateSteadyState, getCalculationIdentifier, getTime, increaseTime, isRunInSteps, setCalculateSteadyState, setCalculationIdentifier, setRunInSteps, setTimeMethods inherited from class NamedBaseClass
getName, getTagName, setName, setTagNameMethods inherited from class Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface NamedInterface
getName, getTagName, setName, setTagNameMethods inherited from interface ProcessEquipmentInterface
getExergyChange, getFluid, getRestCapacity, needRecalculationMethods inherited from interface SimulationInterface
getCalculateSteadyState, getCalculationIdentifier, getTime, increaseTime, isRunInSteps, run, run_step, run_step, runTransient, setCalculateSteadyState, setCalculationIdentifier, setRunInSteps, setTime, solvedMethods inherited from interface TwoPortInterface
getInletPressure, getInletStream, getInletTemperature, getInStream, getOutletPressure, getOutletStream, getOutletTemperature, getOutStream, setInletPressure, setInletStream, setInletTemperature, setOutletStream, setOutletTemperature
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
iteration
int iteration -
nominalDiameter
private double nominalDiameter -
PipeSpecSet
-
inletPressure
private double inletPressure -
totalPressureDrop
private double totalPressureDrop -
temperatureOut
protected double temperatureOut -
pressureOut
protected double pressureOut -
calculationMode
-
specifiedOutletPressure
private double specifiedOutletPressure -
specifiedOutletPressureUnit
-
maxFlowIterations
private int maxFlowIterations -
flowConvergenceTolerance
private double flowConvergenceTolerance -
maxflowunit
String maxflowunit -
insideDiameter
private double insideDiameter -
pipeThickness
private double pipeThickness -
pipeWallRoughness
private double pipeWallRoughness -
runIsothermal
private boolean runIsothermal -
regime
-
inputVolumeFractionLiquid
private double inputVolumeFractionLiquid -
mixtureFroudeNumber
private double mixtureFroudeNumber -
pipeSpecification
-
A
private double A -
area
private double area -
supGasVel
private double supGasVel -
supLiquidVel
private double supLiquidVel -
mixtureDensity
private double mixtureDensity -
hydrostaticPressureDrop
private double hydrostaticPressureDrop -
El
private double El -
supMixVel
private double supMixVel -
frictionPressureLoss
private double frictionPressureLoss -
pressureDrop
private double pressureDrop -
numberOfIncrements
private int numberOfIncrements -
totalLength
private double totalLength -
totalElevation
private double totalElevation -
angle
private double angle -
mixtureLiquidDensity
private double mixtureLiquidDensity -
mixtureLiquidViscosity
private double mixtureLiquidViscosity -
mixtureOilMassFraction
private double mixtureOilMassFraction -
mixtureOilVolumeFraction
private double mixtureOilVolumeFraction -
cumulativeLength
private double cumulativeLength -
cumulativeElevation
private double cumulativeElevation -
length
double length -
elevation
double elevation -
pressureProfile
-
temperatureProfile
-
pressureDropProfile
-
flowRegimeProfile
-
liquidSuperficialVelocityProfile
-
gasSuperficialVelocityProfile
-
mixtureSuperficialVelocityProfile
-
mixtureViscosityProfile
-
mixtureDensityProfile
-
liquidDensityProfile
-
liquidHoldupProfile
-
mixtureReynoldsNumber
-
lengthProfile
-
elevationProfile
-
incrementsProfile
-
transientInitialized
private boolean transientInitialized -
transientPressureProfile
-
transientTemperatureProfile
-
transientMassFlowProfile
-
transientVelocityProfile
-
transientDensityProfile
-
segmentLengthMeters
private double segmentLengthMeters -
crossSectionArea
private double crossSectionArea -
MIN_TRANSIT_VELOCITY
private static final double MIN_TRANSIT_VELOCITY- See Also:
-
MIN_DENSITY
private static final double MIN_DENSITY- See Also:
-
runAdiabatic
private boolean runAdiabatic -
runConstantSurfaceTemperature
private boolean runConstantSurfaceTemperature -
constantSurfaceTemperature
private double constantSurfaceTemperature -
heatTransferCoefficient
private double heatTransferCoefficient -
heatTransferMode
-
includeJouleThomsonEffect
private boolean includeJouleThomsonEffect -
includeFrictionHeating
private boolean includeFrictionHeating -
Tmi
double Tmi -
Tmo
double Tmo -
Ts
double Ts -
error
double error -
iterationT
double iterationT -
dTlm
double dTlm -
cp
double cp -
q1
double q1 -
q2
double q2 -
ReNoSlip
double ReNoSlip -
S
double S -
rhoNoSlip
double rhoNoSlip -
muNoSlip
double muNoSlip -
thermalConductivity
double thermalConductivity -
Pr
double Pr -
frictionFactor
double frictionFactor -
frictionTwoPhase
double frictionTwoPhase -
Nu
double Nu -
criticalPressure
double criticalPressure -
hmax
double hmax -
X
double X -
outerHeatTransferCoefficient
private double outerHeatTransferCoefficient -
pipeWallThermalConductivity
private double pipeWallThermalConductivity -
insulationThickness
private double insulationThickness -
insulationThermalConductivity
private double insulationThermalConductivity
-
-
Constructor Details
-
PipeBeggsAndBrills
Constructor for PipeBeggsAndBrills.- Parameters:
name- name of pipe
-
PipeBeggsAndBrills
Constructor for PipeBeggsAndBrills.- Parameters:
name- name of pipeinStream- input stream
-
-
Method Details
-
setPipeSpecification
-
getThermoSystem
getThermoSystem.
- Specified by:
getThermoSystemin interfaceProcessEquipmentInterface- Overrides:
getThermoSystemin classProcessEquipmentBaseClass- Returns:
- a
SystemInterfaceobject
-
setElevation
public void setElevation(double elevation) Setter for the field
elevation.- Parameters:
elevation- a double
-
setLength
public void setLength(double length) Setter for the field
length.- Parameters:
length- the length to set
-
setDiameter
public void setDiameter(double diameter) setDiameter.
- Parameters:
diameter- the diameter to set
-
setThickness
public void setThickness(double pipeThickness) setThickness.
- Parameters:
pipeThickness- the thickness to set
-
getThickness
public double getThickness()getThickness.
- Returns:
- a double
-
setAngle
public void setAngle(double angle) Setter for the field
angle.- Parameters:
angle- a double
-
setPipeWallRoughness
public void setPipeWallRoughness(double pipeWallRoughness) Setter for the field
pipeWallRoughness.- Parameters:
pipeWallRoughness- the pipeWallRoughness to set
-
setNumberOfIncrements
public void setNumberOfIncrements(int numberOfIncrements) Setter for the field
numberOfIncrements.- Parameters:
numberOfIncrements- a int
-
setRunIsothermal
Deprecated.Sets whether to run isothermal calculations.- Parameters:
runIsothermal- a boolean
-
setConstantSurfaceTemperature
-
setHeatTransferMode
Sets the heat transfer calculation mode.Available modes:
- ADIABATIC: No heat transfer (Q=0)
- ISOTHERMAL: Constant temperature along the pipe
- SPECIFIED_U: Use a user-specified overall U-value
- ESTIMATED_INNER_H: Calculate h from flow (Gnielinski), use as U
- DETAILED_U: Calculate full U including wall, insulation, outer convection
- Parameters:
mode- the heat transfer calculation mode
-
getHeatTransferMode
Gets the current heat transfer calculation mode.- Returns:
- the heat transfer mode
-
setHeatTransferCoefficient
public void setHeatTransferCoefficient(double heatTransferCoefficient) Sets the overall heat transfer coefficient (U-value) and switches to SPECIFIED_U mode.This is the effective U-value used in the heat transfer equation Q = U * A * LMTD. When set, the mode automatically changes to SPECIFIED_U, meaning this value is used directly without flow-based calculation.
- Parameters:
heatTransferCoefficient- the overall heat transfer coefficient in W/(m²·K)- Throws:
IllegalArgumentException- if heatTransferCoefficient is negative
-
setOutletPressure
public void setOutletPressure(double pressure) Sets the specified outlet pressure and switches to flow rate calculation mode. When outlet pressure is specified, the run() method will iterate to find the flow rate that achieves the specified outlet pressure.- Specified by:
setOutletPressurein interfaceTwoPortInterface- Overrides:
setOutletPressurein classTwoPortEquipment- Parameters:
pressure- the desired outlet pressure in bara
-
setOutletPressure
Sets the specified outlet pressure with unit and switches to flow rate calculation mode. When outlet pressure is specified, the run() method will iterate to find the flow rate that achieves the specified outlet pressure.- Parameters:
pressure- the desired outlet pressureunit- the pressure unit (e.g., "bara", "barg", "Pa", "MPa")
-
getSpecifiedOutletPressure
public double getSpecifiedOutletPressure()Gets the specified outlet pressure.- Returns:
- the specified outlet pressure in the unit set, or NaN if not specified
-
getSpecifiedOutletPressureUnit
Gets the specified outlet pressure unit.- Returns:
- the pressure unit
-
setCalculationMode
Sets the calculation mode for the pipeline.- Parameters:
mode- the calculation mode (CALCULATE_OUTLET_PRESSURE or CALCULATE_FLOW_RATE)
-
getCalculationMode
Gets the current calculation mode.- Returns:
- the calculation mode
-
setMaxFlowIterations
public void setMaxFlowIterations(int maxIterations) Sets the maximum number of iterations for flow rate calculation when outlet pressure is specified.- Parameters:
maxIterations- the maximum number of iterations
-
setFlowConvergenceTolerance
public void setFlowConvergenceTolerance(double tolerance) Sets the convergence tolerance for flow rate calculation when outlet pressure is specified.- Parameters:
tolerance- the relative convergence tolerance (default 1e-4)
-
convertSystemUnitToImperial
public void convertSystemUnitToImperial()Converts the input values from the system measurement units to imperial units. Needed because the main equations and coefficients are developed for imperial systemThe conversions applied are:
- Inside Diameter (m) - (feet): multiplied by 3.2808399
- Angle (m) - (feet): multiplied by 0.01745329
- Elevation (m) - (feet): multiplied by 3.2808399
- Length (m) - (feet): multiplied by 3.2808399
- Pipe Wall Roughness (m) - (feet): multiplied by 3.2808399
-
convertSystemUnitToMetric
public void convertSystemUnitToMetric()Converts the input values from imperial units to the system measurement units. Needed because the main equations and coefficients are developed for imperial systemThe conversions applied are the inverse of those in the
convertSystemUnitToImperial()method:- Inside Diameter (ft - m): divided by 3.2808399
- Angle (ft - m): divided by 0.01745329
- Elevation (ft - m): divided by 3.2808399
- Length (ft - m): divided by 3.2808399
- Pipe Wall Roughness (ft - m): divided by 3.2808399
- Pressure Drop (lb/inch) -(bar): multiplied by 1.48727E-05
-
calculateMissingValue
public void calculateMissingValue()calculateMissingValue.
-
calculateLength
private double calculateLength()Calculates the length based on the elevation and angle.- Returns:
- the calculated length.
-
calculateElevation
private double calculateElevation()Calculates the elevation based on the length and angle.- Returns:
- the calculated elevation.
-
calculateAngle
private double calculateAngle()Calculates the angle based on the length and elevation.- Returns:
- the calculated angle.
-
calcFlowRegime
calcFlowRegime.
- Returns:
- the determined flow regime
-
calcHydrostaticPressureDifference
public double calcHydrostaticPressureDifference()calcHydrostaticPressureDifference.
- Returns:
- a double
-
calcFrictionPressureLoss
public double calcFrictionPressureLoss()calcFrictionPressureLoss.
- Returns:
- a double
-
calcPressureDrop
public double calcPressureDrop()calcPressureDrop.
- Returns:
- a double
-
run
In this method all thermodynamic and unit operations will be calculated in a steady state calculation.
- Specified by:
runin interfaceSimulationInterface- Overrides:
runin classPipeline- Parameters:
id- UUID
-
runWithSpecifiedFlowRate
Run pipeline calculation with specified flow rate (calculate outlet pressure). This is the default calculation mode.- Parameters:
id- calculation identifier
-
runWithSpecifiedOutletPressure
Run pipeline calculation with specified outlet pressure (calculate flow rate). Uses bisection method to find the flow rate that achieves the target outlet pressure.- Parameters:
id- calculation identifier
-
tryCalculatePressure
Helper method to calculate outlet pressure for a given flow rate, handling exceptions when pressure goes negative (indicating flow rate is too high).- Parameters:
flowRate- the flow rate to testflowUnit- the unit for flow rateid- calculation identifier- Returns:
- the outlet pressure, or a very low value if calculation fails (pressure went negative)
-
calcGnielinskiNu
private double calcGnielinskiNu(double Re, double Pr) Calculates the Nusselt number using the Gnielinski correlation for turbulent pipe flow. Valid for 0.5 < Pr < 2000 and 3000 < Re < 5E6.- Parameters:
Re- Reynolds numberPr- Prandtl number- Returns:
- the Nusselt number
-
estimateHeatTransferCoefficent
Estimates the inner heat transfer coefficient for the given system.For single-phase flow, uses standard correlations:
- Laminar (Re < 2300): Nu = 3.66 (fully developed)
- Transition (2300-3000): Linear interpolation
- Turbulent (Re > 3000): Gnielinski correlation
For two-phase flow, uses Shah correlation enhancement factor.
- Parameters:
system- the thermodynamic system for which the heat transfer coefficient is to be estimated- Returns:
- the estimated inner heat transfer coefficient [W/(m²·K)]
-
calcTwoPhaseHeatTransferCoefficient
Calculates the two-phase heat transfer coefficient using Shah correlation.The Shah correlation provides enhancement factors for convective heat transfer in two-phase flow. It accounts for the increased turbulence and interfacial effects in gas-liquid flow.
- Parameters:
system- the thermodynamic systemsinglePhaseHTC- the single-phase heat transfer coefficient [W/(m²·K)]- Returns:
- the two-phase heat transfer coefficient [W/(m²·K)]
-
calcOverallHeatTransferCoefficient
private double calcOverallHeatTransferCoefficient(double innerHTC) Calculates the overall heat transfer coefficient including inner convection, pipe wall conduction, insulation (if present), and outer convection.The overall U-value is based on the inner surface area and accounts for:
- Inner convective resistance: 1/h_i
- Pipe wall conductive resistance: (r_o/r_i) × ln(r_o/r_i) / k_wall
- Insulation resistance (if present): (r_ins/r_i) × ln(r_ins/r_o) / k_ins
- Outer convective resistance: (r_o/r_i) / h_o or (r_ins/r_i) / h_o
- Parameters:
innerHTC- the inner heat transfer coefficient [W/(m²·K)]- Returns:
- the overall heat transfer coefficient based on inner area [W/(m²·K)]
-
setOuterHeatTransferCoefficient
public void setOuterHeatTransferCoefficient(double coefficient) Sets the outer (external) heat transfer coefficient for calculating overall U-value.This is the convective heat transfer coefficient on the outside of the pipe (or insulation). Typical values:
- Still air: 5-10 W/(m²·K)
- Moving air (wind): 10-50 W/(m²·K)
- Still water: 100-500 W/(m²·K)
- Flowing water (subsea): 200-1000 W/(m²·K)
- Parameters:
coefficient- the outer heat transfer coefficient [W/(m²·K)]- Throws:
IllegalArgumentException- if coefficient is negative
-
getOuterHeatTransferCoefficient
public double getOuterHeatTransferCoefficient()Gets the outer (external) heat transfer coefficient.- Returns:
- the outer heat transfer coefficient [W/(m²·K)]
-
setPipeWallThermalConductivity
public void setPipeWallThermalConductivity(double conductivity) Sets the pipe wall thermal conductivity.Typical values:
- Carbon steel: 45-50 W/(m·K)
- Stainless steel: 15-20 W/(m·K)
- Duplex steel: 15-17 W/(m·K)
- Parameters:
conductivity- the thermal conductivity [W/(m·K)]
-
getPipeWallThermalConductivity
public double getPipeWallThermalConductivity()Gets the pipe wall thermal conductivity.- Returns:
- the thermal conductivity [W/(m·K)]
-
setInsulation
public void setInsulation(double thickness, double conductivity) Sets the insulation layer properties.Typical thermal conductivity values:
- Mineral wool: 0.03-0.05 W/(m·K)
- Polyurethane foam: 0.02-0.03 W/(m·K)
- Polypropylene (wet insulation): 0.22-0.25 W/(m·K)
- Syntactic foam (subsea): 0.10-0.15 W/(m·K)
- Parameters:
thickness- the insulation thickness [m]conductivity- the thermal conductivity [W/(m·K)]- Throws:
IllegalArgumentException- if thickness or conductivity is negative
-
getInsulationThickness
public double getInsulationThickness()Gets the insulation thickness.- Returns:
- the insulation thickness [m]
-
getInsulationThermalConductivity
public double getInsulationThermalConductivity()Gets the insulation thermal conductivity.- Returns:
- the thermal conductivity [W/(m·K)]
-
setUseOverallHeatTransferCoefficient
Deprecated.UsesetHeatTransferMode(HeatTransferMode)insteadEnables or disables use of detailed overall heat transfer coefficient calculation.When enabled (true), switches to DETAILED_U mode which includes pipe wall resistance, insulation resistance (if set), and outer convection resistance (if set). When disabled (false), switches to ESTIMATED_INNER_H mode which uses only the inner convective heat transfer coefficient.
- Parameters:
use- true to use DETAILED_U mode, false to use ESTIMATED_INNER_H mode
-
isUseOverallHeatTransferCoefficient
Deprecated.UsegetHeatTransferMode()insteadGets whether detailed overall heat transfer coefficient is being used.- Returns:
- true if using DETAILED_U mode
-
calcTemperatureDifference
Calculates the temperature difference between the outlet and inlet of the system.Uses the analytical solution for a pipe with constant wall temperature (like a heat exchanger):
T_out = T_wall + (T_in - T_wall) * exp(-U * A / (m_dot * Cp))
This is derived from the energy balance dQ = U*(T-Ts)*dA = -m_dot*Cp*dT integrated along the pipe length.
- Parameters:
system- the thermodynamic system for which the temperature difference is to be calculated- Returns:
- the temperature difference between the outlet and inlet (negative for cooling)
-
calcHeatBalance
public double calcHeatBalance(double enthalpy, SystemInterface system, ThermodynamicOperations testOps) Calculates the heat balance for the given system.This method calculates the enthalpy change due to:
- Wall heat transfer (LMTD method) - when not adiabatic
- Joule-Thomson effect - cooling/heating due to pressure change (calculated from thermodynamics)
- Friction heating - viscous dissipation
The final PHflash operation determines the equilibrium state at the new enthalpy and pressure, which inherently accounts for heat of vaporization/condensation in two-phase flow. Phase changes (liquid evaporation or vapor condensation) are properly handled through the enthalpy balance.
- Parameters:
enthalpy- the initial enthalpy of the systemsystem- the thermodynamic system for which the heat balance is to be calculatedtestOps- the thermodynamic operations to be performed- Returns:
- the calculated enthalpy after performing the heat balance
-
setIncludeJouleThomsonEffect
public void setIncludeJouleThomsonEffect(boolean include) Sets whether to include Joule-Thomson effect in energy calculations.The Joule-Thomson effect accounts for temperature change during gas expansion. For natural gas, this typically results in cooling during pressure drop. The JT coefficient is automatically calculated from the gas phase thermodynamics using NeqSim's rigorous equation of state, providing accurate values for the actual fluid composition and conditions.
Typical Joule-Thomson coefficients (calculated automatically):
- Methane: ~4×10⁻⁶ K/Pa (0.4 K/bar)
- Natural gas: 3-5×10⁻⁶ K/Pa
- CO2: ~10⁻⁵ K/Pa (1 K/bar)
- Parameters:
include- true to include JT effect, false otherwise
-
isIncludeJouleThomsonEffect
public boolean isIncludeJouleThomsonEffect()Gets whether Joule-Thomson effect is included in energy calculations.When enabled, the energy equation accounts for temperature change due to gas expansion, typically resulting in cooling for natural gas flows. The JT coefficient is automatically calculated from the gas phase thermodynamics.
- Returns:
- true if JT effect is included in the energy balance
- See Also:
-
setIncludeFrictionHeating
public void setIncludeFrictionHeating(boolean include) Sets whether to include friction heating in energy calculations.Friction heating accounts for viscous dissipation, where mechanical energy lost to friction is converted to thermal energy in the fluid. The heat added is calculated as: Q_friction = ΔP_friction × Q_volumetric
For typical pipeline conditions, friction heating is a small effect (typically 0.01-0.1 K per bar of friction pressure drop) compared to wall heat transfer or Joule-Thomson cooling. However, for high-velocity or long pipelines, it may become significant.
- Parameters:
include- true to include friction heating, false otherwise
-
isIncludeFrictionHeating
public boolean isIncludeFrictionHeating()Gets whether friction heating is included in energy calculations.When enabled, the energy equation accounts for viscous dissipation, where friction pressure losses are converted to thermal energy in the fluid.
- Returns:
- true if friction heating is included in the energy balance
- See Also:
-
initializeTransientState
-
ensureTransientState
-
calcTransientFrictionPressureDrop
private double calcTransientFrictionPressureDrop(double velocity, double density, double viscosity, double segmentLength) Calculates friction pressure drop for transient simulation. Uses simplified correlations that don't depend on steady-state flow regime detection.- Parameters:
velocity- mixture velocity in m/sdensity- mixture density in kg/m3viscosity- mixture viscosity in Pa.s (not cP)segmentLength- length of segment in m- Returns:
- friction pressure drop in bar
-
calcTransientHydrostaticPressureDrop
private double calcTransientHydrostaticPressureDrop(double density, double elevationChange) Calculates hydrostatic pressure drop for transient simulation.- Parameters:
density- mixture density in kg/m3elevationChange- elevation change in m (positive = uphill)- Returns:
- hydrostatic pressure drop in bar
-
runTransient
runTransient
This method calculates thermodynamic and unit operations using difference equations if available and calculateSteadyState is true. Use setCalculateSteadyState to set the parameter. Sets calc identifier UUID.- Specified by:
runTransientin interfaceSimulationInterface- Overrides:
runTransientin classPipeline- Parameters:
dt- Delta time [s]id- Calculation identifier
-
displayResult
public void displayResult()displayResult.
- Specified by:
displayResultin interfaceProcessEquipmentInterface- Overrides:
displayResultin classPipeline
-
getInletSuperficialVelocity
public double getInletSuperficialVelocity()getInletSuperficialVelocity.
- Returns:
- a double
-
getHeatTransferCoefficient
public double getHeatTransferCoefficient()Getter for the fieldheatTransferCoefficient.- Returns:
- the heat transfer coefficient
-
getOutletSuperficialVelocity
public double getOutletSuperficialVelocity()getOutletSuperficialVelocity.
- Returns:
- a double
-
getNumberOfIncrements
public int getNumberOfIncrements()getNumberOfIncrements.
- Returns:
- a double
-
getAngle
public double getAngle()Getter for the field
angle.- Returns:
- angle in degrees
-
getLength
public double getLength()Getter for the field
length.- Returns:
- total length of the pipe in m
-
getElevation
public double getElevation()Getter for the field
elevation.- Returns:
- total elevation of the pipe in m
-
getDiameter
public double getDiameter()getDiameter.
- Returns:
- the diameter
-
getFlowRegime
-
getLastSegmentPressureDrop
public double getLastSegmentPressureDrop()Getter for the field
LastSegmentPressureDrop.- Returns:
- pressure drop last segment
-
getPressureDrop
public double getPressureDrop()Getter for the field
totalPressureDrop.- Returns:
- total pressure drop
-
getPressureProfile
-
getSegmentPressure
getSegmentPressure.
- Parameters:
index- segment number- Returns:
- segment pressure as double
-
getPressureDropProfile
-
getSegmentPressureDrop
getSegmentPressureDrop.
- Parameters:
index- segment number- Returns:
- Double
-
getTemperatureProfile
-
getSegmentTemperature
getSegmentTemperature.
- Parameters:
index- segment number- Returns:
- Double
-
getFlowRegimeProfile
Getter for the field
flowRegimeProfile.- Returns:
- list of flow regime names
-
getSegmentFlowRegime
getSegmentFlowRegime.
- Parameters:
index- segment number- Returns:
- String
-
getLiquidSuperficialVelocityProfile
-
getGasSuperficialVelocityProfile
-
getMixtureSuperficialVelocityProfile
-
getMixtureViscosityProfile
-
getMixtureDensityProfile
-
getLiquidDensityProfile
-
getLiquidHoldupProfile
-
getMixtureReynoldsNumber
-
getLengthProfile
-
getIncrementsProfile
-
getElevationProfile
-
getSegmentLiquidSuperficialVelocity
getSegmentLiquidSuperficialVelocity.
- Parameters:
index- segment number- Returns:
- Double
-
getSegmentGasSuperficialVelocity
getSegmentGasSuperficialVelocity.
- Parameters:
index- segment number- Returns:
- Double
-
getSegmentMixtureSuperficialVelocity
getSegmentMixtureSuperficialVelocity.
- Parameters:
index- segment number- Returns:
- Double
-
getSegmentMixtureViscosity
getSegmentMixtureViscosity.
- Parameters:
index- segment number- Returns:
- Double
-
getSegmentMixtureDensity
getSegmentMixtureDensity.
- Parameters:
index- segment number- Returns:
- Double
-
getSegmentLiquidDensity
getSegmentLiquidDensity.
- Parameters:
index- segment number- Returns:
- Double
-
getSegmentLiquidHoldup
getSegmentLiquidHoldup.
- Parameters:
index- segment number- Returns:
- Double
-
getSegmentMixtureReynoldsNumber
getSegmentMixtureReynoldsNumber.
- Parameters:
index- segment number- Returns:
- Double
-
getSegmentLength
getSegmentLength.
- Parameters:
index- segment number- Returns:
- Double
-
getSegmentElevation
getSegmentElevation.
- Parameters:
index- segment number- Returns:
- Double
-
toJson
Serializes the Process Equipment along with its state to a JSON string.
- Specified by:
toJsonin interfaceProcessEquipmentInterface- Overrides:
toJsonin classPipeline- Returns:
- json string.
-
toJson
Serializes the Process Equipment with configurable level of detail.- Specified by:
toJsonin interfaceProcessEquipmentInterface- Overrides:
toJsonin classPipeline- Parameters:
cfg- report configuration- Returns:
- json string
-
getHeatTransferMode()instead