Temperature#

class Temperature(value=None)[source]#

Bases: object

Class for Temperature in FESTIM

Parameters:

value (sp.Add, int, float, optional) – The value of the temperature. Defaults to None.

Variables:
  • T (fenics.Function) – the function attributed with temperature

  • T_n (fenics.Function) – the previous function

  • value (sp.Add, int, float) – the expression of temperature

  • expression (fenics.Expression) – the expression of temperature as a fenics object

Usage:
>>> import festim as F
>>> my_model = F.Simulation(...)
>>> my_model.T = F.Temperature(300 + 10 * F.x + F.t)
create_functions(mesh)[source]#

Creates functions self.T, self.T_n

Parameters:

mesh (festim.Mesh) – the mesh

update(t)[source]#

Updates T_n, expression, and T with respect to time

Parameters:

t (float) – the time

class TemperatureFromXDMF(filename, label)[source]#

Bases: Temperature

Temperature read from an XDMF file

Parameters:
  • filename (str) – The temperature file. Must end in “.xdmf”

  • label (str) – How the checkpoints have been labelled

Variables:
  • filename (str) – name of the temperature file

  • label (str) – How the checkpoints have been labelled

create_functions(mesh)[source]#

Creates functions self.T, self.T_n :param mesh: the mesh :type mesh: festim.Mesh

update(t)[source]#

Allows for the use of this class in transient h transport cases, refer to issue #499

class HeatTransferProblem(transient=True, initial_condition=None, absolute_tolerance=0.001, relative_tolerance=1e-10, maximum_iterations=30, linear_solver=None, preconditioner='default')[source]#

Bases: Temperature

Parameters:
  • transient (bool, optional) – If True, a transient simulation will be run. Defaults to True.

  • initial_condition (int, float, sp.Expr, festim.InitialCondition, optional) – The initial condition. Only needed if transient is True.

  • absolute_tolerance (float, optional) – the absolute tolerance of the newton solver. Defaults to 1e-03

  • relative_tolerance (float, optional) – the relative tolerance of the newton solver. Defaults to 1e-10

  • maximum_iterations (int, optional) – maximum iterations allowed for the solver to converge. Defaults to 30.

  • linear_solver (str, optional) – linear solver method for the newton solver, options can be viewed with print(list_linear_solver_methods()). If None, the default fenics linear solver will be used (“umfpack”). More information can be found at: https://fenicsproject.org/pub/tutorial/html/._ftut1017.html. Defaults to None.

  • preconditioner (str, optional) – preconditioning method for the newton solver, options can be veiwed by print(list_krylov_solver_preconditioners()). Defaults to “default”.

Variables:
  • F (fenics.Form) – the variational form of the heat transfer problem

  • v_T (fenics.TestFunction) – the test function

  • newton_solver (fenics.NewtonSolver) – Newton solver for solving the nonlinear problem

  • initial_condition (festim.InitialCondition) – the initial condition

  • sub_expressions (list) – contains time dependent fenics.Expression to be updated

  • sources (list) – contains festim.Source objects for volumetric heat sources

  • boundary_conditions (list) – contains festim.BoundaryConditions

create_dirichlet_bcs(surface_markers)[source]#

Creates a list of fenics.DirichletBC and add time dependent expressions to .sub_expressions

Parameters:

surface_markers (fenics.MeshFunction) – contains the mesh facet markers

create_functions(materials, mesh, dt=None)[source]#

Creates functions self.T, self.T_n and test function self.v_T. Solves the steady-state heat transfer problem if self.transient is False.

Parameters:
define_newton_solver()[source]#

Creates the Newton solver and sets its parameters

define_variational_problem(materials, mesh, dt=None)[source]#

Create a variational form for heat transfer problem

Parameters:
update(t)[source]#

Updates T_n, and T with respect to time by solving the heat transfer problem

Parameters:

t (float) – the time