Skip to content
Open
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
03dc3c3
start of PolygonAperture implementation
egstern Oct 22, 2025
229ab2a
PolygonAperture logic added and builds now.
egstern Oct 24, 2025
680b89c
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Oct 24, 2025
a86705d
Update src/elements/PolygonAperture.H
egstern Oct 27, 2025
26da419
Added input file parsing logic.
egstern Nov 3, 2025
42120dc
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 3, 2025
f65dd08
Update src/elements/PolygonAperture.H
cemitch99 Nov 4, 2025
23e0f40
sense of test was incorrect
egstern Nov 4, 2025
55e8bdf
input file example
egstern Nov 4, 2025
6b9a5b8
some problem merging upstream? I don't know what happened
egstern Nov 4, 2025
8461e9d
examples of aperture with offsets and rotations
egstern Nov 4, 2025
e93a870
Rearrange storage of vertices data and min_radius2 so that
egstern Nov 5, 2025
d07b51a
script to plot the action of the aperture
egstern Nov 6, 2025
7aa179b
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 6, 2025
af944bb
tweaks to plot layout
egstern Nov 6, 2025
3d414ef
tweaks to plot layout
egstern Nov 6, 2025
bac3829
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 6, 2025
ef0c3ce
New analysis script that checks tests the results of the aperture, small
egstern Nov 7, 2025
95fe1ee
I don't know why this changed upstream
egstern Nov 7, 2025
b3df98f
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 7, 2025
d91ed97
python bindings for polygon aperture
egstern Nov 11, 2025
7fde375
python example file for the polygon aperture
egstern Nov 11, 2025
9cd397a
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 11, 2025
6a45a42
additional scripts demonstrating absorb, rotate, offset options
egstern Nov 11, 2025
49a3306
add new polygon aperture tests to test suite
egstern Nov 11, 2025
f0b9e18
changed upstream
egstern Nov 11, 2025
c9994d5
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 11, 2025
b84682e
fix python stanza
egstern Nov 11, 2025
800f382
another fix python stanza
egstern Nov 11, 2025
357d067
changed upstream
egstern Nov 11, 2025
2362d07
cleanup comments
egstern Nov 11, 2025
0210e94
Fix type for binding of PolygonAperture class data member definitions.
egstern Nov 11, 2025
dbff31c
Added the element to the examples documentation.
egstern Nov 12, 2025
d83b435
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 12, 2025
d0a11fb
Added Python and Input-file documentation
egstern Nov 13, 2025
8a430aa
upstream changes
egstern Nov 13, 2025
f40e6c0
spelling correction
egstern Nov 13, 2025
b39109d
Update examples/polygon_aperture/README.rst
egstern Nov 14, 2025
7462522
Update src/elements/PolygonAperture.H
egstern Nov 14, 2025
725d351
Update examples/polygon_aperture/README.rst
egstern Nov 14, 2025
926e684
Update docs/source/usage/parameters.rst
egstern Nov 14, 2025
5f6ad3c
add comments describing the particle-in-polygon algorithm
egstern Nov 14, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions examples/polygon_aperture/input_polygon_aperture.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
###############################################################################
Copy link
Member

Choose a reason for hiding this comment

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

Wonderful!

Please add your tests to examples/CMakeLists.txt

# Particle Beam(s)
###############################################################################
beam.npart = 10000
beam.units = static
beam.kin_energy = 800.0
beam.charge = 1.0e-9
beam.particle = proton
beam.distribution = waterbag
beam.lambdaX = 2.0e-3
beam.lambdaY = beam.lambdaX
beam.lambdaT = 0.4
beam.lambdaPx = 4.0e-4
beam.lambdaPy = beam.lambdaPx
beam.lambdaPt = 2.0e-3
beam.muxpx = 0.0
beam.muypy = 0.0
beam.mutpt = 0.0


###############################################################################
# Beamline: lattice elements and segments
###############################################################################
lattice.elements = monitor pa monitor
lattice.nslice = 1

monitor.type = beam_monitor
monitor.backend = h5

