thermesh - 1-D Transient Heat Conduction

The thermesh module provides 1-D transient heat conduction modeling for vessel walls using the finite element method. This is particularly important for Type III/IV vessels with low thermal conductivity composite materials.

1-D transient heat conduction solver using finite element method.

This module provides a finite element solver for transient heat conduction problems in 1-D domains. It is particularly useful for calculating temperature distributions through vessel walls with composite materials or low thermal conductivity.

The code is adapted from the thermesh library (https://github.com/wjbg/thermesh) and implements: - Linear and quadratic finite elements - Theta-method time integration (explicit, implicit, Crank-Nicolson) - Temperature-dependent material properties - Dirichlet and Neumann boundary conditions - Multi-layer/composite material domains

Key classes: - Domain: Represents the computational domain with mesh, material model, and BCs - Mesh: 1-D finite element mesh with elements and nodes - Element: Abstract base class for finite elements - LinearElement: 2-node linear finite element - QuadraticElement: 3-node quadratic finite element

Typical usage: 1. Create Mesh with nodes and elements 2. Define material model (isothermal_model or piecewise_linear_model) 3. Create Domain with mesh, material, initial temperature, and BCs 4. Solve using solve_ht() with time step and end time

The solver uses the theta-method for time integration: - theta = 0: Forward Euler (explicit, conditionally stable) - theta = 0.5: Crank-Nicolson (implicit, unconditionally stable, 2nd order) - theta = 1: Backward Euler (implicit, unconditionally stable, 1st order)

hyddown.thermesh.solve_ht(domain, solver)[source]

Solves heat transfer problem.

Parameters:
  • domain (Domain) – Domain with a mesh, material model and boundary conditions.

  • solver (dict) – Solver information, dictionary with the following keys: dt, t_end, theta

Return type:

tuple[ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]]]

Returns:

  • t (nd.array(dtype=float, dim=1, len=int(t_end/dt))) – Times.

  • T (nd.array(dtype=float, dim=2, shape=(int(t_end/dt), mesh.nn))) – Temperature data.

class hyddown.thermesh.Domain(mesh, constitutive_model, bc={})[source]

Bases: object

Class to represent a domain.

mesh

Object with mesh information.

Type:

Mesh

bc

The boundary conditions are provided in a two-item list of dictionaries. The first dictionary (or zeroth item in the list) applies to the start or left side of the domain, while the second item applies to the end or right side of the domain. The dictionaries can have the keys: “T” OR ( (“h” and “T_inf”) AND/OR “q” ), with “T” an applied temperature, “h” and “T_inf” the convective heat transfer coefficient and far field temperature, respectively, while “q” represents a direct flux on the surface which is directed inwards.

Type:

two-item list of dicts

constitutive_model

Functions that takes temperature as an input and provides a dictionary with the following keys: k, cp, rho. The list has a length equal to the number of subdomains in the mesh. The i-th function in the list belongs to the i-th subdomain.

Type:

list[function]

t

Time.

Type:

float

T

Temperature at time t.

Type:

nd.array(dim=1, len=mesh.nn)

q

Heat flux at time t.

Type:

nd.array(dim=1, len=mesh.nn)

timestep(dt, theta=0.5)[source]

Apply a timestep dt and update data.

system_matrices()[source]

Returns domain stiffness and dampling matrix.

check_bc()[source]

Checks if bc’s are valid.

set_T(T) and set_q(q)[source]

Set temperature and heat flux.

clear()[source]

Clears data.

__init__(mesh, constitutive_model, bc={})[source]
timestep(dt, theta=0.5)[source]

Apply timestep and update data.

Parameters:
  • dt (float) – Timestep size.

  • theta (float (0 < theta <= 1)) – Timestepping type.

  • NOTE (The internal heat source Q is not implemented yet.) – repeatedly constructed.

  • NOTE – problem becomes nonlinear, e.g. due to a radiative bc or due to temperature-dependent material properties.

  • NOTE

system_matrices()[source]

Returns domain stiffness and damping matrix.

Return type:

tuple[ndarray[tuple[Any, ...], dtype[float64]], ndarray[tuple[Any, ...], dtype[float64]]]

check_bc()[source]

Check if boundary conditions are valid.

Return type:

bool

set_T(T)[source]

Set temperature.

Parameter

Tfloat OR np.ndarray(dim=1, dtype=float, len=nn)

