Skip to content

Commit

Permalink
Document benchmark example.
Browse files Browse the repository at this point in the history
  • Loading branch information
cemitch99 committed Jan 16, 2025
1 parent aea693a commit d67f273
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions examples/aperture/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -154,3 +154,57 @@ We run the following script to analyze correctness:
.. literalinclude:: analysis_absorber.py
:language: python3
:caption: You can copy this file from ``examples/aperture/analysis_absorber.py``.


.. _examples-aperture-thick:

Aperture Collimation for a Thick Element
=========================================

Proton beam in a drift, undergoing collimation by a rectangular boundary aperture.

We use a 250 MeV proton beam with a horizontal rms beam size of 1.56 mm and a vertical rms beam size of 2.21 mm.

The beam is scraped by a 1 mm x 1.5 mm rectangular aperture. For this test, the parameter nslice = 1, so application at the aperture boundary is equivalent to using a thin aperture element located at the exit of the drift.

In this test, the initial values of :math:`\sigma_x`, :math:`\sigma_y`, :math:`\sigma_t`, :math:`\epsilon_x`, :math:`\epsilon_y`, and :math:`\epsilon_t` must>
The test fails if:

* any of the final coordinates for the valid (not lost) particles lie outside the aperture boundary or
* any of the lost particles are inside the aperture boundary or
* if the sum of lost and kept particles is not equal to the initial particles or
* if the recorded position :math:`s` for the lost particles does not coincide with the drift distance.


Run
---

This example can be run as a Python script (``python3 run_aperture_thick.py``) or with an app with an input file (``impactx input_aperture_thick.in``).
Each can also be prefixed with an `MPI executor <https://www.mpi-forum.org>`__, such as ``mpiexec -n 4 ...`` or ``srun -n 4 ...``, depending on the system.

.. tab-set::

.. tab-item:: Python Script

.. literalinclude:: run_aperture_thick.py
:language: python3
:caption: You can copy this file from ``examples/aperture/run_aperture_thick.py``.

.. tab-item:: App Input File

.. literalinclude:: input_aperture_thick.in
:language: ini
:caption: You can copy this file from ``examples/aperture/input_aperture_thick.in``.


Analyze
-------

We run the following script to analyze correctness:

.. dropdown:: Script ``analysis_aperture_thick.py``

.. literalinclude:: analysis_aperture_thick.py
:language: python3
:caption: You can copy this file from ``examples/aperture/analysis_aperture_thick.py``.

0 comments on commit d67f273

Please sign in to comment.