SPS PUMPING PORT.  MBB-MBB

There are four sets of simulations
       1) MBB - MBB  No shielding
       2) MBB - MBB With shielding. With RF contacts
       3) MBB - MBB With shielding. No RF contacts
       4) MBB - MBB With shielding. With wire i.e. The shieldings are connected with a thin wire - in order to make sure that they are not floating.
       
 The types of signals are:
   WakeMon0.sig  :   Wake potential X
   WakeMon1.sig  :   Wake potential Y
   WakeMon2.sig  :   Wake potential Z
   
   WakeImpXAm.sig : Wake impedance X. Amplitude
   WakeImpXRe.sig :  Wake impedance X. Real part
   WakeImpXIm.sig :  Wake impedance X. Imaginary part

Needs["PlotLegends`"]

Select Wake Potential or Impedance:
                                        X,Y or Z    i.e. HOR, VER and longitudinal

Wake="WakeMon0.sig"; (* X, i.e. vertical wake potential *)
Wake="WakeMon1.sig"; (* Y, i.e. vertical wake potential *)
Wake="WakeMon2.sig"; (* Z i.e. vertical wake potential *)
Wake="WakeImpXAm.sig"; (* Impedance X Amplitude *)
Wake="WakeImpYAm.sig"; (* Impedance Y Amplitude *)
Wake="WakeImpZAm.sig"; (* Impedance Z Amplitude *)
Wake="WakeImpXRe.sig"; (* Impedance X Real part *)
Wake="WakeImpYRe.sig"; (* Impedance Y Real part *)
Wake="WakeImpZRe.sig"; (* Impedance Z Real part *)
Wake="WakeImpXIm.sig"; (* Impedance X Imaginary part *)
Wake="WakeImpYIm.sig"; (* Impedance Y Imaginary part *)
Wake="WakeImpZIm.sig"; (* Impedance Z Imaginary part *)

Wake="WakeMon2.sig"; (* Impedance Amplitude Z *)

Select Main, Quadrupolar or Dipolar fields :
                                        main, xQuad10, xDip10, yQuad10, yDip10

Signal=""; (* Both the beam particle and the observation particles are in the center *)
Signal="xDip10"; (* The beam particle is moved away from the center - in the x direction - while the observation particle is still in the center *)
Signal="xQuad10"; (* The beam particle is moved away from the center - in the x direction - while the observation particle is still in the center *)
Signal="yDip10"; (* The beam particle is moved away from the center - in the x direction - while the observation particle is still in the center *)
Signal="yQuad10"; (* The beam particle is moved away from the center - in the x direction - while the observation particle is still in the center *)

Signal=""; (* The beam particle is moved away from the center - in the x direction - while the observation particle is still in the center *)

Initializations

Clear[FileNameNoShielding,FileNameWithShieldingWithRF,FileNameWithShieldingWithRFWithR,FileNameWithShieldingNoRF,FileNameWithShieldingWithWire]

FileNameNoShielding="G:\\Departments\\AB\\Groups\\dropbox\\berrig\\SPS_pumping_port\\MBB_MBB_noshielding\\MBBMBB"<> Signal<>"\\Result\\_ParticleBeam1_"<> Wake;FileNameWithShieldingWithRF="G:\\Departments\\AB\\Groups\\dropbox\\berrig\\SPS_pumping_port\\MBB_MBB_shielding_withRFcontacts\\MBBMBBshielding_withRFcontacts"<> Signal<>"\\Result\\_ParticleBeam1_"<> Wake;
FileNameWithShieldingWithRFWithR="G:\\Departments\\AB\\Groups\\dropbox\\berrig\\SPS_pumping_port\\MBB_MBB_shielding_withRFcontacts_withR\\MBBMBBshielding_withRFcontacts_withR3560"<> Signal<>"\\Result\\_ParticleBeam1_"<> Wake;FileNameWithShieldingNoRF="G:\\Departments\\AB\\Groups\\dropbox\\berrig\\SPS_pumping_port\\MBB_MBB_shielding_noRFcontacts\\MBBMBBshieldingnoRFcontacts"<> Signal<>"\\Result\\_ParticleBeam1_"<> Wake;
FileNameWithShieldingWithWire="G:\\Departments\\AB\\Groups\\dropbox\\berrig\\SPS_pumping_port\\MBB_MBB_shielding_withWire\\MBBMBBshieldingWithWire"<> Signal<>"\\Result\\_ParticleBeam1_"<> Wake;

FileNameNoShielding

Clear[PlotNoShielding,PlotWithShieldingWithRF,PlotWithShieldingWithRFWithR,PlotWithShieldingNoRF,  PlotWithShieldingWithWire]
Clear[WakeNoShield,WakeWithShieldWithRF,WakeWithShieldWithRFWithR,WakeWithShieldingNoRF, WakeWithShieldingWithWire]

If[StringCount[Wake,"Mon"]>0,LabelForAxes={"s/mm","WI(s)/(V/pC)"},If[StringCount[Wake,"Imp"]>0,LabelForAxes={"Frequency/GHz","Z/Ohm"}],Text["Problem"];CheckAbort[Abort[];,Interrupt[];Abort[];Pause[100];]]

If[Wake=="WakeMon0.sig",Headline="Wake Potential X   "<>Signal;,
If[Wake=="WakeMon1.sig",Headline="Wake Potential Y   "<>Signal;,
If[Wake=="WakeMon2.sig",Headline="Wake Potential Z   "<>Signal;,
If[Wake=="WakeImpXAm.sig",Headline="Wake Impedance Amplitude X   "<>Signal;,
If[Wake=="WakeImpYAm.sig",Headline="Wake Impedance Amplitude Y   "<>Signal;,
If[Wake=="WakeImpZAm.sig",Headline="Wake Impedance Amplitude Z   "<>Signal;,
If[Wake=="WakeImpXRe.sig",Headline="Wake Impedance Real part of X   "<>Signal;,
If[Wake=="WakeImpYRe.sig",Headline="Wake Impedance Real part of Y   "<>Signal;,
If[Wake=="WakeImpZRe.sig",Headline="Wake Impedance Real part of Z   "<>Signal;,
If[Wake=="WakeImpXIm.sig",Headline="Wake Impedance Imaginary part of X   "<>Signal;,
If[Wake=="WakeImpYIm.sig",Headline="Wake Impedance Imaginary part of Y   "<>Signal;,
If[Wake=="WakeImpZIm.sig",Headline="Wake Impedance Imaginary part of Z   "<>Signal;,
Headline="";]]]]]]]]]]]]

legend=Graphics[Legend[{
{Graphics[{Thickness[0.1],Red,Line[{{0,0},{1,0}}]}],"NoShielding"},
{Graphics[{Thickness[0.1],Green,Line[{{0,0},{1,0}}]}],"WithShieldingWithRF"},
{Graphics[{Thickness[0.1],Black,Line[{{0,0},{1,0}}]}],"WithShieldingWithRF_withR"},
{Graphics[{Thickness[0.1],Orange,Line[{{0,0},{1,0}}]}],"WithShieldingNoRF"},
{Graphics[{Thickness[0.1],Magenta,Line[{{0,0},{1,0}}]}],"WithShieldingWithWire"}},
LegendShadow->None,LegendSpacing->-0.4],ImageSize->180]

If[Headline=="",CellPrint[TextCell["Error!!!!!   Wake ="<>Wake<>"  is not correctly selected","Title",Background->Hue[0.6,0.6,1]]],CellPrint[TextCell["Get "<>Headline,"Title",Background->Hue[0.6,0.6,1]]];];

Get Wake Potential Z

If[Headline=="",CheckAbort[Abort[];,Interrupt[];Abort[];Pause[100];]]

No shielding

FileNameNoShielding

WakeNoShield=Import[FileNameNoShielding,"Table"];

{L1=Length[WakeNoShield],WakeNoShield[[2]]}

WakeNoShield[[L1]]

