Skip to content
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

Checking to see what I changed since then #1

Open
wants to merge 44 commits into
base: test_revert_changes
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
6905cea
helper functions for running simulations automatically
mleot Mar 14, 2024
fdd9efa
updating variables
mleot Mar 14, 2024
2729776
plotting updates
mleot Mar 14, 2024
4acc695
update variables
mleot Mar 17, 2024
6f78e93
optimize for multiprocessing
mleot Mar 17, 2024
5883160
remove print lines
mleot Mar 17, 2024
787e045
update running functions
mleot Mar 17, 2024
8202cbc
update for new features
mleot Mar 19, 2024
af81cad
more features
mleot Mar 19, 2024
84ae6b5
change animation variables
mleot Mar 19, 2024
eb57066
tesla tabs
mleot Mar 19, 2024
ab46fed
image prep notebook
mleot Mar 19, 2024
d6979ae
temp copy of docs
mleot Mar 19, 2024
eb57f64
temporary notebook
mleot Mar 19, 2024
b319b76
feature dev
mleot Mar 19, 2024
d639e43
Merge branch 'TLeo_update-pinned_dev' of https://github.com/mleot/pyb…
mleot Mar 19, 2024
825380b
clean up and add tabs
mleot Mar 19, 2024
6719d15
update experiment
mleot Mar 19, 2024
d3d5f77
function updates
mleot Mar 20, 2024
4801ba4
more variables
mleot Mar 20, 2024
e316132
fix variables
mleot Mar 20, 2024
df78849
fix rate of discharge
mleot Mar 20, 2024
cc38436
Merge branch 'TLeo_update-pinned_dev' of https://github.com/mleot/pyb…
mleot Mar 20, 2024
aba66a1
update runfuns
mleot Mar 21, 2024
4435629
add reversibility
mleot Mar 22, 2024
96b37a3
Progress toward heating bug fix
mleot Mar 25, 2024
36c99c8
remove print statements
mleot Mar 25, 2024
99604f4
confidence in results regained
mleot Mar 26, 2024
d0a9104
Merge branch 'TLeo_update-pinned_dev' of https://github.com/mleot/pyb…
mleot Mar 26, 2024
8077398
temporary update funcs
mleot Apr 4, 2024
3f44e78
apply bug fixes for running & debug statements
mleot Apr 4, 2024
e9c3c7d
updating variables, and plotting methods
mleot Apr 4, 2024
fe9edc9
add 18650 support
mleot Apr 4, 2024
27ff07f
update gitignore
mleot Apr 4, 2024
3974872
fixes
mleot Apr 8, 2024
1f573b4
figure creation
mleot Apr 8, 2024
df626b7
Merge branch 'TLeo_update-pinned_dev' of https://github.com/mleot/pyb…
mleot Apr 8, 2024
b8b43df
loosen requirements
mleot Apr 22, 2024
6d0b281
loosen req again
mleot Apr 22, 2024
a2dc4bb
loosen pybamm req
mleot Apr 22, 2024
f848cdb
updated pybamm
mleot Sep 14, 2024
d910ceb
make pyproject.toml file
mleot Sep 14, 2024
c44046d
try fix errors
mleot Sep 16, 2024
70e2136
fix for local install
mleot Sep 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ build/
dist/
.virtual_documents/
**.gif
.lh/.lhignore
1,145 changes: 1,145 additions & 0 deletions docs/examples/02 Network from an image copy.ipynb

Large diffs are not rendered by default.

800 changes: 800 additions & 0 deletions docs/examples/03 Running a simulation bug.ipynb

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/examples/03 Running a simulation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.0"
"version": "3.10.13"
}
},
"nbformat": 4,
Expand Down
299 changes: 251 additions & 48 deletions docs/examples/03.1 Running a simulation mass loading.ipynb

Large diffs are not rendered by default.

233 changes: 233 additions & 0 deletions docs/examples/prepare_images.ipynb

Large diffs are not rendered by default.

143 changes: 0 additions & 143 deletions ecm/autofit_jellyroll.py

This file was deleted.

38 changes: 38 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
[build-system]
requires = ["setuptools>=45", "setuptools_scm[toml]>=6.2"]
build-backend = "setuptools.build_meta"

[project]
name = "ecm"
description = "Equivalent Circuit Model for battery modelling using PyBaMM"
version = "0.0.3"
authors = [
{name = "Tom Tranter", email = "[email protected]"},
]
classifiers = [
"Development Status :: 3 - Alpha",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python",
"Topic :: Scientific/Engineering",
"Topic :: Scientific/Engineering :: Physics",
]
dependencies = [
"numba",
"liionpack",
"pybamm",
"openpnm==2.8.2",
"ffmpeg-python",
"ipywidgets"
]

