Skip to content

Conversation

@JamesMcClung
Copy link
Collaborator

Adds InjectorBoundaryInflow, an injector (to be passed as the inject_particles argument of makePscIntegrator) that injects particles at a boundary as if from a population of particles just beyond the edge. The injector has the following features:

  1. The imaginary particle population can, in principle, have any time-independent, spatially-varying velocity distribution
  2. The continuity and gauss checks are guaranteed to pass for first-order particles

The injector currently has a few limitations, however:

  1. Only one kind of particle can be injected
  2. The imaginary particle population must be time-independent
  3. The imaginary particle population is hardcoded to have a number density of 1
  4. Injection is only supported at the lower y-bound
  5. Continuity and gauss checks may fail for higher-order particles

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_OPEN that removes exiting particles, although this functionality does not currently exist.

See test_injector_boundary_inflow for example uses.

@JamesMcClung JamesMcClung mentioned this pull request Oct 15, 2025
@JamesMcClung
Copy link
Collaborator Author

I'm now thinking BoundaryInjector might be a nicer name than InjectorBoundaryInflow. Also, my current plan to solve problem 1 is to add a CompositeInjector, which is just a combination of multiple injectors.

Copy link
Contributor

@germasch germasch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@JamesMcClung
Copy link
Collaborator Author

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.

@JamesMcClung JamesMcClung force-pushed the pr/injector-boundary-inflow branch from edfec0b to cfd512c Compare October 24, 2025 18:34
@JamesMcClung JamesMcClung merged commit aaf8bcc into psc-code:main Oct 24, 2025
6 checks passed
@JamesMcClung JamesMcClung deleted the pr/injector-boundary-inflow branch October 24, 2025 18:53
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

Successfully merging this pull request may close these issues.

2 participants