The parameter values for a simulation.
Note that this class does not inherit directly from the python dictionary class as this causes issues with saving and loading simulations.
values (dict or string) – Explicit set of parameters, or reference to a file of parameters If string, gets passed to read_parameters_csv to read a file.
chemistry (dict) – Dict of strings for default chemistries. Must be of the form: {“base chemistry”: base_chemistry, “cell”: cell_properties_authorYear, “negative electrode”: negative_electrode_chemistry_authorYear, “separator”: separator_chemistry_authorYear, “positive electrode”: positive_electrode_chemistry_authorYear, “electrolyte”: electrolyte_chemistry_authorYear, “experiment”: experimental_conditions_authorYear}. Then the negative electrode chemistry is loaded from the file inputs/parameters/base_chemistry/negative electrodes/ negative_electrode_chemistry_authorYear, etc. Parameters in “cell” should include geometry and current collector properties. Parameters in “experiment” should include parameters relating to experimental conditions, such as initial conditions and currents.
Examples
>>> import pybamm
>>> values = {"some parameter": 1, "another parameter": 2}
>>> param = pybamm.ParameterValues(values)
>>> param["some parameter"]
1
>>> file = "input/parameters/lithium_ion/cells/kokam_Marquis2019/parameters.csv"
>>> values_path = pybamm.get_parameters_filepath(file)
>>> param = pybamm.ParameterValues(values=values_path)
>>> param["Negative current collector thickness [m]"]
2.5e-05
>>> param = pybamm.ParameterValues(chemistry=pybamm.parameter_sets.Marquis2019)
>>> param["Reference temperature [K]"]
298.15
Process and evaluate a symbol.
symbol (pybamm.Symbol
) – Symbol or Expression tree to evaluate
The evaluated symbol
number or array
Look for parameter file in the different locations in PARAMETER_PATH
Return item correspoonding to key if it exists, otherwise return default
Print a dictionary of evaluated parameters to an output file
evaluated_parameters (defaultdict) – The evaluated parameters, for further processing if needed
output_file (string, optional) – The file to print parameters to. If None, the parameters are not printed, and this function simply acts as a test that all the parameters can be evaluated
Return dictionary of evaluated parameters, and optionally print these evaluated parameters to an output file. For dimensionless parameters that depend on the C-rate, the value is given as a function of the C-rate (either x * Crate or x / Crate depending on the dependence)
parameters (class or dict containing pybamm.Parameter
objects) – Class or dictionary containing all the parameters to be evaluated
output_file (string, optional) – The file to print parameters to. If None, the parameters are not printed, and this function simply acts as a test that all the parameters can be evaluated, and returns the dictionary of evaluated parameters.
evaluated_parameters – The evaluated parameters, for further processing if needed
defaultdict
Notes
A C-rate of 1 C is the current required to fully discharge the battery in 1 hour, 2 C is current to discharge the battery in 0.5 hours, etc
Process boundary conditions for a model Boundary conditions are dictionaries {“left”: left bc, “right”: right bc} in general, but may be imposed on the tabs (or not on the tab) for a small number of variables, e.g. {“negative tab”: neg. tab bc, “positive tab”: pos. tab bc “no tab”: no tab bc}.
Assign parameter values to a geometry (inplace).
geometry (dict) – Geometry specs to assign parameter values to
Assign parameter values to a model. Currently inplace, could be changed to return a new model.
unprocessed_model (pybamm.BaseModel
) – Model to assign parameter values for
inplace (bool, optional) – If True, replace the parameters in the model in place. Otherwise, return a new model with parameter values set. Default is True.
pybamm.ModelError – If an empty model is passed (model.rhs = {} and model.algebraic = {} and model.variables = {})
Walk through the symbol and replace any Parameter with a Value. If a symbol has already been processed, the stored value is returned.
symbol (pybamm.Symbol
) – Symbol or Expression tree to set parameters for
symbol – Symbol with Parameter instances replaced by Value
Search dictionary for keys containing ‘key’.
See pybamm.FuzzyDict.search()
.
Update parameter dictionary, while also performing some basic checks.
values (dict) – Dictionary of parameter values to update parameter dictionary with
check_conflict (bool, optional) – Whether to check that a parameter in values has not already been defined in the parameter class when updating it, and if so that its value does not change. This is set to True during initialisation, when parameters are combined from different sources, and is False by default otherwise
check_already_exists (bool, optional) – Whether to check that a parameter in values already exists when trying to update it. This is to avoid cases where an intended change in the parameters is ignored due a typo in the parameter name, and is True by default but can be manually overridden.
path (string, optional) – Path from which to load functions