PlotNoShielding=ListLinePlot[ WakeNoShield[[Range[5,L1]]],ColorFunction->Function[{x,y},Red],Filling->Axis,FillingStyle->LightRed,Frame->True,FrameLabel->LabelForAxes,PlotStyle->{Thick},PlotRange->Full];

With shielding. With RF contacts

FileNameWithShieldingWithRF

WakeWithShieldWithRF=Import[FileNameWithShieldingWithRF,"Table"];

{L2=Length[WakeWithShieldWithRF],WakeWithShieldWithRF[[2]]}

WakeWithShieldWithRF[[L2]]

PlotWithShieldingWithRF=ListLinePlot[ WakeWithShieldWithRF[[Range[5,L2]]],ColorFunction->Function[{x,y},Green],(*Filling->Axis,FillingStyle->LightGreen,*)Frame->True,FrameLabel->LabelForAxes,PlotStyle->{Thick},PlotRange->Full];

With shielding. With RF contacts_withR

FileNameWithShieldingWithRFWithR

WakeWithShieldWithRFWithR=Import[FileNameWithShieldingWithRFWithR,"Table"];

{L7=Length[WakeWithShieldWithRFWithR],WakeWithShieldWithRFWithR[[2]]}

WakeWithShieldWithRFWithR[[L7]]

PlotWithShieldingWithRFWithR=ListLinePlot[ WakeWithShieldWithRFWithR[[Range[5,L7]]],ColorFunction->Function[{x,y},Black],(*Filling->Axis,FillingStyle->Gray,*)Frame->True,FrameLabel->LabelForAxes,PlotStyle->{Thick},PlotRange->Full];

With shielding. No RF contacts

FileNameWithShieldingNoRF

WakeWithShieldingNoRF=Import[FileNameWithShieldingNoRF,"Table"];

{L3=Length[WakeWithShieldingNoRF],WakeWithShieldingNoRF[[2]]}

WakeWithShieldingNoRF[[L3]]

PlotWithShieldingNoRF=ListLinePlot[ WakeWithShieldingNoRF[[Range[5,L3]]],ColorFunction->Function[{x,y},Orange],Filling->Axis,FillingStyle->LightOrange,Frame->True,FrameLabel->LabelForAxes,PlotStyle->{Thick},PlotRange->Full];

With shielding. With wire

FileNameWithShieldingWithWire

WakeWithShieldingWithWire=Import[FileNameWithShieldingWithWire,"Table"];

{L4=Length[WakeWithShieldingWithWire],WakeWithShieldingWithWire[[2]]}

WakeWithShieldingWithWire[[L4]]

PlotWithShieldingWithWire=ListLinePlot[ WakeWithShieldingWithWire[[Range[5,L4]]],ColorFunction->Function[{x,y},Magenta],Filling->Axis,FillingStyle->LightMagenta,Frame->True,FrameLabel->LabelForAxes,PlotStyle->{Thick},PlotRange->Full];

CellPrint[TextCell["Plot "<>Headline,"Subtitle",Background->Hue[0.6,0.6,1]]];

Plot Wake Potential Z

Show[PlotNoShielding,PlotWithShieldingWithRF,PlotWithShieldingWithRFWithR,PlotWithShieldingNoRF,PlotWithShieldingWithWire,(* PlotRange->{{0,30000},Automatic},*)Epilog->Inset[legend,{Right,Top},{Right,Top}]]

Initializations for comparizons of contact resistance

Clear[FileNameWithShieldingWithRFWithR∞,FileNameWithShieldingWithRFWithR35600,FileNameWithShieldingWithRFWithR3560]

