(* 
This notebook attempts to duplicate Dan's dissertation anti-helmholtz coils. The formula was derived using the Biot-Savart Law. 

"The circular coils were 6.2” in diameter 
and each was wound from 202 turns of 24 gauge...

After winding, the coils measured 8.7 Ω and 2 
mH each...

At a typical operating current of 3 A, the coils yielded a gradient of 11 G/cm along the symmetry 
axis of the coils... 

Although the coils generated 80 W of heat, they remained cold to the 
touch with 10◦ C water ﬂowing through the forms at 10 gallons/hour."

*)

(* Definitions *)
in = 2.54cm;
cm = 0.01m;
T = 10000G;

(* Constants *)
μ0 = 4Pi 10^-7 T m/A;

(* Variables *)
RequiredGradient = 11G/cm;
RCoil = 6.2in/2;
Separation = 3in;

(* Calculate the B field along the axis of symmetry. This field is in the z direction. The quantity "CurrentTurns" is what this calculation aims to determine, which depends only on geometery and the RequiredGradient, which we will then use to find wire diameter, turns, etc *)

Clear[z,CurrentTurns]

B =μ0 CurrentTurns (RCoil/m)^2 (1/m)/2(((RCoil/m)^2+(z-Separation/(2 m))^2)^(-3/2)-((RCoil/m)^2+(z+Separation/(2 m))^2)^(-3/2));

BGradient = D[B,z]/m;

z=0;
CurrentTurns = (CurrentTurns/.Solve[A BGradient==  RequiredGradient ,CurrentTurns][[1]])A;
Clear[z];

{"CurrentTurns"CurrentTurns/A,

Plot[B/G,{z,-2RCoil/m,2RCoil/m},AxesLabel->{"x (m)","B (G)"},ImageSize->Small],

Plot[BGradient m/G/100,{z,-2RCoil/m,2RCoil/m},AxesLabel->{"x (m)","dB/dz (G/cm)"},ImageSize->Small]}

(* Now that we have a figure for CurrentTurns, we may find wire parameters that will produce it with reasonable Ohmic losses and size *)

(* Definitions and Constants *)
Ω = Watts/A^2 ;
ρ = 1.68 10^-8 Ω m; (* for copper *)
PackingRatio = 0.9069;
AWG = {.2893(*1*),.2576,.2294,.2043,.1819,.162,.1443,.1285,.1144,.1019 (*10*),.0907,.0808,.072,.0641,.0571,.0508,.0453,.0403,.0359,.032(*20*),.0285,.0254,.0226,.0201,.0179(*25*),.0159,.0142,.0126,.0113,.01} (*inches*);

Clear[WireDiameter,Current]

(* Calculate the power losses *)
Turns = CurrentTurns/(Current A);
WireLength = 2 RCoil Pi Turns;
WireArea = Pi (WireDiameter in)^2/4;
Resistance = ρ WireLength/WireArea;
Voltage = Current A Resistance; (* Voltage is independent of Current! *)
PowerLoss = Current A Voltage;

(* And the dimensions of the coil, assuming square cross section with hexagonal closest packing *)
CoilArea = Turns WireArea/PackingRatio;
CoilWidth =Simplify[CoilArea^(1/2),m>0];

Animate[
Evaluate[
{{Current "A",WireDiameter "in"},{Turns "turns",WireLength, Voltage "V"A/Watts,PowerLoss,CoilWidth"cm"100/m}}
],
{Current,1,10},{WireDiameter,AWG},AnimationRunning->False]

(* This simulation recreates Dan's coils extremely well, right down to the wire gauge, therefore it should be a good model to use for the new Strontium coils *)