12 #include <boost/math/special_functions/ellint_1.hpp>
13 #include <boost/math/special_functions/ellint_2.hpp>
27 Vector2D rzField = multiCoilField(rzPos, m_scale);
33 xyzField += rDir * rzField[0];
41 return getField(position);
45 return multiCoilField(position, m_scale);
50 return getField(position);
56 return getField(position);
63 for (
size_t coil = 0; coil < m_cfg.nCoils; coil++) {
65 Vector2D(pos[0], pos[1] + m_cfg.length * 0.5 - m_dz * (coil + 0.5));
66 resultField += singleCoilField(shiftedPos, scale);
74 return {B_r(pos, scale), B_z(pos, scale)};
82 using boost::math::ellint_1;
87 using boost::math::ellint_2;
103 double k_2 =
k2(r, z);
104 double k = std::sqrt(k_2);
106 scale * k * z / (4 *
M_PI * std::sqrt(m_cfg.radius * r * r * r));
108 double B = (2. - k_2) / (2. - 2. * k_2) * ellint_2(k_2) - ellint_1(k_2);
111 return r / pos[0] * constant *
B;
119 using boost::math::ellint_1;
124 using boost::math::ellint_2;
137 double res = scale / 2. * m_R2 / (std::sqrt(m_R2 + z * z) * (m_R2 + z *
z));
141 double k_2 =
k2(r, z);
142 double k = std::sqrt(k_2);
143 double constant = scale * k / (4 *
M_PI * std::sqrt(m_cfg.radius * r));
144 double B = ((m_cfg.radius +
r) * k_2 - 2. * r) / (2. * r * (1. - k_2)) *
156 return 4 * m_cfg.radius * r /
157 ((m_cfg.radius +
r) * (m_cfg.radius + r) + z *
z);