pa.type = polygon_aperture
pa.vertices_x = 0.5e-3 0.5e-3 -0.5e-3 -0.5e-3 -1.5e-3 -1.5e-3 -0.5e-3 -0.5e-3 0.5e-3 0.5e-3 1.5e-3 1.5e-3 0.5e-3
pa.vertices_y = 0.5e-3 1.5e-3 1.5e-3 0.5e-3 0.5e-3 -0.5e-3 -0.5e-3 -1.5e-3 -1.5e-3 -0.5e-3 -0.5e-3 0.5e-3 0.5e-3
pa.min_radius2 = 5.0e-7
pa.action = "transmit" # this is the default transmit particles within the polygon
#pa.action = "absorb" # alternatively absorb particles within the polygon

###############################################################################
# Algorithms
###############################################################################
algo.space_charge = false


###############################################################################
# Diagnostics
###############################################################################
diag.slice_step_diagnostics = true
45 changes: 45 additions & 0 deletions examples/polygon_aperture/input_polygon_aperture_absorb.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
###############################################################################
# Particle Beam(s)
###############################################################################
beam.npart = 50000
beam.units = static
beam.kin_energy = 800.0
beam.charge = 1.0e-9
beam.particle = proton
beam.distribution = waterbag
beam.lambdaX = 2.0e-3
beam.lambdaY = beam.lambdaX
beam.lambdaT = 0.4
beam.lambdaPx = 4.0e-4
beam.lambdaPy = beam.lambdaPx
beam.lambdaPt = 2.0e-3
beam.muxpx = 0.0
beam.muypy = 0.0
beam.mutpt = 0.0


###############################################################################
# Beamline: lattice elements and segments
###############################################################################
lattice.elements = monitor pa monitor
lattice.nslice = 1

monitor.type = beam_monitor
monitor.backend = h5

pa.type = polygon_aperture
pa.vertices_x = 0.5e-3 0.5e-3 -0.5e-3 -0.5e-3 -1.5e-3 -1.5e-3 -0.5e-3 -0.5e-3 0.5e-3 0.5e-3 1.5e-3 1.5e-3 0.5e-3
pa.vertices_y = 0.5e-3 1.5e-3 1.5e-3 0.5e-3 0.5e-3 -0.5e-3 -0.5e-3 -1.5e-3 -1.5e-3 -0.5e-3 -0.5e-3 0.5e-3 0.5e-3
pa.min_radius2 = 5.0e-7
pa.action = "absorb" # absorb particles within the polygon

###############################################################################
# Algorithms
###############################################################################
algo.space_charge = false


###############################################################################
# Diagnostics
###############################################################################
diag.slice_step_diagnostics = true
47 changes: 47 additions & 0 deletions examples/polygon_aperture/input_polygon_aperture_absorb_offset.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
###############################################################################
# Particle Beam(s)
###############################################################################
beam.npart = 50000
beam.units = static
beam.kin_energy = 800.0
beam.charge = 1.0e-9
beam.particle = proton
beam.distribution = waterbag
beam.lambdaX = 2.0e-3
beam.lambdaY = beam.lambdaX
beam.lambdaT = 0.4
beam.lambdaPx = 4.0e-4
beam.lambdaPy = beam.lambdaPx
beam.lambdaPt = 2.0e-3
beam.muxpx = 0.0
beam.muypy = 0.0
beam.mutpt = 0.0


###############################################################################
# Beamline: lattice elements and segments
###############################################################################
lattice.elements = monitor pa monitor
lattice.nslice = 1

monitor.type = beam_monitor
monitor.backend = h5

pa.type = polygon_aperture
pa.vertices_x = 0.5e-3 0.5e-3 -0.5e-3 -0.5e-3 -1.5e-3 -1.5e-3 -0.5e-3 -0.5e-3 0.5e-3 0.5e-3 1.5e-3 1.5e-3 0.5e-3
pa.vertices_y = 0.5e-3 1.5e-3 1.5e-3 0.5e-3 0.5e-3 -0.5e-3 -0.5e-3 -1.5e-3 -1.5e-3 -0.5e-3 -0.5e-3 0.5e-3 0.5e-3
pa.min_radius2 = 5.0e-7
pa.action = "absorb" # absorb particles within the polygon
pa.dx = 0.0006
pa.dy = -0.0012

###############################################################################
# Algorithms
###############################################################################
algo.space_charge = false


