1
- #
2
- # Class for leading-order electrolyte diffusion employing stefan-maxwell
3
- #
4
1
import pybamm
5
- from typing import Dict , Optional , Any , TYPE_CHECKING
6
-
7
- if TYPE_CHECKING :
8
- from pybamm import ParameterValues
2
+ from typing import Optional , Any , TYPE_CHECKING
9
3
10
4
from .base_electrolyte_diffusion import BaseElectrolyteDiffusion
11
5
6
+ if TYPE_CHECKING :
7
+ from pybamm import ParameterValues , Symbol
8
+
12
9
13
10
class ConstantConcentration (BaseElectrolyteDiffusion ):
14
11
"""Class for constant concentration of electrolyte
@@ -21,19 +18,17 @@ class ConstantConcentration(BaseElectrolyteDiffusion):
21
18
A dictionary of options to be passed to the model.
22
19
"""
23
20
24
- def __init__ (
25
- self , param : "ParameterValues" , options : Optional [Dict [str , Any ]] = None
26
- ) -> None :
21
+ def __init__ (self , param : "ParameterValues" , options : Optional [dict [str , Any ]] = None ) -> None :
27
22
super ().__init__ (param , options )
28
23
29
- def get_fundamental_variables (self ) -> Dict [str , pybamm .Symbol ]:
24
+ def get_fundamental_variables (self ) -> dict [str , pybamm .Symbol ]:
30
25
c_e_init : float = self .param .c_e_init
31
- eps_c_e_dict : Dict [str , pybamm .Symbol ] = {
26
+ eps_c_e_dict : dict [str , pybamm .Symbol ] = {
32
27
domain : self .param .domain_params [domain .split ()[0 ]].epsilon_init * c_e_init
33
28
for domain in self .options .whole_cell_domains
34
29
}
35
- variables : Dict [str , pybamm .Symbol ] = (
36
- self . _get_standard_porosity_times_concentration_variables ( eps_c_e_dict )
30
+ variables : dict [str , pybamm .Symbol ] = self . _get_standard_porosity_times_concentration_variables (
31
+ eps_c_e_dict
37
32
)
38
33
N_e : pybamm .Symbol = pybamm .FullBroadcastToEdges (
39
34
0 ,
@@ -45,16 +40,12 @@ def get_fundamental_variables(self) -> Dict[str, pybamm.Symbol]:
45
40
46
41
return variables
47
42
48
- def get_coupled_variables (
49
- self , variables : Dict [str , pybamm .Symbol ]
50
- ) -> Dict [str , pybamm .Symbol ]:
51
- c_e_dict : Dict [str , pybamm .Symbol ] = {}
43
+ def get_coupled_variables (self , variables : dict [str , pybamm .Symbol ]) -> dict [str , pybamm .Symbol ]:
44
+ c_e_dict : dict [str , pybamm .Symbol ] = {}
52
45
for domain in self .options .whole_cell_domains :
53
46
Domain = domain .capitalize ()
54
47
eps_k : pybamm .Symbol = variables [f"{ Domain } porosity" ]
55
- eps_c_e_k : pybamm .Symbol = variables [
56
- f"{ Domain } porosity times concentration [mol.m-3]"
57
- ]
48
+ eps_c_e_k : pybamm .Symbol = variables [f"{ Domain } porosity times concentration [mol.m-3]" ]
58
49
c_e_k : pybamm .Symbol = eps_c_e_k / eps_k
59
50
c_e_dict [domain ] = c_e_k
60
51
@@ -70,7 +61,7 @@ def get_coupled_variables(
70
61
71
62
return variables
72
63
73
- def set_boundary_conditions (self , variables : Dict [str , pybamm .Symbol ]) -> None :
64
+ def set_boundary_conditions (self , variables : dict [str , pybamm .Symbol ]) -> None :
74
65
"""
75
66
We provide boundary conditions even though the concentration is constant
76
67
so that the gradient of the concentration has the correct shape after
@@ -86,6 +77,6 @@ def set_boundary_conditions(self, variables: Dict[str, pybamm.Symbol]) -> None:
86
77
}
87
78
}
88
79
89
- def add_events_from (self , variables : Dict [str , pybamm .Symbol ]) -> None :
80
+ def add_events_from (self , variables : dict [str , pybamm .Symbol ]) -> None :
90
81
# No event since the concentration is constant
91
- pass
82
+ pass
0 commit comments