[project.urls]
Documentation = "https://ecm.readthedocs.io/en/latest/"
Source = "https://github.com/TomTranter/pybamm_pnm"
Tracker = "https://github.com/TomTranter/pybamm_pnm/issues"

#[tool.setuptools_scm]
#write_to = "ecm/_version.py"

[tool.setuptools.packages.find]
where = ["src"]
include = ["ecm", "ecm.*"]
4 changes: 2 additions & 2 deletions setup.py → setup_old.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
packages=["ecm"],
install_requires=[
"numba",
"liionpack==0.3.8",
"pybamm==23.9",
"liionpack>=0.3.8",
"pybamm>=23.9",
"openpnm==2.8.2",
"ffmpeg-python",
"ipywidgets"
Expand Down
File renamed without changes.
File renamed without changes.
80 changes: 46 additions & 34 deletions ecm/__funcs__.py → src/ecm/__funcs__.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ def adjust_parameters(parameter_values, I_typical):
# "Typical current [A]": I_typical,
"Current function [A]": current_function,
"Electrode height [m]": "[input]",
# "Cell volume [m3]": "[input]",
}
)
parameter_values.update({"Current": "[input]"}, check_already_exists=False)
Expand All @@ -61,6 +62,7 @@ def output_variables():
return [
"Terminal voltage [V]",
"Volume-averaged cell temperature [K]",
"X-averaged cell temperature [K]",
"Current collector current density [A.m-2]",
"X-averaged negative electrode extent of lithiation",
"X-averaged positive electrode extent of lithiation",
Expand All @@ -69,33 +71,27 @@ def output_variables():
"X-averaged battery concentration overpotential [V]",
"X-averaged battery electrolyte ohmic losses [V]",
"X-averaged battery solid phase ohmic losses [V]",
"X-averaged negative particle surface concentration [mol.m-3]",
"X-averaged positive particle surface concentration [mol.m-3]",
"Battery open-circuit voltage [V]",
# 'Ambient temperature [K]',
'Volume-averaged ambient temperature [K]',
# 'Cell temperature [K]',
# 'Negative current collector temperature [K]',
# 'Positive current collector temperature [K]',
'X-averaged cell temperature [K]',
'Volume-averaged cell temperature [K]',
# 'Negative electrode temperature [K]',
'X-averaged negative electrode temperature [K]',
# 'Separator temperature [K]',
'X-averaged separator temperature [K]',
# 'Positive electrode temperature [K]',
'X-averaged positive electrode temperature [K]',
# 'Ambient temperature [C]',
# 'Volume-averaged ambient temperature [C]',
# 'Cell temperature [C]',
# 'Negative current collector temperature [C]',
# 'Positive current collector temperature [C]',
# 'X-averaged cell temperature [C]',
# 'Volume-averaged cell temperature [C]',
# 'Negative electrode temperature [C]',
# 'X-averaged negative electrode temperature [C]',
# 'Separator temperature [C]',
# 'X-averaged separator temperature [C]',
# 'Positive electrode temperature [C]',
# 'X-averaged positive electrode temperature [C]'
"Volume-averaged irreversible electrochemical heating [W.m-3]",
"X-averaged irreversible electrochemical heating [W.m-3]",
"X-averaged reversible heating [W.m-3]",
"X-averaged total heating [W.m-3]",
"Volume-averaged reversible heating [W.m-3]",
'X-averaged Ohmic heating [W.m-3]',
'Volume-averaged Ohmic heating [W.m-3]',
'Negative current collector temperature [C]',
'Positive current collector temperature [C]',
'X-averaged cell temperature [C]',
'Volume-averaged cell temperature [C]',
'X-averaged negative electrode temperature [C]',
'X-averaged separator temperature [C]',
'X-averaged positive electrode temperature [C]',
"Total heating [W]",
"Total heating per unit electrode-pair area [W.m-2]",
"Volume-averaged total heating [W.m-3]",
"X-averaged total heating [W.m-3]",
]


