forked from pybamm-team/PyBaMM
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Surface temperature model (pybamm-team#4203)
* add surface temperature equal to ambient temperature * pybamm-team#4022 surface model works * update temperature comparison script * pybamm-team#4022 update tests and example, rename parameters * fix plot_thermal_components * fix unit tests * pybamm-team#4022 fix lead acid thermal tests * pybamm-team#4022 fix example * coverage * fix test * style * Moving missed files * Rob's suggestion --------- Co-authored-by: Eric G. Kratz <kratman@users.noreply.github.com> Co-authored-by: kratman <kratmandu@gmail.com>
- Loading branch information
1 parent
3586377
commit ac6c450
Showing
19 changed files
with
253 additions
and
50 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# | ||
# Compare lithium-ion battery models | ||
# | ||
import pybamm | ||
|
||
pybamm.set_logging_level("INFO") | ||
|
||
# load models | ||
models = [ | ||
pybamm.lithium_ion.SPMe( | ||
{"thermal": "lumped", "surface temperature": "ambient"}, | ||
name="ambient surface temperature", | ||
), | ||
pybamm.lithium_ion.SPMe( | ||
{"thermal": "lumped", "surface temperature": "lumped"}, | ||
name="lumped surface temperature", | ||
), | ||
] | ||
|
||
experiment = pybamm.Experiment( | ||
[ | ||
"Discharge at 1C until 2.5V", | ||
"Rest for 1 hour", | ||
] | ||
) | ||
|
||
parameter_values = pybamm.ParameterValues("Chen2020") | ||
parameter_values.update( | ||
{ | ||
"Casing heat capacity [J.K-1]": 30, | ||
"Environment thermal resistance [K.W-1]": 10, | ||
}, | ||
check_already_exists=False, | ||
) | ||
|
||
# create and run simulations | ||
sols = [] | ||
for model in models: | ||
model.variables["Bulk temperature [°C]"] = ( | ||
model.variables["Volume-averaged cell temperature [K]"] - 273.15 | ||
) | ||
model.variables["Surface temperature [°C]"] = ( | ||
model.variables["Surface temperature [K]"] - 273.15 | ||
) | ||
sim = pybamm.Simulation( | ||
model, parameter_values=parameter_values, experiment=experiment | ||
) | ||
sol = sim.solve([0, 3600]) | ||
sols.append(sol) | ||
|
||
# plot | ||
pybamm.dynamic_plot( | ||
sols, | ||
[ | ||
"Voltage [V]", | ||
"Bulk temperature [°C]", | ||
"Surface temperature [°C]", | ||
"Surface total cooling [W]", | ||
"Environment total cooling [W]", | ||
], | ||
) |
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
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
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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from .ambient import Ambient | ||
from .lumped import Lumped |
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,33 @@ | ||
# | ||
# Class for ambient surface temperature submodel | ||
import pybamm | ||
|
||
|
||
class Ambient(pybamm.BaseSubModel): | ||
""" | ||
Class for setting surface temperature equal to ambient temperature. | ||
Parameters | ||
---------- | ||
param : parameter class | ||
The parameters to use for this submodel | ||
options : dict, optional | ||
A dictionary of options to be passed to the model. | ||
""" | ||
|
||
def __init__(self, param, options=None): | ||
super().__init__(param, options=options) | ||
|
||
def get_coupled_variables(self, variables): | ||
T_amb = variables["Ambient temperature [K]"] | ||
T_amb_av = variables["Volume-averaged ambient temperature [K]"] | ||
|
||
variables.update( | ||
{ | ||
"Surface temperature [K]": T_amb, | ||
"Volume-averaged surface temperature [K]": T_amb_av, | ||
"Environment total cooling [W]": pybamm.Scalar(0), | ||
} | ||
) | ||
return variables |
Oops, something went wrong.