Materials#
- class Material(id, D_0, E_D, S_0=None, E_S=None, thermal_cond=None, heat_capacity=None, rho=None, borders=None, Q=None, solubility_law='sievert', name=None)[source]#
Bases:
object- Parameters:
id (int, list) – the id of the material. If a list is provided, the properties will be applied to all the subdomains with the corresponding ids.
D_0 (float) – diffusion coefficient pre-exponential factor (m2/s)
E_D (float) – diffusion coefficient activation energy (eV)
S_0 (float, optional) – Solubility pre-exponential factor (H/m3/Pa0.5). Defaults to None.
E_S (float, optional) – Solubility activation energy (eV). Defaults to None.
thermal_cond (float or callable, optional) – thermal conductivity (W/m/K). Can be a function of T. Defaults to None.
heat_capacity (float or callable, optional) – heat capacity (J/K/kg). Can be a function of T. Defaults to None.
rho (float or callable, optional) – volumetric density (kg/m3). Can be a function of T. Defaults to None.
borders (list, optional) – The borders of the 1D subdomain. Only needed in 1D with several materials. Defaults to None.
Q (float or callable, optional) – heat of transport (eV). Can be a function of T. Defaults to None.
solubility_law (str, optional) – the material’s solubility law. Can be “henry” or “sievert”. Defaults to “sievert”.
name (str, optional) – name of the material. Defaults to None.
Example:
my_mat = Material( id=1, D_0=2e-7, E_D=0.2, thermal_cond=lambda T: 3 * T + 2, heat_capacity=lambda T: 4 * T + 8, rho=lambda T: 7 * T + 5, Q=lambda T: -0.5 * T**2, )
- class Materials(*args)[source]#
Bases:
listA list of festim.Material objects
- check_borders(size)[source]#
Checks that the borders of the materials match
- Parameters:
size (float) – size of the 1D domain
- Raises:
ValueError – if the borders don’t begin at zero
ValueError – if borders don’t match
ValueError – if borders don’t end at size
- Returns:
bool – True if everything’s alright
- check_for_unused_properties(T: Temperature, derived_quantities: list)[source]#
Warns users if properties will be ignored
- Parameters:
T (festim.Temperature) – the temperature
derived_quantities (list) – list of festim.DerivedQuantity objects
- check_materials(T: Temperature, derived_quantities: list = [])[source]#
Checks the materials keys
- Parameters:
T (festim.Temperature) – the temperature
derived_quantities (list) – list of festim.DerivedQuantity objects the derived quantities. Defaults to [].
- check_missing_properties(T: Temperature, derived_quantities: list)[source]#
Checks if the materials miss some properties
- Parameters:
T (festim.Temperature) – the temperature
derived_quantities (list) – list of festim.DerivedQuantity objects
- Raises:
ValueError – if thermal_cond, heat_capacity or rho is None when needed
- create_properties(vm, T)[source]#
Creates the properties fields needed for post processing
- Parameters:
markers (vm {fenics.MeshFunction()} -- volume)
temperature (T {fenics.Function()} --)
- create_solubility_law_markers(mesh: Mesh)[source]#
Creates the attributes henry_marker and sievert_marker These fenics.Function are equal to one or zero depending on the material solubility_law
- Parameters:
mesh (festim.Mesh) – the mesh
- find_material(mat: int | str | Material)[source]#
Returns the correct festim.Material object based on either an id, a name
- Parameters:
mat (Union[int, str, Material]) – the material tag
- Returns:
the matching material
- Return type:
- find_material_from_id(mat_id)[source]#
Returns the material from a given id
- Parameters:
mat_id (int) – id of the wanted material
- Raises:
ValueError – if the id isn’t found
- Returns:
the material that has the id mat_id
- Return type:
- find_material_from_name(name)[source]#
Returns the material with the correct name
- Parameters:
name (str) – the name of the material
- Raises:
ValueError – when no match was found
- Returns:
the material object
- Return type: