Skip to main content
Many battery parameters depend on state of charge, temperature, or both. Piecewise interpolation enables the creation of smooth parameter functions suitable for physics-based models. This guide covers both general piecewise interpolants and specialized OCP interpolants.

Overview

Piecewise interpolation addresses several needs:
  • SOC-dependent parameters: Diffusivity, exchange current density, and other transport properties often vary significantly with lithiation state
  • Temperature dependence: Non-Arrhenius behavior requires more flexible functional forms
  • OCP functions: Open-circuit potential must be defined across the full stoichiometry range for simulation
The implementation uses smooth heaviside functions to create continuous, differentiable interpolants that work well with differential equation solvers.

Mathematical Formulation

Smooth Heaviside Function

Traditional piecewise functions use discontinuous step functions, which cause convergence issues in ODE/DAE solvers. Instead, we use a smooth approximation: Hsmooth(x;θ,ϵ)=12(1+tanh(xθ2ϵ))H_{\text{smooth}}(x; \theta, \epsilon) = \frac{1}{2}\left(1 + \tanh\left(\frac{x - \theta}{2\epsilon}\right)\right) where:
  • xx is the input variable (e.g., SOC)
  • θ\theta is the threshold value
  • ϵ\epsilon is the smoothing parameter (larger = smoother transition)
The smooth heaviside is infinitely differentiable (CC^\infty) and transitions from ~0 for xθx \ll \theta to ~1 for xθx \gg \theta.

1D Piecewise Linear Interpolation

For a parameter pp varying with xx, given breakpoints {x0,x1,,xN1}\{x_0, x_1, \ldots, x_{N-1}\} with values {p0,p1,,pN1}\{p_0, p_1, \ldots, p_{N-1}\}: p(x)=p0H0(x)+i=0N2piseg(x)Hiseg(x)+pN1HN1+(x)p(x) = p_0 H_0^-(x) + \sum_{i=0}^{N-2} p_i^{\text{seg}}(x) H_i^{\text{seg}}(x) + p_{N-1} H_{N-1}^+(x) Each linear segment interpolates between adjacent knots: piseg(x)=pi+(pi+1pi)xxixi+1xip_i^{\text{seg}}(x) = p_i + (p_{i+1} - p_i) \frac{x - x_i}{x_{i+1} - x_i}

Piecewise Parameter Functions

1D Interpolation

For parameters that vary with a single variable (typically SOC), a PiecewiseInterpolation1D direct entry takes a base parameter name, a list of breakpoint values along the independent variable, and a smoothing parameter. The interpolant reads one parameter per breakpoint (e.g. "Negative particle diffusivity at SOC 0.3 [m2.s-1]") and returns a smooth function of the independent variable.

2D Interpolation

For parameters varying with two variables (e.g., SOC and temperature), a PiecewiseInterpolation2D direct entry takes breakpoints along both axes and separate smoothing parameters for each.
Use different smoothing parameters for dimensions with different scales (e.g., SOC in [0, 1] vs Temperature in [273, 323] K).
To configure these interpolants in a pipeline, see Pipelines → Calculations → Piecewise.

Formulations: Knots vs Slopes

Two equivalent parameterizations are available:
FormulationParametersBest for
KnotsValues at each breakpointDirect measurements
SlopesInitial value + slopes between breakpointsOptimization (smoother landscape)
Both have the same degrees of freedom. Slopes can be converted to knots using SlopesToKnots.

OCP Interpolants

Open-circuit potential (OCP) interpolants are specialized functions U(θ)U(\theta) that return equilibrium voltage for a given stoichiometry.

From Experimental Data

An OCPDataInterpolant calculation builds a smooth interpolant from half-cell OCP measurements. Data should be collected at low C-rates (C/20 or slower) to approximate equilibrium.

From MSMR Parameters

An OCPMSMRInterpolant calculation evaluates the MSMR model over a voltage range to create an interpolant. This provides thermodynamic consistency and reliable extrapolation.

Blended MSMR / Experimental OCP

The recommended approach combines experimental data with MSMR extrapolation via OCPDataInterpolantMSMRExtrapolation. The blending function smoothly transitions between data and MSMR: U(x)=w(x)Udata(x)+(1w(x))UMSMR(x)U(x) = w(x) \cdot U_{\text{data}}(x) + (1 - w(x)) \cdot U_{\text{MSMR}}(x) where w(x)w(x) is a bump function that equals ~1 inside the data range and ~0 outside.

The Inaccessible Lithium Problem

Experimental OCP data never covers the full 0-1 stoichiometry range due to:
  • Electrolyte decomposition at low voltages
  • Structural instability at high voltages
Without physics-based extrapolation, simulations that access stoichiometries outside the data range produce unreliable results.
Always use MSMR blending if your simulation might access stoichiometries outside your experimental range. The MSMR model provides physically reasonable behavior at the extremes.

Numerical Considerations

Smoothing Parameter Selection

ValueEffect
Too smallApproaches discontinuous, may cause solver issues
Too largeExcessive smoothing, reduces accuracy
Recommendedϵ104\epsilon \approx 10^{-4} to 103×10^{-3} \times (range of variable)

Extrapolation Behavior

Both piecewise and OCP interpolants use constant extrapolation outside their defined ranges. This prevents unbounded values and is physically reasonable for many battery parameters.

Common Use Cases

SOC-Dependent Diffusivity

Capture phase transitions or concentration effects on transport

OCP Functions

Define equilibrium voltage for electrochemical models

Temperature Effects

Non-Arrhenius temperature dependence

Coupled Dependencies

Parameters depending on multiple variables simultaneously

Best Practices

  1. Breakpoint placement: Place more breakpoints where the parameter changes rapidly
  2. Smoothing selection: Start with defaults; increase if solver has trouble
  3. Visualization: Always plot interpolants across the full range to check for artifacts
  4. MSMR for OCP: Use blended interpolants for robust extrapolation