Temperature at nodes.

set_q(q)[source]

Set heat flux.

Parameter

qfloat OR np.ndarray(dim=1, dtype=float, len=nn)

Heat flux at nodes.

clear()[source]

Clears time and temperature data.

hyddown.thermesh.isothermal_model(k, rho, cp)[source]

Returns a function that represents an isothermal material model.

Parameter

kfloat

Thermal conductivity.

rhofloat

Density

cpfloat

Specific heat.

returns:

model – Function that returns a dictionary with the provided constitutive properties.

rtype:

Callable

hyddown.thermesh.piecewise_linear_model(k, rho, cp)[source]

Returns a function that represents an isothermal material model.

Parameter

knp.ndarray(dim=2, dtype=float)

Temperature vs. thermal conductivity.

rhonp.ndarray(dim=2, dtype=float)

Temperature vs. density

cpnp.ndarray(dim=2, dtype=float)

Temperature vs. specific heat.

returns:

model – Function that returns a dictionary with the provided constitutive properties.

rtype:

Callable

class hyddown.thermesh.Mesh(z, element)[source]

Bases: object

Class to represent a mesh.

nodes

Node locations.

Type:

nd.array()

elem

List of elements.

Type:

list[Element]

nn

Number of nodes.

Type:

int

nel

Number of elements.

Type:

int

subdomain

Number that indicates the subdomain in the mesh. Correlates with the constitutive model that will be used for the analysis.

Type:

list[int] (defaults to a list with zeros)

__init__(z, element)[source]

Initializes Mesh instance.

Parameters:
  • z (np.ndarray(dim=1, dtype=float)) – Node locations.

  • element (Element) – Element type.

class hyddown.thermesh.Element(nodes)[source]

Bases: object

Class to represent an element.

order

Order of the element.

Type:

int

dim

Dimension of the element.

Type:

int

dim = 1
order = 0
__init__(nodes)[source]

Initializes Element instance.

Parameters:

nodes (np.ndarray(dim=1, dtype=float)) – Node locations.

length()[source]
Return type:

float

class hyddown.thermesh.LinearElement(nodes)[source]

Bases: Element

Class to represent a linear element (order = 1).

K()[source]

Returns element stiffness matrix.

C()[source]

Returns element damping matrix.

order = 1
K(mat)[source]

Returns element stiffness matrix.

Return type:

ndarray[tuple[Any, ...], dtype[float64]]

C(mat)[source]

Returns element damping matrix.

class hyddown.thermesh.QuadraticElement(nodes)[source]

Bases: Element

Class to represent a linear element (order = 2).

K()[source]

Returns element stiffness matrix.

C()[source]

Returns element damping matrix.

order = 2
K(mat)[source]

Returns element stiffness matrix.

Return type:

ndarray[tuple[Any, ...], dtype[float64]]

C(mat)[source]

Returns element damping matrix.

Return type:

ndarray[tuple[Any, ...], dtype[float64]]

Overview

The module is adapted from https://github.com/wjbg/thermesh and implements finite element analysis for transient heat conduction through vessel walls.

Key Features

  • Finite element method for accurate temperature distribution

  • Support for composite materials (multi-layer walls)

  • Time-dependent boundary conditions

  • Integration with fire heat load calculations

  • Separate models for wetted/unwetted regions in two-phase flow

Applications

The detailed heat conduction model is essential for:

  • Type III/IV composite pressure vessels

  • Materials with low thermal conductivity

  • Accurate wall temperature prediction during fire scenarios

  • Two-phase systems with different heat transfer in gas/liquid contact regions

Wall Heat Conduction Modes

HydDown supports two modes:

  1. Simple: Uniform wall temperature (lumped capacitance) - fast but approximate

  2. Detailed: 1-D transient conduction via thermesh - slower but accurate

The detailed mode is activated by setting appropriate parameters in the heat_transfer section of the input file.

Composite Materials

For multi-layer walls (e.g., Type III vessels with liner, composite overwrap, and outer layer):

  1. Define material properties for each layer

  2. Specify layer thicknesses

  3. The solver handles interfaces automatically

Two-Phase Modeling

For two-phase systems, the module solves separate heat conduction problems for:

  • Wetted region (liquid-contact) - typically higher heat transfer

  • Unwetted region (gas-contact) - typically lower heat transfer

The boundary between regions is determined by the liquid level in the vessel.