-
-
Notifications
You must be signed in to change notification settings - Fork 563
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Take r_average
of a variable that is broadcast
#1114
Comments
When the model is being built, everything is purely symbolic so the value of the concentration doesn't exist. Typically what I do is solve the model and then look at the values of the variables. What is the reason for needing to see the value before solving? "R-averaged "
+ self.domain.lower()
+ " particle concentration": pybamm.r_average(c_s) |
Thanks for your reply. For some intermediate variables defined in functions but not for outputs, can I still see the values in the solution? I was trying to figure out where was the issue when getting a wrong result, by checking the values of intermediate variables. Following your explanation on the r-average, is it applicable to many particles? |
You would need to define the intermediate variables and add them to the list of variables. If it doesn't make sense to add them to the dictionary of variables, you could do it in your main script e.g. c = model.variables["Electrolyte concentration"]
model.variables["Two times c"] = 2*c then they will appear in the final solution. Many-particle models aren't implemented yet, but |
I have tried to get the r_average concentration, but it fails to broadcast the variable to the domain I used the commands: And when I printed their domain, I got |
In theory, you shouldn't need to broadcast it again as # If symbol is a Broadcast, its average value is its child
elif isinstance(symbol, pybamm.Broadcast):
return symbol.orphans[0] It does this even if the symbol is broadcast in the x-direction, which will be the case if you are using SPM. So
|
r_average
of a variable that is broadcast
Thanks for your reply. I need to report another bug (I think) below, which you may correct at the same time. The child of So |
I can't reproduce this. When running the normal DFN, the variable
with no children. The way I can get it to do what you reported is if I run the DFN with options |
Yes, I was using the fast particle submodel, which is the default option from a notebook example. The Fickian type model should be used instead. Thanks for pointing this out. |
Describe the bug
This is a question rather than a bug. How to show the value of variables (e.g. the r-averaged concentration c_s_av as below) in debug mode (in VS code)? This is convenient to check the definition of equations and to dig out the issues as a developer.
Another question is how to get the r-averaged concentration for all electrode particles in a P2D model? It only has x-average concentration of c_s_n_xav and c_s_p_xav in standard_variables.py
To Reproduce
Steps to reproduce the behaviour:
Expected behaviour
To show a matrix/array of values for the average concentration for electrode particles.
Screenshots
The text was updated successfully, but these errors were encountered: