From f0c5c2e6ac9ec5b9ecff7bbdaf5d27dbffd3b780 Mon Sep 17 00:00:00 2001 From: ncarmignani Date: Fri, 24 Mar 2023 15:51:23 +0100 Subject: [PATCH 1/3] blgrowth separated from BunchLength --- .../LongitudinalDynamics/BunchLength.m | 24 +---------------- .../atphysics/LongitudinalDynamics/blgrowth.m | 27 +++++++++++++++++++ 2 files changed, 28 insertions(+), 23 deletions(-) create mode 100644 atmat/atphysics/LongitudinalDynamics/blgrowth.m diff --git a/atmat/atphysics/LongitudinalDynamics/BunchLength.m b/atmat/atphysics/LongitudinalDynamics/BunchLength.m index dabdeee5a..fa9246bff 100755 --- a/atmat/atphysics/LongitudinalDynamics/BunchLength.m +++ b/atmat/atphysics/LongitudinalDynamics/BunchLength.m @@ -15,7 +15,7 @@ % sigmadelta is the energy spread % circ is the ring circumference % -% see also: atBunchLength +% see also: atBunchLength, blgrowth blg = abs(blgrowth(Ib,Zn,Vrf,U0,E0,h,alpha,sigdelta)); phi=pi - asin(U0./Vrf); @@ -24,26 +24,4 @@ BL = zcBL .* blg; end -function blg = blgrowth(Ib,Zn,Vrf,U0,E0,h,alpha,sigdelta) -% bunch lengthening factor due to the potential well effect - -% Ib is the bunch current [A] (it may be a vector for multiple values) -% Zn is the longitudinal broadband impedance [Ohms] -% Vrf is the RF voltage [V] (it may be a vector for multiple values) -% U0 is the energy loss around the ring [eV] -% h is the harmonic number -% alpha is the momentum compaction factor -% sigmadelta is the energy spread - -phi=pi - asin(U0./Vrf); -nus= sqrt(-(Vrf/E0).*(h * alpha)/(2*pi) .* cos(phi)); - -Delta = -(2*pi*Ib*Zn)./(Vrf*h.*cos(phi).*(alpha*sigdelta./nus).^3); -Q=Delta/(4*sqrt(pi)); - - - -blg = (2/3)^(1/3)./(9*Q + sqrt(3)*sqrt(-4+27*Q.^2)).^(1/3)... - + (9*Q + sqrt(3)*sqrt(-4+27*Q.^2)).^(1/3)./(2^(1/3)*3^(2/3)); -end diff --git a/atmat/atphysics/LongitudinalDynamics/blgrowth.m b/atmat/atphysics/LongitudinalDynamics/blgrowth.m new file mode 100644 index 000000000..e9ee38c47 --- /dev/null +++ b/atmat/atphysics/LongitudinalDynamics/blgrowth.m @@ -0,0 +1,27 @@ +function blg = blgrowth(Ib,Zn,Vrf,U0,E0,h,alpha,sigdelta) +% blg = blgrowth(Ib,Zn,Vrf,U0,E0,h,alpha,sigdelta) +% +% bunch lengthening factor due to the potential well effect +% +% Ib is the bunch current [A] (it may be a vector for multiple values) +% Zn is the longitudinal broadband impedance [Ohms] +% Vrf is the RF voltage [V] (it may be a vector for multiple values) +% U0 is the energy loss around the ring [eV] +% h is the harmonic number +% alpha is the momentum compaction factor +% sigmadelta is the energy spread +% +% see also: atBunchLength, BunchLength +% + +phi=pi - asin(U0./Vrf); +nus= sqrt(-(Vrf/E0).*(h * alpha)/(2*pi) .* cos(phi)); + +Delta = -(2*pi*Ib*Zn)./(Vrf*h.*cos(phi).*(alpha*sigdelta./nus).^3); +Q=Delta/(4*sqrt(pi)); + + + +blg = (2/3)^(1/3)./(9*Q + sqrt(3)*sqrt(-4+27*Q.^2)).^(1/3)... + + (9*Q + sqrt(3)*sqrt(-4+27*Q.^2)).^(1/3)./(2^(1/3)*3^(2/3)); +end From c4956f55f63b581ca9a2fac0d95142a161a81fb4 Mon Sep 17 00:00:00 2001 From: ncarmignani Date: Fri, 24 Mar 2023 15:53:20 +0100 Subject: [PATCH 2/3] atBunchLength uses atx in case the ring is 6D --- .../LongitudinalDynamics/atBunchLength.m | 25 +++++++++++++------ 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/atmat/atphysics/LongitudinalDynamics/atBunchLength.m b/atmat/atphysics/LongitudinalDynamics/atBunchLength.m index 5a4f79cc0..9b1d9ed95 100755 --- a/atmat/atphysics/LongitudinalDynamics/atBunchLength.m +++ b/atmat/atphysics/LongitudinalDynamics/atBunchLength.m @@ -9,14 +9,25 @@ % ring is the at ring without radiation % BL is the bunch length in metres % -% see also: BunchLength +% see also: BunchLength, blgrowth -rp=ringpara(ring); -[E0,~,Vrf,h,U0]=atenergy(ring); -alpha=rp.alphac; -sigdelta=rp.sigma_E; +is6d=check_6d(ring); circ=findspos(ring,length(ring)+1); -BL = BunchLength(Ib,Zn,Vrf,U0,E0,h,alpha,sigdelta,circ); - +if ~is6d + [E0,~,Vrf,h,U0]=atenergy(ring); + rp=ringpara(ring); + alpha=rp.alphac; + sigdelta=rp.sigma_E; + BL = BunchLength(Ib,Zn,Vrf,U0,E0,h,alpha,sigdelta,circ); +else + [~,ringdata]=atx(ring,1); + [~,~,Vrf,h]=atenergy(ring); + alpha = ringdata.alpha; + E0 = ringdata.energy; + U0 = ringdata.eloss; + sigdelta = ringdata.espread; + bl0 = ringdata.blength; + BL = bl0 * blgrowth(Ib,Zn,Vrf,U0,E0,h,alpha,sigdelta); +end end From fa84464be62fce3271d14909f1fcc647560bd9bd Mon Sep 17 00:00:00 2001 From: ncarmignani Date: Fri, 24 Mar 2023 15:59:48 +0100 Subject: [PATCH 3/3] help of atBunchLength updated --- atmat/atphysics/LongitudinalDynamics/atBunchLength.m | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/atmat/atphysics/LongitudinalDynamics/atBunchLength.m b/atmat/atphysics/LongitudinalDynamics/atBunchLength.m index 9b1d9ed95..d94e6fd70 100755 --- a/atmat/atphysics/LongitudinalDynamics/atBunchLength.m +++ b/atmat/atphysics/LongitudinalDynamics/atBunchLength.m @@ -6,7 +6,8 @@ % % Ib is the bunch current [A] (it may be a vector for multiple values) % Zn is the longitudinal broadband impedance [Ohms] -% ring is the at ring without radiation +% ring is the at lattice (4D or 6D) +% % BL is the bunch length in metres % % see also: BunchLength, blgrowth