Concentration#

class Concentration(solution=None, previous_solution=None, test_function=None)[source]#

Bases: object

Class for concentrations (solute or traps) with attributed fenics.Function objects for the solution and the previous solution and a fenics.TestFunction

Parameters:
  • solution (fenics.Function or ufl.Indexed) – Solution for “current” timestep

  • previous_solution (fenics.Function or ufl.Indexed) – Solution for “previous” timestep

  • test_function (fenics.TestFunction or ufl.Indexed) – test function

initialise(V, value, label=None, time_step=None)[source]#

Assign a value to self.previous_solution

Parameters:
  • V (fenics.FunctionSpace) – the function space

  • value (sp.Add, float, int, str) – the value of the initialisation.

  • label (str, optional) – the label in the XDMF file. Defaults to None.

  • time_step (int, optional) – the time step to read in the XDMF file. Defaults to None.

class Mobile[source]#

Bases: Concentration

The mobile concentration.

If conservation of chemical potential, this will be c_m/S. If not, Mobile represents c_m.

Variables:
  • sources (list) – list of festim.Source objects. The volumetric source terms

  • F (fenics.Form) – the variational formulation for mobile

create_diffusion_form(materials, mesh, T, dt=None, traps=None, soret=False)[source]#

Creates the variational formulation for the diffusive part.

Parameters:
  • materials (festim.Materials) – the materials

  • mesh (festim.Mesh) – the mesh

  • T (festim.Temperature) – the temperature

  • dt (festim.Stepsize, optional) – the stepsize. Defaults to None.

  • traps (festim.Traps, optional) – the traps. Defaults to None.

  • chemical_pot (bool, optional) – if True, conservation of chemical potential is assumed. Defaults to False.

  • soret (bool, optional) – If True, Soret effect is assumed. Defaults to False.

create_fluxes_form(T, ds, dt=None)[source]#

Modifies the formulation and adds fluxes based on parameters in self.boundary_conditions

create_form(materials, mesh, T, dt=None, traps=None, soret=False)[source]#

Creates the variational formulation.

Parameters:
  • materials (festim.Materials) – the materials

  • mesh (festim.Mesh) – the mesh of the simulation

  • T (festim.Temperature) – the temperature

  • dt (festim.Stepsize, optional) – the stepsize. Defaults to None.

  • traps (festim.Traps, optional) – the traps. Defaults to None.

  • chemical_pot (bool, optional) – if True, conservation of chemical potential is assumed. Defaults to False.

  • soret (bool, optional) – If True, Soret effect is assumed. Defaults to False.

create_source_form(dx)[source]#

Creates the variational form for the volumetric source term parts.

Parameters:

dx (fenics.Measure) – the measure dx

class Theta[source]#

Bases: Mobile

Class representing the “chemical potential” c/S where S is the solubility of the metal

create_form_post_processing(V, materials, dx)[source]#

Creates a variational formulation for c = theta * S or theta**2 * S

Parameters:
  • V (fenics.FunctionSpace) – the DG1 function space of the concentration field

  • materials (festim.Materials) – the materials

  • dx (fenics.Measurement) – the dx measure of the problem

get_concentration_for_a_given_material(material, T)[source]#

Returns the concentration (and previous concentration) for a given material

Parameters:
Returns:

the current concentration and

previous concentration

Return type:

fenics.Product, fenics.Product

initialise(V, value, label=None, time_step=None)[source]#

Assign a value to self.previous_solution

Parameters:
  • V (fenics.FunctionSpace) – the function space

  • value (sp.Add, float, int, str) – the value of the initialisation.

  • label (str, optional) – the label in the XDMF file. Defaults to None.

  • time_step (int, optional) – the time step to read in the XDMF file. Defaults to None.

mobile_concentration()[source]#

Returns the hydrogen concentration as c=theta*K_S or c=theta**2*K_H This is needed when adding robin BCs (eg RecombinationFlux).

Returns:

the hydrogen mobile concentration

Return type:

ufl.algebra.Sum

post_processing_solution_to_concentration()[source]#

Converts the post_processing_solution from theta to mobile concentration. c = theta * S. The attribute post_processing_solution is fenics.Product (if self.S is festim.ArheniusCoeff)

class Trap(k_0, E_k, p_0, E_p, materials, density, id=None)[source]#

Bases: Concentration

Parameters:
  • k_0 (float, list) – trapping pre-exponential factor (m3 s-1)

  • E_k (float, list) – trapping activation energy (eV)

  • p_0 (float, list) – detrapping pre-exponential factor (s-1)

  • E_p (float, list) – detrapping activation energy (eV)

  • materials (list, str, festim.Material) – the materials the trap is living in. The material’s name.

  • density (sp.Add, float, list, fenics.Expresion, fenics.UserExpression) – the trap density (m-3)

  • id (int, optional) – The trap id. Defaults to None.

Raises:

ValueError – if duplicates are found in materials

Note

Should multiple traps in muliple materials be used, to save on dof’s, traps can be conglomerated and described in lists in the format:

festim.Trap(
    k_0=[1, 2],
    E_k=[1, 2],
    p_0=[1, 2],
    E_p=[1, 2],
    materials=[1, 2]
    density=[1, 2])

