Title: | Electrochemical Reactions Simulation |
---|---|
Description: | Digital simulation of electrochemical processes. Each function allows for implicit and explicit solution of the differential equation using methods like Euler, Backwards implicit, Runge Kutta 4, Crank Nicholson and Backward differentiation formula as well as different number of points for derivative approximation. Several electrochemical processes can be simulated such as: Chronoamperometry, Potential Step, Linear Sweep, Cyclic Voltammetry, Cyclic Voltammetry with electrochemical reaction followed by chemical reaction (EC mechanism) and CV with two following electrochemical reaction (EE mechanism). In update 1.1.0 has been added a general purpose CV function that allow to simulate up to 4 EE mechanism combined with chemical reaction for each species.Update 1.2.0 improved the accuracy of the measurements and allow personalized data resolution for simulation. Bibliography regarding this methods can be found in the following texts. Dieter Britz, Jorg Strutwolf (2016) <ISBN:978-3-319-30292-8>. Allen J. Bard, Larry R. Faulkner (2000) <ISBN:978-0-471-04372-0>. |
Authors: | Federico Maria Vivaldi [aut, cre] |
Maintainer: | Federico Maria Vivaldi <[email protected]> |
License: | GPL-3 |
Version: | 1.2.0 |
Built: | 2024-11-11 03:28:32 UTC |
Source: | https://github.com/federicoviv/elechemr |
Return a graph I vs t of the electrochemical process
ChronAmp( Co = 0.001, exptime = 1, Dx = 1e-05, Dm = 0.45, Temp = 298.15, n = 1, Area = 1, DerApprox = 2, l = 100, errCheck = FALSE, Method = "Euler" )
ChronAmp( Co = 0.001, exptime = 1, Dx = 1e-05, Dm = 0.45, Temp = 298.15, n = 1, Area = 1, DerApprox = 2, l = 100, errCheck = FALSE, Method = "Euler" )
Co |
bulk concentration expressed in Molar |
exptime |
experimental time to be simulated expressed in seconds |
Dx |
diffusion coefficient expressed in cm^2/s |
Dm |
simulation parameter, maximum 0.5 for explicit methods |
Temp |
temperature in kelvin |
n |
number of electrons involved in the process |
Area |
area of the electrode expressed in cm^2 |
DerApprox |
number of point for the approximation of the first derivative |
l |
number of time steps of the simulation |
errCheck |
if true the function returns a list with parameters for CottrCheck function |
Method |
method to be used for the simulation = "Euler" "BI" "RK4" "CN" "BDF" |
if errCheck == F a graph I vs t, if errCheck == T a list
ChronAmp(Co = 0.001, exptime = 1, DerApprox = 2, Dm = 0.45, errCheck = FALSE, Method = "Euler")
ChronAmp(Co = 0.001, exptime = 1, DerApprox = 2, Dm = 0.45, errCheck = FALSE, Method = "Euler")
Return a graph G/Gcot vs t of the electrochemical process
CottrCheck(Elefun)
CottrCheck(Elefun)
Elefun |
the function to be checked = ChronAmp, PotStep |
A graph G/Gcot vs t for the simulation data selected
CottrCheck(ChronAmp(errCheck = TRUE, Method = "BI"))
CottrCheck(ChronAmp(errCheck = TRUE, Method = "BI"))
Return a graph I vs E of the electrochemical process
CV( Co = 0.001, Dx = 1e-05, Eo = 0, Dm = 0.45, Vi = 0.3, Vf = -0.3, Vs = 0.001, ko = 0.01, alpha = 0.5, Temp = 298.15, n = 1, Area = 1, l = 100, DerApprox = 2, errCheck = FALSE, Method = "Euler" )
CV( Co = 0.001, Dx = 1e-05, Eo = 0, Dm = 0.45, Vi = 0.3, Vf = -0.3, Vs = 0.001, ko = 0.01, alpha = 0.5, Temp = 298.15, n = 1, Area = 1, l = 100, DerApprox = 2, errCheck = FALSE, Method = "Euler" )
Co |
bulk concentration expressed in Molar |
Dx |
diffusion coefficient expressed in cm^2/s |
Eo |
reduction potential of the species expressed in Volts |
Dm |
simulation parameter, maximum 0.5 for explicit methods |
Vi |
initial potential of the sweep expressed in Volts |
Vf |
final potential of the sweepexpressed in Volts |
Vs |
potential scan rate of the simulation expressed in V/s |
ko |
heterogeneous electron transfer rate constant expressed in m/s |
alpha |
charge transfer coefficient |
Temp |
temperature in kelvin |
n |
number of electrons involved in the process |
Area |
area of the electrode expressed in cm^2 |
l |
number of time steps of the simulation |
DerApprox |
number of point for the approximation of the first derivative |
errCheck |
if true the function returns a list with parameters for CottrCheck function |
Method |
method to be used for the simulation = "Euler" "BI" "RK4" "CN" "BDF" |
if errCheck == F a graph I vs E, if errCheck == T a list
CV(Co = 0.001, DerApprox = 2, Dm = 0.45, errCheck = FALSE, Method = "Euler")
CV(Co = 0.001, DerApprox = 2, Dm = 0.45, errCheck = FALSE, Method = "Euler")
Return a graph I vs E of the electrochemical process
CVEC( Co = 0.001, Dx = 1e-05, Eo = 0, Dm = 0.45, Vi = 0.3, Vf = -0.3, Vs = 0.001, ko = 0.01, kc = 0.001, l = 100, alpha = 0.5, Temp = 298.15, n = 1, Area = 1, DerApprox = 2, errCheck = FALSE, Method = "Euler" )
CVEC( Co = 0.001, Dx = 1e-05, Eo = 0, Dm = 0.45, Vi = 0.3, Vf = -0.3, Vs = 0.001, ko = 0.01, kc = 0.001, l = 100, alpha = 0.5, Temp = 298.15, n = 1, Area = 1, DerApprox = 2, errCheck = FALSE, Method = "Euler" )
Co |
bulk concentration expressed in Molar |
Dx |
diffusion coefficient expressed in cm^2/s |
Eo |
reduction potential of the species expressed in Volt |
Dm |
simulation parameter, maximum 0.5 for explicit methods |
Vi |
initial potential of the sweep expressed in Volt |
Vf |
final potential of the sweep expressed in Volt |
Vs |
potential scan rate of the simulation expressed in V/s |
ko |
heterogeneous electron transfer rate constant expressed in m/s |
kc |
rate constant of the reaction Red -> C expressed in s^-1 |
l |
number of time steps of the simulation |
alpha |
charge transfer coefficient |
Temp |
temperature in kelvin |
n |
number of electrons involved in the process |
Area |
area of the electrode expressed in cm^2 |
DerApprox |
number of point for the approximation of the first derivative |
errCheck |
if true the function returns a list with parameters for CottrCheck function |
Method |
method to be used for the simulation = "Euler" "BI" "RK4" "CN "BDF" |
if errCheck == F a graph I vs E, if errCheck == T a list
CVEC(Co = 0.001, DerApprox = 2, Dm = 0.45, kc = 0.00001, errCheck = FALSE, Method = "Euler")
CVEC(Co = 0.001, DerApprox = 2, Dm = 0.45, kc = 0.00001, errCheck = FALSE, Method = "Euler")
Return a graph I vs E of the electrochemical process
CVEE( Co = 0.001, Dx1 = 1e-05, Eo1 = 0, Vi = 0.3, Vf = -0.3, Vs = 0.001, ko1 = 0.01, alpha1 = 0.5, Dred = 1e-05, Dred2 = 1e-05, Eo2 = 0, ko2 = 0.01, alpha2 = 0.5, Dm = 0.45, l = 100, Temp = 298.15, n = 1, Area = 1, DerApprox = 2, errCheck = FALSE, Method = "Euler" )
CVEE( Co = 0.001, Dx1 = 1e-05, Eo1 = 0, Vi = 0.3, Vf = -0.3, Vs = 0.001, ko1 = 0.01, alpha1 = 0.5, Dred = 1e-05, Dred2 = 1e-05, Eo2 = 0, ko2 = 0.01, alpha2 = 0.5, Dm = 0.45, l = 100, Temp = 298.15, n = 1, Area = 1, DerApprox = 2, errCheck = FALSE, Method = "Euler" )
Co |
bulk concentration expressed in Molar |
Dx1 |
diffusion coefficient of the oxidized species expressed in cm^2/s |
Eo1 |
reduction potential of the first electrochemical reaction expressed in Volt |
Vi |
initial potential of the sweep expressed in Volt |
Vf |
final potential of the sweep expressed in Volt |
Vs |
potential scan rate of the simulation expressed in V/s |
ko1 |
heterogeneous electron transfer rate constant of the first electrochemical reaction expressed in m/s |
alpha1 |
charge transfer coefficient of the first electrochemical reaction |
Dred |
diffusion coefficient of the first reduced species expressed in cm^2/s |
Dred2 |
diffusion coefficient of the second reduced species expressed in cm^2/s |
Eo2 |
reduction potential of the second electrochemical reaction expressed in Volt |
ko2 |
heterogeneous electron transfer rate constant of the second electrochemical reaction expressed in m/s |
alpha2 |
charge transfer coefficient of the second electrochemical reaction |
Dm |
simulation parameter, maximum 0.5 for explicit methods |
l |
number of time steps of the simulation |
Temp |
temperature in kelvin |
n |
number of electrons involved in the process |
Area |
area of the electrode expressed in cm^2 |
DerApprox |
number of point for the approximation of the first derivative |
errCheck |
if true the function returns a list with parameters for CottrCheck function |
Method |
method to be used for the simulation = "Euler" "BI" "RK4" "CN "BDF" |
if errCheck == F a graph I vs E, if errCheck == T a list
CVEE(Co = 0.001, DerApprox = 2, Dm = 0.45, errCheck = FALSE, Method = "Euler") CVEE(Co = 0.001, Eo2 = -0.15, Dm = 0.45)
CVEE(Co = 0.001, DerApprox = 2, Dm = 0.45, errCheck = FALSE, Method = "Euler") CVEE(Co = 0.001, Eo2 = -0.15, Dm = 0.45)
Return a the derivative of the concentration profile simulated
Derv( npoints = 2, h, Ox, mode = "Forward", Derivative = "First", CoefMat = FALSE )
Derv( npoints = 2, h, Ox, mode = "Forward", Derivative = "First", CoefMat = FALSE )
npoints |
number of points to be used for the derivative |
h |
space for the finite difference |
Ox |
data upon the derivative is calculated |
mode |
"Forward" or "Backward" the derivative will be calculated for the npoints |
Derivative |
"First" or "Second" derivative to calculate |
CoefMat |
if T return the derivative coefficient matrix for selected derivative |
a vector with the derivative requested or the coefficient of such derivative
Derv(npoints = 2, h = 0.13, Ox = matrix(c(1,2), nrow = 1), mode = "Forward", Derivative = "First")
Derv(npoints = 2, h = 0.13, Ox = matrix(c(1,2), nrow = 1), mode = "Forward", Derivative = "First")
Return a graph I vs E of the electrochemical process, up to 4 EE mechanisms and CE mechanisms can be simulated
Gen_CV( Co = 0.001, Cred = 0, kco = 0, Dx1 = 1e-05, Eo1 = 0, kc1 = 0, Vi = 0.3, Vf = -0.3, Vs = 0.001, ko1 = 0.01, alpha1 = 0.5, Dred = 1e-05, Dred2 = 1e-05, Eo2 = 0, kc2 = 0, ko2 = 0, alpha2 = 0.5, Dm = 0.45, Dred3 = 1e-05, Eo3 = 0, kc3 = 0, ko3 = 0, alpha3 = 0.5, Dred4 = 1e-05, Eo4 = 0, kc4 = 0, ko4 = 0, alpha4 = 0.5, Temp = 298.15, n = 1, Area = 1, l = 100, DerApprox = 2, errCheck = FALSE, Method = "Euler" )
Gen_CV( Co = 0.001, Cred = 0, kco = 0, Dx1 = 1e-05, Eo1 = 0, kc1 = 0, Vi = 0.3, Vf = -0.3, Vs = 0.001, ko1 = 0.01, alpha1 = 0.5, Dred = 1e-05, Dred2 = 1e-05, Eo2 = 0, kc2 = 0, ko2 = 0, alpha2 = 0.5, Dm = 0.45, Dred3 = 1e-05, Eo3 = 0, kc3 = 0, ko3 = 0, alpha3 = 0.5, Dred4 = 1e-05, Eo4 = 0, kc4 = 0, ko4 = 0, alpha4 = 0.5, Temp = 298.15, n = 1, Area = 1, l = 100, DerApprox = 2, errCheck = FALSE, Method = "Euler" )
Co |
bulk concentration oxidated speciesexpressed in Molar |
Cred |
bulk concentration of reduced species expressed in Molar |
kco |
Chemical rate constant for Ox Species expressed in s^-1 |
Dx1 |
diffusion coefficient of the oxidized species expressed in cm^2/s |
Eo1 |
reduction potential of the first electrochemical reaction expressed in Volt |
kc1 |
Chemical rate constant for Red Species expressed in s^-1 |
Vi |
initial potential of the sweep expressed in Volt |
Vf |
final potential of the sweep expressed in Volt |
Vs |
potential scan rate of the simulation expressed in V/s |
ko1 |
heterogeneous electron transfer rate constant of the first electrochemical reaction expressed in m/s |
alpha1 |
charge transfer coefficient of the first electrochemical reaction |
Dred |
diffusion coefficient of the first reduced species expressed in cm^2/S |
Dred2 |
diffusion coefficient of the second reduced species expressed in cm^2/s |
Eo2 |
reduction potential of the second electrochemical reaction expressed in Volt |
kc2 |
Chemical rate constant for second Red Species expressed in s^-1 |
ko2 |
heterogeneous electron transfer rate constant of the second electrochemical reaction expressed in m/s |
alpha2 |
charge transfer coefficient of the second electrochemical reaction |
Dm |
simulation parameter, maximum 0.5 for explicit methods |
Dred3 |
diffusion coefficient of the third reduced species expressed in cm^2/s |
Eo3 |
reduction potential of the third electrochemical reaction expressed in Volt |
kc3 |
Chemical rate constant for third Red Species expressed in s^-1 |
ko3 |
heterogeneous electron transfer rate constant of the third electrochemical reaction expressed in m/s |
alpha3 |
charge transfer coefficient of the third electrochemical reaction |
Dred4 |
diffusion coefficient of the fourth reduced species cm^2/s |
Eo4 |
reduction potential of the fourth electrochemical reaction expressed in Volt |
kc4 |
Chemical rate constant for fourth Red Species expressed in s^-1 |
ko4 |
heterogeneous electron transfer rate constant of the fourth electrochemical reaction expressed in m/s |
alpha4 |
charge transfer coefficient of the fourth electrochemical reaction |
Temp |
temperature in kelvin |
n |
number of electrons involved in the process |
Area |
area of the electrode expressed in cm^2 |
l |
number of time steps of the simulation |
DerApprox |
number of point for the approximation of the first derivative |
errCheck |
if true the function returns a list with parameters for CottrCheck function |
Method |
method to be used for the simulation = "Euler" "BI" "RK4" "CN "BDF" |
if errCheck == F a graph I vs E, if errCheck == T a list
Gen_CV(Co = 0.001, DerApprox = 2, Dm = 0.45, errCheck = FALSE, Method = "Euler") Gen_CV(Co = 0.001, Eo2 = -0.15, Dm = 0.45, kc1 = 0.0001)
Gen_CV(Co = 0.001, DerApprox = 2, Dm = 0.45, errCheck = FALSE, Method = "Euler") Gen_CV(Co = 0.001, Eo2 = -0.15, Dm = 0.45, kc1 = 0.0001)
Returns the inverse matrix of the selected one
invMat(A)
invMat(A)
A |
matrix to be inverted |
inverse matrix of the selected
invMat(A = matrix(c(1,2,6,14), nrow = 2))
invMat(A = matrix(c(1,2,6,14), nrow = 2))
Return a graph I vs E of the electrochemical process
LinSwp( Co = 0.001, Dx = 1e-05, Eo = 0, Dm = 0.45, Vi = 0.3, Vf = -0.3, Vs = 0.001, ko = 0.01, alpha = 0.5, Temp = 298.15, n = 1, Area = 1, l = 100, DerApprox = 2, errCheck = FALSE, Method = "Euler" )
LinSwp( Co = 0.001, Dx = 1e-05, Eo = 0, Dm = 0.45, Vi = 0.3, Vf = -0.3, Vs = 0.001, ko = 0.01, alpha = 0.5, Temp = 298.15, n = 1, Area = 1, l = 100, DerApprox = 2, errCheck = FALSE, Method = "Euler" )
Co |
bulk concentration expressed in Molar |
Dx |
diffusion coefficient expressed in cm^2/s |
Eo |
reduction potential of the species expressed in Volt |
Dm |
simulation parameter, maximum 0.5 for explicit methods |
Vi |
initial potential of the sweep expressed in Volt |
Vf |
final potential of the sweep expressed in Volt |
Vs |
potential scan rate of the simulation expressed in V/s |
ko |
heterogeneous electron transfer rate constant expressed in m/s |
alpha |
charge transfer coefficient |
Temp |
temperature in kelvin |
n |
number of electrons involved in the process |
Area |
area of the electrode expressed in cm^2 |
l |
number of time steps of the simulation |
DerApprox |
number of point for the approximation of the first derivative |
errCheck |
if true the function returns a list with parameters for CottrCheck function |
Method |
method to be used for the simulation = "Euler" "BI" "RK4" "CN" "BDF" |
if errCheck == F a graph I vs E, if errCheck == T a list
LinSwp(Co = 0.001, Dm =0.45, DerApprox = 2, errCheck = FALSE, Method = "Euler")
LinSwp(Co = 0.001, Dm =0.45, DerApprox = 2, errCheck = FALSE, Method = "Euler")
Return a matrix ixj filled with 1 value
OneMat(i, j = i)
OneMat(i, j = i)
i |
number of rows |
j |
number of columns |
a matrix of dimention ixj filled with 1 value
OneMat(2,2)
OneMat(2,2)
Returns a list with the parameters necessary for the simulation
ParCall( Fun, n., Temp., Dx1., eta., exptime., Eo1., ko1., ko2., kc., Dm., Vf., Vi., Vs., alpha1., Eo2., Dred1., Dred2., alpha2., Dred3., Dred4., ko3., ko4., kco., kc1., kc2., kc3., kc4., alpha3., alpha4., Eo3., Eo4., l. )
ParCall( Fun, n., Temp., Dx1., eta., exptime., Eo1., ko1., ko2., kc., Dm., Vf., Vi., Vs., alpha1., Eo2., Dred1., Dred2., alpha2., Dred3., Dred4., ko3., ko4., kco., kc1., kc2., kc3., kc4., alpha3., alpha4., Eo3., Eo4., l. )
Fun |
Name of the function this function is called to. Must be a string. |
n. |
Number of electrons |
Temp. |
Temperature for the simulation |
Dx1. |
Diffusion coefficient of species One |
eta. |
OverPotential for potential step |
exptime. |
experimental time for the simulation |
Eo1. |
reduction potential of the first electrochemical reaction |
ko1. |
heterogeneous electron transfer rate constant of the first electrochemical reaction |
ko2. |
heterogeneous electron transfer rate constant of the second electrochemical reaction |
kc. |
Chemical rate constant for first Ox Species, used in simulation with just one species |
Dm. |
Simulation parameter, maximum 0.5 for explicit methods |
Vf. |
Final potential of the sweep |
Vi. |
Initial potential of the sweep |
Vs. |
Scan rate of the simulation |
alpha1. |
charge transfer coefficient of the first electrochemical reaction |
Eo2. |
reduction potential of the second electrochemical reaction |
Dred1. |
diffusion coefficient of the first reduced species |
Dred2. |
diffusion coefficient of the second reduced species |
alpha2. |
charge transfer coefficient of the second electrochemical reaction |
Dred3. |
diffusion coefficient of the third reduced species |
Dred4. |
diffusion coefficient of the fourth reduced species |
ko3. |
heterogeneous electron transfer rate constant of the third electrochemical reaction |
ko4. |
heterogeneous electron transfer rate constant of the fourth electrochemical reaction |
kco. |
Chemical rate constant for first Ox Species |
kc1. |
Chemical rate constant for first Red Species |
kc2. |
Chemical rate constant for second Red Species |
kc3. |
Chemical rate constant for third Red Species |
kc4. |
Chemical rate constant for fourth Red Species |
alpha3. |
charge transfer coefficient of the third electrochemical reaction |
alpha4. |
charge transfer coefficient of the fourth electrochemical reaction |
Eo3. |
reduction potential of the third electrochemical reaction |
Eo4. |
reduction potential of the fourth electrochemical reaction |
l. |
numer of time steps |
inverse matrix of the selected
ParCall("ChronAmp", n. = 1, Temp. = 298, Dx1. = 0.0001, exptime. = 1, Dm. = 0.45, l. = 100)
ParCall("ChronAmp", n. = 1, Temp. = 298, Dx1. = 0.0001, exptime. = 1, Dm. = 0.45, l. = 100)
Return a graph I vs t of the electrochemical process
PotStep( Co = 0.001, exptime = 1, Dx = 1e-05, Dm = 0.45, eta = 0, Temp = 298.15, n = 1, Area = 1, l = 100, DerApprox = 2, errCheck = FALSE, Method = "Euler" )
PotStep( Co = 0.001, exptime = 1, Dx = 1e-05, Dm = 0.45, eta = 0, Temp = 298.15, n = 1, Area = 1, l = 100, DerApprox = 2, errCheck = FALSE, Method = "Euler" )
Co |
bulk concentration expressed in Molar |
exptime |
experimental time to be simulated expressed in seconds |
Dx |
diffusion coefficient expressed in cm^2/s |
Dm |
simulation parameter, maximum 0.5 for explicit methods |
eta |
overpotential of the step expressed in Volt |
Temp |
temperature in kelvin |
n |
number of electrons involved in the process |
Area |
area of the electrode expressed in cm^2 |
l |
number of time steps of the simulation |
DerApprox |
number of point for the approximation of the first derivative |
errCheck |
if true the function returns a list with parameters for CottrCheck function |
Method |
method to be used for the simulation = "Euler" "BI" "RK4" "CN" "BDF" |
if errCheck == F a graph I vs t, if errCheck == T a list
PotStep(Co = 0.001, exptime = 1, Dm =0.45, DerApprox = 2, errCheck = FALSE, Method = "Euler")
PotStep(Co = 0.001, exptime = 1, Dm =0.45, DerApprox = 2, errCheck = FALSE, Method = "Euler")
Return a matrix ixj filled with 0 value
ZeroMat(i, j = i)
ZeroMat(i, j = i)
i |
number of rows |
j |
number of columns |
a matrix of dimention ixj filled with 1 value
ZeroMat(2,2)
ZeroMat(2,2)