-
-
Notifications
You must be signed in to change notification settings - Fork 589
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
Implement Integrated electrolyte conductivity #1188
Merged
brosaplanella
merged 112 commits into
pybamm-team:develop
from
brosaplanella:issue-884-electrolyte-integrated-conductivity
Nov 4, 2020
Merged
Changes from all commits
Commits
Show all changes
112 commits
Select commit
Hold shift + click to select a range
92de548
#884 added integrated conductivity model
brosaplanella e5d7c14
#884 debugging new submodel
brosaplanella fb667b3
#884 added integrated conductivity model
brosaplanella 7899fdd
#884 debugging new submodel
brosaplanella 7b3df30
Merge branch 'issue-884-electrolyte-integrated-conductivity' of https…
brosaplanella 573db34
#884 added integrated conductivity model
brosaplanella eec8354
#884 debugging new submodel
brosaplanella 5d7ca5d
Merge branch 'issue-884-electrolyte-integrated-conductivity' of https…
brosaplanella 334dd17
flake8
brosaplanella 3eb9c68
#884 added integrated conductivity model
brosaplanella 4a3ebf7
#884 debugging new submodel
brosaplanella 5c5b7fa
flake8
brosaplanella 00bfd7c
added tab parameters (set to zero) so thermal model runs
brosaplanella a8496db
debugged conductivity
brosaplanella 34b94f3
added new SPMe model
brosaplanella e439182
fix merge conflict
brosaplanella 3ebae0b
flake8
brosaplanella 5548930
#884 added integrated conductivity model
brosaplanella 4c10748
#884 debugging new submodel
brosaplanella 7e3c823
flake8
brosaplanella 3f76b27
debugged conductivity
brosaplanella 577f5fc
added new SPMe model
brosaplanella a39ac10
flake8
brosaplanella 9d30d37
solved merge conflict
brosaplanella e7897be
#884 added integrated conductivity model
brosaplanella 428e4aa
#884 debugging new submodel
brosaplanella e30ddf9
flake8
brosaplanella f5bef85
debugged conductivity
brosaplanella 7ebf86a
added new SPMe model
brosaplanella f0aa087
flake8
brosaplanella 57c856b
Merge branch 'issue-884-electrolyte-integrated-conductivity' of https…
brosaplanella 320804b
#884 fixed the new SPMe model to work with the new geometry
brosaplanella bf92330
#884 added integrated conductivity model
brosaplanella 44bdd41
#884 debugging new submodel
brosaplanella a0d17b5
flake8
brosaplanella 90eb3ee
#884 added integrated conductivity model
brosaplanella bef6b8c
flake8
brosaplanella 80dc52d
debugged conductivity
brosaplanella 3866e20
added new SPMe model
brosaplanella a5c51cd
flake8
brosaplanella 7b55d57
#884 debugging new submodel
brosaplanella 06674fa
debugged conductivity
brosaplanella a923ca7
#884 fixed the new SPMe model to work with the new geometry
brosaplanella 593ddd4
Merge branch 'issue-884-electrolyte-integrated-conductivity' of https…
brosaplanella 764fcec
#884 cleaned code
brosaplanella 96eb696
#884 added integrated conductivity model
brosaplanella 183a765
#884 debugging new submodel
brosaplanella c0448ca
flake8
brosaplanella d790866
debugged conductivity
brosaplanella c135494
added new SPMe model
brosaplanella 1cee889
flake8
brosaplanella a92fcf8
#884 fixed the new SPMe model to work with the new geometry
brosaplanella 8dc661f
#884 added integrated conductivity model
brosaplanella 40b12c3
flake8
brosaplanella fb4f6d9
#884 debugging new submodel
brosaplanella 9e0d807
debugged conductivity
brosaplanella 71d7a03
#884 cleaned code
brosaplanella d8108e8
#884 renamed model
brosaplanella 4e47666
Merge branch 'issue-884-electrolyte-integrated-conductivity' of https…
brosaplanella 6ec5ce6
#884 added integrated conductivity model
brosaplanella 4a6874f
#884 debugging new submodel
brosaplanella b6626c0
flake8
brosaplanella 93eefae
debugged conductivity
brosaplanella 679ffbe
added new SPMe model
brosaplanella 0a6dfd9
flake8
brosaplanella 51f71c4
#884 fixed the new SPMe model to work with the new geometry
brosaplanella 02ee792
#884 added integrated conductivity model
brosaplanella 2b77066
flake8
brosaplanella a91053d
#884 debugging new submodel
brosaplanella 7e6de9d
debugged conductivity
brosaplanella 466e502
#884 cleaned code
brosaplanella d11e266
#884 debugging new submodel
brosaplanella a15c8d5
debugged conductivity
brosaplanella 1521a3f
#884 added integrated conductivity model
brosaplanella 73a5bfa
flake8
brosaplanella 85c77e7
#884 debugging new submodel
brosaplanella 3904114
debugged conductivity
brosaplanella 1ae86bb
#884 cleaned code
brosaplanella 62c52ea
#884 renamed model
brosaplanella 9999775
Merge branch 'issue-884-electrolyte-integrated-conductivity' of https…
brosaplanella b55ede7
Merge branch 'develop' into issue-884-electrolyte-integrated-conducti…
brosaplanella dd8e174
Merge branch 'develop' into issue-884-electrolyte-integrated-conducti…
brosaplanella f4ba84e
#884 tidy up for merge
brosaplanella cf39650
#884 removed SPME_FBP (for development only)
brosaplanella 756e093
#884 add preliminary citation
brosaplanella 9d08f5e
#884 add test
brosaplanella 0d19dbc
#884 removed activation energy from Nyman2008
brosaplanella 48ca85c
Merge branch 'develop' into issue-884-electrolyte-integrated-conducti…
brosaplanella 5eee5be
Merge branch 'develop' into issue-884-electrolyte-integrated-conducti…
brosaplanella e615e4a
#884 update CHANGELOG
brosaplanella 08d191c
#884 add docs
brosaplanella 6a89b7d
#884 removed arrhenius term
brosaplanella 3f04c15
#884 included docstring reference
brosaplanella 86051b9
#884 removed redundant right boundary integrals
brosaplanella a019e6b
#884 added SPMe tests
brosaplanella 8341306
flake8
brosaplanella 4890bab
#884 fixed typo in docs
brosaplanella f35dd26
#884 fix documentation
brosaplanella 30ab27c
#884 added options to set integrated conductivity
brosaplanella 6aa1bb3
#884 #1207 implemented option to choose electrolyte conductivity and …
brosaplanella 0308466
#1207 update CHANGELOG
brosaplanella ddb5ac5
Merge branch 'develop' into issue-884-electrolyte-integrated-conducti…
brosaplanella 006dc25
#884 set SPMe surface form to NotImplemented for the moment
brosaplanella 480765f
#884 update CHANGELOG
brosaplanella 9818f21
flake8
brosaplanella 3afea4e
#884 removed SPMe from test_compare_outputs for surface form
brosaplanella 8672eff
Merge branch 'develop' into issue-884-electrolyte-integrated-conducti…
brosaplanella e286ce0
Merge branch 'develop' into issue-884-electrolyte-integrated-conducti…
brosaplanella c301814
#884 fix typo CITATIONS.txt
brosaplanella f67357b
#884 add test citation Brosa Planella 2020
brosaplanella 5d4bd51
#884 update citation TSPMe
brosaplanella 49fa413
Merge branch 'develop' into issue-884-electrolyte-integrated-conducti…
brosaplanella 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
5 changes: 5 additions & 0 deletions
5
docs/source/models/submodels/electrolyte_conductivity/integrated_conductivity.rst
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 |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Integrated Model | ||
================ | ||
|
||
.. autoclass:: pybamm.electrolyte_conductivity.Integrated | ||
:members: |
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
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 |
---|---|---|
@@ -1,6 +1,3 @@ | ||
from pybamm import exp, constants | ||
|
||
|
||
def electrolyte_diffusivity_Nyman2008(c_e, T): | ||
""" | ||
Diffusivity of LiPF6 in EC:EMC (3:7) as a function of ion concentration. The data | ||
|
@@ -24,7 +21,7 @@ def electrolyte_diffusivity_Nyman2008(c_e, T): | |
""" | ||
|
||
D_c_e = 8.794e-11 * (c_e / 1000) ** 2 - 3.972e-10 * (c_e / 1000) + 4.862e-10 | ||
E_D_e = 37040 | ||
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. as above |
||
arrhenius = exp(E_D_e / constants.R * (1 / 298.15 - 1 / T)) | ||
|
||
return D_c_e * arrhenius | ||
# Nyman et al. (2008) does not provide temperature dependence | ||
|
||
return D_c_e |
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
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
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
173 changes: 173 additions & 0 deletions
173
pybamm/models/submodels/electrolyte_conductivity/integrated_conductivity.py
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 |
---|---|---|
@@ -0,0 +1,173 @@ | ||
# | ||
# Composite electrolyte potential employing integrated Stefan-Maxwell | ||
# | ||
import pybamm | ||
from .base_electrolyte_conductivity import BaseElectrolyteConductivity | ||
|
||
|
||
class Integrated(BaseElectrolyteConductivity): | ||
""" | ||
Integrated model for conservation of charge in the electrolyte derived from | ||
integrating the Stefan-Maxwell constitutive equations, from [1]_. | ||
|
||
Parameters | ||
---------- | ||
param : parameter class | ||
The parameters to use for this submodel | ||
domain : str, optional | ||
The domain in which the model holds | ||
reactions : dict, optional | ||
Dictionary of reaction terms | ||
|
||
References | ||
---------- | ||
.. [1] F. Brosa Planella, M. Sheikh, and W. D. Widanage, “Systematic derivation and | ||
validation of reduced thermal-electrochemical models for lithium-ion | ||
batteries using asymptotic methods.” arXiv preprint, 2020. | ||
|
||
**Extends:** :class:`pybamm.electrolyte_conductivity.BaseElectrolyteConductivity` | ||
|
||
""" | ||
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. add reference to your paper in the docstring |
||
|
||
def __init__(self, param, domain=None): | ||
pybamm.citations.register("brosaplanella2020TSPMe") | ||
super().__init__(param, domain) | ||
|
||
def _higher_order_macinnes_function(self, x): | ||
return pybamm.log(x) | ||
|
||
def get_coupled_variables(self, variables): | ||
c_e_av = variables["X-averaged electrolyte concentration"] | ||
|
||
i_boundary_cc_0 = variables["Leading-order current collector current density"] | ||
c_e_n = variables["Negative electrolyte concentration"] | ||
c_e_s = variables["Separator electrolyte concentration"] | ||
c_e_p = variables["Positive electrolyte concentration"] | ||
c_e_n0 = pybamm.boundary_value(c_e_n, "left") | ||
|
||
delta_phi_n_av = variables[ | ||
"X-averaged negative electrode surface potential difference" | ||
] | ||
phi_s_n_av = variables["X-averaged negative electrode potential"] | ||
|
||
tor_n = variables["Negative electrolyte tortuosity"] | ||
tor_s = variables["Separator tortuosity"] | ||
tor_p = variables["Positive electrolyte tortuosity"] | ||
|
||
T_av = variables["X-averaged cell temperature"] | ||
T_av_n = pybamm.PrimaryBroadcast(T_av, "negative electrode") | ||
T_av_s = pybamm.PrimaryBroadcast(T_av, "separator") | ||
T_av_p = pybamm.PrimaryBroadcast(T_av, "positive electrode") | ||
|
||
param = self.param | ||
l_n = param.l_n | ||
l_p = param.l_p | ||
x_n = pybamm.standard_spatial_vars.x_n | ||
x_s = pybamm.standard_spatial_vars.x_s | ||
x_p = pybamm.standard_spatial_vars.x_p | ||
x_n_edge = pybamm.standard_spatial_vars.x_n_edge | ||
x_p_edge = pybamm.standard_spatial_vars.x_p_edge | ||
|
||
chi_av = param.chi(c_e_av) | ||
chi_av_n = pybamm.PrimaryBroadcast(chi_av, "negative electrode") | ||
chi_av_s = pybamm.PrimaryBroadcast(chi_av, "separator") | ||
chi_av_p = pybamm.PrimaryBroadcast(chi_av, "positive electrode") | ||
|
||
# electrolyte current | ||
i_e_n = i_boundary_cc_0 * x_n / l_n | ||
i_e_s = pybamm.PrimaryBroadcast(i_boundary_cc_0, "separator") | ||
i_e_p = i_boundary_cc_0 * (1 - x_p) / l_p | ||
i_e = pybamm.Concatenation(i_e_n, i_e_s, i_e_p) | ||
|
||
i_e_n_edge = i_boundary_cc_0 * x_n_edge / l_n | ||
i_e_s_edge = pybamm.PrimaryBroadcastToEdges(i_boundary_cc_0, "separator") | ||
i_e_p_edge = i_boundary_cc_0 * (1 - x_p_edge) / l_p | ||
|
||
# electrolyte potential | ||
indef_integral_n = ( | ||
pybamm.IndefiniteIntegral( | ||
i_e_n_edge / (param.kappa_e(c_e_n, T_av_n) * tor_n), x_n | ||
) | ||
* param.C_e | ||
/ param.gamma_e | ||
) | ||
indef_integral_s = ( | ||
pybamm.IndefiniteIntegral( | ||
i_e_s_edge / (param.kappa_e(c_e_s, T_av_s) * tor_s), x_s | ||
) | ||
* param.C_e | ||
/ param.gamma_e | ||
) | ||
indef_integral_p = ( | ||
pybamm.IndefiniteIntegral( | ||
i_e_p_edge / (param.kappa_e(c_e_p, T_av_p) * tor_p), x_p | ||
) | ||
* param.C_e | ||
/ param.gamma_e | ||
) | ||
|
||
integral_n = indef_integral_n | ||
integral_s = indef_integral_s + pybamm.boundary_value(integral_n, "right") | ||
integral_p = indef_integral_p + pybamm.boundary_value(integral_s, "right") | ||
|
||
phi_e_const = ( | ||
-delta_phi_n_av | ||
+ phi_s_n_av | ||
- ( | ||
chi_av | ||
* (1 + param.Theta * T_av) | ||
* pybamm.x_average(self._higher_order_macinnes_function(c_e_n / c_e_n0)) | ||
) | ||
+ pybamm.x_average(integral_n) | ||
) | ||
|
||
phi_e_n = ( | ||
phi_e_const | ||
+ ( | ||
chi_av_n | ||
* (1 + param.Theta * T_av_n) | ||
* self._higher_order_macinnes_function(c_e_n / c_e_n0) | ||
) | ||
- integral_n | ||
) | ||
|
||
phi_e_s = ( | ||
phi_e_const | ||
+ ( | ||
chi_av_s | ||
* (1 + param.Theta * T_av_s) | ||
* self._higher_order_macinnes_function(c_e_s / c_e_n0) | ||
) | ||
- integral_s | ||
) | ||
|
||
phi_e_p = ( | ||
phi_e_const | ||
+ ( | ||
chi_av_p | ||
* (1 + param.Theta * T_av_p) | ||
* self._higher_order_macinnes_function(c_e_p / c_e_n0) | ||
) | ||
- integral_p | ||
) | ||
|
||
# concentration overpotential | ||
eta_c_av = ( | ||
chi_av | ||
* (1 + param.Theta * T_av) | ||
* ( | ||
pybamm.x_average(self._higher_order_macinnes_function(c_e_p / c_e_av)) | ||
- pybamm.x_average(self._higher_order_macinnes_function(c_e_n / c_e_av)) | ||
) | ||
) | ||
|
||
# average electrolyte ohmic losses | ||
delta_phi_e_av = -(pybamm.x_average(integral_p) - pybamm.x_average(integral_n)) | ||
|
||
variables.update( | ||
self._get_standard_potential_variables(phi_e_n, phi_e_s, phi_e_p) | ||
) | ||
variables.update(self._get_standard_current_variables(i_e)) | ||
variables.update(self._get_split_overpotential(eta_c_av, delta_phi_e_av)) | ||
|
||
return variables |
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.
was this a mistake in the original implementation?
you could argue we should just not have the arrhenius term in this case
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.
Not sure if a mistake, or we decided to keep the Arrhenius term from the Marquis2019 set (originally it all was in
parameters.csv
. However, if now it is specified as a function I think it would be good to stick to what the paper provides, and it this case, Nyman et al. 2008, does not provide temperature dependence so I removed it.If that makes sense, I will remove the whole Arrhenius term so it is clearer.
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.
yeah, that makes sense, just remove the arrhenius term and put in a comment