Upload
others
View
3
Download
0
Embed Size (px)
Citation preview
Computer Simulation of MolecularElectrochemistry Experiments
—A Rational Approach
Kai Ludwig and Bernd Speiser
Institut fur Organische Chemie, Universitat Tubingen
Computer Simulation of Molecular Electrochemistry Experiments—A Rational Approach – p.1/21
Simulation
mechanism, transport, geometry(physicochemical model)
Computer Simulation of Molecular Electrochemistry Experiments—A Rational Approach – p.2/21
Simulation
mechanism, transport, geometry(physicochemical model)
partial differential equations(mathematical model)
Computer Simulation of Molecular Electrochemistry Experiments—A Rational Approach – p.2/21
Simulation
mechanism, transport, geometry(physicochemical model)
partial differential equations(mathematical model)
concentration profiles, current/potential curves(numerical model)
Computer Simulation of Molecular Electrochemistry Experiments—A Rational Approach – p.2/21
Simulation and Molecular Electrochemistry
uses of simulation in molecular electrochemistry:
analyze experimental data by comparison tocalculations
predict experimental responses for complexsystems
numerical calculations: “digital simulation” (Feldberg,1969)
programs for specific purposes vs. software packages
Computer Simulation of Molecular Electrochemistry Experiments—A Rational Approach – p.3/21
Simulation Packages
purpose: help non-programmers to apply simulation in
everyday work
selection of more or less extended and popular simulation
packages in the literature:
EASI (Speiser, since 1990) — fixed list of mechanisms
Elsim (Bieniasz, since 1992) — complex mathematical
relationships
Digisim (Feldberg, Rudolph, et al., since 1994) — “any”
mechanism, windows style, CV
DigiElch (Rudolph, 2004) — variation of Digisim
Computer Simulation of Molecular Electrochemistry Experiments—A Rational Approach – p.4/21
Common Problems with Simulation Packages
complex code(difficult to understand and maintain)
extension difficult or impossible(mechanisms, geometries, transport phenomena,experiments)
proprietary code(distribution as binary executable)
limited testing(“open science” based on access to code)
Computer Simulation of Molecular Electrochemistry Experiments—A Rational Approach – p.5/21
A Possible Rational Solution
based on two paradigms:
use object-oriented programming techniques
provide open-source code
Computer Simulation of Molecular Electrochemistry Experiments—A Rational Approach – p.6/21
A Possible Rational Solution
based on two paradigms:
use object-oriented programming techniques
provide open-source code
Computer Simulation of Molecular Electrochemistry Experiments—A Rational Approach – p.6/21
Object-Oriented Methods I
definition:“writing program text decomposed in modules”(wikipedia.org) which encapsulate data and actions
Computer Simulation of Molecular Electrochemistry Experiments—A Rational Approach – p.7/21
Object-Oriented Methods I
definition:“writing program text decomposed in modules”(wikipedia.org) which encapsulate data and actions
use: large scale software projects
Computer Simulation of Molecular Electrochemistry Experiments—A Rational Approach – p.7/21
Object-Oriented Methods I
definition:“writing program text decomposed in modules”(wikipedia.org) which encapsulate data and actions
use: large scale software projects
possible advantages:
production of flexible, extensible code
re-use of tested code
localized debugging and maintenance
better understanding of real system
Computer Simulation of Molecular Electrochemistry Experiments—A Rational Approach – p.7/21
Object-Oriented Methods II
three common steps of working with the object-orientedparadigm:
analysis: identify concepts(in the real system)
design: describe interaction, define classes(construction plans for objects)
programming: implement in a programming language(write the code)
Computer Simulation of Molecular Electrochemistry Experiments—A Rational Approach – p.8/21
Object-Oriented Methods III
object: instantiation of a class
a program: collection of interacting objects
relations between classes (and objects):exchange of informationcompositionderivation
Computer Simulation of Molecular Electrochemistry Experiments—A Rational Approach – p.9/21
Object-Oriented Methods III
object: instantiation of a class
a program: collection of interacting objects
relations between classes (and objects):exchange of informationcompositionderivation
Computer Simulation of Molecular Electrochemistry Experiments—A Rational Approach – p.9/21
Object-Oriented Methods III
object: instantiation of a class
a program: collection of interacting objects
relations between classes (and objects):exchange of informationcompositionderivation
Computer Simulation of Molecular Electrochemistry Experiments—A Rational Approach – p.9/21
Object-Oriented Methods III
object: instantiation of a class
a program: collection of interacting objects
relations between classes (and objects):exchange of informationcompositionderivation
Computer Simulation of Molecular Electrochemistry Experiments—A Rational Approach – p.9/21
Object-Oriented Methods III
object: instantiation of a class
a program: collection of interacting objects
relations between classes (and objects):exchange of informationcompositionderivation
objects are “building blocks” of program
Computer Simulation of Molecular Electrochemistry Experiments—A Rational Approach – p.9/21
Technical Aspects of EChem++
programming language: C++
operating system: Linux
extended use of librariesQuantity quantity.sourceforge.net
Spirit spirit.sourceforge.net
GiNaC www.ginac.de
GMM++ www.gmm.insa-tlse.fr/getfem
VTK public.kitware.com/VTK
Qt www.trolltech.com
tree.hh www.damtp.cam.ac.uk/user/kp229/tree
Computer Simulation of Molecular Electrochemistry Experiments—A Rational Approach – p.10/21
Example Objects in EChem++ I
excitation functions: induce changes during experimentclass Segment, class ExcitationFunction
Computer Simulation of Molecular Electrochemistry Experiments—A Rational Approach – p.11/21
Example Objects in EChem++ I
excitation functions: induce changes during experimentclass Segment, class ExcitationFunction
E
t
E
t
E
t
Computer Simulation of Molecular Electrochemistry Experiments—A Rational Approach – p.11/21
Example Objects in EChem++ I
excitation functions: induce changes during experimentclass Segment, class ExcitationFunction
d
i
d
i
d
i
d
i
d
i
Computer Simulation of Molecular Electrochemistry Experiments—A Rational Approach – p.11/21
Example Objects in EChem++ I
excitation functions: induce changes during experimentclass Segment, class ExcitationFunction
Segment
LinearSegment<D,I>
D value( I )
D starting_value D end_value
I maximum()
I Imax
ConstantSegment<D,I>
D value( I )
D constant_value
PowerSegment<D,I>
D value( I )
D d_0 D d_1 I i_1 double power
SineSegment<D,I>
D value( I )
D offset D amplitude Frequency angular_frequencyPlaneAngle phase_shift
ExponentialSegment<D,I>
D value( I )
D d_0 D d_1 Frequency omega
DISegment<D,I>
virtual D value( I ) = 0
Computer Simulation of Molecular Electrochemistry Experiments—A Rational Approach – p.11/21
Example Objects in EChem++ I
excitation functions: induce changes during experimentclass Segment, class ExcitationFunction
ExcitationFunction
DIExcitationFunction<D,I>
virtual void add( DISegment<D,I> ) D value( I )
vector<D> values( vector<I> ) vector<D> values( I , int ) I maximum()
vector<DISegment*> segments
SDIExcitationFunction<D,I,S<D,I> >
void add( S<D,I> )
I maximum()
I Imax
DISegment<D,I>
virtual D value( I ) = 0
Computer Simulation of Molecular Electrochemistry Experiments—A Rational Approach – p.11/21
Example Objects in EChem++ II
reaction network:translate mechanisms into internal representationclass ReactionNetwork, class Law
Computer Simulation of Molecular Electrochemistry Experiments—A Rational Approach – p.12/21
Example Objects in EChem++ II
reaction network:translate mechanisms into internal representationclass ReactionNetwork, class Law
Computer Simulation of Molecular Electrochemistry Experiments—A Rational Approach – p.12/21
Example Objects in EChem++ II
reaction network:translate mechanisms into internal representationclass ReactionNetwork, class Law
reactionNetwork
reaction
boundaryOperatoreducts productsreactionArrow
+
reactionBlock
<=>reactionAddend
species
neutrum
A
reactionAddend
species
electron
e-
reactionAddend
species
neutrum
B
b< integer >
1
;
options
;
Computer Simulation of Molecular Electrochemistry Experiments—A Rational Approach – p.12/21
Example Objects in EChem++ II
reaction network:translate mechanisms into internal representationclass ReactionNetwork, class Law
Law
value() gradient() add( int , Law*) parameters()
ZeroLaw
value() gradient() add( int, Law*)
ButlerVolmer
value() gradient() add( int , Law*)
GenericRateLaw
value() gradient() add( int , Law*)
PowerRateLaw
value() gradient() add( int , Law*)
CompositeLaw
value() gradient() add( int , Law*)
Computer Simulation of Molecular Electrochemistry Experiments—A Rational Approach – p.12/21
Example Objects in EChem++ III
numerical integration:solve differential equations by adaptive multilevel finiteelement methodclass RotheRosenbrock, class MFEM
Computer Simulation of Molecular Electrochemistry Experiments—A Rational Approach – p.13/21
Example Objects in EChem++ III
numerical integration:solve differential equations by adaptive multilevel finiteelement methodclass RotheRosenbrock, class MFEM
integrate systems of
∂c
∂t= D
∂2c
∂x2+ ρ(c)
subject to appropriate initial and boundary conditions
Computer Simulation of Molecular Electrochemistry Experiments—A Rational Approach – p.13/21
Example Objects in EChem++ III
numerical integration:solve differential equations by adaptive multilevel finiteelement methodclass RotheRosenbrock, class MFEM
RotheRosenbrock
updateMeshData() step( u_new, r_new, eps_x, eta, un, tn, tau, coarseError )
RotheRos3P
updateMeshData() step( u_new, r_new, eps_x, eta, un, tn, tau, coarseError )
RotheROWDA3
updateMeshData() step( u_new, r_new, eps_x, eta, un, tn, tau, coarseError )
RotheRos2
updateMeshData() step( u_new, r_new, eps_x, eta, un, tn, tau, coarseError )
RotheRodasP
updateMeshData() step( u_new, r_new, eps_x, eta, un, tn, tau, coarseError )
Law kineticTerms
Law boundaryTerms
Computer Simulation of Molecular Electrochemistry Experiments—A Rational Approach – p.13/21
Proposed Electrochemical Simulation High Level Modules
HardwareControl
Experiment
ExcitationFunction
Analysis
Data
Model
Cell
Computer Simulation of Molecular Electrochemistry Experiments—A Rational Approach – p.14/21
Example Simulation I: pseudo-first order reaction
A ⇀↽ B + e− E0, ks, α,D
B + C −→ D k
assume: cyclic voltammetry, cC = 100 × cA, k = 100 s−1
treat follow-up reaction as
second order (e.g., in DigiSim)
pseudo-first order (power rate law: r = kcB; this work)
decouple stoichiometry and kinetics
Computer Simulation of Molecular Electrochemistry Experiments—A Rational Approach – p.15/21
Example Simulation II: non-triangular wave forms
A ⇀↽ B + e− E0, ks, α,D
assume: accumulation of B in diffusion layer by prolongedpotential-controlled oxidationvary excitation functions: E
t
use of more complicated, non-triangular waveforms
Computer Simulation of Molecular Electrochemistry Experiments—A Rational Approach – p.16/21
Example Simulation III: two working electrode system
A ⇀↽ B + e− E01 , ks,1, α1,D1
A + e− ⇀↽ C E02 , ks,2, α2,D2
B + C ⇀↽ 2A K,k
assume: generate oxidation and reduced form at two working
electrodesspecify electrode geometry: d = 50 µmk = 107 l mol−1 s−1
E0
1= +0.25 V, E0
2= −0.25 V
electrode 1 electrode 2
A ⇀↽ B + e−
diffusionց
A + e− ⇀↽ Cdiffusionտ
B + C ⇀↽ 2A
define complex geometries with multiple boundaries (currently only 1D)
Computer Simulation of Molecular Electrochemistry Experiments—A Rational Approach – p.17/21
EChem++ and Open Source Paradigm
open-source software is open for . . .
use
modification
redistribution
in source form
apart from licence considerations, this is promoted within
EChem++ by . . .
modular, object-oriented design
extendability
free availability on the internet
Computer Simulation of Molecular Electrochemistry Experiments—A Rational Approach – p.18/21
Conclusion: The EChem++ Simulation Package
simulation software for molecular electrochemistry
code based on object-oriented methods
provides framework for extensions to additionalprocesses, conditions, etc.
already in present state some improvements aboveexisting software
open-source character
Computer Simulation of Molecular Electrochemistry Experiments—A Rational Approach – p.19/21
Invitation
download, test, report, contribute
http://echempp.sourceforge.net
Computer Simulation of Molecular Electrochemistry Experiments—A Rational Approach – p.20/21
Acknowledgements
financial support:Deutsche Forschungsgemeinschaft
co-operation:excitation function: L. Rajendrangraphical user interface: A. Millers
Computer Simulation of Molecular Electrochemistry Experiments—A Rational Approach – p.21/21