###############################################################################
# Diagnostics
###############################################################################
diag.slice_step_diagnostics = true
46 changes: 46 additions & 0 deletions examples/polygon_aperture/input_polygon_aperture_absorb_rotate.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
###############################################################################
# Particle Beam(s)
###############################################################################
beam.npart = 50000
beam.units = static
beam.kin_energy = 800.0
beam.charge = 1.0e-9
beam.particle = proton
beam.distribution = waterbag
beam.lambdaX = 2.0e-3
beam.lambdaY = beam.lambdaX
beam.lambdaT = 0.4
beam.lambdaPx = 4.0e-4
beam.lambdaPy = beam.lambdaPx
beam.lambdaPt = 2.0e-3
beam.muxpx = 0.0
beam.muypy = 0.0
beam.mutpt = 0.0


###############################################################################
# Beamline: lattice elements and segments
###############################################################################
lattice.elements = monitor pa monitor
lattice.nslice = 1

monitor.type = beam_monitor
monitor.backend = h5

pa.type = polygon_aperture
pa.vertices_x = 0.5e-3 0.5e-3 -0.5e-3 -0.5e-3 -1.5e-3 -1.5e-3 -0.5e-3 -0.5e-3 0.5e-3 0.5e-3 1.5e-3 1.5e-3 0.5e-3
pa.vertices_y = 0.5e-3 1.5e-3 1.5e-3 0.5e-3 0.5e-3 -0.5e-3 -0.5e-3 -1.5e-3 -1.5e-3 -0.5e-3 -0.5e-3 0.5e-3 0.5e-3
pa.min_radius2 = 5.0e-7
pa.action = "absorb" # absorb particles within the polygon
pa.rotation = 30.0 # degrees?

###############################################################################
# Algorithms
###############################################################################
algo.space_charge = false


###############################################################################
# Diagnostics
###############################################################################
diag.slice_step_diagnostics = true
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
###############################################################################
# Particle Beam(s)
###############################################################################
beam.npart = 50000
beam.units = static
beam.kin_energy = 800.0
beam.charge = 1.0e-9
beam.particle = proton
beam.distribution = waterbag
beam.lambdaX = 2.0e-3
beam.lambdaY = beam.lambdaX
beam.lambdaT = 0.4
beam.lambdaPx = 4.0e-4
beam.lambdaPy = beam.lambdaPx
beam.lambdaPt = 2.0e-3
beam.muxpx = 0.0
beam.muypy = 0.0
beam.mutpt = 0.0


###############################################################################
# Beamline: lattice elements and segments
###############################################################################
lattice.elements = monitor pa monitor
lattice.nslice = 1

monitor.type = beam_monitor
monitor.backend = h5

pa.type = polygon_aperture
pa.vertices_x = 0.5e-3 0.5e-3 -0.5e-3 -0.5e-3 -1.5e-3 -1.5e-3 -0.5e-3 -0.5e-3 0.5e-3 0.5e-3 1.5e-3 1.5e-3 0.5e-3
pa.vertices_y = 0.5e-3 1.5e-3 1.5e-3 0.5e-3 0.5e-3 -0.5e-3 -0.5e-3 -1.5e-3 -1.5e-3 -0.5e-3 -0.5e-3 0.5e-3 0.5e-3
pa.min_radius2 = 5.0e-7
pa.action = "absorb" # absorb particles within the polygon
pa.rotation = 30.0 # degrees?
pa.dx = 0.0006
pa.dy = -0.0012
###############################################################################
# Algorithms
###############################################################################
algo.space_charge = false


###############################################################################
# Diagnostics
###############################################################################
diag.slice_step_diagnostics = true
2 changes: 2 additions & 0 deletions src/elements/All.H
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "Multipole.H"
#include "NonlinearLens.H"
#include "PlaneXYRot.H"
#include "PolygonAperture.H"
#include "Programmable.H"
#include "PRot.H"
#include "Quad.H"
Expand Down Expand Up @@ -76,6 +77,7 @@ namespace impactx::elements
Multipole,
NonlinearLens,
PlaneXYRot,
PolygonAperture,
Programmable,
PRot,
Quad,
Expand Down
1 change: 1 addition & 0 deletions src/elements/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
target_sources(lib
PRIVATE
Aperture.cpp
PolygonAperture.cpp
Programmable.cpp
Source.cpp
)
Expand Down
Loading
Loading