Class LNGTankLayeredModel

java.lang.Object
neqsim.process.equipment.lng.LNGTankLayeredModel
All Implemented Interfaces:
Serializable

public class LNGTankLayeredModel extends Object implements Serializable
Multi-layer LNG tank model with stratification support.

This model extends the single-layer approach of LNGship.solveTransient() to support multiple horizontal liquid layers. Each layer has its own composition, temperature, and density. The model tracks how preferential boil-off of lighter components (N2, methane) enriches the residual liquid in heavier components over time.

Physics modeled:

  • Heat ingress: Q = U * A * (T_ambient - T_LNG) distributed to layers by wall contact area fraction
  • Boil-off: Bubble-point flash at tank pressure determines vapor composition; moles removed proportional to gas-phase mole fractions (following LNGship pattern)
  • Quality tracking: ISO 6578 density, ISO 6976 WI/GCV at each time step
  • Stratification: Multiple layers with independent compositions and temperatures; layers can be merged when density difference drops below threshold
Version:
1.0
Author:
NeqSim
See Also:
  • Field Details

    • serialVersionUID

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

      private static final org.apache.logging.log4j.Logger logger
      Logger object.
    • layers

      private List<LNGTankLayer> layers
      List of liquid layers from bottom (index 0) to top.
    • totalTankVolume

      private double totalTankVolume
      Tank total volume (m3).
    • tankPressure

      private double tankPressure
      Tank pressure (bara).
    • overallHeatTransferCoeff

      private double overallHeatTransferCoeff
      Overall heat transfer coefficient (W/m2/K).
    • tankSurfaceArea

      private double tankSurfaceArea
      Tank outer surface area (m2).
    • ambientTemperature

      private double ambientTemperature
      Ambient temperature (K).
    • layerMergeDensityThreshold

      private double layerMergeDensityThreshold
      Minimum density difference to maintain separate layers (kg/m3).
    • referenceSystem

      private transient SystemInterface referenceSystem
      Reference thermo system (used as template for flash calculations).
    • standardISO6976

      private transient Standard_ISO6976 standardISO6976
      ISO 6976 standard for quality calculations.
    • currentVaporComposition

      private Map<String,Double> currentVaporComposition
      Current vapor composition from last flash.
    • bulkTemperature

      private double bulkTemperature
      Current bulk liquid temperature (K).
    • bulkDensity

      private double bulkDensity
      Current bulk liquid density (kg/m3).
    • totalLiquidMoles

      private double totalLiquidMoles
      Current total liquid moles.
    • sloshingMixingFactor

      private double sloshingMixingFactor
      Sloshing mixing enhancement factor (1.0 = no sloshing, >1.0 = enhanced mixing).
    • useGERG2008

      private boolean useGERG2008
      Whether to use GERG-2008 EOS for density and quality calculations.
    • tankGeometry

      private TankGeometry tankGeometry
      Tank geometry model (optional, overrides surface area if set).
    • heatTransferModel

      private TankHeatTransferModel heatTransferModel
      Multi-zone heat transfer model (optional, overrides simple U*A if set).
    • methaneNumberCalculator

      private MethaneNumberCalculator methaneNumberCalculator
      Methane number calculator (optional, overrides simplified correlation if set).
    • sloshingModel

      private LNGSloshingModel sloshingModel
      Sloshing model (optional, overrides constant sloshing factor if set).
    • effectiveDiffusionCoeff

      private double effectiveDiffusionCoeff
      Effective diffusion coefficient for inter-layer mass transfer (m2/s).
  • Constructor Details

    • LNGTankLayeredModel

      public LNGTankLayeredModel(SystemInterface referenceSystem)
      Constructor for LNGTankLayeredModel.
      Parameters:
      referenceSystem - template thermodynamic system (defines EOS and components)
  • Method Details

    • initialise

      public void initialise(double totalLiquidVolume)
      Initialise the tank with a single well-mixed liquid layer.

      Performs a bubble-point temperature flash at tank pressure to determine equilibrium conditions, then creates a single layer with the full liquid inventory. This follows the same initialisation pattern as LNGship.createSystem().

      Parameters:
      totalLiquidVolume - initial liquid volume in tank (m3)
    • addLayerOnTop

      public void addLayerOnTop(LNGTankLayer layer)
      Add a new liquid layer on top of existing layers (e.g., heel mixing, new cargo parcel).
      Parameters:
      layer - the new layer to add on top
    • step

      public LNGAgeingResult step(double timeStepHours, double currentAmbientTemp)
      Advance the tank model by one time step.

      This method:

      1. Calculates heat ingress from ambient
      2. Distributes heat to layers proportional to wall contact area
      3. Performs bubble-point flash on the top layer to determine vapor composition
      4. Removes boil-off moles from the top layer (following LNGship pattern)
      5. Updates density, volume, and quality KPIs
      6. Checks for layer merging
      Parameters:
      timeStepHours - time step size (hours)
      currentAmbientTemp - current ambient temperature (K)
      Returns:
      ageing result snapshot for this time step
    • buildFlashSystem

      private SystemInterface buildFlashSystem(LNGTankLayer layer)
      Build a thermo system for flash calculation from a layer's composition.
      Parameters:
      layer - the tank layer
      Returns:
      configured thermo system ready for flash
    • estimateLatentHeat

      private double estimateLatentHeat(SystemInterface flashSystem)
      Estimate latent heat of vaporisation from a flashed system (J/kg).
      Parameters:
      flashSystem - flashed thermo system with gas and liquid phases
      Returns:
      latent heat (J/kg), or default 510000 if calculation fails
    • estimateCp

      private double estimateCp(SystemInterface flashSystem)
      Estimate molar heat capacity of the liquid phase (J/(mol*K)).
      Parameters:
      flashSystem - flashed thermo system
      Returns:
      molar Cp (J/(mol*K)), or default 55.0 if estimation fails
    • distributeHeatToLayers

      private void distributeHeatToLayers(double totalHeatJ, SystemInterface flashSystem)
      Distribute heat ingress across multiple layers based on wall contact fraction.
      Parameters:
      totalHeatJ - total heat ingress (J)
      flashSystem - thermo system for Cp estimation
    • updateBulkProperties

      private void updateBulkProperties()
      Update bulk properties from all layers.
    • mergeSimilarLayers

      private void mergeSimilarLayers()
      Merge layers whose density difference is below threshold.
    • mergeTwoLayers

      private LNGTankLayer mergeTwoLayers(LNGTankLayer lower, LNGTankLayer upper)
      Merge two layers into one (mass-weighted mixing).
      Parameters:
      lower - lower layer
      upper - upper layer
      Returns:
      merged layer
    • buildResult

      private LNGAgeingResult buildResult(double heatIngressW, double bogMassRateKgHr, double bogMolesStep)
      Build an ageing result snapshot from current state.
      Parameters:
      heatIngressW - heat ingress (W)
      bogMassRateKgHr - BOG mass flow rate (kg/hr)
      bogMolesStep - BOG moles removed this step
      Returns:
      result snapshot
    • calculateQualityKPIs

      private void calculateQualityKPIs(LNGAgeingResult result)
      Calculate ISO 6976 quality KPIs (WI, GCV) from current state.

      If GERG-2008 mode is enabled, uses GERG-2008 EOS for density calculation. Always uses ISO 6976 for calorific values.

      Parameters:
      result - ageing result to populate with quality data
    • calculateGERG2008Density

      private double calculateGERG2008Density(LNGTankLayer layer)
      Calculate LNG density using GERG-2008 EOS.

      Creates a GERG-2008 thermo system from the layer composition, runs a TP flash at the layer temperature and tank pressure, and returns the liquid density. This provides higher accuracy density than the Klosek-McKinley (ISO 6578) correlation.

      Parameters:
      layer - the tank layer
      Returns:
      density (kg/m3) or -1 if calculation fails
    • applyInterLayerDiffusion

      private void applyInterLayerDiffusion(double timeStepHours)
      Apply inter-layer molecular diffusion using Fick's first law.

      For each pair of adjacent layers, calculate mass transfer flux: J_i = D_eff * (c_upper_i - c_lower_i) / delta_h, where c is concentration (mole fraction), and transfer moles to equalise compositions over time. The effective diffusion coefficient includes both molecular diffusion and turbulent eddy diffusion from natural convection.

      Parameters:
      timeStepHours - time step (hours)
    • estimateInterfaceArea

      private double estimateInterfaceArea()
      Estimate the liquid cross-sectional area for diffusion interface.
      Returns:
      interface area (m2)
    • estimateLayerSpacing

      private double estimateLayerSpacing(LNGTankLayer lower, LNGTankLayer upper)
      Estimate the vertical spacing between two layer centres.
      Parameters:
      lower - lower layer
      upper - upper layer
      Returns:
      spacing (m)
    • getCurrentFillFraction

      public double getCurrentFillFraction()
      Get current fill fraction (liquid volume / total volume).
      Returns:
      fill fraction (0-1)
    • getBulkLiquidComposition

      public Map<String,Double> getBulkLiquidComposition()
      Get the mole-averaged bulk liquid composition across all layers.
      Returns:
      map of component name to bulk mole fraction
    • getLayers

      public List<LNGTankLayer> getLayers()
      Get the list of liquid layers.
      Returns:
      list of layers (bottom to top)
    • getTotalTankVolume

      public double getTotalTankVolume()
      Get total tank volume.
      Returns:
      tank volume (m3)
    • setTotalTankVolume

      public void setTotalTankVolume(double totalTankVolume)
      Set total tank volume.
      Parameters:
      totalTankVolume - tank volume (m3)
    • getTankPressure

      public double getTankPressure()
      Get tank pressure.
      Returns:
      pressure (bara)
    • setTankPressure

      public void setTankPressure(double tankPressure)
      Set tank pressure.
      Parameters:
      tankPressure - pressure (bara)
    • getOverallHeatTransferCoeff

      public double getOverallHeatTransferCoeff()
      Get overall heat transfer coefficient.
      Returns:
      U (W/m2/K)
    • setOverallHeatTransferCoeff

      public void setOverallHeatTransferCoeff(double u)
      Set overall heat transfer coefficient.
      Parameters:
      u - heat transfer coefficient (W/m2/K)
    • getTankSurfaceArea

      public double getTankSurfaceArea()
      Get tank surface area.
      Returns:
      surface area (m2)
    • setTankSurfaceArea

      public void setTankSurfaceArea(double tankSurfaceArea)
      Set tank surface area.
      Parameters:
      tankSurfaceArea - surface area (m2)
    • getBulkTemperature

      public double getBulkTemperature()
      Get current bulk temperature.
      Returns:
      bulk temperature (K)
    • getBulkDensity

      public double getBulkDensity()
      Get current bulk density.
      Returns:
      bulk density (kg/m3)
    • getTotalLiquidMoles

      public double getTotalLiquidMoles()
      Get total liquid moles.
      Returns:
      total moles
    • getCurrentVaporComposition

      public Map<String,Double> getCurrentVaporComposition()
      Get current vapor composition.
      Returns:
      map of component name to vapor mole fraction
    • getLayerMergeDensityThreshold

      public double getLayerMergeDensityThreshold()
      Get layer merge density threshold.
      Returns:
      density threshold (kg/m3)
    • setLayerMergeDensityThreshold

      public void setLayerMergeDensityThreshold(double threshold)
      Set layer merge density threshold.
      Parameters:
      threshold - density threshold (kg/m3)
    • getSloshingMixingFactor

      public double getSloshingMixingFactor()
      Get the sloshing mixing enhancement factor.
      Returns:
      mixing factor (1.0 = none)
    • setSloshingMixingFactor

      public void setSloshingMixingFactor(double factor)
      Set the sloshing mixing enhancement factor.

      Sloshing from wave action enhances mixing between layers and surface renewal at the liquid-vapor interface. Factor of 1.0 means no enhancement (quiescent storage), values greater than 1.0 represent enhanced mixing due to ship motion.

      Parameters:
      factor - mixing factor (1.0 = no sloshing effect)
    • getReferenceSystem

      public SystemInterface getReferenceSystem()
      Get the reference thermodynamic system.
      Returns:
      reference system
    • setUseGERG2008

      public void setUseGERG2008(boolean useGERG2008)
      Enable or disable GERG-2008 EOS for density calculations.
      Parameters:
      useGERG2008 - true to use GERG-2008 for density
    • isUseGERG2008

      public boolean isUseGERG2008()
      Check if GERG-2008 density calculation is enabled.
      Returns:
      true if using GERG-2008
    • setTankGeometry

      public void setTankGeometry(TankGeometry geometry)
      Set the tank geometry model.
      Parameters:
      geometry - tank geometry
    • getTankGeometry

      public TankGeometry getTankGeometry()
      Get the tank geometry model.
      Returns:
      tank geometry or null
    • setHeatTransferModel

      public void setHeatTransferModel(TankHeatTransferModel model)
      Set the multi-zone heat transfer model.
      Parameters:
      model - heat transfer model
    • getHeatTransferModel

      public TankHeatTransferModel getHeatTransferModel()
      Get the heat transfer model.
      Returns:
      heat transfer model or null
    • setMethaneNumberCalculator

      public void setMethaneNumberCalculator(MethaneNumberCalculator calculator)
      Set the methane number calculator.
      Parameters:
      calculator - methane number calculator
    • getMethaneNumberCalculator

      public MethaneNumberCalculator getMethaneNumberCalculator()
      Get the methane number calculator.
      Returns:
      calculator or null
    • setSloshingModel

      public void setSloshingModel(LNGSloshingModel model)
      Set the sloshing model.
      Parameters:
      model - sloshing model
    • getSloshingModel

      public LNGSloshingModel getSloshingModel()
      Get the sloshing model.
      Returns:
      sloshing model or null
    • setEffectiveDiffusionCoeff

      public void setEffectiveDiffusionCoeff(double diffCoeff)
      Set the effective diffusion coefficient for inter-layer mass transfer.
      Parameters:
      diffCoeff - diffusion coefficient (m2/s), typical 1e-9 to 1e-8 for LNG
    • getEffectiveDiffusionCoeff

      public double getEffectiveDiffusionCoeff()
      Get the effective diffusion coefficient.
      Returns:
      diffusion coefficient (m2/s)