Open rkurchin opened 2 years ago
hi!, i saw your package during juliacon 2022. i think i can help with this, but i need to get some familiarity on how the code works
Awesome, happy to discuss! And let me know if you have questions about the codebase, too, I did some cleanup before registering so there are semi-decent docstrings/comments, but obviously the only docs that really exist right now are the readme...
on the unitful support, maybe you could do a function like this?
import Unitful
using Unitful: @u_str
V,T = nounits_vt(V,T)
function nounits_vt(_V,_T)
V = nounits_v(V)
T = nounits_t(T)
return V,T
end
nounits_t(T::Real) = T
nounits_v(T::Real) = T
nounits_t(T::Unitful.Temperature) = Unitful.ustrip(Unitful.uconvert(u"K",T))
nounits_t(T::Unitful.Energy) = Unitful.ustrip(Unitful.uconvert(u"J",T))/1.380649e-23 #kT
nounits_v(V::Unitful.Voltage) = Unitful.ustrip(Unitful.uconvert(u"Volt",T))
that, given a normal number, returns the identity, but on unitful quantities it will convert to the correct ones?
and then, on each kinetic model, at the start:
function rate_constant(V_app, bv::ButlerVolmer, ::Val{true}; T = 298)
V_app,T = nounits_vt(V_app,T)
exp_arg = (bv.α .* V_app) / (kB * T)
bv.A .* exp.(exp_arg)
end
@rkurchin is ok if i make a PR this weekend?
Sure, go for it. I’m not totally clear on what you’re describing above, so seeing it in action will probably help :)
————————————— Rachel C. Kurchin, PhD Incoming Assistant Research Professor Carnegie Mellon Materials Science and Engineering https://rkurchin.github.io On Jul 29, 2022, 8:04 PM -0400, Andrés Riedemann @.***>, wrote:
@rkurchin is ok if i make a PR this weekend? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>
Could be kind of neat to allow user to feed in either T or kT, or energies in other units than eV, etc...wouldn't want to clutter up interface though...