Skip to content

Commit b81732b

Browse files
committed
Add support for nonzero ds to app input.
1 parent a1c2d80 commit b81732b

File tree

4 files changed

+8
-1
lines changed

4 files changed

+8
-1
lines changed

docs/source/usage/parameters.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,7 @@ Lattice Elements
363363

364364
* ``<element_name>.R(i,j)`` (``float``, ...) matrix entries
365365
a 1-indexed, 6x6, linear transport map to multiply with the the phase space vector :math:`x,px,y,py,t,pt`.
366+
* ``<element_name>.ds`` (``float``, in meters) length associated with a user-defined linear element (defaults to 0)
366367
* ``<element_name>.dx`` (``float``, in meters) horizontal translation error
367368
* ``<element_name>.dy`` (``float``, in meters) vertical translation error
368369
* ``<element_name>.rotation`` (``float``, in degrees) rotation error in the transverse plane

docs/source/usage/python.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -624,6 +624,7 @@ This module provides elements for the accelerator lattice.
624624
up to the user to ensure that the matrix :math:`R` is symplectic. Otherwise, this condition may be violated.
625625

626626
:param R: a linear transport map to multiply with the the phase space vector :math:`(x,px,y,py,t,pt)`.
627+
:param ds: length associated with a user-defined linear element (defaults to 0), in m
627628
:param dx: horizontal translation error in m
628629
:param dy: vertical translation error in m
629630
:param rotation: rotation error in the transverse plane [degrees]

examples/fodo_userdef/input_fodo_userdef.in

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ monitor.type = beam_monitor
2828
monitor.backend = h5
2929

3030
drift1.type = linear_map
31+
drift1.ds = 0.25
3132
drift1.R12 = 0.25 # ds
3233
drift1.R34 = 0.25 # ds
3334
drift1.R56 = 0.25 / 16.6464 # ds / (beta*gamma^2)
@@ -37,6 +38,7 @@ quad1.ds = 1.0
3738
quad1.k = 1.0
3839

3940
drift2.type = linear_map
41+
drift2.ds = 0.5
4042
drift2.R12 = 0.5 # ds
4143
drift2.R34 = 0.5 # ds
4244
drift2.R56 = 0.5 / 16.6464 # ds / (beta*gamma^2)

src/initialization/InitElement.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,6 +462,9 @@ namespace detail
462462
{
463463
auto a = detail::query_alignment(pp_element);
464464

465+
amrex::ParticleReal ds = 0.0;
466+
pp_element.queryAdd("ds", ds);
467+
465468
elements::LinearTransport::Map6x6 transport_map = elements::LinearTransport::Map6x6::Identity();
466469

467470
// safe to ParmParse inputs for reproducibility
@@ -472,7 +475,7 @@ namespace detail
472475
}
473476
}
474477

475-
m_lattice.emplace_back(LinearMap(transport_map, a["dx"], a["dy"], a["rotation_degree"]) );
478+
m_lattice.emplace_back(LinearMap(transport_map, ds, a["dx"], a["dy"], a["rotation_degree"]) );
476479
} else {
477480
amrex::Abort("Unknown type for lattice element " + element_name + ": " + element_type);
478481
}

0 commit comments

Comments
 (0)