This will act as a singular trap but with seperate properties for respective materials. Parameters k_0, E_k, p_0, E_p, materials and density MUST have the same length for this method to be valid.

create_form(mobile, materials, T, dx, dt=None)[source]#

Creates the general form associated with the trap d ct/ dt = k c_m (n - c_t) - p c_t + S

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

  • materials (festim.Materials) – the materials of the simulation

  • T (festim.Temperature) – the temperature of the simulation

  • dx (fenics.Measure) – the dx measure of the sim

  • dt (festim.Stepsize, optional) – If None assuming steady state. Defaults to None.

create_source_form(dx)[source]#

Create the source form for the trap

Parameters:

dx (fenics.Measure) – the dx measure of the sim

create_trapping_form(mobile, materials, T, dx, dt=None)[source]#

d ct/ dt = k c_m (n - c_t) - p c_t

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

  • materials (festim.Materials) – the materials of the simulation

  • T (festim.Temperature) – the temperature of the simulation

  • dx (fenics.Measure) – the dx measure of the sim

  • dt (festim.Stepsize, optional) – If None assuming steady state. Defaults to None.

make_materials(materials)[source]#

Ensure all entries in self.materials are of type festim.Material

Parameters:

materials (festim.Materials) – the materials

Raises:

ValueError – if some duplicates are found

class Traps(*args)[source]#

Bases: list

A list of festim.Trap objects

append(item)[source]#

Append object to the end of the list.

define_variational_problem_extrinsic_traps(dx, dt, T)[source]#

Creates the variational formulations for the extrinsic traps densities

Parameters:
  • dx (fenics.Measure) – the dx measure of the sim

  • dt (festim.Stepsize) – If None assuming steady state.

  • T (festim.Temperature) – the temperature of the simulation

extend(other)[source]#

Extend list by appending elements from the iterable.

initialise_extrinsic_traps(V)[source]#

Add functions to ExtrinsicTrapBase objects for density form

insert(index, item)[source]#

Insert object before index.

class ExtrinsicTrapBase(k_0, E_k, p_0, E_p, materials, id=None, absolute_tolerance=1.0, relative_tolerance=1e-10, maximum_iterations=30, linear_solver=None, preconditioner='default', **kwargs)[source]#

Bases: Trap

define_newton_solver()[source]#

Creates the Newton solver and sets its parameters

class ExtrinsicTrap(k_0, E_k, p_0, E_p, materials, phi_0, n_amax, n_bmax, eta_a, eta_b, f_a, f_b, id=None, **kwargs)[source]#

Bases: ExtrinsicTrapBase

For details in the forumation see http://www.sciencedirect.com/science/article/pii/S2352179119300547

Parameters:
  • E_k (float, list) – trapping pre-exponential factor (m3 s-1)

  • k_0 (float, list) – trapping activation energy (eV)

  • p_0 (float, list) – detrapping pre-exponential factor (s-1)

  • E_p (float, list) – detrapping activation energy (eV)

  • materials (list, int) – the materials ids the trap is living in

  • id (int, optional) – The trap id. Defaults to None.

create_form_density(dx, dt, T)[source]#

Creates the variational formulation for the extrinsic trap density.

Parameters:
  • dx (fenics.Measure) – the dx measure of the sim

  • dt (festim.Stepsize) – the stepsize of the simulation.

  • T (festim.Temperature) – the temperature of the simulation

Note

T is an argument, although is not used in the formulation of extrinsic traps, but potential for subclasses of extrinsic traps

class NeutronInducedTrap(k_0, E_k, p_0, E_p, materials, phi, K, n_max, A_0, E_A, id=None, **kwargs)[source]#

Bases: ExtrinsicTrapBase

Class for neutron induced trap creation with annealing. The temporal evolution of the trap density is given by

dn_t/dt = phi*K*(1 - n_t/n_max) - A_0*exp(-E_A/(k_B*T))*n_t

Parameters:
  • k_0 (float, list) – trapping pre-exponential factor (m3 s-1)

  • E_k (float, list) – trapping activation energy (eV)

  • p_0 (float, list) – detrapping pre-exponential factor (s-1)

  • E_p (float, list) – detrapping activation energy (eV)

  • materials (list or int) – the materials ids the trap is living in

  • phi (float, sympy.Expr, f.Expression, f.UserExpression) – damage rate (dpa s-1),

  • K (float, sympy.Expr, f.Expression, f.UserExpression) – trap creation factor (m-3 dpa-1),

  • n_max (float, sympy.Expr, f.Expression, f.UserExpression) – maximum trap density (m-3),

  • A_0 (float, sympy.Expr, f.Expression, f.UserExpression) – trap_annealing_factor (s-1),

  • E_A (float, sympy.Expr, f.Expression, f.UserExpression) – annealing activation energy (eV).

  • id (int, optional) – The trap id. Defaults to None.

create_form_density(dx, dt, T)[source]#

Creates the variational formulation for the extrinsic trap density.

Parameters:
  • dx (fenics.Measure) – the dx measure of the sim

  • dt (festim.Stepsize) – the stepsize of the simulation.

  • T (festim.Temperature) – the temperature of the simulation