Transient Step Techniques (softpotato.analytical.step)¶
The softpotato.analytical.step module provides exact solutions for potentiostatic and galvanostatic step experiments, including Cottrell, Anson, and Sand equations.
step
¶
Analytical and empirical equations for electrochemical step techniques.
This module provides closed-form solutions, asymptotic expansions, and empirical models for transient potential-step (chronoamperometry, chronocoulometry) and current-step (chronopotentiometry) electrochemical experiments under semi-infinite diffusion at planar, spherical, and cylindrical electrode geometries.
Functions:
| Name | Description |
|---|---|
cottrell |
Planar Cottrell equation for chronoamperometric current transients. |
cottrell_spherical |
Cottrell equation for spherical and hemispherical electrodes. |
cottrell_step |
Double potential step chronoamperometry reversal transient. |
anson |
Anson equation for chronocoulometric cumulative charge transients. |
sand_transition_time |
Sand equation for chronopotentiometric transition time. |
sand |
Surface concentration transient under constant-current step. |
sand_potential |
Potential-time transient for a reversible chronopotentiometric wave. |
cottrell_cylinder |
Chronoamperometric current transient for cylindrical wire/fiber electrodes. |
step_concentration_profile |
Exact spatial concentration distribution \(c(x, t)\) for planar potential step. |
step_flux_profile |
Exact spatial diffusion flux distribution \(J(x, t)\) for planar potential step. |
Conventions & Units
All equations are dimensionally consistent in either standard SI or standard electrochemical CGS units:
- SI: \(t\) in \(\text{s}\), \(D\) in \(\text{m}^2\cdot\text{s}^{-1}\), \(c^*\) in \(\text{mol}\cdot\text{m}^{-3}\), \(A\) in \(\text{m}^2\), \(F\) in \(\text{C}\cdot\text{mol}^{-1}\) \(\implies I\) in \(\text{A}\).
- CGS: \(t\) in \(\text{s}\), \(D\) in \(\text{cm}^2\cdot\text{s}^{-1}\), \(c^*\) in \(\text{mol}\cdot\text{cm}^{-3}\), \(A\) in \(\text{cm}^2\), \(F\) in \(\text{C}\cdot\text{mol}^{-1}\) \(\implies I\) in \(\text{A}\).
Standard IUPAC sign conventions are applied: - Cathodic (reduction) currents are negative (\(I < 0\)). - Anodic (oxidation) currents are positive (\(I > 0\)).
References
- A. J. Bard, L. R. Faulkner, H. S. White, Electrochemical Methods: Fundamentals and Applications, 3rd ed., John Wiley & Sons, 2022.
- K. Aoki, K. Honda, K. Tokuda, H. Matsuda, "Voltammetry at microcylinder electrodes: Part II. Chronoamperometry", J. Electroanal. Chem., 186 (1985) 79–86.
- K. B. Oldham, "Analytical expressions for the transient current at a microcylinder electrode", J. Electroanal. Chem., 224 (1987) 229–232.
cottrell
¶
cottrell(t: float | ArrayLike, n: float = 1, D: float = 1e-05, c_bulk: float = 0.001, area: float = 1.0, F: float = FARADAY) -> float | np.ndarray
Compute planar Cottrell chronoamperometric current transient.
Calculates the Faradaic diffusion-controlled current response at a planar electrode subject to an instantaneous potential step into the diffusion-limited regime (\(c(0, t) = 0\)):
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
t
|
float or array - like
|
Time elapsed since the potential step in seconds (\(t \ge 0\)). |
required |
n
|
int or float
|
Number of electrons transferred per ion/molecule (\(n > 0\)). |
1
|
D
|
float
|
Diffusion coefficient of the electroactive species in \(\text{m}^2/\text{s}\) or \(\text{cm}^2/\text{s}\) (\(D > 0\)). |
1e-5
|
c_bulk
|
float
|
Bulk concentration of the electroactive species in \(\text{mol}/\text{m}^3\) or \(\text{mol}/\text{cm}^3\) (\(c^* \ge 0\)). |
1e-3
|
area
|
float
|
Electrode surface area in \(\text{m}^2\) or \(\text{cm}^2\) (\(A > 0\)). |
1.0
|
F
|
float
|
Faraday constant in \(\text{C}/\text{mol}\) (\(F \approx 96485.332\,\text{C}/\text{mol}\)). |
FARADAY
|
Returns:
| Type | Description |
|---|---|
float or ndarray
|
Faradaic current \(I(t)\) in Amperes (\(\text{A}\)). At \(t = 0\),
returns |
Raises:
| Type | Description |
|---|---|
ValueError
|
If any element of |
Examples:
>>> from softpotato.analytical.step import cottrell
>>> # Cottrell current at t = 1.0 s
>>> current = cottrell(1.0, n=1, D=1e-5, c_bulk=1e-3, area=1e-4)
>>> round(current * 1e6, 3) # current in microamperes
17.214
>>> # At t = 0, current approaches infinity
>>> cottrell(0.0)
inf
Source code in src/softpotato/analytical/step.py
cottrell_spherical
¶
cottrell_spherical(t: float | ArrayLike, r: float, n: float = 1, D: float = 1e-05, c_bulk: float = 0.001, area: float | None = None, F: float = FARADAY) -> float | np.ndarray
Compute Cottrell chronoamperometric current at a spherical electrode.
Calculates current at a spherical electrode, hanging mercury drop, or spherical microelectrode of radius \(r\):
If area is None, defaults to the surface area of a complete sphere
(\(A = 4 \pi r^2\)), yielding:
As \(t \to \infty\), the current reaches the steady-state limiting current \(I_{\text{ss}} = 4 \pi n F D c^* r\). As \(t \to 0\) (or \(r \to \infty\)), planar Cottrell behavior is recovered.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
t
|
float or array - like
|
Time elapsed since the potential step in seconds (\(t \ge 0\)). |
required |
r
|
float
|
Radius of the spherical electrode (\(r > 0\)). |
required |
n
|
int or float
|
Number of electrons transferred (\(n > 0\)). |
1
|
D
|
float
|
Diffusion coefficient (\(D > 0\)). |
1e-5
|
c_bulk
|
float
|
Bulk concentration (\(c^* \ge 0\)). |
1e-3
|
area
|
float or None
|
Electrode area. If None, defaults to full sphere area \(4 \pi r^2\).
For a hemisphere on an insulating plane, set |
None
|
F
|
float
|
Faraday constant in \(\text{C}/\text{mol}\). |
FARADAY
|
Returns:
| Type | Description |
|---|---|
float or ndarray
|
Faradaic current \(I(t)\) in Amperes (\(\text{A}\)). |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Examples:
>>> from softpotato.analytical.step import cottrell_spherical
>>> # Steady-state limiting current at long time (r = 10 um)
>>> r = 1e-5
>>> i_steady = cottrell_spherical(1e6, r=r, n=1, D=1e-9, c_bulk=1.0)
>>> expected_steady = 4 * np.pi * 96485.332 * 1e-9 * 1.0 * r
>>> bool(np.isclose(i_steady, expected_steady, rtol=1e-4))
True
Source code in src/softpotato/analytical/step.py
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 | |
cottrell_step
¶
cottrell_step(t: float | ArrayLike, tau: float, n: float = 1, D: float = 1e-05, c_bulk: float = 0.001, area: float = 1.0, D_red: float | None = None, F: float = FARADAY) -> float | np.ndarray
Compute double potential step chronoamperometry reversal transient.
Calculates current during a double-step potential experiment for a reversible redox couple \(\text{Ox} + n e^- \rightleftharpoons \text{Red}\).
- Forward step (\(0 < t \le \tau\)): Potential is stepped to a value where \(\text{Ox}\) is reduced at the diffusion-controlled rate (\(c_{\text{Ox}}(0, t) = 0\)), yielding negative cathodic current:
$$ I_f(t) = -\frac{n F A \sqrt{D_{\text{Ox}}} c^*_{\text{Ox}}}{\sqrt{\pi t}} $$
- Reversal step (\(t > \tau\)): Potential is stepped to re-oxidize \(\text{Red}\) back to \(\text{Ox}\) at the diffusion-controlled rate (\(c_{\text{Red}}(0, t) = 0\)), yielding positive anodic current:
$$ I_r(t) = \frac{n F A \sqrt{D_{\text{Red}}} c^*_{\text{Ox}}}{\sqrt{\pi}} \left[ \frac{1}{\sqrt{t - \tau}} - \frac{1}{\sqrt{t}} \right] $$
When \(D_{\text{Ox}} = D_{\text{Red}} = D\), the reversal current satisfies the classic diagnostic ratio:
At \(t = 2\tau\), \(-I(2\tau) / I(\tau) = 1 - 1/\sqrt{2} \approx 0.292893\).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
t
|
float or array - like
|
Time elapsed since the initial step in seconds (\(t \ge 0\)). |
required |
tau
|
float
|
Forward pulse duration in seconds (\(\tau > 0\)). |
required |
n
|
int or float
|
Number of electrons transferred (\(n > 0\)). |
1
|
D
|
float
|
Diffusion coefficient of reactant \(\text{Ox}\) (\(D > 0\)). |
1e-5
|
c_bulk
|
float
|
Bulk concentration of reactant \(\text{Ox}\) (\(c^*_{\text{Ox}} \ge 0\)). |
1e-3
|
area
|
float
|
Electrode area (\(A > 0\)). |
1.0
|
D_red
|
float or None
|
Diffusion coefficient of electrogenerated product \(\text{Red}\). If None, assumes \(D_{\text{Red}} = D_{\text{Ox}} = D\). |
None
|
F
|
float
|
Faraday constant in \(\text{C}/\text{mol}\). |
FARADAY
|
Returns:
| Type | Description |
|---|---|
float or ndarray
|
Faradaic current \(I(t)\) in Amperes (\(\text{A}\)). Negative for cathodic reduction (\(t \le \tau\)) and positive for anodic oxidation (\(t > \tau\)). |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Examples:
>>> from softpotato.analytical.step import cottrell_step
>>> tau = 1.0
>>> # Evaluate forward and reversal currents
>>> i_fwd = cottrell_step(tau, tau=tau)
>>> i_rev = cottrell_step(2.0 * tau, tau=tau)
>>> ratio = -i_rev / i_fwd
>>> round(ratio, 6)
0.292893
Source code in src/softpotato/analytical/step.py
261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 | |
anson
¶
anson(t: float | ArrayLike, n: float = 1, D: float = 1e-05, c_bulk: float = 0.001, area: float = 1.0, Q_dl: float = 0.0, gamma: float = 0.0, tau: float | None = None, F: float = FARADAY) -> float | np.ndarray
Compute cumulative charge transient using the Anson chronocoulometry equation.
For single potential-step chronocoulometry:
where:
- \(Q_{\text{diff}}(t)\) is the Faradaic charge from diffusing species.
- \(Q_{\text{dl}}\) is the double-layer capacitive charge.
- \(Q_{\text{ads}} = n F A \Gamma\) is the Faradaic charge from adsorbed species with surface excess \(\Gamma\).
An Anson plot of \(Q(t)\) versus \(\sqrt{t}\) yields:
- Slope: \(\dfrac{2 n F A \sqrt{D} c^*}{\sqrt{\pi}}\)
- Intercept (\(t = 0\)): \(Q_{\text{dl}} + n F A \Gamma\)
When tau is provided (double-step chronocoulometry), the cumulative charge
for \(t > \tau\) accounts for re-oxidation:
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
t
|
float or array - like
|
Time elapsed since the step in seconds (\(t \ge 0\)). |
required |
n
|
int or float
|
Number of electrons transferred (\(n > 0\)). |
1
|
D
|
float
|
Diffusion coefficient (\(D > 0\)). |
1e-5
|
c_bulk
|
float
|
Bulk concentration (\(c^* \ge 0\)). |
1e-3
|
area
|
float
|
Electrode area (\(A > 0\)). |
1.0
|
Q_dl
|
float
|
Double-layer capacitive charge in Coulombs (\(\text{C}\)). |
0.0
|
gamma
|
float
|
Surface excess of adsorbed reactant \(\Gamma\) in \(\text{mol}/\text{m}^2\) or \(\text{mol}/\text{cm}^2\) (\(\Gamma \ge 0\)). |
0.0
|
tau
|
float or None
|
Forward pulse duration in seconds (\(\tau > 0\)). If None, single-step chronocoulometry is evaluated. |
None
|
F
|
float
|
Faraday constant in \(\text{C}/\text{mol}\). |
FARADAY
|
Returns:
| Type | Description |
|---|---|
float or ndarray
|
Cumulative charge \(Q(t)\) in Coulombs (\(\text{C}\)). |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Examples:
>>> from softpotato.analytical.step import anson
>>> # Intercept at t = 0 matches Q_dl + n*F*A*gamma
>>> q_0 = anson(0.0, Q_dl=5e-6, gamma=1e-10, area=1e-4)
>>> round(q_0 * 1e6, 6)
5.000965
Source code in src/softpotato/analytical/step.py
383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 | |
sand_transition_time
¶
sand_transition_time(I: float, n: float = 1, D: float = 1e-05, c_bulk: float = 0.001, area: float = 1.0, F: float = FARADAY) -> float
Compute Sand equation transition time \(\tau\) for chronopotentiometry.
Calculates the transition time \(\tau\) at which surface concentration drops to zero (\(c(0, \tau) = 0\)) under a constant applied current \(I\):
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
I
|
float
|
Constant applied current in Amperes (\(I \neq 0\)). |
required |
n
|
int or float
|
Number of electrons transferred (\(n > 0\)). |
1
|
D
|
float
|
Diffusion coefficient (\(D > 0\)). |
1e-5
|
c_bulk
|
float
|
Bulk concentration (\(c^* > 0\)). |
1e-3
|
area
|
float
|
Electrode area (\(A > 0\)). |
1.0
|
F
|
float
|
Faraday constant in \(\text{C}/\text{mol}\). |
FARADAY
|
Returns:
| Type | Description |
|---|---|
float
|
Transition time \(\tau\) in seconds (\(\text{s}\)). |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Examples:
>>> from softpotato.analytical.step import sand_transition_time
>>> tau = sand_transition_time(I=1e-4, n=1, D=1e-5, c_bulk=1e-3, area=1e-4)
>>> round(tau, 4)
0.0731
Source code in src/softpotato/analytical/step.py
sand
¶
sand(t: float | ArrayLike, I: float, n: float = 1, D: float = 1e-05, c_bulk: float = 0.001, area: float = 1.0, F: float = FARADAY) -> float | np.ndarray
Compute surface concentration transient under constant-current step.
Calculates the time-dependent electrode surface concentration \(c(0, t)\) under galvanostatic (chronopotentiometric) conditions:
where \(\tau\) is the Sand transition time. For \(t \ge \tau\), the surface concentration is depleted (\(c(0, t) = 0\)).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
t
|
float or array - like
|
Time in seconds (\(t \ge 0\)). |
required |
I
|
float
|
Constant applied current in Amperes (\(I \neq 0\)). |
required |
n
|
int or float
|
Number of electrons transferred (\(n > 0\)). |
1
|
D
|
float
|
Diffusion coefficient (\(D > 0\)). |
1e-5
|
c_bulk
|
float
|
Bulk concentration (\(c^* \ge 0\)). |
1e-3
|
area
|
float
|
Electrode area (\(A > 0\)). |
1.0
|
F
|
float
|
Faraday constant in \(\text{C}/\text{mol}\). |
FARADAY
|
Returns:
| Type | Description |
|---|---|
float or ndarray
|
Surface concentration \(c(0, t)\) in concentration units (\(c \ge 0\)). |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Examples:
>>> from softpotato.analytical.step import sand, sand_transition_time
>>> tau = sand_transition_time(I=1e-4, n=1, D=1e-5, c_bulk=1e-3, area=1e-4)
>>> # At t = 0, surface concentration is c_bulk
>>> sand(0.0, I=1e-4, n=1, D=1e-5, c_bulk=1e-3, area=1e-4)
0.001
>>> # At t = tau, surface concentration is completely depleted
>>> round(sand(tau, I=1e-4, n=1, D=1e-5, c_bulk=1e-3, area=1e-4), 6)
0.0
Source code in src/softpotato/analytical/step.py
561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 | |
sand_potential
¶
sand_potential(t: float | ArrayLike, tau: float, E_half: float = 0.0, n: float = 1, T: float = STANDARD_TEMPERATURE, R: float = GAS_CONSTANT, F: float = FARADAY) -> float | np.ndarray
Compute potential-time curve for a reversible chronopotentiometric wave.
Calculates the potential transient for a reversible electron transfer process (\(\text{Ox} + n e^- \rightleftharpoons \text{Red}\)) under constant applied current:
where \(E_{\tau/4} = E_{1/2}\) is the quarter-wave potential (the potential at \(t = \tau/4\)).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
t
|
float or array - like
|
Time in seconds (\(0 < t < \tau\)). |
required |
tau
|
float
|
Sand transition time in seconds (\(\tau > 0\)). |
required |
E_half
|
float
|
Quarter-wave (half-wave) reversible potential \(E_{1/2}\) in Volts. |
0.0
|
n
|
int or float
|
Number of electrons transferred (\(n > 0\)). |
1
|
T
|
float
|
Temperature in Kelvin (\(T > 0\)). |
STANDARD_TEMPERATURE
|
R
|
float
|
Molar gas constant (\(R \approx 8.31446\,\text{J}/(\text{mol}\cdot\text{K})\)). |
GAS_CONSTANT
|
F
|
float
|
Faraday constant (\(F \approx 96485.332\,\text{C}/\text{mol}\)). |
FARADAY
|
Returns:
| Type | Description |
|---|---|
float or ndarray
|
Electrode potential \(E(t)\) in Volts (\(\text{V}\)). At \(t \ge \tau\),
returns |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Examples:
>>> from softpotato.analytical.step import sand_potential
>>> # At quarter-transition time (t = tau / 4), E(t) equals E_half
>>> tau = 4.0
>>> sand_potential(1.0, tau=tau, E_half=0.250)
0.25
Source code in src/softpotato/analytical/step.py
639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 | |
cottrell_cylinder
¶
cottrell_cylinder(t: float | ArrayLike, r0: float, n: float = 1, D: float = 1e-05, c_bulk: float = 0.001, length: float = 1.0, area: float | None = None, method: Literal['auto', 'aoki', 'oldham', 'short_time', 'long_time'] = 'auto', F: float = FARADAY) -> float | np.ndarray
Compute chronoamperometric current transient at a cylindrical wire/fiber electrode.
Calculates current for a cylindrical microelectrode of radius \(r_0\) and length \(l\) (\(A = 2 \pi r_0 l\)):
where \(\theta = \dfrac{D t}{r_0^2}\) is dimensionless time.
Approximations
- Aoki approximation (
method="aoki"or"auto") (Aoki et al., 1985): Valid across \(0 < \theta \le 10^6\) with error within 1%:
$$ \Phi(\theta) = \frac{1}{\sqrt{\pi \theta}} + 0.422 - 0.0675 \log_{10}(\theta) \pm 0.0058 {\log_{10}(\theta) - 1.47}^2 $$
where \(\pm\) is \(+\) for \(\log_{10}(\theta) \ge 1.47\) and \(-\) for \(\log_{10}(\theta) < 1.47\).
- Oldham rational Padé approximation (
method="oldham") (Oldham, 1987): Valid across all \(\theta > 0\) with maximum error \(< 0.4\%\):
$$ \Phi(\theta) = \frac{1}{\sqrt{\pi \theta}} \left( \frac{1 + 0.36074 \sqrt{\theta} + 0.36502 \theta} {1 + 0.28173 \sqrt{\theta} + 0.17887 \theta} \right) $$
- Short-time asymptotic expansion (
method="short_time", \(\theta \le 1\)):
$$ \Phi(\theta) = \frac{1}{\sqrt{\pi \theta}} + \frac{1}{2} - \frac{1}{4} \sqrt{\frac{\theta}{\pi}} + \frac{1}{8} \theta $$
- Long-time asymptotic expansion (
method="long_time", \(\theta \gg 1\)):
$$ \Phi(\theta) = \frac{2}{u} - \frac{2 \gamma}{u^2}, \quad u = \ln(4\theta) - 2\gamma $$
where \(\gamma \approx 0.57721566\) is Euler's constant.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
t
|
float or array - like
|
Time in seconds (\(t \ge 0\)). |
required |
r0
|
float
|
Electrode cylinder radius in meters or cm (\(r_0 > 0\)). |
required |
n
|
int or float
|
Number of electrons transferred (\(n > 0\)). |
1
|
D
|
float
|
Diffusion coefficient (\(D > 0\)). |
1e-5
|
c_bulk
|
float
|
Bulk concentration (\(c^* \ge 0\)). |
1e-3
|
length
|
float
|
Length of the cylinder wire (\(l > 0\)). |
1.0
|
area
|
float or None
|
Electrode surface area. If None, defaults to \(A = 2 \pi r_0 l\). |
None
|
method
|
('auto', 'aoki', 'oldham', 'short_time', 'long_time')
|
Approximation formula to evaluate. |
'auto'
|
F
|
float
|
Faraday constant in \(\text{C}/\text{mol}\). |
FARADAY
|
Returns:
| Type | Description |
|---|---|
float or ndarray
|
Faradaic current \(I(t)\) in Amperes (\(\text{A}\)). |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
References
- K. Aoki, K. Honda, K. Tokuda, H. Matsuda, "Voltammetry at microcylinder electrodes: Part II. Chronoamperometry", J. Electroanal. Chem., 186 (1985) 79–86.
- K. B. Oldham, "Analytical expressions for the transient current at a microcylinder electrode", J. Electroanal. Chem., 224 (1987) 229–232.
Source code in src/softpotato/analytical/step.py
728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 | |
step_concentration_profile
¶
step_concentration_profile(x: float | ArrayLike, t: float, D: float = 1e-05, c_bulk: float = 0.001) -> float | np.ndarray
Compute exact spatial concentration profile \(c(x, t)\) for a planar potential step.
Calculates the exact error-function analytical solution to 1D linear semi-infinite diffusion following a step to zero surface concentration (\(c(0, t) = 0\)):
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float or array - like
|
Distance from electrode surface in meters or cm (\(x \ge 0\)). |
required |
t
|
float
|
Time elapsed since the potential step in seconds (\(t \ge 0\)). |
required |
D
|
float
|
Diffusion coefficient (\(D > 0\)). |
1e-5
|
c_bulk
|
float
|
Bulk concentration (\(c^* \ge 0\)). |
1e-3
|
Returns:
| Type | Description |
|---|---|
float or ndarray
|
Concentration at spatial coordinate(s) \(x\) at time \(t\). |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Examples:
>>> from softpotato.analytical.step import step_concentration_profile
>>> # Surface concentration is zero for t > 0
>>> step_concentration_profile(0.0, t=1.0)
0.0
>>> # Bulk concentration is reached at large distance
>>> step_concentration_profile(1.0, t=1e-3, D=1e-5, c_bulk=1.0)
1.0
Source code in src/softpotato/analytical/step.py
step_flux_profile
¶
step_flux_profile(x: float | ArrayLike, t: float, D: float = 1e-05, c_bulk: float = 0.001) -> float | np.ndarray
Compute exact spatial diffusion flux profile \(J(x, t)\) for a planar potential step.
Calculates the spatial diffusion flux \(J(x, t) = -D \dfrac{\partial c}{\partial x}\):
At the electrode surface (\(x = 0\)), the interfacial flux is:
corresponding to the Cottrell current \(I(t) = -n F A J(0, t)\).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
float or array - like
|
Distance from electrode surface in meters or cm (\(x \ge 0\)). |
required |
t
|
float
|
Time elapsed since the potential step in seconds (\(t > 0\)). |
required |
D
|
float
|
Diffusion coefficient (\(D > 0\)). |
1e-5
|
c_bulk
|
float
|
Bulk concentration (\(c^* \ge 0\)). |
1e-3
|
Returns:
| Type | Description |
|---|---|
float or ndarray
|
Diffusion flux \(J(x, t)\) in \(\text{mol}/(\text{m}^2\cdot\text{s})\). |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Examples:
>>> from softpotato.analytical.step import step_flux_profile
>>> flux = step_flux_profile(0.0, t=1.0, D=1e-5, c_bulk=1.0)
>>> round(flux, 6)
-0.001784
Source code in src/softpotato/analytical/step.py
959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 | |