Skip to content

Python issues on high kinetics while simulating ECcat mechanism #6

@shuayliu

Description

@shuayliu

Hey, I found this excellent package simulating the cyclic voltammetry and try to use it in my projects. When I simulated the ECcat mechanism with high homogeneous kinetics, this programme returns std::badloc error. I tried to solve it myself, but I failed.

Here is the codes I use:

import pyecsim as ecs
import matplotlib.pyplot as plt

simECr = ecs.Simulation(True)

P = ecs.Species('P', 1.0, 1.0e-9) # name, concentration [mol/m3], diffusion coefficient [m2/s]
Q = ecs.Species('Q', 0.0, 1.0e-9)

A = ecs.Species('A', 1.0, 1.0e-9)
B = ecs.Species('B', 0.0, 1.0e-9)
# C = ecs.Species('C', 0.0, 1.0e-9)

rdx1 = ecs.Redox(P, Q, 1, 0.0, 1, 0.5).enable() # ox, red, n, E_0 [V], k_e [m/s], alpha
simECr.sys.addRedox( rdx1 )

rxn1 = ecs.Reaction(A, Q, B, P, 300000, 0).enable() # reactant1, reactant2, product1, product2, k_f, k_b
simECr.sys.addReaction( rxn1 )

simECr.el.disk(1.0e-3) # radius [m]
simECr.exper.setScanPotentials(0.5, [-0.5], 0.5) # potentials [V]: initial, [0 or more vertices], final
simECr.exper.setScanRate(0.05) # scan rate [V/s]

plt.plot(*simECr.run())

And the error message :

---------------------------------------------------------------------------
MemoryError                               Traceback (most recent call last)
<ipython-input-6-c5b7c4bcb650> in <module>
      1 # [potential, current] = simECr.run()
      2 # rxn1.setKf(2.3e3)
----> 3 plt.plot(*simECr.run())

MemoryError: std::bad_alloc

my working environment: CentOS 7.9, JupyterLab 3.2.9, Python 3.6.8, the pyecsim package was installed through PyPi.

I succeeded using these parameters on your website version, so I guess there might be something wrong with the python version.

Thanks a lot!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions