Class TransientPipe
- All Implemented Interfaces:
Serializable, Runnable, PipeLineInterface, ProcessEquipmentInterface, TwoPortInterface, SimulationInterface, NamedInterface
Features
- Drift-flux model for gas-liquid slip (Zuber-Findlay formulation)
- Mechanistic flow regime detection (Taitel-Dukler, Barnea)
- Three-phase gas-oil-water flow with volume-weighted liquid property averaging
- Liquid accumulation tracking at terrain low points
- Lagrangian slug tracking for terrain-induced slugging
- Integration with NeqSim thermodynamics (SRK, PR, CPA equations of state)
- AUSM+ numerical flux scheme with adaptive CFL-based time stepping
Basic Usage
// Create two-phase fluid
SystemInterface fluid = new SystemSrkEos(300, 50);
fluid.addComponent("methane", 0.8);
fluid.addComponent("n-pentane", 0.2);
fluid.setMixingRule("classic");
fluid.setMultiPhaseCheck(true);
// Create inlet stream
Stream inlet = new Stream("inlet", fluid);
inlet.setFlowRate(5, "kg/sec");
inlet.run();
// Create and configure transient pipe
TransientPipe pipe = new TransientPipe("Pipeline", inlet);
pipe.setLength(1000); // 1000 m total length
pipe.setDiameter(0.2); // 200 mm inner diameter
pipe.setNumberOfSections(50); // 50 computational cells
pipe.setMaxSimulationTime(60); // 60 seconds simulation
// Run simulation
pipe.run();
// Access results
double[] pressures = pipe.getPressureProfile();
double[] holdups = pipe.getLiquidHoldupProfile();
Terrain Pipeline Example
TransientPipe pipe = new TransientPipe("TerrainPipe", inlet);
pipe.setLength(2000);
pipe.setDiameter(0.3);
pipe.setNumberOfSections(40);
// Define elevation profile with low point
double[] elevations = new double[40];
for (int i = 0; i < 40; i++) {
double x = i * 50.0;
if (x < 500)
elevations[i] = 0;
else if (x < 1000)
elevations[i] = -20 * (x - 500) / 500;
else if (x < 1500)
elevations[i] = -20 + 20 * (x - 1000) / 500;
else
elevations[i] = 0;
}
pipe.setElevationProfile(elevations);
pipe.run();
// Check liquid accumulation
LiquidAccumulationTracker accumTracker = pipe.getAccumulationTracker();
for (AccumulationZone zone : accumTracker.getAccumulationZones()) {
System.out.println("Accumulation at: " + zone.getPosition() + " m");
}
Physical Model
The drift-flux model relates gas velocity to mixture velocity:v_G = C₀ · v_m + v_dwhere C₀ is the distribution coefficient (typically 1.0-1.2) and v_d is the drift velocity. Flow regime-dependent correlations from Bendiksen (1984) and Harmathy (1960) provide closure.
Numerical Method
The model solves conservation equations using an explicit finite volume scheme with AUSM+ flux splitting. Time stepping is adaptive based on CFL condition for numerical stability.References
- Taitel, Y. and Dukler, A.E. (1976) - AIChE Journal 22(1)
- Barnea, D. (1987) - Int. J. Multiphase Flow 13(1)
- Bendiksen, K.H. (1984) - Int. J. Multiphase Flow 10(4)
- Zuber, N. and Findlay, J.A. (1965) - J. Heat Transfer 87(4)
- Version:
- 1.0
- Author:
- Even Solbraa
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumBoundary condition types for inlet and outlet. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate LiquidAccumulationTrackerprivate doubleprivate doubleBurial depth in meters.private booleanFlag for buried pipe.private doubleprivate doubleCoating thermal conductivity in W/(m·K).private doubleCoating thickness in meters.private doubleprivate intprivate Stringprivate doubleprivate doubleprivate doubleprivate DriftFluxModelprivate doubleprivate doubleprivate double[]private doubleprivate FlowRegimeDetectorprivate double[]private static final doubleprivate intprivate intprivate double[]private booleanprivate TransientPipe.BoundaryConditionprivate doubleprivate doubleprivate doubleInner heat transfer coefficient.private doubleInsulation thermal conductivity in W/(m·K).private doubleInsulation thickness in meters.private StringInsulation type.private booleanprivate doubleprivate doubleprivate double[]private double[]private intprivate static final org.apache.logging.log4j.Loggerprivate doubleprivate Stringprivate doubleprivate doubleprivate PipeMechanicalDesignCalculatorprivate doubleprivate intprivate doubleOuter heat transfer coefficient.private TransientPipe.BoundaryConditionprivate doubleprivate booleanprivate doubleprivate doubleprivate doubleprivate StringPipe material.private StringPipe schedule.private doublePipe wall thermal conductivity in W/(m·K).private double[][]private double[]private SystemInterfaceprivate doubleprivate PipeSection[]private static final longprivate doubleprivate SlugTrackerprivate doubleSoil thermal conductivity.private double[]private intprivate intprivate booleanprivate doubleFields 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
ConstructorsConstructorDescriptionDefault constructor.TransientPipe(String name) Constructor with name.TransientPipe(String name, StreamInterface inletStream) Constructor with name and inlet stream. -
Method Summary
Modifier and TypeMethodDescriptionprivate voidaddSourceTerms(double[] U, PipeSection section, double dt) Add source terms (gravity and friction) to the momentum equation.private voidadvanceTimeStep(double dt) Advance solution by one time step using finite volume method.private voidApply boundary conditions.private double[]calculateAUSMFlux(PipeSection left, PipeSection right) Calculate AUSM+ numerical flux at interface.private double[][]calculateFluxes(PipeSection[] oldSections) Calculate fluxes at cell interfaces using AUSM+ scheme.doubleCalculate hoop stress at operating pressure.doubleCalculate Maximum Allowable Operating Pressure (MAOP).doubleCalculate minimum required wall thickness based on design code.doubleCalculate the overall heat transfer coefficient based on pipe buildup.doubleCalculate hydrostatic test pressure.private doubleCalculate adaptive time step based on CFL condition.doublecalculateVonMisesStress(double deltaT) Calculate von Mises equivalent stress.private voidCheck for steady-state convergence.private voidCheck for terrain-induced slugging.Generate a mechanical design report.Get the liquid accumulation tracker.doubleGet the ambient temperature.doublegetAngle()Get the angle of the pipe from horizontal.doubleGet the burial depth.Getter for property calcIdentifier.doubleGet the coating thermal conductivity.doubleGet the coating thickness.doubleGet the corrosion allowance.Get the design code.doubleGet design pressure.doubleGet maximum design temperature.doubleGet pipe inner diameter.doubleGet the elevation change from inlet to outlet.doubleGet energy residual from last time step.Get the determined flow regime.doubleGet the friction factor.double[]Get gas velocity profile at end of simulation.doubleGet the overall heat transfer coefficient.doubleGet the inlet elevation above reference.Get inlet Stream of twoport.doubleGet the inner (fluid-side) heat transfer coefficient.doubleGet the insulation thermal conductivity.doubleGet the insulation thickness.Get the insulation type/material.doubleGet Joule-Thomson coefficient for temperature change during gas expansion.doubleGet total pipe length.doubleGet the liquid holdup fraction.double[]Get liquid holdup profile at end of simulation.double[]Get liquid velocity profile at end of simulation.intGet the location class.doubleGet MAOP in specified unit.private doubleGet the controlling mass flow rate for pressure profile calculation.doubleGet mass residual from last time step.Get the pipe material grade.Get the mechanical design calculator for this pipeline.getName()Getter for the fieldname.intGet number of computational increments/segments.intGet number of pipe legs/segments.private PipeMechanicalDesignCalculatorGet or create the mechanical design calculator.doubleGet the outer (external) heat transfer coefficient.doubleGet the outlet elevation above reference.doubleGet the current outlet mass flow rate.doublegetOutletPressure(String unit) Get the outlet pressure.Get outlet Stream of twoport.doublegetOutletTemperature(String unit) Get the outlet temperature.doubleGet overall heat transfer coefficient.getPipe()Get the underlying flow system (for advanced models).doubleGet pipe material elasticity (Young's modulus).Get the pipe material.Get the pipe schedule.doubleGet the pipe wall thermal conductivity.doubleGet the pipe wall roughness.doubleGet the total pressure drop across the pipeline.double[][]Get pressure history over simulation time.double[]Get the pressure profile along the pipe.doubleGet the Reynolds number for the flow.doubleGet pipe wall roughness.Get all pipe sections with their state variables.doubleGet current simulation time.Get the slug tracker for detailed slug analysis.doubleGet the soil thermal conductivity.doublegetSuperficialVelocity(int phaseNumber) Get the superficial velocity for a specific phase.double[]Get temperature profile at end of simulation.intGet total number of time steps taken during simulation.doubleGet the flow velocity in the pipe.doubleGet pipe wall thickness.private voidInitialize pipe state from inlet stream.voidInitialize the discretized pipe sections.private voidInitialize sub-models for flow regime detection, drift-flux, and slug tracking.booleanCheck if the pipe is operating in adiabatic mode.booleanisBuried()Check if the pipe is buried.booleanCheck if simulation has converged.booleanCheck if heat transfer is enabled.booleanCheck if the mechanical design is within allowable stress limits.voidrun()Run the transient simulation.voidRun with calculation identifier.voidrunTransient(double dt, UUID id) Run transient simulation for a specified time step.voidsetAdiabatic(boolean adiabatic) Set whether the pipe operates in adiabatic mode.voidsetAmbientTemperature(double temperature) Set the ambient temperature.voidsetAmbientTemperatures(double[] temperatures) Set ambient/surrounding temperatures for each pipe segment.voidsetAngle(double angle) Set the angle of the pipe from horizontal.voidsetBurialDepth(double depth) Set the burial depth below ground surface.voidsetBuried(boolean buried) Set whether the pipe is buried.voidSetter for property calcIdentifier.voidsetCflNumber(double cfl) Set CFL number for adaptive time stepping.voidsetCoatingConductivity(double conductivity) Set the coating thermal conductivity.voidsetCoatingThickness(double thickness) Set the coating thickness.voidsetConstantSurfaceTemperature(double temperature) Set the constant surface temperature for heat transfer.voidsetCorrosionAllowance(double allowance) Set the corrosion allowance.voidsetDesignCode(String code) Set the design code for wall thickness and pressure calculations.voidsetDesignPressure(double pressure) Set design pressure for mechanical design calculations.voidsetDesignPressure(double pressure, String unit) Set design pressure with unit.voidsetDesignTemperature(double temperature) Set maximum design temperature for mechanical design.voidsetDiameter(double diameter) Set pipe inner diameter.voidsetElevation(double elevation) Set the elevation change from inlet to outlet.voidsetElevationProfile(double[] profile) Set elevation profile along the pipe.voidsetHeatTransferCoefficient(double coefficient) Set the overall heat transfer coefficient.voidsetHeightProfile(double[] heights) Set the height profile along the pipe.voidsetInclinationProfile(double[] profile) Set inclination profile along the pipe.voidsetIncludeHeatTransfer(boolean include) Enable or disable heat transfer calculations.voidsetInitialFlowPattern(String flowPattern) Set initial flow pattern for simulation initialization.voidSet inlet boundary condition type.voidsetInletElevation(double inletElevation) Set the inlet elevation above reference.voidsetInletMassFlow(double flow) voidsetInletPressure(double pressure) Set the inlet pressure value.voidsetinletPressureValue(double pressure) Deprecated.voidsetInletStream(StreamInterface stream) Set inlet Stream of twoport.voidsetInnerHeatTransferCoefficient(double coefficient) Set the inner (fluid-side) heat transfer coefficient.voidsetInsulationConductivity(double conductivity) Set the insulation thermal conductivity.voidsetInsulationThickness(double thickness) Set the insulation thickness.voidsetInsulationType(String insulationType) Set the insulation type/material.voidsetLegPositions(double[] positions) Set the position of each leg along the pipe.voidsetLength(double length) Set total pipe length.voidsetLocationClass(int locClass) Set the location class per ASME B31.8.voidsetMaterialGrade(String grade) Set the pipe material grade per API 5L.voidsetMaxSimulationTime(double time) Set maximum simulation time.voidSetter for the fieldname.voidsetNumberOfIncrements(int numberOfIncrements) Set number of computational increments/segments.voidsetNumberOfLegs(int number) Set number of pipe legs/segments.voidsetNumberOfNodesInLeg(int number) Set number of computational nodes in each leg.voidsetNumberOfSections(int n) Set number of computational cells (sections).voidsetOuterHeatTransferCoefficient(double coefficient) Set the outer (external) heat transfer coefficient.voidsetOuterHeatTransferCoefficients(double[] coefficients) Set outer heat transfer coefficients for each pipe segment.voidsetOuterTemperatures(double[] outerTemp) Set outer temperatures for heat transfer calculations.voidvoidsetOutletElevation(double outletElevation) Set the outlet elevation above reference.voidsetOutletMassFlow(double flow) Set the outlet mass flow rate.voidsetOutletPressure(double pressure) Set the outlet pressure value.voidsetoutletPressureValue(double pressure) Deprecated.UsesetOutletPressure(double)insteadvoidsetOutletStream(StreamInterface stream) Set outlet Stream of twoport.voidsetOutPressure(double pressure) Set outlet pressure of twoport.voidsetOutputFileName(String name) Set output file name for detailed results.voidsetOutTemperature(double temperature) Set outlet temperature of twoport.voidsetOverallHeatTransferCoeff(double coeff) Set overall heat transfer coefficient.voidsetPipeDiameters(double[] diameters) Set pipe diameters for each segment.voidsetPipeMaterial(String material) Set the pipe material.voidsetPipeSchedule(String schedule) Set the pipe schedule.voidsetPipeSpecification(double nominalDiameter, String specification) Set pipe specification from database.voidsetPipeWallConductivity(double conductivity) Set the pipe wall thermal conductivity.voidsetPipeWallRoughness(double roughness) Set the pipe wall roughness.voidsetPipeWallRoughness(double[] rough) Set wall roughness for each segment.voidsetRoughness(double roughness) Set pipe wall roughness.voidsetSoilConductivity(double conductivity) Set the soil thermal conductivity.voidsetThermodynamicUpdateInterval(int interval) Set interval for thermodynamic property updates.voidsetUpdateThermodynamics(boolean update) Enable or disable thermodynamic updates during simulation.voidsetWallHeatTransferCoefficients(double[] coefficients) Set inner (wall) heat transfer coefficients for each pipe segment.voidsetWallThickness(double thickness) Set the pipe wall thickness.private doublesplitMachMinus(double M) private doublesplitMachPlus(double M) private doublesplitPressureMinus(double M, double p) private doublesplitPressurePlus(double M, double p) private voidStore pressure history for time series analysis.private voidStore current results.private voidUpdate pressure at boundary sections only to maintain boundary condition consistency.private voidUpdate flow regimes for all sections.private voidUpdate inlet boundary conditions from the current inlet stream state.private voidUpdates the outlet boundary conditions from the current outlet stream state.private voidUpdate outlet stream with final conditions including flow rate.private voidUpdate pressure profile based on friction and gravity pressure gradients.private voidupdatePrimitiveVariables(PipeSection section, PipeSection oldSection, double[] U, int sectionIndex, double dt, double momentumFluxLeft, double momentumFluxRight) Update primitive variables from conservative variables.private voidUpdate thermodynamic properties using NeqSim flash.Methods inherited from class TwoPortEquipment
getInletPressure, getInletTemperature, getMassBalance, getOutletPressure, getOutletTemperature, setInletTemperature, setOutletPressure, setOutletTemperature, setOutletTemperature, toJson, toJson, validateSetupMethods inherited from class ProcessEquipmentBaseClass
copy, displayResult, equals, getConditionAnalysisMessage, getController, getEffectiveCapacityFactor, getEnergyStream, getEntropyProduction, getExergyChange, getFailureMode, getMassBalance, getMechanicalDesign, getMinimumFlow, getPressure, getPressure, getProperty, getReport_json, getResultTable, getSpecification, getTemperature, getTemperature, getThermoSystem, hashCode, initMechanicalDesign, 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, getTime, increaseTime, isRunInSteps, setCalculateSteadyState, setRunInSteps, setTimeMethods inherited from class NamedBaseClass
getTagName, setTagNameMethods inherited from class Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface NamedInterface
getTagName, setTagNameMethods inherited from interface PipeLineInterface
setOutletTemperatureMethods inherited from interface ProcessEquipmentInterface
getCapacityDuty, getCapacityMax, getExergyChange, getFluid, getOperatingEnvelopeViolation, getRestCapacity, getSimulationValidationErrors, isSimulationValid, isWithinOperatingEnvelope, needRecalculationMethods inherited from interface SimulationInterface
getCalculateSteadyState, getTime, increaseTime, isRunInSteps, run_step, run_step, runTransient, setCalculateSteadyState, setRunInSteps, setTime, solvedMethods inherited from interface TwoPortInterface
getInletPressure, getInletTemperature, getInStream, getOutletPressure, getOutletTemperature, getOutStream, setInletTemperature, setOutletPressure, setOutletTemperature, setOutPressure, setOutTemperature
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
logger
private static final org.apache.logging.log4j.Logger logger -
GRAVITY
private static final double GRAVITY- See Also:
-
length
private double length -
diameter
private double diameter -
roughness
private double roughness -
numberOfSections
private int numberOfSections -
wallThickness
private double wallThickness -
pipeElasticity
private double pipeElasticity -
elevationProfile
private double[] elevationProfile -
inclinationProfile
private double[] inclinationProfile -
sections
-
dx
private double dx -
simulationTime
private double simulationTime -
maxSimulationTime
private double maxSimulationTime -
dt
private double dt -
cflNumber
private double cflNumber -
minTimeStep
private double minTimeStep -
maxTimeStep
private double maxTimeStep -
flowRegimeDetector
-
driftFluxModel
-
accumulationTracker
-
slugTracker
-
inletBCType
-
outletBCType
-
inletPressureValue
private double inletPressureValue -
outletPressureValue
private double outletPressureValue -
outletPressureExplicitlySet
private boolean outletPressureExplicitlySet -
inletMassFlow
private double inletMassFlow -
outletMassFlow
private double outletMassFlow -
includeHeatTransfer
private boolean includeHeatTransfer -
ambientTemperature
private double ambientTemperature -
overallHeatTransferCoeff
private double overallHeatTransferCoeff -
jouleThomsonCoeff
private double jouleThomsonCoeff -
referenceFluid
-
updateThermodynamics
private boolean updateThermodynamics -
thermodynamicUpdateInterval
private int thermodynamicUpdateInterval -
currentStep
private int currentStep -
pressureProfile
private double[] pressureProfile -
temperatureProfile
private double[] temperatureProfile -
liquidHoldupProfile
private double[] liquidHoldupProfile -
gasVelocityProfile
private double[] gasVelocityProfile -
liquidVelocityProfile
private double[] liquidVelocityProfile -
pressureHistory
private double[][] pressureHistory -
historyInterval
private int historyInterval -
historyIndex
private int historyIndex -
massResidual
private double massResidual -
energyResidual
private double energyResidual -
isConverged
private boolean isConverged -
totalTimeSteps
private int totalTimeSteps -
mechanicalDesignCalculator
-
designPressure
private double designPressure -
designTemperature
private double designTemperature -
materialGrade
-
designCode
-
locationClass
private int locationClass -
corrosionAllowance
private double corrosionAllowance -
pipeMaterial
Pipe material. -
pipeSchedule
Pipe schedule. -
pipeWallConductivity
private double pipeWallConductivityPipe wall thermal conductivity in W/(m·K). -
insulationThickness
private double insulationThicknessInsulation thickness in meters. -
insulationConductivity
private double insulationConductivityInsulation thermal conductivity in W/(m·K). -
insulationType
Insulation type. -
coatingThickness
private double coatingThicknessCoating thickness in meters. -
coatingConductivity
private double coatingConductivityCoating thermal conductivity in W/(m·K). -
innerHeatTransferCoefficient
private double innerHeatTransferCoefficientInner heat transfer coefficient. -
outerHeatTransferCoefficient
private double outerHeatTransferCoefficientOuter heat transfer coefficient. -
burialDepth
private double burialDepthBurial depth in meters. -
soilConductivity
private double soilConductivitySoil thermal conductivity. -
buried
private boolean buriedFlag for buried pipe.
-
-
Constructor Details
-
TransientPipe
public TransientPipe()Default constructor. Creates a TransientPipe with default name "TransientPipe". -
TransientPipe
Constructor with name.- Parameters:
name- Pipe name used for identification in process systems
-
TransientPipe
Constructor with name and inlet stream. This is the recommended constructor for typical usage. The inlet stream provides initial conditions (composition, temperature, pressure, flow rate) for the simulation.- Parameters:
name- Pipe name used for identification in process systemsinletStream- Inlet stream containing fluid properties and flow conditions
-
-
Method Details
-
initializeSubModels
private void initializeSubModels()Initialize sub-models for flow regime detection, drift-flux, and slug tracking. -
initializePipe
public void initializePipe()Initialize the discretized pipe sections. Creates the computational mesh based on pipe length and number of sections. Also initializes elevation/inclination profiles and identifies low points for liquid accumulation tracking. This method is called automatically byrun()if sections have not been initialized. It can also be called explicitly to inspect the mesh before running. Note: The number of sections determines spatial resolution. For accurate slug tracking, use at least 20 sections. Typical guideline: dx ≈ 10-50 pipe diameters. -
initializeFromStream
private void initializeFromStream()Initialize pipe state from inlet stream. -
run
public void run()Run the transient simulation.- Specified by:
runin interfaceRunnable- Specified by:
runin interfaceSimulationInterface
-
run
Run with calculation identifier.- Specified by:
runin interfaceSimulationInterface- Parameters:
id- Calculation identifier
-
runTransient
Run transient simulation for a specified time step. This method advances the pipe simulation by the specified time stepdt, making it suitable for use within aProcessSystem.runTransient(double, java.util.UUID)loop. Unlikerun(), which runs the complete simulation tomaxSimulationTime, this method performs incremental time-stepping that can be coordinated with other equipment. On the first call, the pipe is initialized from the inlet stream. Subsequent calls advance the simulation state incrementally. The method uses adaptive sub-stepping internally to maintain numerical stability (CFL condition) while advancing by the requesteddt. Usage Example:
Note: The inlet stream conditions are re-read at each call, allowing dynamic boundary conditions. If the inlet flow rate or composition changes, the pipe simulation will respond accordingly.ProcessSystem process = new ProcessSystem(); process.add(inlet); process.add(transientPipe); process.add(separator); process.run(); // Initial steady state // Transient loop for (int i = 0; i < 100; i++) { // Optionally change inlet conditions here process.runTransient(1.0); // Advance 1 second System.out.println("Outlet pressure: " + separator.getGasOutStream().getPressure()); }- Specified by:
runTransientin interfaceSimulationInterface- Parameters:
dt- Time step to advance in seconds. The method will use internal sub-stepping if required for numerical stability.id- Calculation identifier for tracking- See Also:
-
updateInletFromStream
private void updateInletFromStream()Update inlet boundary conditions from the current inlet stream state. This method is called duringrunTransient(double, UUID)to capture any changes in the inlet stream conditions (flow rate, pressure, composition) that may have occurred since the last time step. -
updateOutletFromStream
private void updateOutletFromStream()Updates the outlet boundary conditions from the current outlet stream state. This method is called duringrunTransient(double, UUID)to capture any changes in the outlet stream conditions when using CONSTANT_FLOW outlet boundary condition. This allows external controllers or other process equipment to set the outlet flow rate on the outlet stream, which is then read back into the pipe model. -
calculateTimeStep
private double calculateTimeStep()Calculate adaptive time step based on CFL condition.Uses the full eigenvalue structure for hyperbolic systems. The characteristic wave speeds for multiphase flow are approximately |u ± c| where u is the mixture velocity and c is the mixture sound speed. We take the maximum of all four wave speeds: |u_G + c|, |u_G - c|, |u_L + c|, |u_L - c| to ensure stability for both forward and backward propagating waves.
- Returns:
- time step (s)
-
advanceTimeStep
private void advanceTimeStep(double dt) Advance solution by one time step using finite volume method.- Parameters:
dt- time step (s)
-
getMassFlowForPressureProfile
private double getMassFlowForPressureProfile()Get the controlling mass flow rate for pressure profile calculation. Returns the appropriate mass flow rate based on boundary conditions:- CONSTANT_FLOW inlet: use inlet mass flow
- CONSTANT_FLOW outlet: use outlet mass flow
- Both CONSTANT_PRESSURE: use inlet mass flow as fallback
- Returns:
- Mass flow rate in kg/s
-
updateBoundaryPressures
private void updateBoundaryPressures()Update pressure at boundary sections only to maintain boundary condition consistency.Interior section pressures are computed from the momentum equation to preserve momentum conservation. Only boundary-adjacent sections are updated to ensure proper pressure gradient at boundaries.
-
updatePressureProfile
private void updatePressureProfile()Update pressure profile based on friction and gravity pressure gradients.Legacy method: Marches from inlet to outlet (or outlet to inlet), computing pressure drop in each cell based on the local friction and gravity gradients. This ensures the pressure profile is consistent with the flow. For single-phase flow, uses the direct Darcy-Weisbach calculation.
Note: This method is preserved for compatibility but is no longer called in transient mode to avoid overriding momentum-conserving pressure from the conservative solver.
-
calculateFluxes
Calculate fluxes at cell interfaces using AUSM+ scheme. For interior interfaces, the AUSM+ upwind scheme is used. For boundary interfaces, the fluxes are set according to the boundary conditions to ensure mass and momentum conservation:- CONSTANT_FLOW: Flux is set to the specified mass flow rate
- CONSTANT_PRESSURE: Flux is computed from the AUSM scheme
- CLOSED: Zero flux
- Parameters:
oldSections- array of pipe sections from the previous time step- Returns:
- 2D array of fluxes [section][conserved variable index]
-
calculateAUSMFlux
Calculate AUSM+ numerical flux at interface.- Parameters:
left- left pipe sectionright- right pipe section- Returns:
- flux array [mass_L, mass_G, momentum_L, momentum_G]
-
splitMachPlus
private double splitMachPlus(double M) -
splitMachMinus
private double splitMachMinus(double M) -
splitPressurePlus
private double splitPressurePlus(double M, double p) -
splitPressureMinus
private double splitPressureMinus(double M, double p) -
addSourceTerms
Add source terms (gravity and friction) to the momentum equation. The momentum equation in conservative form is:∂(ρu)/∂t + ∂(ρu² + p)/∂x = -ρg sin(θ) - τ_w/A
Where the source terms are:- Gravity: S_g = -ρ_m · g · sin(θ) [kg/(m²·s²)]
- Friction: S_f = -dP/dx_friction [kg/(m²·s²)]
- Parameters:
U- conserved variable array to be modified in-placesection- pipe section for which to calculate source termsdt- time step size in seconds
-
updatePrimitiveVariables
private void updatePrimitiveVariables(PipeSection section, PipeSection oldSection, double[] U, int sectionIndex, double dt, double momentumFluxLeft, double momentumFluxRight) Update primitive variables from conservative variables.This method converts from conservative variables (densities, momentum, energy) back to primitive variables (holdups, velocities, temperature, pressure). Interior cell pressures are computed from the momentum equation residual to properly capture acoustic wave propagation.
- Parameters:
section- Current section to updateoldSection- Previous time step section stateU- Conservative variables [ρ_G·α_G, ρ_L·α_L, ρ_m·u, ρ_m·E]sectionIndex- Index of this section (0 to numberOfSections-1)dt- Time step (s)momentumFluxLeft- Momentum flux at left face (Pa)momentumFluxRight- Momentum flux at right face (Pa)
-
applyBoundaryConditions
private void applyBoundaryConditions()Apply boundary conditions. -
updateFlowRegimes
private void updateFlowRegimes()Update flow regimes for all sections. -
checkTerrainSlugging
private void checkTerrainSlugging()Check for terrain-induced slugging. -
updateThermodynamicProperties
private void updateThermodynamicProperties()Update thermodynamic properties using NeqSim flash. -
checkConvergence
private void checkConvergence()Check for steady-state convergence. -
storeResults
private void storeResults()Store current results. -
storeHistory
private void storeHistory()Store pressure history for time series analysis. -
updateOutletStream
private void updateOutletStream()Update outlet stream with final conditions including flow rate. This method updates the outlet stream with:- Pressure from the outlet pipe section
- Temperature from the outlet pipe section
- Mass flow rate calculated from outlet section velocity and density
-
getName
Description copied from class:NamedBaseClassGetter for the field
name.- Specified by:
getNamein interfaceNamedInterface- Overrides:
getNamein classNamedBaseClass- Returns:
- a
Stringobject
-
setName
Description copied from class:NamedBaseClassSetter for the field
name.- Specified by:
setNamein interfaceNamedInterface- Overrides:
setNamein classNamedBaseClass- Parameters:
name- aStringobject
-
setLength
public void setLength(double length) Set total pipe length.- Specified by:
setLengthin interfacePipeLineInterface- Parameters:
length- Pipe length in meters
-
getLength
public double getLength()Get total pipe length.- Specified by:
getLengthin interfacePipeLineInterface- Returns:
- Pipe length in meters
-
setDiameter
public void setDiameter(double diameter) Set pipe inner diameter.- Specified by:
setDiameterin interfacePipeLineInterface- Parameters:
diameter- Inner diameter in meters
-
getDiameter
public double getDiameter()Get pipe inner diameter.- Specified by:
getDiameterin interfacePipeLineInterface- Returns:
- Inner diameter in meters
-
getRoughness
public double getRoughness()Get pipe wall roughness.- Returns:
- Wall roughness in meters
-
getWallThickness
public double getWallThickness()Get pipe wall thickness.- Specified by:
getWallThicknessin interfacePipeLineInterface- Returns:
- Wall thickness in meters
-
getPipeElasticity
public double getPipeElasticity()Get pipe material elasticity (Young's modulus).- Returns:
- Elasticity in Pascals
-
isIncludeHeatTransfer
public boolean isIncludeHeatTransfer()Check if heat transfer is enabled.- Returns:
- true if heat transfer is included in calculations
-
setIncludeHeatTransfer
public void setIncludeHeatTransfer(boolean include) Enable or disable heat transfer calculations.When enabled, the energy equation is solved to calculate temperature changes along the pipe due to:
- Heat transfer to/from surroundings (ambient)
- Joule-Thomson effect (gas expansion cooling)
- Friction heating (viscous dissipation)
- Elevation work
- Parameters:
include- true to enable heat transfer calculations
-
getAmbientTemperature
public double getAmbientTemperature()Get the ambient temperature.- Specified by:
getAmbientTemperaturein interfacePipeLineInterface- Returns:
- ambient temperature in Kelvin
-
setAmbientTemperature
public void setAmbientTemperature(double temperature) Set the ambient temperature.- Specified by:
setAmbientTemperaturein interfacePipeLineInterface- Parameters:
temperature- ambient temperature in Kelvin
-
getOverallHeatTransferCoeff
public double getOverallHeatTransferCoeff()Get overall heat transfer coefficient.- Returns:
- Heat transfer coefficient in W/(m²·K)
-
setOverallHeatTransferCoeff
public void setOverallHeatTransferCoeff(double coeff) Set overall heat transfer coefficient.The overall heat transfer coefficient U accounts for all heat transfer resistances between the fluid and surroundings. Typical values:
- Bare steel pipe in still air: 5-10 W/(m²·K)
- Bare steel pipe in seawater: 200-500 W/(m²·K)
- Insulated pipe (50mm): 1-3 W/(m²·K)
- Buried pipe: 2-5 W/(m²·K)
- Parameters:
coeff- Heat transfer coefficient in W/(m²·K)
-
getJouleThomsonCoeff
public double getJouleThomsonCoeff()Get Joule-Thomson coefficient for temperature change during gas expansion.Returns the JT coefficient calculated from gas phase thermodynamics. This is automatically updated during simulation based on the fluid properties.
Typical values (at ~300K, 50 bar):
- Methane: ~4.5e-6 K/Pa (0.45 K/MPa)
- Natural gas: 2-6e-6 K/Pa
- CO2: ~1e-5 K/Pa
- Hydrogen: ~-0.3e-6 K/Pa (warms on expansion)
- Liquids: ~1e-8 K/Pa (very small)
- Returns:
- Joule-Thomson coefficient in K/Pa
-
getMassResidual
public double getMassResidual()Get mass residual from last time step.- Returns:
- Mass balance residual
-
getEnergyResidual
public double getEnergyResidual()Get energy residual from last time step.- Returns:
- Energy balance residual
-
isConverged
public boolean isConverged()Check if simulation has converged.- Returns:
- true if converged to steady-state
-
setRoughness
public void setRoughness(double roughness) Set pipe wall roughness. Used for friction factor calculation. Typical values:- New steel pipe: 0.00004 m (40 μm)
- Used steel pipe: 0.0001 m (100 μm)
- Corroded pipe: 0.0003 m (300 μm)
- Parameters:
roughness- Wall roughness in meters
-
setNumberOfSections
public void setNumberOfSections(int n) Set number of computational cells (sections). More sections provide higher spatial resolution but require more computation. Guideline: dx ≈ 10-50 pipe diameters. For slug tracking, use at least 20 sections.- Parameters:
n- Number of sections
-
setElevationProfile
public void setElevationProfile(double[] profile) Set elevation profile along the pipe. Array of elevations (meters) at each section node. The array length should match the number of sections. Positive values indicate upward elevation. Example:double[] elevations = new double[50]; for (int i = 0; i < 50; i++) { elevations[i] = 10 * Math.sin(i * Math.PI / 49); // Terrain with low point } pipe.setElevationProfile(elevations);- Parameters:
profile- Array of elevations in meters
-
setInclinationProfile
public void setInclinationProfile(double[] profile) Set inclination profile along the pipe. Array of inclination angles (radians) at each section. Positive values indicate upward inclination. Use this instead of elevation profile for constant-inclination sections.- Parameters:
profile- Array of inclination angles in radians
-
setMaxSimulationTime
public void setMaxSimulationTime(double time) Set maximum simulation time. The simulation runs until this time is reached or steady-state is achieved.- Parameters:
time- Maximum simulation time in seconds
-
getSimulationTime
public double getSimulationTime()Get current simulation time.- Returns:
- Simulation time in seconds
-
setInletBoundaryCondition
Set inlet boundary condition type.- Parameters:
bc- Boundary condition type- See Also:
-
setOutletBoundaryCondition
-
setinletPressureValue
Deprecated.UsesetInletPressure(double)insteadSet the inlet pressure value.- Parameters:
pressure- Inlet pressure in bara (bar absolute)
-
setInletPressure
public void setInletPressure(double pressure) Set the inlet pressure value.- Specified by:
setInletPressurein interfaceTwoPortInterface- Overrides:
setInletPressurein classTwoPortEquipment- Parameters:
pressure- Inlet pressure in bara (bar absolute)
-
setoutletPressureValue
Deprecated.UsesetOutletPressure(double)insteadSet the outlet pressure value.- Parameters:
pressure- Outlet pressure in bara (bar absolute)
-
setOutletPressure
public void setOutletPressure(double pressure) Set the outlet pressure value.- Specified by:
setOutletPressurein interfacePipeLineInterface- Specified by:
setOutletPressurein interfaceTwoPortInterface- Overrides:
setOutletPressurein classTwoPortEquipment- Parameters:
pressure- Outlet pressure in bara (bar absolute)
-
setInletMassFlow
public void setInletMassFlow(double flow) -
setOutletMassFlow
public void setOutletMassFlow(double flow) Set the outlet mass flow rate. Use this when the outlet flow is controlled by downstream equipment (e.g., a valve). When using CONSTANT_FLOW outlet boundary condition, this value is used to calculate the pressure profile and outlet stream properties. This can be called before each runTransient() call to update the outlet flow from downstream valve Cv calculations.- Parameters:
flow- Outlet mass flow rate in kg/s
-
getOutletMassFlow
public double getOutletMassFlow()Get the current outlet mass flow rate.- Returns:
- Outlet mass flow rate in kg/s
-
setInletStream
Description copied from class:TwoPortEquipmentSet inlet Stream of twoport.- Specified by:
setInletStreamin interfaceTwoPortInterface- Overrides:
setInletStreamin classTwoPortEquipment- Parameters:
stream- value to set
-
getOutletStream
Description copied from class:TwoPortEquipmentGet outlet Stream of twoport.- Specified by:
getOutletStreamin interfaceTwoPortInterface- Overrides:
getOutletStreamin classTwoPortEquipment- Returns:
- outlet Stream of TwoPortEquipment
-
setOutletStream
Description copied from class:TwoPortEquipmentSet outlet Stream of twoport.- Specified by:
setOutletStreamin interfaceTwoPortInterface- Overrides:
setOutletStreamin classTwoPortEquipment- Parameters:
stream- value to set
-
getPressureProfile
public double[] getPressureProfile()Get the pressure profile along the pipe.- Specified by:
getPressureProfilein interfacePipeLineInterface- Returns:
- array of pressures in bar at each increment
-
getTemperatureProfile
public double[] getTemperatureProfile()Get temperature profile at end of simulation.- Specified by:
getTemperatureProfilein interfacePipeLineInterface- Returns:
- Array of temperatures (K) at each section, or null if not run
-
getLiquidHoldupProfile
public double[] getLiquidHoldupProfile()Get liquid holdup profile at end of simulation. Liquid holdup (α_L) is the fraction of pipe cross-section occupied by liquid. Values range from 0 (all gas) to 1 (all liquid).- Specified by:
getLiquidHoldupProfilein interfacePipeLineInterface- Returns:
- Array of liquid holdups (dimensionless) at each section, or null if not run
-
getGasVelocityProfile
public double[] getGasVelocityProfile()Get gas velocity profile at end of simulation.- Returns:
- Array of gas velocities (m/s) at each section, or null if not run
-
getLiquidVelocityProfile
public double[] getLiquidVelocityProfile()Get liquid velocity profile at end of simulation.- Returns:
- Array of liquid velocities (m/s) at each section, or null if not run
-
getPressureHistory
public double[][] getPressureHistory()Get pressure history over simulation time. The history is stored at intervals specified by historyInterval. The array dimensions are [time_index][position_index].- Returns:
- 2D array of pressures (Pa), or null if not run
-
getSections
Get all pipe sections with their state variables. Each section contains detailed state information including pressure, temperature, holdups, velocities, flow regime, and other properties.- Returns:
- Array of PipeSection objects
-
getSlugTracker
Get the slug tracker for detailed slug analysis. The slug tracker contains information about active slugs, slug statistics, and slug history. Example:SlugTracker tracker = pipe.getSlugTracker(); int slugCount = tracker.getSlugCount(); double avgLength = tracker.getAverageSlugLength(); String stats = tracker.getStatisticsString();- Returns:
- SlugTracker instance
-
getAccumulationTracker
Get the liquid accumulation tracker. Tracks liquid pooling at terrain low points. Useful for identifying potential liquid loading and slug initiation locations. Example:LiquidAccumulationTracker tracker = pipe.getAccumulationTracker(); for (AccumulationZone zone : tracker.getAccumulationZones()) { System.out.println("Low point at: " + zone.getPosition()); System.out.println("Accumulated: " + zone.getAccumulatedVolume() + " m3"); }- Returns:
- LiquidAccumulationTracker instance
-
getTotalTimeSteps
public int getTotalTimeSteps()Get total number of time steps taken during simulation.- Returns:
- Number of time steps
-
setCflNumber
public void setCflNumber(double cfl) Set CFL number for adaptive time stepping. The CFL (Courant-Friedrichs-Lewy) number controls the time step size relative to the grid spacing and wave speeds. Lower values (0.3-0.5) provide more stability but slower simulation. Higher values (0.7-0.9) are faster but may become unstable.- Parameters:
cfl- CFL number, clamped to range [0.1, 1.0]
-
setThermodynamicUpdateInterval
public void setThermodynamicUpdateInterval(int interval) Set interval for thermodynamic property updates. Flash calculations are computationally expensive. This setting controls how often phase properties are recalculated. Higher values improve performance but may reduce accuracy for rapidly changing conditions.- Parameters:
interval- Update interval (number of time steps), minimum 1
-
setUpdateThermodynamics
public void setUpdateThermodynamics(boolean update) Enable or disable thermodynamic updates during simulation. When disabled, phase properties remain constant at initial values. This is appropriate for isothermal simulations or when temperature/pressure changes are small.- Parameters:
update- true to enable updates, false to disable
-
getCalculationIdentifier
Description copied from class:SimulationBaseClassGetter for property calcIdentifier.- Specified by:
getCalculationIdentifierin interfaceSimulationInterface- Overrides:
getCalculationIdentifierin classSimulationBaseClass- Returns:
- Value of calcIdentifier.
-
setCalculationIdentifier
Description copied from class:SimulationBaseClassSetter for property calcIdentifier.- Specified by:
setCalculationIdentifierin interfaceSimulationInterface- Overrides:
setCalculationIdentifierin classSimulationBaseClass- Parameters:
id- Value to set.
-
getPipe
Get the underlying flow system (for advanced models). This transient model uses internal discretization, not FlowSystemInterface.- Specified by:
getPipein interfacePipeLineInterface- Returns:
- flow system interface or null if not applicable
-
setNumberOfLegs
public void setNumberOfLegs(int number) Set number of pipe legs/segments.- Specified by:
setNumberOfLegsin interfacePipeLineInterface- Parameters:
number- number of legs
-
setHeightProfile
public void setHeightProfile(double[] heights) Set the height profile along the pipe.- Specified by:
setHeightProfilein interfacePipeLineInterface- Parameters:
heights- array of heights at each leg boundary (length = numberOfLegs + 1)
-
setLegPositions
public void setLegPositions(double[] positions) Set the position of each leg along the pipe.- Specified by:
setLegPositionsin interfacePipeLineInterface- Parameters:
positions- array of positions at each leg boundary in meters
-
setPipeDiameters
public void setPipeDiameters(double[] diameters) Set pipe diameters for each segment.- Specified by:
setPipeDiametersin interfacePipeLineInterface- Parameters:
diameters- array of diameters for each leg boundary
-
setPipeWallRoughness
public void setPipeWallRoughness(double[] rough) Set wall roughness for each segment.- Specified by:
setPipeWallRoughnessin interfacePipeLineInterface- Parameters:
rough- array of roughness values for each leg
-
setOuterTemperatures
public void setOuterTemperatures(double[] outerTemp) Set outer temperatures for heat transfer calculations.- Specified by:
setOuterTemperaturesin interfacePipeLineInterface- Parameters:
outerTemp- array of outer temperatures in Kelvin for each leg
-
setNumberOfNodesInLeg
public void setNumberOfNodesInLeg(int number) Set number of computational nodes in each leg.- Specified by:
setNumberOfNodesInLegin interfacePipeLineInterface- Parameters:
number- number of nodes per leg
-
setOutputFileName
Set output file name for detailed results.- Specified by:
setOutputFileNamein interfacePipeLineInterface- Parameters:
name- output file name
-
setInitialFlowPattern
Set initial flow pattern for simulation initialization.- Specified by:
setInitialFlowPatternin interfacePipeLineInterface- Parameters:
flowPattern- initial flow pattern (e.g., "stratified", "slug")
-
getInletStream
Get inlet Stream of twoport.- Specified by:
getInletStreamin interfaceTwoPortInterface- Overrides:
getInletStreamin classTwoPortEquipment- Returns:
- inlet Stream of TwoPortEquipment
-
setPipeWallRoughness
public void setPipeWallRoughness(double roughness) Set the pipe wall roughness.- Specified by:
setPipeWallRoughnessin interfacePipeLineInterface- Parameters:
roughness- the wall roughness in meters
-
getPipeWallRoughness
public double getPipeWallRoughness()Get the pipe wall roughness.- Specified by:
getPipeWallRoughnessin interfacePipeLineInterface- Returns:
- the wall roughness in meters
-
setElevation
public void setElevation(double elevation) Set the elevation change from inlet to outlet.- Specified by:
setElevationin interfacePipeLineInterface- Parameters:
elevation- elevation change in meters (positive = uphill)
-
getElevation
public double getElevation()Get the elevation change from inlet to outlet.- Specified by:
getElevationin interfacePipeLineInterface- Returns:
- elevation change in meters
-
setInletElevation
public void setInletElevation(double inletElevation) Set the inlet elevation above reference.- Specified by:
setInletElevationin interfacePipeLineInterface- Parameters:
inletElevation- inlet elevation in meters
-
getInletElevation
public double getInletElevation()Get the inlet elevation above reference.- Specified by:
getInletElevationin interfacePipeLineInterface- Returns:
- inlet elevation in meters
-
setOutletElevation
public void setOutletElevation(double outletElevation) Set the outlet elevation above reference.- Specified by:
setOutletElevationin interfacePipeLineInterface- Parameters:
outletElevation- outlet elevation in meters
-
getOutletElevation
public double getOutletElevation()Get the outlet elevation above reference.- Specified by:
getOutletElevationin interfacePipeLineInterface- Returns:
- outlet elevation in meters
-
getNumberOfLegs
public int getNumberOfLegs()Get number of pipe legs/segments.- Specified by:
getNumberOfLegsin interfacePipeLineInterface- Returns:
- number of legs
-
setNumberOfIncrements
public void setNumberOfIncrements(int numberOfIncrements) Set number of computational increments/segments.- Specified by:
setNumberOfIncrementsin interfacePipeLineInterface- Parameters:
numberOfIncrements- number of increments for pressure drop calculation
-
getNumberOfIncrements
public int getNumberOfIncrements()Get number of computational increments/segments.- Specified by:
getNumberOfIncrementsin interfacePipeLineInterface- Returns:
- number of increments
-
setOutPressure
public void setOutPressure(double pressure) Set outlet pressure of twoport.- Specified by:
setOutPressurein interfacePipeLineInterface- Specified by:
setOutPressurein interfaceTwoPortInterface- Parameters:
pressure- value to set in unit bara
-
setOutTemperature
public void setOutTemperature(double temperature) Set outlet temperature of twoport.- Specified by:
setOutTemperaturein interfacePipeLineInterface- Specified by:
setOutTemperaturein interfaceTwoPortInterface- Parameters:
temperature- value to set in kelvin
-
getPressureDrop
public double getPressureDrop()Get the total pressure drop across the pipeline.- Specified by:
getPressureDropin interfacePipeLineInterface- Returns:
- pressure drop in bar
-
getOutletPressure
Get the outlet pressure.- Specified by:
getOutletPressurein interfacePipeLineInterface- Parameters:
unit- pressure unit (e.g., "bara", "barg", "Pa", "MPa")- Returns:
- outlet pressure in specified unit
-
getOutletTemperature
Get the outlet temperature.- Specified by:
getOutletTemperaturein interfacePipeLineInterface- Parameters:
unit- temperature unit (e.g., "K", "C")- Returns:
- outlet temperature in specified unit
-
getVelocity
public double getVelocity()Get the flow velocity in the pipe.- Specified by:
getVelocityin interfacePipeLineInterface- Returns:
- velocity in m/s
-
getSuperficialVelocity
public double getSuperficialVelocity(int phaseNumber) Get the superficial velocity for a specific phase.- Specified by:
getSuperficialVelocityin interfacePipeLineInterface- Parameters:
phaseNumber- phase index (0=gas, 1=liquid)- Returns:
- superficial velocity in m/s
-
getFlowRegime
Get the determined flow regime.- Specified by:
getFlowRegimein interfacePipeLineInterface- Returns:
- flow regime as string (e.g., "stratified", "slug", "annular", "dispersed bubble")
-
getLiquidHoldup
public double getLiquidHoldup()Get the liquid holdup fraction.- Specified by:
getLiquidHoldupin interfacePipeLineInterface- Returns:
- liquid holdup as fraction (0-1)
-
getReynoldsNumber
public double getReynoldsNumber()Get the Reynolds number for the flow.- Specified by:
getReynoldsNumberin interfacePipeLineInterface- Returns:
- Reynolds number (dimensionless)
-
getFrictionFactor
public double getFrictionFactor()Get the friction factor.- Specified by:
getFrictionFactorin interfacePipeLineInterface- Returns:
- Darcy friction factor (dimensionless)
-
setHeatTransferCoefficient
public void setHeatTransferCoefficient(double coefficient) Set the overall heat transfer coefficient.- Specified by:
setHeatTransferCoefficientin interfacePipeLineInterface- Parameters:
coefficient- heat transfer coefficient in W/(m²·K)
-
getHeatTransferCoefficient
public double getHeatTransferCoefficient()Get the overall heat transfer coefficient.- Specified by:
getHeatTransferCoefficientin interfacePipeLineInterface- Returns:
- heat transfer coefficient in W/(m²·K)
-
setConstantSurfaceTemperature
public void setConstantSurfaceTemperature(double temperature) Set the constant surface temperature for heat transfer.- Specified by:
setConstantSurfaceTemperaturein interfacePipeLineInterface- Parameters:
temperature- surface temperature in Kelvin
-
isAdiabatic
public boolean isAdiabatic()Check if the pipe is operating in adiabatic mode.- Specified by:
isAdiabaticin interfacePipeLineInterface- Returns:
- true if adiabatic (no heat transfer)
-
setAdiabatic
public void setAdiabatic(boolean adiabatic) Set whether the pipe operates in adiabatic mode.- Specified by:
setAdiabaticin interfacePipeLineInterface- Parameters:
adiabatic- true for no heat transfer
-
setPipeSpecification
Set pipe specification from database.- Specified by:
setPipeSpecificationin interfacePipeLineInterface- Parameters:
nominalDiameter- nominal diameter in mm or inchesspecification- pipe specification code (e.g., "API 5L", "ANSI B36.10")
-
setWallThickness
public void setWallThickness(double thickness) Set the pipe wall thickness.- Specified by:
setWallThicknessin interfacePipeLineInterface- Parameters:
thickness- wall thickness in meters
-
getAngle
public double getAngle()Get the angle of the pipe from horizontal.- Specified by:
getAnglein interfacePipeLineInterface- Returns:
- angle in degrees (0 = horizontal, 90 = vertical upward)
-
setAngle
public void setAngle(double angle) Set the angle of the pipe from horizontal.- Specified by:
setAnglein interfacePipeLineInterface- Parameters:
angle- angle in degrees (0 = horizontal, 90 = vertical upward)
-
setPipeMaterial
Set the pipe material.- Specified by:
setPipeMaterialin interfacePipeLineInterface- Parameters:
material- pipe material name (e.g., "carbon steel", "stainless steel", "duplex")
-
getPipeMaterial
Get the pipe material.- Specified by:
getPipeMaterialin interfacePipeLineInterface- Returns:
- pipe material name
-
setPipeSchedule
Set the pipe schedule.- Specified by:
setPipeSchedulein interfacePipeLineInterface- Parameters:
schedule- pipe schedule (e.g., "40", "80", "STD", "XS")
-
getPipeSchedule
Get the pipe schedule.- Specified by:
getPipeSchedulein interfacePipeLineInterface- Returns:
- pipe schedule
-
setInsulationThickness
public void setInsulationThickness(double thickness) Set the insulation thickness.- Specified by:
setInsulationThicknessin interfacePipeLineInterface- Parameters:
thickness- insulation thickness in meters
-
getInsulationThickness
public double getInsulationThickness()Get the insulation thickness.- Specified by:
getInsulationThicknessin interfacePipeLineInterface- Returns:
- insulation thickness in meters
-
setInsulationConductivity
public void setInsulationConductivity(double conductivity) Set the insulation thermal conductivity.- Specified by:
setInsulationConductivityin interfacePipeLineInterface- Parameters:
conductivity- thermal conductivity in W/(m·K)
-
getInsulationConductivity
public double getInsulationConductivity()Get the insulation thermal conductivity.- Specified by:
getInsulationConductivityin interfacePipeLineInterface- Returns:
- thermal conductivity in W/(m·K)
-
setInsulationType
Set the insulation type/material.- Specified by:
setInsulationTypein interfacePipeLineInterface- Parameters:
insulationType- insulation type (e.g., "polyurethane", "mineral wool", "aerogel")
-
getInsulationType
Get the insulation type/material.- Specified by:
getInsulationTypein interfacePipeLineInterface- Returns:
- insulation type
-
setCoatingThickness
public void setCoatingThickness(double thickness) Set the coating thickness.- Specified by:
setCoatingThicknessin interfacePipeLineInterface- Parameters:
thickness- coating thickness in meters
-
getCoatingThickness
public double getCoatingThickness()Get the coating thickness.- Specified by:
getCoatingThicknessin interfacePipeLineInterface- Returns:
- coating thickness in meters
-
setCoatingConductivity
public void setCoatingConductivity(double conductivity) Set the coating thermal conductivity.- Specified by:
setCoatingConductivityin interfacePipeLineInterface- Parameters:
conductivity- thermal conductivity in W/(m·K)
-
getCoatingConductivity
public double getCoatingConductivity()Get the coating thermal conductivity.- Specified by:
getCoatingConductivityin interfacePipeLineInterface- Returns:
- thermal conductivity in W/(m·K)
-
setPipeWallConductivity
public void setPipeWallConductivity(double conductivity) Set the pipe wall thermal conductivity.- Specified by:
setPipeWallConductivityin interfacePipeLineInterface- Parameters:
conductivity- thermal conductivity in W/(m·K)
-
getPipeWallConductivity
public double getPipeWallConductivity()Get the pipe wall thermal conductivity.- Specified by:
getPipeWallConductivityin interfacePipeLineInterface- Returns:
- thermal conductivity in W/(m·K)
-
setOuterHeatTransferCoefficient
public void setOuterHeatTransferCoefficient(double coefficient) Set the outer (external) heat transfer coefficient.This is the convective heat transfer coefficient between the pipe outer surface (or insulation outer surface if insulated) and the surrounding environment.
Typical values:
- Still air: 5-25 W/(m²·K)
- Flowing air: 10-100 W/(m²·K)
- Buried in soil: 1-5 W/(m²·K)
- Still water: 100-500 W/(m²·K)
- Flowing seawater: 500-2000 W/(m²·K)
- Specified by:
setOuterHeatTransferCoefficientin interfacePipeLineInterface- Parameters:
coefficient- outer heat transfer coefficient in W/(m²·K)
-
getOuterHeatTransferCoefficient
public double getOuterHeatTransferCoefficient()Get the outer (external) heat transfer coefficient.- Specified by:
getOuterHeatTransferCoefficientin interfacePipeLineInterface- Returns:
- outer heat transfer coefficient in W/(m²·K)
-
setInnerHeatTransferCoefficient
public void setInnerHeatTransferCoefficient(double coefficient) Set the inner (fluid-side) heat transfer coefficient.This is the convective heat transfer coefficient between the fluid and the pipe inner wall. If not set, it can be calculated automatically based on flow conditions.
- Specified by:
setInnerHeatTransferCoefficientin interfacePipeLineInterface- Parameters:
coefficient- inner heat transfer coefficient in W/(m²·K)
-
getInnerHeatTransferCoefficient
public double getInnerHeatTransferCoefficient()Get the inner (fluid-side) heat transfer coefficient.- Specified by:
getInnerHeatTransferCoefficientin interfacePipeLineInterface- Returns:
- inner heat transfer coefficient in W/(m²·K)
-
setOuterHeatTransferCoefficients
public void setOuterHeatTransferCoefficients(double[] coefficients) Set outer heat transfer coefficients for each pipe segment.- Specified by:
setOuterHeatTransferCoefficientsin interfacePipeLineInterface- Parameters:
coefficients- array of outer heat transfer coefficients in W/(m²·K)
-
setWallHeatTransferCoefficients
public void setWallHeatTransferCoefficients(double[] coefficients) Set inner (wall) heat transfer coefficients for each pipe segment.- Specified by:
setWallHeatTransferCoefficientsin interfacePipeLineInterface- Parameters:
coefficients- array of wall heat transfer coefficients in W/(m²·K)
-
setAmbientTemperatures
public void setAmbientTemperatures(double[] temperatures) Set ambient/surrounding temperatures for each pipe segment.- Specified by:
setAmbientTemperaturesin interfacePipeLineInterface- Parameters:
temperatures- array of ambient temperatures in Kelvin
-
calculateOverallHeatTransferCoefficient
public double calculateOverallHeatTransferCoefficient()Calculate the overall heat transfer coefficient based on pipe buildup.This method calculates the overall U-value considering:
- Inner fluid-side convection
- Pipe wall conduction
- Coating conduction (if present)
- Insulation conduction (if present)
- Outer convection
The calculation uses the resistance analogy for cylindrical geometries.
- Specified by:
calculateOverallHeatTransferCoefficientin interfacePipeLineInterface- Returns:
- overall heat transfer coefficient in W/(m²·K) based on inner diameter
-
setBurialDepth
public void setBurialDepth(double depth) Set the burial depth below ground surface.- Specified by:
setBurialDepthin interfacePipeLineInterface- Parameters:
depth- burial depth in meters
-
getBurialDepth
public double getBurialDepth()Get the burial depth.- Specified by:
getBurialDepthin interfacePipeLineInterface- Returns:
- burial depth in meters
-
setSoilConductivity
public void setSoilConductivity(double conductivity) Set the soil thermal conductivity.- Specified by:
setSoilConductivityin interfacePipeLineInterface- Parameters:
conductivity- soil thermal conductivity in W/(m·K)
-
getSoilConductivity
public double getSoilConductivity()Get the soil thermal conductivity.- Specified by:
getSoilConductivityin interfacePipeLineInterface- Returns:
- soil thermal conductivity in W/(m·K)
-
isBuried
public boolean isBuried()Check if the pipe is buried.- Specified by:
isBuriedin interfacePipeLineInterface- Returns:
- true if pipe is buried
-
setBuried
public void setBuried(boolean buried) Set whether the pipe is buried.- Specified by:
setBuriedin interfacePipeLineInterface- Parameters:
buried- true if pipe is buried
-
getOrCreateCalculator
Get or create the mechanical design calculator.- Returns:
- the mechanical design calculator instance
-
getMechanicalDesignCalculator
Get the mechanical design calculator for this pipeline.The calculator provides standards-based calculations for:
- Wall thickness calculation per ASME B31.3/B31.4/B31.8 or DNV-OS-F101
- Maximum Allowable Operating Pressure (MAOP)
- Stress analysis (hoop, longitudinal, von Mises)
- Test pressure calculation
- Specified by:
getMechanicalDesignCalculatorin interfacePipeLineInterface- Returns:
- mechanical design calculator
-
setDesignPressure
public void setDesignPressure(double pressure) Set design pressure for mechanical design calculations.- Specified by:
setDesignPressurein interfacePipeLineInterface- Parameters:
pressure- design pressure in MPa
-
getDesignPressure
public double getDesignPressure()Get design pressure.- Specified by:
getDesignPressurein interfacePipeLineInterface- Returns:
- design pressure in MPa
-
setDesignPressure
Set design pressure with unit.- Specified by:
setDesignPressurein interfacePipeLineInterface- Parameters:
pressure- design pressure valueunit- pressure unit ("MPa", "bar", "bara", "psi")
-
setDesignTemperature
public void setDesignTemperature(double temperature) Set maximum design temperature for mechanical design.- Specified by:
setDesignTemperaturein interfacePipeLineInterface- Parameters:
temperature- design temperature in Celsius
-
getDesignTemperature
public double getDesignTemperature()Get maximum design temperature.- Specified by:
getDesignTemperaturein interfacePipeLineInterface- Returns:
- design temperature in Celsius
-
setMaterialGrade
Set the pipe material grade per API 5L.- Specified by:
setMaterialGradein interfacePipeLineInterface- Parameters:
grade- material grade (e.g., "X42", "X52", "X65", "X70", "X80")
-
getMaterialGrade
Get the pipe material grade.- Specified by:
getMaterialGradein interfacePipeLineInterface- Returns:
- material grade
-
setDesignCode
Set the design code for wall thickness and pressure calculations.- Specified by:
setDesignCodein interfacePipeLineInterface- Parameters:
code- design code (e.g., "ASME_B31_8", "ASME_B31_4", "ASME_B31_3", "DNV_OS_F101")
-
getDesignCode
Get the design code.- Specified by:
getDesignCodein interfacePipeLineInterface- Returns:
- design code
-
setLocationClass
public void setLocationClass(int locClass) Set the location class per ASME B31.8.Location classes:
- Class 1: Offshore and remote areas (F=0.72)
- Class 2: Fringe areas (F=0.60)
- Class 3: Suburban areas (F=0.50)
- Class 4: Urban areas (F=0.40)
- Specified by:
setLocationClassin interfacePipeLineInterface- Parameters:
locClass- location class 1-4
-
getLocationClass
public int getLocationClass()Get the location class.- Specified by:
getLocationClassin interfacePipeLineInterface- Returns:
- location class 1-4
-
setCorrosionAllowance
public void setCorrosionAllowance(double allowance) Set the corrosion allowance.- Specified by:
setCorrosionAllowancein interfacePipeLineInterface- Parameters:
allowance- corrosion allowance in meters
-
getCorrosionAllowance
public double getCorrosionAllowance()Get the corrosion allowance.- Specified by:
getCorrosionAllowancein interfacePipeLineInterface- Returns:
- corrosion allowance in meters
-
calculateMinimumWallThickness
public double calculateMinimumWallThickness()Calculate minimum required wall thickness based on design code.- Specified by:
calculateMinimumWallThicknessin interfacePipeLineInterface- Returns:
- minimum wall thickness in meters
-
calculateMAOP
public double calculateMAOP()Calculate Maximum Allowable Operating Pressure (MAOP).- Specified by:
calculateMAOPin interfacePipeLineInterface- Returns:
- MAOP in MPa
-
getMAOP
Get MAOP in specified unit.- Specified by:
getMAOPin interfacePipeLineInterface- Parameters:
unit- pressure unit ("MPa", "bar", "psi")- Returns:
- MAOP in specified unit
-
calculateTestPressure
public double calculateTestPressure()Calculate hydrostatic test pressure.- Specified by:
calculateTestPressurein interfacePipeLineInterface- Returns:
- test pressure in MPa
-
calculateHoopStress
public double calculateHoopStress()Calculate hoop stress at operating pressure.- Specified by:
calculateHoopStressin interfacePipeLineInterface- Returns:
- hoop stress in MPa
-
calculateVonMisesStress
public double calculateVonMisesStress(double deltaT) Calculate von Mises equivalent stress.- Specified by:
calculateVonMisesStressin interfacePipeLineInterface- Parameters:
deltaT- temperature change from installation in Celsius- Returns:
- von Mises stress in MPa
-
isMechanicalDesignSafe
public boolean isMechanicalDesignSafe()Check if the mechanical design is within allowable stress limits.- Specified by:
isMechanicalDesignSafein interfacePipeLineInterface- Returns:
- true if design stress is below allowable limit
-
generateMechanicalDesignReport
Generate a mechanical design report.- Specified by:
generateMechanicalDesignReportin interfacePipeLineInterface- Returns:
- formatted design report string
-
setInletPressure(double)instead