Skip to content
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

Move initial soc out of solve #2372

Closed
aabills opened this issue Oct 17, 2022 · 3 comments · Fixed by #2375
Closed

Move initial soc out of solve #2372

aabills opened this issue Oct 17, 2022 · 3 comments · Fixed by #2375
Labels
difficulty: easy A good issue for someone new. Can be done in a few hours feature

Comments

@aabills
Copy link
Contributor

aabills commented Oct 17, 2022

Description

It would be nice if it was in its own method, which was then called by either solve or build.

Motivation

Necessary to get initial soc for Julia solvers

Possible Implementation

just move it to its own method, then call that method in build/solve

Additional context

No response

@valentinsulzer
Copy link
Member

It's already mostly in a separate method get_initial_stoichiometries.

PyBaMM/pybamm/simulation.py

Lines 605 to 624 in 91a97cd

c_n_init = self.parameter_values[
"Initial concentration in negative electrode [mol.m-3]"
]
c_p_init = self.parameter_values[
"Initial concentration in positive electrode [mol.m-3]"
]
param = pybamm.LithiumIonParameters()
c_n_max = self.parameter_values.evaluate(param.n.prim.c_max)
c_p_max = self.parameter_values.evaluate(param.p.prim.c_max)
x, y = pybamm.lithium_ion.get_initial_stoichiometries(
initial_soc, self.parameter_values
)
self.parameter_values.update(
{
"Initial concentration in negative electrode [mol.m-3]": x
* c_n_max,
"Initial concentration in positive electrode [mol.m-3]": y
* c_p_max,
}
)

What are the inputs/outputs you need for the julia stuff?

@aabills
Copy link
Contributor Author

aabills commented Oct 17, 2022

I just want to access it from build. S/b trivial

@valentinsulzer valentinsulzer added the difficulty: easy A good issue for someone new. Can be done in a few hours label Oct 17, 2022
@valentinsulzer
Copy link
Member

Yes, it's easy. We need to also keep it in solve though, no good reason to break backwards compatibility here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
difficulty: easy A good issue for someone new. Can be done in a few hours feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants