Skip to content
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

explicit ODE solver #137

Open
sezerh24 opened this issue Oct 28, 2024 · 6 comments
Open

explicit ODE solver #137

sezerh24 opened this issue Oct 28, 2024 · 6 comments

Comments

@sezerh24
Copy link

I am able to use different implicit ODE solvers and they works well most of the times with my Solid Oxide Fuel Cell (SOFC) model developed in VoronoiFVM. I would like to simulate the impedance of SOFC. I wanted to try some explicit solvers. I have found that trixi.jl is using RDPK3SpFSAL49() ODE solver. I have tried to use it for VoronoiFVM, however, it did not work.
is it possible to use any explicit ODE solvers in julia differential equations library for voronoifvm?
Thank you

@j-fu
Copy link
Member

j-fu commented Oct 28, 2024

Dear Hayri,
I don't think explicit solvers will work.

However, VoronoiFVM has built-in impedance calculation support, see examples 150 and 151. It uses frequency domain calculations based on linearization using automatic differentiation. This means for each frequency, we have to perform just one linear solution of a system in complex numbers.

@sezerh24
Copy link
Author

Thank you Dr. Fuhrmann. I have tried to use the impedance examples, however, in the impedance examples, the steady state solution is obtained by: steadystate = solve(sys). when i try this in my code, it gives an error: "trying to assemble NaN". But the same code works when I use ImplicitEuler() ODE solver. I tried to use the steady state solution obtained from ImplicitEuler(), however, then, in the measurement_derivative, it gives an error: MethodError: no method matching values(::Adjoint{Float64, Vector{Float64}}). measurement_derivative has three input arguments. the argument U0 which is supposed to be my steady state solution does not have the same type with the U0 from steadystate = solve(sys). The typeof(steadystate) is VoronoiFVM.SparseSolutionArray{Float64, Int32}, the type of steady state solution that I obtained from ImplicitEuler(), typeof(U0): Adjoint{Float64, Vector{Float64}}. so, the measurement_derivative gives an error because of the type.. There are different ways to calculate the impedance, however, I was excited to try the impedance calculations embedded in VoronoiFVM... and compare with the other methods. I usually use the method described by Bessler, here: Bessler, W.G., 2007. Rapid impedance modeling via potential step and current relaxation simulations. Journal of The Electrochemical Society, 154(11), p.B1186.

@j-fu
Copy link
Member

j-fu commented Oct 30, 2024

Ah, basically you identified a bug, I think this can be easily fixed.
Also, may be adding some initial damping to the steady state solve might help.

I am really curious to see the comparison with the Bessler paper.

@j-fu
Copy link
Member

j-fu commented Oct 30, 2024

For using the solution from the ODE solver you need to reshape it for the system before further use in VoronoiFVM: https://wias-pdelib.github.io/VoronoiFVM.jl/stable/system/#Base.reshape-Tuple%7BAbstractVector,%20VoronoiFVM.AbstractSystem%7D

You can als use the built-in implicit Euler by passing e.g, times=[0.0,100.0] to the solve argument. I update the impedance example to show how this can work, also I indeed need to fix some stuff.

@sezerh24
Copy link
Author

sezerh24 commented Nov 1, 2024

Thank you Dr. Fuhrmann. I will implement the new modification. And hopefully be able to compare the Bessler impedance with Impedance embedded inside VoronoiFVM.jl. I will share the results with you.

@j-fu
Copy link
Member

j-fu commented Nov 1, 2024

Please be aware that for this you will need to update to version 2.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants