Class SeparatorPerformanceCalculator
- All Implemented Interfaces:
Serializable
This calculator provides an optional, physics-based alternative to the simple entrainment
fractions in the base Separator class. When enabled, it computes entrainment from
first-principles using:
- Inlet droplet size distribution (Rosin-Rammler, log-normal, or from Hinze correlation)
- Gravity separation section — cut diameter from vessel geometry and gas/liquid residence time
- Mist eliminator grade efficiency — wire mesh, vane pack, cyclone, or custom
- Liquid-liquid separation (three-phase) — oil/water droplet settling with plate pack option
The overall entrainment is the fraction of the inlet DSD that passes through all separation stages without being captured. For three-phase separators, separate calculations are performed for gas-oil, gas-water, oil-in-water, and water-in-oil entrainment.
Usage pattern:
SeparatorPerformanceCalculator calc = new SeparatorPerformanceCalculator();
// Configure inlet DSD (e.g., from pipe flow)
calc.setGasLiquidDSD(DropletSizeDistribution.rosinRammler(100e-6, 2.6));
// Configure mist eliminator
calc.setMistEliminatorCurve(GradeEfficiencyCurve.wireMeshDefault());
// Run calculation
calc.calculate(gasDensity, oilDensity, waterDensity, gasViscosity, oilViscosity, waterViscosity,
gasVelocity, separatorDiameter, separatorLength, orientation, liquidLevelFraction);
// Get results
double oilInGas = calc.getOilInGasFraction();
double waterInGas = calc.getWaterInGasFraction();
- Version:
- 1.0
- Author:
- NeqSim team
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classSummary for batch calibration against multiple cases.static classOne field/vendor calibration case with modeled and measured entrainment fractions.static classResult object for one-point calibration of entrainment factors. -
Field Summary
FieldsModifier and TypeFieldDescriptionAPI 12J compliance result (populated after calculate() if geometry is known).private booleanWhether to apply turbulent diffusion correction to the gravity cut diameter.private MultiphaseFlowRegimeFlow regime calculator for the inlet pipe.private static final doubleGravitational acceleration [m/s2].private DropletSizeDistributionInlet droplet size distribution for gas bubbles in liquid.private doubleCalibration multiplier for gas carry-under fractions (gas in liquid).private doubleCalculated gas-in-oil carry-under fraction (volume basis).private doubleCalculated gas-in-water carry-under fraction (volume basis).private DropletSizeDistributionInlet droplet size distribution for liquid-in-gas.private SeparatorGeometryCalculatorSeparator geometry calculator.private doubleGravity section cut diameter [m].private doubleGravity section efficiency for gas-liquid separation.private booleanWhether to include gravity pre-separation before mist eliminator.private doubleInlet device bulk separation efficiency.private InletDeviceModelInlet device model.private MultiphaseFlowRegime.FlowRegimeFlow regime at separator inlet.private doubleInlet pipe diameter [m] for flow regime prediction.private doubleK-factor (Souders-Brown) at operating conditions.private doubleK-factor utilization (operating K / design K).private doubleCalibration multiplier for liquid-in-gas carryover fractions.private doubleCalibration multiplier for liquid-liquid cross-contamination fractions.private doubleLiquid-liquid gravity section efficiency.private doubleLiquid-liquid residence time override [s].private GradeEfficiencyCurveGrade efficiency curve for the mist eliminator (gas section).private doubleMist eliminator efficiency.private booleanWhether flooding was detected in the mist eliminator.private doubleCalculated oil-in-gas entrainment fraction (volume basis).private DropletSizeDistributionInlet droplet size distribution for oil-in-water (three-phase).private doubleCalculated oil-in-water fraction (volume basis).private doubleOil volume fraction in the liquid phase [0-1] for three-phase calculations.private GradeEfficiencyCurveGrade efficiency curve for oil-water coalescer (if present).private doubleOil-water interfacial tension [N/m] for liquid-liquid DSD estimation.private doubleOverall gas-liquid separation efficiency.private DropletSizeDistributionDSD after inlet device transformation (intermediate result).private static final longSerialization version UID.private doubleGas-liquid interfacial tension [N/m] for DSD generation.private booleanWhether to use the enhanced calculation chain (flow regime + inlet device + geometry).private doubleCalculated water-in-gas entrainment fraction (volume basis).private DropletSizeDistributionInlet droplet size distribution for water-in-oil (three-phase).private doubleCalculated water-in-oil fraction (volume basis). -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new SeparatorPerformanceCalculator with default settings. -
Method Summary
Modifier and TypeMethodDescriptionprivate static voidAdds finite ratio values to a list.private voidApplies user-defined calibration multipliers to calculated entrainment fractions.private static doubleaverageFinite(double[] values, double defaultValue) Calculates the arithmetic mean of finite values, or returns a default value.private static doubleaveragePositive(double a, double b, double floor) Returns average of positive values above a floor, or 0 if no values qualify.buildBatchCalibrationReportJson(List<SeparatorPerformanceCalculator.CalibrationCase> cases, SeparatorPerformanceCalculator.BatchCalibrationSummary summary, double modelFloor) Builds a JSON calibration report with factors, aggregate error metrics, and per-case residuals.private doublecalcCombinedEfficiency(DropletSizeDistribution dsd, GradeEfficiencyCurve stage1, GradeEfficiencyCurve stage2) Calculates combined efficiency of two stages in series (gravity + mist eliminator).private voidcalcGasBubbleCarryUnder(double gasDensity, double liquidDensity, double liquidViscosity, double gasVelocity, double diameter, double length, String orientation, double liquidLevelFrac) private voidcalcGasLiquidSeparation(double gasDensity, double liquidDensity, double gasViscosity, double gasVelocity, double diameter, double length, String orientation, double liquidLevelFrac) Calculates gas-liquid separation efficiency combining gravity section and mist eliminator.private voidcalcLiquidLiquidSeparation(double oilDensity, double waterDensity, double oilViscosity, double waterViscosity, double diameter, double length, String orientation, double liquidLevelFrac) Calculates liquid-liquid separation (oil-water and water-oil).voidcalculate(double gasDensity, double oilDensity, double waterDensity, double gasViscosity, double oilViscosity, double waterViscosity, double gasVelocity, double vesselDiameter, double vesselLength, String orientation, double liquidLevelFraction) Performs the full separation performance calculation.private voidcalculateEnhanced(double gasDensity, double oilDensity, double waterDensity, double gasViscosity, double oilViscosity, double waterViscosity, double gasVelocity, double vesselDiameter, double vesselLength, String orientation, double liquidLevelFraction) Enhanced calculation chain integrating flow regime prediction, inlet device modeling, detailed vessel geometry, and database-driven internals performance.private voidcalculateStandard(double gasDensity, double oilDensity, double waterDensity, double gasViscosity, double oilViscosity, double waterViscosity, double gasVelocity, double vesselDiameter, double vesselLength, String orientation, double liquidLevelFraction) Standard calculation path (original implementation).calibrateFromCaseLibrary(List<SeparatorPerformanceCalculator.CalibrationCase> cases, double modelFloor) Calibrates factors from a list of modeled/measured cases.calibrateFromGroupedMeasurements(double measuredLiquidInGas, double measuredGasCarryUnder, double measuredLiquidLiquid, double modelFloor) Calibrates factors from grouped measurements (three values only).calibrateFromMeasuredFractions(double measuredOilInGas, double measuredWaterInGas, double measuredGasInOil, double measuredGasInWater, double measuredOilInWater, double measuredWaterInOil, double modelFloor) Auto-calibrates entrainment multipliers from one measured benchmark point.private static doubleclamp01(double value) Clamps a value to the physical [0, 1] range.private static intcountFinite(double[] values) Counts finite values in an array.private static doubleestimateLiquidResidenceTime(double diameter, double length, String orientation, double liquidLevelFrac, double gasVelocity) Estimates the liquid residence time from vessel geometry and gas velocity.static DropletSizeDistributiongenerateLiquidLiquidDSD(double interfacialTension, double continuousDensity, double nozzleVelocity, double nozzleDiameter) Generates a default Rosin-Rammler DSD for liquid-liquid droplets using the Hinze (1955) maximum stable droplet breakup criterion, adapted for oil-water interfacial tension and turbulent energy input at the separator inlet.Returns the API 12J compliance check result.private static doubleParses a numeric CSV column value.Gets the flow regime calculator.doubleGets calibration multiplier for gas carry-under.doubleGets the calculated gas-in-oil carry-under fraction (volume basis).doubleGets the calculated gas-in-water carry-under fraction (volume basis).Gets the gas-liquid droplet size distribution.Gets the separator geometry calculator.doubleGets the gravity section cut diameter [m].doubleGets the gravity section efficiency for gas-liquid separation.doubleGets the inlet device bulk separation efficiency.Gets the inlet device model.Gets the predicted inlet flow regime.doubleGets the inlet pipe diameter.doubleGets the K-factor (Souders-Brown) at operating conditions.doubleGets the K-factor utilization (operating K / design K).doubleGets calibration multiplier for liquid-in-gas carryover.doubleGets calibration multiplier for liquid-liquid cross-contamination.doubleGets the liquid-liquid gravity section efficiency.Gets the mist eliminator grade efficiency curve.doubleGets the mist eliminator efficiency.doubleGets the calculated oil-in-gas entrainment fraction (volume basis).doubleGets the calculated oil-in-water fraction (volume basis).doubleGets the oil volume fraction used in three-phase calculations.doubleGets the oil-water interfacial tension.doubleGets the overall gas-liquid separation efficiency.Gets the DSD after inlet device transformation.private static StringParses an optional string CSV column value.doubleGets the gas-liquid interfacial tension.doubleGets the calculated water-in-gas entrainment fraction (volume basis).doubleGets the calculated water-in-oil fraction (volume basis).booleanReturns whether the turbulent diffusion correction is active.booleanGets whether gravity pre-separation is included.booleanReturns whether the mist eliminator is flooded (K-factor exceeds design).booleanReturns whether enhanced calculation is enabled.loadCalibrationCasesFromCsv(String filePath) Loads calibration cases from a CSV file.private static doubleReturns arithmetic mean of a list of doubles.private static doublepairMape(double modeled, double measured, double floor) Computes absolute percentage error for one modeled/measured pair.private voidResets all calculated results to zero.private static doublesafeRatio(double measured, double modeled, double floor) Computes measured/model ratio for calibration if modeled value exceeds floor.voidsaveBatchCalibrationReportJson(String filePath, List<SeparatorPerformanceCalculator.CalibrationCase> cases, SeparatorPerformanceCalculator.BatchCalibrationSummary summary, double modelFloor) Saves batch calibration report JSON to disk.voidsetApplyTurbulenceCorrection(boolean apply) Enables or disables the turbulent diffusion correction on the gravity cut diameter.voidSets the flow regime calculator.voidSets the inlet droplet size distribution for gas bubbles entrained in liquid.voidsetGasCarryUnderCalibrationFactor(double factor) Sets calibration multiplier for gas carry-under (gas-in-oil and gas-in-water).voidSets the inlet droplet size distribution for liquid-in-gas separation.voidSets the separator geometry calculator.voidsetIncludeGravitySection(boolean include) Sets whether to include gravity pre-separation before the mist eliminator.voidSets the inlet device model.voidsetInletPipeDiameter(double diameter) Sets the inlet pipe diameter for flow regime prediction.voidsetLiquidInGasCalibrationFactor(double factor) Sets calibration multiplier for liquid-in-gas carryover (oil-in-gas and water-in-gas fractions).voidsetLiquidLiquidCalibrationFactor(double factor) Sets calibration multiplier for liquid-liquid cross-contamination (oil-in-water and water-in-oil fractions).voidsetLiquidLiquidResidenceTime(double seconds) Sets the liquid-liquid residence time override [s].voidSets the grade efficiency curve for the mist eliminator.voidSets the inlet droplet size distribution for oil-in-water droplets.voidsetOilVolumeFraction(double fraction) Sets the oil volume fraction in the liquid phase for three-phase calculations.voidSets the grade efficiency curve for a liquid-liquid coalescer (plate pack, etc.).voidsetOilWaterInterfacialTension(double sigma) Sets the oil-water interfacial tension for liquid-liquid DSD.voidsetSurfaceTension(double sigma) Sets the gas-liquid interfacial tension for DSD generation.voidsetUseEnhancedCalculation(boolean use) Enables or disables the enhanced calculation chain (flow regime, inlet device, geometry).voidSets the inlet droplet size distribution for water-in-oil droplets.toJson()Returns a JSON string with full performance calculation results.
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDSerialization version UID.- See Also:
-
G
private static final double GGravitational acceleration [m/s2].- See Also:
-
gasLiquidDSD
Inlet droplet size distribution for liquid-in-gas. -
oilInWaterDSD
Inlet droplet size distribution for oil-in-water (three-phase). -
waterInOilDSD
Inlet droplet size distribution for water-in-oil (three-phase). -
gasBubbleDSD
Inlet droplet size distribution for gas bubbles in liquid. -
mistEliminatorCurve
Grade efficiency curve for the mist eliminator (gas section). -
oilWaterCoalescerCurve
Grade efficiency curve for oil-water coalescer (if present). -
includeGravitySection
private boolean includeGravitySectionWhether to include gravity pre-separation before mist eliminator. -
flowRegimeCalc
Flow regime calculator for the inlet pipe. -
inletDeviceModel
Inlet device model. -
geometryCalc
Separator geometry calculator. -
useEnhancedCalculation
private boolean useEnhancedCalculationWhether to use the enhanced calculation chain (flow regime + inlet device + geometry). -
inletPipeDiameter
private double inletPipeDiameterInlet pipe diameter [m] for flow regime prediction. -
surfaceTension
private double surfaceTensionGas-liquid interfacial tension [N/m] for DSD generation. -
oilWaterInterfacialTension
private double oilWaterInterfacialTensionOil-water interfacial tension [N/m] for liquid-liquid DSD estimation. -
liquidLiquidResidenceTimeOverride
private double liquidLiquidResidenceTimeOverrideLiquid-liquid residence time override [s]. Zero means use geometry-calculated value. -
oilVolumeFraction
private double oilVolumeFractionOil volume fraction in the liquid phase [0-1] for three-phase calculations. Defaults to 0.5 (equal oil/water split). Set viasetOilVolumeFraction(double)when the actual oil/water split is known from the thermodynamic system. -
applyTurbulenceCorrection
private boolean applyTurbulenceCorrectionWhether to apply turbulent diffusion correction to the gravity cut diameter. -
mistEliminatorFlooded
private boolean mistEliminatorFloodedWhether flooding was detected in the mist eliminator. -
postInletDeviceDSD
DSD after inlet device transformation (intermediate result). -
apiComplianceResult
API 12J compliance result (populated after calculate() if geometry is known). -
oilInGasFraction
private double oilInGasFractionCalculated oil-in-gas entrainment fraction (volume basis). -
waterInGasFraction
private double waterInGasFractionCalculated water-in-gas entrainment fraction (volume basis). -
gasInOilFraction
private double gasInOilFractionCalculated gas-in-oil carry-under fraction (volume basis). -
gasInWaterFraction
private double gasInWaterFractionCalculated gas-in-water carry-under fraction (volume basis). -
oilInWaterFraction
private double oilInWaterFractionCalculated oil-in-water fraction (volume basis). -
waterInOilFraction
private double waterInOilFractionCalculated water-in-oil fraction (volume basis). -
gravitySectionEfficiency
private double gravitySectionEfficiencyGravity section efficiency for gas-liquid separation. -
mistEliminatorEfficiency
private double mistEliminatorEfficiencyMist eliminator efficiency. -
overallGasLiquidEfficiency
private double overallGasLiquidEfficiencyOverall gas-liquid separation efficiency. -
gravityCutDiameter
private double gravityCutDiameterGravity section cut diameter [m]. -
liquidLiquidGravityEfficiency
private double liquidLiquidGravityEfficiencyLiquid-liquid gravity section efficiency. -
kFactor
private double kFactorK-factor (Souders-Brown) at operating conditions. -
kFactorUtilization
private double kFactorUtilizationK-factor utilization (operating K / design K). -
liquidInGasCalibrationFactor
private double liquidInGasCalibrationFactorCalibration multiplier for liquid-in-gas carryover fractions. -
gasCarryUnderCalibrationFactor
private double gasCarryUnderCalibrationFactorCalibration multiplier for gas carry-under fractions (gas in liquid). -
liquidLiquidCalibrationFactor
private double liquidLiquidCalibrationFactorCalibration multiplier for liquid-liquid cross-contamination fractions. -
inletDeviceBulkEfficiency
private double inletDeviceBulkEfficiencyInlet device bulk separation efficiency. -
inletFlowRegime
Flow regime at separator inlet.
-
-
Constructor Details
-
SeparatorPerformanceCalculator
public SeparatorPerformanceCalculator()Creates a new SeparatorPerformanceCalculator with default settings.
-
-
Method Details
-
calculate
public void calculate(double gasDensity, double oilDensity, double waterDensity, double gasViscosity, double oilViscosity, double waterViscosity, double gasVelocity, double vesselDiameter, double vesselLength, String orientation, double liquidLevelFraction) Performs the full separation performance calculation.This method calculates entrainment fractions for all relevant phase pairs based on the configured droplet size distributions, grade efficiency curves, and separator geometry.
- Parameters:
gasDensity- gas phase density [kg/m3]oilDensity- oil phase density [kg/m3], 0 if no oilwaterDensity- water phase density [kg/m3], 0 if no watergasViscosity- gas phase dynamic viscosity [Pa.s]oilViscosity- oil phase dynamic viscosity [Pa.s]waterViscosity- water phase dynamic viscosity [Pa.s]gasVelocity- superficial gas velocity in gas section [m/s]vesselDiameter- internal diameter of separator [m]vesselLength- length of separator [m]orientation- "horizontal" or "vertical"liquidLevelFraction- fraction of vessel cross-section occupied by liquid (horizontal) or fraction of height (vertical) [0-1]
-
applyCalibrationFactors
private void applyCalibrationFactors()Applies user-defined calibration multipliers to calculated entrainment fractions.This preserves the mechanistic model structure while allowing reconciliation to plant/vendor test data. All calibrated values are clamped to [0, 1].
-
clamp01
private static double clamp01(double value) Clamps a value to the physical [0, 1] range.- Parameters:
value- raw value- Returns:
- clamped value in [0, 1]
-
calculateStandard
private void calculateStandard(double gasDensity, double oilDensity, double waterDensity, double gasViscosity, double oilViscosity, double waterViscosity, double gasVelocity, double vesselDiameter, double vesselLength, String orientation, double liquidLevelFraction) Standard calculation path (original implementation).- Parameters:
gasDensity- gas density [kg/m3]oilDensity- oil density [kg/m3]waterDensity- water density [kg/m3]gasViscosity- gas viscosity [Pa.s]oilViscosity- oil viscosity [Pa.s]waterViscosity- water viscosity [Pa.s]gasVelocity- gas velocity [m/s]vesselDiameter- vessel diameter [m]vesselLength- vessel length [m]orientation- vessel orientationliquidLevelFraction- liquid level fraction
-
calculateEnhanced
private void calculateEnhanced(double gasDensity, double oilDensity, double waterDensity, double gasViscosity, double oilViscosity, double waterViscosity, double gasVelocity, double vesselDiameter, double vesselLength, String orientation, double liquidLevelFraction) Enhanced calculation chain integrating flow regime prediction, inlet device modeling, detailed vessel geometry, and database-driven internals performance.Calculation sequence:
- Predict inlet pipe flow regime and generate regime-specific DSD
- Model inlet device: bulk separation, DSD transformation, pressure drop
- Calculate vessel geometry: gas/liquid areas, settling heights, K-factor
- Gravity section: droplet settling with proper residence time from geometry
- Mist eliminator: grade efficiency with K-factor flooding check
- Liquid-liquid separation with geometry-based residence time (three-phase)
- Parameters:
gasDensity- gas phase density [kg/m3]oilDensity- oil phase density [kg/m3], 0 if no oilwaterDensity- water phase density [kg/m3], 0 if no watergasViscosity- gas phase dynamic viscosity [Pa.s]oilViscosity- oil phase dynamic viscosity [Pa.s]waterViscosity- water phase dynamic viscosity [Pa.s]gasVelocity- superficial gas velocity in gas section [m/s]vesselDiameter- internal diameter of separator [m]vesselLength- length of separator [m]orientation- "horizontal" or "vertical"liquidLevelFraction- fraction of vessel cross-section occupied by liquid [0-1]
-
calcGasLiquidSeparation
private void calcGasLiquidSeparation(double gasDensity, double liquidDensity, double gasViscosity, double gasVelocity, double diameter, double length, String orientation, double liquidLevelFrac) Calculates gas-liquid separation efficiency combining gravity section and mist eliminator.- Parameters:
gasDensity- gas density [kg/m3]liquidDensity- liquid density [kg/m3]gasViscosity- gas viscosity [Pa.s]gasVelocity- superficial gas velocity [m/s]diameter- vessel diameter [m]length- vessel length [m]orientation- vessel orientationliquidLevelFrac- liquid level fraction
-
calcCombinedEfficiency
private double calcCombinedEfficiency(DropletSizeDistribution dsd, GradeEfficiencyCurve stage1, GradeEfficiencyCurve stage2) Calculates combined efficiency of two stages in series (gravity + mist eliminator).For each size class, the combined efficiency is:
$$ \eta_{combined}(d) = 1 - (1 - \eta_1(d)) \cdot (1 - \eta_2(d)) $$- Parameters:
dsd- droplet size distributionstage1- first stage (gravity)stage2- second stage (mist eliminator)- Returns:
- combined overall efficiency
-
estimateLiquidResidenceTime
private static double estimateLiquidResidenceTime(double diameter, double length, String orientation, double liquidLevelFrac, double gasVelocity) Estimates the liquid residence time from vessel geometry and gas velocity.Uses mass continuity to derive the superficial liquid velocity from the superficial gas velocity and the phase fraction, then divides vessel length by that velocity.
- Parameters:
diameter- vessel internal diameter [m]length- vessel tangent-to-tangent length [m]orientation- "horizontal" or "vertical"liquidLevelFrac- fraction of cross-section occupied by liquid [0-1]gasVelocity- superficial gas velocity [m/s]- Returns:
- estimated liquid residence time [s]
-
calcGasBubbleCarryUnder
private void calcGasBubbleCarryUnder(double gasDensity, double liquidDensity, double liquidViscosity, double gasVelocity, double diameter, double length, String orientation, double liquidLevelFrac) -
calcLiquidLiquidSeparation
private void calcLiquidLiquidSeparation(double oilDensity, double waterDensity, double oilViscosity, double waterViscosity, double diameter, double length, String orientation, double liquidLevelFrac) Calculates liquid-liquid separation (oil-water and water-oil).- Parameters:
oilDensity- oil density [kg/m3]waterDensity- water density [kg/m3]oilViscosity- oil viscosity [Pa.s]waterViscosity- water viscosity [Pa.s]diameter- vessel diameter [m]length- vessel length [m]orientation- vessel orientationliquidLevelFrac- total liquid level fraction
-
resetResults
private void resetResults()Resets all calculated results to zero. -
toJson
Returns a JSON string with full performance calculation results.- Returns:
- JSON string
-
getOilInGasFraction
public double getOilInGasFraction()Gets the calculated oil-in-gas entrainment fraction (volume basis).- Returns:
- oilInGasFraction [0-1]
-
getWaterInGasFraction
public double getWaterInGasFraction()Gets the calculated water-in-gas entrainment fraction (volume basis).- Returns:
- waterInGasFraction [0-1]
-
getGasInOilFraction
public double getGasInOilFraction()Gets the calculated gas-in-oil carry-under fraction (volume basis).- Returns:
- gasInOilFraction [0-1]
-
getGasInWaterFraction
public double getGasInWaterFraction()Gets the calculated gas-in-water carry-under fraction (volume basis).- Returns:
- gasInWaterFraction [0-1]
-
getOilInWaterFraction
public double getOilInWaterFraction()Gets the calculated oil-in-water fraction (volume basis).- Returns:
- oilInWaterFraction [0-1]
-
getWaterInOilFraction
public double getWaterInOilFraction()Gets the calculated water-in-oil fraction (volume basis).- Returns:
- waterInOilFraction [0-1]
-
getGravitySectionEfficiency
public double getGravitySectionEfficiency()Gets the gravity section efficiency for gas-liquid separation.- Returns:
- gravitySectionEfficiency [0-1]
-
getMistEliminatorEfficiency
public double getMistEliminatorEfficiency()Gets the mist eliminator efficiency.- Returns:
- mistEliminatorEfficiency [0-1]
-
getOverallGasLiquidEfficiency
public double getOverallGasLiquidEfficiency()Gets the overall gas-liquid separation efficiency.- Returns:
- overallGasLiquidEfficiency [0-1]
-
getGravityCutDiameter
public double getGravityCutDiameter()Gets the gravity section cut diameter [m].- Returns:
- gravityCutDiameter [m]
-
getLiquidLiquidGravityEfficiency
public double getLiquidLiquidGravityEfficiency()Gets the liquid-liquid gravity section efficiency.- Returns:
- liquidLiquidGravityEfficiency [0-1]
-
setGasLiquidDSD
Sets the inlet droplet size distribution for liquid-in-gas separation.- Parameters:
dsd- droplet size distribution
-
getGasLiquidDSD
Gets the gas-liquid droplet size distribution.- Returns:
- dsd or null if not set
-
setOilInWaterDSD
Sets the inlet droplet size distribution for oil-in-water droplets.- Parameters:
dsd- droplet size distribution
-
setWaterInOilDSD
Sets the inlet droplet size distribution for water-in-oil droplets.- Parameters:
dsd- droplet size distribution
-
setGasBubbleDSD
Sets the inlet droplet size distribution for gas bubbles entrained in liquid.- Parameters:
dsd- bubble size distribution
-
setMistEliminatorCurve
Sets the grade efficiency curve for the mist eliminator.- Parameters:
curve- grade efficiency curve
-
getMistEliminatorCurve
Gets the mist eliminator grade efficiency curve.- Returns:
- curve or null if not set
-
setOilWaterCoalescerCurve
Sets the grade efficiency curve for a liquid-liquid coalescer (plate pack, etc.).- Parameters:
curve- grade efficiency curve
-
setIncludeGravitySection
public void setIncludeGravitySection(boolean include) Sets whether to include gravity pre-separation before the mist eliminator.- Parameters:
include- true to include gravity section (default true)
-
isIncludeGravitySection
public boolean isIncludeGravitySection()Gets whether gravity pre-separation is included.- Returns:
- true if gravity section is included
-
setLiquidLiquidResidenceTime
public void setLiquidLiquidResidenceTime(double seconds) Sets the liquid-liquid residence time override [s].- Parameters:
seconds- residence time [s]
-
setLiquidInGasCalibrationFactor
public void setLiquidInGasCalibrationFactor(double factor) Sets calibration multiplier for liquid-in-gas carryover (oil-in-gas and water-in-gas fractions).- Parameters:
factor- calibration factor (>= 0), where 1.0 means no calibration
-
getLiquidInGasCalibrationFactor
public double getLiquidInGasCalibrationFactor()Gets calibration multiplier for liquid-in-gas carryover.- Returns:
- calibration factor
-
setGasCarryUnderCalibrationFactor
public void setGasCarryUnderCalibrationFactor(double factor) Sets calibration multiplier for gas carry-under (gas-in-oil and gas-in-water).- Parameters:
factor- calibration factor (>= 0), where 1.0 means no calibration
-
getGasCarryUnderCalibrationFactor
public double getGasCarryUnderCalibrationFactor()Gets calibration multiplier for gas carry-under.- Returns:
- calibration factor
-
setLiquidLiquidCalibrationFactor
public void setLiquidLiquidCalibrationFactor(double factor) Sets calibration multiplier for liquid-liquid cross-contamination (oil-in-water and water-in-oil fractions).- Parameters:
factor- calibration factor (>= 0), where 1.0 means no calibration
-
getLiquidLiquidCalibrationFactor
public double getLiquidLiquidCalibrationFactor()Gets calibration multiplier for liquid-liquid cross-contamination.- Returns:
- calibration factor
-
loadCalibrationCasesFromCsv
public static List<SeparatorPerformanceCalculator.CalibrationCase> loadCalibrationCasesFromCsv(String filePath) throws IOException Loads calibration cases from a CSV file.Required headers (case-insensitive):
- modeled_oil_in_gas, modeled_water_in_gas, modeled_gas_in_oil, modeled_gas_in_water, modeled_oil_in_water, modeled_water_in_oil
- measured_oil_in_gas, measured_water_in_gas, measured_gas_in_oil, measured_gas_in_water, measured_oil_in_water, measured_water_in_oil
Optional header: case_id.
- Parameters:
filePath- path to CSV file- Returns:
- list of calibration cases
- Throws:
IOException- if reading fails or required columns are missing
-
calibrateFromGroupedMeasurements
public SeparatorPerformanceCalculator.CalibrationSummary calibrateFromGroupedMeasurements(double measuredLiquidInGas, double measuredGasCarryUnder, double measuredLiquidLiquid, double modelFloor) Calibrates factors from grouped measurements (three values only).Groups are interpreted as:
- liquid-in-gas: average of oil-in-gas and water-in-gas model values
- gas carry-under: average of gas-in-oil and gas-in-water model values
- liquid-liquid: average of oil-in-water and water-in-oil model values
- Parameters:
measuredLiquidInGas- measured grouped liquid-in-gasmeasuredGasCarryUnder- measured grouped gas carry-undermeasuredLiquidLiquid- measured grouped liquid-liquid cross-contaminationmodelFloor- minimum model value for ratio fitting- Returns:
- calibration summary
-
calibrateFromCaseLibrary
public SeparatorPerformanceCalculator.BatchCalibrationSummary calibrateFromCaseLibrary(List<SeparatorPerformanceCalculator.CalibrationCase> cases, double modelFloor) Calibrates factors from a list of modeled/measured cases.- Parameters:
cases- calibration casesmodelFloor- minimum model value for ratio fitting- Returns:
- batch calibration summary with pre/post error metrics
-
buildBatchCalibrationReportJson
public String buildBatchCalibrationReportJson(List<SeparatorPerformanceCalculator.CalibrationCase> cases, SeparatorPerformanceCalculator.BatchCalibrationSummary summary, double modelFloor) Builds a JSON calibration report with factors, aggregate error metrics, and per-case residuals.- Parameters:
cases- calibration cases used in fittingsummary- batch calibration summary returned bycalibrateFromCaseLibrary(List, double)modelFloor- minimum floor used for percentage error calculations- Returns:
- pretty-printed JSON calibration report
-
saveBatchCalibrationReportJson
public void saveBatchCalibrationReportJson(String filePath, List<SeparatorPerformanceCalculator.CalibrationCase> cases, SeparatorPerformanceCalculator.BatchCalibrationSummary summary, double modelFloor) throws IOException Saves batch calibration report JSON to disk.- Parameters:
filePath- output file pathcases- calibration cases used in fittingsummary- batch calibration summarymodelFloor- minimum floor used for percentage error calculations- Throws:
IOException- if file writing fails
-
getDouble
private static double getDouble(String[] cols, Map<String, Integer> idx, String key, int row) throws IOExceptionParses a numeric CSV column value.- Parameters:
cols- CSV columnsidx- header index mapkey- column keyrow- row number (for diagnostics)- Returns:
- parsed double value
- Throws:
IOException- if parsing fails
-
getString
-
addRatio
-
meanList
-
pairMape
private static double pairMape(double modeled, double measured, double floor) Computes absolute percentage error for one modeled/measured pair.- Parameters:
modeled- modeled valuemeasured- measured valuefloor- small floor to avoid division by zero- Returns:
- absolute percentage error
-
averagePositive
private static double averagePositive(double a, double b, double floor) Returns average of positive values above a floor, or 0 if no values qualify.- Parameters:
a- value ab- value bfloor- minimum value threshold- Returns:
- average or 0
-
calibrateFromMeasuredFractions
public SeparatorPerformanceCalculator.CalibrationSummary calibrateFromMeasuredFractions(double measuredOilInGas, double measuredWaterInGas, double measuredGasInOil, double measuredGasInWater, double measuredOilInWater, double measuredWaterInOil, double modelFloor) Auto-calibrates entrainment multipliers from one measured benchmark point.This method uses the current calculated fractions as model values and computes group-wise multipliers from measured/model ratios:
- Liquid-in-gas: oil-in-gas and water-in-gas
- Gas carry-under: gas-in-oil and gas-in-water
- Liquid-liquid: oil-in-water and water-in-oil
Ratios are only formed for model values above
modelFloor. The group multiplier is the arithmetic mean of valid ratios. If no valid ratios exist in a group, the existing factor is retained.- Parameters:
measuredOilInGas- measured oil-in-gas fraction [0-1]measuredWaterInGas- measured water-in-gas fraction [0-1]measuredGasInOil- measured gas-in-oil fraction [0-1]measuredGasInWater- measured gas-in-water fraction [0-1]measuredOilInWater- measured oil-in-water fraction [0-1]measuredWaterInOil- measured water-in-oil fraction [0-1]modelFloor- minimum modeled fraction to use in ratio fitting (e.g. 1e-9)- Returns:
- calibration summary containing old/new factors and data-point usage
-
safeRatio
private static double safeRatio(double measured, double modeled, double floor) Computes measured/model ratio for calibration if modeled value exceeds floor.- Parameters:
measured- measured fractionmodeled- modeled fractionfloor- minimum modeled value for ratio use- Returns:
- ratio, or NaN if modeled value is below floor
-
countFinite
private static int countFinite(double[] values) Counts finite values in an array.- Parameters:
values- input values- Returns:
- number of finite values
-
averageFinite
private static double averageFinite(double[] values, double defaultValue) Calculates the arithmetic mean of finite values, or returns a default value.- Parameters:
values- input valuesdefaultValue- fallback if no finite values are present- Returns:
- arithmetic mean of finite values or defaultValue
-
setUseEnhancedCalculation
public void setUseEnhancedCalculation(boolean use) Enables or disables the enhanced calculation chain (flow regime, inlet device, geometry).- Parameters:
use- true to enable enhanced calculation
-
isUseEnhancedCalculation
public boolean isUseEnhancedCalculation()Returns whether enhanced calculation is enabled.- Returns:
- true if enhanced calculation is enabled
-
setInletPipeDiameter
public void setInletPipeDiameter(double diameter) Sets the inlet pipe diameter for flow regime prediction.- Parameters:
diameter- inlet pipe diameter [m]
-
getInletPipeDiameter
public double getInletPipeDiameter()Gets the inlet pipe diameter.- Returns:
- inlet pipe diameter [m]
-
setSurfaceTension
public void setSurfaceTension(double sigma) Sets the gas-liquid interfacial tension for DSD generation.- Parameters:
sigma- interfacial tension [N/m]
-
getSurfaceTension
public double getSurfaceTension()Gets the gas-liquid interfacial tension.- Returns:
- interfacial tension [N/m]
-
setOilWaterInterfacialTension
public void setOilWaterInterfacialTension(double sigma) Sets the oil-water interfacial tension for liquid-liquid DSD.- Parameters:
sigma- interfacial tension [N/m]
-
getOilWaterInterfacialTension
public double getOilWaterInterfacialTension()Gets the oil-water interfacial tension.- Returns:
- interfacial tension [N/m]
-
setInletDeviceModel
Sets the inlet device model.- Parameters:
model- inlet device model
-
getInletDeviceModel
Gets the inlet device model.- Returns:
- inlet device model or null
-
setFlowRegimeCalculator
Sets the flow regime calculator.- Parameters:
calc- flow regime calculator
-
getFlowRegimeCalculator
Gets the flow regime calculator.- Returns:
- flow regime calculator or null
-
setGeometryCalculator
Sets the separator geometry calculator.- Parameters:
calc- geometry calculator
-
getGeometryCalculator
Gets the separator geometry calculator.- Returns:
- geometry calculator or null
-
getKFactor
public double getKFactor()Gets the K-factor (Souders-Brown) at operating conditions.- Returns:
- kFactor [m/s]
-
getKFactorUtilization
public double getKFactorUtilization()Gets the K-factor utilization (operating K / design K).- Returns:
- kFactorUtilization [0-...], values above 1.0 indicate flooding
-
getInletDeviceBulkEfficiency
public double getInletDeviceBulkEfficiency()Gets the inlet device bulk separation efficiency.- Returns:
- inletDeviceBulkEfficiency [0-1]
-
getInletFlowRegime
Gets the predicted inlet flow regime.- Returns:
- flow regime enum or null if not calculated
-
isMistEliminatorFlooded
public boolean isMistEliminatorFlooded()Returns whether the mist eliminator is flooded (K-factor exceeds design).- Returns:
- true if flooded
-
getPostInletDeviceDSD
Gets the DSD after inlet device transformation.- Returns:
- transformed DSD or null if not calculated
-
setOilVolumeFraction
public void setOilVolumeFraction(double fraction) Sets the oil volume fraction in the liquid phase for three-phase calculations.This fraction is used when splitting the liquid flow between the oil and water phases in the vessel geometry calculation. The default of 0.5 (50/50 split) should be overridden by the
Separator.run()method using the actual phase volumes from the thermodynamic system.- Parameters:
fraction- oil volume fraction [0-1]
-
getOilVolumeFraction
public double getOilVolumeFraction()Gets the oil volume fraction used in three-phase calculations.- Returns:
- oil volume fraction [0-1]
-
setApplyTurbulenceCorrection
public void setApplyTurbulenceCorrection(boolean apply) Enables or disables the turbulent diffusion correction on the gravity cut diameter.When enabled (default), the Csanady (1963) turbulent dispersion correction increases the effective cut diameter to account for turbulence in the separator vessel, giving a more accurate (less optimistic) prediction at higher gas loads. Disable only for quiescent-flow validation cases.
- Parameters:
apply- true to apply correction (default), false to use pure gravity settling
-
isApplyTurbulenceCorrection
public boolean isApplyTurbulenceCorrection()Returns whether the turbulent diffusion correction is active.- Returns:
- true if turbulence correction is applied
-
getApiComplianceResult
Returns the API 12J compliance check result.Populated automatically after
calculate(double, double, double, double, double, double, double, double, double, String, double)when a gravity cut diameter is available. Returnsnullbefore the first calculation or when insufficient geometry data is available.- Returns:
- API 12J compliance result, or
nullif not yet computed
-
generateLiquidLiquidDSD
public static DropletSizeDistribution generateLiquidLiquidDSD(double interfacialTension, double continuousDensity, double nozzleVelocity, double nozzleDiameter) Generates a default Rosin-Rammler DSD for liquid-liquid droplets using the Hinze (1955) maximum stable droplet breakup criterion, adapted for oil-water interfacial tension and turbulent energy input at the separator inlet.The maximum stable droplet diameter in turbulent flow (Hinze, 1955): $d_{max} = C \cdot (\sigma / \rho_c)^{3/5} \cdot \epsilon^{-2/5}$ where $\epsilon$ is the turbulent energy dissipation rate estimated from inlet momentum: $\epsilon \approx u_n^3 / D_{nozzle}$.
The median diameter is set to $d_{max} / 4$ and a Rosin-Rammler spread of 1.8 is used, consistent with oil-water emulsion data (Luo and Svendsen, 1996).
References:
- Hinze, J.O. (1955). Fundamentals of the hydrodynamic mechanism of splitting in dispersion processes. AIChE J., 1(3), 289-295.
- Luo, H., Svendsen, H.F. (1996). Theoretical model for drop and bubble breakup in turbulent dispersions. AIChE J., 42(5), 1225-1233.
- Parameters:
interfacialTension- oil-water interfacial tension [N/m]continuousDensity- continuous phase density [kg/m3]nozzleVelocity- inlet nozzle velocity [m/s]nozzleDiameter- inlet nozzle diameter [m]- Returns:
- Rosin-Rammler DSD representing the initial liquid-liquid droplet population
-