Class TwoFluidPipe
- All Implemented Interfaces:
Serializable, Runnable, CapacityConstrainedEquipment, PipeLineInterface, ProcessEquipmentInterface, TwoPortInterface, SimulationInterface, NamedInterface
Implements a full two-fluid model for 1D transient multiphase pipeline flow. Unlike the
drift-flux based TransientPipe, this model
solves separate momentum equations for each phase, providing more accurate predictions for:
- Countercurrent flow
- Slug flow dynamics
- Terrain-induced liquid accumulation
- Transient pressure waves
Conservation Equations
- Gas Mass: ∂/∂t(α_g·ρ_g·A) + ∂/∂x(α_g·ρ_g·v_g·A) = Γ_g
- Liquid Mass: ∂/∂t(α_L·ρ_L·A) + ∂/∂x(α_L·ρ_L·v_L·A) = Γ_L
- Gas Momentum: ∂/∂t(α_g·ρ_g·v_g·A) + ∂/∂x(α_g·ρ_g·v_g²·A + α_g·P·A) = S_g
- Liquid Momentum: ∂/∂t(α_L·ρ_L·v_L·A) + ∂/∂x(α_L·ρ_L·v_L²·A + α_L·P·A) = S_L
- Mixture Energy: (optional)
Usage Example
// Create two-phase fluid
SystemInterface fluid = new SystemSrkEos(300, 50);
fluid.addComponent("methane", 0.85);
fluid.addComponent("n-pentane", 0.15);
fluid.setMixingRule("classic");
fluid.setMultiPhaseCheck(true);
// Create inlet stream
Stream inlet = new Stream("inlet", fluid);
inlet.setFlowRate(10, "kg/sec");
inlet.run();
// Create two-fluid pipe
TwoFluidPipe pipe = new TwoFluidPipe("Pipeline", inlet);
pipe.setLength(5000); // 5 km
pipe.setDiameter(0.3); // 300 mm
pipe.setNumberOfSections(100);
// Set terrain profile
double[] elevations = new double[100];
for (int i = 0; i < 100; i++) {
elevations[i] = 50.0 * Math.sin(i * Math.PI / 50); // Undulating terrain
}
pipe.setElevationProfile(elevations);
// Initialize steady state
pipe.run();
// Transient simulation
UUID id = UUID.randomUUID();
for (int step = 0; step < 1000; step++) {
pipe.runTransient(0.1, id); // 0.1 second steps
}
// Get results
double[] pressures = pipe.getPressureProfile();
double[] holdups = pipe.getLiquidHoldupProfile();
double liquidInventory = pipe.getLiquidInventory("m3");
References
- Bendiksen, K.H. et al. (1991) - The Dynamic Two-Fluid Model OLGA
- Taitel, Y. and Dukler, A.E. (1976) - Flow regime transitions
- Issa, R.I. and Kempf, M.H.W. (2003) - Simulation of slug flow
- Version:
- 1.0
- Author:
- Even Solbraa
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumBoundary condition type.static enumInsulation type presets with typical U-values.static enumOLGA model type for holdup and flow regime calculations.static enumSlug tracking mode. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate LiquidAccumulationTrackerLiquid accumulation tracker.private doubleEntrainment fraction in annular flow.private doubleCFL number for time stepping (0 < CFL < 1).Track which slugs have already been counted at outlet (by slug ID).private intCurrent step count.private doublePipe inner diameter (m).private doubleSpatial step size (m).private double[]Elevation profile at each section (m).private booleanEnable OLGA-style annular film model.private booleanEnable heat transfer from surroundings.private booleanEnable Joule-Thomson effect.private booleanEnable severe slugging detection and modeling.private booleanEnable slug tracking.private booleanEnable full OLGA-style terrain tracking.private booleanEnable OLGA-style minimum slip constraint.private TwoFluidConservationEquationsConservation equations solver.private FlowRegimeDetectorFlow regime detector.private doubleFlow regime transition hysteresis factor.private double[]Gas velocity profile (m/s).private doubleHeat transfer coefficient (W/(m²·K)).private double[]Heat transfer coefficient profile along pipe (W/(m²·K)).private doubleHydrate formation temperature (K).private boolean[]Sections flagged for hydrate risk.private booleanInclude energy equation.private booleanInclude mass transfer (flash/condensation).private TwoFluidPipe.BoundaryConditionInlet boundary condition type.private TwoFluidPipe.InsulationTypeCurrent insulation type.private LagrangianSlugTrackerLagrangian slug tracker (OLGA-style full tracking).private doubleprivate doubleTotal pipe length (m).private doubleLiquid fallback coefficient for uphill sections.private double[]Liquid holdup profile.private double[]Liquid velocity profile (m/s).private static final org.apache.logging.log4j.Loggerprivate doubleMaximum simulation time (s).private doubleprivate doubleprivate doubleMinimum film thickness for annular flow (m).private doubleBase minimum liquid holdup for stratified flow (OLGA-style constraint).private doubleSlip factor applied to no-slip holdup to calculate adaptive minimum.private intNumber of computational cells.private TwoFluidPipe.OLGAModelTypeCurrent OLGA model type.private TwoFluidPipe.BoundaryConditionOutlet boundary condition type.private doubleOutlet pressure (Pa).private booleanFlag indicating if outlet pressure was explicitly set.private intOutlet slug statistics.private double[]Pressure profile (Pa).private SystemInterfaceReference fluid for flash calculations.private doublePipe wall roughness (m).private TwoFluidSection[]Pipe sections with state.private static final longprivate doubleCurrent simulation time (s).private SlugTrackerSlug tracker (simplified model).private TwoFluidPipe.SlugTrackingModeCurrent slug tracking mode.private doubleSoil/burial thermal resistance (m²·K/W).private doubleSurface temperature for heat transfer (K).private double[]Surface temperature profile along pipe (K).private double[]Temperature profile (K).private doubleCritical holdup for terrain-induced slug initiation.private MultilayerThermalCalculatorMulti-layer thermal calculator for OLGA-style radial heat transfer.private intUpdate thermodynamics every N steps.private TimeIntegratorTime integrator.private doubleprivate booleanUse only adaptive (correlation-based) minimum, without absolute floor.private booleanEnable multi-layer thermal model (vs simple U-value).private booleanUse OLGA flow regime map instead of Taitel-Dukler.private doublePipe wall density (kg/m³) - steel default.private doublePipe wall specific heat capacity (J/(kg·K)) - steel default.private double[]Pipe wall temperature profile (K).private doublePipe wall thickness (m).private doubleWax appearance temperature (K).private boolean[]Sections flagged for wax risk.Fields inherited from class Pipeline
adiabatic, ambientTemperature, angle, burialDepth, buried, coatingConductivity, coatingThickness, corrosionAllowance, designCode, designPressure, designTemperature, elevation, equilibriumHeatTransfer, equilibriumMassTransfer, fileName, fittings, flowPattern, flowRegime, frictionFactor, inletElevation, innerHeatTransferCoefficient, insulationConductivity, insulationThickness, legHeights, legPositions, liquidHoldup, locationClass, materialGrade, mechanicalDesignCalculator, numberOfIncrements, numberOfLegs, numberOfNodesInLeg, outerHeatTransferCoefficient, outerHeatTransferCoeffs, outerTemperature, outletElevation, pipe, pipeDiameters, pipelineMechanicalDesign, pipeMaterial, pipeSchedule, pipeWallConductivity, pipeWallRoughness, pressureDrop, reynoldsNumber, soilConductivity, system, times, useFittings, velocity, 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
ConstructorsConstructorDescriptionTwoFluidPipe(String name) Constructor with name only.TwoFluidPipe(String name, StreamInterface inStream) Constructor with inlet stream. -
Method Summary
Modifier and TypeMethodDescriptionprivate voidApply boundary conditions.private doubleapplyTerrainAccumulation(TwoFluidSection sec, TwoFluidSection prev, double baseHoldup) Calculate terrain-induced liquid accumulation enhancement using OLGA methodology.private doubleCalculate stable time step using CFL condition.private double[]calculateAnnularHoldupOLGA(double vsG, double vsL, double rhoG, double rhoL, double muG, double muL, double sigma, double D, double theta) Calculate liquid holdup for annular flow using OLGA-style film model.doublecalculateCooldownTime(double targetTemperature, String unit) Calculate cooldown time from current state to a target temperature.private doublecalculateDriftFluxHoldup(double vsG, double vsL, double rhoG, double rhoL, double sigma, double inclination) Calculate holdup using original drift-flux model.doubleCalculate cooldown time to hydrate formation temperature.private doublecalculateInnerHTC(double massFlow, double area) Calculate inner (fluid-side) heat transfer coefficient based on flow conditions.private double[]calculateLocalHoldup(TwoFluidSection sec, TwoFluidSection prev, double mDotGas, double mDotLiq, double area) Calculate local liquid holdup using OLGA-style models with terrain effects.private doublecalculateSlugHoldupOLGA(double vsG, double vsL, double rhoG, double rhoL, double muL, double sigma, double D, double theta) Calculate liquid holdup for slug flow using OLGA model.private doublecalculateStratifiedHoldupOLGA(double vsG, double vsL, double rhoG, double rhoL, double muG, double muL, double sigma, double D, double theta) Calculate stratified flow liquid holdup using OLGA-style momentum balance.private voidcheckTerrainSlugEvents(double dt) Check for and handle terrain-induced slug events.voidconfigureBuriedThermalModel(double burialDepth, boolean wetSoil) Configure buried onshore pipe thermal model.voidconfigureLagrangianSlugTracking(boolean enableInletGeneration, boolean enableTerrainGeneration, boolean enableWakeEffects) Configure Lagrangian slug tracker parameters.voidconfigureSubseaThermalModel(double insulationThickness, double concreteThickness, RadialThermalLayer.MaterialType insulationMaterial) Configure standard subsea pipe thermal model.private doubleEstimate pressure gradient for steady-state initialization.Get accumulation tracker for detailed analysis.doubleGet pipe diameter.doubleGet distance to first hydrate risk location.intGet first section index with hydrate risk.doubleGet flow regime transition hysteresis factor.Get flow regime at each section.double[]Get gas velocity profile.doubleGet the heat transfer coefficient.double[]Get the heat transfer coefficient profile.doubleGet hydrate formation temperature.intGet number of sections with hydrate risk.boolean[]Get sections with hydrate formation risk.Get the insulation type/material.Get the current insulation type.Get Lagrangian slug tracker for OLGA-style slug tracking.doubleGet time of last slug arrival at outlet.doubleGet pipe length.doubleGet the liquid fallback coefficient.double[]Get liquid holdup profile.doublegetLiquidInventory(String unit) Get total liquid inventory in the pipe.double[]Get liquid velocity profile.doubleGet maximum simulation time.doubleGet maximum slug length observed at outlet.doubleGet maximum slug volume observed at outlet.doubleGet minimum film thickness for annular flow model.doubleGet base minimum liquid holdup for stratified flow.doubleGet the slip factor used for adaptive minimum holdup calculation.intGet number of sections.double[]Get oil holdup profile along the pipeline.double[]Get oil velocity profile along the pipeline.double[]Get oil-water velocity slip profile along the pipeline.Get the current OLGA model type.intGet number of slugs that have arrived at outlet.double[]Get position array for plotting.double[]Get pressure profile.doubleGet pipe wall roughness.doubleGet current simulation time.Get slug statistics summary string.Get slug tracker for slug statistics (simplified model).Get current slug tracking mode.Get slug tracking statistics as JSON string.doubleGet soil thermal resistance.doubleGet the surface temperature used for heat transfer calculations.double[]Get the surface temperature profile.double[]Get temperature profile.double[]getTemperatureProfile(String unit) Get temperature profile with specified unit.doubleGet the critical holdup for terrain-induced slug initiation.Get or create the multi-layer thermal calculator.Get thermal summary including U-value and layer details.doubleGet total liquid volume delivered by slugs at outlet.double[]Get the pipe wall temperature profile.doubleGet pipe wall thickness.double[]Get water cut profile along the pipeline.double[]Get water holdup profile along the pipeline.double[]Get water velocity profile along the pipeline.doubleGet wax appearance temperature.boolean[]Get sections with wax deposition risk.booleanCheck if any section has hydrate risk.booleanCheck if any section has wax risk.private voidInitialize pipe sections with inlet conditions.private voidInitialize sub-models.booleanCheck if annular film model is enabled.booleanCheck if severe slugging model is enabled.booleanCheck if terrain tracking is enabled.booleanCheck if OLGA-style minimum slip constraint is enabled.booleanCheck if heat transfer is enabled.booleanCheck if Joule-Thomson effect is enabled.booleanCheck if adaptive-only minimum holdup mode is enabled.booleanCheck if multi-layer thermal model is enabled.booleanCheck if OLGA flow regime map is used.booleanCheck if water-oil velocity slip modeling is enabled.voidIn this method all thermodynamic and unit operations will be calculated in a steady state calculation.private voidRun steady-state initialization.voidrunTransient(double dt, UUID id) Run transient simulation for specified time step.voidsetCflNumber(double cfl) Set CFL number for time stepping.voidsetDiameter(double diameter) Set pipe diameter.voidsetElevationProfile(double[] elevations) Set elevation profile.voidsetEnableAnnularFilmModel(boolean enable) Enable or disable OLGA-style annular film model.voidsetEnableJouleThomson(boolean enable) Enable or disable Joule-Thomson effect.voidsetEnableSevereSlugModel(boolean enable) Enable or disable severe slugging model for risers.voidsetEnableSlugTracking(boolean enable) Enable/disable slug tracking.voidsetEnableTerrainTracking(boolean enable) Enable or disable full terrain tracking.voidsetEnableWaterOilSlip(boolean enable) Enable water-oil velocity slip modeling.voidsetEnforceMinimumSlip(boolean enforce) Enable or disable OLGA-style minimum slip constraint.voidsetFlowRegimeHysteresis(double hysteresis) Set flow regime transition hysteresis factor.voidsetHeatTransferCoefficient(double heatTransferCoefficient) Set heat transfer coefficient for convective heat transfer.voidsetHeatTransferProfile(double[] profile) Set heat transfer coefficient profile along the pipe.voidsetHydrateFormationTemperature(double temperature, String unit) Set hydrate formation temperature for risk monitoring.voidsetIncludeEnergyEquation(boolean include) Enable/disable energy equation.voidsetIncludeMassTransfer(boolean include) Enable/disable mass transfer (flashing/condensation).voidsetInsulationType(String type) Set the insulation type/material.voidSet insulation type using predefined U-values.voidsetLength(double length) Set pipe length.voidsetLiquidFallbackCoefficient(double coefficient) Set the liquid fallback coefficient for uphill sections.voidsetMaxSimulationTime(double time) Set maximum simulation time for transient calculations.voidsetMinimumFilmThickness(double thickness) Set minimum film thickness for annular flow model.voidsetMinimumLiquidHoldup(double minHoldup) Set minimum liquid holdup for stratified flow (OLGA-style constraint).voidsetMinimumSlipFactor(double slipFactor) Set the slip factor used for adaptive minimum holdup calculation.voidsetNumberOfSections(int numberOfSections) Set number of computational sections.voidsetOLGAModelType(TwoFluidPipe.OLGAModelType modelType) Set the OLGA model type for holdup and flow regime calculations.voidsetOutletPressure(double pressure) Set outlet pressure.voidsetOutletPressure(double pressure, String unit) Set outlet pressure with unit.voidsetRoughness(double roughness) Set pipe wall roughness.voidSet slug tracking mode.voidsetSoilThermalResistance(double resistance) Set soil/burial thermal resistance.voidsetSurfaceTemperature(double temperature, String unit) Set surface temperature for heat transfer calculations.voidsetSurfaceTemperatureProfile(double[] profile) Set surface temperature profile along the pipe.voidsetTerrainSlugCriticalHoldup(double criticalHoldup) Set the critical holdup for terrain-induced slug initiation.voidsetThermalCalculator(MultilayerThermalCalculator calculator) Set a pre-configured thermal calculator.voidsetThermodynamicUpdateInterval(int interval) Set thermodynamic update interval.voidsetUseAdaptiveMinimumOnly(boolean useAdaptive) Set whether to use adaptive-only minimum holdup (no absolute floor).voidsetUseMultilayerThermalModel(boolean enable) Enable multi-layer thermal model for OLGA-style radial heat transfer.voidsetUseOLGAFlowRegimeMap(boolean enable) Enable or disable OLGA flow regime map.voidsetWallProperties(double thickness, double density, double heatCapacity) Set pipe wall properties for transient thermal calculations.voidsetWaxAppearanceTemperature(double temperature, String unit) Set wax appearance temperature for risk monitoring.private voidTrack slugs arriving at outlet and collect statistics.private voidTrack slugs arriving at outlet using Lagrangian tracker.private voidUpdate outlet stream with current outlet conditions.private voidUpdate result arrays from section states.private voidupdateTemperatureProfile(double massFlow, double area) Update temperature profile along the pipe accounting for heat transfer.private voidUpdate thermodynamic properties using flash calculations.private voidupdateThermodynamicsWithCondensation(double massFlow, double[] localMDotGas, double[] localMDotLiq) Update thermodynamics along pipe with condensation tracking.private voidupdateTransientTemperature(double massFlow, double area, double dt) Update temperature profile for transient simulation including pipe wall thermal mass.private voidupdateTransientTemperatureMultilayer(double massFlow, double area, double dt, double Cp, double muJT) Update temperature using multi-layer thermal model.private voidupdateWaterOilHoldups(TwoFluidSection sec, TwoFluidSection prev, double alphaL, double area) Update water and oil holdups for three-phase flow with terrain effects.private voidvalidateAndCorrectState(double[][] U_new, double[][] U_prev) Validate and correct state vector to prevent numerical instabilities.private voidValidate section states and fix any numerical issues.Methods inherited from class Pipeline
addCapacityConstraint, addFitting, addFittingFromDatabase, addFittings, addStandardFitting, addStandardFittings, calculateHoopStress, calculateMAOP, calculateMinimumWallThickness, calculateOverallHeatTransferCoefficient, calculateTestPressure, calculateVonMisesStress, clearCapacityConstraints, clearFittings, displayResult, generateMechanicalDesignReport, getAmbientTemperature, getAngle, getBottleneckConstraint, getBurialDepth, getCapacityConstraints, getCapacityDuty, getCapacityMax, getCoatingConductivity, getCoatingThickness, getCorrosionAllowance, getDesignCode, getDesignPressure, getDesignTemperature, getEffectiveLength, getElevation, getEntropyProduction, getEquivalentLength, getFittings, getFlowRegime, getFrictionFactor, getInletElevation, getInnerHeatTransferCoefficient, getInsulationConductivity, getInsulationThickness, getLiquidHoldup, getLocationClass, getMAOP, getMaterialGrade, getMaxUtilization, getMechanicalDesign, getMechanicalDesignCalculator, getNumberOfFittings, getNumberOfIncrements, getNumberOfLegs, getOuterHeatTransferCoefficient, getOutletElevation, getOutletPressure, getOutletTemperature, getPipe, getPipeMaterial, getPipeSchedule, getPipeWallConductivity, getPipeWallRoughness, getPressureDrop, getReynoldsNumber, getSoilConductivity, getSuperficialVelocity, getSuperficialVelocity, getTimes, getTotalFittingsLdRatio, getVelocity, initializeCapacityConstraints, initMechanicalDesign, isAdiabatic, isBuried, isCapacityExceeded, isHardLimitExceeded, isMechanicalDesignSafe, isUseFittings, printFittingsSummary, removeCapacityConstraint, setAdiabatic, setAmbientTemperature, setAmbientTemperatures, setAngle, setBurialDepth, setBuried, setCoatingConductivity, setCoatingThickness, setConstantSurfaceTemperature, setCorrosionAllowance, setDesignCode, setDesignPressure, setDesignPressure, setDesignTemperature, setElevation, setEquilibriumHeatTransfer, setEquilibriumMassTransfer, setHeightProfile, setInitialFlowPattern, setInletElevation, setInnerHeatTransferCoefficient, setInsulationConductivity, setInsulationThickness, setLegPositions, setLocationClass, setMaterialGrade, setNumberOfIncrements, setNumberOfLegs, setNumberOfNodesInLeg, setOuterHeatTransferCoefficient, setOuterHeatTransferCoefficients, setOuterTemperatures, setOutletElevation, setOutletTemperature, setOutputFileName, setPipeDiameters, setPipeMaterial, setPipeOuterHeatTransferCoefficients, setPipeSchedule, setPipeSpecification, setPipeWallConductivity, setPipeWallHeatTransferCoefficients, setPipeWallRoughness, setPipeWallRoughness, setSoilConductivity, setTimeSeries, setUseFittings, setWallHeatTransferCoefficients, setWallThickness, toJson, toJsonMethods 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, getEffectiveCapacityFactor, getEnergyStream, getExergyChange, getFailureMode, getMassBalance, getMinimumFlow, getPressure, getPressure, getProperty, getReport_json, getResultTable, getSpecification, getTemperature, getTemperature, getThermoSystem, hashCode, isActive, isActive, isCapacityAnalysisEnabled, isFailed, isSetEnergyStream, reportResults, restoreFromFailure, run_step, runConditionAnalysis, setCapacityAnalysisEnabled, setController, setEnergyStream, setEnergyStream, setFailureMode, setFlowValveController, setMinimumFlow, setPressure, setRegulatorOutSignal, setSpecification, setTemperature, simulateDegradedOperation, simulateTrip, 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 CapacityConstrainedEquipment
disableAllConstraints, enableAllConstraints, getAvailableMargin, getAvailableMarginPercent, getMaxUtilizationPercent, getUtilizationSummary, isCapacityAnalysisEnabled, isNearCapacityLimit, setCapacityAnalysisEnabledMethods inherited from interface NamedInterface
getName, getTagName, setName, setTagNameMethods inherited from interface PipeLineInterface
setOutPressure, setOutTemperatureMethods inherited from interface ProcessEquipmentInterface
getExergyChange, getFluid, getOperatingEnvelopeViolation, getRestCapacity, getSimulationValidationErrors, isSimulationValid, isWithinOperatingEnvelope, 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, setOutPressure, setOutTemperature
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
logger
private static final org.apache.logging.log4j.Logger logger -
length
private double lengthTotal pipe length (m). -
diameter
private double diameterPipe inner diameter (m). -
roughness
private double roughnessPipe wall roughness (m). -
numberOfSections
private int numberOfSectionsNumber of computational cells. -
elevationProfile
private double[] elevationProfileElevation profile at each section (m). -
sections
Pipe sections with state. -
dx
private double dxSpatial step size (m). -
simulationTime
private double simulationTimeCurrent simulation time (s). -
maxSimulationTime
private double maxSimulationTimeMaximum simulation time (s). -
cflNumber
private double cflNumberCFL number for time stepping (0 < CFL < 1). -
equations
Conservation equations solver. -
timeIntegrator
Time integrator. -
flowRegimeDetector
Flow regime detector. -
accumulationTracker
Liquid accumulation tracker. -
slugTracker
Slug tracker (simplified model). -
lagrangianSlugTracker
Lagrangian slug tracker (OLGA-style full tracking). -
slugTrackingMode
Current slug tracking mode. -
inletBCType
Inlet boundary condition type. -
outletBCType
Outlet boundary condition type. -
outletPressure
private double outletPressureOutlet pressure (Pa). -
outletPressureSet
private boolean outletPressureSetFlag indicating if outlet pressure was explicitly set. -
includeEnergyEquation
private boolean includeEnergyEquationInclude energy equation. -
includeMassTransfer
private boolean includeMassTransferInclude mass transfer (flash/condensation). -
enableHeatTransfer
private boolean enableHeatTransferEnable heat transfer from surroundings. -
surfaceTemperature
private double surfaceTemperatureSurface temperature for heat transfer (K). -
heatTransferCoefficient
private double heatTransferCoefficientHeat transfer coefficient (W/(m²·K)). -
heatTransferProfile
private double[] heatTransferProfileHeat transfer coefficient profile along pipe (W/(m²·K)). -
surfaceTemperatureProfile
private double[] surfaceTemperatureProfileSurface temperature profile along pipe (K). -
wallThickness
private double wallThicknessPipe wall thickness (m). -
wallDensity
private double wallDensityPipe wall density (kg/m³) - steel default. -
wallHeatCapacity
private double wallHeatCapacityPipe wall specific heat capacity (J/(kg·K)) - steel default. -
wallTemperatureProfile
private double[] wallTemperatureProfilePipe wall temperature profile (K). -
soilThermalResistance
private double soilThermalResistanceSoil/burial thermal resistance (m²·K/W). -
thermalCalculator
Multi-layer thermal calculator for OLGA-style radial heat transfer. -
useMultilayerThermalModel
private boolean useMultilayerThermalModelEnable multi-layer thermal model (vs simple U-value). -
enableJouleThomson
private boolean enableJouleThomsonEnable Joule-Thomson effect. -
hydrateFormationTemperature
private double hydrateFormationTemperatureHydrate formation temperature (K). -
waxAppearanceTemperature
private double waxAppearanceTemperatureWax appearance temperature (K). -
hydrateRiskSections
private boolean[] hydrateRiskSectionsSections flagged for hydrate risk. -
waxRiskSections
private boolean[] waxRiskSectionsSections flagged for wax risk. -
insulationType
Current insulation type. -
enableSlugTracking
private boolean enableSlugTrackingEnable slug tracking. -
outletSlugCount
private int outletSlugCountOutlet slug statistics. -
totalSlugVolumeAtOutlet
private double totalSlugVolumeAtOutlet -
lastSlugArrivalTime
private double lastSlugArrivalTime -
maxSlugLengthAtOutlet
private double maxSlugLengthAtOutlet -
maxSlugVolumeAtOutlet
private double maxSlugVolumeAtOutlet -
countedOutletSlugs
-
olgaModelType
Current OLGA model type. Default is FULL for best accuracy. -
minimumLiquidHoldup
private double minimumLiquidHoldupBase minimum liquid holdup for stratified flow (OLGA-style constraint).OLGA enforces a minimum holdup to prevent unrealistically low values at high gas velocities. This is based on the observation that even at high velocities, a thin liquid film remains on the pipe wall in stratified/annular flow.
The actual minimum applied is the maximum of:
- This base value (default 1%)
- A multiple of the no-slip holdup (lambdaL * minimumSlipFactor)
This ensures the minimum is physically reasonable for both lean gas (low liquid loading) and rich gas condensate (high liquid loading) systems.
Reference: Bendiksen et al. (1991) "The Dynamic Two-Fluid Model OLGA" - SPE Production Engineering
-
minimumSlipFactor
private double minimumSlipFactorSlip factor applied to no-slip holdup to calculate adaptive minimum.The adaptive minimum holdup is calculated as: lambdaL * minimumSlipFactor. For gas-dominant systems, typical slip ratios range from 1.5-3.0. Default value of 2.0 means minimum holdup is twice the no-slip value, which accounts for liquid accumulation due to slip. This prevents the minimum from being unrealistically high for lean gas systems with very low liquid loading.
-
useAdaptiveMinimumOnly
private boolean useAdaptiveMinimumOnlyUse only adaptive (correlation-based) minimum, without absolute floor.When true, the minimum holdup is calculated purely from flow correlations (Beggs-Brill type) without enforcing the absolute minimumLiquidHoldup floor. This allows the model to predict very low holdups for lean gas systems where the physical holdup may be below 1%.
Default is true for better handling of lean gas systems.
-
enforceMinimumSlip
private boolean enforceMinimumSlipEnable OLGA-style minimum slip constraint.When enabled (default), enforces a minimum liquid holdup in gas-dominant stratified flow, matching OLGA behavior. When disabled, holdup can approach no-slip values at high velocities (Beggs-Brill style).
-
minimumFilmThickness
private double minimumFilmThicknessMinimum film thickness for annular flow (m).In high gas velocity annular flow, OLGA maintains a minimum liquid film on the pipe wall. This prevents unrealistically low holdup predictions. Default 0.1mm based on typical measurements.
-
annularEntrainmentFraction
private double annularEntrainmentFractionEntrainment fraction in annular flow.Fraction of liquid entrained as droplets in the gas core. Affects the distribution between film flow and droplet flow in annular regime. OLGA uses Ishii-Mishima correlation.
-
enableAnnularFilmModel
private boolean enableAnnularFilmModelEnable OLGA-style annular film model.When enabled, uses OLGA's annular film model which accounts for: - Minimum film thickness on pipe wall - Liquid entrainment in gas core - Wave formation and droplet deposition
-
enableTerrainTracking
private boolean enableTerrainTrackingEnable full OLGA-style terrain tracking.When enabled, uses OLGA's terrain tracking algorithm which: - Identifies all low points and high points - Tracks liquid accumulation in valleys - Models terrain-induced slugging - Handles severe slugging in risers
-
terrainSlugCriticalHoldup
private double terrainSlugCriticalHoldupCritical holdup for terrain-induced slug initiation.When liquid holdup in a low point exceeds this value, a terrain-induced slug is initiated. Default 0.6 based on OLGA recommendations.
-
liquidFallbackCoefficient
private double liquidFallbackCoefficientLiquid fallback coefficient for uphill sections.Controls how much liquid falls back in uphill sections when gas velocity is insufficient to carry liquid upward. Higher values mean more liquid accumulation. OLGA default ~0.3.
-
enableSevereSlugModel
private boolean enableSevereSlugModelEnable severe slugging detection and modeling.Severe slugging occurs at riser bases when liquid periodically blocks gas flow. This cyclic phenomenon can cause large pressure and flow oscillations.
-
useOLGAFlowRegimeMap
private boolean useOLGAFlowRegimeMapUse OLGA flow regime map instead of Taitel-Dukler.OLGA's flow regime map differs from Taitel-Dukler in several ways: - Different transition criteria for stratified wavy to slug - Accounts for pipe roughness effects - Better handling of inclined flow - Hysteresis in regime transitions
-
flowRegimeHysteresis
private double flowRegimeHysteresisFlow regime transition hysteresis factor.OLGA uses hysteresis to prevent rapid switching between flow regimes. A value of 0.1 means 10% hysteresis band around transition boundaries.
-
thermodynamicUpdateInterval
private int thermodynamicUpdateIntervalUpdate thermodynamics every N steps. -
currentStep
private int currentStepCurrent step count. -
pressureProfile
private double[] pressureProfilePressure profile (Pa). -
temperatureProfile
private double[] temperatureProfileTemperature profile (K). -
liquidHoldupProfile
private double[] liquidHoldupProfileLiquid holdup profile. -
gasVelocityProfile
private double[] gasVelocityProfileGas velocity profile (m/s). -
liquidVelocityProfile
private double[] liquidVelocityProfileLiquid velocity profile (m/s). -
referenceFluid
Reference fluid for flash calculations.
-
-
Constructor Details
-
TwoFluidPipe
-
TwoFluidPipe
Constructor with inlet stream.- Parameters:
name- Equipment nameinStream- Inlet stream
-
-
Method Details
-
initSubModels
private void initSubModels()Initialize sub-models. -
initializeSections
private void initializeSections()Initialize pipe sections with inlet conditions. -
runSteadyState
private void runSteadyState()Run steady-state initialization. -
updateThermodynamicsWithCondensation
private void updateThermodynamicsWithCondensation(double massFlow, double[] localMDotGas, double[] localMDotLiq) Update thermodynamics along pipe with condensation tracking.Performs TP-flash at each section to determine local phase fractions accounting for condensation/vaporization. This is critical for gas systems with water where liquid may condense as pressure drops and temperature decreases along the pipeline.
- Parameters:
massFlow- Total mass flow rate [kg/s]localMDotGas- Array to store local gas mass flow rates [kg/s]localMDotLiq- Array to store local liquid mass flow rates [kg/s]
-
updateTemperatureProfile
private void updateTemperatureProfile(double massFlow, double area) Update temperature profile along the pipe accounting for heat transfer.Steady-state energy balance: m_dot * Cp * dT/dx = -h * π * D * (T - T_surface) - μ_JT * dP/dx
- Parameters:
massFlow- Total mass flow rate [kg/s]area- Pipe cross-sectional area [m²]
-
updateTransientTemperature
private void updateTransientTemperature(double massFlow, double area, double dt) Update temperature profile for transient simulation including pipe wall thermal mass.Solves coupled fluid-wall energy equations:
- Fluid: ρ_f * Cp_f * A * dT_f/dt = -m_dot * Cp_f * dT_f/dx - h_i * π * D * (T_f - T_w)
- Wall: ρ_w * Cp_w * A_w * dT_w/dt = h_i * π * D * (T_f - T_w) - h_o * π * D_o * (T_w - T_amb)
If multi-layer thermal model is enabled, uses MultilayerThermalCalculator for accurate radial heat transfer through multiple layers (steel, insulation, coatings, etc.).
- Parameters:
massFlow- Total mass flow rate [kg/s]area- Pipe cross-sectional area [m²]dt- Time step [s]
-
updateTransientTemperatureMultilayer
private void updateTransientTemperatureMultilayer(double massFlow, double area, double dt, double Cp, double muJT) Update temperature using multi-layer thermal model.This method implements OLGA-style radial heat transfer through multiple concentric layers. The heat transfer calculation uses:
- Inner convective resistance from fluid to pipe wall
- Conductive resistance through each layer
- Thermal mass storage in each layer for transient response
- Outer convective/conductive resistance to ambient
- Parameters:
massFlow- Total mass flow rate [kg/s]area- Pipe cross-sectional area [m²]dt- Time step [s]Cp- Fluid heat capacity [J/(kg·K)]muJT- Joule-Thomson coefficient [K/Pa]
-
calculateInnerHTC
private double calculateInnerHTC(double massFlow, double area) Calculate inner (fluid-side) heat transfer coefficient based on flow conditions.Uses Dittus-Boelter correlation for turbulent flow, constant Nusselt for laminar.
- Parameters:
massFlow- Mass flow rate [kg/s]area- Pipe cross-sectional area [m²]- Returns:
- Inner HTC in W/(m²·K)
-
calculateLocalHoldup
private double[] calculateLocalHoldup(TwoFluidSection sec, TwoFluidSection prev, double mDotGas, double mDotLiq, double area) Calculate local liquid holdup using OLGA-style models with terrain effects.Supports multiple model types:
- FULL OLGA: Momentum balance for stratified, film model for annular, Dukler for slug
- SIMPLIFIED OLGA: Empirical correlations with minimum slip constraint
- DRIFT_FLUX: Original NeqSim drift-flux model
- Parameters:
sec- Current sectionprev- Previous section (upstream)mDotGas- Gas mass flow rate [kg/s]mDotLiq- Liquid mass flow rate [kg/s]area- Pipe cross-sectional area [m²]- Returns:
- Array with [liquidHoldup, gasHoldup]
-
calculateDriftFluxHoldup
private double calculateDriftFluxHoldup(double vsG, double vsL, double rhoG, double rhoL, double sigma, double inclination) Calculate holdup using original drift-flux model.Uses the drift-flux model: v_G = C_0 * v_m + v_gj where:
- C_0 = distribution coefficient (~1.0-1.2 for pipe flow)
- v_gj = drift velocity (gas rises relative to mixture)
- Parameters:
vsG- Gas superficial velocity [m/s]vsL- Liquid superficial velocity [m/s]rhoG- Gas density [kg/m³]rhoL- Liquid density [kg/m³]sigma- Surface tension [N/m]inclination- Pipe inclination [radians]- Returns:
- Liquid holdup [-]
-
calculateStratifiedHoldupOLGA
private double calculateStratifiedHoldupOLGA(double vsG, double vsL, double rhoG, double rhoL, double muG, double muL, double sigma, double D, double theta) Calculate stratified flow liquid holdup using OLGA-style momentum balance.This method implements the OLGA approach for stratified flow, where the liquid level is determined by a momentum balance between the phases. The key principle is that at equilibrium, the pressure gradient must be equal in both phases.
The momentum balance accounts for:
- Wall friction in each phase (τ_wG, τ_wL)
- Interfacial friction between phases (τ_i)
- Gravity component for inclined pipes
Uses exact circular segment geometry for wetted perimeters and areas, which is critical for accurate holdup prediction at low liquid fractions (lean gas systems).
Reference: Bendiksen et al. (1991) "The Dynamic Two-Fluid Model OLGA: Theory and Application" SPE Production Engineering, May 1991, pp. 171-180
- Parameters:
vsG- Gas superficial velocity [m/s]vsL- Liquid superficial velocity [m/s]rhoG- Gas density [kg/m³]rhoL- Liquid density [kg/m³]muG- Gas dynamic viscosity [Pa·s]muL- Liquid dynamic viscosity [Pa·s]sigma- Surface tension [N/m]D- Pipe diameter [m]theta- Pipe inclination [radians]- Returns:
- Equilibrium liquid holdup [-]
-
calculateAnnularHoldupOLGA
private double[] calculateAnnularHoldupOLGA(double vsG, double vsL, double rhoG, double rhoL, double muG, double muL, double sigma, double D, double theta) Calculate liquid holdup for annular flow using OLGA-style film model.In annular flow, liquid exists as a thin film on the pipe wall and as entrained droplets in the gas core. OLGA models this using:
- Film flow momentum balance
- Entrainment/deposition equilibrium
- Minimum film thickness constraint
Reference: Bendiksen et al. (1991) and OLGA Technical Manual
- Parameters:
vsG- Gas superficial velocity [m/s]vsL- Liquid superficial velocity [m/s]rhoG- Gas density [kg/m³]rhoL- Liquid density [kg/m³]muG- Gas dynamic viscosity [Pa·s]muL- Liquid dynamic viscosity [Pa·s]sigma- Surface tension [N/m]D- Pipe diameter [m]theta- Pipe inclination [radians]- Returns:
- Array with [total liquid holdup, film holdup, entrained fraction]
-
calculateSlugHoldupOLGA
private double calculateSlugHoldupOLGA(double vsG, double vsL, double rhoG, double rhoL, double muL, double sigma, double D, double theta) Calculate liquid holdup for slug flow using OLGA model.OLGA models slug flow as a sequence of liquid slugs separated by gas bubbles (Taylor bubbles). The average holdup is determined by:
- Slug body holdup (typically 0.7-1.0)
- Film holdup under Taylor bubble
- Slug frequency and length
- Parameters:
vsG- Gas superficial velocity [m/s]vsL- Liquid superficial velocity [m/s]rhoG- Gas density [kg/m³]rhoL- Liquid density [kg/m³]muL- Liquid dynamic viscosity [Pa·s]sigma- Surface tension [N/m]D- Pipe diameter [m]theta- Pipe inclination [radians]- Returns:
- Slug flow average liquid holdup [-]
-
applyTerrainAccumulation
private double applyTerrainAccumulation(TwoFluidSection sec, TwoFluidSection prev, double baseHoldup) Calculate terrain-induced liquid accumulation enhancement using OLGA methodology.This implements the full OLGA terrain tracking algorithm which accounts for:
- Low Point Accumulation: Liquid pools in valleys due to gravity. The volume of accumulated liquid depends on the depth of the valley and gas carrying capacity.
- Uphill Liquid Fallback: When gas velocity is below critical velocity, liquid falls back. The critical velocity is based on Taitel-Dukler flooding criterion.
- Downhill Drainage: Liquid accelerates on downhill sections, reducing holdup.
- Riser Base Accumulation: Special treatment for transition from horizontal/downhill to steep uphill (severe slugging potential).
- Terrain-Induced Slugging: When low-point holdup exceeds critical value, slugs form and surge out.
Reference: Bendiksen et al. (1991) "The Dynamic Two-Fluid Model OLGA: Theory and Application" SPE Production Engineering, May 1991, pp. 171-180
- Parameters:
sec- Current pipe sectionprev- Previous pipe sectionbaseHoldup- Base holdup from flow regime correlation- Returns:
- Enhanced holdup accounting for terrain effects
-
checkTerrainSlugEvents
private void checkTerrainSlugEvents(double dt) Check for and handle terrain-induced slug events.Called during transient simulation to detect when accumulated liquid in low points reaches critical level and triggers a terrain-induced slug.
- Parameters:
dt- Time step (s)
-
estimatePressureGradient
Estimate pressure gradient for steady-state initialization.Uses Haaland equation (explicit approximation to Colebrook-White) for friction factor, consistent with AdiabaticPipe and PipeBeggsAndBrills.
- Parameters:
sec- Current pipe section- Returns:
- Pressure gradient estimate (Pa/m)
-
updateWaterOilHoldups
private void updateWaterOilHoldups(TwoFluidSection sec, TwoFluidSection prev, double alphaL, double area) Update water and oil holdups for three-phase flow with terrain effects.Water is denser than oil, so it tends to accumulate in valleys (low spots) more than oil. This method calculates the local water cut which can vary along the pipe based on:
- Gravity segregation: water settles faster in low-velocity regions
- Terrain effects: water accumulates more in valleys
- Slip between oil and water phases
- Parameters:
sec- Current sectionprev- Previous section (upstream)alphaL- Total liquid holduparea- Pipe cross-sectional area
-
run
-
runTransient
Run transient simulation for specified time step.- Specified by:
runTransientin interfaceSimulationInterface- Overrides:
runTransientin classPipeline- Parameters:
dt- Requested time step (s)id- Calculation identifier
-
validateAndCorrectState
private void validateAndCorrectState(double[][] U_new, double[][] U_prev) Validate and correct state vector to prevent numerical instabilities.- Parameters:
U_new- New state to validateU_prev- Previous state for fallback
-
validateSectionStates
private void validateSectionStates()Validate section states and fix any numerical issues. -
calcStableTimeStep
private double calcStableTimeStep()Calculate stable time step using CFL condition.- Returns:
- stable time step [s]
-
updateThermodynamics
private void updateThermodynamics()Update thermodynamic properties using flash calculations. -
applyBoundaryConditions
private void applyBoundaryConditions()Apply boundary conditions. -
updateOutletStream
private void updateOutletStream()Update outlet stream with current outlet conditions. -
updateResultArrays
private void updateResultArrays()Update result arrays from section states.Array length equals numberOfSections, with each element representing the section midpoint values.
-
getLiquidInventory
Get total liquid inventory in the pipe.Calculates inventory from conservative mass per length, converted to volume using local liquid density. This ensures consistency with the solver's mass tracking.
- Parameters:
unit- Volume unit ("m3", "bbl", "L")- Returns:
- Liquid volume
-
getPressureProfile
public double[] getPressureProfile()Get pressure profile.- Specified by:
getPressureProfilein interfacePipeLineInterface- Overrides:
getPressureProfilein classPipeline- Returns:
- Pressure at each section (Pa)
-
getTemperatureProfile
public double[] getTemperatureProfile()Get temperature profile.- Specified by:
getTemperatureProfilein interfacePipeLineInterface- Overrides:
getTemperatureProfilein classPipeline- Returns:
- Temperature at each section (K)
-
getLiquidHoldupProfile
public double[] getLiquidHoldupProfile()Get liquid holdup profile.For consistency with oil and water holdups, the liquid holdup is calculated as the sum of oil and water holdups.
- Specified by:
getLiquidHoldupProfilein interfacePipeLineInterface- Overrides:
getLiquidHoldupProfilein classPipeline- Returns:
- Holdup at each section (0-1)
-
getWaterCutProfile
public double[] getWaterCutProfile()Get water cut profile along the pipeline.For three-phase flow, water cut can vary along the pipeline as water accumulates in low spots (valleys) due to its higher density compared to oil.
- Returns:
- Water cut at each section (0-1, fraction of liquid that is water)
-
getWaterHoldupProfile
public double[] getWaterHoldupProfile()Get water holdup profile along the pipeline.- Returns:
- Water holdup at each section (0-1, fraction of pipe area occupied by water)
-
getOilHoldupProfile
public double[] getOilHoldupProfile()Get oil holdup profile along the pipeline.- Returns:
- Oil holdup at each section (0-1, fraction of pipe area occupied by oil)
-
getGasVelocityProfile
public double[] getGasVelocityProfile()Get gas velocity profile.- Returns:
- Gas velocity at each section (m/s)
-
getLiquidVelocityProfile
public double[] getLiquidVelocityProfile()Get liquid velocity profile.- Returns:
- Liquid velocity at each section (m/s)
-
getOilVelocityProfile
public double[] getOilVelocityProfile()Get oil velocity profile along the pipeline.When water-oil slip is enabled, this returns the independent oil velocity. Otherwise, it returns the combined liquid velocity.
- Returns:
- Oil velocity at each section (m/s)
-
getWaterVelocityProfile
public double[] getWaterVelocityProfile()Get water velocity profile along the pipeline.When water-oil slip is enabled, this returns the independent water velocity. Otherwise, it returns the combined liquid velocity.
- Returns:
- Water velocity at each section (m/s)
-
getOilWaterSlipProfile
public double[] getOilWaterSlipProfile()Get oil-water velocity slip profile along the pipeline.Returns the difference between oil and water velocities (vOil - vWater). Positive values indicate oil is flowing faster than water.
- Returns:
- Oil-water slip velocity at each section (m/s)
-
getFlowRegimeProfile
Get flow regime at each section.- Returns:
- Array of flow regimes
-
getPositionProfile
public double[] getPositionProfile()Get position array for plotting.- Returns:
- Position along pipe (m), one value per section at section midpoint
-
getSimulationTime
public double getSimulationTime()Get current simulation time.- Returns:
- Time (s)
-
getAccumulationTracker
Get accumulation tracker for detailed analysis.- Returns:
- Accumulation tracker
-
getSlugTracker
Get slug tracker for slug statistics (simplified model).- Returns:
- Slug tracker
-
getLagrangianSlugTracker
Get Lagrangian slug tracker for OLGA-style slug tracking.- Returns:
- Lagrangian slug tracker
-
getSlugTrackingMode
Get current slug tracking mode.- Returns:
- slug tracking mode
-
setSlugTrackingMode
Set slug tracking mode.Available modes:
- SIMPLIFIED: Simple slug unit model with basic tracking
- LAGRANGIAN: Full OLGA-style Lagrangian tracking with wake effects, frequency-based initiation, and detailed statistics
- DISABLED: No slug tracking
- Parameters:
mode- slug tracking mode
-
configureLagrangianSlugTracking
public void configureLagrangianSlugTracking(boolean enableInletGeneration, boolean enableTerrainGeneration, boolean enableWakeEffects) Configure Lagrangian slug tracker parameters.This method provides access to advanced slug tracking configuration for the OLGA-style Lagrangian model.
- Parameters:
enableInletGeneration- enable hydrodynamic slug generation at inletenableTerrainGeneration- enable terrain-induced slug generationenableWakeEffects- enable wake interaction between slugs
-
getSlugTrackingStatisticsJson
Get slug tracking statistics as JSON string.- Returns:
- JSON string with slug statistics
-
trackOutletSlugs
private void trackOutletSlugs()Track slugs arriving at outlet and collect statistics. Each slug is only counted once when it first reaches the outlet region. -
trackOutletSlugsLagrangian
private void trackOutletSlugsLagrangian()Track slugs arriving at outlet using Lagrangian tracker. -
getOutletSlugCount
public int getOutletSlugCount()Get number of slugs that have arrived at outlet.- Returns:
- Outlet slug count
-
getTotalSlugVolumeAtOutlet
public double getTotalSlugVolumeAtOutlet()Get total liquid volume delivered by slugs at outlet.- Returns:
- Total slug volume (m³)
-
getLastSlugArrivalTime
public double getLastSlugArrivalTime()Get time of last slug arrival at outlet.- Returns:
- Time (s)
-
getMaxSlugLengthAtOutlet
public double getMaxSlugLengthAtOutlet()Get maximum slug length observed at outlet.- Returns:
- Max length (m)
-
getMaxSlugVolumeAtOutlet
public double getMaxSlugVolumeAtOutlet()Get maximum slug volume observed at outlet.- Returns:
- Max volume (m³)
-
getSlugStatisticsSummary
Get slug statistics summary string.- Returns:
- Statistics summary
-
setLength
public void setLength(double length) Set pipe length.- Specified by:
setLengthin interfacePipeLineInterface- Overrides:
setLengthin classPipeline- Parameters:
length- Length (m)
-
getLength
public double getLength()Get pipe length.- Specified by:
getLengthin interfacePipeLineInterface- Overrides:
getLengthin classPipeline- Returns:
- Length (m)
-
setDiameter
public void setDiameter(double diameter) Set pipe diameter.- Specified by:
setDiameterin interfacePipeLineInterface- Overrides:
setDiameterin classPipeline- Parameters:
diameter- Diameter (m)
-
getDiameter
public double getDiameter()Get pipe diameter.- Specified by:
getDiameterin interfacePipeLineInterface- Overrides:
getDiameterin classPipeline- Returns:
- Diameter (m)
-
setRoughness
public void setRoughness(double roughness) Set pipe wall roughness.- Parameters:
roughness- Roughness (m)
-
getRoughness
public double getRoughness()Get pipe wall roughness.- Returns:
- Roughness (m)
-
setNumberOfSections
public void setNumberOfSections(int numberOfSections) Set number of computational sections.- Parameters:
numberOfSections- Number of sections
-
getNumberOfSections
public int getNumberOfSections()Get number of sections.- Returns:
- Number of sections
-
setElevationProfile
public void setElevationProfile(double[] elevations) Set elevation profile.- Parameters:
elevations- Elevation at each section (m)
-
setOutletPressure
public void setOutletPressure(double pressure) Set outlet pressure.- Specified by:
setOutletPressurein interfacePipeLineInterface- Specified by:
setOutletPressurein interfaceTwoPortInterface- Overrides:
setOutletPressurein classPipeline- Parameters:
pressure- Pressure (Pa)
-
setOutletPressure
Set outlet pressure with unit.- Specified by:
setOutletPressurein interfaceTwoPortInterface- Overrides:
setOutletPressurein classTwoPortEquipment- Parameters:
pressure- Pressure valueunit- Pressure unit ("Pa", "bara", "barg", "psia")
-
setCflNumber
public void setCflNumber(double cfl) Set CFL number for time stepping.- Parameters:
cfl- CFL number (0 < cfl < 1)
-
setMaxSimulationTime
public void setMaxSimulationTime(double time) Set maximum simulation time for transient calculations.- Parameters:
time- Maximum simulation time in seconds
-
getMaxSimulationTime
public double getMaxSimulationTime()Get maximum simulation time.- Returns:
- Maximum simulation time in seconds
-
setIncludeEnergyEquation
public void setIncludeEnergyEquation(boolean include) Enable/disable energy equation.- Parameters:
include- true to include energy equation
-
setSurfaceTemperature
Set surface temperature for heat transfer calculations.Enables heat transfer modeling. The pipe loses/gains heat to reach this temperature.
- Parameters:
temperature- Surface temperature in the specified unitunit- Temperature unit ("K" or "C")
-
setHeatTransferCoefficient
public void setHeatTransferCoefficient(double heatTransferCoefficient) Set heat transfer coefficient for convective heat transfer.Heat transfer rate: Q = h * A * (T_pipe - T_surface)
where h = heat transfer coefficient (W/(m²·K))
A = pipe surface area (m²)
T_pipe = bulk fluid temperature (K)
T_surface = surrounding surface temperature (K)
Typical values:
- Insulated subsea pipe: 5-15 W/(m²·K)
- Uninsulated subsea pipe: 20-30 W/(m²·K)
- Exposed/above-ground pipe: 50-100 W/(m²·K)
- Specified by:
setHeatTransferCoefficientin interfacePipeLineInterface- Overrides:
setHeatTransferCoefficientin classPipeline- Parameters:
heatTransferCoefficient- Heat transfer coefficient in W/(m²·K)
-
getSurfaceTemperature
public double getSurfaceTemperature()Get the surface temperature used for heat transfer calculations.- Returns:
- Surface temperature in Kelvin
-
getHeatTransferCoefficient
public double getHeatTransferCoefficient()Get the heat transfer coefficient.- Specified by:
getHeatTransferCoefficientin interfacePipeLineInterface- Overrides:
getHeatTransferCoefficientin classPipeline- Returns:
- Heat transfer coefficient in W/(m²·K)
-
isHeatTransferEnabled
public boolean isHeatTransferEnabled()Check if heat transfer is enabled.- Returns:
- true if heat transfer modeling is active
-
setIncludeMassTransfer
public void setIncludeMassTransfer(boolean include) Enable/disable mass transfer (flashing/condensation).- Parameters:
include- true to include mass transfer
-
setEnableSlugTracking
public void setEnableSlugTracking(boolean enable) Enable/disable slug tracking.- Parameters:
enable- true to enable slug tracking
-
setEnableWaterOilSlip
public void setEnableWaterOilSlip(boolean enable) Enable water-oil velocity slip modeling.When enabled, uses 7-equation model with separate oil and water momentum equations, allowing water and oil phases to flow at different velocities. This is important for:
- Uphill flow: water slips back relative to oil due to higher density
- Downhill flow: water accelerates relative to oil
- Stratified oil-water flow with shear at interface
- Parameters:
enable- true to enable 7-equation model with oil-water slip
-
isWaterOilSlipEnabled
public boolean isWaterOilSlipEnabled()Check if water-oil velocity slip modeling is enabled.- Returns:
- true if 7-equation model is enabled
-
setThermodynamicUpdateInterval
public void setThermodynamicUpdateInterval(int interval) Set thermodynamic update interval.- Parameters:
interval- Update every N time steps
-
setMinimumLiquidHoldup
public void setMinimumLiquidHoldup(double minHoldup) Set minimum liquid holdup for stratified flow (OLGA-style constraint).This parameter enforces a minimum liquid holdup in gas-dominant stratified flow, preventing unrealistically low values at high gas velocities. OLGA uses a similar approach based on the observation that a thin liquid film always remains on the pipe wall.
Typical values:
- 0.005 (0.5%) - Default, suitable for gas-condensate systems
- 0.01 (1%) - Conservative estimate for wet gas
- 0.02 (2%) - High liquid loading or wavy stratified flow
- Parameters:
minHoldup- Base minimum liquid holdup fraction (0-1), default 0.01
-
getMinimumLiquidHoldup
public double getMinimumLiquidHoldup()Get base minimum liquid holdup for stratified flow.- Returns:
- Base minimum liquid holdup fraction (0-1)
-
setMinimumSlipFactor
public void setMinimumSlipFactor(double slipFactor) Set the slip factor used for adaptive minimum holdup calculation.The adaptive minimum holdup is calculated as: lambdaL * minimumSlipFactor, where lambdaL is the no-slip (input) liquid fraction. This ensures physically reasonable minimum holdup for systems with varying liquid loading.
Example: For a lean gas with 0.5% liquid loading and slipFactor=2.0:
- adaptiveMin = 0.005 * 2.0 = 1% holdup
- This is more reasonable than a fixed 5% minimum
- Parameters:
slipFactor- Multiplier for no-slip holdup (1.0-5.0), default 2.0
-
getMinimumSlipFactor
public double getMinimumSlipFactor()Get the slip factor used for adaptive minimum holdup calculation.- Returns:
- Slip factor (multiplier for no-slip holdup)
-
setEnforceMinimumSlip
public void setEnforceMinimumSlip(boolean enforce) Enable or disable OLGA-style minimum slip constraint.When enabled (default), enforces a minimum liquid holdup in gas-dominant stratified flow. This matches OLGA behavior and prevents unrealistically low holdup at high velocities.
When disabled, holdup can approach no-slip values at high Froude numbers, similar to the original Beggs-Brill correlation behavior.
- Parameters:
enforce- true to enforce minimum slip (OLGA-style, default), false for Beggs-Brill style
-
isEnforceMinimumSlip
public boolean isEnforceMinimumSlip()Check if OLGA-style minimum slip constraint is enabled.- Returns:
- true if minimum slip is enforced (OLGA-style)
-
setUseAdaptiveMinimumOnly
public void setUseAdaptiveMinimumOnly(boolean useAdaptive) Set whether to use adaptive-only minimum holdup (no absolute floor).When true (default), the minimum holdup is calculated purely from flow correlations (Beggs-Brill type) scaled by the no-slip holdup, without enforcing an absolute floor. This allows the model to predict very low holdups for lean gas systems where the physical holdup may be well below 1%.
When false, an absolute minimum (minimumLiquidHoldup, default 0.1%) is enforced in addition to the correlation-based minimum. This is more conservative but may overpredict holdup for very lean gas systems.
- Parameters:
useAdaptive- true to use correlation-only minimum (recommended for lean gas), false to also enforce absolute floor
-
isUseAdaptiveMinimumOnly
public boolean isUseAdaptiveMinimumOnly()Check if adaptive-only minimum holdup mode is enabled.- Returns:
- true if using correlation-based minimum only (no absolute floor)
-
setOLGAModelType
Set the OLGA model type for holdup and flow regime calculations.Available model types:
- FULL - Full OLGA model with momentum balance for all flow regimes (most accurate)
- SIMPLIFIED - Simplified OLGA model with empirical correlations (faster)
- DRIFT_FLUX - Original NeqSim drift-flux model (for backward compatibility)
- Parameters:
modelType- the OLGA model type to use
-
getOLGAModelType
Get the current OLGA model type.- Returns:
- the current OLGA model type
-
setMinimumFilmThickness
public void setMinimumFilmThickness(double thickness) Set minimum film thickness for annular flow model.- Parameters:
thickness- minimum film thickness in meters (default 0.0001 m = 0.1 mm)
-
getMinimumFilmThickness
public double getMinimumFilmThickness()Get minimum film thickness for annular flow model.- Returns:
- minimum film thickness in meters
-
setEnableAnnularFilmModel
public void setEnableAnnularFilmModel(boolean enable) Enable or disable OLGA-style annular film model.- Parameters:
enable- true to enable annular film model
-
isEnableAnnularFilmModel
public boolean isEnableAnnularFilmModel()Check if annular film model is enabled.- Returns:
- true if annular film model is enabled
-
setEnableTerrainTracking
public void setEnableTerrainTracking(boolean enable) Enable or disable full terrain tracking.Terrain tracking identifies low points and models liquid accumulation in valleys. Required for accurate liquid inventory prediction in undulating pipelines.
- Parameters:
enable- true to enable terrain tracking (default true)
-
isEnableTerrainTracking
public boolean isEnableTerrainTracking()Check if terrain tracking is enabled.- Returns:
- true if terrain tracking is enabled
-
setTerrainSlugCriticalHoldup
public void setTerrainSlugCriticalHoldup(double criticalHoldup) Set the critical holdup for terrain-induced slug initiation.- Parameters:
criticalHoldup- holdup fraction (0-1) at which terrain slug initiates (default 0.6)
-
getTerrainSlugCriticalHoldup
public double getTerrainSlugCriticalHoldup()Get the critical holdup for terrain-induced slug initiation.- Returns:
- critical holdup fraction
-
setLiquidFallbackCoefficient
public void setLiquidFallbackCoefficient(double coefficient) Set the liquid fallback coefficient for uphill sections.Controls liquid accumulation in uphill sections. Higher values mean more liquid falls back and accumulates. OLGA default is approximately 0.3.
- Parameters:
coefficient- fallback coefficient (0-1), default 0.3
-
getLiquidFallbackCoefficient
public double getLiquidFallbackCoefficient()Get the liquid fallback coefficient.- Returns:
- liquid fallback coefficient
-
setEnableSevereSlugModel
public void setEnableSevereSlugModel(boolean enable) Enable or disable severe slugging model for risers.- Parameters:
enable- true to enable severe slugging detection (default true)
-
isEnableSevereSlugModel
public boolean isEnableSevereSlugModel()Check if severe slugging model is enabled.- Returns:
- true if severe slugging model is enabled
-
setUseOLGAFlowRegimeMap
public void setUseOLGAFlowRegimeMap(boolean enable) Enable or disable OLGA flow regime map.When enabled, uses OLGA's flow regime transition criteria instead of Taitel-Dukler. OLGA's criteria include roughness effects and better inclined flow handling.
- Parameters:
enable- true to use OLGA flow regime map (default true)
-
isUseOLGAFlowRegimeMap
public boolean isUseOLGAFlowRegimeMap()Check if OLGA flow regime map is used.- Returns:
- true if OLGA flow regime map is enabled
-
setFlowRegimeHysteresis
public void setFlowRegimeHysteresis(double hysteresis) Set flow regime transition hysteresis factor.Prevents rapid switching between flow regimes near transition boundaries. A value of 0.1 means 10% hysteresis band.
- Parameters:
hysteresis- hysteresis factor (0-0.5), default 0.1
-
getFlowRegimeHysteresis
public double getFlowRegimeHysteresis()Get flow regime transition hysteresis factor.- Returns:
- hysteresis factor
-
setInsulationType
Set insulation type using predefined U-values.This is a convenience method that sets appropriate heat transfer coefficient based on insulation type. Automatically enables heat transfer modeling.
- Parameters:
type- Insulation type preset
-
getInsulationTypeEnum
Get the current insulation type.- Returns:
- Current insulation type
-
getInsulationType
Get the insulation type/material.- Specified by:
getInsulationTypein interfacePipeLineInterface- Overrides:
getInsulationTypein classPipeline- Returns:
- insulation type
-
setInsulationType
Set the insulation type/material.- Specified by:
setInsulationTypein interfacePipeLineInterface- Overrides:
setInsulationTypein classPipeline- Parameters:
type- insulation type (e.g., "polyurethane", "mineral wool", "aerogel")
-
setHeatTransferProfile
public void setHeatTransferProfile(double[] profile) Set heat transfer coefficient profile along the pipe.Allows different U-values at different positions (e.g., buried vs exposed sections).
- Parameters:
profile- Array of U-values [W/(m²·K)], one per section
-
getHeatTransferProfile
public double[] getHeatTransferProfile()Get the heat transfer coefficient profile.- Returns:
- Array of U-values or null if constant
-
setSurfaceTemperatureProfile
public void setSurfaceTemperatureProfile(double[] profile) Set surface temperature profile along the pipe.Allows different ambient temperatures at different positions (e.g., varying seabed depth).
- Parameters:
profile- Array of surface temperatures [K], one per section
-
getSurfaceTemperatureProfile
public double[] getSurfaceTemperatureProfile()Get the surface temperature profile.- Returns:
- Array of surface temperatures or null if constant
-
setWallProperties
public void setWallProperties(double thickness, double density, double heatCapacity) Set pipe wall properties for transient thermal calculations.- Parameters:
thickness- Wall thickness [m]density- Wall material density [kg/m³]heatCapacity- Wall specific heat capacity [J/(kg·K)]
-
getWallThickness
public double getWallThickness()Get pipe wall thickness.- Specified by:
getWallThicknessin interfacePipeLineInterface- Overrides:
getWallThicknessin classPipeline- Returns:
- Wall thickness [m]
-
setSoilThermalResistance
public void setSoilThermalResistance(double resistance) Set soil/burial thermal resistance.For buried pipelines, this adds thermal resistance between pipe outer wall and ambient. The effective U-value becomes: U_eff = 1 / (1/U + R_soil)
- Parameters:
resistance- Soil thermal resistance [m²·K/W]
-
getSoilThermalResistance
public double getSoilThermalResistance()Get soil thermal resistance.- Returns:
- Soil thermal resistance [m²·K/W]
-
getThermalCalculator
Get or create the multi-layer thermal calculator.If not yet created, initializes with current pipe geometry. The calculator allows defining multiple radial thermal layers (steel wall, insulation, coatings, etc.) for accurate heat transfer calculations.
- Returns:
- MultilayerThermalCalculator instance
-
setThermalCalculator
Set a pre-configured thermal calculator.- Parameters:
calculator- Configured MultilayerThermalCalculator
-
setUseMultilayerThermalModel
public void setUseMultilayerThermalModel(boolean enable) Enable multi-layer thermal model for OLGA-style radial heat transfer.When enabled, uses the MultilayerThermalCalculator for accurate heat transfer with proper modeling of:
- Steel pipe wall thermal mass and conductivity
- Insulation layers (PU foam, syntactic, aerogel, etc.)
- Coating layers (FBE, 3LPE, etc.)
- Concrete weight coating
- Burial/soil effects
- Parameters:
enable- true to use multi-layer model, false to use simple U-value
-
isUseMultilayerThermalModel
public boolean isUseMultilayerThermalModel()Check if multi-layer thermal model is enabled.- Returns:
- true if using multi-layer thermal model
-
configureSubseaThermalModel
public void configureSubseaThermalModel(double insulationThickness, double concreteThickness, RadialThermalLayer.MaterialType insulationMaterial) Configure standard subsea pipe thermal model.Creates a typical subsea configuration with:
- Steel wall
- FBE corrosion coating
- Insulation (optional)
- Concrete weight coating (optional)
- Parameters:
insulationThickness- Insulation thickness [m], 0 for uninsulatedconcreteThickness- Concrete coating thickness [m], 0 for noneinsulationMaterial- Type of insulation material
-
configureBuriedThermalModel
public void configureBuriedThermalModel(double burialDepth, boolean wetSoil) Configure buried onshore pipe thermal model.- Parameters:
burialDepth- Depth of cover [m]wetSoil- true for wet soil, false for dry
-
calculateCooldownTime
Calculate cooldown time from current state to a target temperature.Estimates shutdown cooldown time, useful for hydrate prevention planning.
- Parameters:
targetTemperature- Target temperatureunit- Temperature unit ("K" or "C")- Returns:
- Cooldown time in hours
-
calculateHydrateCooldownTime
public double calculateHydrateCooldownTime()Calculate cooldown time to hydrate formation temperature.- Returns:
- Cooldown time in hours, or infinity if hydrate temp not set
-
getThermalSummary
Get thermal summary including U-value and layer details.- Returns:
- Formatted thermal summary string
-
setEnableJouleThomson
public void setEnableJouleThomson(boolean enable) Enable or disable Joule-Thomson effect.When enabled, temperature drops due to pressure reduction are calculated. This is important for gas pipelines with significant pressure drop.
- Parameters:
enable- true to enable J-T effect
-
isJouleThomsonEnabled
public boolean isJouleThomsonEnabled()Check if Joule-Thomson effect is enabled.- Returns:
- true if J-T effect is modeled
-
setHydrateFormationTemperature
Set hydrate formation temperature for risk monitoring.- Parameters:
temperature- Hydrate formation temperatureunit- Temperature unit ("K" or "C")
-
getHydrateFormationTemperature
public double getHydrateFormationTemperature()Get hydrate formation temperature.- Returns:
- Hydrate formation temperature [K], or 0 if not set
-
setWaxAppearanceTemperature
Set wax appearance temperature for risk monitoring.- Parameters:
temperature- Wax appearance temperatureunit- Temperature unit ("K" or "C")
-
getWaxAppearanceTemperature
public double getWaxAppearanceTemperature()Get wax appearance temperature.- Returns:
- Wax appearance temperature [K], or 0 if not set
-
getHydrateRiskSections
public boolean[] getHydrateRiskSections()Get sections with hydrate formation risk.- Returns:
- Array of booleans, true where temperature is below hydrate formation temperature
-
getWaxRiskSections
public boolean[] getWaxRiskSections()Get sections with wax deposition risk.- Returns:
- Array of booleans, true where temperature is below wax appearance temperature
-
hasHydrateRisk
public boolean hasHydrateRisk()Check if any section has hydrate risk.- Returns:
- true if any section temperature is below hydrate formation temperature
-
hasWaxRisk
public boolean hasWaxRisk()Check if any section has wax risk.- Returns:
- true if any section temperature is below wax appearance temperature
-
getTemperatureProfile
Get temperature profile with specified unit.- Parameters:
unit- Temperature unit ("K", "C", or "F")- Returns:
- Temperature profile in the specified unit
-
getWallTemperatureProfile
public double[] getWallTemperatureProfile()Get the pipe wall temperature profile.- Returns:
- Wall temperature profile [K], or null if not calculated
-
getHydrateRiskSectionCount
public int getHydrateRiskSectionCount()Get number of sections with hydrate risk.- Returns:
- Count of sections below hydrate formation temperature
-
getFirstHydrateRiskSection
public int getFirstHydrateRiskSection()Get first section index with hydrate risk.- Returns:
- Section index where hydrate risk first occurs, or -1 if no risk
-
getDistanceToHydrateRisk
public double getDistanceToHydrateRisk()Get distance to first hydrate risk location.- Returns:
- Distance [m] from inlet to first hydrate risk, or -1 if no risk
-