Class NorsokM506CorrosionRate

java.lang.Object
neqsim.process.corrosion.NorsokM506CorrosionRate
All Implemented Interfaces:
Serializable

public class NorsokM506CorrosionRate extends Object implements Serializable
CO2 corrosion rate prediction model per NORSOK M-506 (2005/2017).

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 Details

    • serialVersionUID

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

      private static final double DEBYE_HUCKEL_A
      Debye-Huckel constant at 25 degrees C for activity coefficient correction.
      See Also:
    • STEEL_DENSITY_KG_M3

      private static final double STEEL_DENSITY_KG_M3
      Steel density in kg/m3 for wall loss conversion.
      See Also:
    • temperatureC

      private double temperatureC
      Operating temperature in degrees Celsius.
    • totalPressureBara

      private double totalPressureBara
      Total system pressure in bara.
    • co2MoleFraction

      private double co2MoleFraction
      CO2 mole fraction in the gas phase (0 to 1).
    • h2sMoleFraction

      private double h2sMoleFraction
      H2S mole fraction in the gas phase (0 to 1) for sour service check.
    • actualPH

      private double actualPH
      Actual pH of the aqueous phase (if known); use -1 to calculate from equilibrium.
    • bicarbonateConcentrationMgL

      private double bicarbonateConcentrationMgL
      Bicarbonate concentration in mg/L (for pH adjustment from formation water).
    • ionicStrengthMolL

      private double ionicStrengthMolL
      Ionic strength in mol/L (for activity coefficient correction).
    • flowVelocityMs

      private double flowVelocityMs
      Flow velocity in m/s.
    • pipeDiameterM

      private double pipeDiameterM
      Pipe internal diameter in metres.
    • liquidDensityKgM3

      private double liquidDensityKgM3
      Liquid density in kg/m3 (for shear stress calculation).
    • liquidViscosityPas

      private double liquidViscosityPas
      Liquid dynamic viscosity in Pa.s (for Reynolds number).
    • inhibitorEfficiency

      private double inhibitorEfficiency
      Chemical inhibitor efficiency (0 to 1).
    • glycolWeightFraction

      private double glycolWeightFraction
      Glycol (MEG/DEG) weight fraction in aqueous phase (0 to 1).
    • usePHCorrection

      private boolean usePHCorrection
      Whether to apply pH correction factor.
    • useScaleCorrection

      private boolean useScaleCorrection
      Whether to apply scale correction factor.
    • useFlowCorrection

      private boolean useFlowCorrection
      Whether to apply flow correction factor.
    • co2FugacityBar

      private double co2FugacityBar
      CO2 fugacity in bar.
    • co2FugacityCoeff

      private double co2FugacityCoeff
      CO2 fugacity coefficient (dimensionless).
    • calculatedPH

      private double calculatedPH
      Calculated pH of CO2-saturated water.
    • baselineCorrosionRate

      private double baselineCorrosionRate
      Baseline (uncorrected) corrosion rate in mm/yr.
    • phCorrectionFactor

      private double phCorrectionFactor
      pH correction factor (Fpht).
    • scaleCorrectionFactor

      private double scaleCorrectionFactor
      Scale correction factor (Fscale).
    • flowCorrectionFactor

      private double flowCorrectionFactor
      Flow correction factor.
    • glycolCorrectionFactor

      private double glycolCorrectionFactor
      Glycol correction factor.
    • correctedCorrosionRate

      private double correctedCorrosionRate
      Fully corrected corrosion rate in mm/yr.
    • scalingTemperatureC

      private double scalingTemperatureC
      Scaling temperature in degrees C (protective FeCO3 formation).
    • wallShearStressPa

      private double wallShearStressPa
      Wall shear stress in Pa.
    • hasBeenCalculated

      private boolean hasBeenCalculated
      Whether 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 bara
      co2MoleFraction - 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 function
      
      

      The 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

      public String 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

      public String 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

      public Map<String,Boolean> checkApplicableRange()
      Checks whether the model is within the applicable range per NORSOK M-506.
      Returns:
      map of range checks with parameter name to boolean (true = within range)
    • runTemperatureSweep

      public List<Map<String,Object>> runTemperatureSweep(double minTempC, double maxTempC, int steps)
      Calculates corrosion rate over a temperature range for parameter study.
      Parameters:
      minTempC - minimum temperature in Celsius
      maxTempC - maximum temperature in Celsius
      steps - number of temperature steps
      Returns:
      list of maps with temperature and corrosion results at each step
    • runPressureSweep

      public List<Map<String,Object>> runPressureSweep(double minPressure, double maxPressure, int steps)
      Calculates corrosion rate over a pressure range for parameter study.
      Parameters:
      minPressure - minimum total pressure in bara
      maxPressure - maximum total pressure in bara
      steps - number of pressure steps
      Returns:
      list of maps with pressure and corrosion results at each step
    • toMap

      public Map<String,Object> toMap()
      Returns all input parameters and calculated results as a map.
      Returns:
      map of all parameters and results
    • toJson

      public String 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.