Class LNGTankLayeredModel
- All Implemented Interfaces:
Serializable
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 Summary
FieldsModifier and TypeFieldDescriptionprivate doubleAmbient temperature (K).private doubleCurrent bulk liquid density (kg/m3).private doubleCurrent bulk liquid temperature (K).Current vapor composition from last flash.private doubleEffective diffusion coefficient for inter-layer mass transfer (m2/s).private TankHeatTransferModelMulti-zone heat transfer model (optional, overrides simple U*A if set).private doubleMinimum density difference to maintain separate layers (kg/m3).private List<LNGTankLayer> List of liquid layers from bottom (index 0) to top.private static final org.apache.logging.log4j.LoggerLogger object.private MethaneNumberCalculatorMethane number calculator (optional, overrides simplified correlation if set).private doubleOverall heat transfer coefficient (W/m2/K).private SystemInterfaceReference thermo system (used as template for flash calculations).private static final longSerialization version UID.private doubleSloshing mixing enhancement factor (1.0 = no sloshing, >1.0 = enhanced mixing).private LNGSloshingModelSloshing model (optional, overrides constant sloshing factor if set).private Standard_ISO6976ISO 6976 standard for quality calculations.private TankGeometryTank geometry model (optional, overrides surface area if set).private doubleTank pressure (bara).private doubleTank outer surface area (m2).private doubleCurrent total liquid moles.private doubleTank total volume (m3).private booleanWhether to use GERG-2008 EOS for density and quality calculations. -
Constructor Summary
ConstructorsConstructorDescriptionLNGTankLayeredModel(SystemInterface referenceSystem) Constructor for LNGTankLayeredModel. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddLayerOnTop(LNGTankLayer layer) Add a new liquid layer on top of existing layers (e.g., heel mixing, new cargo parcel).private voidapplyInterLayerDiffusion(double timeStepHours) Apply inter-layer molecular diffusion using Fick's first law.private SystemInterfacebuildFlashSystem(LNGTankLayer layer) Build a thermo system for flash calculation from a layer's composition.private LNGAgeingResultbuildResult(double heatIngressW, double bogMassRateKgHr, double bogMolesStep) Build an ageing result snapshot from current state.private doubleCalculate LNG density using GERG-2008 EOS.private voidcalculateQualityKPIs(LNGAgeingResult result) Calculate ISO 6976 quality KPIs (WI, GCV) from current state.private voiddistributeHeatToLayers(double totalHeatJ, SystemInterface flashSystem) Distribute heat ingress across multiple layers based on wall contact fraction.private doubleestimateCp(SystemInterface flashSystem) Estimate molar heat capacity of the liquid phase (J/(mol*K)).private doubleEstimate the liquid cross-sectional area for diffusion interface.private doubleestimateLatentHeat(SystemInterface flashSystem) Estimate latent heat of vaporisation from a flashed system (J/kg).private doubleestimateLayerSpacing(LNGTankLayer lower, LNGTankLayer upper) Estimate the vertical spacing between two layer centres.doubleGet current bulk density.Get the mole-averaged bulk liquid composition across all layers.doubleGet current bulk temperature.doubleGet current fill fraction (liquid volume / total volume).Get current vapor composition.doubleGet the effective diffusion coefficient.Get the heat transfer model.doubleGet layer merge density threshold.Get the list of liquid layers.Get the methane number calculator.doubleGet overall heat transfer coefficient.Get the reference thermodynamic system.doubleGet the sloshing mixing enhancement factor.Get the sloshing model.Get the tank geometry model.doubleGet tank pressure.doubleGet tank surface area.doubleGet total liquid moles.doubleGet total tank volume.voidinitialise(double totalLiquidVolume) Initialise the tank with a single well-mixed liquid layer.booleanCheck if GERG-2008 density calculation is enabled.private voidMerge layers whose density difference is below threshold.private LNGTankLayermergeTwoLayers(LNGTankLayer lower, LNGTankLayer upper) Merge two layers into one (mass-weighted mixing).voidsetEffectiveDiffusionCoeff(double diffCoeff) Set the effective diffusion coefficient for inter-layer mass transfer.voidSet the multi-zone heat transfer model.voidsetLayerMergeDensityThreshold(double threshold) Set layer merge density threshold.voidsetMethaneNumberCalculator(MethaneNumberCalculator calculator) Set the methane number calculator.voidsetOverallHeatTransferCoeff(double u) Set overall heat transfer coefficient.voidsetSloshingMixingFactor(double factor) Set the sloshing mixing enhancement factor.voidsetSloshingModel(LNGSloshingModel model) Set the sloshing model.voidsetTankGeometry(TankGeometry geometry) Set the tank geometry model.voidsetTankPressure(double tankPressure) Set tank pressure.voidsetTankSurfaceArea(double tankSurfaceArea) Set tank surface area.voidsetTotalTankVolume(double totalTankVolume) Set total tank volume.voidsetUseGERG2008(boolean useGERG2008) Enable or disable GERG-2008 EOS for density calculations.step(double timeStepHours, double currentAmbientTemp) Advance the tank model by one time step.private voidUpdate bulk properties from all layers.
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDSerialization version UID.- See Also:
-
logger
private static final org.apache.logging.log4j.Logger loggerLogger object. -
layers
List of liquid layers from bottom (index 0) to top. -
totalTankVolume
private double totalTankVolumeTank total volume (m3). -
tankPressure
private double tankPressureTank pressure (bara). -
overallHeatTransferCoeff
private double overallHeatTransferCoeffOverall heat transfer coefficient (W/m2/K). -
tankSurfaceArea
private double tankSurfaceAreaTank outer surface area (m2). -
ambientTemperature
private double ambientTemperatureAmbient temperature (K). -
layerMergeDensityThreshold
private double layerMergeDensityThresholdMinimum density difference to maintain separate layers (kg/m3). -
referenceSystem
Reference thermo system (used as template for flash calculations). -
standardISO6976
ISO 6976 standard for quality calculations. -
currentVaporComposition
-
bulkTemperature
private double bulkTemperatureCurrent bulk liquid temperature (K). -
bulkDensity
private double bulkDensityCurrent bulk liquid density (kg/m3). -
totalLiquidMoles
private double totalLiquidMolesCurrent total liquid moles. -
sloshingMixingFactor
private double sloshingMixingFactorSloshing mixing enhancement factor (1.0 = no sloshing, >1.0 = enhanced mixing). -
useGERG2008
private boolean useGERG2008Whether to use GERG-2008 EOS for density and quality calculations. -
tankGeometry
Tank geometry model (optional, overrides surface area if set). -
heatTransferModel
Multi-zone heat transfer model (optional, overrides simple U*A if set). -
methaneNumberCalculator
Methane number calculator (optional, overrides simplified correlation if set). -
sloshingModel
Sloshing model (optional, overrides constant sloshing factor if set). -
effectiveDiffusionCoeff
private double effectiveDiffusionCoeffEffective diffusion coefficient for inter-layer mass transfer (m2/s).
-
-
Constructor Details
-
LNGTankLayeredModel
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
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
Advance the tank model by one time step.This method:
- Calculates heat ingress from ambient
- Distributes heat to layers proportional to wall contact area
- Performs bubble-point flash on the top layer to determine vapor composition
- Removes boil-off moles from the top layer (following LNGship pattern)
- Updates density, volume, and quality KPIs
- Checks for layer merging
- Parameters:
timeStepHours- time step size (hours)currentAmbientTemp- current ambient temperature (K)- Returns:
- ageing result snapshot for this time step
-
buildFlashSystem
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
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
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
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
Merge two layers into one (mass-weighted mixing).- Parameters:
lower- lower layerupper- 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
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
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
Estimate the vertical spacing between two layer centres.- Parameters:
lower- lower layerupper- upper layer- Returns:
- spacing (m)
-
getCurrentFillFraction
public double getCurrentFillFraction()Get current fill fraction (liquid volume / total volume).- Returns:
- fill fraction (0-1)
-
getBulkLiquidComposition
-
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
-
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
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
Set the tank geometry model.- Parameters:
geometry- tank geometry
-
getTankGeometry
-
setHeatTransferModel
Set the multi-zone heat transfer model.- Parameters:
model- heat transfer model
-
getHeatTransferModel
Get the heat transfer model.- Returns:
- heat transfer model or null
-
setMethaneNumberCalculator
Set the methane number calculator.- Parameters:
calculator- methane number calculator
-
getMethaneNumberCalculator
Get the methane number calculator.- Returns:
- calculator or null
-
setSloshingModel
Set the sloshing model.- Parameters:
model- sloshing model
-
getSloshingModel
-
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)
-