Class PseudoComponentCombiner

java.lang.Object
neqsim.thermo.characterization.PseudoComponentCombiner

public final class PseudoComponentCombiner extends Object
Utility class for combining and re-characterizing fluids containing pseudo components.

This class provides methods for:

  • Combining multiple reservoir fluids with a common pseudo-component structure
  • Characterizing one fluid to match another's pseudo-component definition
  • Transferring binary interaction parameters between fluids

Reference: Pedersen et al., "Phase Behavior of Petroleum Reservoir Fluids", Chapters 5.5-5.6.

Author:
ESOL
  • Field Details

    • logger

      private static final org.apache.logging.log4j.Logger logger
    • MASS_TOLERANCE

      private static final double MASS_TOLERANCE
      See Also:
  • Constructor Details

    • PseudoComponentCombiner

      private PseudoComponentCombiner()
  • Method Details

    • combineReservoirFluids

      public static SystemInterface combineReservoirFluids(int targetPseudoComponents, SystemInterface... fluids)
      Combine one or more reservoir fluids and redistribute their pseudo components into a specified number of new pseudo components. The new pseudo components are calculated using the weighting scheme described in Chapter 5.5 of Pedersen et al. (mixing of multiple fluids), i.e. the properties of each resulting pseudo component are weighted by the fluid fraction and the mole fraction of the contributing pseudo components.
      Parameters:
      targetPseudoComponents - number of pseudo components in the combined fluid
      fluids - input fluids
      Returns:
      combined fluid with the requested number of pseudo components
    • combineReservoirFluids

      public static SystemInterface combineReservoirFluids(int targetPseudoComponents, Collection<SystemInterface> fluids)
      Combine one or more reservoir fluids and redistribute their pseudo components into a specified number of new pseudo components. The new pseudo components are calculated using the weighting scheme described in Chapter 5.5 of Pedersen et al. (mixing of multiple fluids), i.e. the properties of each resulting pseudo component are weighted by the fluid fraction and the mole fraction of the contributing pseudo components.
      Parameters:
      targetPseudoComponents - number of pseudo components in the combined fluid
      fluids - input fluids
      Returns:
      combined fluid with the requested number of pseudo components
    • characterizeToReference

      public static SystemInterface characterizeToReference(SystemInterface source, SystemInterface reference)
      Characterize a fluid to another fluid's pseudo component definition (Pedersen et al., Chapter 5.6). The pseudo component cut points are derived from the reference fluid's pseudo component ordering and applied to the source fluid.
      Parameters:
      source - fluid to characterize
      reference - fluid defining the pseudo component characterization
      Returns:
      characterized fluid containing pseudo components compatible with the reference fluid
    • characterizeToReference

      public static SystemInterface characterizeToReference(SystemInterface source, SystemInterface reference, CharacterizationOptions options)
      Characterize a fluid to another fluid's pseudo component definition with options.

      This overload allows specifying options for BIP transfer, normalization, and validation.

      Parameters:
      source - fluid to characterize
      reference - fluid defining the pseudo component characterization
      options - characterization options
      Returns:
      characterized fluid containing pseudo components compatible with the reference fluid
    • transferBinaryInteractionParameters

      public static void transferBinaryInteractionParameters(SystemInterface reference, SystemInterface target)
      Transfer binary interaction parameters from a reference fluid to a target fluid.

      This method copies BIPs between components that exist in both fluids. For pseudo-components, it matches by position (first PC to first PC, etc.) since names may differ.

      Parameters:
      reference - the fluid containing BIPs to copy
      target - the fluid to receive the BIPs
    • getBinaryInteractionParameter

      private static double getBinaryInteractionParameter(SystemInterface fluid, String comp1, String comp2)
      Get a BIP value between two components in a fluid.
      Parameters:
      fluid - the fluid
      comp1 - first component name
      comp2 - second component name
      Returns:
      the BIP value, or 0.0 if not found
    • getPseudoComponentList

      private static List<ComponentInterface> getPseudoComponentList(SystemInterface fluid)
      Get ordered list of pseudo-components from a fluid.
      Parameters:
      fluid - the fluid
      Returns:
      list of pseudo-components in order
    • normalizeComposition

      public static void normalizeComposition(SystemInterface fluid)
      Normalize composition so mole fractions sum to 1.0.
      Parameters:
      fluid - the fluid to normalize
    • generateValidationReport

      public static CharacterizationValidationReport generateValidationReport(SystemInterface source, SystemInterface reference, SystemInterface characterized)
      Generate a validation report comparing source and characterized fluids.
      Parameters:
      source - the original source fluid
      reference - the reference fluid used for characterization
      characterized - the resulting characterized fluid
      Returns:
      validation report
    • stripPcSuffix

      private static String stripPcSuffix(String componentName)
    • finalizeFluid

      private static void finalizeFluid(SystemInterface system)
    • removeAllComponents

      private static void removeAllComponents(SystemInterface system)
    • extractComponents

      private static PseudoComponentCombiner.FluidExtraction extractComponents(SystemInterface fluid)
    • mergeBaseComponents

      private static Map<String,Double> mergeBaseComponents(Map<String,Double> accumulator, Map<String,Double> addition)
    • determineQuantileBoundaries

      private static List<Double> determineQuantileBoundaries(List<PseudoComponentCombiner.PseudoComponentContribution> contributions, int targetPseudoComponents)
    • determineReferenceBoundaries

      private static List<Double> determineReferenceBoundaries(List<PseudoComponentCombiner.PseudoComponentContribution> referenceContributions)
    • distributeToProfiles

      private static List<PseudoComponentCombiner.PseudoComponentProfile> distributeToProfiles(List<PseudoComponentCombiner.PseudoComponentContribution> contributions, List<Double> boundaries, int targetPseudoComponents)
    • combineProfiles

      private static List<PseudoComponentCombiner.PseudoComponentProfile> combineProfiles(List<List<PseudoComponentCombiner.PseudoComponentProfile>> perFluidProfiles, double[] fluidMassTotals, double[] fluidMoleTotals)