Closed archermarx closed 4 weeks ago
I think generally these changes are a trend in the right direction. My main concern is that removing the multiple neutral infrastructure will make it harder to properly implement charge exchange in the future. However, if we are not terrible concerned about this functionality, I think the performance and reability improvement is worth it
@DecBrick that's a good point, but I think there are better ways we can implement it. I am leaning toward a future version where we treat the neutrals kinetically (either like Hall2De or using particles)
This PR rearranges the code internals for very slightly better performance (1-2%), but more importantly better separates the electron part of the solver loop from the ion part of the solver loop. This architectural change will help facilitate later changes on the ion side without needing to mess with the electron part at all.
Most notably, this PR makes it so now, electron functions do not use the heavy species state matrix
U
. This means that the details about how this is laid out are left to the ions. The electrons now just require thatne
,ni
,niui
,ji
, andavg_Z
in thecache
struct are set.Additionally, I have made some changes to the
Config
structtransition_function
option inConfig
. Replaced withtransition_length
which can be specified either as aFloat64
in meters or as a Unitful length. The reason behind this change is that nobody uses the alternate transition functions, and it lets us remove one specialization on theConfig
struct, potentially reducing compile times.solve_background_neutrals
option. This option is redundant, and setting the back-pressure to zero (the default) accomplishes the same thingFinally, I removed the infrastructure for multiple neutral fluids. This was vestigial anyway, and I have better ideas for how we might want to handle this in the future.