Class DryGasSealAnalyzer
This analyzer addresses a well-documented failure mode in high-pressure gas compressors (API 692): gas leaking through the primary dry gas seal clearance undergoes isenthalpic (Joule-Thomson) expansion from seal cavity pressure to primary vent pressure. When the seal gas contains C3+ hydrocarbons, this expansion can produce liquid condensation in the primary vent piping, standpipe dead-legs, and seal faces.
Key physics modelled:
- Isenthalpic (PH-flash) expansion through seal gap at multiple outlet pressures
- Retrograde condensation mapping over the full T-P operating envelope
- Dead-leg cooldown transient (lumped thermal model with natural convection)
- Condensate accumulation rate from continuous seal leakage
- Flash vaporisation impact pressure during repressurisation (water hammer analogy)
- Gas Conditioning Unit (GCU) sizing: required cooling, separation, and reheating
Usage example:
SystemInterface sealGas = new SystemPrEos(273.15 + 44.0, 422.0);
sealGas.addComponent("methane", 0.7997);
sealGas.addComponent("ethane", 0.0996);
// ... add remaining components
sealGas.setMixingRule("classic");
DryGasSealAnalyzer analyzer = new DryGasSealAnalyzer("GIC-Seal");
analyzer.setSealGas(sealGas);
analyzer.setSealCavityPressure(421.0, "barg");
analyzer.setSealCavityTemperature(44.0, "C");
analyzer.setPrimaryVentPressure(1.5, "barg");
analyzer.setSealLeakageRate(280.0, "NL/min");
analyzer.setStandpipeGeometry(1.5, 0.038);
analyzer.setStandpipeCount(2);
analyzer.setAmbientTemperature(25.0, "C");
analyzer.runFullAnalysis();
Map<String, Object> results = analyzer.getResults();
boolean safe = analyzer.isSafeToOperate();
double fillTimeHours = analyzer.getStandpipeFillTimeHours();
- Version:
- 1.0
- Author:
- neqsim
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate doubleAmbient temperature in Kelvin.private booleanWhether the full analysis has been run.private doubleGCU subcool margin below dew point in Kelvin.private doubleGCU superheat margin above dew point in Kelvin.private doubleInsulation thermal conductivity in W/(m K).private doublePipe insulation thickness in metres (0 = bare pipe).private static final org.apache.logging.log4j.LoggerLogger object for class.private final StringAnalyzer tag/name.private doublePrimary vent back-pressure in bara.Master results map (nested hierarchy).private doubleSeal cavity pressure in bara.private doubleSeal cavity temperature in Kelvin.private doublePrimary seal radial clearance in metres.private SystemInterfaceThe seal gas fluid (will be cloned for each sub-analysis).private doubleSeal leakage rate at standard conditions in normal litres per minute.private intNumber of standpipes (typically 2: drive end + non-drive end).private doubleStandpipe inner diameter in metres.private doubleStandpipe (dead-leg) length in metres.private doubleStandpipe wall thickness in metres (for cooldown model).private static final doubleprivate static final doubleStandard conditions: 0 degC, 1.01325 bara for normal litres.private static final doubleStefan-Boltzmann constant in W/(m2 K4).private doubleWind speed in m/s (for forced convection on pipe exterior). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate doublecalculateExternalHTC(double outerRadius, double surfaceTemperatureK) Calculates the external heat transfer coefficient combining forced convection (wind) and radiation from a horizontal/vertical cylinder in air.private doublecalculateOverallU(double ri, double ro, double rIns, double steelK, double hExt) Calculates the overall heat transfer coefficient for the pipe wall + insulation composite.private static doubleconvertPressureToBara(double pressure, String unit) Converts a pressure value to bara.private static doubleconvertTemperatureToKelvin(double temperature, String unit) Converts a temperature value to Kelvin.doubleReturns the maximum liquid volume fraction produced during isenthalpic expansion.getName()Returns the analyzer name.Returns the complete results hierarchy from the full analysis.doubleReturns the estimated time in hours for the standpipe dead-legs to fill with condensate from continuous seal leakage.getVentConditions(double inletEnthalpy) Gets the outlet conditions at the primary vent pressure after isenthalpic expansion.booleanReturns whether the full analysis has been completed.booleanReturns whether the seal gas system is safe from condensation at the configured conditions.Calculates the condensate accumulation rate from continuous seal leakage, considering both the JT expansion mechanism (primary) and retrograde condensation from gas cooling in dead-legs (secondary).Simulates the transient cooldown of gas trapped in a standpipe dead-leg after compressor shutdown.Estimates the pressure impulse generated when accumulated liquid condensate flashes to vapour during rapid repressurisation of the seal gas system.voidRuns the complete dry gas seal condensation analysis.Sizes a Gas Conditioning Unit (GCU) per API 692 guidelines.Models isenthalpic (constant enthalpy) expansion of seal gas leaking through the dry gas seal clearance from seal cavity pressure to primary vent pressure.Maps the retrograde condensation region by performing TP flash calculations over a grid of temperatures and pressures covering the seal gas standstill operating envelope.voidsetAmbientTemperature(double temperature, String unit) Sets the ambient temperature.voidsetGCUMargins(double superheatK, double subcoolK) Sets the GCU superheat and subcool margins per API 692.voidsetInsulation(double thicknessM, double conductivity) Sets the pipe insulation properties.voidsetPrimaryVentPressure(double pressure, String unit) Sets the primary vent back-pressure (downstream of seal gap).voidsetSealCavityPressure(double pressure, String unit) Sets the seal cavity pressure (upstream of the seal gap).voidsetSealCavityTemperature(double temperature, String unit) Sets the seal cavity temperature (upstream of the seal gap).voidsetSealClearance(double clearance, String unit) Sets the primary seal radial clearance.voidsetSealGas(SystemInterface sealGas) Sets the seal gas thermodynamic system.voidsetSealLeakageRate(double rate, String unit) Sets the seal leakage rate at standard conditions.voidsetStandpipeCount(int count) Sets the number of standpipe dead-legs.voidsetStandpipeGeometry(double lengthM, double innerDiameterM) Sets the standpipe (dead-leg) geometry.voidsetStandpipeWallThickness(double thicknessM) Sets the standpipe wall thickness for thermal model.voidsetWindSpeed(double speedMs) Sets the wind speed for forced convection heat transfer calculation.toJson()Returns the results as a JSON string.
-
Field Details
-
logger
private static final org.apache.logging.log4j.Logger loggerLogger object for class. -
STD_TEMPERATURE_K
private static final double STD_TEMPERATURE_KStandard conditions: 0 degC, 1.01325 bara for normal litres.- See Also:
-
STD_PRESSURE_BARA
private static final double STD_PRESSURE_BARA- See Also:
-
STEFAN_BOLTZMANN
private static final double STEFAN_BOLTZMANNStefan-Boltzmann constant in W/(m2 K4).- See Also:
-
name
Analyzer tag/name. -
sealGas
The seal gas fluid (will be cloned for each sub-analysis). -
sealCavityPressureBara
private double sealCavityPressureBaraSeal cavity pressure in bara. -
sealCavityTemperatureK
private double sealCavityTemperatureKSeal cavity temperature in Kelvin. -
private double primaryVentPressureBaraPrimary vent back-pressure in bara.
-
sealClearanceM
private double sealClearanceMPrimary seal radial clearance in metres. -
sealLeakageNLmin
private double sealLeakageNLminSeal leakage rate at standard conditions in normal litres per minute. -
standpipeLengthM
private double standpipeLengthMStandpipe (dead-leg) length in metres. -
standpipeIDM
private double standpipeIDMStandpipe inner diameter in metres. -
standpipeCount
private int standpipeCountNumber of standpipes (typically 2: drive end + non-drive end). -
standpipeWallThicknessM
private double standpipeWallThicknessMStandpipe wall thickness in metres (for cooldown model). -
insulationThicknessM
private double insulationThicknessMPipe insulation thickness in metres (0 = bare pipe). -
insulationConductivity
private double insulationConductivityInsulation thermal conductivity in W/(m K). -
ambientTemperatureK
private double ambientTemperatureKAmbient temperature in Kelvin. -
windSpeedMs
private double windSpeedMsWind speed in m/s (for forced convection on pipe exterior). -
results
-
analysisComplete
private boolean analysisCompleteWhether the full analysis has been run. -
gcuSuperheatMarginK
private double gcuSuperheatMarginKGCU superheat margin above dew point in Kelvin. -
gcuSubcoolMarginK
private double gcuSubcoolMarginKGCU subcool margin below dew point in Kelvin.
-
-
Constructor Details
-
DryGasSealAnalyzer
Constructor for DryGasSealAnalyzer.- Parameters:
name- the analyzer tag or compressor seal identification
-
-
Method Details
-
setSealGas
Sets the seal gas thermodynamic system. The fluid is cloned internally so the original is not modified.- Parameters:
sealGas- the thermodynamic system representing the seal gas composition
-
setSealCavityPressure
Sets the seal cavity pressure (upstream of the seal gap).- Parameters:
pressure- the pressure valueunit- pressure unit: "bara", "barg", "Pa", "MPa"
-
setSealCavityTemperature
Sets the seal cavity temperature (upstream of the seal gap).- Parameters:
temperature- the temperature valueunit- temperature unit: "C", "K", "F"
-
setPrimaryVentPressure
Sets the primary vent back-pressure (downstream of seal gap).- Parameters:
pressure- the pressure valueunit- pressure unit: "bara", "barg", "Pa", "MPa"
-
setSealClearance
Sets the primary seal radial clearance.- Parameters:
clearance- the clearance in the specified unitunit- length unit: "m", "mm", "um"
-
setSealLeakageRate
Sets the seal leakage rate at standard conditions.- Parameters:
rate- the leakage rateunit- rate unit: "NL/min", "Nm3/hr", "kg/hr"
-
setStandpipeGeometry
public void setStandpipeGeometry(double lengthM, double innerDiameterM) Sets the standpipe (dead-leg) geometry.- Parameters:
lengthM- length in metresinnerDiameterM- inner diameter in metres
-
setStandpipeCount
public void setStandpipeCount(int count) Sets the number of standpipe dead-legs.- Parameters:
count- number of standpipes
-
setStandpipeWallThickness
public void setStandpipeWallThickness(double thicknessM) Sets the standpipe wall thickness for thermal model.- Parameters:
thicknessM- wall thickness in metres
-
setInsulation
public void setInsulation(double thicknessM, double conductivity) Sets the pipe insulation properties.- Parameters:
thicknessM- insulation thickness in metres (0 for bare pipe)conductivity- insulation thermal conductivity in W/(m K)
-
setAmbientTemperature
Sets the ambient temperature.- Parameters:
temperature- the temperature valueunit- temperature unit: "C", "K", "F"
-
setWindSpeed
public void setWindSpeed(double speedMs) Sets the wind speed for forced convection heat transfer calculation.- Parameters:
speedMs- wind speed in m/s
-
setGCUMargins
public void setGCUMargins(double superheatK, double subcoolK) Sets the GCU superheat and subcool margins per API 692.- Parameters:
superheatK- margin above dew point for reheating in KelvinsubcoolK- margin below dew point for cooling in Kelvin
-
runFullAnalysis
public void runFullAnalysis()Runs the complete dry gas seal condensation analysis. This is the main entry point that chains all sub-analyses in sequence.Sub-analyses executed:
- Isenthalpic expansion through seal gap (JT cooling + condensation)
- Retrograde condensation map over T-P space
- Dead-leg cooldown transient simulation
- Condensate accumulation rate calculation
- Flash vaporisation impact pressure estimation
- GCU sizing calculation
-
runIsenthalpicExpansionAnalysis
Models isenthalpic (constant enthalpy) expansion of seal gas leaking through the dry gas seal clearance from seal cavity pressure to primary vent pressure.Physics: Gas leaks through the narrow annular seal gap (typically 3-5 um operating, up to 0.23 mm static). The process is approximately isenthalpic (negligible heat transfer in the short transit through the seal). The PH-flash at each outlet pressure gives the temperature and phase distribution after expansion.
Governing equation (Joule-Thomson coefficient):
$$\mu_{JT} = \left(\frac{\partial T}{\partial P}\right)_H = \frac{1}{C_p}\left[T \left(\frac{\partial V}{\partial T}\right)_P - V\right]$$- Returns:
- map with outlet temperatures, liquid fractions, and JT coefficients at each pressure step
-
getVentConditions
-
runRetrogradeCdensationMap
Maps the retrograde condensation region by performing TP flash calculations over a grid of temperatures and pressures covering the seal gas standstill operating envelope.This produces the condensation contour map used for operational planning: any T-P condition in the two-phase region will produce liquid in the seal gas piping.
- Returns:
- map with condensation grid data, dew point curve, and maximum condensation conditions
-
runDeadLegCooldown
Simulates the transient cooldown of gas trapped in a standpipe dead-leg after compressor shutdown. Uses a lumped thermal capacitance model combining natural convection and radiation heat loss from the pipe exterior.Governing equation (lumped thermal model):
$$(\rho C_p)_{eff} V \frac{dT}{dt} = -U A_{outer} (T - T_{amb})$$where the overall heat transfer coefficient U includes:
- Internal natural convection: Churchill-Chu correlation for vertical cylinders
- Pipe wall conduction: $k_{steel} / t_{wall}$
- Insulation conduction: $k_{ins} / t_{ins}$ (if present)
- External combined convection + radiation
At each time step, the gas T-P state is re-flashed (TP flash) to detect when condensation first occurs during cooldown and how liquid fraction evolves.
- Returns:
- map with cooldown temperature profile, time to dew point, and liquid accumulation
-
calculateExternalHTC
private double calculateExternalHTC(double outerRadius, double surfaceTemperatureK) Calculates the external heat transfer coefficient combining forced convection (wind) and radiation from a horizontal/vertical cylinder in air.Forced convection uses the Churchill-Bernstein correlation for cross-flow over a cylinder:
$$Nu = 0.3 + \frac{0.62 Re^{1/2} Pr^{1/3}}{[1 + (0.4/Pr)^{2/3}]^{1/4}} \left[1 + \left(\frac{Re}{282000}\right)^{5/8}\right]^{4/5}$$Radiation uses the Stefan-Boltzmann law with emissivity 0.9 (oxidised steel):
$$h_{rad} = \varepsilon \sigma (T_s^2 + T_{amb}^2)(T_s + T_{amb})$$- Parameters:
outerRadius- outer radius of pipe (including insulation) in metressurfaceTemperatureK- pipe surface temperature in Kelvin- Returns:
- combined external heat transfer coefficient in W/(m2 K)
-
calculateOverallU
private double calculateOverallU(double ri, double ro, double rIns, double steelK, double hExt) Calculates the overall heat transfer coefficient for the pipe wall + insulation composite.For cylindrical geometry:
$$\frac{1}{U} = \frac{r_{ins}}{r_i h_{int}} + \frac{r_{ins} \ln(r_o/r_i)}{k_{steel}} + \frac{r_{ins} \ln(r_{ins}/r_o)}{k_{ins}} + \frac{1}{h_{ext}}$$Internal convection is assumed to be dominated by natural convection at low velocities (stagnant dead-leg), approximated as h_int = 5 W/(m2 K).
- Parameters:
ri- inner radius in metresro- outer radius of steel wall in metresrIns- outer radius including insulation in metressteelK- steel thermal conductivity in W/(m K)hExt- external heat transfer coefficient in W/(m2 K)- Returns:
- overall heat transfer coefficient in W/(m2 K) based on outer area
-
runCondensateAccumulation
Calculates the condensate accumulation rate from continuous seal leakage, considering both the JT expansion mechanism (primary) and retrograde condensation from gas cooling in dead-legs (secondary).Method: Converts the seal leakage rate from NL/min to actual molar flow at standard conditions, then applies the liquid mole fraction from the isenthalpic expansion to get the liquid production rate.
The accumulation rate is:
$$\dot{V}_{liq} = \dot{n}_{leak} \cdot x_{liq} \cdot \frac{MW_{liq}}{\rho_{liq}}$$where $\dot{n}_{leak}$ is the molar leakage rate, $x_{liq}$ is the liquid mole fraction from PH-flash at vent conditions, $MW_{liq}$ is the liquid molar mass, and $\rho_{liq}$ is the liquid density.
- Returns:
- map with accumulation rates, standpipe fill times, and daily volumes
-
runFlashVaporisationImpact
Estimates the pressure impulse generated when accumulated liquid condensate flashes to vapour during rapid repressurisation of the seal gas system.Physics: When liquid condensate trapped in a standpipe dead-leg is suddenly exposed to high pressure gas during compressor restart or re-pressurisation, the liquid evaporates rapidly. The volume expansion generates a pressure wave that propagates through the piping and can impact the seal faces.
The analysis uses two approaches:
- Confined flash pressure: TV flash of liquid at original dead-leg volume to find the equilibrium pressure after complete evaporation
- Water hammer analogy: Pressure rise from slug deceleration in a confined pipe using the Joukowsky equation: $\Delta P = \rho \cdot c \cdot \Delta v$
- Returns:
- map with flash pressure, slug velocity, impact pressure, and slug acceleration
-
runGCUSizing
Sizes a Gas Conditioning Unit (GCU) per API 692 guidelines. The GCU removes heavy hydrocarbons from the seal gas by cooling below the dew point, separating the condensed liquid, and reheating the dry gas above the dew point plus a safety margin.GCU design basis (per API 692):
- Cool seal gas to dew point minus subcool margin (typically 17 degC below)
- Separate liquid at the lowest temperature
- Reheat gas to dew point plus superheat margin (typically 17 degC above)
- Size the cooler, separator, and heater
The required cooling duty is:
$$Q_{cool} = \dot{m} \cdot (h_{in} - h_{cooled})$$and the reheating duty is:
$$Q_{heat} = \dot{m}_{dry} \cdot (h_{out} - h_{separated})$$- Returns:
- map with GCU sizing data: duties, temperatures, liquid production, and dry gas composition
-
getResults
-
isSafeToOperate
public boolean isSafeToOperate()Returns whether the seal gas system is safe from condensation at the configured conditions. The system is considered safe only if no liquid is produced at any point in the isenthalpic expansion path and no retrograde condensation occurs at ambient conditions.- Returns:
- true if no condensation risk, false if condensation is predicted
-
getStandpipeFillTimeHours
public double getStandpipeFillTimeHours()Returns the estimated time in hours for the standpipe dead-legs to fill with condensate from continuous seal leakage.- Returns:
- fill time in hours, or -1 if no condensation occurs or analysis not complete
-
getMaxJTLiquidFraction
public double getMaxJTLiquidFraction()Returns the maximum liquid volume fraction produced during isenthalpic expansion.- Returns:
- maximum liquid volume percent, or 0 if no condensation
-
isAnalysisComplete
public boolean isAnalysisComplete()Returns whether the full analysis has been completed.- Returns:
- true if runFullAnalysis() has been called and completed
-
getName
-
toJson
Returns the results as a JSON string.- Returns:
- JSON representation of all results
-
convertPressureToBara
Converts a pressure value to bara.- Parameters:
pressure- the pressure valueunit- the unit string- Returns:
- pressure in bara
-
convertTemperatureToKelvin
Converts a temperature value to Kelvin.- Parameters:
temperature- the temperature valueunit- the unit string- Returns:
- temperature in Kelvin
-