Class NorsokM506CorrosionRate
- All Implemented Interfaces:
Serializable
Implements the NORSOK M-506 standard "CO2 corrosion rate calculation model" for internal corrosion of carbon steel pipelines and process piping in CO2-containing environments with free water. The model is based on the de Waard-Milliams-Lotz equations with NORSOK-specific corrections.
The model calculates:
- CO2 fugacity from partial pressure using a simplified Peng-Robinson correction
- In-situ pH of CO2-saturated water considering temperature, fugacity, bicarbonate concentration, and ionic strength
- Baseline corrosion rate from the de Waard-Milliams equation (different regimes for T below and above 20 degrees C)
- pH correction factor (Fpht) with asymmetric formula per NORSOK M-506
- Scaling temperature (Tscale) for protective FeCO3 film formation
- Wall shear stress and flow correction factor
- Glycol/MEG correction for reduced water activity
- Inhibitor efficiency
- Corrosion allowance for pipeline design
Applicable range per NORSOK M-506:
- Temperature: 5 to 150 degrees C
- CO2 partial pressure: up to 10 bar
- pH: 3.5 to 6.5
- Total pressure: up to 1000 bar
- Carbon steel only (for CRA materials, see
NorsokM001MaterialSelection)
Usage example:
NorsokM506CorrosionRate model = new NorsokM506CorrosionRate();
model.setTemperatureCelsius(60.0);
model.setTotalPressureBara(100.0);
model.setCO2MoleFraction(0.02);
model.setFlowVelocityMs(3.0);
model.setPipeDiameterM(0.254);
model.calculate();
double rate = model.getCorrectedCorrosionRate(); // mm/yr
double pH = model.getCalculatedPH();
String json = model.toJson();
- Version:
- 1.0
- Author:
- ESOL
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate doubleActual pH of the aqueous phase (if known); use -1 to calculate from equilibrium.private doubleBaseline (uncorrected) corrosion rate in mm/yr.private doubleBicarbonate concentration in mg/L (for pH adjustment from formation water).private doubleCalculated pH of CO2-saturated water.private doubleCO2 fugacity in bar.private doubleCO2 fugacity coefficient (dimensionless).private doubleCO2 mole fraction in the gas phase (0 to 1).private doubleFully corrected corrosion rate in mm/yr.private static final doubleDebye-Huckel constant at 25 degrees C for activity coefficient correction.private doubleFlow correction factor.private doubleFlow velocity in m/s.private doubleGlycol correction factor.private doubleGlycol (MEG/DEG) weight fraction in aqueous phase (0 to 1).private doubleH2S mole fraction in the gas phase (0 to 1) for sour service check.private booleanWhether the model has been calculated.private doubleChemical inhibitor efficiency (0 to 1).private doubleIonic strength in mol/L (for activity coefficient correction).private doubleLiquid density in kg/m3 (for shear stress calculation).private doubleLiquid dynamic viscosity in Pa.s (for Reynolds number).private doublepH correction factor (Fpht).private doublePipe internal diameter in metres.private doubleScale correction factor (Fscale).private doubleScaling temperature in degrees C (protective FeCO3 formation).private static final longSerialization version UID.private static final doubleSteel density in kg/m3 for wall loss conversion.private doubleOperating temperature in degrees Celsius.private doubleTotal system pressure in bara.private booleanWhether to apply flow correction factor.private booleanWhether to apply pH correction factor.private booleanWhether to apply scale correction factor.private doubleWall shear stress in Pa. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new NorsokM506CorrosionRate with default parameters.NorsokM506CorrosionRate(double temperatureC, double totalPressureBara, double co2MoleFraction) Creates a new NorsokM506CorrosionRate with specified conditions. -
Method Summary
Modifier and TypeMethodDescriptionvoidRuns all calculation steps per NORSOK M-506.doubleCalculates the baseline (uncorrected) corrosion rate per NORSOK M-506.doubleCalculates the CO2 fugacity.doublecalculateCorrosionAllowance(double designLifeYears) Calculates the required corrosion allowance for a given design life.doubleCalculates the in-situ pH of CO2-saturated water at the given temperature and CO2 fugacity.doubleCalculates the flow correction factor based on wall shear stress.doubleCalculates the CO2 fugacity coefficient using simplified Peng-Robinson.doubleCalculates the glycol (MEG/DEG) correction factor.doublecalculatePHCorrectionFactor(double effectivePH) Calculates the pH correction factor (Fpht) per NORSOK M-506.doubleCalculates the scale correction factor (Fscale) for protective FeCO3 film.doubleCalculates the scaling temperature where protective FeCO3 scale begins to form.doubleCalculates the wall shear stress in the pipe.Checks whether the model is within the applicable range per NORSOK M-506.private voidEnsures the model has been calculated, running calculate() if necessary.doubleReturns the baseline (uncorrected) corrosion rate.doubleReturns the calculated equilibrium pH.doubleReturns the CO2 fugacity.doubleReturns the CO2 fugacity coefficient.doubleDetermines the CO2 partial pressure in bar.doubleReturns the fully corrected corrosion rate.Returns the corrosion severity classification per NORSOK M-001.doubleReturns the effective pH used in the corrosion calculation.doubleReturns the flow correction factor.doubleReturns the glycol correction factor.doubleDetermines the H2S partial pressure in bar.doubleReturns the pH correction factor.doubleReturns the scale correction factor.doubleReturns the scaling temperature for protective FeCO3 formation.Returns the H2S sour severity classification per NACE MR0175/ISO 15156.doubleReturns the wall shear stress.booleanChecks whether the service is sour per NACE MR0175/ISO 15156.runPressureSweep(double minPressure, double maxPressure, int steps) Calculates corrosion rate over a pressure range for parameter study.runTemperatureSweep(double minTempC, double maxTempC, int steps) Calculates corrosion rate over a temperature range for parameter study.voidsetActualPH(double pH) Sets the actual pH of the aqueous phase.voidsetBicarbonateConcentrationMgL(double concentrationMgL) Sets the bicarbonate concentration in formation water.voidsetCO2MoleFraction(double moleFraction) Sets the CO2 mole fraction in the gas phase.voidsetFlowVelocityMs(double velocityMs) Sets the flow velocity.voidsetGlycolWeightFraction(double weightFraction) Sets the glycol (MEG/DEG) weight fraction in the aqueous phase.voidsetH2SMoleFraction(double moleFraction) Sets the H2S mole fraction in the gas phase (for sour service classification).voidsetInhibitorEfficiency(double efficiency) Sets the chemical inhibitor efficiency.voidsetIonicStrengthMolL(double ionicStrength) Sets the ionic strength of the aqueous phase.voidsetLiquidDensityKgM3(double densityKgM3) Sets the liquid density (used for wall shear stress calculation).voidsetLiquidViscosityPas(double viscosityPas) Sets the liquid dynamic viscosity (used for Reynolds number calculation).voidsetPipeDiameterM(double diameterM) Sets the pipe internal diameter.voidsetTemperatureCelsius(double temperatureC) Sets the operating temperature.voidsetTotalPressureBara(double pressureBara) Sets the total system pressure.voidsetUseFlowCorrection(boolean use) Sets whether to apply flow velocity correction factor.voidsetUsePHCorrection(boolean use) Sets whether to apply pH correction factor.voidsetUseScaleCorrection(boolean use) Sets whether to apply scale (FeCO3) correction factor.toJson()Returns a comprehensive JSON report of input conditions and calculated results.toMap()Returns all input parameters and calculated results as a map.
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDSerialization version UID.- See Also:
-
DEBYE_HUCKEL_A
private static final double DEBYE_HUCKEL_ADebye-Huckel constant at 25 degrees C for activity coefficient correction.- See Also:
-
STEEL_DENSITY_KG_M3
private static final double STEEL_DENSITY_KG_M3Steel density in kg/m3 for wall loss conversion.- See Also:
-
temperatureC
private double temperatureCOperating temperature in degrees Celsius. -
totalPressureBara
private double totalPressureBaraTotal system pressure in bara. -
co2MoleFraction
private double co2MoleFractionCO2 mole fraction in the gas phase (0 to 1). -
h2sMoleFraction
private double h2sMoleFractionH2S mole fraction in the gas phase (0 to 1) for sour service check. -
actualPH
private double actualPHActual pH of the aqueous phase (if known); use -1 to calculate from equilibrium. -
bicarbonateConcentrationMgL
private double bicarbonateConcentrationMgLBicarbonate concentration in mg/L (for pH adjustment from formation water). -
ionicStrengthMolL
private double ionicStrengthMolLIonic strength in mol/L (for activity coefficient correction). -
flowVelocityMs
private double flowVelocityMsFlow velocity in m/s. -
pipeDiameterM
private double pipeDiameterMPipe internal diameter in metres. -
liquidDensityKgM3
private double liquidDensityKgM3Liquid density in kg/m3 (for shear stress calculation). -
liquidViscosityPas
private double liquidViscosityPasLiquid dynamic viscosity in Pa.s (for Reynolds number). -
inhibitorEfficiency
private double inhibitorEfficiencyChemical inhibitor efficiency (0 to 1). -
glycolWeightFraction
private double glycolWeightFractionGlycol (MEG/DEG) weight fraction in aqueous phase (0 to 1). -
usePHCorrection
private boolean usePHCorrectionWhether to apply pH correction factor. -
useScaleCorrection
private boolean useScaleCorrectionWhether to apply scale correction factor. -
useFlowCorrection
private boolean useFlowCorrectionWhether to apply flow correction factor. -
co2FugacityBar
private double co2FugacityBarCO2 fugacity in bar. -
co2FugacityCoeff
private double co2FugacityCoeffCO2 fugacity coefficient (dimensionless). -
calculatedPH
private double calculatedPHCalculated pH of CO2-saturated water. -
baselineCorrosionRate
private double baselineCorrosionRateBaseline (uncorrected) corrosion rate in mm/yr. -
phCorrectionFactor
private double phCorrectionFactorpH correction factor (Fpht). -
scaleCorrectionFactor
private double scaleCorrectionFactorScale correction factor (Fscale). -
flowCorrectionFactor
private double flowCorrectionFactorFlow correction factor. -
glycolCorrectionFactor
private double glycolCorrectionFactorGlycol correction factor. -
correctedCorrosionRate
private double correctedCorrosionRateFully corrected corrosion rate in mm/yr. -
scalingTemperatureC
private double scalingTemperatureCScaling temperature in degrees C (protective FeCO3 formation). -
wallShearStressPa
private double wallShearStressPaWall shear stress in Pa. -
hasBeenCalculated
private boolean hasBeenCalculatedWhether the model has been calculated.
-
-
Constructor Details
-
NorsokM506CorrosionRate
public NorsokM506CorrosionRate()Creates a new NorsokM506CorrosionRate with default parameters. -
NorsokM506CorrosionRate
public NorsokM506CorrosionRate(double temperatureC, double totalPressureBara, double co2MoleFraction) Creates a new NorsokM506CorrosionRate with specified conditions.- Parameters:
temperatureC- operating temperature in Celsius (5 to 150)totalPressureBara- total system pressure in baraco2MoleFraction- CO2 mole fraction in gas phase (0 to 1)
-
-
Method Details
-
setTemperatureCelsius
public void setTemperatureCelsius(double temperatureC) Sets the operating temperature.- Parameters:
temperatureC- temperature in Celsius (valid range: 5 to 150)
-
setTotalPressureBara
public void setTotalPressureBara(double pressureBara) Sets the total system pressure.- Parameters:
pressureBara- total pressure in bara (valid range: 1 to 1000)
-
setCO2MoleFraction
public void setCO2MoleFraction(double moleFraction) Sets the CO2 mole fraction in the gas phase.- Parameters:
moleFraction- CO2 mole fraction (0 to 1)
-
setH2SMoleFraction
public void setH2SMoleFraction(double moleFraction) Sets the H2S mole fraction in the gas phase (for sour service classification).- Parameters:
moleFraction- H2S mole fraction (0 to 1)
-
setActualPH
public void setActualPH(double pH) Sets the actual pH of the aqueous phase.If set to a positive value, this overrides the equilibrium pH calculation. Set to -1 to use the calculated equilibrium pH from CO2-water chemistry.
- Parameters:
pH- actual pH (3.0 to 7.0, or -1 to calculate)
-
setBicarbonateConcentrationMgL
public void setBicarbonateConcentrationMgL(double concentrationMgL) Sets the bicarbonate concentration in formation water.Bicarbonate ions raise the pH above the pure CO2-water value, which reduces the corrosion rate. This is important for fields with high bicarbonate formation water.
- Parameters:
concentrationMgL- bicarbonate concentration in mg/L (0 to 10000)
-
setIonicStrengthMolL
public void setIonicStrengthMolL(double ionicStrength) Sets the ionic strength of the aqueous phase.Ionic strength affects activity coefficients and thus pH. Typical seawater has I approximately 0.7 mol/L.
- Parameters:
ionicStrength- ionic strength in mol/L (0 to 5)
-
setFlowVelocityMs
public void setFlowVelocityMs(double velocityMs) Sets the flow velocity.- Parameters:
velocityMs- flow velocity in m/s (0 to 30)
-
setPipeDiameterM
public void setPipeDiameterM(double diameterM) Sets the pipe internal diameter.- Parameters:
diameterM- pipe inner diameter in metres (0.01 to 2.0)
-
setLiquidDensityKgM3
public void setLiquidDensityKgM3(double densityKgM3) Sets the liquid density (used for wall shear stress calculation).- Parameters:
densityKgM3- liquid density in kg/m3 (500 to 1500)
-
setLiquidViscosityPas
public void setLiquidViscosityPas(double viscosityPas) Sets the liquid dynamic viscosity (used for Reynolds number calculation).- Parameters:
viscosityPas- dynamic viscosity in Pa.s (0.0001 to 0.1)
-
setInhibitorEfficiency
public void setInhibitorEfficiency(double efficiency) Sets the chemical inhibitor efficiency.- Parameters:
efficiency- inhibitor efficiency factor (0.0 = no inhibitor, 1.0 = perfect)
-
setGlycolWeightFraction
public void setGlycolWeightFraction(double weightFraction) Sets the glycol (MEG/DEG) weight fraction in the aqueous phase.Glycol reduces water activity and thus the corrosion rate. Typical MEG injection gives 40-80 wt%.
- Parameters:
weightFraction- glycol weight fraction (0.0 to 1.0)
-
setUsePHCorrection
public void setUsePHCorrection(boolean use) Sets whether to apply pH correction factor.- Parameters:
use- true to apply pH correction (default true)
-
setUseScaleCorrection
public void setUseScaleCorrection(boolean use) Sets whether to apply scale (FeCO3) correction factor.- Parameters:
use- true to apply scale correction (default true)
-
setUseFlowCorrection
public void setUseFlowCorrection(boolean use) Sets whether to apply flow velocity correction factor.- Parameters:
use- true to apply flow correction (default true)
-
calculate
public void calculate()Runs all calculation steps per NORSOK M-506.Calculates CO2 fugacity, in-situ pH, baseline rate, all correction factors, and the final corrected corrosion rate. Results are available via getter methods after calling this method.
-
calculateFugacityCoefficient
public double calculateFugacityCoefficient()Calculates the CO2 fugacity coefficient using simplified Peng-Robinson.Per NORSOK M-506:
ln(phi_CO2) = P * (0.0031 - 1.4 / T)where P is total pressure in bar and T is temperature in Kelvin.
- Returns:
- CO2 fugacity coefficient (dimensionless)
-
calculateCO2Fugacity
public double calculateCO2Fugacity()Calculates the CO2 fugacity.f_CO2 = y_CO2 * P_total * phi_CO2- Returns:
- CO2 fugacity in bar
-
calculateEquilibriumPH
public double calculateEquilibriumPH()Calculates the in-situ pH of CO2-saturated water at the given temperature and CO2 fugacity.Uses the combined equilibrium approach where pH of CO2-saturated water is calculated from the product of Henry's law constant (KH) and the apparent first dissociation constant (Ka1') of carbonic acid:
pH = A(T) - 0.5 * log10(fCO2) where A(T) = 0.5 * (pKa1' + pKH) is a temperature-dependent functionThe correlation is calibrated against literature data for CO2-water systems (de Waard-Lotz 1993, Dugstad et al.) giving pH approximately 3.9 at 25 degrees C and 1 bar CO2, increasing slightly with temperature.
When bicarbonate is present, the pH is calculated from the charge balance. The ionic strength correction uses the extended Debye-Huckel equation.
- Returns:
- calculated pH
-
calculateBaselineRate
public double calculateBaselineRate()Calculates the baseline (uncorrected) corrosion rate per NORSOK M-506.Uses the de Waard-Milliams (1991) equation:
log10(CR) = 5.8 - 1710 / T + 0.67 * log10(fCO2)where CR is in mm/yr, T in Kelvin, fCO2 (CO2 fugacity) in bar. This equation is valid for the full temperature range of 5 to 150 degrees C per NORSOK M-506.
- Returns:
- baseline corrosion rate in mm/yr
-
calculateScalingTemperature
public double calculateScalingTemperature()Calculates the scaling temperature where protective FeCO3 scale begins to form.Per NORSOK M-506:
Tscale = 2400 / (6.7 + 0.644 * log10(fCO2)) - 273.15 (degrees C)Above this temperature, protective FeCO3 scale forms and reduces the corrosion rate.
- Returns:
- scaling temperature in degrees Celsius
-
calculatePHCorrectionFactor
public double calculatePHCorrectionFactor(double effectivePH) Calculates the pH correction factor (Fpht) per NORSOK M-506.The correction is asymmetric around the CO2-saturated pH:
If pH_actual < pH_CO2: Fpht = 10^(0.34 * (pH_CO2 - pH_actual)) [more acidic -> higher rate] If pH_actual >= pH_CO2: Fpht = 10^(1.23 * (pH_CO2 - pH_actual)) [more alkaline -> lower rate]- Parameters:
effectivePH- the effective pH to use (actual or calculated)- Returns:
- pH correction factor (Fpht)
-
calculateScaleCorrectionFactor
public double calculateScaleCorrectionFactor()Calculates the scale correction factor (Fscale) for protective FeCO3 film.Per NORSOK M-506, when the operating temperature exceeds the scaling temperature, a protective FeCO3 scale forms that reduces the corrosion rate:
- T below Tscale: Fscale = 1.0 (no protective scale)
- T above Tscale: Fscale decreases as scale becomes more protective
- Returns:
- scale correction factor (0.01 to 1.0)
-
calculateWallShearStress
public double calculateWallShearStress()Calculates the wall shear stress in the pipe.Uses the Fanning friction factor for turbulent flow:
Re = rho * v * D / mu f = 0.046 * Re^(-0.2) (Blasius correlation for turbulent flow) tau = 0.5 * f * rho * v^2 (Pa)- Returns:
- wall shear stress in Pa
-
calculateFlowCorrectionFactor
public double calculateFlowCorrectionFactor()Calculates the flow correction factor based on wall shear stress.Higher flow velocity increases mass transfer of CO2 to the wall and can remove protective scales. Per NORSOK M-506, the flow correction is based on wall shear stress relative to a reference stress of 1 Pa. The correction is capped at a factor of 5 per the standard.
- Returns:
- flow correction factor (1.0 to 5.0)
-
calculateGlycolCorrectionFactor
public double calculateGlycolCorrectionFactor()Calculates the glycol (MEG/DEG) correction factor.Per NORSOK M-506, glycol reduces water activity and thus the corrosion rate. The correction follows an empirical relationship:
- Below 50 wt%: Fglyc = 1 - wg (linear reduction)
- 50-80 wt%: Fglyc = 0.5 * (1 - wg)^2 (accelerated reduction)
- Above 80 wt%: Fglyc = 0.05 (minimal residual corrosion)
- Returns:
- glycol correction factor (0.05 to 1.0)
-
getCO2FugacityBar
public double getCO2FugacityBar()Returns the CO2 fugacity.- Returns:
- CO2 fugacity in bar
-
getCO2FugacityCoefficient
public double getCO2FugacityCoefficient()Returns the CO2 fugacity coefficient.- Returns:
- fugacity coefficient (dimensionless)
-
getCalculatedPH
public double getCalculatedPH()Returns the calculated equilibrium pH.- Returns:
- calculated pH of CO2-saturated water
-
getEffectivePH
public double getEffectivePH()Returns the effective pH used in the corrosion calculation.- Returns:
- effective pH (user-specified actual pH or calculated equilibrium pH)
-
getBaselineCorrosionRate
public double getBaselineCorrosionRate()Returns the baseline (uncorrected) corrosion rate.- Returns:
- baseline corrosion rate in mm/yr
-
getCorrectedCorrosionRate
public double getCorrectedCorrosionRate()Returns the fully corrected corrosion rate.- Returns:
- corrected corrosion rate in mm/yr
-
getScalingTemperatureC
public double getScalingTemperatureC()Returns the scaling temperature for protective FeCO3 formation.- Returns:
- scaling temperature in degrees Celsius
-
getWallShearStressPa
public double getWallShearStressPa()Returns the wall shear stress.- Returns:
- wall shear stress in Pa
-
getPHCorrectionFactor
public double getPHCorrectionFactor()Returns the pH correction factor.- Returns:
- pH correction factor (Fpht)
-
getScaleCorrectionFactor
public double getScaleCorrectionFactor()Returns the scale correction factor.- Returns:
- scale correction factor (Fscale)
-
getFlowCorrectionFactor
public double getFlowCorrectionFactor()Returns the flow correction factor.- Returns:
- flow correction factor
-
getGlycolCorrectionFactor
public double getGlycolCorrectionFactor()Returns the glycol correction factor.- Returns:
- glycol correction factor
-
calculateCorrosionAllowance
public double calculateCorrosionAllowance(double designLifeYears) Calculates the required corrosion allowance for a given design life.Per NORSOK M-001, the corrosion allowance (CA) is typically:
- CA = CR * design_life (mm)
- Minimum CA: 1.0 mm for carbon steel per NORSOK M-001
- Maximum practical CA: typically 6.0 mm (above this, consider CRA material)
- Parameters:
designLifeYears- design life in years (typically 20-30)- Returns:
- corrosion allowance in mm
-
getCorrosionSeverity
Returns the corrosion severity classification per NORSOK M-001.Severity categories:
- Low: less than 0.1 mm/yr
- Medium: 0.1 to 0.3 mm/yr
- High: 0.3 to 1.0 mm/yr
- Very High: greater than 1.0 mm/yr
- Returns:
- severity category string
-
getCO2PartialPressureBar
public double getCO2PartialPressureBar()Determines the CO2 partial pressure in bar.- Returns:
- CO2 partial pressure in bar
-
getH2SPartialPressureBar
public double getH2SPartialPressureBar()Determines the H2S partial pressure in bar.- Returns:
- H2S partial pressure in bar
-
isSourService
public boolean isSourService()Checks whether the service is sour per NACE MR0175/ISO 15156.NACE defines sour service when H2S partial pressure exceeds 0.003 bar (0.3 kPa).
- Returns:
- true if sour service conditions
-
getSourSeverityClassification
Returns the H2S sour severity classification per NACE MR0175/ISO 15156.- Non-sour: H2S pp less than 0.3 kPa (0.003 bar)
- Mild sour: 0.3 to 1.0 kPa (0.003 to 0.01 bar)
- Moderate sour: 1.0 to 10 kPa (0.01 to 0.1 bar)
- Severe sour: greater than 10 kPa (0.1 bar)
- Returns:
- sour severity classification string
-
checkApplicableRange
-
runTemperatureSweep
Calculates corrosion rate over a temperature range for parameter study.- Parameters:
minTempC- minimum temperature in CelsiusmaxTempC- maximum temperature in Celsiussteps- number of temperature steps- Returns:
- list of maps with temperature and corrosion results at each step
-
runPressureSweep
Calculates corrosion rate over a pressure range for parameter study.- Parameters:
minPressure- minimum total pressure in baramaxPressure- maximum total pressure in barasteps- number of pressure steps- Returns:
- list of maps with pressure and corrosion results at each step
-
toMap
-
toJson
Returns a comprehensive JSON report of input conditions and calculated results.- Returns:
- JSON string with all parameters and results
-
ensureCalculated
private void ensureCalculated()Ensures the model has been calculated, running calculate() if necessary.
-