Class SlugTracker

java.lang.Object
neqsim.process.equipment.pipeline.twophasepipe.SlugTracker
All Implemented Interfaces:
Serializable

public class SlugTracker extends Object implements Serializable
Tracks individual slugs through the pipeline.

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:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • GRAVITY

      private static final double GRAVITY
      See Also:
    • slugs

      private List<SlugTracker.SlugUnit> 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 totalMassReturnedToEulerian
      Cumulative liquid mass returned to Eulerian cells from exiting/dissipating slugs (kg). This enables mass conservation verification between Lagrangian and Eulerian representations.
    • totalMassBorrowedFromEulerian

      private double totalMassBorrowedFromEulerian
      Cumulative liquid mass borrowed from Eulerian cells when slugs are created (kg). This enables mass conservation verification between Lagrangian and Eulerian representations.
    • referenceVelocity

      private double referenceVelocity
      Reference velocity from inlet for fallback when sections have near-zero velocity.
    • MAX_SLUG_LENGTH_DIAMETERS

      private static final double MAX_SLUG_LENGTH_DIAMETERS
      Maximum 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 tracker
      sections - Pipe sections
      Returns:
      New slug unit
    • generateInletSlug

      public SlugTracker.SlugUnit generateInletSlug(PipeSection inletSection, double pipeArea)
      Generate slug at inlet based on flow conditions.
      Parameters:
      inletSection - Inlet pipe section
      pipeArea - Pipe cross-sectional area (m²)
      Returns:
      New slug if generated, null otherwise
    • advanceSlugs

      public void advanceSlugs(PipeSection[] sections, double dt)
      Advance all slugs by one time step.
      Parameters:
      sections - Pipe sections
      dt - 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

      private void advanceSlug(SlugTracker.SlugUnit slug, PipeSection[] sections, double dt)
      Advance a single slug.
      Parameters:
      slug - the slug unit to advance
      sections - the pipe sections array
      dt - 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

      private double calculateBubbleLength(SlugTracker.SlugUnit slug, PipeSection section)
      Calculate Taylor bubble/film region length.
      Parameters:
      slug - the slug unit
      section - the pipe section
      Returns:
      bubble length (m)
    • calculateEquilibriumLength

      private double calculateEquilibriumLength(PipeSection section)
      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

      private void markSlugSections(SlugTracker.SlugUnit slug, PipeSection[] sections)
      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 for
      sections - array of pipe sections to check for slug overlap
    • mergeSlugs

      private void mergeSlugs()
      Merge slugs that have caught up to each other.
    • removeInactiveSlugs

      private void removeInactiveSlugs(PipeSection[] sections)
      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

      private void returnMassToEulerianCells(SlugTracker.SlugUnit slug, PipeSection[] sections)
      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 slug
      sections - Pipe sections to receive the returned mass
    • updateStatistics

      private void updateStatistics()
      Update slug statistics.
    • findSectionIndex

      private int findSectionIndex(double position, PipeSection[] sections)
      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

      public List<SlugTracker.SlugUnit> getSlugs()
      Get all active slugs.
      Returns:
      List of slug units
    • 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

      public String getStatisticsString()
      Get detailed slug statistics string.
      Returns:
      Statistics summary