Open delaossa opened 9 hours ago
Hi,
$$ B_x = B_0 \frac{k_x}{k_y} \sin(k_x x) ...., $$
which will transform to:
$$ B_x = B_0 \frac{i k_x}{k_y} \sinh(i k_x x)... = -B_0 \frac{k_x}{k_y} \sin(k_x x)... $$
As you can see, now we have the same formulas as in Ocelot. By the way, apparently I tried to provide a hint (to myself) with the comment "# // here kx is only real.". I will include an explanation in the doc string.
I see you submitted a PR, so you have a choice: either you modify your PR and remove the changes regarding point 1 and leave the changes regarding point 2, or I can do it. Please let me know.
Cheers, Sergey.
Hi Sergey,
Oh I see! I missed that... Thanks a lot for the explanation!
About the PR, I only did it so one could see better the issue by comparing the two versions. I think that it is better if you take care of point 2. I am not very satisfied how the phase shift is implemented anyway...
Hello,
I have been revising the
UndulatorAtom
class and have noticed that there seems to be a couple of inconsistencies:The general expression for the magnetic field seems to be wrong. In the code this is written:
But, from S. Reiche's thesis, Eq. (2.1), I get:
See here: https://github.com/ocelot-collab/ocelot/blob/39bda2607853c23abee02cde31521d8b4186c0c6/ocelot/cpbd/elements/undulator_atom.py#L124 In this piece of code
kx
is always set to zero and, in this case, the two expressions yield the same result. However, for consistency, I think that this should be fixed.Depending on the
end_poles
parameter, a phase shift is introduced:np.cos(kz_z + ph_shift)
. However, this phase shift is only applied to thenp.cos(kz_z)
part inBy
, but not to thenp.sin(kz_z)
part inBz
. This would certainly lead to a wrong focusing effect when using the RK method.Perhaps is easier to explain the issue through this PR #262.