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."
  "InitialThickness"               => 1.0e-8
  "MolarVolume"                    => 9.586e-5
  "IonicConductivity"              => 1.0e-5
  "InterstitialConcentration"      => 0.015
  "InitialPotentialDrop"           => 0.5
  "StoichiometricCoefficient"      => 2
  "ElectronicDiffusionCoefficient" => 1.6e-12

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 3605 report steps
╭────────────────┬────────────┬────────────────┬──────────────╮
│ Iteration type │   Avg/step │   Avg/ministep │        Total │
│                │ 2601 steps │ 2996 ministeps │     (wasted) │
├────────────────┼────────────┼────────────────┼──────────────┤
│ Newton         │    3.26259 │        2.83244 │  8486 (2160) │
│ Linearization  │    4.41446 │        3.83244 │ 11482 (2268) │
│ Linear solver  │    3.26259 │        2.83244 │  8486 (2160) │
│ Precond apply  │        0.0 │            0.0 │        0 (0) │
╰────────────────┴────────────┴────────────────┴──────────────╯
╭───────────────┬──────────┬────────────┬────────╮
│ Timing type   │     Each │   Relative │  Total │
│               │       μs │ Percentage │      s │
├───────────────┼──────────┼────────────┼────────┤
│ Properties    │  36.9544 │     8.16 % │ 0.3136 │
│ Equations     │ 115.3189 │    34.44 % │ 1.3241 │
│ Assembly      │  55.0608 │    16.44 % │ 0.6322 │
│ Linear solve  │  55.9980 │    12.36 % │ 0.4752 │
│ Linear setup  │   0.0000 │     0.00 % │ 0.0000 │
│ Precond apply │   0.0000 │     0.00 % │ 0.0000 │
│ Update        │  28.9218 │     6.38 % │ 0.2454 │
│ Convergence   │  31.3513 │     9.36 % │ 0.3600 │
│ Input/Output  │  24.1257 │     1.88 % │ 0.0723 │
│ Other         │  49.7345 │    10.98 % │ 0.4220 │
├───────────────┼──────────┼────────────┼────────┤
│ Total         │ 453.0788 │   100.00 % │ 3.8448 │
╰───────────────┴──────────┴────────────┴────────╯

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["NegativeElectrode"]["Interphase"]["Thickness"][:, 1]
seilength_xend = output.states["NegativeElectrode"]["Interphase"]["Thickness"][:, 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["NegativeElectrode"]["Interphase"]["VoltageDrop"][:, 1]
u_xend = output.states["NegativeElectrode"]["Interphase"]["VoltageDrop"][:, 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"
)
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.