Parameter library

In this example, we show how to use the Library to access parameter values to use in pipelines, either as known values or initial guesses for optimization. The library is currently small, and only contains thermodynamic parameters for the MSMR model for a handful of materials. The library will be expanded in the future, and users can add new materials for use in their own pipelines.

import ionworkspipeline as iwp

First we create a Library object.

lib = iwp.Library()

We can get a list of the materials in the library using the materials attribute.

lib.materials
['Graphite (Coal derived) - Paul 2024',
 'Graphite (Commercial) - Paul 2024',
 'Graphite - Verbrugge 2017',
 'LFP - Verbrugge 2017',
 'Manganese oxide - Verbrugge 2017',
 'NMC - Verbrugge 2017',
 'Silicon (delithiation) - Verbrugge 2017',
 'Silicon (lithiation) - Verbrugge 2017']

We can search for a material in the library using the search_materials method,

lib.search_materials("si")
Results for 'si': ['Silicon (delithiation) - Verbrugge 2017', 'Silicon (lithiation) - Verbrugge 2017']

and access the parameters for a material using by indexing the library with the material name.

si = lib["Silicon (lithiation) - Verbrugge 2017"]

si is a Material object with attributes for the name, description and parameter values.

Parameters are stored in a dictionary and can be accessed using the parameter_values attribute.

si.parameter_values
{'U0_n_0': 0.08216,
 'X_n_0': 0.21834,
 'w_n_0': 0.70934,
 'U0_n_1': 0.2329,
 'X_n_1': 0.23264,
 'w_n_1': 0.9597,
 'U0_n_2': 0.12606,
 'X_n_2': 0.42492,
 'w_n_2': 3.02803,
 'U0_n_3': 0.42638,
 'X_n_3': 0.1241,
 'w_n_3': 4.68406}

We can also access the name

si.name
'Silicon (lithiation) - Verbrugge 2017'

and description.

si.description
'Thermodynamic parameters for Lithiation of LixSi4.4 from Mark Verbrugge et al 2017 J.Electrochem.Soc. 164 E3243'

We can search the materials for a specific parameter using the search_parameters method.

si.search_parameters("U")
Results for 'U': ['U0_n_0', 'U0_n_1', 'U0_n_2', 'U0_n_3']
U0_n_0 -> 0.08216
U0_n_1 -> 0.2329
U0_n_2 -> 0.12606
U0_n_3 -> 0.42638

We can also search for parameters across the entire library.

lib.search_parameters("U")
Graphite (Coal derived) - Paul 2024
Results for 'U': ['U0_n_0', 'U0_n_1', 'U0_n_2', 'U0_n_3', 'U0_n_4', 'U0_n_5']
U0_n_0 -> 0.3954
U0_n_1 -> 0.1868
U0_n_2 -> 0.1191
U0_n_3 -> 0.1172
U0_n_4 -> 0.0846
U0_n_5 -> 0.0839
Graphite (Commercial) - Paul 2024
Results for 'U': ['U0_n_0', 'U0_n_1', 'U0_n_2', 'U0_n_3', 'U0_n_4', 'U0_n_5']
U0_n_0 -> 0.3329
U0_n_1 -> 0.2098
U0_n_2 -> 0.1281
U0_n_3 -> 0.1263
U0_n_4 -> 0.0886
U0_n_5 -> 0.0888
Graphite - Verbrugge 2017
Results for 'U': ['U0_n_0', 'U0_n_1', 'U0_n_2', 'U0_n_3', 'U0_n_4', 'U0_n_5']
U0_n_0 -> 0.088
U0_n_1 -> 0.13
U0_n_2 -> 0.14
U0_n_3 -> 0.17
U0_n_4 -> 0.21
U0_n_5 -> 0.36
LFP - Verbrugge 2017
Results for 'U': ['U0_p_0', 'U0_p_1']
U0_p_0 -> 3.42977
U0_p_1 -> 3.42977
Manganese oxide - Verbrugge 2017
Results for 'U': ['U0_p_0', 'U0_p_1', 'U0_p_2']
U0_p_0 -> 4.01326
U0_p_1 -> 4.14834
U0_p_2 -> 4.1445
NMC - Verbrugge 2017
Results for 'U': ['U0_p_0', 'U0_p_1', 'U0_p_2', 'U0_p_3']
U0_p_0 -> 3.6
U0_p_1 -> 3.7
U0_p_2 -> 3.9
U0_p_3 -> 4.2
Silicon (delithiation) - Verbrugge 2017
Results for 'U': ['U0_n_0', 'U0_n_1', 'U0_n_2', 'U0_n_3']
U0_n_0 -> 0.2807
U0_n_1 -> 0.47931
U0_n_2 -> 0.45049
U0_n_3 -> 0.71796
Silicon (lithiation) - Verbrugge 2017
Results for 'U': ['U0_n_0', 'U0_n_1', 'U0_n_2', 'U0_n_3']
U0_n_0 -> 0.08216
U0_n_1 -> 0.2329
U0_n_2 -> 0.12606
U0_n_3 -> 0.42638

New Material objects can be created by passing in a dictionary with keys “name”, “description” and “parameter_values” to the Material class. The parameters can contain functions and scalar values.

def myfun(x):
    return x**2


my_material_dict = {
    "name": "My Material",
    "description": "This is a material I made",
    "parameter values": {"U": 1.0, "D": 2.0, "fun": myfun},
}

my_material = iwp.Material(my_material_dict)

We can check that the stored parameters are those we passed in,

my_material.parameter_values
{'U': 1.0, 'D': 2.0, 'fun': <function __main__.myfun(x)>}

and we can search as before.

my_material.search_parameters("U")
Results for 'U': ['U', 'fun']
U -> 1.0
fun -> <function myfun at 0x72b579f78220>

New materials can be added to the library using entry points, as described in the documentation.