Skip to content

Example with SEI layer

Preparation of the input

julia
using Jutul, BattMo, GLMakie

We use the SEI model presented in [1]. We use the json data given in bolay.json which contains the parameters for the SEI layer.

julia
cell_parameters = load_cell_parameters(; from_default_set = "chen_2020")
cycling_protocol = load_cycling_protocol(; from_default_set = "cccv")
simulation_settings = load_simulation_settings(; from_default_set = "p2d")

We have a look at the SEI related parameters.

julia
interphase_parameters = cell_parameters["NegativeElectrode"]["Interphase"]
Dict{String, Any} with 8 entries:
  "Description"                    => "EC-based SEI, from Bolay2022."
  "ElectronicDiffusionCoefficient" => 1.6e-12
  "InterstitialConcentration"      => 0.015
  "InitialThickness"               => 1.0e-8
  "IonicConductivity"              => 1.0e-5
  "StoichiometricCoefficient"      => 2
  "InitialPotentialDrop"           => 0.5
  "MolarVolume"                    => 9.586e-5

We start the simulation and retrieve the result

julia
model = LithiumIonBattery();

model_settings = model.settings
model_settings["SEIModel"] = "Bolay"

cycling_protocol["TotalNumberOfCycles"] = 10

sim = Simulation(model, cell_parameters, cycling_protocol; simulation_settings);

output = solve(sim)

t = output.time_series["Time"]
E = output.time_series["Voltage"]
I = output.time_series["Current"]
✔️ Validation of ModelSettings passed: No issues found.
──────────────────────────────────────────────────
✔️ Validation of CellParameters passed: No issues found.
──────────────────────────────────────────────────
✔️ Validation of CyclingProtocol passed: No issues found.
──────────────────────────────────────────────────
✔️ Validation of SimulationSettings passed: No issues found.
──────────────────────────────────────────────────
✔️ Validation of SolverSettings passed: No issues found.
──────────────────────────────────────────────────
Jutul: Simulating 2 days, 2 hours as 3600 report steps
╭────────────────┬────────────┬────────────────┬──────────────╮
 Iteration type    Avg/step    Avg/ministep         Total 
 2630 steps  2806 ministeps      (wasted) 
├────────────────┼────────────┼────────────────┼──────────────┤
 Newton         │    3.01179 │        2.82288 │  7921 (2140) │
 Linearization  │    4.07871 │        3.82288 │ 10727 (2247) │
 Linear solver  │    3.01179 │        2.82288 │  7921 (2140) │
 Precond apply  │        0.0 │            0.0 │        0 (0) │
╰────────────────┴────────────┴────────────────┴──────────────╯
╭───────────────┬────────┬────────────┬─────────╮
 Timing type      Each    Relative    Total 
     ms  Percentage        s 
├───────────────┼────────┼────────────┼─────────┤
 Properties    │ 0.0981 │     2.85 % │  0.7772 │
 Equations     │ 1.6472 │    64.76 % │ 17.6697 │
 Assembly      │ 0.1478 │     5.81 % │  1.5851 │
 Linear solve  │ 0.5913 │    17.17 % │  4.6838 │
 Linear setup  │ 0.0000 │     0.00 % │  0.0000 │
 Precond apply │ 0.0000 │     0.00 % │  0.0000 │
 Update        │ 0.0836 │     2.43 % │  0.6620 │
 Convergence   │ 0.1378 │     5.42 % │  1.4777 │
 Input/Output  │ 0.0312 │     0.32 % │  0.0875 │
 Other         │ 0.0434 │     1.26 % │  0.3439 │
├───────────────┼────────┼────────────┼─────────┤
 Total         │ 3.4449 │   100.00 % │ 27.2867 │
╰───────────────┴────────┴────────────┴─────────╯

Plot of voltage and current

julia
plot_dashboard(output; plot_type = "simple")

Plot of SEI thickness

We recover the SEI thickness from the state output

julia
seilength_x1 = output.states["SEIThickness"][:, 1]
seilength_xend = output.states["SEIThickness"][:, end]

f = Figure(size = (1000, 400))

ax = Axis(f[1, 1],
	title = "Length",
	xlabel = "Time / s",
	ylabel = "Thickness / m",
	xlabelsize = 25,
	ylabelsize = 25,
	xticklabelsize = 25,
	yticklabelsize = 25,
)

scatterlines!(ax,
	t,
	seilength_x1;
	linewidth = 4,
	markersize = 10,
	marker = :cross,
	markercolor = :black)

scatterlines!(ax,
	t,
	seilength_xend;
	linewidth = 4,
	markersize = 10,
	marker = :cross,
	markercolor = :black)

ax = Axis(f[2, 1],
	title = "SEI thicknesss",
	xlabel = "Time / s",
	ylabel = "Voltage / V",
	xlabelsize = 25,
	ylabelsize = 25,
	xticklabelsize = 25,
	yticklabelsize = 25,
)

scatterlines!(ax,
	t,
	E;
	linewidth = 4,
	markersize = 10,
	marker = :cross,
	markercolor = :black)

Plot of voltage drop

julia
u_x1 = output.states["SEIVoltageDrop"][:, 1]
u_xend = output.states["SEIVoltageDrop"][:, end]

f = Figure(size = (1000, 400))

ax = Axis(f[1, 1],
	title = "SEI voltage drop",
	xlabel = "Time / s",
	ylabel = "Voltage / V",
	xlabelsize = 25,
	ylabelsize = 25,
	xticklabelsize = 25,
	yticklabelsize = 25,
)

scatterlines!(ax,
	t,
	u_x1;
	linewidth = 4,
	markersize = 10,
	marker = :cross,
	markercolor = :blue,
	label = "xmin")

scatterlines!(ax,
	t,
	u_xend;
	linewidth = 4,
	markersize = 10,
	marker = :cross,
	markercolor = :black,
	label = "xmax")
Plot{Makie.scatterlines, Tuple{Vector{Point{2, Float64}}}}

Example on GitHub

If you would like to run this example yourself, it can be downloaded from the BattMo.jl GitHub repository as a script.


This page was generated using Literate.jl.