Temperature#
Definition of a temperature field or problem is essential for hydrogen transport
and FESTIM as a whole.
Regardless of how you define the temperature of the problem, it is passed to the T attribute of the festim.Simulation object.
Analytical expressions#
The temperature can be defined as a constant value in Kelvin (K):
my_temperature = 300
Temperature can also be defined as an expression of time and/or space. For example:
would be passed to FESTIM as:
from festim import x, t
my_temp = 300 + 2*x + 3*t
More complex expressions can be expressed with sympy:
would be passed to FESTIM as:
from festim import x, t
import sympy as sp
my_temp = sp.exp(x) * sp.sin(t)
Conditional expressions are also possible:
from festim import x, t
import sympy as sp
my_temp = sp.Piecewise((400, t < 10), (300, True))
From a heat transfer solver#
Temperature can also be obtained by solving the heat equation.
Users can define heat transfer problems using festim.HeatTransferProblem.
my_temp = HeatTransferProblem()
For a steady-state problem:
my_temp = HeatTransferProblem(transient=False)
Boundary conditions and heat sources can then be applied to this heat transfer problem.
For transient problems, an initial condition is required:
model.T = HeatTransferProblem(
transient=True,
initial_condition=300,
)
Initial conditions can be given as float, sympy expressions or a festim.InitialCondition instance in order to read from a XDMF file (see Initial Conditions for more details).
From a XDMF file#
Temperature can also be read from a XDMF file (see festim.TemperatureFromXDMF).
my_temp = TemperatureFromXDMF('temperature.xdmf', label='temperature')
Note
The XDMF file must contain a scalar field named ‘temperature’. Moreover, it has to have been exported in “checkpoint” mode (see XDMF export).