From 563bb1c1114e95d6731276c6833e5290fa718fcc Mon Sep 17 00:00:00 2001 From: Chad Mitchell Date: Tue, 7 Jun 2022 15:47:07 -0700 Subject: [PATCH 1/9] Examples for 3D space charge benchmarking - Modified the initial beam size in the IOTA lens benchmark example. - Added 2 benchmarks of 3D space charge for initial testing. - Add documentation for 2 benchmarks with space charge. - Add a benchmark example with space charge and periodic s-dependent focusing. - Added an s-dependent example using a Kurth beam without space charge. - Modified tolerance for IOTA lens benchmark example. Reduced tolerance to account for smaller initial beam size and improved preservation of invariants of motion. - Modified tolerances of space charge examples to allow CI tests to pass when space charge is not active. - Modified tolerance for space charge examples. These should fail unless space charge is turned on. --- examples/kurth/input_kurth_10nC.in | 37 ++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 examples/kurth/input_kurth_10nC.in diff --git a/examples/kurth/input_kurth_10nC.in b/examples/kurth/input_kurth_10nC.in new file mode 100644 index 000000000..be1a3611d --- /dev/null +++ b/examples/kurth/input_kurth_10nC.in @@ -0,0 +1,37 @@ +############################################################################### +# Particle Beam(s) +############################################################################### +beam.npart = 10000 +beam.units = static +beam.energy = 2.0e3 +beam.charge = 1.0e-8 +beam.particle = proton +beam.distribution = kurth6d +beam.sigmaX = 1.2154443728379865788e-3 +beam.sigmaY = 1.2154443728379865788e-3 +beam.sigmaT = 4.0956844276541331005e-4 +beam.sigmaPx = 8.2274435782286157175e-4 +beam.sigmaPy = 8.2274435782286157175e-4 +beam.sigmaPt = 2.4415943602685364584e-3 + + +############################################################################### +# Beamline: lattice elements and segments +############################################################################### +lattice.elements = constf1 + +constf1.type = constf +constf1.ds = 2.0 +constf1.kx = 1.0 +constf1.ky = 1.0 +constf1.kt = 1.0 + + +############################################################################### +# Algorithms +############################################################################### +algo.particle_shape = 2 +algo.space_charge = true + +amr.n_cell = 40 40 32 +geometry.prob_relative = 1.0 From ff21b61b20823612e41547d4d4d5b669659ba3bd Mon Sep 17 00:00:00 2001 From: Chad Mitchell <46825199+cemitch99@users.noreply.github.com> Date: Mon, 5 Dec 2022 15:14:50 -0800 Subject: [PATCH 2/9] Update input_kurth_10nC.in Selected numerical values for amr.n_cell, lattice.nslice, and geometry.prob_relative. --- examples/kurth/input_kurth_10nC.in | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/examples/kurth/input_kurth_10nC.in b/examples/kurth/input_kurth_10nC.in index be1a3611d..6349bfdda 100644 --- a/examples/kurth/input_kurth_10nC.in +++ b/examples/kurth/input_kurth_10nC.in @@ -2,6 +2,7 @@ # Particle Beam(s) ############################################################################### beam.npart = 10000 +#beam.npart = 100000 #optional for increased precision beam.units = static beam.energy = 2.0e3 beam.charge = 1.0e-8 @@ -19,6 +20,8 @@ beam.sigmaPt = 2.4415943602685364584e-3 # Beamline: lattice elements and segments ############################################################################### lattice.elements = constf1 +lattice.nslice = 50 +#lattice.nslice = 100 #optional for increased precision constf1.type = constf constf1.ds = 2.0 @@ -33,5 +36,6 @@ constf1.kt = 1.0 algo.particle_shape = 2 algo.space_charge = true -amr.n_cell = 40 40 32 +amr.n_cell = 48 48 40 +#amr.n_cell = 72 72 72 #optional for increased precision geometry.prob_relative = 1.0 From 222adfad5d3536d534249d0ed62a07a07c334ce3 Mon Sep 17 00:00:00 2001 From: Chad Mitchell Date: Tue, 16 Apr 2024 14:25:02 -0700 Subject: [PATCH 3/9] Add README documentation for examples/distgen --- examples/distgen/README.rst | 263 ++++++++++++++++++++++++++++++++++++ 1 file changed, 263 insertions(+) create mode 100644 examples/distgen/README.rst diff --git a/examples/distgen/README.rst b/examples/distgen/README.rst new file mode 100644 index 000000000..c5642e011 --- /dev/null +++ b/examples/distgen/README.rst @@ -0,0 +1,263 @@ + +Generation of beam distributions +================================= + +The following examples are tests of beam initialization for distributions of various types. + +In each example, we use a 2 GeV electron beam with initial unnormalized rms emittance of 2 nm. + +The matched Twiss parameters are the same as those used in the FODO example: + +* :math:`\beta_\mathrm{x} = 2.82161941` m +* :math:`\alpha_\mathrm{x} = -1.59050035` +* :math:`\beta_\mathrm{y} = 2.82161941` m +* :math:`\alpha_\mathrm{y} = 1.59050035` + +The second moments of the particle distribution after the FODO cell should coincide with the second moments of the particle distribution before the FODO cell, to within the level expected due to noise due to statistical sampling. + +In this test, the initial and final values of :math:`\lambda_x`, :math:`\lambda_y`, :math:`\lambda_t`, :math:`\epsilon_x`, :math:`\epsilon_y`, and :math:`\epsilon_t` must agree with nominal values. + + +.. _examples-gaussian: + +A 6d Gaussian distribution +============================ + +A Gaussian distribution in all 6 phase space variables. + +In this test, the initial and final values of :math:`\lambda_x`, :math:`\lambda_y`, :math:`\lambda_t`, :math:`\epsilon_x`, :math:`\epsilon_y`, and :math:`\epsilon_t` must agree wi> + + +Run +--- + +This example can be run **either** as: + +* **Python** script: ``python3 run_gaussian.py`` or +* ImpactX **executable** using an input file: ``impactx input_gaussian.in`` + +For `MPI-parallel `__ runs, prefix these lines with ``mpiexec -n 4 ...`` or ``srun -n 4 ...``, depending on the system. + +.. tab-set:: + + .. tab-item:: Python: Script + + .. literalinclude:: run_gaussian.py + :language: python3 + :caption: You can copy this file from ``examples/distgen/run_gaussian.py``. + + .. tab-item:: Executable: Input File + + .. literalinclude:: input_gaussian.in + :language: ini + :caption: You can copy this file from ``examples/distgen/input_gaussian.in``. + + +Analyze +------- + +We run the following script to analyze correctness: + +.. dropdown:: Script ``analysis_gaussian.py`` + + .. literalinclude:: analysis_gaussian.py + :language: python3 + :caption: You can copy this file from ``examples/distgen/analysis_gaussian.py``. + + + +.. _examples-kvdist: + +A Kapchinskij-Vladimirskij (K-V) distribution +=============================================== + +A 4D K-V distribution in the transverse phase space variables ( + a longitudinally uniform distribution in t + a Gaussian distribution in p_t ). + +In this test, the initial and final values of :math:`\lambda_x`, :math:`\lambda_y`, :math:`\lambda_t`, :math:`\epsilon_x`, :math:`\epsilon_y`, and :math:`\epsilon_t` must agree wi> + + +Run +--- + +This example can be run **either** as: + +* **Python** script: ``python3 run_kvdist.py`` or +* ImpactX **executable** using an input file: ``impactx input_kvdist.in`` + +For `MPI-parallel `__ runs, prefix these lines with ``mpiexec -n 4 ...`` or ``srun -n 4 ...``, depending on the system. + +.. tab-set:: + + .. tab-item:: Python: Script + + .. literalinclude:: run_kvdist.py + :language: python3 + :caption: You can copy this file from ``examples/distgen/run_kvdist.py``. + + .. tab-item:: Executable: Input File + + .. literalinclude:: input_kvdist.in + :language: ini + :caption: You can copy this file from ``examples/distgen/input_kvdist.in``. + + +Analyze +------- + +We run the following script to analyze correctness: + +.. dropdown:: Script ``analysis_kvdist.py`` + + .. literalinclude:: analysis_kvdist.py + :language: python3 + :caption: You can copy this file from ``examples/distgen/analysis_kvdist.py``. + + + + +.. _examples-kvdist_from_twiss: + +A K-V distribution initialized from Twiss functions +====================================================== + +Identical to the previous example (examples-kvdist), but initialized using Courant-Snyder Twiss functions. + +In this test, the initial and final values of :math:`\lambda_x`, :math:`\lambda_y`, :math:`\lambda_t`, :math:`\epsilon_x`, :math:`\epsilon_y`, and :math:`\epsilon_t` must agree wi> + + +Run +--- + +This example can be run **either** as: + +* **Python** script: ``python3 run_kvdist_from_twiss.py`` or +* ImpactX **executable** using an input file: ``impactx input_kvdist_from_twiss.in`` + +For `MPI-parallel `__ runs, prefix these lines with ``mpiexec -n 4 ...`` or ``srun -n 4 ...``, depending on the system. + +.. tab-set:: + + .. tab-item:: Python: Script + + .. literalinclude:: run_kvdist_from_twiss.py + :language: python3 + :caption: You can copy this file from ``examples/distgen/run_kvdist_from_twiss.py``. + + .. tab-item:: Executable: Input File + + .. literalinclude:: input_kvdist_from_twiss.in + :language: ini + :caption: You can copy this file from ``examples/distgen/input_kvdist_from_twiss.in``. + + +Analyze +------- + +We run the following script to analyze correctness: + +.. dropdown:: Script ``analysis_kvdist_from_twiss.py`` + + .. literalinclude:: analysis_kvdist_from_twiss.py + :language: python3 + :caption: You can copy this file from ``examples/distgen/analysis_kvdist_from_twiss.py``. + + + + +.. _examples-kurth4d: + +A 4D Kurth Distribution +============================ + +A 4D Kurth distribution in the transverse phase space variables ( + a longitudinally uniform distribution in t + a Gaussian distribution in p_t ). + + +In this test, the initial and final values of :math:`\lambda_x`, :math:`\lambda_y`, :math:`\lambda_t`, :math:`\epsilon_x`, :math:`\epsilon_y`, and :math:`\epsilon_t` must agree wi> + + +Run +--- + +This example can be run **either** as: + +* **Python** script: ``python3 run_kurth4d.py`` or +* ImpactX **executable** using an input file: ``impactx input_kurth4d.in`` + +For `MPI-parallel `__ runs, prefix these lines with ``mpiexec -n 4 ...`` or ``srun -n 4 ...``, depending on the system. + +.. tab-set:: + + .. tab-item:: Python: Script + + .. literalinclude:: run_kurth4d.py + :language: python3 + :caption: You can copy this file from ``examples/distgen/run_kurth4d.py``. + + .. tab-item:: Executable: Input File + + .. literalinclude:: input_kurth4d.in + :language: ini + :caption: You can copy this file from ``examples/distgen/input_kurth4d.in``. + + +Analyze +------- + +We run the following script to analyze correctness: + +.. dropdown:: Script ``analysis_kurth4d.py`` + + .. literalinclude:: analysis_kurth4d.py + :language: python3 + :caption: You can copy this file from ``examples/distgen/analysis_kurth4d.py``. + + + + +.. _examples-semigaussian: + +A Semigaussian distribution +============================ + +A 6D semigaussian distribution (uniform in position, Gaussian in momentum). + +In this test, the initial and final values of :math:`\lambda_x`, :math:`\lambda_y`, :math:`\lambda_t`, :math:`\epsilon_x`, :math:`\epsilon_y`, and :math:`\epsilon_t` must agree wi> + + +Run +--- + +This example can be run **either** as: + +* **Python** script: ``python3 run_semigaussian.py`` or +* ImpactX **executable** using an input file: ``impactx input_semigaussian.in`` + +For `MPI-parallel `__ runs, prefix these lines with ``mpiexec -n 4 ...`` or ``srun -n 4 ...``, depending on the system. + +.. tab-set:: + + .. tab-item:: Python: Script + + .. literalinclude:: run_semigaussian.py + :language: python3 + :caption: You can copy this file from ``examples/distgen/run_semigaussian.py``. + + .. tab-item:: Executable: Input File + + .. literalinclude:: input_semigaussian.in + :language: ini + :caption: You can copy this file from ``examples/distgen/input_semigaussian.in``. + + +Analyze +------- + +We run the following script to analyze correctness: + +.. dropdown:: Script ``analysis_semigaussian.py`` + + .. literalinclude:: analysis_semigaussian.py + :language: python3 + :caption: You can copy this file from ``examples/distgen/analysis_semigaussian.py``. + + From 22feb49f434ef16970aa84f9081f23531879901a Mon Sep 17 00:00:00 2001 From: Chad Mitchell Date: Thu, 25 Apr 2024 19:21:18 -0700 Subject: [PATCH 4/9] Correct C++ input file. --- examples/chicane/input_chicane.in | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/examples/chicane/input_chicane.in b/examples/chicane/input_chicane.in index 57d11cf9e..430a1e944 100644 --- a/examples/chicane/input_chicane.in +++ b/examples/chicane/input_chicane.in @@ -26,15 +26,15 @@ lattice.elements = monitor sbend1 dipedge1 drift1 dipedge2 sbend2 drift2 \ lattice.nslice = 25 sbend1.type = sbend -sbend1.ds = 0.50037 # projected length 0.5 m, angle 2.77 deg -sbend1.rc = -10.35 +sbend1.ds = 0.500194828041958 # projected length 0.5 m, angle 2.77 deg +sbend1.rc = -10.3462283686195526 drift1.type = drift drift1.ds = 5.0058489435 # projected length 5 m sbend2.type = sbend -sbend2.ds = 0.50037 # projected length 0.5 m, angle 2.77 deg -sbend2.rc = 10.35 +sbend2.ds = 0.500194828041958 # projected length 0.5 m, angle 2.77 deg +sbend2.rc = 10.3462283686195526 drift2.type = drift drift2.ds = 1.0 @@ -44,13 +44,13 @@ drift3.ds = 2.0 dipedge1.type = dipedge # dipole edge focusing dipedge1.psi = -0.048345620280243 -dipedge1.rc = -10.35 +dipedge1.rc = -10.3462283686195526 dipedge1.g = 0.0 dipedge1.K2 = 0.0 dipedge2.type = dipedge dipedge2.psi = 0.048345620280243 -dipedge2.rc = 10.35 +dipedge2.rc = 10.3462283686195526 dipedge2.g = 0.0 dipedge2.K2 = 0.0 From 4a97f7abf8644527e4968d5a663fa0398c9627a9 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 26 Apr 2024 02:24:45 +0000 Subject: [PATCH 5/9] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- examples/distgen/README.rst | 2 -- 1 file changed, 2 deletions(-) diff --git a/examples/distgen/README.rst b/examples/distgen/README.rst index c5642e011..b25d83b5d 100644 --- a/examples/distgen/README.rst +++ b/examples/distgen/README.rst @@ -259,5 +259,3 @@ We run the following script to analyze correctness: .. literalinclude:: analysis_semigaussian.py :language: python3 :caption: You can copy this file from ``examples/distgen/analysis_semigaussian.py``. - - From 63dca746e31728c5c8e599f5b4117e227d92c0c3 Mon Sep 17 00:00:00 2001 From: Chad Mitchell <46825199+cemitch99@users.noreply.github.com> Date: Thu, 25 Apr 2024 19:25:09 -0700 Subject: [PATCH 6/9] Delete examples/kurth/input_kurth_10nC.in Not part of this pr --- examples/kurth/input_kurth_10nC.in | 41 ------------------------------ 1 file changed, 41 deletions(-) delete mode 100644 examples/kurth/input_kurth_10nC.in diff --git a/examples/kurth/input_kurth_10nC.in b/examples/kurth/input_kurth_10nC.in deleted file mode 100644 index 6349bfdda..000000000 --- a/examples/kurth/input_kurth_10nC.in +++ /dev/null @@ -1,41 +0,0 @@ -############################################################################### -# Particle Beam(s) -############################################################################### -beam.npart = 10000 -#beam.npart = 100000 #optional for increased precision -beam.units = static -beam.energy = 2.0e3 -beam.charge = 1.0e-8 -beam.particle = proton -beam.distribution = kurth6d -beam.sigmaX = 1.2154443728379865788e-3 -beam.sigmaY = 1.2154443728379865788e-3 -beam.sigmaT = 4.0956844276541331005e-4 -beam.sigmaPx = 8.2274435782286157175e-4 -beam.sigmaPy = 8.2274435782286157175e-4 -beam.sigmaPt = 2.4415943602685364584e-3 - - -############################################################################### -# Beamline: lattice elements and segments -############################################################################### -lattice.elements = constf1 -lattice.nslice = 50 -#lattice.nslice = 100 #optional for increased precision - -constf1.type = constf -constf1.ds = 2.0 -constf1.kx = 1.0 -constf1.ky = 1.0 -constf1.kt = 1.0 - - -############################################################################### -# Algorithms -############################################################################### -algo.particle_shape = 2 -algo.space_charge = true - -amr.n_cell = 48 48 40 -#amr.n_cell = 72 72 72 #optional for increased precision -geometry.prob_relative = 1.0 From ba1bc6a7137c3aed968b8dd4e1608e672abaf843 Mon Sep 17 00:00:00 2001 From: Chad Mitchell Date: Fri, 26 Apr 2024 08:51:19 -0700 Subject: [PATCH 7/9] Modify Python and MAD-X input --- examples/chicane/chicane.madx | 8 ++++---- examples/chicane/run_chicane.py | 7 ++++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/examples/chicane/chicane.madx b/examples/chicane/chicane.madx index 7f29aa65e..42e100040 100644 --- a/examples/chicane/chicane.madx +++ b/examples/chicane/chicane.madx @@ -8,11 +8,11 @@ D3: drift, L=2.0; ! theta=0.50037/10.35; ! inv_rho=1.0/10.35 ! TODO put `angle=theta` for SBENDs and `e1=theta` for DIPEDGEs with their right sign -SB1: sbend, L=0.50037, angle=-0.04834492753623188, e1=0.000, e2=0.000, k1=0.00; -SB2: sbend, L=0.50037, angle=0.04834492753623188, e1=0.000, e2=0.000, k1=0.00; +SB1: sbend, L=0.500194828041958, angle=-0.04834492753623188, e1=0.000, e2=0.000, k1=0.00; +SB2: sbend, L=0.500194828041958, angle=0.04834492753623188, e1=0.000, e2=0.000, k1=0.00; ! dipole edge elements -DIPE1: dipedge, H=-0.0966183574879227, e1=-0.048345620280243, fint=0.000, hgap=0.000, tilt=0.00; -DIPE2: dipedge, H=0.0966183574879227, e1=0.048345620280243, fint=0.000, hgap=0.000, tilt=0.00; +DIPE1: dipedge, H=-0.096653578905433, e1=-0.048345620280243, fint=0.000, hgap=0.000, tilt=0.00; +DIPE2: dipedge, H=0.096653578905433, e1=0.048345620280243, fint=0.000, hgap=0.000, tilt=0.00; CHICANE: Line=(M1,SB1,DIPE1,D1,DIPE2,SB2,D2,SB2,DIPE2,D1,DIPE1,SB1,D3,M1); USE, SEQUENCE = CHICANE; diff --git a/examples/chicane/run_chicane.py b/examples/chicane/run_chicane.py index a061b33e7..b0b5ed585 100644 --- a/examples/chicane/run_chicane.py +++ b/examples/chicane/run_chicane.py @@ -48,8 +48,9 @@ # design the accelerator lattice ns = 25 # number of slices per ds in the element -rc = 10.35 # bend radius (meters) +rc = 10.3462283686195526 # bend radius (meters) psi = 0.048345620280243 # pole face rotation angle (radians) +lb = 0.500194828041958 # projected bend length (meters) # Drift elements dr1 = elements.Drift(ds=5.0058489435, nslice=ns) @@ -57,8 +58,8 @@ dr3 = elements.Drift(ds=2.0, nslice=ns) # Bend elements -sbend1 = elements.Sbend(ds=0.50037, rc=-rc, nslice=ns) -sbend2 = elements.Sbend(ds=0.50037, rc=rc, nslice=ns) +sbend1 = elements.Sbend(ds=lb, rc=-rc, nslice=ns) +sbend2 = elements.Sbend(ds=lb, rc=rc, nslice=ns) # Dipole Edge Focusing elements dipedge1 = elements.DipEdge(psi=-psi, rc=-rc, g=0.0, K2=0.0) From 65fd47b5b23d92ef7a8ad44509308ef461ea72a3 Mon Sep 17 00:00:00 2001 From: Chad Mitchell <46825199+cemitch99@users.noreply.github.com> Date: Fri, 26 Apr 2024 08:54:37 -0700 Subject: [PATCH 8/9] Delete examples/distgen/README.rst Not part of this PR. --- examples/distgen/README.rst | 261 ------------------------------------ 1 file changed, 261 deletions(-) delete mode 100644 examples/distgen/README.rst diff --git a/examples/distgen/README.rst b/examples/distgen/README.rst deleted file mode 100644 index b25d83b5d..000000000 --- a/examples/distgen/README.rst +++ /dev/null @@ -1,261 +0,0 @@ - -Generation of beam distributions -================================= - -The following examples are tests of beam initialization for distributions of various types. - -In each example, we use a 2 GeV electron beam with initial unnormalized rms emittance of 2 nm. - -The matched Twiss parameters are the same as those used in the FODO example: - -* :math:`\beta_\mathrm{x} = 2.82161941` m -* :math:`\alpha_\mathrm{x} = -1.59050035` -* :math:`\beta_\mathrm{y} = 2.82161941` m -* :math:`\alpha_\mathrm{y} = 1.59050035` - -The second moments of the particle distribution after the FODO cell should coincide with the second moments of the particle distribution before the FODO cell, to within the level expected due to noise due to statistical sampling. - -In this test, the initial and final values of :math:`\lambda_x`, :math:`\lambda_y`, :math:`\lambda_t`, :math:`\epsilon_x`, :math:`\epsilon_y`, and :math:`\epsilon_t` must agree with nominal values. - - -.. _examples-gaussian: - -A 6d Gaussian distribution -============================ - -A Gaussian distribution in all 6 phase space variables. - -In this test, the initial and final values of :math:`\lambda_x`, :math:`\lambda_y`, :math:`\lambda_t`, :math:`\epsilon_x`, :math:`\epsilon_y`, and :math:`\epsilon_t` must agree wi> - - -Run ---- - -This example can be run **either** as: - -* **Python** script: ``python3 run_gaussian.py`` or -* ImpactX **executable** using an input file: ``impactx input_gaussian.in`` - -For `MPI-parallel `__ runs, prefix these lines with ``mpiexec -n 4 ...`` or ``srun -n 4 ...``, depending on the system. - -.. tab-set:: - - .. tab-item:: Python: Script - - .. literalinclude:: run_gaussian.py - :language: python3 - :caption: You can copy this file from ``examples/distgen/run_gaussian.py``. - - .. tab-item:: Executable: Input File - - .. literalinclude:: input_gaussian.in - :language: ini - :caption: You can copy this file from ``examples/distgen/input_gaussian.in``. - - -Analyze -------- - -We run the following script to analyze correctness: - -.. dropdown:: Script ``analysis_gaussian.py`` - - .. literalinclude:: analysis_gaussian.py - :language: python3 - :caption: You can copy this file from ``examples/distgen/analysis_gaussian.py``. - - - -.. _examples-kvdist: - -A Kapchinskij-Vladimirskij (K-V) distribution -=============================================== - -A 4D K-V distribution in the transverse phase space variables ( + a longitudinally uniform distribution in t + a Gaussian distribution in p_t ). - -In this test, the initial and final values of :math:`\lambda_x`, :math:`\lambda_y`, :math:`\lambda_t`, :math:`\epsilon_x`, :math:`\epsilon_y`, and :math:`\epsilon_t` must agree wi> - - -Run ---- - -This example can be run **either** as: - -* **Python** script: ``python3 run_kvdist.py`` or -* ImpactX **executable** using an input file: ``impactx input_kvdist.in`` - -For `MPI-parallel `__ runs, prefix these lines with ``mpiexec -n 4 ...`` or ``srun -n 4 ...``, depending on the system. - -.. tab-set:: - - .. tab-item:: Python: Script - - .. literalinclude:: run_kvdist.py - :language: python3 - :caption: You can copy this file from ``examples/distgen/run_kvdist.py``. - - .. tab-item:: Executable: Input File - - .. literalinclude:: input_kvdist.in - :language: ini - :caption: You can copy this file from ``examples/distgen/input_kvdist.in``. - - -Analyze -------- - -We run the following script to analyze correctness: - -.. dropdown:: Script ``analysis_kvdist.py`` - - .. literalinclude:: analysis_kvdist.py - :language: python3 - :caption: You can copy this file from ``examples/distgen/analysis_kvdist.py``. - - - - -.. _examples-kvdist_from_twiss: - -A K-V distribution initialized from Twiss functions -====================================================== - -Identical to the previous example (examples-kvdist), but initialized using Courant-Snyder Twiss functions. - -In this test, the initial and final values of :math:`\lambda_x`, :math:`\lambda_y`, :math:`\lambda_t`, :math:`\epsilon_x`, :math:`\epsilon_y`, and :math:`\epsilon_t` must agree wi> - - -Run ---- - -This example can be run **either** as: - -* **Python** script: ``python3 run_kvdist_from_twiss.py`` or -* ImpactX **executable** using an input file: ``impactx input_kvdist_from_twiss.in`` - -For `MPI-parallel `__ runs, prefix these lines with ``mpiexec -n 4 ...`` or ``srun -n 4 ...``, depending on the system. - -.. tab-set:: - - .. tab-item:: Python: Script - - .. literalinclude:: run_kvdist_from_twiss.py - :language: python3 - :caption: You can copy this file from ``examples/distgen/run_kvdist_from_twiss.py``. - - .. tab-item:: Executable: Input File - - .. literalinclude:: input_kvdist_from_twiss.in - :language: ini - :caption: You can copy this file from ``examples/distgen/input_kvdist_from_twiss.in``. - - -Analyze -------- - -We run the following script to analyze correctness: - -.. dropdown:: Script ``analysis_kvdist_from_twiss.py`` - - .. literalinclude:: analysis_kvdist_from_twiss.py - :language: python3 - :caption: You can copy this file from ``examples/distgen/analysis_kvdist_from_twiss.py``. - - - - -.. _examples-kurth4d: - -A 4D Kurth Distribution -============================ - -A 4D Kurth distribution in the transverse phase space variables ( + a longitudinally uniform distribution in t + a Gaussian distribution in p_t ). - - -In this test, the initial and final values of :math:`\lambda_x`, :math:`\lambda_y`, :math:`\lambda_t`, :math:`\epsilon_x`, :math:`\epsilon_y`, and :math:`\epsilon_t` must agree wi> - - -Run ---- - -This example can be run **either** as: - -* **Python** script: ``python3 run_kurth4d.py`` or -* ImpactX **executable** using an input file: ``impactx input_kurth4d.in`` - -For `MPI-parallel `__ runs, prefix these lines with ``mpiexec -n 4 ...`` or ``srun -n 4 ...``, depending on the system. - -.. tab-set:: - - .. tab-item:: Python: Script - - .. literalinclude:: run_kurth4d.py - :language: python3 - :caption: You can copy this file from ``examples/distgen/run_kurth4d.py``. - - .. tab-item:: Executable: Input File - - .. literalinclude:: input_kurth4d.in - :language: ini - :caption: You can copy this file from ``examples/distgen/input_kurth4d.in``. - - -Analyze -------- - -We run the following script to analyze correctness: - -.. dropdown:: Script ``analysis_kurth4d.py`` - - .. literalinclude:: analysis_kurth4d.py - :language: python3 - :caption: You can copy this file from ``examples/distgen/analysis_kurth4d.py``. - - - - -.. _examples-semigaussian: - -A Semigaussian distribution -============================ - -A 6D semigaussian distribution (uniform in position, Gaussian in momentum). - -In this test, the initial and final values of :math:`\lambda_x`, :math:`\lambda_y`, :math:`\lambda_t`, :math:`\epsilon_x`, :math:`\epsilon_y`, and :math:`\epsilon_t` must agree wi> - - -Run ---- - -This example can be run **either** as: - -* **Python** script: ``python3 run_semigaussian.py`` or -* ImpactX **executable** using an input file: ``impactx input_semigaussian.in`` - -For `MPI-parallel `__ runs, prefix these lines with ``mpiexec -n 4 ...`` or ``srun -n 4 ...``, depending on the system. - -.. tab-set:: - - .. tab-item:: Python: Script - - .. literalinclude:: run_semigaussian.py - :language: python3 - :caption: You can copy this file from ``examples/distgen/run_semigaussian.py``. - - .. tab-item:: Executable: Input File - - .. literalinclude:: input_semigaussian.in - :language: ini - :caption: You can copy this file from ``examples/distgen/input_semigaussian.in``. - - -Analyze -------- - -We run the following script to analyze correctness: - -.. dropdown:: Script ``analysis_semigaussian.py`` - - .. literalinclude:: analysis_semigaussian.py - :language: python3 - :caption: You can copy this file from ``examples/distgen/analysis_semigaussian.py``. From 97428c55510768506c2d4a1e9ee4d2141744ae9d Mon Sep 17 00:00:00 2001 From: Chad Mitchell <46825199+cemitch99@users.noreply.github.com> Date: Fri, 26 Apr 2024 09:53:16 -0700 Subject: [PATCH 9/9] Update run_chicane.py Update lb comment. --- examples/chicane/run_chicane.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/chicane/run_chicane.py b/examples/chicane/run_chicane.py index b0b5ed585..10ff072eb 100644 --- a/examples/chicane/run_chicane.py +++ b/examples/chicane/run_chicane.py @@ -50,7 +50,7 @@ ns = 25 # number of slices per ds in the element rc = 10.3462283686195526 # bend radius (meters) psi = 0.048345620280243 # pole face rotation angle (radians) -lb = 0.500194828041958 # projected bend length (meters) +lb = 0.500194828041958 # bend arc length (meters) # Drift elements dr1 = elements.Drift(ds=5.0058489435, nslice=ns)