Class TransientWallHeatTransfer
This class implements a finite difference solution for transient heat conduction through single or composite (multi-layer) vessel walls. It is designed for modeling Type III/IV hydrogen storage vessels with low thermal conductivity liners, but is applicable to any cylindrical vessel wall.
The model solves the 1-D heat equation:
rho * Cp * dT/dt = k * d2T/dx2using an explicit finite difference scheme with configurable boundary conditions.
Reference: Andreasen, A. (2021). HydDown: A Python package for calculation of hydrogen (or other gas) pressure vessel filling and discharge. Journal of Open Source Software, 6(66), 3695.
- Author:
- ESOL
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final double[]Density at each node [kg/m^3].private final doubleNode spacing [m].private final double[]Heat capacity at each node [J/(kg*K)].private final intNumber of nodes in the spatial discretization.private double[]Temperature profile across wall [K].private final double[]Thermal conductivity at each node [W/(m*K)].private final double[]Thermal diffusivity at each node [m^2/s].private final doubleTotal wall thickness [m]. -
Constructor Summary
ConstructorsConstructorDescriptionTransientWallHeatTransfer(double linerThickness, double linerK, double linerDensity, double linerCp, double shellThickness, double shellK, double shellDensity, double shellCp, double initialTemperatureK, int numNodes) Creates a transient wall heat transfer model for a composite (two-layer) wall.TransientWallHeatTransfer(double thickness, double thermalConductivity, double density, double heatCapacity, double initialTemperatureK, int numNodes) Creates a transient wall heat transfer model for a single-layer wall. -
Method Summary
Modifier and TypeMethodDescriptionvoidadvanceTimeStep(double dt, double innerFluidTemperatureK, double innerFilmCoefficientWPerM2K, double outerAmbientTemperatureK, double outerFilmCoefficientWPerM2K) Advances the temperature profile by one time step using explicit finite differences.private voidadvanceTimeStepInternal(double dt, double innerFluidTemperatureK, double innerFilmCoefficientWPerM2K, double outerAmbientTemperatureK, double outerFilmCoefficientWPerM2K) Internal time step advancement (assumes stability is already checked).doublegetHeatAbsorbed(double wallAreaM2, double previousMeanTemperatureK) Calculates the heat absorbed by the wall during a time step.doubleCalculates the heat flux through the wall at steady state.doubleGets the current inner wall surface temperature (x = 0).doubleCalculates the maximum stable time step for the explicit scheme.doubleGets the mean wall temperature (volume-averaged).doubleGets the node spacing.intGets the number of spatial nodes.doubleGets the current outer wall surface temperature (x = L).double[]Gets the position array for the temperature profile.double[]Gets the complete temperature profile across the wall.doubleGets the total wall thickness.voidresetTemperature(double temperatureK) Resets the temperature profile to a uniform value.
-
Field Details
-
numNodes
private final int numNodesNumber of nodes in the spatial discretization. -
dx
private final double dxNode spacing [m]. -
totalThickness
private final double totalThicknessTotal wall thickness [m]. -
temperatureProfile
private double[] temperatureProfileTemperature profile across wall [K]. -
thermalConductivity
private final double[] thermalConductivityThermal conductivity at each node [W/(m*K)]. -
density
private final double[] densityDensity at each node [kg/m^3]. -
heatCapacity
private final double[] heatCapacityHeat capacity at each node [J/(kg*K)]. -
thermalDiffusivity
private final double[] thermalDiffusivityThermal diffusivity at each node [m^2/s].
-
-
Constructor Details
-
TransientWallHeatTransfer
public TransientWallHeatTransfer(double thickness, double thermalConductivity, double density, double heatCapacity, double initialTemperatureK, int numNodes) Creates a transient wall heat transfer model for a single-layer wall.- Parameters:
thickness- Wall thickness [m]thermalConductivity- Thermal conductivity [W/(m*K)]density- Material density [kg/m^3]heatCapacity- Specific heat capacity [J/(kg*K)]initialTemperatureK- Initial uniform temperature [K]numNodes- Number of spatial nodes (minimum 3)
-
TransientWallHeatTransfer
public TransientWallHeatTransfer(double linerThickness, double linerK, double linerDensity, double linerCp, double shellThickness, double shellK, double shellDensity, double shellCp, double initialTemperatureK, int numNodes) Creates a transient wall heat transfer model for a composite (two-layer) wall.This is typical for Type III/IV hydrogen vessels with an inner liner and outer shell.
- Parameters:
linerThickness- Inner liner thickness [m]linerK- Liner thermal conductivity [W/(m*K)]linerDensity- Liner density [kg/m^3]linerCp- Liner heat capacity [J/(kg*K)]shellThickness- Outer shell thickness [m]shellK- Shell thermal conductivity [W/(m*K)]shellDensity- Shell density [kg/m^3]shellCp- Shell heat capacity [J/(kg*K)]initialTemperatureK- Initial uniform temperature [K]numNodes- Total number of spatial nodes (minimum 5)
-
-
Method Details
-
advanceTimeStep
public void advanceTimeStep(double dt, double innerFluidTemperatureK, double innerFilmCoefficientWPerM2K, double outerAmbientTemperatureK, double outerFilmCoefficientWPerM2K) Advances the temperature profile by one time step using explicit finite differences.Uses convective (Robin) boundary conditions at both surfaces:
-k * dT/dx = h_inner * (T_inner - T_fluid_inner) at x = 0 -k * dT/dx = h_outer * (T_outer - T_ambient) at x = L
- Parameters:
dt- Time step [s]innerFluidTemperatureK- Process fluid temperature [K]innerFilmCoefficientWPerM2K- Internal film coefficient [W/(m^2*K)]outerAmbientTemperatureK- Ambient/fire temperature [K]outerFilmCoefficientWPerM2K- External film coefficient [W/(m^2*K)]
-
advanceTimeStepInternal
private void advanceTimeStepInternal(double dt, double innerFluidTemperatureK, double innerFilmCoefficientWPerM2K, double outerAmbientTemperatureK, double outerFilmCoefficientWPerM2K) Internal time step advancement (assumes stability is already checked). -
getInnerWallTemperature
public double getInnerWallTemperature()Gets the current inner wall surface temperature (x = 0).- Returns:
- Inner wall temperature [K]
-
getOuterWallTemperature
public double getOuterWallTemperature()Gets the current outer wall surface temperature (x = L).- Returns:
- Outer wall temperature [K]
-
getMeanWallTemperature
public double getMeanWallTemperature()Gets the mean wall temperature (volume-averaged).- Returns:
- Mean wall temperature [K]
-
getTemperatureProfile
public double[] getTemperatureProfile()Gets the complete temperature profile across the wall.- Returns:
- Array of temperatures at each node [K]
-
getPositionArray
public double[] getPositionArray()Gets the position array for the temperature profile.- Returns:
- Array of positions [m] from inner wall (x=0) to outer wall (x=thickness)
-
getHeatFlux
public double getHeatFlux()Calculates the heat flux through the wall at steady state.This is an approximation based on the current temperature gradient at the boundaries.
- Returns:
- Heat flux [W/m^2] (positive = heat flowing from outer to inner)
-
getHeatAbsorbed
public double getHeatAbsorbed(double wallAreaM2, double previousMeanTemperatureK) Calculates the heat absorbed by the wall during a time step.- Parameters:
wallAreaM2- Wall surface area [m^2]previousMeanTemperatureK- Previous mean temperature [K]- Returns:
- Heat absorbed [J]
-
resetTemperature
public void resetTemperature(double temperatureK) Resets the temperature profile to a uniform value.- Parameters:
temperatureK- Uniform temperature [K]
-
getNumNodes
public int getNumNodes()Gets the number of spatial nodes.- Returns:
- Number of nodes
-
getTotalThickness
public double getTotalThickness()Gets the total wall thickness.- Returns:
- Total thickness [m]
-
getNodeSpacing
public double getNodeSpacing()Gets the node spacing.- Returns:
- Node spacing [m]
-
getMaxStableTimeStep
public double getMaxStableTimeStep()Calculates the maximum stable time step for the explicit scheme.- Returns:
- Maximum stable time step [s]
-