pints icon indicating copy to clipboard operation
pints copied to clipboard

Add one-electron transfer electrochemistry toy problem

Open rccreswell opened this issue 5 years ago • 12 comments

We are thinking about adding as a Pints toy problem the two species surface confined electrochemistry reaction.

A + e- <-> B

The toy problem could use the dimensionless form of the equations with one-parameter capacitance, which are given below. Let θ indicate the proportion of A, i indicate the current, and e indicate the input potential.

dθ/dt = k_0 ((1 - θ) exp((1 - α) (e_r - e_0)) - θ exp(-α (e_r - e_0))) i = γ * de_r/dt + ζ * dθ/dt e_r = e - ρ * i

The six dimensionless equation parameters are: α = charge transfer coefficient γ = capacitance ρ = uncompensated resistance k_0 = reaction kinetics parameter e_0 = reversible potential ζ = electrode coverage

e gives the input potential. This could be fixed at a reasonable sinusoidal form.

Further details: Adamson, Hope, et al. "Analysis of HypD disulfide redox chemistry via optimization of fourier transformed ac voltammetric data." Analytical Chemistry 89.3 (2017): 1565-1573.

rccreswell avatar Feb 14 '20 12:02 rccreswell

sounds good, how were you thinking of doing the time integration? I don't think scipy has a dae solver

martinjrobins avatar Feb 14 '20 12:02 martinjrobins

I was happy with the DAE solver in Julia, but at this point we presumably don't want to add Julia as a dependency for the toy problems. Is there a straight Python/scipy approach you would recommend?

rccreswell avatar Feb 14 '20 13:02 rccreswell

I havn't found anything suitably lightweight enough. Various packages wrap sundials (https://web.casadi.org/, https://scikits-odes.readthedocs.io/en/latest/). Casadi is pip installable, but quite big. Scikits odes requires you to download and compile sundials manually

martinjrobins avatar Feb 14 '20 13:02 martinjrobins

Just a quick one -- aren't we already using some sort of finite differences scheme here to solve? Couldn't we just use that rather than rely on outside packages...

On Fri, Feb 14, 2020 at 1:25 PM Martin Robinson [email protected] wrote:

I havn't found anything suitably lightweight enough. Various packages wrap sundials (https://web.casadi.org/, https://scikits-odes.readthedocs.io/en/latest/). Casadi is pip installable, but quite big. Scikits odes requires you to download and compile sundials manually

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/pints-team/pints/issues/1039?email_source=notifications&email_token=ABCILKAQ44Z2NJG2H2S6O4DRC2LTJA5CNFSM4KVHPPHKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELZAKTQ#issuecomment-586286414, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABCILKEZ7PS4V36G36AUXU3RC2LTJANCNFSM4KVHPPHA .

ben18785 avatar Feb 14 '20 13:02 ben18785

Yes, I do have a finite difference implementation just in numpy which I was planning to start with. Of course, it's more lines of code/slower than what these libraries enable.

rccreswell avatar Feb 14 '20 13:02 rccreswell

I have c++ code to solve this in the electrochemistry repo, this is already wrapped in python. You could use this, but it would complicate the pints install process..

martinjrobins avatar Feb 14 '20 13:02 martinjrobins

If this is going to be a real pain, I'd say we could drop it (or make it an example of how to interface with Julia). I just thought it might make a good additional example (especially seeing as Dave likes this model).

On Fri, Feb 14, 2020 at 1:43 PM Martin Robinson [email protected] wrote:

I have c++ code to solve this in the electrochemistry repo, this is already wrapped in python. You could use this, but it would complicate the pints install process..

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/pints-team/pints/issues/1039?email_source=notifications&email_token=ABCILKDICX25474FOVMAA23RC2NXNA5CNFSM4KVHPPHKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOELZB3YA#issuecomment-586292704, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABCILKHLZ2L2GH4IPC6UJJDRC2NXNANCNFSM4KVHPPHA .

ben18785 avatar Feb 14 '20 13:02 ben18785

if you wanted to make an example, I would try CasADI, it's pretty good and can automatically generate jacobians, sensitivities etc. But I wouldn't have CasADI be a dependency for pints

martinjrobins avatar Feb 14 '20 17:02 martinjrobins

Yep, really like this idea! I'd like to see how it works for an example...

On 14 Feb 2020, at 17:00, Martin Robinson [email protected] wrote:

if you wanted to make an example, I would try CasADI, it's pretty good and can automatically generate jacobians, sensitivities etc. But I wouldn't have CasADI be a dependency for pints

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

ben18785 avatar Feb 14 '20 17:02 ben18785

Seems too hard for PINTS proper. Can we make this a side project? Would agree with copying martins code and ideally wrapping something clever e.g. CVODE

MichaelClerx avatar Feb 17 '20 14:02 MichaelClerx

Let's chat about this tomorrow -- I think a notebook where we trial Casadi would be really nice. But we wouldn't have Casadi as a dependency.

On Mon, Feb 17, 2020 at 2:34 PM Michael Clerx [email protected] wrote:

Seems too hard for PINTS proper. Can we make this a side project? Would agree with copying martins code and ideally wrapping something clever e.g. CVODE

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/pints-team/pints/issues/1039?email_source=notifications&email_token=ABCILKDBXCGSSO6DRVYI4XTRDKN6DA5CNFSM4KVHPPHKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEL6T6DQ#issuecomment-587022094, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABCILKE4JWWEIBKCPETZLR3RDKN6DANCNFSM4KVHPPHA .

ben18785 avatar Feb 17 '20 14:02 ben18785

Let's!

That notebook would be untestable within this repo, so outside still seems better to me. We should probably have an "advanced" section in the examples anyway, where we refer to all the outside projects? (e.g. emupints, pints with tensorflow, etc.)

MichaelClerx avatar Feb 17 '20 14:02 MichaelClerx