Class RecombinationFlashGenerator

java.lang.Object
neqsim.process.util.optimizer.RecombinationFlashGenerator
All Implemented Interfaces:
Serializable

public class RecombinationFlashGenerator extends Object implements Serializable
Generates feed fluids at different GOR by recombining gas and oil phases.

This is a simple, physically-based approach:

  1. Start with separated gas and oil phases from reference fluid
  2. Mix at different ratios to achieve target GOR
  3. Add water based on water cut

This mimics what happens in the reservoir when wells produce at different GOR:

  • Low GOR: High drawdown, more liquid production, less gas liberation
  • High GOR: Low drawdown or gas cap expansion, more gas

Performance Optimization

The generator includes a fluid cache keyed by (GOR, WC) to avoid regenerating the same fluid composition multiple times during parallel VFP table generation.

Usage Example

FluidMagicInput input = FluidMagicInput.fromE300File("FLUID.E300");
input.setGORRange(250, 10000);
input.setWaterCutRange(0.05, 0.60);
input.separateToStandardConditions();

RecombinationFlashGenerator generator = new RecombinationFlashGenerator(input);

// Generate fluid at GOR=1000, WC=20%
SystemInterface fluid = generator.generateFluid(1000.0, 0.20, 10000.0, 353.15, 50.0);
Version:
1.0
Author:
ESOL
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      Serialization version UID.
      See Also:
    • logger

      private static final org.apache.logging.log4j.Logger logger
      Logger object for class.
    • MW_WATER

      private static final double MW_WATER
      Molecular weight of water in kg/kmol.
      See Also:
    • STD_TEMPERATURE_K

      private static final double STD_TEMPERATURE_K
      Standard temperature in Kelvin (15°C).
      See Also:
    • STD_PRESSURE_BARA

      private static final double STD_PRESSURE_BARA
      Standard pressure in bara (1 atm).
      See Also:
    • gasPhase

      private SystemInterface gasPhase
    • oilPhase

      private SystemInterface oilPhase
    • waterPhase

      private SystemInterface waterPhase
    • gasStdVolumePerMole

      private double gasStdVolumePerMole
    • oilStdVolumePerMole

      private double oilStdVolumePerMole
    • waterStdVolumePerMole

      private double waterStdVolumePerMole
    • fluidCache

      private transient Map<String, SystemInterface> fluidCache
    • enableCaching

      private boolean enableCaching
    • cacheHits

      private int cacheHits
    • cacheMisses

      private int cacheMisses
  • Constructor Details

    • RecombinationFlashGenerator

      public RecombinationFlashGenerator(FluidMagicInput input)
      Create generator from FluidMagicInput.
      Parameters:
      input - FluidMagicInput with separated phases
  • Method Details

    • calculateMolarVolumes

      private void calculateMolarVolumes()
      Calculate standard molar volumes for each phase.
    • generateFluid

      public SystemInterface generateFluid(double targetGOR, double waterCut, double totalLiquidRate, double temperature, double pressure)
      Generate feed fluid at specified GOR and water cut.

      Uses recombination flash: mix gas and oil at ratio to achieve target GOR, then add water based on water cut.

      Parameters:
      targetGOR - target GOR in Sm3/Sm3
      waterCut - water cut as fraction (0-1)
      totalLiquidRate - total liquid rate (oil + water) in Sm3/hr
      temperature - temperature in K
      pressure - pressure in bara
      Returns:
      recombined fluid at specified conditions
    • generateFluid

      public SystemInterface generateFluid(double targetGOR, double waterCut, double temperature, double pressure)
      Generate fluid at specified GOR and water cut with default rates.
      Parameters:
      targetGOR - target GOR in Sm3/Sm3
      waterCut - water cut as fraction (0-1)
      temperature - temperature in K
      pressure - pressure in bara
      Returns:
      recombined fluid
    • createBaseFluid

      private SystemInterface createBaseFluid()
      Create base fluid system for recombination.
      Returns:
      empty fluid system
    • getStandardVolume

      private double getStandardVolume(SystemInterface phase)
      Get standard volume of a phase.
      Parameters:
      phase - the phase
      Returns:
      volume at standard conditions in m3
    • addScaledPhase

      private void addScaledPhase(SystemInterface target, SystemInterface source, double factor)
      Add scaled phase components to target fluid.
      Parameters:
      target - target fluid to add components to
      source - source phase with components
      factor - scaling factor for moles
    • scaleFluidToRate

      private void scaleFluidToRate(SystemInterface fluid, double totalLiquidRate, double waterCut)
      Scale fluid to desired total liquid rate.
      Parameters:
      fluid - the fluid to scale
      totalLiquidRate - desired total liquid rate in Sm3/hr
      waterCut - water cut fraction
    • getCacheKey

      private String getCacheKey(double gor, double wc)
      Get cache key for GOR/WC combination.
      Parameters:
      gor - GOR value
      wc - water cut value
      Returns:
      cache key string
    • clearCache

      public void clearCache()
      Clear the fluid cache.
    • getCacheStatistics

      public String getCacheStatistics()
      Get cache statistics.
      Returns:
      string with cache hit/miss statistics
    • setEnableCaching

      public void setEnableCaching(boolean enable)
      Enable or disable fluid caching.
      Parameters:
      enable - true to enable caching
    • isEnableCaching

      public boolean isEnableCaching()
      Check if caching is enabled.
      Returns:
      true if caching is enabled
    • validateGOR

      public boolean validateGOR(double targetGOR, double waterCut, double tolerance)
      Validate that recombination produces expected GOR.

      This method is useful for testing and verification.

      Parameters:
      targetGOR - target GOR in Sm3/Sm3
      waterCut - water cut fraction
      tolerance - acceptable relative error (e.g., 0.05 for 5%)
      Returns:
      true if actual GOR is within tolerance of target
    • getGasPhase

      public SystemInterface getGasPhase()
      Get the gas phase used for recombination.
      Returns:
      gas phase
    • getOilPhase

      public SystemInterface getOilPhase()
      Get the oil phase used for recombination.
      Returns:
      oil phase
    • getWaterPhase

      public SystemInterface getWaterPhase()
      Get the water phase used for recombination.
      Returns:
      water phase