-
-
Notifications
You must be signed in to change notification settings - Fork 534
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
Add new electrolyte functions from Landesfeind 2019 #860
Merged
valentinsulzer
merged 4 commits into
develop
from
issue-859-landesfeind-electrolyte-functions
Mar 10, 2020
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
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
31 changes: 31 additions & 0 deletions
31
...electrolytes/lipf6_Landesfeind2019/electrolyte_conductivity_Landesfeind2019_EC_DMC_1_1.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,31 @@ | ||
import electrolyte_conductivity_Landesfeind2019_base as base | ||
import numpy as np | ||
|
||
|
||
def electrolyte_conductivity_Landesfeind2019_EC_DMC_1_1(c_e, T, T_inf, E_k_e, R_g): | ||
""" | ||
Conductivity of LiPF6 in EC:DMC (1:1) as a function of ion concentration and | ||
Temperature. The data comes from [1]. | ||
References | ||
---------- | ||
.. [1] Landesfeind, J. and Gasteiger, H.A., 2019. Temperature and Concentration | ||
Dependence of the Ionic Transport Properties of Lithium-Ion Battery Electrolytes. | ||
Journal of The Electrochemical Society, 166(14), pp.A3079-A3097. | ||
---------- | ||
c_e: :class: `numpy.Array` | ||
Dimensional electrolyte concentration | ||
T: :class: `numpy.Array` | ||
Dimensional temperature | ||
Returns | ||
------- | ||
:`numpy.Array` | ||
Electrolyte diffusivity | ||
""" | ||
coeffs = np.array([7.98e-1, | ||
2.28e2, | ||
-1.22, | ||
5.09e-1, | ||
-4e-3, | ||
3.79e-3]) | ||
|
||
return base.electrolyte_conductivity_Landesfeind2019_base(c_e, T, coeffs) |
30 changes: 30 additions & 0 deletions
30
...electrolytes/lipf6_Landesfeind2019/electrolyte_conductivity_Landesfeind2019_EC_EMC_3_7.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,30 @@ | ||
import electrolyte_conductivity_Landesfeind2019_base as base | ||
import numpy as np | ||
|
||
|
||
def electrolyte_conductivity_Landesfeind2019_EC_EMC_3_7(c_e, T, T_inf, E_k_e, R_g): | ||
""" | ||
Conductivity of LiPF6 in EC:EMC (3:7) as a function of ion concentration and | ||
Temperature. The data comes from [1]. | ||
References | ||
---------- | ||
.. [1] Landesfeind, J. and Gasteiger, H.A., 2019. Temperature and Concentration | ||
Dependence of the Ionic Transport Properties of Lithium-Ion Battery Electrolytes. | ||
Journal of The Electrochemical Society, 166(14), pp.A3079-A3097. | ||
---------- | ||
c_e: :class: `numpy.Array` | ||
Dimensional electrolyte concentration | ||
T: :class: `numpy.Array` | ||
Dimensional temperature | ||
Returns | ||
------- | ||
:`numpy.Array` | ||
Electrolyte diffusivity | ||
""" | ||
coeffs = np.array([5.21e-1, | ||
2.28e2, | ||
-1.06, | ||
3.53e-1, | ||
-3.59e-3, | ||
1.48e-3]) | ||
return base.electrolyte_conductivity_Landesfeind2019_base(c_e, T, coeffs) |
30 changes: 30 additions & 0 deletions
30
...ectrolytes/lipf6_Landesfeind2019/electrolyte_conductivity_Landesfeind2019_EMC_FEC_19_1.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,30 @@ | ||
import electrolyte_conductivity_Landesfeind2019_base as base | ||
import numpy as np | ||
|
||
|
||
def electrolyte_conductivity_Landesfeind2019_EMC_FEC_19_1(c_e, T, T_inf, E_k_e, R_g): | ||
""" | ||
Conductivity of LiPF6 in EMC:FEC (19:1) as a function of ion concentration and | ||
Temperature. The data comes from [1]. | ||
References | ||
---------- | ||
.. [1] Landesfeind, J. and Gasteiger, H.A., 2019. Temperature and Concentration | ||
Dependence of the Ionic Transport Properties of Lithium-Ion Battery Electrolytes. | ||
Journal of The Electrochemical Society, 166(14), pp.A3079-A3097. | ||
---------- | ||
c_e: :class: `numpy.Array` | ||
Dimensional electrolyte concentration | ||
T: :class: `numpy.Array` | ||
Dimensional temperature | ||
Returns | ||
------- | ||
:`numpy.Array` | ||
Electrolyte diffusivity | ||
""" | ||
coeffs = np.array([2.51e-2, | ||
1.75e2, | ||
1.23, | ||
2.05e-1, | ||
-8.81e-2, | ||
2.83e-3]) | ||
return base.electrolyte_conductivity_Landesfeind2019_base(c_e, T, coeffs) |
32 changes: 32 additions & 0 deletions
32
...m-ion/electrolytes/lipf6_Landesfeind2019/electrolyte_conductivity_Landesfeind2019_base.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,32 @@ | ||
from pybamm import exp, sqrt | ||
|
||
|
||
def electrolyte_conductivity_Landesfeind2019_base(c_e, T, coeffs): | ||
""" | ||
Conductivity of LiPF6 in solvent_X as a function of ion concentration and | ||
Temperature. The data comes from [1]. | ||
References | ||
---------- | ||
.. [1] Landesfeind, J. and Gasteiger, H.A., 2019. Temperature and Concentration | ||
Dependence of the Ionic Transport Properties of Lithium-Ion Battery Electrolytes. | ||
Journal of The Electrochemical Society, 166(14), pp.A3079-A3097. | ||
---------- | ||
c_e: :class: `numpy.Array` | ||
Dimensional electrolyte concentration | ||
T: :class: `numpy.Array` | ||
Dimensional temperature | ||
coeffs: :class: `numpy.Array` | ||
Fitting parameter coefficients | ||
Returns | ||
------- | ||
:`numpy.Array` | ||
Electrolyte diffusivity | ||
""" | ||
c = c_e / 1000 # mol.m-3 -> mol.l | ||
p1, p2, p3, p4, p5, p6 = coeffs | ||
A = p1 * (1 + (T - p2)) | ||
B = (1 + p3 * sqrt(c) + p4 * (1 + p5 * exp(1000 / T)) * c) | ||
C = 1 + c**4 * (p6 * exp(1000 / T)) | ||
sigma_e = A * c * B / C # mS.cm-1 | ||
|
||
return sigma_e / 10 |
29 changes: 29 additions & 0 deletions
29
.../electrolytes/lipf6_Landesfeind2019/electrolyte_diffusivity_Landesfeind2019_EC_DMC_1_1.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,29 @@ | ||
import electrolyte_diffusivity_Landesfeind2019_base as base | ||
import numpy as np | ||
|
||
|
||
def electrolyte_diffusivity_Landesfeind2019_EC_DMC_1_1(c_e, T, T_inf, E_k_e, R_g): | ||
""" | ||
Diffusivity of LiPF6 in EC:DMC (1:1) as a function of ion concentration and | ||
Temperature. The data comes from [1]. | ||
References | ||
---------- | ||
.. [1] Landesfeind, J. and Gasteiger, H.A., 2019. Temperature and Concentration | ||
Dependence of the Ionic Transport Properties of Lithium-Ion Battery Electrolytes. | ||
Journal of The Electrochemical Society, 166(14), pp.A3079-A3097. | ||
---------- | ||
c_e: :class: `numpy.Array` | ||
Dimensional electrolyte concentration | ||
T: :class: `numpy.Array` | ||
Dimensional temperature | ||
Returns | ||
------- | ||
:`numpy.Array` | ||
Electrolyte diffusivity | ||
""" | ||
coeffs = np.array([1.47e3, | ||
1.33, | ||
-1.69e3, | ||
-5.63e2]) | ||
|
||
return base.electrolyte_diffusivity_Landesfeind2019_base(c_e, T, coeffs) |
28 changes: 28 additions & 0 deletions
28
.../electrolytes/lipf6_Landesfeind2019/electrolyte_diffusivity_Landesfeind2019_EC_EMC_3_7.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,28 @@ | ||
import electrolyte_diffusivity_Landesfeind2019_base as base | ||
import numpy as np | ||
|
||
|
||
def electrolyte_diffusivity_Landesfeind2019_EC_EMC_3_7(c_e, T, T_inf, E_k_e, R_g): | ||
""" | ||
Diffusivity of LiPF6 in EC:EMC (3:7) as a function of ion concentration and | ||
Temperature. The data comes from [1]. | ||
References | ||
---------- | ||
.. [1] Landesfeind, J. and Gasteiger, H.A., 2019. Temperature and Concentration | ||
Dependence of the Ionic Transport Properties of Lithium-Ion Battery Electrolytes. | ||
Journal of The Electrochemical Society, 166(14), pp.A3079-A3097. | ||
---------- | ||
c_e: :class: `numpy.Array` | ||
Dimensional electrolyte concentration | ||
T: :class: `numpy.Array` | ||
Dimensional temperature | ||
Returns | ||
------- | ||
:`numpy.Array` | ||
Electrolyte diffusivity | ||
""" | ||
coeffs = np.array([1.01e3, | ||
1.01, | ||
-1.56e3, | ||
-4.87e2]) | ||
return base.electrolyte_diffusivity_Landesfeind2019_base(c_e, T, coeffs) |
28 changes: 28 additions & 0 deletions
28
...lectrolytes/lipf6_Landesfeind2019/electrolyte_diffusivity_Landesfeind2019_EMC_FEC_19_1.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,28 @@ | ||
import electrolyte_diffusivity_Landesfeind2019_base as base | ||
import numpy as np | ||
|
||
|
||
def electrolyte_diffusivity_Landesfeind2019_EMC_FEC_19_1(c_e, T, T_inf, E_k_e, R_g): | ||
""" | ||
Diffusivity of LiPF6 in EMC:FEC (19:1) as a function of ion concentration and | ||
Temperature. The data comes from [1]. | ||
References | ||
---------- | ||
.. [1] Landesfeind, J. and Gasteiger, H.A., 2019. Temperature and Concentration | ||
Dependence of the Ionic Transport Properties of Lithium-Ion Battery Electrolytes. | ||
Journal of The Electrochemical Society, 166(14), pp.A3079-A3097. | ||
---------- | ||
c_e: :class: `numpy.Array` | ||
Dimensional electrolyte concentration | ||
T: :class: `numpy.Array` | ||
Dimensional temperature | ||
Returns | ||
------- | ||
:`numpy.Array` | ||
Electrolyte diffusivity | ||
""" | ||
coeffs = np.array([5.86e2, | ||
1.33, | ||
-1.38e3, | ||
-5.82e2]) | ||
return base.electrolyte_diffusivity_Landesfeind2019_base(c_e, T, coeffs) |
32 changes: 32 additions & 0 deletions
32
...um-ion/electrolytes/lipf6_Landesfeind2019/electrolyte_diffusivity_Landesfeind2019_base.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,32 @@ | ||
from pybamm import exp | ||
|
||
|
||
def electrolyte_diffusivity_Landesfeind2019_base(c_e, T, coeffs): | ||
""" | ||
Conductivity of LiPF6 in solvent_X as a function of ion concentration and | ||
Temperature. The data comes from [1]. | ||
References | ||
---------- | ||
.. [1] Landesfeind, J. and Gasteiger, H.A., 2019. Temperature and Concentration | ||
Dependence of the Ionic Transport Properties of Lithium-Ion Battery Electrolytes. | ||
Journal of The Electrochemical Society, 166(14), pp.A3079-A3097. | ||
---------- | ||
c_e: :class: `numpy.Array` | ||
Dimensional electrolyte concentration | ||
T: :class: `numpy.Array` | ||
Dimensional temperature | ||
coeffs: :class: `numpy.Array` | ||
Fitting parameter coefficients | ||
Returns | ||
------- | ||
:`numpy.Array` | ||
Electrolyte diffusivity | ||
""" | ||
c = c_e / 1000 # mol.m-3 -> mol.l | ||
p1, p2, p3, p4 = coeffs | ||
A = p1 * exp(p2 * c) | ||
B = exp(p3 / T) | ||
C = exp(p4 * c / T) | ||
D_e = A * B * C * 1e-10 # m2/s | ||
|
||
return D_e |
70 changes: 70 additions & 0 deletions
70
tests/unit/test_parameters/test_parameter_sets/test_Landesfeind2020.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,70 @@ | ||
# | ||
# Tests for LG M50 parameter set loads | ||
# | ||
import pybamm | ||
import unittest | ||
import os | ||
import numpy as np | ||
|
||
|
||
class TestLandesfeind(unittest.TestCase): | ||
|
||
def test_electrolyte_conductivity(self): | ||
root = pybamm.root_dir() | ||
p = "pybamm/input/parameters/lithium-ion/electrolytes/lipf6_Landesfeind2019" | ||
k_path = os.path.join(root, p) | ||
files = [f for f in os.listdir(k_path) if '.py' in f | ||
and '_base' not in f | ||
and 'conductivity' in f] | ||
funcs = [pybamm.load_function(os.path.join(k_path, f)) for f in files] | ||
T_ref = 298.15 | ||
T = T_ref + 30.0 | ||
c = 1000.0 | ||
k = [np.around(f(c, T, np.nan, np.nan, np.nan).value, 6) for f in funcs] | ||
self.assertEqual(k, [1.839786, 1.361015, 0.750259]) | ||
T += 20 | ||
k = [np.around(f(c, T, np.nan, np.nan, np.nan).value, 6) for f in funcs] | ||
self.assertEqual(k, [2.292425, 1.664438, 0.880755]) | ||
|
||
chemistry = pybamm.parameter_sets.Chen2020 | ||
param = pybamm.ParameterValues(chemistry=chemistry) | ||
param['Electrolyte conductivity [S.m-1]'] = funcs[0] | ||
model = pybamm.lithium_ion.SPM() | ||
sim = pybamm.Simulation(model, parameter_values=param) | ||
sim.set_parameters() | ||
sim.build() | ||
|
||
def test_electrolyte_diffusivity(self): | ||
root = pybamm.root_dir() | ||
p = "pybamm/input/parameters/lithium-ion/electrolytes/lipf6_Landesfeind2019" | ||
d_path = os.path.join(root, p) | ||
files = [f for f in os.listdir(d_path) if '.py' in f | ||
and '_base' not in f | ||
and 'diffusivity' in f] | ||
funcs = [pybamm.load_function(os.path.join(d_path, f)) for f in files] | ||
T_ref = 298.15 | ||
T = T_ref + 30.0 | ||
c = 1000.0 | ||
D = [np.around(f(c, T, np.nan, np.nan, np.nan).value, 16) for f in funcs] | ||
self.assertEqual(D, [5.796505e-10, 5.417881e-10, 5.608856e-10]) | ||
T += 20 | ||
D = [np.around(f(c, T, np.nan, np.nan, np.nan).value, 16) for f in funcs] | ||
self.assertEqual(D, [8.5992e-10, 7.752815e-10, 7.907549e-10]) | ||
|
||
chemistry = pybamm.parameter_sets.Chen2020 | ||
param = pybamm.ParameterValues(chemistry=chemistry) | ||
param['Electrolyte diffusivity [m2.s-1]'] = funcs[0] | ||
model = pybamm.lithium_ion.SPM() | ||
sim = pybamm.Simulation(model, parameter_values=param) | ||
sim.set_parameters() | ||
sim.build() | ||
|
||
|
||
if __name__ == "__main__": | ||
print("Add -v for more debug output") | ||
import sys | ||
|
||
if "-v" in sys.argv: | ||
debug = True | ||
pybamm.settings.debug_mode = True | ||
unittest.main() |
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.
should we get rid of T_inf, E_k_E and R_g as inputs to these functions in general? When they are needed, they can easily be called from within the function as
pybamm.standard_parameters_lithium_ion.T_inf
, etcThere 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.
For R_g I would say yes. For T_inf could there be a situation where the reference temperature for different functions is different? We could also use **kwargs potentially although I don't know if that would work with the expression tree. But yeah if you see fewer problems I'm happy to make the changes
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.
I think we should definitely be open to the idea of different functional dependencies of these things, so being less prescriptive in terms of inputs is probably good
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.
if it's specific to a function then maybe it should be hard-coded into the function itself (same with E_k_e)
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 maybe you are right, If there were a specific reference temperature it would probably be hardcoded into the function if there were other parameters dependent on that.