Particle injector for boundary inflow - #363
Conversation
|
I'm now thinking |
germasch
left a comment
There was a problem hiding this comment.
LGTM -- I did go through it commit by commit (and, as usual, nice job breaking it up). Still couldn't say that I followed 100% of it, but I only have two minor concerns:
- The .999 to keep it away from the right boundary. I hit similar issues before in the particle boundary -- I think I used (1 - 1e-6) at that point. I guess neither is likely to cause any noticeable issues, though.
- You templated some injected particle generator class by the number of particles -- I don't think I saw why that's a template arg rather than just a regular argument.
|
What kind of issue, noticeable or not, would you anticipate from the .999? It does have to be in that cell, so 1.0 doesn't work. As for the templated count... yeah, that was just me doing the first thing that came to mind. I already have a note to fix that in the next PR I'll submit. |
the functionality of `Inflow` will be superseded by `InjectorBoundaryInflow`, which will be tested in test_injector_boundary_inflow
redoing inflow
so it "works" in debug mode
edfec0b to
cfd512c
Compare
germasch
left a comment
There was a problem hiding this comment.
Well, this was nicely split out, so (relatively) easy to follow.
Looks good, though I came away with two questions:
You used a .999 factor to prevent particles from being on the edge -- I've done similar before, though I guess I'd add another two or so 9's there which should still be enough to avoid hitting the boundary. .999 is like a 0.1% error, which is small but might still show up under certain circumstances (?, or not...)
I saw you adding current through the boundary based on how much charge made it into the domain -- but I feel like this is missing something, as it should also matter how far into the domain the particles made it -- some of their charge cloud might still be outside and hence not have flown through the boundary. Or maybe the b.c.s are still wall-like, so that outside part would still be inside? I'm just kinda confused, I'm rather sure you know those nuances and are testing things accordingly...
|
Whoops, clearly I reviewed the wrong PR :( |
Adds
InjectorBoundaryInflow, an injector (to be passed as theinject_particlesargument ofmakePscIntegrator) that injects particles at a boundary as if from a population of particles just beyond the edge. The injector has the following features:The injector currently has a few limitations, however:
Also note that the injector is not responsible for removing particles that exit the domain. This injector should be paired with a boundary condition of
BND_PRT_OPENthat removes exiting particles, although this functionality does not currently exist.See
test_injector_boundary_inflowfor example uses.