FileNameWithShieldingWithRFWithR∞="G:\\Departments\\AB\\Groups\\dropbox\\berrig\\SPS_pumping_port\\MBB_MBB_shielding_withRFcontacts_withR\\MBBMBBshielding_withRFcontacts_withR"<> Signal<>"\\Result\\_ParticleBeam1_"<> Wake;
FileNameWithShieldingWithRFWithR35600="G:\\Departments\\AB\\Groups\\dropbox\\berrig\\SPS_pumping_port\\MBB_MBB_shielding_withRFcontacts_withR\\MBBMBBshielding_withRFcontacts_withR35600"<> Signal<>"\\Result\\_ParticleBeam1_"<> Wake;
FileNameWithShieldingWithRFWithR3560="G:\\Departments\\AB\\Groups\\dropbox\\berrig\\SPS_pumping_port\\MBB_MBB_shielding_withRFcontacts_withR\\MBBMBBshielding_withRFcontacts_withR3560"<> Signal<>"\\Result\\_ParticleBeam1_"<> Wake;
FileNameWithShieldingWithRFWithR356="G:\\Departments\\AB\\Groups\\dropbox\\berrig\\SPS_pumping_port\\MBB_MBB_shielding_withRFcontacts_withR\\MBBMBBshielding_withRFcontacts_withR356"<> Signal<>"\\Result\\_ParticleBeam1_"<> Wake;

Clear[PlotWithShieldingWithRFWithR∞,PlotWithShieldingWithRFWithR36500,PlotWithShieldingWithRFWithR3650,PlotWithShieldingWithRFWithR365]
Clear[WakeWithShieldWithRFWithR∞,WakeWithShieldWithRFWithR36500,WakeWithShieldWithRFWithR3650,WakeWithShieldWithRFWithR365]

legendR=Graphics[Legend[{
{Graphics[{Thickness[0.1],ColorData["HTML"]["DarkRed"],Line[{{0,0},{1,0}}]}],"σ∞"},
{Graphics[{Thickness[0.1],ColorData["HTML"]["BlueViolet"],Line[{{0,0},{1,0}}]}],"σ35600"},
{Graphics[{Thickness[0.1],ColorData["HTML"]["Fuchsia"],Line[{{0,0},{1,0}}]}],"σ3560"},
{Graphics[{Thickness[0.1],ColorData["HTML"]["Chartreuse"],Line[{{0,0},{1,0}}]}],"σ356"}},
LegendShadow->None,LegendSpacing->-0.4],ImageSize->180]

If[Headline=="",CellPrint[TextCell["Error!!!!!   Wake ="<>Wake<>"  is not correctly selected","Title",Background->Hue[0.6,0.6,1]]],CellPrint[TextCell["Get "<>Headline,"Title",Background->Hue[0.6,0.6,1]]];];

Get Wake Potential Z

If[Headline=="",CheckAbort[Abort[];,Interrupt[];Abort[];Pause[100];]]

With shielding. With RF contacts_withR∞

σ=35600000000000;
l=0.001;
A=0.004*0.00155;
R=l/(A*σ); (* The resistance of one individual RF contact *)
NRFContacts=44; (* There are 44 individual RF contacts, that makes a connection between two pieces of pipe - 22 above and 22 below *)
RSet=R/NRFContacts; (* The RF contact resistance between two pieces of pipe *)
NSets=3; (* There are two inserts inside each SPS pumping port; corresponding to three sets *)
RTotal=RSet*NSets

FileNameWithShieldingWithRFWithR∞

WakeWithShieldWithRFWithR∞=Import[FileNameWithShieldingWithRFWithR,"Table"];

{L7=Length[WakeWithShieldWithRFWithR∞],WakeWithShieldWithRFWithR∞[[2]]}

WakeWithShieldWithRFWithR∞[[L7]]

PlotWithShieldingWithRFWithR∞=ListLinePlot[ WakeWithShieldWithRFWithR∞[[Range[5,L7]]],PlotStyle->ColorData["HTML"]["DarkRed"],(*Filling->Axis,FillingStyle->Gray,*)Frame->True,FrameLabel->LabelForAxes,PlotStyle->{Thick},PlotRange->Full];

With shielding. With RF contacts_withR35600

σ=35600;
l=0.001;
A=0.004*0.00155;
R=l/(A*σ); (* The resistance of one individual RF contact *)
NRFContacts=44; (* There are 44 individual RF contacts, that makes a connection between two pieces of pipe - 22 above and 22 below *)
RSet=R/NRFContacts; (* The RF contact resistance between two pieces of pipe *)
NSets=3; (* There are two inserts inside each SPS pumping port; corresponding to three sets *)
RTotal=RSet*NSets

FileNameWithShieldingWithRFWithR35600

WakeWithShieldWithRFWithR36500=Import[FileNameWithShieldingWithRFWithR35600,"Table"];

{L7=Length[WakeWithShieldWithRFWithR36500],WakeWithShieldWithRFWithR36500[[2]]}

WakeWithShieldWithRFWithR36500[[L7]]

PlotWithShieldingWithRFWithR36500=ListLinePlot[ WakeWithShieldWithRFWithR36500[[Range[5,L7]]],PlotStyle->ColorData["HTML"]["BlueViolet"],(*Filling->Axis,FillingStyle->Gray,*)Frame->True,FrameLabel->LabelForAxes,PlotStyle->{Thick},PlotRange->Full];

With shielding. With RF contacts_withR3560

σ=3560;
l=0.001;
A=0.004*0.00155;
R=l/(A*σ); (* The resistance of one individual RF contact *)
NRFContacts=44; (* There are 44 individual RF contacts, that makes a connection between two pieces of pipe - 22 above and 22 below *)
RSet=R/NRFContacts; (* The RF contact resistance between two pieces of pipe *)
NSets=3; (* There are two inserts inside each SPS pumping port; corresponding to three sets *)
RTotal=RSet*NSets

FileNameWithShieldingWithRFWithR3560

WakeWithShieldWithRFWithR3650=Import[FileNameWithShieldingWithRFWithR3560,"Table"];

{L7=Length[WakeWithShieldWithRFWithR3650],WakeWithShieldWithRFWithR3650[[2]]}

WakeWithShieldWithRFWithR3650[[L7]]

PlotWithShieldingWithRFWithR3650=ListLinePlot[ WakeWithShieldWithRFWithR3650[[Range[5,L7]]],PlotStyle->ColorData["HTML"]["Fuchsia"],(*Filling->Axis,FillingStyle->Gray,*)Frame->True,FrameLabel->LabelForAxes,PlotStyle->{Thick},PlotRange->Full];

With shielding. With RF contacts_withR356

σ=356;
l=0.001;
A=0.004*0.00155;
R=l/(A*σ); (* The resistance of one individual RF contact *)
NRFContacts=44; (* There are 44 individual RF contacts, that makes a connection between two pieces of pipe - 22 above and 22 below *)
RSet=R/NRFContacts; (* The RF contact resistance between two pieces of pipe *)
NSets=3; (* There are two inserts inside each SPS pumping port; corresponding to three sets *)
RTotal=RSet*NSets

FileNameWithShieldingWithRFWithR356

WakeWithShieldWithRFWithR365=Import[FileNameWithShieldingWithRFWithR356,"Table"];

{L7=Length[WakeWithShieldWithRFWithR365],WakeWithShieldWithRFWithR365[[2]]}

WakeWithShieldWithRFWithR365[[L7]]

PlotWithShieldingWithRFWithR365=ListLinePlot[ WakeWithShieldWithRFWithR365[[Range[5,L7]]],PlotStyle->ColorData["HTML"]["Chartreuse"],(*Filling->Axis,FillingStyle->Gray,*)Frame->True,FrameLabel->LabelForAxes,PlotStyle->{Thick},PlotRange->Full];

CellPrint[TextCell["Plot "<>Headline<>".   Effect of changing the resistance of RF contacts","Subtitle",Background->Hue[0.6,0.6,1]]]

Plot Wake Potential Z   .   Effect of changing the resistance of RF contacts

Show[PlotWithShieldingWithRFWithR∞,PlotWithShieldingWithRFWithR36500,PlotWithShieldingWithRFWithR3650,PlotWithShieldingWithRFWithR365,(*PlotRange->{{2500,3000},Automatic},*)Epilog->Inset[legendR,{Right,Top},{Right,Top}]]