Expand Down Expand Up @@ -196,6 +192,7 @@ def setup_geometry(net, dtheta, spacing, length_3d):
rPs = geo["pore.arc_index"][net["throat.conns"]]
sameR = rPs[:, 0] == rPs[:, 1]
geo["throat.area"] = spacing * length_3d
geo['throat.xarea'] = length_3d * geo['throat.radial_position'] * drad
geo["throat.electrode_height"] = geo["throat.radial_position"] * drad
geo["throat.area"][sameR] = geo["throat.electrode_height"][sameR] * length_3d
geo["throat.volume"] = 0.0
Expand Down Expand Up @@ -239,7 +236,7 @@ def apply_heat_source(project, Q):
phys = project.physics()["phys_01"]
spm_Ts = net.throats("spm_resistor")
phys["throat.heat_source"] = 0.0
phys["throat.heat_source"][spm_Ts] = Q
phys["throat.heat_source"][spm_Ts] = Q * 2
phys.add_model(
propname="pore.heat_source",
model=op.models.misc.from_neighbor_throats,
Expand All @@ -252,22 +249,30 @@ def apply_heat_source_lp(project, Q):
# The SPMs are defined at the throat but the pores represent the
# Actual electrode volume so need to interpolate for heat sources
phys = project.physics()["phys_01"]
phys["throat.heat_source"] = Q
phys["throat.heat_source"] = Q
phys.add_model(
propname="pore.heat_source",
model=op.models.misc.from_neighbor_throats,
prop="throat.heat_source",
mode="mean",
)

# phys['pore.heat_source'] = phys.interpolate_data(propname='throat.heat_source')

# print('pore heat', phys['pore.heat_source'].sum())
# print('throat heat', phys['throat.heat_source'].sum())


def run_step_transient(project, time_step, BC_value, cp, rho, third=False, **kwargs):
# To Do - test whether this needs to be transient
net = project.network
phase = project.phases()["phase_01"]
phys = project.physics()["phys_01"]
phys["pore.A1"] = 0.0
Q_spm = phys["pore.heat_source"] * net["pore.volume"]
Q_spm = phys["pore.heat_source"] #* net["pore.volume"] #* len(net['pore.volume'])
# print(Q_spm.max(), Q_spm.min())
# print('total W heat produced',Q_spm.sum())
# print('total pore volume', net["pore.volume"].sum())
# Q_cc = net["pore.cc_power_loss"]
# print(
# "Q_spm",
Expand All @@ -283,6 +288,7 @@ def run_step_transient(project, time_step, BC_value, cp, rho, third=False, **kwa
phys["pore.A2"] = (Q_spm) / (cp * rho)
# Heat Source
T0 = phase["pore.temperature"]
# print(T0.max(), T0.min())
t_step = float(time_step / kwargs['t_slice'])
phys.add_model(
"pore.source",
Expand All @@ -297,15 +303,18 @@ def run_step_transient(project, time_step, BC_value, cp, rho, third=False, **kwa
phase=phase,
conductance="throat.conductance",
quantity="pore.temperature",
pore_volume="pore.volume",
t_initial=0.0,
t_final=time_step,
t_step=t_step,
t_output=t_step,
t_output=time_step,
t_tolerance=1e-9,
t_precision=kwargs['t_precision'],
rxn_tolerance=1e-9,
t_scheme="implicit",
)
alg.settings['cache_A'] = False
# print(phase['throat.conductance'].max(),phase['throat.conductance'].min())
alg.set_IC(values=T0)
bulk_Ps = net.pores("free_stream", mode="not")
alg.set_source("pore.source", bulk_Ps)
Expand All @@ -317,6 +326,9 @@ def run_step_transient(project, time_step, BC_value, cp, rho, third=False, **kwa
Ps = net.pores("free_stream")
alg.set_value_BC(Ps, values=BC_value)
alg.run()

# plt.plot(alg["pore.temperature"])
# plt.show()
# print(
# "Max Temp",
# np.around(alg["pore.temperature"].max(), 3),
Expand Down Expand Up @@ -556,10 +568,10 @@ def lump_thermal_props(param):
for j, l in enumerate(layers):
all_props[i][j] = param[l + " " + prop]
# Break them up
lens = all_props[:, 0]
rhos = all_props[:, 1]
Cps = all_props[:, 2]
ks = all_props[:, 3]
lens = all_props[0,:]
rhos = all_props[1,:]
Cps = all_props[2,:]
ks = all_props[3,:]
# Lumped props
rho_lump = np.sum(lens * rhos) / np.sum(lens)
Cp_lump = np.sum(lens * rhos * Cps) / np.sum(lens * rhos)
Expand Down
3 changes: 2 additions & 1 deletion ecm/__init__.py → src/ecm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@
from .__topology__ import *
from .__battery__ import *
from .__liionsolve__ import *
__version__ = "0.0.2"
from .autofit_jellyroll import *
__version__ = "0.0.3"
Loading
Loading