% GKLmagnet2.m: magnetic profile for TWO ring magnets. % This code simulates the magnetic field on the z-axis of % two concentric solenoidal superconducting magnets of specified % size for use in the 140GHz Gyroklystron (GKL) experiment, MIT. % With two coils, it's possible to have one large region that % meets the tolerance spec, otherwise two fields are created which % may not meet spec. If the field is not continuous (one field) % to within spec, the varialbe 'flag' is set to unity (otherwise 0), % and a warning is displayed. % % run GKLmagnet2 % % Last edit by Colin Joye, 7/10/03 clear all; opengl autoselect; % -------------- USER INPUT ------------------------- Bmax = 5.12; %[Telsa] maximum magnetic field in uniform region Tol = 0.3; %[%] percent homogeneity of uniform region % Magnet size. The magnet is a finite-length finite-thickness hollow cylinder % modeled as a single turn rectangular cross-section current density. % The magnet is centered at z=0, extending 'Length'/2 above and below z=0. RadIn = 15; %[cm] inner radius of coil RadOut = 18; %[cm] outer radius of coil Length = 6; %[cm] coil length Separ = 18.0; %[cm] center separation distance > Length zaxis = 30; %[cm] length above z=0 to view the field profile % -------------- End USER INPUT --------------------- % extra user constants: transparency = 0.25; % controls transparency of slices & patches. '= 1.0' is opaque. cyl_frac = 0.74; % azimuthal fraction of cylinder to plot. '= 1.0' for full cyl. % check if length is larger than separation. if(Separ