You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
the BaseModel.set_initial_conditions function extracts the ic values from a pybamm.Solution object. It looks in the output variables of the model to find each variable in turn, then concatenates a new state vector from the evaluation of those output variables.
This works fine with our library models, where for each variable a = pybamm.Variable('A'), we have defined an output variable model.variables = { 'A': a}. But third party models do not neccessarily have this structure, so the BaseModel.set_initial_conditions function can easily fail when this third party model is used in an experiment
Perhaps instead we could:
disallow any output variables of a model with the same name as a model variable
automatically create output variables for each variable when model is discretised
Steps to Reproduce
create a model that has a variable with name A, and an output variable with the same name but a different shape
use this model in an experiment
Relevant log output
The text was updated successfully, but these errors were encountered:
Hi @TusharNaugain, your potential solution seems to be just a rephrase of the steps that have been outlined already. Could you please elaborate on how you plan to implement these changes? A proposal to fix this must be refined enough and filled with details that describe your approach to the codebase succinctly.
This might not be a "good first issue", since it assumes some knowledge of what is going on with the processing and solving of our models – please look for issues labelled as "easy" if you wish to contribute and are looking for where to start!
agree with @agriyakhetarpal that this is not a good first issue, you need to have a good knowledge of how pybamm represents and processes a model via discretisation.
I didn't implement the BaseModel.set_initial_conditions function, @valentinsulzer I think this was you, are you happy with my proposed solution?
I think adding the variables when discretizing is a good idea, not sure why we also need to disallow outputs with the same name as set_initial_conditions should just look for the variable with the right name and ignore any others
if there is already an output with the same name as the variable then the discretisation class won't be able to add the variable (its a dict mapping str to an expression as I recall)
PyBaMM Version
develop
Python Version
n/a
Describe the bug
the
BaseModel.set_initial_conditions
function extracts the ic values from apybamm.Solution
object. It looks in the output variables of the model to find each variable in turn, then concatenates a new state vector from the evaluation of those output variables.This works fine with our library models, where for each variable
a = pybamm.Variable('A')
, we have defined an output variablemodel.variables = { 'A': a}
. But third party models do not neccessarily have this structure, so theBaseModel.set_initial_conditions
function can easily fail when this third party model is used in an experimentPerhaps instead we could:
Steps to Reproduce
A
, and an output variable with the same name but a different shapeRelevant log output
The text was updated successfully, but these errors were encountered: