Error with too many children when processing parameter with tabular data
See original GitHub issueDescribe the bug When updating the positive or negative electrode OCP entropic change with tabular data like in:
params.update({"Negative electrode OCP entropic change [V.K-1]": "[data]my_data"}, path="")
There is an error when creating the interpolant in here. The traceback is enourmous, but the last bit is:
~/Documents/Projects/PyBaMM-GEM/PyBaMM/pybamm/parameters/parameter_values.py in _process_symbol(self, symbol)
512 print(i, v)
513 name, data = function_name
--> 514 function = pybamm.Interpolant(data, *new_children, name=name)
515 elif isinstance(function_name, numbers.Number):
516 # If the "function" is provided is actually a scalar, return a Scalar
TypeError: __init__() got multiple values for argument 'name'
I’ve identified that, apparently, when procesing these parameters, new_children
has actually two elements, but pybamm.Interpolate
only expect one child. The second child is assigned to the argument name
and therefore the actual keyword argument name
is redundant, hence the error.
To Reproduce Run the following script. Attached is the input file. my_data.csv.zip
The error is the same when using the default chemistry or the SPMe and DFN models.
import pybamm
exp = pybamm.Experiment(["Discharge at 1C until 2.5V",
"Rest for 1 hour",
"Charge at 1C until 4.2V",
"Hold at 4.2V until 50mA",])
model = pybamm.lithium_ion.SPM(options={"thermal": "x-full"} )
params = pybamm.ParameterValues(chemistry=pybamm.parameter_sets.Chen2020)
params.update({"Negative current collector surface heat transfer coefficient [W.m-2.K-1]": 0,
"Positive current collector surface heat transfer coefficient [W.m-2.K-1]": 0},
check_already_exists=False)
params.update({"Negative electrode OCP entropic change [V.K-1]": "[data]my_data"}, path="")
sim = pybamm.Simulation(model=model, parameter_values=params, experiment=exp)
sim.solve()
Expected behaviour The parameter should be processed without error.
Screenshots None
Additional context
The two children that appear to be causing the problem are:
broadcast(boundary value(X-averaged positive particle concentration))
Maximum concentration in positive electrode [mol.m-3]
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (3 by maintainers)
To NOT close this issue. I can’t spell 🤦
You can either do that or create the function in your main file and reference it directly (pass the function object). If you do the first option, you need to set the path to point to where the function is defined. Did you mean do close or don’t close?