You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bx=k1*np.sin(kx_x) *sinhy*cosz# // here kx is only real
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 the np.cos(kz_z) part in By, but not to the np.sin(kz_z) part in Bz.
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.
The text was updated successfully, but these errors were encountered:
Hi,
1. Both sets of formulas are correct. However, one should not forget that, in reality, the field in the horizontal direction should decay; for that, $k_x$ must be an imaginary number. In that case, we have $\cosh(i x) = \cos(x)$. For the $B_x$ component, it is a bit different. We have originally:
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.
2. Regarding the issue with $\sin(k_z z)$, it seems you are right. This shift also has to be in the $B_z$ field. Thanks for the tip.
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.
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:In the code this is written:
But, from S. Reiche's thesis, Eq. (2.1), I get:
See here:
ocelot/ocelot/cpbd/elements/undulator_atom.py
Line 124 in 39bda26
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.
end_poles
parameter, a phase shift is introduced:np.cos(kz_z + ph_shift)
.However, this phase shift is only applied to the
np.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.
The text was updated successfully, but these errors were encountered: