Class SlugTracker
- All Implemented Interfaces:
Serializable
Implements slug unit model with Lagrangian tracking of slug front and tail. Models slug growth, decay, merging, and interaction with terrain features.
Key features:
- Tracks slug front and tail positions
- Models slug liquid holdup and bubble region
- Handles slug merging when front catches tail
- Bendiksen correlation for slug velocity
References:
- Bendiksen, K.H. et al. (1991) - The Dynamic Two-Fluid Model OLGA
- Nydal, O.J. and Banerjee, S. (1996) - Dynamic Slug Tracking Simulations
- Version:
- 1.0
- Author:
- Even Solbraa
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classRepresents a single slug unit (liquid slug + Taylor bubble). -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate doubleprivate static final doubleprivate static final doubleMaximum allowed slug body length (multiples of diameter).private doubleprivate doubleprivate doubleReference velocity from inlet for fallback when sections have near-zero velocity.private static final longprivate doubleprivate doubleprivate doubleprivate doubleprivate List<SlugTracker.SlugUnit> private doubleCumulative liquid mass borrowed from Eulerian cells when slugs are created (kg).private doubleCumulative liquid mass returned to Eulerian cells from exiting/dissipating slugs (kg).private intprivate int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidadvanceSlug(SlugTracker.SlugUnit slug, PipeSection[] sections, double dt) Advance a single slug.voidadvanceSlugs(PipeSection[] sections, double dt) Advance all slugs by one time step.private doublecalculateBubbleLength(SlugTracker.SlugUnit slug, PipeSection section) Calculate Taylor bubble/film region length.private doublecalculateDriftVelocity(double D, double theta, double deltaRho, double rho_L) Calculate drift velocity using Bendiksen correlation.private doublecalculateEquilibriumLength(PipeSection section) Calculate equilibrium slug length using Nydal correlation.private doublecalculateSlugBodyHoldup(double U_M) Calculate slug body holdup using Gregory et al. (1978) correlation.private intfindSectionIndex(double position, PipeSection[] sections) Find section index containing a position.generateInletSlug(PipeSection inletSection, double pipeArea) Generate slug at inlet based on flow conditions.doubleGet average slug length.doubleGet net mass currently held in active slugs (borrowed - returned - in_active_slugs).doubleGet maximum slug length.doubleGet slug body holdup.intGet number of active slugs.doubleGet slug frequency.getSlugs()Get all active slugs.Get detailed slug statistics string.doubleGet total liquid mass borrowed from Eulerian cells when slugs are created.doubleGet total liquid mass returned to Eulerian cells when slugs exit or dissipate.intGet total slugs generated.intGet total slugs merged.initializeTerrainSlug(LiquidAccumulationTracker.SlugCharacteristics characteristics, PipeSection[] sections) Initialize slug from terrain-induced accumulation.private voidmarkSlugSections(SlugTracker.SlugUnit slug, PipeSection[] sections) Mark sections that are within a slug.private voidMerge slugs that have caught up to each other.private voidremoveInactiveSlugs(PipeSection[] sections) Remove slugs that have exited pipe or dissipated, returning mass to Eulerian cells.voidreset()Reset tracker state.private voidreturnMassToEulerianCells(SlugTracker.SlugUnit slug, PipeSection[] sections) Return liquid mass from a dissipating slug back to Eulerian cells.voidsetFilmHoldup(double holdup) Set film holdup.voidsetMinimumSlugLength(double length) Set minimum slug length.voidsetReferenceVelocity(double velocity) Set the reference velocity for slug propagation.voidsetSlugBodyHoldup(double holdup) Set slug body holdup.private voidUpdate slug statistics.
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
GRAVITY
private static final double GRAVITY- See Also:
-
slugs
-
minimumSlugLength
private double minimumSlugLength -
slugMergeDistance
private double slugMergeDistance -
slugHoldupBody
private double slugHoldupBody -
slugHoldupFilm
private double slugHoldupFilm -
slugFrequency
private double slugFrequency -
averageSlugLength
private double averageSlugLength -
maxSlugLength
private double maxSlugLength -
totalSlugsGenerated
private int totalSlugsGenerated -
totalSlugsMerged
private int totalSlugsMerged -
totalMassReturnedToEulerian
private double totalMassReturnedToEulerianCumulative liquid mass returned to Eulerian cells from exiting/dissipating slugs (kg). This enables mass conservation verification between Lagrangian and Eulerian representations. -
totalMassBorrowedFromEulerian
private double totalMassBorrowedFromEulerianCumulative liquid mass borrowed from Eulerian cells when slugs are created (kg). This enables mass conservation verification between Lagrangian and Eulerian representations. -
referenceVelocity
private double referenceVelocityReference velocity from inlet for fallback when sections have near-zero velocity. -
MAX_SLUG_LENGTH_DIAMETERS
private static final double MAX_SLUG_LENGTH_DIAMETERSMaximum allowed slug body length (multiples of diameter).- See Also:
-
-
Constructor Details
-
SlugTracker
public SlugTracker()Constructor.
-
-
Method Details
-
initializeTerrainSlug
public SlugTracker.SlugUnit initializeTerrainSlug(LiquidAccumulationTracker.SlugCharacteristics characteristics, PipeSection[] sections) Initialize slug from terrain-induced accumulation.This method creates a new slug from accumulated liquid at a terrain feature and tracks the mass "borrowed" from the Eulerian cells. This borrowed mass is recorded to enable mass conservation verification and is returned to appropriate cells when the slug exits or dissipates.
- Parameters:
characteristics- Slug characteristics from accumulation trackersections- Pipe sections- Returns:
- New slug unit
-
generateInletSlug
Generate slug at inlet based on flow conditions.- Parameters:
inletSection- Inlet pipe sectionpipeArea- Pipe cross-sectional area (m²)- Returns:
- New slug if generated, null otherwise
-
advanceSlugs
Advance all slugs by one time step.- Parameters:
sections- Pipe sectionsdt- Time step (s)
-
setReferenceVelocity
public void setReferenceVelocity(double velocity) Set the reference velocity for slug propagation. This is used as fallback when section mixture velocity is near zero (e.g., with constant pressure outlet BC where momentum solver gives low velocities).- Parameters:
velocity- Reference velocity in m/s (typically inlet mixture velocity)
-
advanceSlug
Advance a single slug.- Parameters:
slug- the slug unit to advancesections- the pipe sections arraydt- the time step
-
calculateDriftVelocity
private double calculateDriftVelocity(double D, double theta, double deltaRho, double rho_L) Calculate drift velocity using Bendiksen correlation.- Parameters:
D- pipe diameter (m)theta- pipe inclination angle (radians)deltaRho- density difference between liquid and gas (kg/m³)rho_L- liquid density (kg/m³)- Returns:
- drift velocity (m/s)
-
calculateBubbleLength
Calculate Taylor bubble/film region length.- Parameters:
slug- the slug unitsection- the pipe section- Returns:
- bubble length (m)
-
calculateEquilibriumLength
Calculate equilibrium slug length using Nydal correlation.References:
- Nydal, O.J. (1991) - An Experimental Investigation of Slug Flow
- Barnea, D. and Taitel, Y. (1993) - A Model for Slug Length Distribution
- Parameters:
section- pipe section with flow conditions- Returns:
- equilibrium slug length [m]
-
calculateSlugBodyHoldup
private double calculateSlugBodyHoldup(double U_M) Calculate slug body holdup using Gregory et al. (1978) correlation.H_LS = 1 / (1 + (U_M / 8.66)^1.39)
This accounts for gas entrainment in the slug body at high mixture velocities.
- Parameters:
U_M- mixture velocity [m/s]- Returns:
- liquid holdup in slug body (0.5 to 1.0 typically)
-
markSlugSections
Mark sections that are within a slug.A section is marked as in slug body if it overlaps with the slug body region (between tail and front positions). Sections are marked as in slug bubble if they overlap with the bubble/film region behind the tail.
Mass Conservation Note: The slug holdup represents additional liquid concentration from the slug body. The section's base holdup (from Eulerian solver) is preserved and the slug holdup is used to modify effective properties for friction/pressure calculations.
- Parameters:
slug- the slug unit to mark sections forsections- array of pipe sections to check for slug overlap
-
mergeSlugs
private void mergeSlugs()Merge slugs that have caught up to each other. -
removeInactiveSlugs
Remove slugs that have exited pipe or dissipated, returning mass to Eulerian cells.When a slug exits the pipe or dissipates, its liquid mass is "returned" to the Eulerian representation. For slugs exiting at the outlet, the mass is considered as having left the system (outlet mass flux). For dissipating slugs, the mass is returned to the surrounding cells proportionally.
- Parameters:
sections- Pipe sections (may be modified to return mass)
-
returnMassToEulerianCells
Return liquid mass from a dissipating slug back to Eulerian cells.When a slug dissipates (becomes too short), its liquid mass is distributed back to the surrounding pipe sections. This maintains mass conservation between the Lagrangian slug tracking and Eulerian field representation.
- Parameters:
slug- The dissipating slugsections- Pipe sections to receive the returned mass
-
updateStatistics
private void updateStatistics()Update slug statistics. -
findSectionIndex
Find section index containing a position.- Parameters:
position- position along pipe (m)sections- array of pipe sections- Returns:
- section index, or -1 if not found
-
getSlugs
-
getSlugCount
public int getSlugCount()Get number of active slugs.- Returns:
- Slug count
-
getSlugFrequency
public double getSlugFrequency()Get slug frequency.- Returns:
- Frequency (1/s)
-
getAverageSlugLength
public double getAverageSlugLength()Get average slug length.- Returns:
- Average length (m)
-
getMaxSlugLength
public double getMaxSlugLength()Get maximum slug length.- Returns:
- Max length (m)
-
getTotalSlugsGenerated
public int getTotalSlugsGenerated()Get total slugs generated.- Returns:
- Total count
-
getTotalSlugsMerged
public int getTotalSlugsMerged()Get total slugs merged.- Returns:
- Merge count
-
setMinimumSlugLength
public void setMinimumSlugLength(double length) Set minimum slug length.- Parameters:
length- Minimum length (m)
-
setSlugBodyHoldup
public void setSlugBodyHoldup(double holdup) Set slug body holdup.- Parameters:
holdup- Holdup (0-1)
-
getSlugBodyHoldup
public double getSlugBodyHoldup()Get slug body holdup.- Returns:
- Holdup in slug body (0-1)
-
setFilmHoldup
public void setFilmHoldup(double holdup) Set film holdup.- Parameters:
holdup- Holdup (0-1)
-
reset
public void reset()Reset tracker state. -
getTotalMassBorrowedFromEulerian
public double getTotalMassBorrowedFromEulerian()Get total liquid mass borrowed from Eulerian cells when slugs are created.- Returns:
- Total borrowed mass (kg)
-
getTotalMassReturnedToEulerian
public double getTotalMassReturnedToEulerian()Get total liquid mass returned to Eulerian cells when slugs exit or dissipate.- Returns:
- Total returned mass (kg)
-
getMassConservationError
public double getMassConservationError()Get net mass currently held in active slugs (borrowed - returned - in_active_slugs).For mass conservation verification: netMassInSlugs = totalBorrowed - totalReturned - massInActiveSlugs This should be approximately zero if mass is conserved.
- Returns:
- Net mass discrepancy (kg), should be ~0 for conservation
-
getStatisticsString
Get detailed slug statistics string.- Returns:
- Statistics summary
-