-
-
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
Composite porosity #4417
Open
DrSOKane
wants to merge
41
commits into
pybamm-team:develop
Choose a base branch
from
DrSOKane:composite-porosity
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Composite porosity #4417
Changes from 29 commits
Commits
Show all changes
41 commits
Select commit
Hold shift + click to select a range
0e70d3e
Started modifying porosity change submodel to work with phases
DrSOKane b8dd013
Porosity now works on composite electrode
DrSOKane e8fc8f4
Now works for non-composite electrode as well!
DrSOKane b2825de
Merge branch 'develop' of https://github.com/pybamm-team/PyBaMM into …
DrSOKane b76a2ca
style: pre-commit fixes
pre-commit-ci[bot] 6b87041
changelog
DrSOKane cd4aa54
Merge branch 'composite-porosity' of https://github.com/DrSOKane/PyBa…
DrSOKane 4758ab8
style fix
DrSOKane adcb652
Updated tests
DrSOKane 1985fb1
Changed how pref is handled
DrSOKane 9352297
Merge branch 'develop' of https://github.com/pybamm-team/PyBaMM into …
DrSOKane 709d634
Added comments to the new if statements
DrSOKane 96d960d
Merge branch 'develop' of https://github.com/pybamm-team/PyBaMM into …
DrSOKane f0a5a79
Why did I not think of this before?!
DrSOKane 3937c54
Merge branch 'develop' of https://github.com/pybamm-team/PyBaMM into …
DrSOKane 7e87880
Merge branch 'develop' into composite-porosity
brosaplanella 47949e7
changelog
DrSOKane b1b225a
Merge branch 'composite-porosity' of https://github.com/DrSOKane/PyBa…
DrSOKane 04d0d7a
Merge branch 'develop' into composite-porosity
kratman 35df164
changelog
DrSOKane 69b366d
changelog
DrSOKane 447d435
Merge branch 'develop' into composite-porosity
brosaplanella 05ce7b3
Merged singe-layer SEI
DrSOKane 8930dd3
Merge branch 'composite-porosity' of https://github.com/DrSOKane/PyBa…
DrSOKane 252b132
Fixed merge conflict
DrSOKane c89419a
Merge branch 'develop' of https://github.com/pybamm-team/PyBaMM into …
DrSOKane 43fc11f
Removed one last reference to inner and outer
DrSOKane d1f99d0
style: pre-commit fixes
pre-commit-ci[bot] 18551aa
Merge branch 'develop' into composite-porosity
brosaplanella 6228dd2
Refactored if statement in reaction_driven_porosity.py
DrSOKane 72f945b
Merge branch 'develop' of https://github.com/pybamm-team/PyBaMM into …
DrSOKane 7b8c001
changelog
DrSOKane 58b0006
Merge branch 'composite-porosity' of https://github.com/DrSOKane/PyBa…
DrSOKane d339967
Merge branch 'develop' of https://github.com/pybamm-team/PyBaMM into …
DrSOKane 5509022
Merge branch 'develop' of https://github.com/pybamm-team/PyBaMM into …
DrSOKane 9ca1efa
Merge branch 'develop' into composite-porosity
DrSOKane 3df0d80
Merge branch 'develop' of https://github.com/pybamm-team/PyBaMM into …
DrSOKane ae5f0f8
Merge branch 'composite-porosity' of https://github.com/DrSOKane/PyBa…
DrSOKane 8619c4c
Added comment for Asher
DrSOKane d3a88a9
Merge branch 'develop' of https://github.com/pybamm-team/PyBaMM into …
DrSOKane cd6077c
style: pre-commit fixes
pre-commit-ci[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,36 +25,61 @@ def __init__(self, param, options, x_average): | |
def get_coupled_variables(self, variables): | ||
eps_dict = {} | ||
for domain in self.options.whole_cell_domains: | ||
delta_eps_k = 0 | ||
if domain == "separator": | ||
delta_eps_k = 0 # separator porosity does not change | ||
pass # separator porosity does not change | ||
else: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe this could be refactored to use if domain != "separator" |
||
Domain = domain.split()[0].capitalize() | ||
L_sei_k = variables[f"{Domain} total SEI thickness [m]"] | ||
dom = domain.split()[0] | ||
Domain = dom.capitalize() | ||
if Domain == "Negative": | ||
L_sei_0 = self.param.n.prim.L_sei_0 | ||
elif Domain == "Positive": | ||
L_sei_0 = self.param.p.prim.L_sei_0 | ||
L_pl_k = variables[f"{Domain} lithium plating thickness [m]"] | ||
L_dead_k = variables[f"{Domain} dead lithium thickness [m]"] | ||
L_sei_cr_k = variables[f"{Domain} total SEI on cracks thickness [m]"] | ||
roughness_k = variables[f"{Domain} electrode roughness ratio"] | ||
SEI_option = getattr(self.options, dom)["SEI"] | ||
phases_option = getattr(self.options, dom)["particle phases"] | ||
phases = self.options.phases[dom] | ||
for phase in phases: | ||
if phases_option == "1" and phase == "primary": | ||
# `domain` has one phase | ||
phase_name = "" | ||
pref = "" | ||
else: | ||
# `domain` has more than one phase | ||
phase_name = phase + " " | ||
pref = phase.capitalize() + ": " | ||
L_sei_k = variables[f"{Domain} total {phase_name}SEI thickness [m]"] | ||
if SEI_option == "none": | ||
L_sei_0 = pybamm.Scalar(0) | ||
else: | ||
L_sei_0 = pybamm.Parameter(f"{pref}Initial SEI thickness [m]") | ||
L_pl_k = variables[ | ||
f"{Domain} {phase_name}lithium plating thickness [m]" | ||
] | ||
L_dead_k = variables[ | ||
f"{Domain} {phase_name}dead lithium thickness [m]" | ||
] | ||
L_sei_cr_k = variables[ | ||
f"{Domain} total {phase_name}SEI on cracks thickness [m]" | ||
] | ||
|
||
L_tot = ( | ||
(L_sei_k - L_sei_0) | ||
+ L_pl_k | ||
+ L_dead_k | ||
+ L_sei_cr_k * (roughness_k - 1) | ||
) | ||
L_tot = ( | ||
(L_sei_k - L_sei_0) | ||
+ L_pl_k | ||
+ L_dead_k | ||
+ L_sei_cr_k * (roughness_k - 1) | ||
) | ||
|
||
a_k = variables[ | ||
f"{Domain} electrode surface area to volume ratio [m-1]" | ||
] | ||
a_k = variables[ | ||
f"{Domain} electrode {phase_name}" | ||
"surface area to volume ratio [m-1]" | ||
] | ||
|
||
# This assumes a thin film so curvature effects are neglected. | ||
# They could be included (e.g. for a sphere it is | ||
# a_n * (L_tot + L_tot ** 2 / R_n + L_tot ** # 3 / (3 * R_n ** 2))) | ||
# but it is not clear if it is relevant or not. | ||
delta_eps_k = -a_k * L_tot | ||
# This assumes a thin film so curvature effects are neglected. | ||
# They could be included (e.g. for a sphere it is | ||
# a_n * (L_tot + L_tot ** 2 / R_n + L_tot ** # 3 / (3 * R_n ** 2))) | ||
# but it is not clear if it is relevant or not. | ||
delta_eps_k += -a_k * L_tot | ||
|
||
domain_param = self.param.domain_params[domain.split()[0]] | ||
eps_k = domain_param.epsilon_init + delta_eps_k | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be moved to the unreleased section