-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Galvanostatic mode #131
Comments
Just tried out your MWE, it works. Just a hint: with recent SciML versions, it is sufficient to use OrdinaryDiffEqBDF instead of the whole of DifferentialEquations. Will take some time to think about galvanostatic (next week is very busy...) |
Thank you; for now, I probably can make it work just by assigning another species for the voltage and then look for solutions satisfying Laplace equation with homogenous Neumann b. c. at the center and a properly chosen Dirichlet b. c. at the external boundary (this should yield spatially constant solutions). This is of course a bit redundant since it doubles the storage requirements, but probably still feasible in 1D. Best, |
Just a quick update: I did manage to find a temporary solution/workaround along the lines of what I've explained above; namely, I've assigned another species index to the voltage and formulated the PDE for voltage as a Laplace equation with a zero Neumann boundary condition at one end. At the outer boundary, I used |
@j-fu on a somehow related note to the above discussion, I am now trying to expand the above functionality. I am wondering, whether it is possible access global solution vector from within the standard functions such as Thank you and best regards, Jan |
Conceptually, there is no way to access the global solution vector from the callbacks. However you could trick around this by having a SystemState (since v2.0) as part of the userdata. The drawback is that there will be no differentiation against the corresponding DOFs, in the best case resulting in detoriation of Newton convergence to linear. The generic operator has been created to handle this situation in a consistent manner. I know it is not well documented, so if you have a minimal example covering the situation you need I would take the occasion to update the docs. Also, there is the possibility to detect the sparsity pattern automatically. This step may take some time, but is needed only once in a simulation. |
Thank you, I will try to come up with a useful example; for now, it puzzles me a bit that I do not get the same solutions if I just try to rewrite the reaction term as a generic operator. At this point, I do not yet try to access dofs in non-adjacent nodes, I just try to come up with an equivalent formulation in terms of a generic operator, but to no avail. I will dig into this some more and then provide a minimal example. Ultimately, what I'd like to achieve is the following: above, I've mentioned a workaround that enabled me to simulate the galvanostatic mode by essentially looking for constant (in space) solutions of the Laplace equation. Now, I also wanted to implement the term simulating the double-layer. In a simplified form, the governing equation is the following: where For the voltage boundary conditions, I set up homogenous Neumann boundary conditions to enforce uniform spatial profiles and I tried using stiff solvers (Rosenbrock23, Rodas4, Rodas4P etc.) to handle the system. For now, I obtain a uniform profile of voltage if I manually select a constant surface concentration in Best, |
@j-fu, in the attached jupyter notebook, I have implemented a MWE that displays the difference between implementing the same equation using the I am also attaching the manifest and project files. Please let me know if everything works as expected and whether anything should be changed. Regards, |
Ok, I tried to run it, but I get "UndefVarError: Generally it would be more convenient for me to share code with a git repo, and I also have a slight preference for pluto notebooks. |
I have shared with you the project's git repo which remains private for now. The selected notebook can be found under For convenience, I also include the zip archive here: (it is beneficial to install IJulia package to the global Julia environment if working with Jupyter notebooks). Since I have not used Pluto before, I can also prepare some scripts in case the above does not work). |
Continue discussion from #119
The text was updated successfully, but these errors were encountered: