H transport simulation#

class HTransportProblem(mobile, traps, T, settings, initial_conditions)[source]#

Bases: object

Hydrogen Transport Problem. Used internally in festim.Simulation

Parameters:
  • mobile (festim.Mobile) – the mobile concentration

  • traps (festim.Traps) – the traps

  • T (festim.Temperature) – the temperature

  • settings (festim.Settings) – the problem settings

  • initial_conditions (list of festim.initial_conditions) – the initial conditions of the h transport problem

Variables:
  • expressions (list) – contains time-dependent fenics.Expressions

  • J (ufl.Form) – the jacobian of the variational problem

  • V (fenics.FunctionSpace) – the vector-function space for concentrations

  • u (fenics.Function) – the vector holding the concentrations (c_m, ct1, ct2, …)

  • v (fenics.TestFunction) – the test function

  • u_n (fenics.Function) – the “previous” function

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

  • bcs (list) – list of fenics.DirichletBC for H transport

attribute_flux_boundary_conditions()[source]#

Iterates through self.boundary_conditions, checks if it’s a FluxBC and its field is 0, and assign fluxes to self.mobile

create_dirichlet_bcs(materials, mesh)[source]#

Creates fenics.DirichletBC objects for the hydrogen transport problem and add them to self.bcs

define_function_space(mesh)[source]#

Creates a suitable function space for H transport problem

Parameters:

mesh (festim.Mesh) – the mesh

define_newton_solver()[source]#

Creates the Newton solver and sets its parameters

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

Creates the variational problem for hydrogen transport (form, Dirichlet boundary conditions)

Parameters:
initialise(mesh, materials, dt=None)[source]#

Assigns BCs, create suitable function space, initialise concentration fields, define variational problem

Parameters:
initialise_concentrations()[source]#

Creates the main fenics.Function (holding all the concentrations), eventually split it and assign it to Trap and Mobile. Then initialise self.u_n based on self.initial_conditions

Parameters:

materials (festim.Materials) – the materials

solve_once()[source]#

Solves non linear problem

Returns:

number of iterations for reaching convergence, True if

converged else False

Return type:

int, bool

update(t, dt)[source]#

Updates the H transport problem.

Parameters: